|CS552 Course Wiki: Spring 2013||Main »
Test Programs FAQ
On this page... (hide)
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 add the following line to the end of your .bashrc.local file:
set path = ($path /u/k/a/karu/public/html/courses/cs552/spring2013/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 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.
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
For example, to run all the inst_tests files to create the summary.log file for demo1, execute the following command:
You must examine the summary.log file and then for any program that failed, re-execute it using the
|Page last modified on January 23, 2013, visited 225 times|