ALU2123113 Lab Instructions

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 13

ECEN 106: ALU Laboratory Instructions

Overview
You will construct and test a 2-bit binary adder circuit and verify its correct operation.

Background
You constructed logic circuits in the previous laboratory. A typical Arithmetic Logic Unit (ALU)
performs all those same functions (NOT, AND, OR and XOR). An ALU also performs arithmetic
functions such as addition and subtraction.
Arithmetic functions such as addition, can be defined using a truth table. The truth table shown
in Figure 1 is for a 2-bit adder circuit. The first 2-bit addend has bits A0 and A1 where A0 is the
least significant bit (LSB) and A1 is the most significant bit (MSB). The second addend has bits
B0 and B1. These are the inputs to the adder circuit. The smallest addend is 00 (0 in base 10).
The largest addend is 11 (3 in base 10).
There are three outputs: Sum0, Sum1, and CarryOut. Sum0 is the LSB and CarryOut is the MSB.
The largest output will be 110b (6d) which is obtained by adding 11b (3d) and 11b (3d).

A1 A0 B1 B0 CarryOut Sum1 Sum0


0 0 0 0 0 0 0
0 0 0 1 0 0 1
0 0 1 0 0 1 0
0 0 1 1 0 1 1
0 1 0 0 0 0 1
0 1 0 1 0 1 0
0 1 1 0 0 1 1
0 1 1 1 1 0 0
1 0 0 0 0 1 0
1 0 0 1 0 1 1
1 0 1 0 1 0 0
1 0 1 1 1 0 1
1 1 0 0 0 1 1
1 1 0 1 1 0 0
1 1 1 0 1 0 1
1 1 1 1 1 1 0

Figure 1
A block diagram for the circuit that implements the 2-bit adder is shown in Figure 2. This
diagram shows the inputs at the top and the outputs at the bottom.
It uses a half-adder for the two least significant bits (A0 and B0) in column 0 because a Carry
from the previous column does not exist. The sum of those bits (Sum0), along with a Carry is
produced.
A full-adder is required for the next column (column 1) because the Carry from column 0 must
be included. It has bits A1 and B1 as inputs, in addition to the Carry from column 0. The
outputs are Sum1 and Carry. A full-adder can be constructed with two half-adders and an OR
gate.

Figure 2

Preparation
Watch the video How to Use a Breadboard (12 minutes).

Required Data Sheets


These data sheets show the pin connections and electrical characteristics of electronic components.
Engineers use these data sheets; the instructions in this worksheet cover all the information you need to
know, but you are welcome to review the data sheets for additional learning opportunities:

 74LS08 Quad 2-Input AND Gates


 74LS32 Quad 2-Input OR Gates
 74LS86 Quad 2-Input Exclusive-OR Gates

Required Equipment and Materials


 74LS08 AND Gate Integrated Circuit (1)
 74LS32 OR Gate Integrated Circuit (1)
 74LS86 XOR Gate Integrated Circuit (1)
 LAFVIN Super Starter Kit for UNO R3 (1), containing the following items:
o Solderless Breadboard (1)
o Power Supply Module (1)
o Arduino Uno (1)
o 9 V Battery (1)
o Battery Connector (1)
o Red LEDs (3)
o 220 Ohm Resistors (3)
o Male-to-Male Jumper Wires (28)

Schematic Diagram of the Circuit


The actual circuit, with IC pin numbers, for the 2-bit adder is shown in Figure 3. It has the
inputs at the top and the outputs at the bottom.
Figure 3

Connect Power and Ground to the Breadboard


There are two ways you can supply power to the circuits used in this laboratory: (1) the power
supply module, or (2) the Arduino Uno.
Method 1: Use the Power Supply Module
1. Plug the power supply module into the solderless breadboard as shown in Figure 4.
2. On the power supply module, there are two yellow jumpers. The yellow jumpers are
adjustable brackets on the edge of the module. There are four prongs which provides the
jumpers three positions to be in: 3.3V, Off, or 5V. Move the two yellow jumpers to the 5V
position as shown in Figure 3.
3. Insert four male-to-male jumper wires across the middle of the negative and positive lines of
both busses as shown by the red wires in Figure 3. This step is important as it extends the 5V
and GND busses along the entire length of the board.
NOTE: Although they will look different than the wires shown in the figure, the male-to-
male jumper wires in your kit can be used for this.
4. Connect the 9V battery to the power supply module. Ensure it is correctly connected by
pressing the white button next to the green LED; this should turn the power on, and if the
battery is correctly connected, the LED will turn on.
5. Turn the power supply module off by pushing the white button again. The LED will turn off.
Do not continue the project until the power is off.
Figure 4

Method 2: Use the Arduino Uno


1. Connect a male-to-male jumper wire from the 5V pin on the Arduino to the 5V bus (near the
red line) on the solderless breadboard as shown by the diagonal red wire in Figure 5.
2. Use a male-to-male jumper wire to connect the 5V bus on one side of the board to the 5V
bus on the other side of the board as shown by the vertical red wire in Figure 5.
3. Connect a male-to-male jumper wire from the GND pin on the Arduino Uno to the GND bus
(near the blue line) on the solderless breadboard as shown by the diagonal black wire in Figure
5.
4. Use a male-to-male jumper wire to connect the GND bus on one side of the board to the
GND bus on the other side of the board as shown by the vertical black wire in Figure 5.
5. Insert four male-to-male jumper wires across the middle of the negative and positive lines of
both busses as shown by the four short horizontal wires in Figure 4. This step is important as it
extends the 5V and GND busses along the entire length of the board.
NOTE: Although they will look different than the wires shown in the figure, the male-to-
male jumper wires in your kit can be used for this.
6. Cut the power from the solderless breadboard before continuing. Do so by unplugging the
Arduino board from your computer before proceeding.

Figure 5
Connect and Test the Output LEDs
1. Plug a 220 Ohm resistor into the solderless breadboard. See Figure 6.
2. Plug in a red LED with the long lead in the same column as the resistor. See Figure 6.
3. Connect the short lead of the LED to the GND bus with a male-to-male jumper wire. See
Figure 6.

ß The 220 Ohm resistor in the LAFVIN


Super Starter Kit for UNO R3 has five
color bands: red, red, black, black,
brown.

Figure 6

4. Repeat steps 1, 2, and 3 to connect two more output LEDs. See Figure 7.
5. Temporarily connect three test wires between 5V and the bottom of each resistor. See
Figure 8.

Figure 7

Figure 8

6. Connect power to the solderless breadboard by pushing the white button on the power
supply module or connecting the Arduino board to your computer.
7. Make sure all three LEDs light up. If they do not, verify that the LEDs are plugged in correctly.
See steps 2 and 3 again if necessary.
8. Remove the three temporary test wires.
9. Disconnect power from the solderless bread board.

Connect 5V and GND to each Integrated Circuit


1. Plug the 74LS08, 74LS32, and 74LS86 integrated circuits (IC) into the solderless breadboard
with the notch on the ICs facing the left. See Figure 9.
Figure 9

2. See the pin diagram for a 14-pin IC in Figure 10.

Figure 10

3. Connect pin 7 of all three ICs to GND as shown by the vertical black wires in Figure 11.
4. Connect pin 14 of all three ICs to 5V as shown by the vertical red wires in Figure 11.

Figure 11
Connect and Test the Sum0 Sub-circuit
1. Connect pin 3 of the 74LS86 to the bottom of the Sum0 resistor. See Figure 12.

2. Connect pin 1 of the 74LS86 to GND. This is the B0 input. See Figure 12.

3. Connect pin 2 of the 74LS86 to GND. This is the A0 input. See Figure 12.

Figure 12

4. Connect power to the solderless breadboard.


5. Verify that the Sum0 LED is off (logic 0) when A0 and B0 are connected to GND.
6. Move B0 to 5V. Sum0 should turn on (logic 1).
7. Move A0 to 5V. Sum0 should turn off (logic 0).
8. Move B0 to GND. Sum0 should turn on (logic 1).
9. Move A0 back to GND. Sum0 should turn off (logic 0).
10. Disconnect power from the solderless breadboard.

Connect and Test the Sum1 Sub-circuit


1. Connect pin 8 of the 74LS86 to the bottom of the Sum1 resistor. See Figure 13.

2. Connect pin 4 of the 74LS86 to GND. This is the B1 input. See Figure 13.
3. Connect pin 5 of the 74LS86 to GND. This is the A1 input. See Figure 13.

4. Connect pin 1 of the 74LS86 to pin 1 of the 74LS08. See Figure 13.

5. Connect pin 2 of the 74LS86 to pin 2 of the 74LS08. See Figure 13.

6. Connect pin 3 of the 74LS08 to pin 9 of the 74LS86. See Figure 13.

Figure 13

7. Connect pin 6 of the 74LS86 to pin 10 of the 74LS86. See Figure 13.

8. Connect power to the solderless breadboard.

9. Verify that the Sum1 LED is off when A0, B0, A1, and B1 are connected to GND.

10. Move B1 to 5V. Sum1 should turn on.

11. Move A1 to 5V. Sum1 should turn off.

12. Move B1 to GND. Sum1 should turn on.

13. Move A1 back to GND. Sum0 should turn off.

14. Disconnect power from the solderless breadboard.

Connect and Test the CarryOut Sub-circuit


1. Connect pin 3 of the 74LS32 to the bottom of the CarryOut resistor. See Figure 14.
2. Connect pin 8 of the 74LS08 to pin 1 of the 74LS32. See Figure 14.

3. Connect pin 6 of the 74LS08 to pin 2 of the 74LS32. See Figure 14.

4. Connect pin 4 of the 74LS08 to pin 4 of the 74LS86. See Figure 14.

5. Connect pin 5 of the 74LS08 to pin 5 of the 74LS86. See Figure 14.

Figure 14

6. Connect pin 9 of the 74LS08 to pin 9 of the 74LS86. See Figure 14.

7. Connect pin 10 of the 74LS08 to pin 10 of the 74LS86. See Figure 14.

Test the 2-bit Binary Adder Circuit


1. Connect power to the solderless breadboard.

2. Connect inputs A1, A0, B1, and B0 to GND. These are the pink wires shown in Figure 14. This
corresponds with an input of 00 + 00 (A1 A0 + B1 B0).

3. Observe the three LEDs (CarryOut, Sum1, and Sum2). Record their status (1 = on, 0 = off) in
the first row of the truth table (Figure 15).

4. Move input B0 from GND to +5V. This corresponds to an input of 00 + 01 (A1 A0 + B1 B0).

5. Observe the three LEDs (CarryOut, Sum1, and Sum2). Record their status (1 = on, 0 = off) in
the second row of the truth table (Figure 15).
6. Continue testing all the combinations of A1, A0, B1, and B0, and recording the LED outputs
on the corresponding rows of the truth table (Figure 15).

7. Compare the actual results you recorded in Figure 15 with the expected results in Figure 1.
If they are not the same, check your circuit connections and test the circuit again.

8. Disconnect power from the solderless breadboard.

A1 A0 B1 B0 CarryOut Sum1 Sum0


0 0 0 0 0 0 0
0 0 0 1 0 0 1
0 0 1 0 0 1 0
0 0 1 1 0 1 1
0 1 0 0 0 0 1
0 1 0 1 0 1 0
0 1 1 0 0 1 1
0 1 1 1 1 0 0
1 0 0 0 0 1 0
1 0 0 1 0 1 1
1 0 1 0 1 0 0
1 0 1 1 1 0 1
1 1 0 0 0 1 1
1 1 0 1 1 0 0
1 1 1 0 1 0 1
1 1 1 1 1 1 0
Figure 15

Submit Your Laboratory Report.


After filling in all the blanks in Figure 15 on this instruction sheet, submit it along with a photo
of your circuit through Canvas.

Extra Credit Challenge (15 Extra Points!)


Convert the 2-bit adder into a 2-bit subtractor. Submit your circuit diagram and truth table.

You might also like