2 minutes
Five-Stage Pipelined MIPS Series: 5. Data Operation, Data Transfer, and Sequencing Instructions
Data Operations
- The Program Counter holds the instruction address
- Instructions are fetched from the memory into the instruction register
- Control logic decodes the instruction and tells the Arithmetic Logic Unit (ALU) and Register File what to do
- ALU executes the instruction and results flow back to the Register File
- Control logic updates the PC for the next instruction
Data Transfer
Now, we need an additional Memory Address Register and Data Register.
- ALU generates the address
- Address goes to the Memory Address Register
- Results to/from memory are stored in the Memory Address Register
- Data from memory can now be stroed in the Register File, or data to memory can be written in the Register File
Sequencing Instructions
Sequencing instructions include Jump and Branch instructions.
MIPS has the following conditional branch instructions:
- bne R0, R1, Label : branch to Label if R0 and R1 are not equal
- beq R3, R4, Label : branch to Label if R0 and R1 are equal
MIPS has the following unconditional branch instruction:
- j Label : jump to Label
Sequencing Instructions have the following flow:
- ALU compares registers
- Result tells the Control logic whether to branch
- If the branch is taken, the Control logic adds a constant from the instruction to the PC. The Control logic also adds an additional 4 to move to the next instruction.
- For unconditional jumps, the Control logic replaces the PC with the constant from the instruction.