























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
























sum
M U X
ALU
PCSrc
ALU
a
b
carryout
zero
result
overflow
ALU operation
111 Set on less than
ALU operation Function
Combine Binvert and Operation into set of 3 control lines
What function should ALU perform?
produce 3-bit ALU (operation) control
I-type instructions
Based on op-code: generated by main control unit
Input signal to ALU
Shift left 2
ALU
sum
M U X
PCSrc
[25-21] rs
[20-16] rt
[15-11] rd
[15-0] addr
[5-0] funct
ALU control ALUOp
ALU Control Unit
0 rs rt rd func
[31-26] [25-21] [20-16] [15-11] [5-0]
35 or 43 rs rd immediate
[31-26] [25-21] [20-16] [15-0]
4 rs rd immediate
[31-26] [25-21] [20-16] [15-0]
2 immediate
[31-26] [25-0]
All R-type
I-type Load/Store
I-type Branch
Jump
shamt
[10-6]
Shift left 2
ALU^ sum
M U X
PCSrc
[25-21] rs
[20-16] rt
[15-11] rd
[15-0] addr
[5-0] funct
ALU control ALUOp
ALU Control Unit
What about write register?
For R-type use bits [15-11] For I-type use bits [20-16]
[15-11] rd
M U X
RegDst
Single-cycle Instruction execution
Read/write Enabler
Data path control Mux’s
ALUOp
ALUOp
Branch
MemWrite
R-type 1 0 0 1 0
RegDstALUSrcMemToRegRegWriteMemRead Instr type
RegDst: Destination register is determined by [15-11] Ë 1 ALUSrc: ALU input 2 is from register fileË 0 MemtoReg: ALU result written to register Ë 0 RegWrite: Write to register allowed Ë 1 MemRead: Read to mem not needed (no effect) Ë 0 MemWrite: Write to mem not needed (no effect) Ë 0 Branch: This is not a branch (PCSrcË0) Ë 0 ALUOp1: TBD by function code Ë 1 (sets ALU control) ALUOp0: TBD by function code Ë 0 (sets ALU control)
Store X 1 X 0 0 1 0 0 0
Load 0 1 1 1 1 0 0 0 0
ALUOp
ALUOp
Branch
MemWrite
R-type 1 0 0 1 0
ALUSrcMemToRegRegWriteMemRead RegDst Instr type
RegDst: Don’t care b/c no storage to regs (RegWrite=0) ËX
ALUSrc: ALU input 2 is from sign extended immediateË 1
MemtoReg: Don’t care b/c no storage to regs (RegWrite=0) ËX
RegWrite: Write to register not allowed Ë 0
MemRead: Read to mem not needed (no effect) Ë 0
MemWrite: Allow mem to be written Ë 1
Branch: This is not a branch (PCSrcË0) Ë 0
ALUOp1: TBD by function code Ë 0 (sets ALU control)
ALUOp0: TBD by function code Ë 0 (sets ALU control)
Store X 1 X 0 0 1 0 0 0
Load 0 1 1 1 1 0 0 0 0
ALUOp
ALUOp
Branch
MemWrite
R-type 1 0 0 1 0
RegDstALUSrcMemToRegRegWriteMemRead Instr type
RegDst: Don’t care b/c no storage to regs (RegWrite=0) ËX
ALUSrc: ALU input 2 is from register fileË 0
MemtoReg: Don’t care b/c no storage to regs (RegWrite=0) ËX
RegWrite: Write to register not allowed Ë 0
MemRead: Read to mem not needed (no effect) Ë 0
MemWrite: Write to mem not needed (no effect) Ë 0
Branch: This is a branch (PCSrc=(zero AND Branch)) Ë 1
ALUOp1: TBD by function code Ë 0 (sets ALU control)
ALUOp0: TBD by function code Ë 1 (sets ALU control)
What about Jump?