Test Programs FAQ
1. Can I make assumptions about the prior values in registers for my test programs?
You may not make any assumptions about the values in the registers. You should explicitly clear them all as the first thing you do in your program. Using andn to clear them to 0 is fine. Or you can use the lbi instruction to set them to a constant.
2. How do I set the path properly to execute
wsrun.pl - the command line tool to verify project demos?
To use the assembler and the command-line simulation script, you must
have the following line in your
set path = ($path /u/k/a/karu/public/html/courses/cs552/fall2020/handouts/bins)
3. How to interpret immediate and displacement field for branch instructions? Should I shift left by 1?
Clarification on the immediate field for branch instructions
(beqz, bnez, bltz, bgez, j, jr, jal, jalr)
You MUST NOT shift the immediate field by 1. I know this is slightly counter-intuitive, but the simulator already implements this semantics and these are semantics in the ISA spec. so we will stick with it.
For example, see
lbi r0, 0
beqz r0, 4
lbi r0, 1
lbi r1, 1
lbi r2, 1
lbi r3, 1
.lst file is:
0000 c000 lbi r0, 0
0002 6004 beqz r0, 4
0004 c001 lbi r0, 1
0006 c101 lbi r1, 1
0008 c201 lbi r2, 1
000a c301 lbi r3, 1
The conditional branch is taken and PC will be set to:
0x0002 + 2 + 4 == 0x0008
0x0002 + 2 + (4 << 1) == 0x000C.
Similar semantics applies for all conditional and unconditional branches.
If your immediate or displacement field in the assembly program ends up being an odd number, then you will get an unaligned access error from the simulator and from the memory module.
4. How can I run multiple programs on my processor one after another?
5. I want to run all the inst_tests programs?
6. What is the
You can specify a list of assembly files to run in a single file. Lets call this a list file. For example foo.list. You can then specify this file as input to
wsrun.pl using the
-list option and the script will methodically assembly, load into memory, and run one program after another. The summary results of whether each program passed or failed is written to a file called
For example, to run all the inst_tests files to create the summary.log file for demo1, execute the following command:
wsrun.pl -list /u/k/a/karu/courses/cs552/fall2020/handouts/testprograms/public/inst_tests/all.list proc_hier_bench *.v
You must examine the summary.log file and then for any program that failed, re-execute it using the
-prog option, create the trace files, dumpfile and load them in Modelsim and debug.