next up previous
Next: NOP Instruction Up: Miscellaneous Previous: Miscellaneous

Memory

As indicated by the state_t structure described in Section 5.1, there are two arrays that implement memory, an instruction memory array instrMem and a data memory array dataMem. This simulates the separate instruction and memory structures in the pipeline in Figure A.18 of the text. The code we have provided initializes both of these arrays to the same values read in from the assembly code file. In your simulator, you should read instructions from the instrMem array in the fetch stage, and write (read) values to (from) the dataMem array in the memory stage.

In the simulator code we have provided for you, the amount of memory simulated is determined by the size of the assembly program file that you read into the simulator. The numMemory field of the state_t structure is set to this size during initialization and is fixed for the duration of the simulation. This means that you must allocate all the memory your program will need statically in the assembly code file. The maximum size of the assembly program allowed is set by the MAXMEMORY constant declared in mips-small-pipe.h and is currently 16K words (64K bytes).


next up previous
Next: NOP Instruction Up: Miscellaneous Previous: Miscellaneous
MM Hugue 2011-09-24