Chapter 4 The Processor 2 4.4
Chapter 4 The Processor 2 4.4
Chapter 4 The Processor 2 4.4
Chapter 4
Section 4.4
Control
Control unit takes input from
the instruction opcode bits
ALUO 4
Main ALU To
p ALU
Control Control ALU
control
input
6
ALU must perform Instruction ALUOp generation
add for load/storesfunct field
(ALUOp 00)by main control
sub for branches (ALUOp 01)
one of and, or, add, sub, slt for R-type instructions, depending on the
instruction’s 6-bit funct field (ALUOp 10)
Setting up the ALU Control
Designing the Main Control
1
Add M
u
x
4 ALU 0
Add result
New multiplexor RegWrite Shift
left 2
ALUOp
RegDst The register destination number for the The register destination number for the
Write register comes from the rt field (bits 20-16) Write register comes from the rd field (bits 15-11)
RegWrite None The register on the Write register input is written
with the value on the Write data input
AlLUSrc The second ALU operand comes from the The second ALU operand is the sign-extended,
second register file output (Read data 2) lower 16 bits of the instruction
PCSrc The PC is replaced by the output of the adder The PC is replaced by the output of the adder
that computes the value of PC + 4 that computes the branch target
MemRead None Data memory contents designated by the address
input are put on the first Read data output
MemWrite None Data memory contents designated by the address
input are replaced by the value of the Write data inpu
MemtoReg The value fed to the register Write data input The value fed to the register Write data input
comes from the ALU comes from the data memory
Instruction [5 0]
MIPS datapath with the control unit: input to control is the 6-bit instruction
opcode field, output is seven 1-bit signals and the 2-bit ALUOp signal
Datapath with Control
PCSrc cannot be
0
set directly from the
M
u opcode: zero test
x
ALU
Add result 1
outcome is required
Add Shift PCSrc
RegDst left 2
4 Branch
MemRead
Instruction [31 26] MemtoReg
Control
ALUOp
MemWrite
ALUSrc
RegWrite
ALU
control
Determining control signals for the MIPS datapath based on instruction opcode