Skip to content

Commit dac31c1

Browse files
committed
test: add basic random tests for V extension
1 parent 4d6c71e commit dac31c1

File tree

5 files changed

+766
-2
lines changed

5 files changed

+766
-2
lines changed

ci-tests/generate-snippy-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ CONFIGDIR=$(dirname "$CONFIG")
1414
base=$(basename "$CONFIG" .yaml)
1515
elf="$base".elf
1616
./llvm-snippy "$CONFIG" -o "$elf" --seed 1 -mtriple="$TRIPLE" -march="$ARCH" -riscv-disable-misaligned-access
17-
riscv64-linux-gnu-gcc -O0 -march="$ARCH" -mabi="$ABI" -T "$elf".ld -T "$CONFIGDIR"/linker-entry.ld "$elf" "$BOOTCODE" -nostdlib -static -o "$RESULT"
17+
riscv64-linux-gnu-gcc -O0 -march="$ARCH" -mabi="$ABI" -T "$elf".ld -T "$CONFIGDIR"/linker-entry.ld "$elf" "$BOOTCODE" -nostdlib -static -o "$RESULT" -Wl,--build-id=none
1818

ci-tests/generate-snippy-tests.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,5 @@ generate_script=`git rev-parse --show-toplevel`/ci-tests/generate-snippy-test.sh
3535
"$generate_script" "$CONFIGDIR"/single-fp.yaml "$RESULTDIR"/float32.elf \
3636
"$CONFIGDIR"/boot-code-f.s riscv32-unknown-elf rv32if_zicsr ilp32f
3737

38+
"$generate_script" "$CONFIGDIR"/vector.yaml "$RESULTDIR"/vector64.elf \
39+
"$CONFIGDIR"/boot-code-vf.s riscv64-unknown-elf rv64gcv lp64d

ci-tests/run-snippy-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ SPIKE_PATH="$2"
88
error=0
99
for testfile in "$TESTDIR"/*; do
1010
bitness=$(basename "$testfile" .elf | grep -o "[0-9]\+")
11-
if ! timeout --foreground 5s "$SPIKE_PATH" -l --log-commits --isa rv"$bitness"ifdc_zicsr "$testfile"
11+
if ! timeout --foreground 5s "$SPIKE_PATH" -l --log-commits --isa rv"$bitness"ifdcv_zicsr "$testfile"
1212
then
1313
echo "TIMEOUT: $testfile"
1414
error=1
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
.option norvc
2+
3+
.global _entry
4+
.global fromhost
5+
.global tohost
6+
7+
.text
8+
_entry:
9+
la t0, exception_handler
10+
csrw mtvec, t0
11+
csrr t1, mstatus
12+
# Setting bit number 9 (mstatus.VS)
13+
li t2, 1
14+
slli t2, t2, 9
15+
or t1, t1, t2
16+
# Setting bit number 13 (mstatus.FS)
17+
li t3, 1
18+
slli t3, t3, 13
19+
or t1, t1, t3
20+
csrw mstatus, t1
21+
la t0, SNIPPY_ENTRY
22+
jalr t0
23+
24+
exception_handler:
25+
csrr x10, mcause
26+
# In case of breakpoint (Interrupt = 0, Exception code = 3) we finalize.
27+
# Otherwise it's not the expected behavior and we go into an infinite loop.
28+
li x11, 3
29+
beq x10, x11, exit
30+
j infinite_loop
31+
32+
exit:
33+
li ra, 1
34+
la sp, tohost
35+
sd ra, 0(sp)
36+
37+
infinite_loop:
38+
j infinite_loop
39+
40+
.balign 64
41+
tohost:
42+
.8byte 0x0
43+
.balign 64
44+
fromhost:
45+
.8byte 0x0

0 commit comments

Comments
 (0)