Skip to main content

WISC-SP22 Simulator & Debugger

Links to specific parts of document:

1.  Usage

A simple simulator and debugger for the WISC-SP22 ISA is provided here. This simulator can read in the output of the assembler and execute it. You can step one instruction at a time to determine how the individual steps in your program affect the state of the machine.

One way to use this program for verification is to compare the state of registers in the writeback stage with the registers printed by this simulator.

You can run this simulator by invoking the following command at a Linux prompt:

/u/s/i/sinclair/courses/cs552/spring2022/handouts/bins/wiscalculator

To use this, I strongly recommend that you add the directory /u/s/i/sinclair/courses/cs552/spring2022/handouts/bins to your PATH variable.

Type help at its prompt to see what all it can do.

Normal usage: wiscalculator loadfile_all.img

With this usage, the simulator will run the program and print a step by step listing of the instructions executed and what registers they write to etc. A file called archsim.trace will be created.

Example archisim.trace

          PC: 0x0000 REG: 0 VALUE: 0x0000
          PC: 0x0002 REG: 0 VALUE: 0x004c
          PC: 0x0004 REG: 1 VALUE: 0x0000
          PC: 0x0006 REG: 1 VALUE: 0x0054
          PC: 0x0008 REG: 2 VALUE: 0x0007
          PC: 0x000a ADDR: 0x004c VALUE: 0x0007
          PC: 0x000c REG: 3 VALUE: 0x0007 ADDR: 0x004c
          PC: 0x000e REG: 4 VALUE: 0xfff9
          PC: 0x0010 ADDR: 0x0050 VALUE: 0xfff9
          PC: 0x0012 REG: 0 VALUE: 0x0050
          PC: 0x0014 REG: 5 VALUE: 0xfff9 ADDR: 0x0050
          PC: 0x0016 REG: 2 VALUE: 0x000f
          PC: 0x0018 ADDR: 0x004e VALUE: 0x000f
          PC: 0x001a REG: 0 VALUE: 0x004d
          PC: 0x001c REG: 6 VALUE: 0x000f ADDR: 0x004e
        

2.  Source code

This source is provided under the following conditions.

You shall not redistribute this code. You may use this code exclusively for cs552 related use. For any other type of use contact the instructor first.

Download all files from: http://pages.cs.wisc.edu/~sinclair/courses/cs552/spring2022/handouts/simulator/
or from the filesystem: /u/s/i/sinclair/courses/cs552/spring2022/handouts/simulator

And then, use the Makefile to build the simulator.