Engineering Homework Help

Engineering Homework Help. Instruction Level Simulator for A Single Cycle Mips Processor in C++ Project

 

Implement an instruction-level simulator for a single cycle MIPS processor in C++. The simulator supports a subset of the MIPS instruction set and can model the execution of each instruction.

Skeleton Code

The file “MIPS.cpp” contains a skeleton code for the assignment. You need to fill in the missing code. In this section, we provide descriptions for each of the components in the skeleton code.

Classes

   We have defined four C++ classes that each implement one of the four major blocks in a single cycle MIPS machine, namely RF (to implement the register file), ALU (to implement the ALU), INSMem (to implement instruction memory), and DataMem (to implement data memory).

Main Function

The main function defines a 32 bit program counter (PC) that is initialized to zero. The MIPS simulation routine is carried out within a while loop. In each iteration of the while loop, you will fetch one instruction from the instruction memory, and based on the instruction, make calls to the register file, ALU and data memory classes (in fact, you might need to make two calls to the register file class, once to read and a second time to write back). Finally you will update the PC so as to fetch the next instruction. When the halt instruction is fetched, you are to break out of the while loop and terminate the simulation.

What You Have to Submit

  1. We      have provided skeleton code in the file MIPS.cpp. Finish the code.  
  • A Makefile has been provided for you to compile the source code. 
  • We are working on setting up a server for development as was requested.
  • You can compile your design by typing “make” which would create the MIPS executable. Run the executable using “./MIPS” command.
  • You are welcome to write your own Makefile to compile the code (for example, if you add new header files etc) but in this case you must include a “howto.txt” file explaining how to compile your submitted source code. 
  • Code that does not compile will automatically be given a 0.
  • You are free to use whatever development environment you want, but you must upload your code with a working makefile.
  • We have provided “imem.txt” and “dmem.txt” files containing a sample code (loading two variables and adding them) and initialized data. These files must be in the same directory as the source code.
  • We encourage you to write your own MIPS programs and check your design for different cases. 

Engineering Homework Help