Authors: Justin Mendes and Shazil Razzaq
Tests the functionality of your RV32UI processor by executing test_pd with Verilator and verifying the results with a mock RV32UI processor created in Python.
-
Runs all of the
*.x
tests in the benchmarks (rv32-benchmarks). -
Verifies all of the resulting
*.trace
files in../sim/verilator/test_pd/
for behaviour
-
Put
test.py
andparse.py
in/projects/pd4/verif/scripts
-
In
/project/pd4/verif/scripts
enterpython3 test.py <PATH to /rv32-benchmarks>
If your output looks like this, you're processor is likely good to go!
Otherwise, read on for debugging instructions.
-
Place
test.py
andparse.py
in the./verif/scripts
directory of the project you want to test (e.g. ece320/projects/pd4/verif/scripts). -
Have local access to
/rv32-benchmarks
found in the ece320 GitLab.
For an end-to-end test follow instructions for test.py.
For testing individual programs follow instructions for parse.py
Runs a full end-to-end test of your processor.
Default Behaviour: Executes and Verifies all tests.
Assumptions Made:
-
Your
/rv32-benchmarks
directory has subfolders:/individual-instructions
and/simple-programs
. -
*.x
files in/individual-instructions
begin with:rv32ui-p-
-
Your results -
*.trace
files, are in directory../sim/verilator/test_pd
python3 test.py [-h/--help] [-e/--execute] [-v/--verify] [any flags/options for parse.py...] <PATH: to "/rv32-benchmarks" directory>
Must be ran in /projects/pd#/verif/scripts/
directory
PATH
: Required.
Path to "/rv32-benchmarks" directory.
Optional flags to help with debugging:
-h
/--help
:
Get more information how to run the command and what each of the arguments and options/flags do.
-e
/--execute
:
Add this flag to EXECUTE the tests only (runs all .x tests at the specified path).
-v
/--verify
:
Add this flag to VERIFY the trace files of the tests only (runs parse.py on all trace files in "../sim/verilator/test_pd/*.trace").
Flags forwarded to parse.py:
-s
/--skip
-i
/--instructions
-in
/--instructions-no-mem
-r
/--regfile
-m <MEM_DEPTH>
python3 test.py ../../../../../rv32-benchmarks -in -s
python3 test.py -e ../../../../../rv32-benchmarks
python3 test.py -i -r ../../../../../rv32-benchmarks --verify
python3 test.py -v --skip -m 1024000 /home/ece320/rv32-benchmarks -i
python3 test.py --execute ../../../../../rv32-benchmarks
python3 test.py ../../../../../rv32-benchmarks --execute
Compares the results of your processor's *.trace
output file under a *.x
testbench to a mock Python RV32UI processor to verify correctness of your processor under the given *.x
test.
Assumptions Made:
-
Your dmemory is initialized with the same data as imemory.
-
Your reg_file (i.e. each register x0-x31) is initialized with all 0s.
python3 parse.py [-h/--help] [-s/--skip] [-i/--instructions] [-in/--instructions-no-num] [-r/--regfile] [-m <MEM_DEPTH> / --mem <MEM_DEPTH>] <TRACE: path to .trace file> <HEX: path to corresponding .x file>
TRACE
: Required.
Path to .trace file from executing a *.x
testbench: make run VERILATOR=1 TEST=test_pd MEM_PATH=*.x
.
HEX
: Required.
Path to .x file used to generate the *.trace
file: make run VERILATOR=1 TEST=test_pd MEM_PATH={HEX}
.
The contents of this file will be initially loaded into dmemory.
-s
/--skip
: Default False
CONTINUE execution on errors.
-i
/--instructions
: Default: False
Print all instructions in RISC-V format (instructions enumerated).
-in
/--instructions-no-num
: Default: False
Print all instructions in RISC-V format (instructions NOT enumerated).
-r
/--regfile
: Default: False
Print the state of the Register File at each [R] in the .trace file.
-m <MEM_DEPTH>
/--mem <MEM_DEPTH>
: Default: -m 1048576
Number of bytes (8-bit values) in data memory (memory).
python3 parse.py ../sim/verilator/test_pd/rv32ui-p-sltiu.trace ../../../../../rv32-benchmarks/individual-instructions/rv32ui-p-sltiu.x -in -s
python3 parse.py -i -r ../data/rv32ui-p-add.trace ../../../../../rv32-benchmarks/individual-instructions/rv32ui-p-add.x
python3 parse.py --skip -m 1024000 ../tests/out/BubbleSort.trace -i /rv32-benchmarks/simple-programs/BubbleSort.x
- Add support for flags
-pd1
-pd2
-pd3
-pd4
-pd5
to allow user to isolate which project they would like to test up to.