Skip to content

Commit 1127f55

Browse files
committed
test: improve benchmarking different architectures, remove arm asms
1 parent ee0e785 commit 1127f55

5 files changed

Lines changed: 24 additions & 119 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Cargo.lock
2626

2727
# temporary files
2828
*.bin
29+
*.arm.s
2930
*.as
3031
a.out
3132

run.sh

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,34 @@
11
#!/usr/bin/env bash
22

3-
ASM_FILE=$1
3+
ARCH=$1
4+
ASM_FILE=$2
45
PLATFORM=""
56
LD_FLAGS=""
67
BENCHMARKING="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
1314
fi
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
1732
fi
1833

1934
if [[ "$OSTYPE" == "darwin"* ]]; then
@@ -30,3 +45,4 @@ echo "$?"
3045
if [ "$BENCHMARKING" = true ]; then
3146
hyperfine -r 1000 -w 100 -Ni ""$QEMU" ./"$ASM_FILE".bin"
3247
fi
48+

tests/add/add.arm.s

Lines changed: 0 additions & 47 deletions
This file was deleted.

tests/echo/echo.arm.s

Lines changed: 0 additions & 29 deletions
This file was deleted.

tests/print/print.arm.s

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)