-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Repaired bugs on simulate and test scripts
- Loading branch information
1 parent
3df3508
commit 47e1fc7
Showing
4 changed files
with
52 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,5 +52,8 @@ analisador_semantico | |
# Debug status | ||
debug.y.output | ||
|
||
# Binary output files | ||
*.mips | ||
|
||
# Temp files | ||
*.swp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,40 @@ | ||
#!/bin/bash | ||
# Execute spim and put output to a file | ||
spim -f "$1" | tail -n +6 | head -n 10000 > "$2" | ||
|
||
# Show help usage | ||
if [ "$#" -eq "0" ] || [ "$#" -gt "2" ] | ||
then | ||
printf "Usage: \n\t./simulate.sh input output\n" | ||
exit 0 | ||
fi | ||
|
||
# Check if there are a input file | ||
if [ -z "$1" ] | ||
then | ||
echo "[ERROR] NOT SPECIFIED INPUT FILE!" | ||
exit 1 | ||
fi | ||
|
||
# Check if output file is specified | ||
if [ -z "$2" ] | ||
then | ||
echo "[ERROR] NOT SPECIFIED OUTPUT FILE!" | ||
exit 1 | ||
fi | ||
|
||
# Check if compiler exists and can be executed | ||
if [ -e "compilador" ] && [ -s "compilador" ] && [ -x "compilador" ] && [ -e "$1" ] | ||
then | ||
echo "Compiling and testing program..." | ||
else | ||
echo "[ERROR] COMPILER OR INPUT FILE DON'T EXIST, IS EMPTY OR CAN'T BE EXECUTABLE!" | ||
exit 1 | ||
fi | ||
|
||
# Execute compiler, generate mips code pass this to spim and put the output in a file | ||
( ./compilador "$1" "$2.mips" > /dev/null 2>&1 && \ | ||
spim -f "$2.mips" | tail -n +6 | head -n 10000 > "$2" ) || \ | ||
( echo "Failed to compile program" && exit 1 ) | ||
|
||
# Program simulated with success | ||
echo "Simulation Finished!" | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters