Unit 1 Processor Datapath Design: o o o o
Unit 1 Processor Datapath Design: o o o o
Unit 1
Processor datapath design
Introduction
Building the datapath
o Searching new instructions in memory
o Type R Instructions
o Load and Store Instructions
o A first scheme of a processor
Multiplexors
Control
o Conditions Branch Instructions
o The complete datapath
The datapath control
o The ALU control
o Designing the Main Control Unit
o The datapath with the control signals
Conclusions
Unit 1: 1
Introduction
The performance of a processor depends on several factors:
Execution Time = NI x CPI x Cycle
o Number of instructions: determined by the ISA and the compiler
o CPI and Cycle: determined by CPU hardware
We will study two implementations of the MIPS processor:
o A simplified version (a review of the design studied in the previous course)
o A more realistic pipelined version
A simple MIPS subset instructions will be used
o Memory accesses: lw, sw
o Arithmetic/logic Operations: add, sub, and, or, slt
o Control transferences (branches): beq, j
We will show that ISA determines a lot of the aspects of the implementation and
how the election among several implementation strategies affects the size of the
Unit 1: 2
clock cycle and the CPI of the computer.
The MIPS ISA only has three instructions formats, all of them of 32 bits:
o Instructions with immediate (type I)
load and stores
all the operations with immediate
conditional branch instructions: bne, beq
o Instructions between registers (type R)
ALU operations register-register
func codifies the datapath operation
special read/write registers and transfers
o Unconditional Branch instructions (type J)
Branch
Branch and return
Trap and return after the exception
Unit 1: 3
Register of
32 bits
Increases the
address by 4
for the next
instruction
Unit 1: 5
Type R instructions
Unit 1: 6
lw $t1, 16($t2)
Unit 1: 7
Unit 1: 8
Multiplexors
We cannot join directly wires
o Multiplexors are used
Unit 1: 9
Control
Unit 1: 10
Unit 1: 11
Unit 1: 12
M
u
x
Unit 1: 14
Unit 1: 15
0
1
Unit 1: 16
Instrucciones
PCSrc
MemRead
MemtoReg
MemWrite
ALUSrc
RegWrite
Unit 1: 17
ALU Control
The ALU is used for
o Load/Store: the operation to be performed is add
o Branch: the operation to be performed is subtract
o R-type: the operation to be performed depends on the funct field:
AND, OR, subtract, add, or set less than.
ALU control
Function
0000
AND
0001
OR
0010
add
0110
subtract
0111
set-on-less-than
1100
NOR
Only for
shifts
Unit 1: 19
ALU Control
We can generate 4 bits to control the ALU using a simple control unit with input
the funct field of the ALU instruction and 2 bits of configuration (ALUOp)
generated by the main control unit.
Assuming 2 bits ALUOp generated based on the instruction opcode:
o ALUOp = 00 an add operation must be performed for a load or a store.
o ALUOp = 01 a subtract operation must be performed for a conditional branch.
o ALUOp = 10 the specific operation to be performed is codified in the funct field.
Unit 1: 20
ALU Control
Using two control levels the size and complexity of the main control unit can be
reduced.
The ALU control unit is simple because a lot of combinations arent interesting.
Unit 1: 21
ALU Control
The truth table for the bit Operation2=1 is:
Unit 1: 22
ALU Control
The control block which generates the 4 bits that govern the ALU has as
inputs:
o The 2 bits ALUOp
o The 6 bits of the funct field of the type-R operations.
Unit 1: 23
Load/
Store
Branch
rs
rt
rd
shamt
funct
31:26
25:21
20:16
15:11
10:6
5:0
35 or 43
rs
rt
address
31:26
25:21
20:16
15:0
rs
rt
address
31:26
25:21
20:16
15:0
Opcode
They
are
always
read
They are
always
read
except
for a load
Where to
write for a
type-R
instruction
and a load
Only
for
shifts
Unit 1: 25
Autonomous Activity
Review the execution process for each type of instruction in the previous datapath:
o Type-R instructions
o Load instruction
o Store instruction
o Conditional Branch instruction
Instructions
ALUOp
MemWrite
ALUSrc
RegWrite
Type-R
Load
Store
Conditional Branch
Unit 1: 26
Unit 1: 27
Unit 1: 28
Autonomous activity
Unconditional branches cannot be executed in the previous datapath.
Modify the implementation to be able to execute unconditional branches (Exercice 13).
Unit 1: 29
Unit 1: 30
Conclusions
We have reviewed the main elements that compose a processor datapath.
These elements have been interconnected to form the datapath.
We have also studied which control signals must be included and how to
obtain them.
For each instruction type, we have thoroughly studied how the designed
datapath works.
Unit 1: 31