DLD Manual EE
DLD Manual EE
DLD Manual EE
Signature: ______________________________
61
EE233L: Digital Logic Design Lab
6.2. Objectives
This lab exercise will enable students to achieve the following:
Familiarize with the decoder structure and understand what is meant by the size of a decoder
Design larger size decoders by cascading small size decoders
Relate the output of decoders to the already learnt concepts of minterms and thus use decoders with a few extra gate
circuitry to implement Boolean functions
Learn how to use behavioral modeling style of Verilog
6.4.1. Decoders
An n-bit binary number can be used to represent 2 n values. A binary decoder is a multiple-output combinational circuit that
converts binary information from n input lines to a maximum of 2 n unique output lines. If there are unused combinations in
n-bit coded input, then there can be fewer than 2 n output lines.
Table 6.1 shows the truth table of the outputs of a 3-to-8 (=23) decoder that is shown in Figure 6.1:
Table 6.1: Truth table of a 3-to-8 decoder
Inputs Outputs
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
62
LAB 6
Only one output line of a binary decoder can be 1, while all other output lines remain zero. An n-to-2n decoder actually
provides all the minterms of the n-bit input. Outputs of a combinational logic circuit can be represented in sum-of-minterms
form; hence decoder outputs (that are actually minterms) can be used to implement any combinational circuit by ORing the
required minterms. Hence a combinational circuit with n-bit input and m-bit output can be implemented using an n-to-2n
decoder and m number of OR gates with multiple inputs.
6.4.1.1. Enable input and decoder cascading
A decoder may be provided with an additional input to enable or disable its operation. This additional input is called “enable”
input. When this input is not enabled, all of the 2n outputs of an n-bit decoder are 0. Decoders with enable inputs can be
combined to build a larger decoder circuit. For example, two 2-to-4 line decoders can be connected together to give a 3-to-8
line decoder, as shown below:
Figure 6.2: 3-to-8 line decoder using two 2-to-4 line decoder
63
EE233L: Digital Logic Design Lab
64
LAB 6
65
EE233L: Digital Logic Design Lab
Write Verilog code that implements your design of 4-to-16-line decoder with enable input using the already coded 3-to-
8-line and 1-to-2-line decoders in a hierarchical pattern. [2]
Write test bench module to simulate your 4-to-16-line decoder for an arbitrary set (at least eight in number) of input
combinations. Make sure to test the enable of your decoder. [2]
Show your code and simulation waveforms to the lab engineer to obtain credit. [2]
Take clear screenshots of the code of all modules of this task and the simulation timing waveforms, and paste them in a
WORD file such that all fit on no more than two pages. Make sure that screenshots are legible.
A B C D F
0 0 0 0
0 0 0 1
0 0 1 0
0 0 1 1
0 1 0 0
0 1 0 1
0 1 1 0
0 1 1 1
1 0 0 0
1 0 0 1
1 0 1 0
66
LAB 6
1 0 1 1
1 1 0 0
1 1 0 1
1 1 1 0
1 1 1 1
Show your code and simulation waveforms to the lab engineer to obtain credit. [2]
Take clear screenshots of the code of all modules of this task and the simulation timing waveforms, and paste them in
your WORD file such that all fit on no more than two pages. Make sure that screenshots are legible.
Search the internet for two ICs of 7400 series that implement a decoder. Also mention the decoder ICs along with their
names (numbers). [1]
How can you use a 2-to-4 decoder as a 1-to-2 decoder? Draw circuit diagram to support your answer. [2]
How many 4-to-16 decoders will be required to implement a 6-to-64 decoder? [1]
67
EE233L: Digital Logic Design Lab
68
LAB 6
_____________________________
69