Abstract


Wasted computation

Each pipeline stage is isolated and independent from each other. When one stage is running, the other stages will be idle. You can see from the animation above, when the Instruction is decoded, the instruction register is actually ready to take in the next instruction.

This can be optimised with Instruction-Level Parallelism.

Fetch


MIPS fetch stage

The instruction memory in MIPS is a sequential circuit that only gets updated with the next instruction at the next rising clock edge.

Decode


  • Fetch the opcode which is used by the Control Unit to configure the CPU and send the instruction to the ALU. Obtain the operands, which can be either register values or immediate values within the instruction, and send the data to the ALU

MIPS decode stage

Two multiplexers are used to perform the correct operand fetch for R-type and I-type instructions. The bit signal sent to RegDst is 1 for R-type and 0 for I-type. The bit signal sent to ALUSrc is 0 for R-type and 1 for I-type.

Operand Fetch

Execute


Memory Access

Write Back


MIPS register write back

RegWrite is set to 1, so data sent to WD is written to the register at WR. MemToReg is set to 1, so the ALU result is sent to WD, instead of the Read Data from the MIPS data memory.