Lecture #11
Lecture #11
1
2-to-4 decoder
The two data inputs, w1 and w0 represent a two-bit number that causes the decoder
to assert one of the outputs y0, . . . , y3.
Setting the inputs w1w0 to 00, 01, 10, or 11 causes the output y0, y1, y2, or y3 to be
set to 1, respectively.
2
Larger decoders can be built using the sum-of-products structure or else they can be
constructed from smaller decoders.
Building a 3-to-8 decoder using 2-to-4 decoders.
The w2 input drives the enable inputs of the two decoders. The top decoder is
enabled if w2 = 0, and the bottom decoder is enabled if w2 = 1. This concept can
be applied for decoders of any size.
The enable input of the decoder is not needed in this case, and it is set to 1.
4
Example #2: Building demultiplexers from Decoder
The demultiplexer can be implemented using a decoder circuit. For example, the 2-
to-4 decoder shown below can be used as a 1-to-4 demultiplexer. In this case the En
input serves as the data input for the demultiplexer, and the y0 to y3 outputs are the
data outputs. The valuation of w1w0 determines which of the outputs is set to the
value of En.
In practice decoder circuits are used much more often as decoders rather than as
demultiplexers.
5
Encoders
An encoder performs the opposite function of a decoder. It encodes given information
into a more compact form.
Encoders are used to reduce the number of bits needed to represent given
information.
- Transmission: fewer wires.
- Storage: small data size.
Binary Encoders
Encodes information from 2n inputs into an n-bit code as shown below.
Exactly one of the input signals should have a value of 1, and the outputs present
6
the binary number that identifies which input is equal to 1.
4-to-2 encoder
All input patterns that have multiple inputs set to 1 are not shown in the truth table, and
they can be treated as don’t-care conditions.
7
Priority Encoders
In a priority encoder each input has a priority level associated with it.
The encoder outputs indicate the active input that has the highest priority. When an
input with a high priority is asserted, the other inputs with lower priority are
ignored.
4-to-2 priority encoder
w0 has the lowest priority and w3 the highest.
The outputs y1 and y0 represent the binary
number that identifies the highest priority
input set to 1.
Observing the truth tables, the circuit for the priority encoder has the same structure as
the 4-to-2 binary encoder.
Encoder output
-What will be the circuit for the 4-to-1 priority encoder?
Output z:
9