Refer to the following datapath, write a program to simulate the instruction execution in this datapath. We assume initially the value of the general-purpose registers as follows: Reg[y] = y + 20, for 0![][1] For example, you can use the following code to declare and initialize the Registers and Data Memory int Reg[32]; Reg[0] = 0; for (int k=1 ; k<32 ; k++) Reg[k] = k + 20; const int MEM_SIZE = 5000; int DataMem[MEM_SIZE]; for (k=0 ; k< MEM_SIZE ; k++) DatMem[k] = 100+k; Simulator Input: The input is a file of MIPS machine instructions program with hexadecimal representation. An example file is the following. ********* [login to view URL] begins ***************** 8ca40004 ae520004 010c4020 012a7020 ********* [login to view URL] ends **************** As shown above, the [login to view URL] may contain many instructions. After executing each instruction, the memory unit and/or registers used by the current instruction need to be updated for the following instruction. Thus the memory content and/or registers will not all have the initial value after executing the first instruction. This will require you to complete the last step for each instruction, e.g., for sw instruction, you need to finish DataMem[[login to view URL]] = DM.WriteData. For lw, add, sub instruction, you need to finish Reg[[login to view URL]] = [login to view URL] Only the following instructions in the [login to view URL] file will be used: lw sw add sub beq bne
## Deliverables
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
2) Deliverables must be in ready-to-run condition 3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement).
## Platform
Visual C++ Simulator Output: Your simulator should output the values of following buffers in the datapath for the execution of each instruction. Component Buffer Instruction Memory (IM) Instruction Read Address Registers (Reg) ReadRegister1 ReadRegister2 WriteRegister WriteData ReadData1 ReadData2 ALU Input1 Input2 ALUResult Data Memory (DM) Address WriteData ReadData User Interface : You can simply print the content of each buffer as text output after executing each instruction. The following is an example output for the above [login to view URL] file. Executing instruction "8ca40004", Instruction Memory : Instruction = 8ca40004 ReadAddress = 0 Registers: ReadRegister1 = 5 ReadRegister2 = 4 WriteRegister = 4 ? Executing instruction "ae520004", Instruction = ae520004 ReadAddress = 4 Registers: ReadRegister1 = 18 ?