L11 PDF
L11 PDF
25/03/2020
Control Design
Processor
Input
Control
Memory
Datapath Output
Adding Control
• Analyze datapath and RTLs for control
– Identify control points for pieces of the datapath
• Instruction Fetch Unit
• Integer function units
• Memory
– Categorize type of control signal
• Flow of data through multiplexors
• Writes of state information
– Derive control signal values for each instruction
• Design and implement control with logic/PLA/ROM (for
single cycle & pipelined)
L11
25/03/2020
MUX
Instruction[25:0] 26 Memory
PC
0
Adder
30 0 32
MUX
30
“1”
Adder
imm16 30
Branch = Zero =
Instruction[15:0] 16
previous previous
L11
25/03/2020
[21:25]
[16:20]
[11:15]
[0:15]
Jump = 0
Rd Rt Fetch Unit
RegDst = 1 Clk
1 Mux 0
Rs Rt ALUctr = <op> Rt Rs Rd Imm16
RegWr = 1 5 5 5 MemtoReg = 0
busA Zero
Rw Ra Rb MemWr = 0
busW 32
ALU
32 32-bit
32 Registers busB 32 0
MUX
Clk 0
32
MUX
32
Extender
WrEn Adr 1
1 Data In32
imm16 32 Data
16 Memory
Clk
ALUSrc = 0
ExtOp = X
L11
25/03/2020
30
Addr[31:2]
PC[31:28] 30
Addr[1:0]
4 “00”
1 Instruction
Target 30
MUX
Instruction[25:0] 26 Memory
PC
0
Adder
30 0 32
MUX
30
“1”
Adder
1 Jump = 0 Instruction[31:0]
Clk 30
SignExt
imm16 30
Instruction[15:0] 16
Branch = 0 Zero = X
L11
25/03/2020
[21:25]
[16:20]
[11:15]
[0:15]
Jump = 0
Rd Rt Fetch Unit
RegDst = 0 Clk
1 Mux 0
Rs Rt ALUctr = <op> Rt Rs Rd Imm16
RegWr = 1 5 5 5 MemtoReg = 0
busA Zero
Rw Ra Rb MemWr = 0
busW 32
ALU
32 32-bit
32 Registers busB 32 0
MUX
Clk 0
32
MUX
32
Extender
WrEn Adr 1
1 Data In32
imm16 32 Data
16 Memory
Clk
ALUSrc=1
ExtOp=0
L11
25/03/2020
[21:25]
[16:20]
[11:15]
[0:15]
Jump = 0
Rd Rt Fetch Unit
RegDst = 0 Clk
1 Mux 0
Rs Rt ALUctr = Add Rt Rs Rd Imm16
RegWr = 1 5 5 5 MemtoReg = 1
busA Zero
Rw Ra Rb MemWr = 0
busW 32
ALU
32 32-bit
32 Registers busB 32 0
MUX
Clk 0
32
MUX
32
Extender
WrEn Adr 1
1 Data In32
imm16 32 Data
16 Memory
Clk
ALUSrc = 1
ExtOp = 1
L11
25/03/2020
[21:25]
[16:20]
[11:15]
[0:15]
Jump = 0
Rd Rt Fetch Unit
RegDst = X Clk
1 Mux 0
Rs Rt ALUctr = Add Rt Rs Rd Imm16
RegWr = 0 5 5 5 MemtoReg = X
busA Zero
Rw Ra Rb MemWr = 1
busW 32
ALU
32 32-bit
32 Registers busB 32 0
MUX
Clk 0
32
MUX
32
Extender
WrEn Adr 1
1 Data In32
imm16 32 Data
16 Memory
Clk
ALUSrc = 1
ExtOp = 1
L11
25/03/2020
[21:25]
[16:20]
[11:15]
[0:15]
Jump = 0
Rd Rt Fetch Unit
RegDst = X Clk
1 Mux 0
Rs Rt ALUctr = Sub Rt Rs Rd Imm16
RegWr = 0 5 5 5 MemtoReg = X
busA Zero
Rw Ra Rb MemWr = 0
busW 32
ALU
32 32-bit
32 Registers busB 32 0
MUX
Clk 0
32
MUX
32
Extender
WrEn Adr 1
1 Data In32
imm16 32 Data
16 Memory
Clk
ALUSrc = 0
ExtOp = X
L11
25/03/2020
30
Addr[31:2]
PC[31:28] 30
Addr[1:0]
4 “00”
1 Instruction
Target 30
MUX
Instruction[25:0] 26 Memory
PC
0
Adder
30 0 32
MUX
30
“1”
Adder
1 Jump = 0 Instruction[31:0]
Clk 30
SignExt
imm16 30
Instruction[15:0] 16
Branch = 1 Zero = 1
L11
25/03/2020
[21:25]
[16:20]
[11:15]
[0:15]
Jump = 1
Rd Rt Fetch Unit
RegDst = X Clk
1 Mux 0
Rs Rt ALUctr = X Rt Rs Rd Imm16
RegWr = 0 5 5 5 MemtoReg = X
busA Zero
Rw Ra Rb MemWr = 0
busW 32
ALU
32 32-bit
32 Registers busB 32 0
MUX
Clk 0
32
MUX
32
Extender
WrEn Adr 1
1 Data In32
imm16 32 Data
16 Memory
Clk
ALUSrc = X
ExtOp = X
L11
25/03/2020
30
Addr[31:2]
PC[31:28] 30
Addr[1:0]
4 “00”
1 Instruction
Target 30
MUX
Instruction[25:0] 26 Memory
PC
0
Adder
30 0 32
MUX
30
“1”
Adder
1 Jump = 1 Instruction[31:0]
Clk 30
SignExt
imm16 30
Instruction[15:0] 16
Branch = 0 Zero = X
L11
25/03/2020
Control Path
Branch Instruction[31:0]
Instruction
[21:25]
[16:20]
[11:15]
[0:15]
Jump
Rd Rt Fetch Unit
RegDst Clk
1 Mux 0
Rs Rt ALUctr Rt Rs Rd Imm16
RegWr 5 5 5 Zero MemtoReg
busA
Rw Ra Rb MemWr
busW 32
ALU
32 32-bit
32 Registers busB 32 0
MUX
Clk 0
32
MUX
32
Extender
WrEn Adr 1
1 Data In32
imm16 32 Data
16 Memory
Clk
ALUSrc
ExtOp
L11
25/03/2020
Multilevel Decoding
• 12-input control will be very large (212 = 4096)
• To keep decoder size smaller, decode some control
lines in each stage
• Since only R-type instructions (with op = 000000)
need function field bits, give these to ALU control
func
ALU ALUctr
op Main 6
ALUop Control 3
6 Control
(Local)
N
ALU
L11
25/03/2020
ALUop func
bit<2> bit<1> bit<0> bit<3> bit<2> bit<1> bit<0> ALUctr<2>
0 x 1 x x x x 1
1 x x 0 0 1 0 1
1 x x 1 0 1 0 1
ALUSrc
RegDst
MemtoReg
MemWrite
Branch
Jump
ExtOp
ALUop<2>
ALUop<1>
ALUop<0>
L11
25/03/2020
Implementing Control
• Programmable Logic Array (PLA) vs.
“Random Logic”
– Design Changes
• Validation changes are common
• PLA is less work to change; area/timing impact is predictable
– Area
• Tradeoff depends on complexity of logic (# of gates)
– Timing and Power
• Random logic generally better since individual paths can be tuned
• Alternative approach is Read Only Memory
(ROM/PROM)
– Also combinational, but size makes it slow
– used for microcoded control with more than one state/cycle per
instruction
L11
25/03/2020
Putting It All Together
ALUop
ALU ALUctr
RegDst 3 func
op Control 3
Main Instr[5:0] 6
6 Control ALUSrc
Instr[31:26] : Branch Instruction[31:0]
Instruction
[21:25]
[16:20]
[11:15]
[0:15]
Jump
Rd Rt Fetch Unit
RegDst Clk
1 Mux 0
Rs Rt ALUctr Rt Rs Rd Imm16
RegWr 5 5 5 MemtoReg
busA Zero
Rw Ra Rb MemWr
busW 32
ALU
32 32-bit
32 Registers busB 32 0
MUX
Clk 0
32
MUX
32
Extender
WrEn Adr 1
1 Data In32
imm16 32 Data
16 Memory
Clk
ALUSrc
ExtOp
L11
25/03/2020
Worst Case Timing (Load)
Clk
Clk-to-Q
PC Old Value New Value
Instruction Memory Access Time
Rs, Rt, Rd, Old Value New Value
Op, Func
Delay through Control Logic
ALUctr Old Value New Value
Summary
Single cycle datapath => CPI=1, CCT => long
5 steps to design a processor
• 1. Analyze instruction set => datapath requirements
• 2. Select set of datapath components & establish clock methodology
• 3. Assemble datapath meeting the requirements
• 4. Analyze implementation of each instruction to determine setting of
control points that effects the register transfer.
• 5. Assemble the control logic
Processor
Control is the hard part Input
Control
MIPS makes control easier Memory
• Instructions same size
• Source registers always in same place Datapath Output
• Immediates same size, location
• Operations always on registers/immediates