Lecture 2 DataPath Components
Lecture 2 DataPath Components
Datapath Components
N-bit muxes
Multifunction Register
Shifters
Counters
Timers
Register files
1
10/9/2023
Datapath Components
N-bit Mux
Example: Two 4-bit inputs, A (a3 a2 a1 a0), and B (b3 b2 b1 b0)
4-bit 2x1 mux (just four 2x1 muxes sharing a select line) can select between A or B
2x1
a3 i0 Simplifying
d
b3 i1 notation:
s0
4-bit 4
2x1 4 C
a2 i0 2x1
d A I0 4
b2 i1 D C is short
s0 4
B I1 for
2x1
a1 i0 s0
d
b1 i1 c3
s0
s0 c2
i0 2x1
a0
d c1
b0 i1
s0
s0 c0
Datapath Components
N-bit Mux Example
A 8
I1 8 D To the
I 8 D above-mirror
I2
display
M 8
I3
s1 s0
x y
We will design
this later
button
2
10/9/2023
Datapath Components
Registers
I3 I2 I1 I0
4-bit register
load I3 I2 I1 I0
D D D D reg(4)
Q Q Q Q
Q3 Q2 Q1 Q0
clk
Q3 Q2 Q1 Q0
Datapath Components
Register with Parallel Load
1 0 1 0 1 0 1 0
load 2x1
2mux
1 I3 I2 I1 I0
load
D D D D
Q3 Q2 Q1 Q0
Q Q Q Q
Q3 Q2 Q1 Q0
(a) (c)
I3 I2 I1 I0 I3 I2 I1 I0
load = 0
load = 1
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
D D D D D D D D
Q Q Q Q Q Q Q Q
Q3 Q2 Q1 Q0 Q3 Q2 Q1 Q0
(
(b)
6
3
10/9/2023
Datapath Components
Shift Registers
Shift right
Register contents
Move each bit one position right 1 1 0 1
before shift right
Shift in 0 to leftmost bit 0
Register contents
0 1 1 0
after shift right
Shift Register
Connect register’s flip-flop’s outputs to
next flip-flop’s input
This design would always shift on every
clock cycle shr_in
How can we control it?
Datapath Components
Shift Registers
1. 10011
2. 00010
3. 10000
4. 00001
4
10/9/2023
Datapath Components
Shift Register
shr_in
shr=1
shr 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
2 1
2 1
D D D D
D D D D
Q Q Q Q
Q Q Q Q Q3 Q2 Q1 Q0
Q3 Q2 Q1 Q0 (b)
(a)
shr_in
shr
Q3 Q2 Q1 Q0
(c)
9
Datapath Components
Rotate Register
10
5
10/9/2023
Datapath Components
Buses
11
Datapath Components
Register Example: Above-Mirror Display
2-4 decoder i0
8
0 8-bit
d1 load reg1 A
a0 4× 1 Mux
i0
i1
1 i1 8
a1 1 d D
d2 loadreg2 I 8
0001010
i2
8
d3 load reg3
e M
1 i3 s1 s0
load 8
x y
12
6
10/9/2023
Datapath Components
Shift Register Example: Above-Mirror Display
Datapath Components
Multifunction Registers
shr_in I3 I2 I1 I0
0 0 0 0
s1 3 2 1 0 3210 3210 3210
s0 4 1 shr_in I3 I2 I1 I0
s1
D D D D s0
Q3 Q2 Q1 Q0
Q Q Q Q
(b)
Q3 Q2 Q1 Q0
(a)
14
7
10/9/2023
Datapath Components
Multifunction Registers
s1 s0 Operation
0 0 Maintain present value
0 1 Parallel load
1 0 Shift right
1 1 Shift left
I3 I2 I1 I0
shr_in
shl_in
Q Q Q Q Q3 Q2 Q1 Q0
Q3 Q2 Q1 Q0
(a) (b)
15
Datapath Components
Multifunction Registers with Separate Control Inputs
?
0 1 0 Shift right combi- s1 shl_in
s0 shl_in
0 1 1 Shift right – shr has priority over shl shr national
1 0 0 Parallel load circuit Q3 Q2 Q1 Q0
1 0 1 Parallel load – ld has priority shl
1 1 0 Parallel load – ld has priority Q3 Q2 Q1 Q0
1 1 1 Parallel load – ld has priority
16
8
10/9/2023
Datapath Components
Register Operation Table
17