MIPS Report File
MIPS Report File
MIPS Report File
EC 728
MINOR PROJECT
Submitted by
MANISH (212VL022)
Here in this report our default RISC architecture is MIPS. There are three
different types of instructions. Here we implemented two types of instruction
only branch and jump type instructions are not implemented.
1. ALU instruction :
These kinds of instructions use either two registers or a sing extended
immediate and register.
Typical instructions are AND, OR, add, sub and etc.
2. Load and Store instructions:
Base register and offset are the operands for this type of instructions. The sum
of both base register and offset called as ‘effective address’ and this is being
used as a memory address.
At the time of LOAD instructions, a second register operand works as the
destinations register while in STORE instruction second register operand is the
source of the data that needs to be stored into memory.
R-type instructions
For example,
add $r1, $r2, $r3 (instruction rd, rs, rt) which means it adds two values of
$r2 and $r3 and stores the result in to $r1.
I-type instructions
For example,
addi $r1, $r2, 9 (instruction rt, rs, immediate) which means it adds the
value 5 to the register $r2, and stores the result in to $r1.
J-type instruction
For example,
In order to specify the control signal of the pipeline structure, each stage of
the pipeline needs to be given control value. Here we can divide the
control signals in to five different groups since each control line is
correspondent to the active component of that particular pipeline stage as
shown in figure above.
To continue with five divisions, let us explain a little detail about each of
them.
1. Instruction Fetch
There isn’t anything really in this division as control signal to
write the PC and read the IM (Instruction Memory) are
always there.
2. Instruction Decode
Since even this stage is independent to the current instruction
type as explained earlier, every time same operation happens
at this stage.
3. Execution /ALU operation
As shown in above figure, ALUSrc, ALUOp and RegDsr are
the signals that need to be set, it selects the ALU operation,
resulting register, and either sign extended immediate field or
read the data.
4. Memory
Again as shown in above figure, in this stage, MemWrite,
MemRead and Branch are the signals that needs to be set,
they are set by the store instruction, load instruction or by the
branch equal respectively.
5. Write Back
There are two different control signals; MemtoReg which is
responsible in deciding in between sending the memory value
or ALU result from stage 3 and RegWrite which is
responsible of writing the value.
4.0 Simulation in Xilinx Vivado
Instruction format
Instructions should be provided to the instruction memory in reset time. We
avoided the `readmemb` and `readmemh` functions to
keep the code synthesizable. The instruction memory cells are 8 bits long,
whereas each instruction is 32 bits long.
Therefore, each instruction takes up four memory cells, as shown bellow.
For example, an add instruction: `10000000001000000000000000001010` or
`Addi r1,r0,10` will need to be given as
```
instMem[0] <= 8'b10000000;
instMem[1] <= 8'b00100000;
instMem[2] <= 8'b00000000;
instMem[3] <= 8'b00001010;
```
For R-type.
Initial 6 bits contain opcode then next five bits contain the address of
destination register and then next ten bits will have address of two source
registers,then next five bits are for shamt, and last 6 bits are for function.
For I-type.
Initial 6 bits contain opcode then next five bits contain the address of
destination register and then next five bits will have address of source register
then we have last sixteen bit reserved for immediate value.
For Store/Load
Initial 6 bits contain opcode then next five bits contain the address of
destination register and then next five bits will have address of source register
then we have last sixteen bit reserved for address.
Instruction Memory.
Instruction Hexadecimal
Addi r1,r0,10 Add immediate r0&10 8020000A
and store in r1.
Add r2,r0,r1 Add register value of r0 04400800
&r1 and store in r2.
Sub r3,r0,r1 Subtract r1 from ro and 0C600800
store it in r3.
And r4,r2,r3 Bitwise And operation 14821800
between r2&r3 and store
in r4.
Ld r11,r1,0 Load value from memory 91610000
address generated from
r1+(offset value(i.e 0)) to
r1.
St r3,r1,4 Store value of r3 to 94610004
address(r1+(offset value
(i.e 4)))
Add r1,r0,r4 Add register value of r0 4405800
&r4 and store in r1.
And r4,r2,r3 Bitwise And operation 14821800
between r2&r3 and store
in r4.
5.0 Simulation Results
6.0 Conclusion
In this practice, I have successfully accomplished building a MIPS CPU
with pipeline functionalities. This design shows the implementation of MIPS
CPU capable of handling various R-type,I-type and store load type of
instruction and each of these categories has a different format. This project
shows the wide variety of logics to consider during the design.
7.0 Future Enhancement
Incorporating memory architecture by designing different CACHE
implementation technique could be helpful to understand the advance computer
architecture. Taking this design and dump it to IC Compiler to understand the
physical design fundamental can be a good way to learn whole ASIC flow.
8.0 References
1] Muskan Saxena, Ojaswini Nimbalkar, Vidhi Jaiswal, Vishakha Pandey, P.
Sanjeevi. The survey of concepts of architecture in RISC and CISC computers,
Volume-4, Issue-6, pp. 146-151, 2018.
[2] P. M. Kogge, The Architecture of Pipelined Computers, McGrawHill, 1981.
[3] M Design of 16-bit RISC Processor International Journal of Scientific
Research in Physics and Applied Sciences, 1(1), Feb 2017, pp 25-30.
[4] Mano, Ciletti. Digital Design with an Introduction to the Verilog HDL, 5th
Edition, Pearson Education, 2013.
[5] Palnitkar. Verilog HDL A Guide to Digital Design and Synthesis, 2nd
Edition, Sun Microsystems, 2003.
[6] Mano. Digital Logic and Computer Design, Pearson Education, 1979.