summaryrefslogtreecommitdiff
path: root/src/demo.sh
diff options
context:
space:
mode:
authorGabriel Kerneis2014-06-09 13:50:02 +0100
committerGabriel Kerneis2014-06-09 13:50:02 +0100
commit58e5682a99508e82941ad4b11bb0a07f532b5c8c (patch)
treef36a986c6740fd7b16b4ebff0901ede50eb9a639 /src/demo.sh
parent994f91de8d19b8923d51531bac6c0f2e01ff4a95 (diff)
Add explicit flag -r to rebuild in demo.sh
./demo.sh now jumps straight into the interpreter. ./demo.sh -r does the fancy "rebuild step-by-step with comments" show
Diffstat (limited to 'src/demo.sh')
-rwxr-xr-xsrc/demo.sh42
1 files changed, 32 insertions, 10 deletions
diff --git a/src/demo.sh b/src/demo.sh
index 7d883181..af737867 100755
--- a/src/demo.sh
+++ b/src/demo.sh
@@ -5,6 +5,8 @@ POWERISA="../../../rsem/idl/power"
# restricted set of instructions to translate
MNEMO="stwu,stw,mr,addi,lwz,bclr,or"
+REBUILD=0
+
run () {
printf "\n# $1\n"
printf "$ $2"
@@ -12,17 +14,37 @@ run () {
eval $2
}
-run "Building Sail" "ocamlbuild sail.native"
+while getopts ":r" opt; do
+ case $opt in
+ r)
+ REBUILD=1
+ ;;
+ \?)
+ echo "Invalid option: -$OPTARG" >&2
+ ;;
+ esac
+done
+
+rebuild () {
+ run "Building Sail" "ocamlbuild sail.native"
-run "Generating the Sail interpreter from Power ISA (restricted to: $MNEMO)" \
- "make -C $POWERISA clean extract EXPORT_MNEMO=$MNEMO"
+ run "Generating the Sail interpreter from Power ISA (restricted to: $MNEMO)" \
+ "make -C $POWERISA clean extract EXPORT_MNEMO=$MNEMO"
-run "Type-checking Sail Power model" "make -C $POWERISA check"
-run "Copying Power model locally to run tests" \
- "cp $POWERISA/generated/extract-full.sail test/power.sail"
-#git diff test/power.sail
+ run "Type-checking Sail Power model" "make -C $POWERISA check"
+ run "Copying Power model locally to run tests" \
+ "cp $POWERISA/generated/extract-full.sail test/power.sail"
+ #git diff test/power.sail
+
+ run "Translating Power model from Sail to OCaml via Lem" "ocamlbuild test/run_power.native"
+}
-run "Translating Power model from Sail to OCaml via Lem" "ocamlbuild test/run_power.native"
+DEMO="./run_power.native --interactive --file test/main.bin"
-run "Starting interactive interpreter (press 'h' for help)" \
- "./run_power.native --interactive --file test/main.bin"
+if [ $REBUILD -eq 1 ]; then
+ rebuild
+ run "Starting interactive interpreter (press 'h' for help)" \
+ "$DEMO"
+else
+ $DEMO
+fi