Comb Circ
Comb Circ
+
+
+ + + + =
c
i+1
can be implemented in 2-level
AND-OR circuits.
A Carry-Lookahead Adder is based
on this expression.
0 0 1 2 1
c p p p p p
i i
L
+
25
Ripple-carry Adder Delay
LSB:
Only First 2
stages shown
LSB:
(x
0
, y
0
) = (0,1)
Delay: 5 gates
For n stages:
Delay: 2n+1 gates
From Browns Fundamentals of digital logic
26
CLA Delay
LSB:
(x
0
, y
0
) = (0,1)
Only First 2
stages shown
0 0 0 1
c p g c + =
Delay: 3 gates
For n stages:
Delay: 3 gates
0 0 0 1
c p g c + =
0 0 1
0 1 1 2
c p p
g p g c
+
+ =
27
CLA Implementation
Total delay : 4 gates (1 for all g
i
,p
i
, 2 for
all carry, 1 for the final XOR to compute
all s
i
)
Becomes very complex when n large.
Hierarchical CLA with ripple-carry Hierarchical CLA with ripple-carry
28
CLA : A better implementation
Consider c
8
out of block 0:
Recall that
If define
0 0 1 2 6 7
0 1 2 6 7 5 6 7 6 7 7 8
c p p p p p
g p p p p g p p g p g c
L
L L
+
+ + + + =
0 0 0 1
c p g c + =
c p p p p p p p p P =
If define
Then can write
Likewise
0 1 2 6 7 5 6 7 6 7 7 0
g p p p p g p p g p g G L L+ + + + =
0 0 1 2 3 4 5 6 7 0
c p p p p p p p p P =
0 0 0 8
c P G c + =
0 0 1 0 1 1 16
c P P G P G c + + =
0 0 1 2 0 1 2 1 2 2 16
c P P P G P P G P G c + + + =
0 0 1 2 3 0 1 2 3 1 2 3 2 3 3 32
c P P P P G P P P G P P G P G c + + + + =
29
CLA : A better implementation
30
BCD Addition
31
BCD Adder
Adjust=0 -> S = Z + 0
Adjust=1 -> S = Z + 6
32
4-bit Comparator
0
0
1
0
1
1
1
1
0 1 0 1
1 0 0 0
1
1
0
0
0
1
0
1
1 1 0 0
0 1 1 1
3-(-5)=-8 -5-4=7
33
4-bit Comparator
X < Y
Same sign: No overflow (V=0) and N=1
Different sign: V=0 && N=1, OR V=1
(overflow) && N=0 (positive)
Thus, condition is N V=1. Thus, condition is N V=1.
X = Y -> Z = 1
X > Y
Same sign: No overflow (V=0) and N=0
Different sign: V=0 && N=0, OR V=1
(overflow) && N=1 (negative)
Thus, condition is N V=0, i.e., the
complement of N V, (N V).
34
2-to-1 Multiplexer (MUX)
Multiplexer has multiple
inputs and one output; it
passes the signal on one
input to the output.
Symbol Truth Table Symbol Truth Table
SOP circuit
Circuit with transmission gates
35
4-to-1 Multiplexer
3 0 1 2 0 1 1 0 1 0 0 1
' ' ' ' w s s w s s w s s w s s f + + + =
36
4-to-1 Multiplexer
4-to-1 mux using
2-to-1 mux
16-to-1 mux using
4-to-1 mux
37
2 2 crossbar switch
2 inputs, 2 outputs
s = 0 -> connect x
1
->y
1
, x
2
->y
2
s = 1 -> connect x
1
->y
2
, x
2
->y
1
38
Synthesis of Logic Functions
2 1
w w f =
39
3-input XOR
Using
2-to-1 MUX 2-to-1 MUX
Using
4-to-1 MUX
40
3-input Majority Function
Get 3 inputs and output 1 if # of 1s
greater than # of 0s.
41
Shannons Expansion
Shannons Expansion Theorem
1 1
1 ' 1
2 1 2 1 2 1
'
) , , , 1 ( ) , , , 0 ( ' ) , , , (
w w
n n n
f w f w
w w f w w w f w w w w f
+ =
+ = K K K
cofactors : ,
1 1
' w w
f f
Example : 3-input majority function
Can be rewritten as
3 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1
' ' ' w w w w w w w w w w w w w w w w w w f + + = + + + =
) ( ) ( '
3 2 1 3 2 1 3 1 3 2 2 1
w w w w w w w w w w w w f + + = + + =
42
Shannons Expansion
Using
2-to-1 MUX
3-input XOR
)' ( ) ( '
3 2 1 3 2 1 3 2 1
w w w w w w w w w f + = =
43
Shannons Expansion
In general : expand by w
i
2-variable expansion:
i i
w i w i
n i n i n
f w f w
w w w f w w w w f w w w w f
+ =
+ =
'
2 1 2 1 2 1
'
) , , 1 , , , ( ) , , 0 , , , ( ' ) , , , ( K K K K K
2-variable expansion:
which can be implemented by a 4-to-1
MUX.
) , , , 1 , 1 ( ) , , , 0 , 1 ( '
) , , , 1 , 0 ( ' ) , , , 0 , 0 ( ' ' ) , , , (
3 2 1 3 2 1
3 2 1 3 2 1 2 1
n n
n n n
w w f w w w w f w w
w w f w w w w f w w w w w f
K K
K K K
+ +
+ =
44
Example 1
) 1 ( ' ' ' ' ' '
) ( ' '
' '
2 1 3 2 1 3 2 1 3 2 1
3 2 1 3 1
3 1 2 1 3 1
w w w w w w w w w w w
w w w w w
w w w w w w f
+ + + =
+ + =
+ + =
Using
2-to-1 MUX
Using
4-to-1 MUX
45
3-input majority function
Let g = w
2
w
3
, h = w
2
+w
3
, then
) ( ) ( '
3 2 1 3 2 1 3 1 3 2 2 1
w w w w w w w w w w w w f + + = + + =
) 1 ( ' ; ) 0 ( '
2 3 2 3 2 2
w w w h w w w g + = + =
46
Decoder
Main function: decode encoded data.
n-to-2
n
decoder
2-to-4 decoder
47
Decoder
3-to-8 decoder using
2-to-4 decoder
4-to-1 MUX using
2-to-4 decoder
48
4-to-16 Decoder
49
Demultiplexer (DEMUX)
A 2
m
m ROM Block
50
Encoder
2
n
-to-n encoder
4-to-2 binary encoder
51
Hamming Code
In linear block code family.
Can correct 1-bit error or detect
2-bit error.
Add parity bits to message bits. Add parity bits to message bits.
Typically use notation (n,k)
Hamming code, which means n
total bits, k message bits.
Clearly there are (n-k) parity bits.
52
(7,4) Hamming Code
System Structure
53
Codewords
3 1 0 2 3 2 1 1 2 1 0 0
; ; a a a r a a a r a a a r = = =
Codeword : a
3
a
2
a
1
a
0
r
2
r
1
r
0
with
54
Syndrome
Error pattern is given by syndrome, i.e., s
2
s
1
s
0
(=s) where
2 3 1 0 2 1 3 2 1 1 0 2 1 0 0
; ; q b b b s q b b b s q b b b s = = =
Example : Send 0110100
Receive 0110100 -> s = 000 -> No error
Receive 0111100 -> s = 101 -> Error at b
0
Receive 0010100 -> s = 011 -> Error at b
2
55
(7,4) Hamming Encoder
Exercise : Design the
(7,4) Hamming Decoder
56
Gate Arrays (Programmable Logic Device)
Basic
Structure
(AND-OR GA)
57
Example
f = ab + abc
g = abc + ab + bc
h = ab + c
58
Simplified Diagram
59
Using ROM
=
=
=
) 15 , 11 , 7 , 5 , 1 ( ) , , , (
) 15 , 14 , 10 , 7 , 5 , 4 , 3 ( ) , , , (
) 15 , 11 , 9 , 8 , 7 , 3 ( ) , , , (
m D C B A Y
m D C B A X
m D C B A W
60
Using PLA
=
= =
) 15 , 11 , 7 , 5 , 1 ( ) , , , (
) 15 , 14 , 10 , 7 , 5 , 4 , 3 ( ) , , , ( ; ) 15 , 11 , 9 , 8 , 7 , 3 ( ) , , , (
m D C B A Y
m D C B A X m D C B A W
} ' or { ' '
} or { ' ' ' '
' ' ' ' '
BD A BCD ACD D C A Y
ABC BCD CD A ACD BC A X
ACD CD A C AB CD C AB W
+ + =
+ + + =
+ + = + =
61
Using PLA (2)
62
Using Programmable Array Logic
63