Fundamentals of Computer Systems: A Single Cycle MIPS Processor
Fundamentals of Computer Systems: A Single Cycle MIPS Processor
Fundamentals of Computer Systems: A Single Cycle MIPS Processor
Spring 2012
Illustrations Copyright 2007 Elsevier
Supported instructions: R-type: and, or, addu, subu, slt Memory instructions: lw, sw Branch instructions: beq Version 2.0: I-type: addiu J-type: j
CLK PC'
32
CLK PC
32 32
RD
5 32 5
A1 A2 A3 WD3
Instruction Memory
5 32
Register File
32
RD Data Memory WD
32
B
N
ALU
N Y
F2
F2 0 0 0 0 1 1 1 1
F1 0 0 1 1 0 0 1 1
F0 0 1 0 1 0 1 0 1
[N-1]
+ S
2
N
F1:0
CLK
25:21
PC'
Instruction Memory
Instruction Memory
15:0
010 Zero
ALU
ALUResult
Instruction Memory
SrcB
SignImm
15:0
Sign Extend
CLK A1 A2 A3 WD3
1 WE3
ALU
RD1 RD2
ALUResult
Instruction Memory
20:16
SrcB
Register File
SignImm
15:0
Sign Extend
CLK A1 A2
20:16
1 WE3
ALU
RD1 RD2
ALUResult
Instruction Memory
SrcB
A3 WD3
Register File
PCPlus4 SignImm
15:0
Sign Extend
Result
CLK A1 A2 A3 WD3
0 WE3
ALU
RD1 RD2
ALUResult
Instruction Memory
20:16 20:16
SrcB
Register File
WriteData
PCPlus4 SignImm
15:0
Sign Extend
Result
RegDst 1
MemtoReg 0
CLK A1 A2
1 WE3
ALU
RD1 RD2
ALUResult
ReadData
0 1
Instruction Memory
20:16
0 SrcB 1
WriteData
PCPlus4
15:0
0 1
SignImm
Result
RegDst x
MemtoReg x
CLK 0 1 PC'
ALU
A1
WE3
RD1
ALUResult
ReadData
Instruction Memory
20:16
0 1
0 SrcB 1
WriteData
20:16 15:11
PCPlus4
15:0
SignImm
<<2
PCBranch
Result
offset
PCSrc
31:26 5:0
ALU
ALUResult
Instruction Memory
20:16
0 SrcB 1
WriteData
20:16 15:11
PCPlus4
15:0
SignImm
<<2
PCBranch
Result
Op
rs
Funct
or rd, rs, rt rs rt rd
Control Unit
Opcode5:0
Main Decoder
Part of the control unit responsible for implementing the opcode Funct eld.
ALU Op 00 -1 11111Funct 100001 100011 100100 100101 101010 ALU Ctrl. 010 110 010 110 000 001 111 ALU Function Add Subtract Add Subtract AND OR Slt
Funct5:0
ALUControl 2:0
31:26 5:0
MemtoReg Control MemWrite Unit Branch ALUControl2:0 Op ALUSrc Funct RegDst RegWrite
PCSrc
ALU
ALUResult
Instruction Memory
20:16
0 SrcB 1
WriteData
20:16 15:11
PCPlus4
15:0
SignImm
<<2
PCBranch
Result
31:26 5:0
MemtoReg Control MemWrite Unit Branch ALUControl2:0 Op Funct ALUSrc RegDst RegWrite
0 PCSrc
0 0 1 PC'
CLK PC A RD Instr
25:21
CLK A1 A2
0 WE 0 ReadData 0 1
ALU
Instruction Memory
20:16
WriteData
RD Data Memory WD
PCPlus4
15:0
<<2
PCBranch
Result
31:26 5:0
MemtoReg Control MemWrite Unit Branch ALUControl2:0 Op ALUSrc Funct RegDst RegWrite
PCSrc
ALU
ALUResult
Instruction Memory
20:16
0 SrcB 1
WriteData
20:16 15:11
PCPlus4
15:0
SignImm
<<2
PCBranch
Result
31:26 5:0
MemtoReg Control MemWrite Unit Branch ALUControl2:0 Op ALUSrc Funct RegDst RegWrite
PCSrc
ALU
ALUResult
Instruction Memory
20:16
0 SrcB 1
WriteData
20:16 15:11
PCPlus4
15:0
SignImm
<<2
PCBranch
Result
31:26 5:0
MemtoReg Control MemWrite Unit Branch ALUControl2:0 Op ALUSrc Funct RegDst RegWrite
PCSrc
ALU
ALUResult
Instruction Memory
20:16
0 SrcB 1
WriteData
20:16 15:11
PCPlus4
15:0
SignImm
<<2
PCBranch
Result
0 0 1 0
0 1 -
100 00 01
PCSrc
31:26 5:0
ALU
ALUResult
Instruction Memory
20:16
0 SrcB 1
WriteData
20:16 15:11
PCPlus4
15:0
SignImm
<<2
PCBranch
Result
0 1 1 0 1
0 0 0 1 0
0 0 1 0 0
0 1 0
100 00 01 00
PCSrc
31:26 5:0
ALU
ALUResult
Instruction Memory
20:16
0 SrcB 1
WriteData
20:16 15:11
PCPlus4
15:0
SignImm
<<2
PCBranch
Result
1 0 0 MemtoReg Control MemWrite Unit Branch ALUControl2:0 Op ALUSrc Funct RegDst RegWrite
0 1 1 0 1 -
0 0 0 1 0 -
0 0 1 0 0 0
0 1 0 -
100 00 01 00 --
0 0 0 0 0 1
PCSrc
31:26 5:0
ALU
ALUResult
Instruction Memory
20:16
0 SrcB 1
WriteData
20:16
PCJump
15:11
PCPlus4
15:0
4
27:0 31:28
SignImm
<<2
25:0
<<2
PCBranch
Processor Performance
Seconds Program
Instructions Program
Seconds Program Instructions Program Clock Cycles Instruction Seconds Clock Cycle
How long you have to wait Number that must execute to complete the task CPI: Cycles per instruction The clock period (1/frequency)
PCSrc
31:26 5:0
CLK A1 A2 A3
0 WE 1 ReadData 0 1
ALU
Instruction Memory
20:16
WriteData
RD Data Memory WD
PCPlus4
15:0
SignImm
<<2
PCBranch
Result
MemtoReg Control MemWrite Unit Branch ALUControl 2:0 Op ALUSrc Funct RegDst RegWrite
PCSrc
CLK A1 A2 A3 WD3
20:16 15:11
1 WE3
0 WE ReadData 0 1
ALU
Instruction Memory
20:16
Register File
WriteData
RD Data Memory WD
PCPlus4
15:0
SignImm
<<2
PCBranch
Result
TC
= = = =
tpcq-PC + tmem-I + tRFread + tALU + tmem-D + tmux + tRFsetup (30 + 250 + 150 + 200 + 250 + 25 + 20) ps 925 ps 1.08 GHz
For a 100 billion-instruction task on our single-cycle processor with a 925 ps clock period,
Seconds Program
Instructions Program
925 ps