Professional Documents
Culture Documents
The Processor
A simple processor executing few RISC V instructions
SANTA CLARA UNIVERSITY
The Task
• Design a RISC V processor that can execute the following instructions:
1. Load word, lw
2. Store word, sw
3. Branch if equal, beq
4. R-type subset, two register operand arithmetic/logic:
• Add, add
• Subtract, sub
• And, and
• Or, or
• This subset –albeit small- is powerful enough to build programs (but
no use of functions).
7/15/2022
SANTA CLARA UNIVERSITY
Additional Requirement
7/15/2022
SANTA CLARA UNIVERSITY
The Plan
• Understand what a processor does
• Identify and understand the building blocks used,
• Build the processor gradually,
• Understand the control signal generation and use,
• Figure out how to calculate timing
• Misc.:
• Examples of extra instructions
• Looking inside the register file.
7/15/2022
SANTA CLARA UNIVERSITY
7/15/2022
SANTA CLARA UNIVERSITY
7/15/2022
SANTA CLARA UNIVERSITY
MemRead MemWrite
7/15/2022
SANTA CLARA UNIVERSITY
7/15/2022
SANTA CLARA UNIVERSITY
7/15/2022
SANTA CLARA UNIVERSITY
|
5
Register
file
• Reading/Writing a register in register file is
ReadData2
| slower than accessing a separate register.
32
WriteData • More details provided at end of document.
|
32
RegWrite
7/15/2022
SANTA CLARA UNIVERSITY
32
Imm[11:0] Rs1[4:0] func Rd[4:0] Opcode[6:0]
7/15/2022
SANTA CLARA UNIVERSITY
7/15/2022
SANTA CLARA UNIVERSITY
7/15/2022
SANTA CLARA UNIVERSITY
7/15/2022
SANTA CLARA UNIVERSITY
Instruction Fetch
• Repeated instruction fetch!
• Nothing more.
+
• Every clock cycle the PC is
incremented by 4 & a word is read
off the memory.
• The word (instruction) goes out to a
black hole.
Instruction
7/15/2022
SANTA CLARA UNIVERSITY
• Control unit,
Memory 32
5
Rd Register File
|
• Immediate Generation
• Note: some instruction bits sent to
Immed. Gen
32
Rd
| Register file
32
RegWrite
7/15/2022
SANTA CLARA UNIVERSITY
Rs1
|
5
Instruction Rs2 | Zero
PC | 32
Memory
5 Address Data
Rd Register |
| 32 Memory
5 File
Write Data
Data In
(for sd)
RegWrite
32-bit immediate
7/15/2022
SANTA CLARA UNIVERSITY
Rs1
|
5
Instruction Rs2 | Zero
PC | 32
Rs1 Memory
|
5 Address Data
5 Rd Register |
| 32 Memory
Instruction Rs2 | Zero 5 File
PC | 32
Memory Write Data
5
Rd
| Register file Data In
5 (for sd)
ReadData2
| ALU Operation= 4 bits
32 Immed. Gen
MemRead MemWrite
ALU Operation= 4
RegWrite
bits
WriteData
32-bit immediate
Immed. Gen
RegWrite
32
Complete Datapath
C + <<1
C
o
n
t
r
o
Opcode & l
func* fields Beq
Control
+ Unit S
i
g
n
a
l
s
Rs1
|
5
Instruction Rs2 |
PC | 32
Memory
5 Address Data
Rd Register |
| 32 Memory
5 File
Write Data
Data In
(for sd)
B ALU Op
Immed. Gen
MemRead MemWrite
RegWrite
A
32-bit immediate
7/15/2022
SANTA CLARA UNIVERSITY
7/15/2022
SANTA CLARA UNIVERSITY
7/15/2022
SANTA CLARA UNIVERSITY
7/15/2022
SANTA CLARA UNIVERSITY
7/15/2022
SANTA CLARA UNIVERSITY
is_error.
2. Stage two: used these signals to
generate RISC V (blue) control signals
• MemWrite, MemRead, AluSrc, etc.
7/15/2022
SANTA CLARA UNIVERSITY
7/15/2022
SANTA CLARA UNIVERSITY
7/15/2022
SANTA CLARA UNIVERSITY
7/15/2022
SANTA CLARA UNIVERSITY
Load Timing
400
500
C + <<1
700
C
o
0 n
t
400 r
Opcode & o
100
func* fields l
S
Control
+ Unit i
•
g
ALU 200 ps, n
a
l
• Adders= 100 ps, s
Data In
32
A 1100
32-bit immediate 400
400
7/15/2022
SANTA CLARA UNIVERSITY
Summing Up
• While other instructions may need less than 1400 to complete, clock
cycle has to be large enough to tolerate the load instruction.
• A pipelined data path will fix this problem.
7/15/2022