Microprocessor without Interlocked Pipeline Stages (MIPS) is a widely used instruction set architecture. We’ve already had comprehensive understandings of it in our Computer Architecture course. In this exercise, we’re going to implement the single-cycle MIPS architecture using Verilog. This exercise will give you a hardware viewpoint to this architecture.
The MIPS architecture is shown in Fig. 1. In this exercise, the instruction memory and data memory are implemented in the testbench. Except the memories, you need to implement everything else by yourself.
Figure1: Single-cycle MIPS architecture.
The input/output pins are defined in Table. 1. The required instructions you need to support in the baseline are listed in Table. 2. The complete machine codes for the required instructions are not listed in this document. Please refer to your textbook or MIPS Green Sheet for the full machine code, our testbench follows the standard machine code rules. (We also provide you MIPS Green Sheet with marker on the instructions that we asked you to do. The password is same as course slides)
Tabel1: I/O pins specification
|Signal name||I / O||Bit width||Description|
|clk||I||1||Clock signal.Positive edge trigger.|
|rst_n||I||1||Active low synchronous reset signal.|
|IR_addr||O||32||Output address of the instruction memory.|
|IR||I||32||Instruction read from instruction memory|
|ReadDataMem||I||32||Signals from data memory.|
|CEN||O||1||Chip-enable; set it low to read/write data.|
|WEN||O||1||Write-enable; set it low to write data into memory.|
|A||O||7||Address for data memory.|
|Data2Mem||O||32||Registers output signal.|
|OEN||O||1||Read-enable; set it low to read data from memory.Note that OEN should be the inverse of WEN.|
Table 2: Your MIPS needs to support the instructions in this table to pass baseline.
|Instrucion||Type||Op code (Hex)||Func code (Hex)|
3. Timing Diagram for Memory
In the MIPS architecture shown in Fig. 1, there are two memories needed. Here we use a ROM for the instruction memory. As soon as you give it an address, the instruction memory sends the instruction immediately.
As for data memory, we use a simulated SRAM for it in this exercise. Fig. 2 shows the timing diagram for reading data from a memory. Fig. 3 shows the timing diagram for writing data into a memory.
Figure2: Read data from a memory.
Figure3: Write data from a memory.
4. Floating-Point Unit
For more advanced exercise, you can add some function to your MIPS to support some floating-point instructions. You need to extend from your baseline code, adding new registers $FR0 – $FR31 to store floating-point numbers ($FR0 is not always 0 !).
Since some floating-point operations are too complex to implement, you have to use DesignWare modules to accomplish this part. DesignWare modules are stored in the following directory.
During RTL Simulation, include these modules by adding the following in command line :
Table 3 are the instructions that will be tested in our testbench, where double precision instructions are marked with darker background. You can also just do single precision part to get partial points.
Table 3: floating-point instructions that your MIPS have to support
|Instrucion||Type||Op code (Hex)||FMT(Hex)||Func code (Hex)|