Title: The Datapath
1The Datapath
- Andreas Klappenecker
- CPSC321 Computer Architecture
2Administrative Issues
- WebCT news, chat, grades
- https//webct.tamu.edu
- Quantum Computing Seminar
- Chance to make 356
- Fair Scholarship in Telecommunications
- 1000 for five qualified students in Computer
Science or Comp. Eng. (CPSC) - Computer Science Logo Contest
- 1000 for best logo
3Administrative Issues
- Talk by David Patterson
- Friday, October 10, 410pm, HRBB 124
- Project 0 due October 10
- Exam, October 17
- Invited Admissions for UGrads
4Goal of this lecture
- Create a single datapath for
- lw, sw
- beq (j later)
- add, sub, and, or, slt
- Our line of attack
- We recall datapaths of these operations
- and compose their datapaths
5Instruction Word Formats
- Register format
- Immediate format
- Jump format
op-code rs rt
rd shamt funct
6 5 5 5 5
6
op-code rs rt
immediate value
6 5 5 16
op-code 26 bit current
segment address
6 26
6Requirements of the Instruction Set
- Memory
- Register file
- PC
- Sign extender
- ALU
- Add 4 to increase PC
7Hardware components
8Instruction Fetch PC update
9R-Format Instructions
op-code rs rt
rd shamt funct
6 5 5 5 5
6
10Datapath for a load and store
- register access
- memory access calculation
- read or write from memory
- in the case of a load, write into register file
11Marrying two Datapaths
12Datapaths for Instruction Fetch, Memory and
R-type Instructions
A
L
U
o
p
e
r
a
t
i
o
n
A
L
U
o
p
e
r
a
t
i
o
n
3
3
M
e
m
W
r
i
t
e
M
e
m
W
r
i
t
e
M
e
m
t
o
R
e
g
M
e
m
t
o
R
e
g
A
L
U
S
r
c
A
L
U
S
r
c
Z
e
r
o
Z
e
r
o
A
L
U
o
p
e
r
a
t
i
o
n
3
A
L
U
A
L
U
A
L
U
A
L
U
r
e
s
u
l
t
A
d
d
r
e
s
s
r
e
s
u
l
t
A
d
d
r
e
s
s
M
e
m
W
r
i
t
e
M
e
m
t
o
R
e
g
A
L
U
S
r
c
Z
e
r
o
A
L
U
A
L
U
r
e
s
u
l
t
A
d
d
r
e
s
s
R
e
g
W
r
i
t
e
R
e
g
W
r
i
t
e
M
e
m
R
e
a
d
M
e
m
R
e
a
d
x
t
e
n
d
x
t
e
n
d
R
e
g
W
r
i
t
e
M
e
m
R
e
a
d
x
t
e
n
d
Note the added multiplexor switching between
register 2 and sign-extended immediate value
13Datapath for a Branch
Use ALU to evaluate the branch condition, another
adder for branch target PC 4 (sign extended
16 bits)gtgt2
14Marrying Branches with Rest
Output of Sign extend goes where? Output of PC
adder goes where?
15Datapath for MIPS instructions
Seven control signals
16ALU Control
- For load and store instructions
- Use ALU to compute memory address by addition
(add immediate value) - For R-type instructions
- Perform addition, subtraction, and, or, slt
- value depends on 6bit function field
- For beq
- perform subtraction
17ALU Control Logic (Recall ALU)
Depending on instruction, the ALU has to perform
one of the five operations
ALU cntrl Function
000 and
001 or
010 add
110 subtract
111 slt
18ALU Control
- Must describe hardware to compute 3-bit ALU
control input - ALU control bits depend on ALUOp control bits
- and different functions codes for R-type
instructions
19ALU Control
20Datapath for MIPS instructions
Note the seven control signals!
21Generating Control Signals
- Opcode field of instruction
- yields control signals
- and ALUOp signals
22Control
23Summary