Lecture 3 DataPath Components
Lecture 3 DataPath Components
Datapath Components
Comparator
Multipliers
ALU (Arithmetic and Logic Unit)
1
10/18/2023
Datapath Components
Comparators
a3 b3 a2 b2 a1 b1 a0 b0
0110 = 0111 ? 0 0 1 1 1 1 0 1
a3 a2 a1 a0 b3 b2 b1 b0
1 1 1 0
4-bit equality comparator
eq
(b)
0 eq
(a)
3
Datapath Components
Magnitude Comparator
2
10/18/2023
Datapath Components
Magnitude Comparator
a3 b3 a2 b2 a1 b1 a0 b0
a b a b a b a b
Igt in_gt out_gt in_gt out_gt in_gt out_gt in_gt out_gt AgtB
Ieq in_eq out_eq in_eq out_eq in_eq out_eq in_eq out_eq AeqB
Ilt in_lt out_lt in_lt out_lt in_lt out_lt in_lt out_lt AltB
0 Igt a3 a2 a1 a0 b3 b2 b1 b0
AgtB
1 Ieq 4-bit magnitude comparator AeqB
0 Ilt AltB
(b)
5
Datapath Components
8 bit Magnitude Comparator
A[7:4] B[7:4] A[3:0] B[3:0]
3
10/18/2023
Datapath Components
Magnitude Comparator
a3 b3 a2 b2 a1 b1 a0 b0
a b a b a b a b
Igt in_gt out_gt in_gt out_gt in_gt out_gt in_gt out_gt AgtB
Ieq in_eq out_eq in_eq out_eq in_eq out_eq in_eq out_eq AeqB
Ilt in_lt out_lt in_lt out_lt in_lt out_lt in_lt out_lt AltB
Each stage:
out_gt = in_gt + (in_eq * a * b’)
A>B (so far) if already determined in higher stage, or if higher stages equal but in this stage a=1
and b=0
out_lt = in_lt + (in_eq * a’ * b)
A<B (so far) if already determined in higher stage, or if higher stages equal but in this stage a=0
and b=1
out_eq = in_eq * (a XNOR b)
A=B (so far) if already determined in higher stage and in this stage a=b too
Simple circuit inside each stage, just a few gates (not shown)
Datapath Components
Magnitude Comparator Example: Minimum of Two Numbers
11000000 01111111
a
MIN A B 8 8
8 8 8 8
A B
A B 1 I1 I0 M in
0 Igt AgtB s
8-bit magnitude comparator
0 8-bit
C
1 Ieq AeqB
0 Ilt
0 2x1 mux 8
AltB
8
(b)
C
(a)
01111111
4
10/18/2023
Datapath Components
Multipliers – Array Style
Datapath Components
Multipliers – Array Style
10
5
10/18/2023
Datapath Components
Multipliers – Array Style
a3 a2 a1 a0
b0
pp1
b1
0 0
pp2
b2
+ (5-bit)
00
pp3
b3
+ (6-bit) A B
0 00 *
pp4
P
+ (7-bit)
Block symbol
p7..p0
11
Datapath Components
Arithmetic Logic Unit (ALU)
12
6
10/18/2023
Datapath Components
Multifunction Calculator without an ALU
LEDs
13
Datapath Components
ALU Example: Multifunction Calculator
1 1 1 1
0 0 0 0
8 8 6 6
A B A B
1 0 A B
Wasted x
+ Ð +1 AND OR XOR NOT power x
y ALU
8 8 8 y
8 z z S
8 8 8
8 6
1 0 0 1 2 3 4 5 6 7 A lot of wi res.
x e
y s2 ld
s1 6-bit register
z s0 8-bit 8x1 mux clk
8 6 CALC
e Id
8-bit register
clk CALC LEDs
8
LEDs
14
7
10/18/2023
Datapath Components
Arithmetic-Logic Unit (ALU)
15
Datapath Components
Arithmetic-Logic Extender in Front of ALU
xyz=000
Want S=A+B
Pass a to ia, b to ib, and set cin=0
xyz=001
Want S=A-B
Pass a to ia, b’ to ib, and set cin=1
xyz=010
Want S=A+1
Pass a to ia, set ib=0, and set cin=1
xyz=011
Want S=A
Pass a to ia, set ib=0, and set cin=0
xyz=100
Want S=A AND B
Set ia=a*b, b=0, and cin=0
others: likewise
Based on above
Create logic for ia(x,y,z,a,b) and ib(x,y,z,a,b)
for each abext
Create logic for cin(x,y,z), to complete design
of the AL-extender component
16
8
10/18/2023
Datapath Components
Designing an ALU – Example 1
a1 b1 a0 b0
Given a 2-bit ALU,
AL-ext
Find its operation table 0 0 0 0 0 1 0 0
Inputs
Outputs 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3
x y x
0 0 S=
y
ia1 ib1 ia0 ib0 cin
0 1 S=
1 0 S=
1 1 S=
IA IB
2-bit Adder cin
17