This page is a work in progress.

L19: Decoders & Encoders#

Let’s practice Boolean algebra!

Objective
Practice usage of theorems 5-17 of Boolean algebra.


Before the Lecture#

Required Textbook Reading:

  • 4.2–4.4 (Decoders & Encoders)

Decoders#

The decoder is a combinational logic circuit that converts binary information from n input lines to a maximum of 2^n unique output lines. It is used to decode the binary input into a specific output line, which can be used for various applications such as memory addressing, data routing, and display control.

The following figure shows a 2-to-4 line decoder, which takes 2 input lines and decodes them into 4 unique output lines. Each output line corresponds to one of the possible combinations of the input lines.

A decoder may include an enable input, which must be active for the decoder to function. If the enable input is inactive, all outputs will be low (0).

Demultiplexers#

A demultiplexer (DEMUX) is the inverse of a multiplexer. It takes a single input and routes it to one of several output lines based on the select lines.

Decoder Trees#

Decoders can be combined to create larger decoders. For example, two 2-to-4 decoders can be used to create a 3-to-8 decoder. The first decoder takes the most significant bit (MSB) of the input and enables one of the two 2-to-4 decoders based on its value. The second decoder takes the remaining bits and produces the final output.

Encoders#

An encoder is a combinational logic circuit that performs the reverse operation of a decoder. It takes 2^n input lines and encodes them into n output lines. The encoder generates a binary code corresponding to the active input line.

Priority Encoders#

A priority encoder is a type of encoder that assigns priority to the input lines. If multiple inputs are active simultaneously, the encoder will output the binary code corresponding to the highest-priority active input. This is useful in applications where certain signals need to be prioritized over others.

Code Converters#

One common application of encoders and decoders is in code conversion. For example, a binary-to-Gray code converter can be implemented using a combination of encoders and decoders. The binary input is first encoded into a specific format, and then decoded into the desired output format.