Lecture 2 DataPath Components 2
Lecture 2 DataPath Components 2
Datapath Components
N-bit muxes
Multifunction Register
Shifters
Counters
Timers
Register files
1
10/13/2023
Datapath Components
Register Design Process
Can design register with desired operations using simple four-step process
Datapath Components
Register Design Example
Inputs
clr set ld shl Operation
0 0 0 0 Maintain present value
0 0 0 1 Shift left
0 0 1 X Parallel load
0 1 X X Set to all 1s
1 X X X Clear to all 0s
I3 I2 I1 I0
shl I3 I2 I1 I0
s2
s1 shl_in
ld combi- s0 shl_in
national
set
circuit Q3 Q2 Q1 Q0
clr
Q3 Q2 Q1 Q0
2
10/13/2023
Datapath Components
Register Design Example
s2 s1 s0 Operation
Desired register operations 0 0 0 Maintain present value
Synchronous clear, synchronous set, load, shift 0 0 1 Parallel load
left (with this priority) 0 1 0 Shift left
0 1 1 Synchronous clear
1 0 0 Synchronous set
Step 1: Determine mux size 1 0 1 Maintain present value
1 1 0 Maintain present value
5 operations: above, plus maintain 1 1 1 Maintain present value
a
present value (don’t forget this one!) - In
1 0
-> Use 8x1 mux from
Qn-1
s2
s1 7 6 5 4 3 2 1 0
s0
Step 2: Create mux operation table
D
Qn
Step 4: Map control lines
Inputs Outputs
s2 = clr’set clr set ld shl s2 s1 s0 Operation
s1 = clr’set’ld’shl + clr 0 0 0 0 0 0 0 Maintain present value
s0 = clr’set’ld + clr 0 0 0 1 0 1 0 Shift left
0 0 1 X 0 0 1 Parallel load
0 1 X X 1 0 0 Set to all 1s
1 X X X 0 1 1 Clear to all 0s
a
5
Datapath Components
Register Design Example
I3 I2 I1 I0
shl I3 I2 I1 I0
s2
s1 shl_in
ld combi- s0 shl_in
national
set
circuit Q3 Q2 Q1 Q0
clr
Q3 Q2 Q1 Q0
3
10/13/2023
Datapath Components
Shifters
i3 i2 i1 i0 inR
i3 i2 i1 i0 inL
2 01 201 2 01 2 01
in
<<1 shL s0
01 01 01 01 shR s1
in sh
Symbol
a
q3 q2 q1 q0
q3 q2 q1 q0
q3 q2 q1 q0 Shifter with left shift, right
Left shifter
Shifter with left shift or shift, and no shift
no shift
Datapath Components
Shifter Example: Temperature Averager
0 >>2
0001010 (10)
a
Ravg
ld
Tavg
4
10/13/2023
Datapath Components
Strength Reduction
Datapath Components
Barrel Shifter
i3 i2 i1 i0
A shifter that can shift by any amount
in
4-bit barrel left shift can shift left by 0, 1, 2, 01 01 01 01
or 3 positions sh
8-bit barrel left shifter can shift left by 0, 1, 2,
3, 4, 5, 6, or 7 positions q3 q2 q1 q0
(Shifting an 8-bit number by 8 positions is Shift by 1 shifter uses 2x1 muxes. 8x1 mux
pointless -- you just lose all the bits) solution for 8-bit barrel shifter: too many
wires.
Could design using 8x1 muxes and lots of
wires
Too many wires Q: xyz=???
to shift by 5? I 00000110
8
More elegant design 1
Chain three shifters: 4, 2, and 1 x sh <<4 in 0
10
5
10/13/2023
Datapath Components
Counters
cnt
ld
4-bit register
4 4
4 +1 4
tc C
11
Datapath Components
Down-Counter
4 –1
tc C 4
12
6
10/13/2023
Datapath Components
Up/Down-Counter
4 4 4 4
4 –1 +1
4 4
1 2x1 0
tc C
13
Datapath Components
Counter with Parallel Load
4 +1
tc C
14
7
10/13/2023
Datapath Components
Counter with Parallel Load
15
16
8
10/13/2023
Datapath Components
Timers
Q unused
(a)
32
M
load
Q
enable 32-bit
1-microsec
(b)
Q timer
(c)
17
Datapath Components
Register Files
congestion
d15 load reg15 16*32 = 512
e
i15 wires
load 32 s3-s0
16 32-bit registers
begins to have fanout and wire problems
18
9
10/13/2023
Datapath Components
Register File
MxN register file: Efficient design for one-at-a-time write/read of many registers
Consider 16 32-bit registers
“read port”
W_data R_data
“write port”
19
Datapath Components
Register File
d q i0 32
W_addr i0
R_addr
i1 i1
q=d d2 load reg2 d2
Boosts signal 32
write read
decoder decoder
d3 load reg3 d3
e e
three-state driver
a 32
c W_en R_en
d q 4x32 register file
c=1: q=d d q
d
c=0: q= Z q
like no connection Note: Each driver in figure actually
represents 32 1-bit drivers
20
10
10/13/2023
Datapath Components
Register File Timing Diagram
Can write one register and read one register each clock cycle
May be same register
R_data Z Z Z Z
R_addr X X X
R_en
0: ? 0: 0: 0: 0: 0: 0:
1: ? 1: 1: 1: 1: 1: 1:
2: ? 2: 2: 2: 2: 2: 2:
3: ? 3: 3: 3: 3: 3: 3:
21
11