Links to specific parts of document:
NOTE: The steps below show how the process for testing assembly programs work. We have provided a script (see section 3) to automate all these for your convenience.
As mentioned above, you no longer need to do any manual "hand-execution". See below for details.
wsrun.pl
script with the -prog
flag. See wsrun.pl details page.
wsrun.pl -prog <assmebly program file name> proc_hier_bench *.v
verilogsim.trace
archsim.trace
As you may have realized, generating the trace with PC, INSTRUCTION, REG, MEM ADDR, and MEM VALUE is more complicated for a pipelined design than for the single cycle design.
So for the pipelined, design we will opt for a simple trace format - we'll call this the the pipe trace and give it a .ptrace
extension.
Every cycle that a value is being written to the register file (write-back stage), or being read from mem (memory stage), or being stored to memory (mem stage), we will record an entry. PC and the instruction bits will not be recorded. Since NOPs, and branch instruction do not effectively change the registers or memory, they will create no entries in this simplified trace format.
There are 4 differences:
Everything else remains the same. To run a program:
wsrun.pl -pipe -prog foo.asm proc_hier_pbench *.v
On failure, see diff.ptrace
. Raw ptrace files are archsim.ptrace
and verilogsim.ptrace
As some of you have noticed the stalling memory and the cache modules, do NOT allow unaligned accesses. They all set err
output. Our instruction emulator has this feature also, which can be enabled by passing it the -align
flag. Henceforth in your simulations you will be using the -align flag which can be passed using wsrun.pl. To simulate your designs with stalling memory and your cache modules integrated, you must do the following:
wsrun.pl -align -pipe -prog foo.asm proc_hier_pbench *.v
A specific align test (alignTest.asm) has been added to the complexdemo2 which you can use to test.
Within your design you must OR the err outputs from different state machines and propagate the err output all the way up to the top-level and into the clkrst.v which will STOP simulation when the err output is encountered.
A performance tracking enhancement to the proc_hier_pbench.v testbench is also present. The following 4 signals, allow the testbench to track instruction and data cache hit rates for the programs executed: ICacheReq, DCacheReq, ICacheHit, DCacheHit.
See below for the signal names and descriptions. The assignments are dummy assignments.
Connecting these signals is OPTIONAL, but I highly recommended it. If you do not want to use them, simply assign them to 1'b0. If you do connect these signals, you will see IHITRATE and DHITRATE in the summary.log file. These are percentages - they should never exceed 100%.
You can use this data to analyze your processors performance on the programs you are running. Also, in a real industry processor, techniques very similar are use to implement so-called performance counters to measure such events.
// new added 05/03 assign ICacheReq = DUT.p0.readData; // Signal indicating a valid instruction read request to cache // Above assignment is a dummy example assign ICacheHit = DUT.p0.readData; // Signal indicating a valid instruction cache hit // Above assignment is a dummy example assign DCacheReq = DUT.p0.readData; // Signal indicating a valid instruction data read or write request to cache // Above assignment is a dummy example // assign DCacheHit = DUT.p0.readData; // Signal indicating a valid data cache hit // Above assignment is a dummy example