## Description

**Lab ****6 2-bit Adder/Subtractor **

**Introduction**

Arithmetic circuits such as the digital adder and subtractor are simple combinational logic. In this lab, students learn to construct a 2-bit full adder/subtractor from basic combinational logic.

**Experimental Equipment List**:- 74HC
**08**AND gate chip, two 74HC**86**XOR gate chips, and 74HC**32**OR gate chip

- 74HC

(XOR) |

**Design Procedure**

Hierarchy in circuit design is often necessary to manage complex layouts that reuse common components such as basic logic gates. We start with logic gates, then we build half adders from them, then a full adder from half adders, and finally, we cascade 2 full adders to obtain a 2-bit adder block. The basic half-adder diagram is:

The Boolean expression for the sum of A and B is S = A⊕B, and carry is C =A⋅B. The half-adder adds two single bits, A and B, but does not make a provision for carry-in. If we wish to make a full adder (an adder that provides for carry-in), it looks like:

The full adder sum is: S =A⊕B⊕Cin, and carry is Cout =AB + (A⊕B)Cin, The full adder accommodates three variables, two input bits and a carry, which can be built from 2 half adders. A 2-bit full adder requires connecting two 1-bit full adders together like below.

The 2-bit full adder can be used to perform subtraction by inverting B input and setting Cin = 1. The addition and subtraction operations can be combined into one circuit with one common binary adder by including an XOR gate with each full adder and a control input M that controls the operation.

**Circuit Construction on Tinkercad**

** **

- After you log in to the Tinkercad, copy and paste the following link to your web browser https://www.tinkercad.com/things/h3EJqRMU0aa to make a copy of the Lab 6 starter circuit.

- Constructing a 2-bit adder/subtractor requires XOR, OR, and AND gates. The gates should be connected as follows

**Switches: A1, A0, B1, B0, M LEDs: C2, S1, S0**

- Connect inputs A1-A0 (number A) and B1-B0 (number B) to four of the
**data switches**according to the order offrom left to right. A fifth data switch should be connected to__A1, A0, B1, B0__**M**. Note that A0 and B0 are the least significant bits of each number. The Sum**S1-S0**and carry-out**C2**should go to three**LED**inputs according to the order offrom left to right.__C2, S1, S0__ - Start the simulation and turn on combinations of the input switches to check that addition/subtraction of two-bit binary numbers is successful.
- Complete the following additions/subtractions at least: 1+2, 3+1, 0+3, 2+2, 3+3, 3-1, 2-2, 2-0, 3-2, 1-2. Tabulate the results.

**Note the subtraction result is 2 bit and not 3 bits so you need to disconnect the C2 wire from the LED to the bottom breadboard to see the correct result.**

__Submission Instructions:__

__Lab work submission__

- Take screenshots of your circuit for all your testing cases.
- Copy the link of your circuit for sharing.
- On the Blackboard, click on Lab 6. Attach the screenshots from Step 1 and paste the link from Step 2 into the Comments area, then hit the “Submit” button.

**Lab report is not needed for this lab. **