Professional Documents
Culture Documents
Lab #3
Lab #3 has been posted
Due Friday, March 6 by 6pm (demo and report)
Requires downloading MARS, a MIPS simulator
Lecture 16, 17 & 18: Single Cycle Processor Design
Remember, this lab is to be done alone. All code should be
March 2, 4, 6, 2015 written by you alone.
Prof. R. Iris Bahar
Multi-cycle
Programming Language We will examine a number of MIPS implementations
Operating System/Virtual Machine
Each instruction is broken up into a series A simplified single-cycle version
Instruction Set Architecture (ISA)
of shorter steps
Microarchitecture A more realistic pipelined version
Pipelined
Register-Transfer Level (RTL) Simple subset, shows most aspects
Each instruction is broken up into a series
Circuits
of steps Memory reference: lw, sw
Devices
Multiple instructions execute at once. Arithmetic/logical: add, sub, and, or, slt
Physics
Superscalar Control transfer: beq, j
Multiple instructions fetched, decoded
and executed simultaneously. 3 4
1
3/1/2015
5 6
8 9
2
3/1/2015
CLK CLK
CLK
WE3 WE
CLK CLK PC' PC Instr
25:21
A1 RD1
CLK A RD
25:21
WE3 WE A RD
A1 RD1 Instruction
PC' PC Instr A2 RD2 Data
A RD Memory
A RD A3 Memory
Instruction Register
A2 RD2 Data WD3 WD
Memory File
A3 Memory
Register
WD3 WD
File
15:0 SignImm
Sign Extend
10 11
ALUResult A RD
ALU
ALUResult ReadData
A RD A RD
Instruction Instruction
A2 RD2
A2 RD2 SrcB Data Memory SrcB Data
Memory 20:16
A3 Memory A3 Memory
Register
Register WD3 WD
WD3 WD File
File
SignImm
15:0
SignImm Sign Extend
15:0
Sign Extend
12 13
3
3/1/2015
ALU
ALU
ALUResult ReadData ALUResult ReadData
A RD A RD
Instruction Instruction 20:16
A2 RD2 SrcB Data A2 RD2 SrcB
Memory Memory Data
20:16
A3 Memory 20:16
A3 Memory
Register Register WriteData
WD3 WD WD3 WD
File File
PCPlus4 PCPlus4
+
+
SignImm SignImm
4 15:0
Sign Extend 4 15:0
Sign Extend
Result
Result
14 15
ALU
1 ALUResult ReadData
A3 1 Memory A RD 1
Register WriteData Instruction 20:16
WD3 WD A2 RD2 0 SrcB Data
File Memory
A3 1 Memory
20:16 Register WriteData
0 WD3 WD
15:11 File
1 20:16
WriteReg4:0 0
PCPlus4 15:11
+
1
SignImm WriteReg4:0
4 15:0 PCPlus4
+
Sign Extend
SignImm
4 15:0
<<2
Sign Extend PCBranch
+
Result
Result
16 17
4
3/1/2015
18 19
20 21
5
3/1/2015
R-type 000000 1 1 0 0 0 0 0 10
lw 100011 1 0 1 0 1 0 1 00
sw 101011 0 X 1 0 0 1 X 00
beq 000100 0 X 0 1 0 0 X 01
addi
001000 1 0 1 0 0 0 0 00
[without jumps]
22 23
Instruction Op5:0 RegWrite RegDst AluSrc Branch MemWrite MemtoReg ALUOp1:0 Jump
j 000010 0 X X X 0 X XX 1
24
25
6
3/1/2015
= # instructions x CPI x TC
5:0
Funct RegDst
RegWrite
CLK CLK
CLK 1 0
010 1
25:21
WE3 SrcA Zero WE
0 PC' PC Instr A1 RD1 0
A RD
ALU
1 ALUResult ReadData
CPI = 1 Instruction
Memory
20:16
A2 RD2
1
0 SrcB
A RD
Data
1
A3 1 Memory
Register WriteData
What is TC? 20:16
WD3
File
0
WD
0
15:11
1
WriteReg4:0
PCPlus4
+
SignImm
4 15:0 <<2
Sign Extend PCBranch
+
Result
26 27
7
3/1/2015
Summary
Single-cycle processor design is simple
Plenty of room for improvement:
Pipelining
Superscalar
In Lab#4 you will design, implement and boot your first
processor!
30