2016-04-08 10:08:23 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
|
|
|
|
|
|
|
## Generate test case
|
|
|
|
|
|
|
|
if ! test -f test.S; then
|
|
|
|
cd riscv-torture
|
|
|
|
./sbt generator/run
|
|
|
|
cp output/test.S ../test.S
|
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
## Compile test case and create reference
|
|
|
|
|
2016-04-08 16:28:30 -04:00
|
|
|
riscv32-unknown-elf-gcc -m32 -march=RV32IC -ffreestanding -nostdlib -Wl,-Bstatic,-T,sections.lds -o test.elf test.S
|
2016-04-08 10:08:23 -04:00
|
|
|
LD_LIBRARY_PATH="./riscv-isa-sim:./riscv-fesvr" ./riscv-isa-sim/spike test.elf > test.ref
|
|
|
|
riscv32-unknown-elf-objcopy -O binary test.elf test.bin
|
|
|
|
python3 ../../firmware/makehex.py test.bin 4096 > test.hex
|
|
|
|
|
|
|
|
|
|
|
|
## Run test
|
|
|
|
|
|
|
|
iverilog -o test.vvp testbench.v ../../picorv32.v
|
|
|
|
vvp test.vvp +hex=test.hex +ref=test.ref
|
|
|
|
|