Single Cycle Processor Design: Computer Architecture and Assembly Language
Single Cycle Processor Design: Computer Architecture and Assembly Language
CSE 333
Computer Architecture and Assembly Language
Op6 immediate26
0 zero
A
ALU, Adder 16
Extend
32 m
u L
32
ALU result
x 32 U overflow
Immediate extender 1
ExtOp select ALU control
Multiplexers
Storage Elements
32
Instruction Data
32 32
Memory
32 32
PC
Address Address
Instruction memory 32 Data_out
32
Instruction Data_in
Data memory Memory
PC register Registers
MemRead MemWrite
5 32
Register file 5
RA BusA
32
RB BusB
Clocking methodology 5
RW
BusW
5
RA selects register to be read on BusA 5
RB
32
BusB
RW
RB selects register to be read on BusB
Clock
RW selects the register to be written BusW
RegWrite
ALUCtrl
30
+1
Instruction Registers 32
Memory Rs 5
30 32 RA BusA A 32
00
Instruction Rt 5 L
32 RB
Address BusB 32 U
PC
Rd 5
RW ALU result
BusW
Control signals
ALUCtrl is derived from the funct field because Op = 0 for R-type
RegWrite is used to enable the writing of the ALU result
Datapath for I-type ALU Instructions
Op6 Rs5 Rt5 immediate16
RegWrite
ALUCtrl
30
+1
Instruction Registers 32
Memory Rs 5
30 32 RA BusA A 32
00
Instruction 5
32 L
32 RB
Address BusB 32 U
PC
Rt 5
RW ALU result
BusW
ExtOp
Instruction Rt 5 32 L
32
Address
RB BusB 0
m U source register
PC
0
m
u
u
x Rt data on BusB
RW BusW
Rd x
1
1 or the extended
ExtOp 32 ALUSrc
5 immediate
A mux selects RW RegDst ALU result
Extender
as either Rt or Rd Imm16
Control signals
ALUCtrl is derived from either the Op or the funct field
RegWrite enables the writing of the ALU result
ExtOp controls the extension of the 16-bit immediate
RegDst selects the register destination as either Rt or Rd
ALUSrc selects the 2nd ALU source as BusB or extended immediate
Adding Data Memory to Datapath
A data memory is added for load and store instructions
ExtOp ALUCtrl MemRead MemWrite
Imm16 32 ALUSrc
Extender MemtoReg
ALU result
30
+1
Instruction Rs 5 32
RA BusA Data
30 Memory Memory 0
32
Registers A 32 m 32
00
Instruction Rt 5 L Address u
x
32 RB 32
Address
BusB 0
m U Data_out 1
PC
0
m u
u x Data_in
RW BusW
Rd x 1
1 32
5
RegDs
RegWrite
t
ALU calculates data memory address A 3rd mux selects data on BusW as
either ALU result or memory data_out
Additional Control signals
MemRead for load instructions BusB is connected to Data_in of Data
Memory for store instructions
MemWrite for store instructions
MemtoReg selects data on BusW as ALU result or Memory Data_out
Controlling the Execution of Load
ExtOp = ‘sign’ to sign-extend
Immmediate16 to 32 bits ExtOp ALUCtrl
MemRead MemWrite
= sign = ADD
=1 =0
ALUSrc MemtoReg
Imm16 32
Extender =1 =1
ALU result
30
+1
Instruction Rs 5 32
RA BusA Data
30 Memory Memory 0
32
Registers A 32 m 32
00
Instruction Rt 5 L Address u
x
32 RB 32
Address
BusB 0
m U Data_out 1
PC
0
m u
u x Data_in
RW BusW
Rd x 1
1 32
5
RegDst RegWrite
RegDst = ‘0’ selects Rt =0 =1
as destination register MemRead = ‘1’ to read data memory
ALUSrc = ‘1’ selects extended immediate as MemtoReg = ‘1’ places the data read
second ALU input from memory on BusW
ALUCtrl = ‘ADD’ to calculate data memory RegWrite = ‘1’ to write the memory
address as Reg(Rs) + sign-extend(Imm16) data on BusW to register Rt
Adding Jump and Branch to Datapath
30 Jump or Branch Target Address
30 30
MemRea
MemWrite
Next d
Imm26
PC MemtoReg
ALU result
PCSrc +1 Imm16
zero
Instruction Rs 5
BusA Data
RA
Memory Memory 0
30 32
Registers Ext A m 32
00
Instruction
0 Rt 5 L Address u
x
m RB 32
u Address
BusB 0
m U Data_out 1
PC
0
x m u
1 u x Data_in
RW BusW
Rd x 1
1
5
RegDst RegWrite
ALUSrc ALUCtrl J, Beq, Bne
30 30
Instruction
0 Rt 5 L Address u
x
m RB 32
u Address
BusB 0
m U Data_out 1
PC
0
x m u
1 u x Data_in
RW BusW
Rd x 1
1
5
func
ALU
Op
Ctrl MemRead
Main
Control
Drawbacks of Single Cycle Processor
Long cycle time
All instructions take as much time as the slowest