diff --git a/scripts/tomthumbtestgen/.gitignore b/scripts/tomthumbtestgen/.gitignore deleted file mode 100644 index 0f06936..0000000 --- a/scripts/tomthumbtestgen/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -testbench -testgen.tgz -testgen -tests diff --git a/scripts/tomthumbtestgen/run.sh b/scripts/tomthumbtestgen/run.sh deleted file mode 100644 index e9c1fe5..0000000 --- a/scripts/tomthumbtestgen/run.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -set -ex - -if [ ! -f testgen.tgz ]; then - rm -f testgen.tgz.part - wget -O testgen.tgz.part http://maikmerten.de/testgen.tgz - mv testgen.tgz.part testgen.tgz -fi - -rm -rf tests testgen/ -tar xvzf testgen.tgz - -iverilog -o testbench -s testbench testbench.v ../../picorv32.v - -mkdir -p tests -for i in {0..999}; do - fn="tests/test_`printf '%03d' $i`" - - { - cat start.S - java -jar testgen/tomthumb-testgen-1.0-SNAPSHOT.jar - } > $fn.s - - riscv32-unknown-elf-gcc -ffreestanding -nostdlib -Wl,-Bstatic,-T,sections.lds -o $fn.elf $fn.s - riscv32-unknown-elf-objcopy -O binary $fn.elf $fn.bin - python3 ../../firmware/makehex.py $fn.bin 16384 > $fn.hex - vvp -N ./testbench +hex=tests/test_000.hex -done diff --git a/scripts/tomthumbtg/.gitignore b/scripts/tomthumbtg/.gitignore new file mode 100644 index 0000000..c1e6b04 --- /dev/null +++ b/scripts/tomthumbtg/.gitignore @@ -0,0 +1,15 @@ +testbench_a +testbench_b +testbench_c +testbench_d +testbench_e +testbench_f +testbench_g +testbench_h +testbench_i +testbench_j +testbench_k +testbench_l +testgen.tgz +testgen +tests diff --git a/scripts/tomthumbtestgen/README b/scripts/tomthumbtg/README similarity index 100% rename from scripts/tomthumbtestgen/README rename to scripts/tomthumbtg/README diff --git a/scripts/tomthumbtg/run.sh b/scripts/tomthumbtg/run.sh new file mode 100644 index 0000000..dcce6bd --- /dev/null +++ b/scripts/tomthumbtg/run.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +set -ex + +if [ ! -f testgen.tgz ]; then + rm -f testgen.tgz.part + wget -O testgen.tgz.part http://maikmerten.de/testgen.tgz + mv testgen.tgz.part testgen.tgz +fi + +rm -rf tests testgen/ +tar xvzf testgen.tgz + +iverilog -o testbench_a -s testbench testbench.v ../../picorv32.v -DTWO_STAGE_SHIFT=0 -DBARREL_SHIFTER=0 -DTWO_CYCLE_COMPARE=0 -DTWO_CYCLE_ALU=0 +iverilog -o testbench_b -s testbench testbench.v ../../picorv32.v -DTWO_STAGE_SHIFT=1 -DBARREL_SHIFTER=0 -DTWO_CYCLE_COMPARE=0 -DTWO_CYCLE_ALU=0 +iverilog -o testbench_c -s testbench testbench.v ../../picorv32.v -DTWO_STAGE_SHIFT=0 -DBARREL_SHIFTER=1 -DTWO_CYCLE_COMPARE=0 -DTWO_CYCLE_ALU=0 + +iverilog -o testbench_d -s testbench testbench.v ../../picorv32.v -DTWO_STAGE_SHIFT=0 -DBARREL_SHIFTER=0 -DTWO_CYCLE_COMPARE=1 -DTWO_CYCLE_ALU=0 +iverilog -o testbench_e -s testbench testbench.v ../../picorv32.v -DTWO_STAGE_SHIFT=1 -DBARREL_SHIFTER=0 -DTWO_CYCLE_COMPARE=1 -DTWO_CYCLE_ALU=0 +iverilog -o testbench_f -s testbench testbench.v ../../picorv32.v -DTWO_STAGE_SHIFT=0 -DBARREL_SHIFTER=1 -DTWO_CYCLE_COMPARE=1 -DTWO_CYCLE_ALU=0 + +iverilog -o testbench_g -s testbench testbench.v ../../picorv32.v -DTWO_STAGE_SHIFT=0 -DBARREL_SHIFTER=0 -DTWO_CYCLE_COMPARE=0 -DTWO_CYCLE_ALU=1 +iverilog -o testbench_h -s testbench testbench.v ../../picorv32.v -DTWO_STAGE_SHIFT=1 -DBARREL_SHIFTER=0 -DTWO_CYCLE_COMPARE=0 -DTWO_CYCLE_ALU=1 +iverilog -o testbench_i -s testbench testbench.v ../../picorv32.v -DTWO_STAGE_SHIFT=0 -DBARREL_SHIFTER=1 -DTWO_CYCLE_COMPARE=0 -DTWO_CYCLE_ALU=1 + +iverilog -o testbench_j -s testbench testbench.v ../../picorv32.v -DTWO_STAGE_SHIFT=0 -DBARREL_SHIFTER=0 -DTWO_CYCLE_COMPARE=1 -DTWO_CYCLE_ALU=1 +iverilog -o testbench_k -s testbench testbench.v ../../picorv32.v -DTWO_STAGE_SHIFT=1 -DBARREL_SHIFTER=0 -DTWO_CYCLE_COMPARE=1 -DTWO_CYCLE_ALU=1 +iverilog -o testbench_l -s testbench testbench.v ../../picorv32.v -DTWO_STAGE_SHIFT=0 -DBARREL_SHIFTER=1 -DTWO_CYCLE_COMPARE=1 -DTWO_CYCLE_ALU=1 + +mkdir -p tests +for i in {0..999}; do + fn="tests/test_`printf '%03d' $i`" + + { + cat start.S + java -jar testgen/tomthumb-testgen-1.0-SNAPSHOT.jar + } > $fn.s + + riscv32-unknown-elf-gcc -ffreestanding -nostdlib -Wl,-Bstatic,-T,sections.lds -o $fn.elf $fn.s + riscv32-unknown-elf-objcopy -O binary $fn.elf $fn.bin + python3 ../../firmware/makehex.py $fn.bin 16384 > $fn.hex + for tb in testbench_{a,b,c,d,e,f,g,h,i,j,k,l}; do vvp -N $tb +hex=$fn.hex; done +done diff --git a/scripts/tomthumbtestgen/sections.lds b/scripts/tomthumbtg/sections.lds similarity index 100% rename from scripts/tomthumbtestgen/sections.lds rename to scripts/tomthumbtg/sections.lds diff --git a/scripts/tomthumbtestgen/start.S b/scripts/tomthumbtg/start.S similarity index 100% rename from scripts/tomthumbtestgen/start.S rename to scripts/tomthumbtg/start.S diff --git a/scripts/tomthumbtestgen/testbench.v b/scripts/tomthumbtg/testbench.v similarity index 91% rename from scripts/tomthumbtestgen/testbench.v rename to scripts/tomthumbtg/testbench.v index 169700e..c39ebca 100644 --- a/scripts/tomthumbtestgen/testbench.v +++ b/scripts/tomthumbtg/testbench.v @@ -21,6 +21,10 @@ module testbench; reg [31:0] mem_rdata; picorv32 #( + .TWO_STAGE_SHIFT(`TWO_STAGE_SHIFT), + .BARREL_SHIFTER(`BARREL_SHIFTER), + .TWO_CYCLE_COMPARE(`TWO_CYCLE_COMPARE), + .TWO_CYCLE_ALU(`TWO_CYCLE_ALU) ) uut ( .clk (clk ), .resetn (resetn ),