07 CombFunc
07 CombFunc
1
Overview
• Signal Naming
• Decoders
• Encoders
– Binary, priority
• Multiplexers
• Three-state buffers
2
Active States and Bubbles
3
Signal Naming Conventions
4
Signal Naming
5
Active Levels For Pins
6
Be Careful!
7
What is a decoder?
– Detect which of the 2^n input code words is represented at the inputs
– Produce m outputs, only one of which is asserted
8
1-to-2 (Line) Decoder
9
2-to-4 Decoder
– The 2-bit input is called S1-S0, and the four outputs are Q0-Q3
S1 S0 Q0 Q1 Q2 Q3
0 0 1 0 0 0
0 1 0 1 0 0
1 0 0 0 1 0
1 1 0 0 0 1
• Follow the design procedures from last time! We have a truth table, so
we can write equations for each of the four outputs (Q0-Q3)
S1 S0 Q0 Q1 Q2 Q3
0 0 1 0 0 0
0 1 0 1 0 0
1 0 0 0 1 0
1 1 0 0 0 1
Q0 = S1’ S0’
• Q1to=be
In this case there’s not much S1’simplified.
S0 Here are the equations:
Q2 = S1 S0’
Q3 = S1 S0
11
2-to-4 Decoder
S1 S0 Q0 Q1 Q2 Q3
0 0 1 0 0 0
0 1 0 1 0 0
1 0 0 0 1 0
1 1 0 0 0 1
12
Enable Inputs
• For a decoder,
EN S1 S0 Q0 Q1 Q2 Q3
0 0 0 0 0 0 0
0 0 1 0 0 0 0
0 1 0 0 0 0 0
0 1 1 0 0 0 0
1 0 0 1 0 0 0
1 0 1 0 1 0 0
1 1 0 0 0 1 0
1 1 1 0 0 0 1 13
An aside: abbreviated truth tables
EN S1 S0 Q0 Q1 Q2 Q3
0 0 0 0 0 0 0
• In this table, note that whenever
0 0 1 0 0 0 0
EN=0, the outputs are always 0,
0 1 0 0 0 0 0
regardless of inputs S1 and S0. 0 1 1 0 0 0 0
1 0 0 1 0 0 0
1 0 1 0 1 0 0
1 1 0 0 0 1 0
1 1 1 0 0 0 1
EN S1 S0 Q0 Q1 Q2 Q3
• We can abbreviate the table by 0 x x 0 0 0 0
writing x’s in the input columns 1 0 0 1 0 0 0
for S1 and S0 1 0 1 0 1 0 0
1 1 0 0 0 1 0
1 1 1 0 0 0 1
14
2-to-4 Decoder with Enable
Y0 = (S1’ S0’) EN
Y1 = (S1’ S0) EN
Y2 = (S1 S0’) EN
Y3 = (S1 S0) EN
15
A variation of the standard decoder
EN S1 S0 Q0 Q1 Q2 Q3
0 x x 0 0 0 0
1 0 0 1 0 0 0
1 0 1 0 1 0 0
1 1 0 0 0 1 0
1 1 1 0 0 0 1
G A
• An active-low decoder is the same thing, butBwithY0 Y1 Y2 Y3
an inverted EN input
and inverted outputs 1 x x 1 1 1 1
0 0 0 0 1 1 1
0 0 1 1 0 1 1
0 1 0 1 1 0 1
0 1 1 1 1 1 0
16
2-to-4 Active-Low Decoder
G A B Y0 Y1 Y2 Y3
1 x x 1 1 1 1 Y0 = (S1 + S0) + G
0 0 0 0 1 1 1 Y1 = (S1 + S0’) + G
0 0 1 1 0 1 1 Y2 = (S1’ + S0) + G
0 1 0 1 1 0 1 Y3 = (S1’ + S0’) + G
0 1 1 1 1 1 0
17
Complete 74x139 Decoder
18
3-to-8 decoder
S2 S1 S0 Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7
Q0 = S2’ S1’ S0’
0 0 0 1 0 0 0 0 0 0 0
Q1 = S2’ S1’ S0
0 0 1 0 1 0 0 0 0 0 0
Q2 = S2’ S1 S0’
0 1 0 0 0 1 0 0 0 0 0
Q3 = S2’ S1 S0
0 1 1 0 0 0 1 0 0 0 0
Q4 = S2 S1’ S0’
1 0 0 0 0 0 0 1 0 0 0
Q5 = S2 S1’ S0
1 0 1 0 0 0 0 0 1 0 0
Q6 = S2 S1 S0’
1 1 0 0 0 0 0 0 0 1 0
Q7 = S2 S1 S0
1 1 1 0 0 0 0 0 0 0 1
19
74x138 3-to-8 Active-Low Decoder
20
Cascading - 3-to-8 Active-High Decoder
• You can use enable inputs to string decoders together. Here’s a 3-to-8
decoder constructed from two 2-to-4 decoders:
S2 S1 S0 Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7
0 0 0 1 0 0 0 0 0 0 0
0 0 1 0 1 0 0 0 0 0 0
0 1 0 0 0 1 0 0 0 0 0
0 1 1 0 0 0 1 0 0 0 0
1 0 0 0 0 0 0 1 0 0 0
1 0 1 0 0 0 0 0 1 0 0
1 1 0 0 0 0 0 0 0 1 0
1 1 1 0 0 0 0 0 0 0 1 21
Cascading - 4-to-16 Active-Low Decoder
22
So what good is a decoder?
S1 S0 Q0 Q1 Q2 Q3
Q0 = S1’ S0’
0 0 1 0 0 0 Q1 = S1’ S0
0 1 0 1 0 0 Q2 = S1 S0’
1 0 0 0 1 0 Q3 = S1 S0
1 1 0 0 0 1
• We will need two bits to represent the total; let’s call them C and S, for
“carry” and “sum.” Note that C and S are two separate functions of the
same inputs X, Y and Z
X Y Z C S
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
C(X,Y,Z) = m(3,5,6,7)
0 + 1 + 1 = 10 0 1 1 1 0
1 0 0 0 1 S(X,Y,Z) = m(1,2,4,7)
1 0 1 1 0
1 1 0 1 0
1 1 1 1 1 1 + 1 + 1 = 11
24
Decoder-based Adder
25
Active-Low Decoders
26
Summary of Decoders
27
Binary Encoders
28
Octal-to-Binary Encoder
• This encoder has eight inputs, one for each of the octal digits.
D7
D6
A2
D5
D4
D3
Encoder A1
D2
A0
D1
D0
29
Octal-to-Binary Encoder
A0= D1 + D3 + D5 + D7,
A2= D4 + D5 + D6 +
D7
A1= D2 + D3 + D6 + D7 30
Priority Encoder
31
4-Input Priority Encoder
32
4-Input Priority Encoder
33
4-Input Priority Encoder
34
74x148 8-input priority encoder
35
Cascaded Priority Encoders
36
Multiplexers
37
Multiplexers
38
2-to-1 Mux
39
2-to-1 Mux
40
74x157 Quad 2-to-1 Mux
41
4-to-1 Mux
Decoder
42
4-to-1 Mux
43
Quad 4-to-1 Mux
44
74x151 8-to-1 Multiplexer
45
74x151 8-to-1 Multiplexer
46
Expanding Multiplexers
47
Implementing functions with multiplexers
• Muxes can be used to implement arbitrary functions
– For each minterm mi of the function, connect 1 to mux data input Di.
Each data input corresponds to one row of the truth table
– Connect the function’s input variables to the mux select inputs. These
are used to indicate a particular input combination
x y z f
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 1 48
A more efficient way
• We can actually implement f(x,y,z) = m(1,2,6,7) with
just a 4-to-1 mux, instead of an 8-to-1 x y z f
0 0 0 0
• Step 1: Find the truth table for the function, and 0 0 1 1
0 1 0 1
group the rows into pairs. Within each pair of rows, 0 1 1 0
x and y are the same, so f is a function of z only. 1 0 0 0
1 0 1 0
– When xy=00, f=z
1 1 0 1
– When xy=01, f=z’
1 1 1 1
– When xy=10, f=0
– When xy=11, f=1
• The basic setup is to connect two of the input variables (usually the first
two in the truth table) to the mux select inputs
X Y Z C
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 1
With S1=X and S0=Y, then
1 1 1 1
Q=X’Y’D0 + X’YD1 + XY’D2 + XYD3
50
Multiplexer-based carry
• We can set the multiplexer data inputs D0-D3, by fixing X and Y and
finding equations for C in terms of just Z.
X Y Z C
0 0 0 0
When XY=00, C=0
0 0 1 0
0 1 0 0
When XY=01, C=Z
0 1 1 1
1 0 0 0
When XY=10, C=Z
1 0 1 1
1 1 0 1
When XY=11, C=1
1 1 1 1
C = X’ Y’ D0 + X’ Y D1 + X Y’ D2 + X Y D3
= X’ Y’ 0 + X’ Y Z + X Y’ Z + X Y 1
= X’ Y Z + X Y’ Z + XY
= m(3,5,6,7)
51
Multiplexer-based sum
• Here’s the same thing, but for the sum function S(X,Y,Z)
X Y Z S
0 0 0 0
0 0 1 1 When XY=00, S=Z
0 1 0 1
When XY=01, S=Z’
0 1 1 0
1 0 0 1
When XY=10, S=Z’
1 0 1 0
1 1 0 0
When XY=11, S=Z
1 1 1 1
S = X’ Y’ D0 + X’ Y D1 + X Y’ D2 + X Y D3
= X’ Y’ Z + X’ Y Z’ + X Y’ Z’ + X Y Z
= m(1,2,4,7)
52
Summary of Muxes
53
Three-state Buffers
• Different flavors:
54
Selecting based on 3-state buffers
55
Sharing a Wire
56
Three-State Drivers – 74x541
57
Driver Application
58
Three-State Transcievers
59
Transciever Application
60