ELM3111 Digital Electronics and Microprocessors | Dr Muharrem Mercimek
1
DIGITAL ELECTRONICS AND
MICROPROCESSORS
ELM3111 Digital Electronics and
Microprocessors
Some of the contents are adopted from
M. Morris Mano, Michael D Ciletti.Digital Design, 4nd edition, Pearson & Prentice Hall, 2007.
ELM3111 Digital Electronics and Microprocessors | Dr Muharrem Mercimek
Contents
4-2 Combinational Design Procedure – Examples (Cont’d)
• Decoder
• Encoders
• Multiplexer
2
ELM3111 Digital Electronics and Microprocessors | Dr Muharrem Mercimek
4.2 Combinational Design Procedure –
Examples (Cont’d)
3
ELM3111 Digital Electronics and Microprocessors | Dr Muharrem Mercimek
Decoders vs. encoders
• Binary decoders
• Converts an n-bit code to a single active output
• Can be developed using AND/OR gates
• Can be used to implement logic circuits.
• Binary encoders
• Converts one of 2n inputs to an n-bit output
• Useful for compressing data
• Can be developed using AND/OR gates
• Both encoders and decoders are extensively used in digital systems
4
5
ELM3111 Digital Electronics and Microprocessors | Dr Muharrem Mercimek
Binary Decoder
• Black box with n input lines and 2n output lines
• Only one output is a 1 for any given input
n
inputs
Binary
Decoder
2n outputs
6
ELM3111 Digital Electronics and Microprocessors | Dr Muharrem Mercimek
2-to-4 Binary Decoder
x
y
D0
D1
D2
D3
0
0
1
0
0
0
0
1
0
1
0
0
1
0
0
0
1
0
1
1
0
0
0
1
F0 = x’y’
F1 = x’y
F2 = xy’
• From truth table, circuit for 2x4 decoder is:
• Note: Each output is a 2-variable minterm
(X'Y', X'Y, XY' or XY)
x
y
2x4
Decoder
F3 = xy
D0
D1
D2
D3
x
y
7
ELM3111 Digital Electronics and Microprocessors | Dr Muharrem Mercimek
3-to-8 Binary Decoder
x y
z
D0
D1
D2
D3
D4
D5
D6
D7
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
D0 = x’y’z’
D1 = x’y’z
D2 = x’yz
D3 = x’yz
D4 = xy’z’
D5 = xy’z
D6 = xyz’
D0
x
y
z
D7 = xyz
D1
3-to-8
Decoder
D2
D3
D4
D5
D6
D7
x
y
z
ELM3111 Digital Electronics and Microprocessors | Dr Muharrem Mercimek
8
Implementing Functions Using Decoders
• Any n-variable logic function can be implemented using a single n-to-2n
decoder to generate the minterms
• OR gate forms the sum.
• The output lines of the decoder corresponding to the minterms of the
function are used as inputs to the or gate.
• Any combinational circuit with n inputs and m outputs can be
implemented with an n-to-2n decoder with m OR gates.
• Suitable when a circuit has many outputs, and each output function is
expressed with few minterms.
9
ELM3111 Digital Electronics and Microprocessors | Dr Muharrem Mercimek
Implementing Functions Using Decoders
• Example: Full adder
Si(Ai, Bi, Ci) = S (1,2,4,7)
Ci+1(Ai, Bi, Ci) = S (3,5,6,7)
Ai
Bi
Ci
Si
Ci+1
0
0
0
0
0
0
0
1
1
0
0
1
0
1
0
0
1
1
0
1
1
0
0
1
0
Ai
1
0
1
0
1
Bi
1
1
0
0
1
Ci
1
1
1
1
1
3x8
Decoder
0
1
2
3
4
5
6
7
Si
Ci+1
Building a Binary Decoder with NAND Gates
• Start with a 2-bit decoder
• Add an enable signal (E)
Note: use of NANDs
only one 0 active!
if E = 0
ELM3111 Digital Electronics and Microprocessors | Dr Muharrem Mercimek
74138 (3-to-8 decoder)
11
ELM3111 Digital Electronics and Microprocessors | Dr Muharrem Mercimek
74138 (3-to-8 decoder)
12
ELM3111 Digital Electronics and Microprocessors | Dr Muharrem Mercimek
13
Use two 3 to 8 decoders to make 4 to 16 decoder
• Enable can also be active high
• In this example, only one decoder can be active at a time.
• x, y, z effectively select output line for w
When w is 0
When w is 1
ELM3111 Digital Electronics and Microprocessors | Dr Muharrem Mercimek
Decoders for memory addressing
http://www.csee.umbc.edu
14
ELM3111 Digital Electronics and Microprocessors | Dr Muharrem Mercimek
15
Encoders
• If the a decoder's output code has fewer bits ( compression) than the input code, the
device is usually called an encoder.
e.g. 2n-to-n
• The simplest encoder is a 2n-to-n binary encoder
• One of 2n inputs = 1
• Output is an n-bit binary number
2n inputs
Binary
encoder
n outputs
ELM3111 Digital Electronics and Microprocessors | Dr Muharrem Mercimek
16
8-to-3 Binary Encoder
D0
D1
D2
D3
D4
D5
D6
D7
x y z
1
0
0
0
0
0
0
0
0 0 0
0
1
0
0
0
0
0
0
0 0 1
0
0
1
0
0
0
0
0
0 1 0
0
0
0
1
0
0
0
0
0 1 1
0
0
0
0
1
0
0
0
1 0 0
0
0
0
0
0
1
0
0
1 0 1
0
0
0
0
0
0
1
0
1 1 0
0
0
0
0
0
0
0
1
1 1 1
Ambiguity1 : At any one time, only one input line is expected to have value of 1.
If D3 and D5 are 1 exactly at the same time then x, y, z will be 1 1 1. it does not represent either
binart 3 or binary 5
A Priority has to be established,
if D5 has more priority over D3 the output will be 1 0 0
Ambiguity2 : If all inputs are 0 the output should be determined.
A an output is used to express at least one input is equal to 1.
17
ELM3111 Digital Electronics and Microprocessors | Dr Muharrem Mercimek
8-to-3 Priority Encoder
What if more than one input line has a value of 1?
Ignore “lower priority” inputs.
Idle indicates that no input is a 1.
•
•
•
D0
D1
D2
D3
D4
D5
D6
D7
x y z
V
0
0
0
0
0
0
0
0
0 0 0
0
1
0
0
0
0
0
0
0
0 0 0
1
X
1
0
0
0
0
0
0
0 0 1
1
X
X
1
0
0
0
0
0
0 1 0
1
X
X
X
1
0
0
0
0
0 1 1
1
X
X
X
X
1
0
0
0
1 0 0
1
X
X
X
X
X
1
0
0
1 0 1
1
X
X
X
X
X
X
1
0
1 1 0
1
X
X
X
X
X
X
X
1
1 1 1
1
ELM3111 Digital Electronics and Microprocessors | Dr Muharrem Mercimek
Multiplexer
•
•
•
•
Select an input value with one or more select bits
Use for transmitting data
Allows for conditional transfer of data
Also called mux
18
ELM3111 Digital Electronics and Microprocessors | Dr Muharrem Mercimek
19
Multiplexer
•
•
•
Selection lines S1 and S0 are decoded to
select a particular AND gate.
The outputs of the AND gates are applied to a
single OR gate that provides the one-line
output. The function table lists the input that is
passed to the output for each combination of
the binary selection values.
ELM3111 Digital Electronics and Microprocessors | Dr Muharrem Mercimek
20
Implementing a Function with a Multiplexer
F (x, y, z) = (1, 2, 6, 7)
Boolean function of n variables with a multiplexer that has n - 1 selection inputs.
The first n - 1 variables of the function are connected to the selection inputs of the multiplexer.
The remaining single variable of the function is used for the data inputs.
Evaluate the function using last variable
ELM3111 Digital Electronics and Microprocessors | Dr Muharrem Mercimek
21
Implementing a Function with a Multiplexer
F (A, B, C, D) = (1, 3, 4, 11, 12, 13, 14, 15)
Boolean function of n variables with a multiplexer that has n - 1 selection inputs.
The first n - 1 variables of the function are connected to the selection inputs of the multiplexer.
The remaining single variable of the function is used for the data inputs.
Evaluate the function using last variable
Download

ELM3111 Digital Electronics and Microprocessors Mux Decoder