The SystemC hardware simulator for the mMIPS NOC (mips)

The Linux executable mips is a ready-to-use hardware simulator for the 2-by-2 mMIPS NOC and is available in ./samples/simulator. This simulator is useful for debugging your applications or the NOC itself. The simulator does not is not simulate real-time, in fact it is about a twenty thousand times slower than that (on a Pentium III 1GHz). This makes it less suitable for debugging larger applications. You could use the FPGA implementation to debug larger programs.

Debugging capabilities

The simulator has two features that makes it useful for debugging:

  1. Contents of all processors after simulation
    The mMIPS debugging library supports a printf() variant called mprintf() that stores formatted output in memory. This output can be viewed in a hex editor after simulation. You could also use the script dolcc which automates the application compilation and simulation process (see the application design flow for more information).
  2. Trace memory addresses
    The simulator can watch memory addresses. If a "watched address" is accessed, then the simulator outputs a line (to stdout) containing the text "MEMORY ACCESS  addr=0x" followed by the watch address and the data that was either read or written. The user has can specify which addresses need to be watched by creating a file called mem_dbg that contains a list of (decimal) values representing these addresses. The file needs to be in the same directory as the simulator and the numbers should be separated by spaces.

Usage instructions

The simulator mips can be called from the Linux shell with the desired simulation time in nanoseconds as a parameter (e.g. mips 5000 to simulate for 5Ás).

The simulator searches for the files mips_rom.xXyY.bin and mips_ram.xXyY.bin which should contain the instructions and data for the processor node at x-position X and y-position Y in the network. Since the sample simulator is for a 2-by-2 network X and Y can be either zero or one. Processors that have no corresponding memory file will not cause problems. These processors will just stop immediately and remain idle while the other processors do their thing.

The test projects "Gossip" and "JPEG Decoder" contain a Linux shell script called dolcc to automate the process of compiling the C sources, create the mips_r*m.xXyY.bin files and start the simulator. More on the compilation and simulation process is in the application design flow.

As said before, simulation takes a lot of time on even today's fastest processors. It took 600 milliseconds for the JPEG decoder on the 2x2 NOC to convert a 16x16 color JPEG image to a bitmap. To simulate these 600 milliseconds on a Pentium III 1GHz processor running GNU/Linux 2.4.20 with 2048 MB of RAM took three hours (more information).

Compile the simulator

The page that describes the NOC design flow also shows how to compile a hardware simulator. You only need to create a new simulator if you change the sources of the NOC. There is a working hardware simulator for the 2-by-2 mMIPS NOC in ./samples/simulator.

Customize the simulator

It is possible to customize the simulator and add new debugging capabilities. See SystemC hardware simulators page for more information.