RISC-V - Control Unit
RISC-V - Control Unit
edu/~cs61c
CS61C : Machine Structures
Lecture 31 – RISC-V Control
Instructors
Dan Garcia and Bora Nikolic
2018-11-02
Berkeley’s SkyDeck Offers Chip Design Support
Worth Millions to Startups
Xconomy San Francisco — The current land rush in chip development,
spurred as new technologies such as artificial intelligence create new needs,
is pitting established semiconductor companies like Intel and Nvidia against
tech titans like Facebook that are building their own chips. A wave of next-
generation chip companies has also entered the fray. So how much room
remains for startups that are relative latecomers? Oct 25, 2018.
xconomy.com
CS61C L31 Control Garcia, Nikolić, Fall 2018 © UCB
Review
Not in CS61C
+4
Add
Add
pc+4 2
wb pc
DataD alu
Reg[rs1] 1
alu Inst[11:7]
1 0 wb
PC AddrD 1
addr
addr Inst[19:15]
0 DataR
inst
inst AddrA DataA 0 alu
pc+4
Inst[24:20]
Branch + addr mem
AddrB DataB Comp 0 ALU
clk DataW
IMEM
IMEM Reg [ ] 1 DMEM
Inst
clk Reg[rs2] clk
[31:7] Imm.
Gen Imm[31:0]
PCSel Inst[31:0] ImmSel RegWEn BrUn BrLT Bsel ALUSel MemRW WBSel
Asel
Control logic BrEq
Processor Memory
Enable? Input
Read/Write
Control
Cache Program
Datapath Memory (including
Address cache) organized
PC Bytes around blocks,
which are typically
Write multiple words
Registers Data
Processor organized
around words and bytes
Processor‐Memory Interface I/O‐Memory Interfaces
+4
Add
Add
pc+4 2
DataD Reg[rs1] 1
1 Inst[11:7] 0 wb
PC AddrD 1
addr
addr Inst[19:15]
0 DataR
inst
inst AddrA DataA 0 alu
pc+4
Inst[24:20]
Branch + addr mem
AddrB DataB Comp 0 ALU
clk DataW
IMEM
IMEM Reg [ ] 1 DMEM
Inst
clk Reg[rs2] clk
[31:20] Imm.
Gen Imm[31:0]
PCSel Inst[31:0] ImmSel RegWEn BrUn BrLT Bsel ALUSel MemRW WBSel
Asel
Control logic BrEq
+4
Add
Add
pc+4 2
wb pc
DataD alu
Reg[rs1] 1
alu Inst[11:7]
1 0 wb
PC AddrD 1
addr
addr Inst[19:15]
0 DataR
inst
inst AddrA DataA 0 alu
pc+4
Inst[24:20]
Branch + addr mem
AddrB DataB Comp 0 ALU
clk DataW
IMEM
IMEM Reg [ ] 1 DMEM
Inst
clk Reg[rs2] clk
[31:7] Imm.
Gen Imm[31:0]
PCSel Inst[31:0] ImmSel RegWEn BrUn BrLT Bsel ALUSel MemRW WBSel
=* =* =0 =Read =1
=pc+4 Control logic =* =1 BrEq =* Asel =add
=0
Clock
PC 1000 1004
wb Reg[2]+Reg[3] Reg[7]+Reg[9]
Reg[1] ??? Reg[2]+Reg[3]
CS61C L31 Control 9 Garcia, Nikolić, Fall 2018 © UCB
Example: sw
+4
Add
Add
pc+4 2
wb pc
DataD alu
Reg[rs1] 1
alu Inst[11:7]
1 0 wb
PC AddrD 1
addr
addr Inst[19:15]
0 DataR
inst
inst AddrA DataA 0 alu
pc+4
Inst[24:20]
Branch + addr mem
AddrB DataB Comp 0 ALU
clk DataW
IMEM
IMEM Reg [ ] 1 DMEM
Inst
clk Reg[rs2] clk
[31:7] Imm.
Gen Imm[31:0]
+4
Add
Add
pc+4 2
wb pc
DataD alu
Reg[rs1] 1
alu Inst[11:7]
1 0 wb
PC AddrD 1
addr
addr Inst[19:15]
0 DataR
inst
inst AddrA DataA 0 alu
pc+4
Inst[24:20]
Branch + addr mem
AddrB DataB Comp 0 ALU
clk DataW
IMEM
IMEM Reg [ ] 1 DMEM
Inst
clk Reg[rs2] clk
[31:7] Imm.
Gen Imm[31:0]
PCSel Inst[31:0] ImmSel RegWEn BrUn BrLT Bsel ALUSel MemRW WBSel
=1 =Read
=B =0 =0 =* Asel =add =*
Control logic BrEq =1
Gen Imm[31:0]
R[rd] = R[rs1]+imm
PCSel Inst[31:0] ImmSelRegWEn BrUn BrLT Bsel ALUSel MemRW WBSel
BrEq Asel
Control logic
Gen Imm[31:0]
R[rd] = R[rs1]+imm
PCSel Inst[31:0] ImmSelRegWEn BrUn BrLT Bsel ALUSel MemRW WBSel
BrEq Asel
Control logic
IF ID EX MEM WB Total
I-MEM Reg ALU D-MEM Reg W
Read
200 ps 100 ps 200 ps 200 ps 100 ps 800 ps
CS61C L31 Control 14 Garcia, Nikolić, Fall 2018 © UCB
Instruction Timing
•ROM
•“Read-Only Memory”
•Regular structure
•Can be easily reprogrammed
fix errors
add instructions
•Popular when designing control logic manually
•Combinatorial Logic
•Today, chip designers use logic synthesis tools
to convert truth tables to networks of gates
Not in CS61C
Decoder
.
Address
Inst[] 11 . .
BrEQ . .
BrLT .
jal
Machine
Interpretation
Hardware Architecture Description
(e.g., block diagrams)
Architecture
Implementation