File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ Cargo.lock
2626
2727# temporary files
2828* .bin
29+ * .arm.s
2930* .as
3031a.out
3132
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3- ASM_FILE=$1
3+ ARCH=$1
4+ ASM_FILE=$2
45PLATFORM=" "
56LD_FLAGS=" "
67BENCHMARKING=" true" # "true" to enable
7- QEMU=" qemu-riscv64 "
8+ QEMU=" "
89
9- if [[ -z " $ASM_FILE " ]]; then
10- echo " Error: Assembly (.S) file is not passed in ."
11- echo " Usage: ./run.sh test_binary_translate_add.S "
10+ if [[ -z " $ARCH " || -z " $ ASM_FILE" ]]; then
11+ echo " Error: Architecture and assembly (.S) file must be provided ."
12+ echo " Usage: ./run.sh [riscv|arm] <assembly_file.S> "
1213 exit 1
1314fi
1415
15- if [[ " $OSTYPE " == " linux-gnu" * ]]; then
16- PLATFORM=" riscv64-unknown-linux-gnu-"
16+ if [[ " $ARCH " != " riscv" && " $ARCH " != " arm" ]]; then
17+ echo " Error: Architecture must be either 'riscv' or 'arm'."
18+ echo " Usage: ./run.sh [riscv|arm] <assembly_file.S>"
19+ exit 1
20+ fi
21+
22+ if [[ " $ARCH " == " riscv" ]]; then
23+ QEMU=" qemu-riscv64"
24+ if [[ " $OSTYPE " == " linux-gnu" * ]]; then
25+ PLATFORM=" riscv64-unknown-linux-gnu-"
26+ fi
27+ elif [[ " $ARCH " == " arm" ]]; then
28+ QEMU=" qemu-aarch64"
29+ if [[ " $OSTYPE " == " linux-gnu" * ]]; then
30+ PLATFORM=" aarch64-unknown-linux-gnu-"
31+ fi
1732fi
1833
1934if [[ " $OSTYPE " == " darwin" * ]]; then
@@ -30,3 +45,4 @@ echo "$?"
3045if [ " $BENCHMARKING " = true ]; then
3146 hyperfine -r 1000 -w 100 -Ni " " $QEMU " ./" $ASM_FILE " .bin"
3247fi
48+
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments