Links to specific parts of FAQ:
-list
option?
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.
To use the assembler and the command-line simulation script, you must add the following line to the end of your .bashrc (or .bashrc.local) file:
export PATH=$PATH:/u/s/i/sinclair/public/html/courses/cs552/spring2022/handouts/bins
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 beqz_0.asm:
lbi r0, 0
beqz r0, 4
lbi r0, 1
lbi r1, 1
lbi r2, 1
lbi r3, 1
Its .lst file:
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
NOT 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.
See below.
See below.
-list
option?
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 summary.log
.
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/s/i/sinclair/courses/cs552/spring2022/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.