Академический Документы
Профессиональный Документы
Культура Документы
Resources
Fall 2010
ENG241/Digital Design
Week #4 Topics
Decoders
Encoders
Multiplexers
Demultiplexers
Fall 2010
ENG241/Digital Design
Decoders
Typically n inputs and 2n outputs Drives high the output corresponding to binary code of input
Fall 2010
ENG241/Digital Design
Fall 2010
Fall 2010
ENG241/Digital Design
Fall 2010
ENG241/Digital Design
Fall 2010
ENG241/Digital Design
dataflow
Concurrent statements
structural
Components and interconnects
behavioral (algorithmic)
Sequential statements Registers State machines Test benches
Interface
D3 A(1) D2 D1
A(0)
D0
architecture dataflow1 of dec_2_to_4 is Signal A0_n, A1_n: std_logic; begin A0_n <= not A0; A1_n <= not A1; D0 <= A0_n and A1_n; D1 <= A0 and A1_n; D2 <= A0_n and A1; D3 <= A0 and A1; end architecture dataflow1;
Fall 2010
ENG241/Digital Design
Functionality
A0_n
11
zmux: z <= d0 when sel1 = 0 and sel0 = 0 else d1 when sel1 = 0 and sel0 = 1 else d2 when sel1 = 1 and sel0 = 0 else d3;
Fall 2010
ENG241/Digital Design
12
Interface
A(0)
D(0)
Functionality
architecture dataflow2 of dec_2_to_4 is begin D <= "0001" when A = "00" else "0010" when A = "01" else "0100" when A = "10" else "1000" when A = "11" else "XXXX"; end architecture dataflow2;
A(1..0) 0 0 1 1 0 1 0 1 0 0 0 1
D(3..0) 0 0 1 0 0 1 0 0 1 0 0 0
Fall 2010
ENG241/Digital Design
13
Fall 2010
ENG241/Digital Design
14
Fall 2010
ENG241/Digital Design
15
N3
Fall 2010
ENG241/Digital Design
16
Fall 2010
ENG241/Digital Design
17
Fall 2010
ENG241/Digital Design
18
Fall 2010
ENG241/Digital Design
19
Implement logic circuits! Memory address lines Decoders are used in Micro Computer Interfacing for Keyboard and Display applications.
Fall 2010
ENG241/Digital Design
20
With the variables used as control inputs Enable inputs tied to 1 and Appropriate minterms summed to form the function
Decoder generates appropriate minterm based on control signals (it "decodes" control signals)
Fall 2010
ENG241/Digital Design
21
S(A2,A1,A0) = SUM(m(1,2,4,7))
C(A2,A1,A0) = SUM(m(3,5,6,7))
1.
Since there are three inputs, we need a 3-to-8 line decoder. The decoder generates the eight minterms for inputs A0,A1,A2 An OR GATE forms the logical sum minterms required.
22
2.
3.
Fall 2010
ENG241/Digital Design
Example
F1
Enable
Fall 2010
ENG241/Digital Design
Encoder
Encoder is the opposite of decoder 2n inputs (or less maybe BCD in) n outputs Examples:
Fall 2010
ENG241/Digital Design
24
Fall 2010
ENG241/Digital Design
25
Fall 2010
ENG241/Digital Design
26
What if D3 and D6 both high? Simple OR circuit will set A to 111 Solution?
Fall 2010
ENG241/Digital Design
27
Priority Encoder
A Valid Output!
Fall 2010
ENG241/Digital Design
29
Fall 2010
ENG241/Digital Design
30
Selects one of a set of inputs to pass on to output Binary control code, n lines
74153
Very common
Fall 2010
ENG241/Digital Design
31
Fall 2010
ENG241/Digital Design
32
Fall 2010
ENG241/Digital Design
33
Fall 2010
ENG241/Digital Design
34
Fall 2010
ENG241/Digital Design
35
Fall 2010
ENG241/Digital Design
36
Fall 2010
ENG241/Digital Design
38
2n:1 multiplexer implements any function of n variables 1. With the variables used as control inputs and 2. Data inputs tied to 0 or 1 3. In essence, a lookup table Example: F(A,B,C) = m0 + m2 + m6 + m7
0 1 2 3 4 8:1 MUX 5 6 7 S2 S1 S0 A B
C
39
Fall 2010
ENG241/Digital Design
2n-1:1 mux can implement any function of n variables With n-1 variables used as control inputs and Data inputs tied to the last variable or its complement Example: F(A,B,C) = m0 + m2 + m6 + m7 = A'B'C' + A'BC' + ABC' + ABC
1 0 1 0 0 0 1 1
0 1 2 3 4 8:1 MUX 5 6 7 S2 S1 S0 A B
A 0 0 0 0 1 1 1 1
B 0 0 1 1 0 0 1 1
C 0 1 0 1 0 1 0 1
F 1 0 1 0 0 0 1 1
C' C' 0 1
C' C' 0 1
0 1 4:1 MUX 2 3 S1 S0 A B
C
ENG241/Digital Design 40
Fall 2010
Demultiplexer
Fall 2010
ENG241/Digital Design
41
Demux is a Decoder
With an enable
Fall 2010
ENG241/Digital Design
42
Fall 2010
ENG241/Digital Design
43
Decoder Expansion
A 2-to-4 Line decoder requires 4 (2-input) AND gates A 3-to-8 line decoder requires 8 (3-input) AND gates If we want to design a 6-to-64 line decoder then we will need? 64 (6-input) AND gates! Unfortunately, as decoders become larger, this approach gives a high gate input count! Instead we will resort to a procedure that uses design hierarchy to construct any decoder with n inputs and 2n outputs. The resulting decoder should have the same or a lower gate input count than the one constructed simply enlarging each AND gate.
ENG241/Digital Design 44
Fall 2010
Decoder Expansion
To design a 3-to-8 line decoder (n=3) we can use a 2-to-4 line decoder and 1to-2 line decoder feeding eight 2-input AND gates to form the minterms instead of using eight 3input AND gates!
Fall 2010
ENG241/Digital Design
45
General Procedure
1. 2. 3.
4. 5.
1.
2.
Let k=n. If k is even, divide k by 2 to obtain k/2. Use 2k AND gates driven by two decoders of output size 2k/2. If k is odd, obtain (k+1)/2 and (k-1)/2. Use 2k AND gates driven by a decoder of output size 2(k+1)/2 and a decoder of output size 2(k-1)/2 For each decoder resulting from step (2-3) (4-5), repeat with values obtained in step 2 until k=1. For k=1, use a 1-to-2 decoder.
Fall 2010
ENG241/Digital Design
46
3-to-8-line decoder Number of output ANDs = 8 Number of inputs to decoders driving output ANDs = 3 Closest possible split to equal (k+1)/2 2-to-4-line decoder (k-1)/ 2 1-to-2-line decoder 2-to-4-line decoder Number of output ANDs = 4 Number of inputs to decoders driving output ANDs = 2 Closest possible split to equal Two 1-to-2-line decoders See next slide for result
Fall 2010
ENG241/Digital Design
47
Result
Fall 2010
ENG241/Digital Design
48
Multi-Level 6-to-64
Fall 2010
ENG241/Digital Design
49
Fall 2010
ENG241/Digital Design
50
Variations
At right
Fall 2010
Variations
Fall 2010
ENG241/Digital Design
52
Fall 2010
ENG241/Digital Design
53
Fall 2010
ENG241/Digital Design
54
Fall 2010
ENG241/Digital Design
55