Mano CH 03 r1 Large
Mano CH 03 r1 Large
Hierarchical Design
1
Hierarchical Design
2
Ex.: 4-Bit Equality Comparator
Design
◼ Formulation (without truth table this time)
◼ Each corresponding bit of A and B array must
be equal
◼ Test each corresponding bit
◼ All tests must show that bits are equal for
output E = 1
◼ Use 4 comparison circuits MX
◼ Use 1 circuit ME combining MX outputs
3
Ex.: 4-Bit Equality Comparator
Design
◼ Optimization
◼ Choose output of MX to be 0 for Ai and Bi are
equal and 1 if unequal
Ni = Ai Bi + Ai Bi
E = N 0 + N1 + N 2 + N3
4
Ex.: 4-Bit Equality Comparator
Design
◼ A hierarchical representation
◼ Uses primitives – simple gates – at lowest levels as
“leaves” in the tree
◼ Branches are the MX and ME blocks with the root
being the overall function
◼ MX blocks are reusable in the design
◼ They must be implemented separately as instances in the
actual circuit
Simplified representation
showing reusable blocks
10
10
5
Technology Mapping
11
11
Technology Mapping
12
12
6
Technology Mapping
13
13
Technology Mapping
◼ Notice the last conversion uses DeMOrgan’s theorem on
the OR gate (which creates an inversion of OR) and then
a last inversion with the bubble at the AND output
(NAND)
F = A + B + C F = A + B + C = ABC
DeMorgan’s
F = F = ABC
14
14
7
Technology Mapping
◼ Mapping to NOR
15
15
Technology Mapping
◼ Notice the first conversion uses DeMorgan’s theorem on
the AND gate (which creates an inversion of AND) and
then a last inversion with the bubble at the AND output
(NAND)
F = ABC F = ABC = A + B + C
DeMorgan’s
F = F = A+ B +C
16
16
8
Technology Mapping
Dot
17
17
18
18
9
Ex.: NAND Gate Implementation
19
19
◼ Result
20
20
10
Ex.: NOR Gate Implementation
21
21
22
22
11
Important Observation for NOR
and NAND Implementations
◼ Product of sums (POS) form works better
for NAND implementation
◼ Sum of products (SOP) form works better
for NOR implementation
23
23
◼ Input = X, output = F
24
24
12
Rudimentary Logic Functions
25
25
◼ Multi-bit function
◼ Need to represent bit combinations into parallel
“busses” and splitting up busses into bits
Which Extracted
Slash with number wires are functions
indicates how many extracted
bits in the bus
Order (position) of
a function’s wire in
the bus 26
26
13
Enabling
EN
27
27
Decoding
28
28
14
1-to-2 Line Decoder
29
29
30
30
15
3-to-8 Line Decoder
31
31
32
32
16
Other Decoder Combinations
◼ Procedure
1. Let k = n
2. If k is even, divide k by 2
Use 2k 2-input AND gates driven by 2
decoders of output size 2k /2
If k is odd, find (k +1)/2 and (k −1)/2
Use 2k 2-input AND gates driven by one
decoder of output size 2(k +1)/2 and a decoder
of output size 2(k −1)/2
34
34
17
Other Decoder Combinations
35
35
First cycle
1. Start with k = n = 6
2. k is even so use 26 = 64 2-input AND gates
fed by two decoders of output size 2k/2 = 23 =
8
◼ These are two 3-to-8 decoders
36
36
18
Ex.: 6-to-64 Line Decoder
Second cycle
1. Now k = 3
2. k is odd, so use 23 = 8 2-input AND gates
driven by
◼ One decoder of output size 2(k+1)/2 = 22 = 4
(a 2-to-4 decoder) and
◼ One decoder of output size 2(k−1)/2 = 21 = 2
(a 1-to-2 decoder)
37
37
Third cycle
◼ From second cycle,
◼ One decoder was a 1-to-2 line, so it is not
reduced further
◼ The other was a 2-to-4 line, so it is reduced
again
1. Now k = 2
2. k is even, so use 24 = 4 2-input AND gates
driven by
◼ One decoder of output size 2k/2 = 21 = 2 (a
1-to-2 decoder) 38
38
19
Ex.: 6-to-64 Line Decoder
Finish
◼ All decoder expansions (size reductions) are
complete
39
39
Note
◼ Final output has 64 2-input AND gates in
groups of 8
◼ The top 3-to-8 line decoder has 8 outputs
◼ Each output feeds one of the AND gates in each
group
◼ The lower 3-to-8 line decoder has 8 outputs
◼ Each output feeds all 8 AND gates in one
group
◼ These outputs are “enabling” one group at a time
◼ Just like inside a 3-to-8 line decoder 40
40
20
Enabling Decoder Outputs
41
41
42
42
21
1-Bit, 3-Input Binary Adder Using
3-to-8 Line Decoder
◼ A 1-bit binary adder has
the following truth table
◼ Inputs X and Y are the
bits being added and Z is
an incoming carry from
the right
◼ There are 2 independent
outputs even though you
may think they are
dependent
43
43
S = m (1, 2, 4, 7 )
C = m ( 3,5, 6, 7 )
44
44
22
1-Bit, 3-Input Binary Adder Using
3-to-8 Line Decoder
◼ Implementation
S = m (1, 2, 4, 7 )
C = m ( 3,5, 6, 7 )
45
45
Encoding
46
46
23
Encoders
47
47
48
48
24
Ex.: Octal-to-Binary Converter
49
49
◼ Problem:
◼ If 2 or more inputs are active, output will be
invalid
◼ Solution – use a priority encoder
50
50
25
Priority Encoder
51
51
52
52
26
Ex. 4-Input Priority Encoder
◼ The V input means “valid” and is 1
whenever one of the inputs is 1
◼ Truth table is condensed
◼ Row 3 replaces rows
0010
0011
With 0 0 1 X
53
53
54
54
27
Ex. 4-Input Priority Encoder
◼ Each row’s input can be written as a
minterm where an “X” simply doesn’t
appear
A0 = D3 D2 D1 + D3
A1 = D3 D2 + D3
V = D0 + D1 + D2 + D3
55
55
12 13 15 14
11 1 1 1 1
8 9 11 10
10 1 1 1 1
56
56
28
Ex. 4-Input Priority Encoder
◼ K-map for A1
D1D0
D3D2 00 01 11 10
0 1 3 2
00 X
A1 = D2 + D3 4 5 7 6
01 1 1 1 1
12 13 15 14
11 1 1 1 1
8 9 11 10
10 1 1 1 1
57
57
58
58
29
Selecting
59
59
Selecting
60
60
30
Multiplexer (MUX)
61
61
Y = SI 0 + SI1
62
62
31
Ex. 2-to-1 Line Multiplexer
63
63
64
64
32
Ex. 4-to-1 Line Multiplexer
65
65
◼ Circuit
66
66
33
Multiplexer Design Summary
67
67
68
68
34
Implement 4-Input Function
with 8-to-1 Line MUX
69
69
70
70
35
Ex. 1-Bit Binary Adder With
Using MUX
S output
◼ First subscript is value: MUX 1
minterm number
determined by X, Y
◼ Second is the carry
bit value Z
71
71
72
36
BCD-to-Seven Segment Display
Decoder
◼ Truth table
73
73
74
74
37
BCD-to-Seven Segment Display
Decoder
◼ Using seven 8-to-1 line MUX
◼ Each MUX handles one display segment
◼ Select inputs would be A = S2, B = S1, C = S0
◼ Data inputs I would be as in table below
◼ Inputs would either be D, /D, 1, or 0
75
75
76
76
38
Adders
77
Half-Adder
78
78
39
Full-Adder
79
79
Full-Adder
◼ K-map simplification
80
80
40
Full-Adder
◼ Implementation
◼ Two half-adders and OR gate
81
81
◼ Modular
◼ Made up of full-adder stages
◼ Each sum bit is produced in parallel
◼ Carry “ripples” through the stages in series
◼ Output delay is longer than sum bits
82
82
41
Binary Subtraction – Unsigned
Numbers
◼ Unsigned binary numbers do not use the
MSB as a sign bit (positive or negative sign)
◼ Implement using 2’s complement with
addition
◼ Taking a 2’s complement
◼ Complement each bit individually (bit-wise)
◼ Add 1 to result
◼ Be sure to carry through to higher bits if necessary
83
83
84
42
Ex. 3-20: Unsigned Number
Subtraction
◼ Let X = 1010100 and Y = 1000011
◼ Perform X – Y, then Y – X
85
85
86
43
Ex. 3-20: Unsigned Number
Subtraction
◼ For Y – X first find 2’s complement of X
1. Bitwise inversion 1010100 → 0101011
2. Add 1 to get 2’s complement: 0101100
87
87
Answer X – Y − 00100001 88
88
44
Binary Adder-Subtractor
89
89
Binary Adder-Subtractor
◼ How it works
◼ S bit is 0 for addition, 1 for subtraction
◼ When S = 0 for addition, XOR gates allow B
bits through unaltered
◼ S = 0 bit is the input carry C0 to the LSB full adder
so does nothing
◼ When S = 1 for subtraction, XOR gates invert
B bits
◼ S = 1 bit is input carry C0 so essentially forms 2’s
complement of B
90
90
45
Binary Adder-Subtractor
91
91
Signed-Magnitude Binary
Numbers
◼ Signed-magnitude is convenient
◼ The MSB is the sign bit
◼ Remaining bits are the magnitude
◼ MSB = 0 means positive number
◼ MSB = 1 means negative number
◼ We won’t go over the arithmetic
92
92
46
Signed-Magnitude Binary
Numbers
◼ Table for 3-bit
magnitudes
◼ Notice “0” can be
represented two ways
93
93
47