Embedded Systems Project 9 - Designing Logic Circuits with

advertisement
Embedded Systems Project 9 - Designing Logic Circuits with Decoders
In this laboratory experiment you will build a single-bit, full-adder using a 74138 decoder and a 7420 dual 4-input
NAND gate integrated circuit. The 74138 has an active-low output so you will be using negative logic in your
circuit design.
Background - The 74138 is a 3-to-8 decoder in which one of 8 output lines (O0..O7) is selected to be set low (L)
as determined by the input select lines (A2, A1, A0) where A0 is the least-significant bit (LSB) of these three select
lines and the three bits represent a binary encoded value between 0 and 7. This is our first look at “negative logic”
in which the selected or active output is set to 0V rather than 5V.
The truth table in Figure 1 shows the response for each possible bit-pattern applied to (A 2, A1, A0). Note that for
the chip to operate, the pins labeled E1 and E2 must be grounded and the pin labeled E3 must be set to Vcc. The X
values in this table represent "don't care" states for the IC inputs which means that the value applied does not
affect the outputs. The L and H values represent Low and High outputs. It is up to the user to determine the truthvalue to be associated with these values.
Figure 1: Input/Output Table for 74138 Decoder
Step 1: Complete the truth table for a single-bit full adder. The three inputs of the
full adder are the two bits being added (Ai and Bi) and the carry-in from the
previous bit (Cin) if any. The two outputs of the full adder are the
Bi
Ai Cin
sum bit (S) and the carry-out bit (Cout). Show the outputs of the
sum (S) and the carry-out (Cout) for each of the eight settings of
Full Adder
the input A, B and Cin (carry-in).
Bi Ai Cin
Step 2: Design a positive-logic (normal) full-adder circuit.
Assume that the 3-to-8 decoder is an active-high device. Sketch
Cout
Si
and label your circuit below. (Ref: Textbook Computing
Machinery, Section 3.4)
0
0
0
0
0
1
0
1
0
0
1
1
1
0
0
1
0
1
1
1
0
1
1
1
S
Cout
Step 3: As stated earlier the 74138 provides an active low output (negative logic). This means that the selected
output line is low while the other seven output lines are high (Vcc). For this reason we will not use OR gates to
accumulate the selected outputs for the sum (S) and carry out (Cout) functions. We could pass each output through
a NOT gate to convert the 74138 to active high, but this would require eight inverters (or two 7404 ICs). Instead
we will replace the OR gates in the positive-logic circuit design with NAND gates. Note that NAND gates have a
low output only if all inputs are high, therefore they can be used to convert the negative logic output of the 74138
back to positive logic. Replace the OR gates in your circuit with 4-input NAND gates provided in the 7420.
Implement your circuit using the 74138 and 7420.
The pinouts for these two ICs are shown in
Figure 2.
Step 4: Test your circuit by applying binary
encoded values 000 through 111 to the select
lines of the 74138. These data can be generated
using the Arduino processor board running the
three_variable_generator. You should test both
the sum (S) and the carry out (Cout) for all
combinations of A, B and Cin. Debug your circuit
if necessary before continuing.
Figure 2: Pinout Diagrams for 74138 and 7420
Step 5: Get with three other students (if available) and join your circuit with other completed full adders in the lab
to make a 4-bit adder circuit as shown in Figure 3. This type of binary adder is called a ripple-carry adder because
the carry-out bit value can ripple through the full-adders from the LSB to the most-significant-bit.
B3
A3 Cin
B2
A2 Cin
B1
A1 Cin
B0
A0 Cin
set to 0
Full Adder
Cout
S3
Full Adder
Cout
S2
Full Adder
Cout
S1
Full Adder
Cout
S0
Figure 3: Four-Bit Ripple Carry Adder
1. How many different three-variable Boolean expressions can be implemented using a 74138 decoder? _______
Explain____________________________________________________________________________________
2. The 74138 accepts a 3-bit binary encoded value to select one of the 23=8 output lines. Describe how you could
use two 74138s to build a 4-bit to 24=16 line decoder. Hint: Use the high-order bit of the 4-bit selector value to
choose which 74138 is active using the E (enable) lines.
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
_____________________________________________________
circuit sketch
Download