Introduction: 4 Bit-Adder Project

If you have a basic understanding of binary conversions and logic gates, this project is an excellent choice for you. Designing a 4-bit Adder as part of your Engineering Final Project will allow you to create a simple calculator that can add two 4-bit binary numbers. To bring this project to life, you'll work with 74xx series IC chips and logic gates. Don't worry if you're new to these concepts; it's advisable to refresh your knowledge of binary conversions and familiarize yourself with logic gates. With the 4-bit Adder, you'll be able to perform calculations up to 15+15, resulting in 30 in decimal. In comparison to the 2-bit adder, the 4-bit version requires one half-adder and either three full adders or four full adders. Each full adder has a carrying value and a sum value, with the carry values propagating into the next full adder until the final one, where any remaining carry value becomes the 5th output. Throughout this project, you'll primarily work with fundamental logic gates such as XOR, AND, and OR gates, which are essential components in digital circuits. If you're interested in building the complete project, you can refer to the list of supplies required. Undertaking this project will provide you with valuable hands-on experience in binary arithmetic and digital logic. It will strengthen your understanding of binary conversions and enhance your grasp of the fundamental workings of basic calculators. Here are the supplies at the bottom!

Supplies

Step 1: Basic Understanding of Logic Gates Using Half Adders

Before we start the actual assembly of the 4-bit adder, let's first start with an understanding of how logic gates are incorporated into half adders. A half-adder consists of two fundamental logic gates: XOR (exclusive OR) and AND. The XOR gate outputs a result that is 1 if the inputs are different, and 0 if they are the same. In contrast, a regular OR gate outputs 1 if at least one input is 1. The XOR gate is crucial for addition in binary because when adding 1 and 1, we need the result to be 0 and carry over a 1 to the next bit. To handle the carry-over, we introduce the AND gate. The AND gate produces a result of 1 only if both inputs are 1. By connecting the output of the AND gate in parallel with the XOR gate, we obtain both the sum and carry-out bits.

When adding 1 and 0, the XOR gate outputs 1 as the sum, and there is no carry-over, so the carry-out is 0. However, when adding 1 and 1, the XOR gate outputs 0 as the sum, and we require a carry-over. The AND gate, by receiving 1 from both inputs, generates a carry-out of 1, which is added to the next bit. This arrangement allows us to correctly handle the addition of binary numbers, producing the correct sum and carry-out. The half-adder forms the basis for more complex adder circuits, such as the full-adder used in 4-bit adders.

Step 2: Basic Understanding of Logic Gates Using Full Adders

Now that you understand what a half adder does, let's view a full adder. A Full Adder is a combinational logic circuit that adds three input bits: A, B, and a carry-in (C-in) bit and produces a sum (S) output and a carry-out (C-out) output. It overcomes the limitation of a half-adder by considering the carry from the previous bit addition. Here's a simplified explanation of a full adder using examples:

Let's consider two single-digit binary numbers: A = 1 and B = 1, and a carry-in bit C-in = 0.

  1. Step 1: Adding the bits A and B using the XOR gate (exclusive OR).
  2. A = 1 B = 1 XOR(A, B) = 0
  3. The XOR gate outputs 0 because both A and B are the same.
  4. Step 2: Adding the carry-in bit C-in with the XOR result using another XOR gate.
  5. XOR(XOR(A, B), C-in) = XOR(0, 0) = 0
  6. Since C-in is 0, the XOR gate produces 0.
  7. Step 3: Determining the carry-out using the AND gate.
  8. A = 1 B = 1 AND(A, B) = 1
  9. The AND gate outputs 1 because both A and B are 1.
  10. Step 4: Obtaining the final sum (S) using the second XOR result from Step 2.
  11. XOR(XOR(XOR(A, B), C-in), AND(A, B)) = XOR(0, 1) = 1
  12. The XOR gate outputs 1, which represents the sum of A, B, and C-in.
  13. Step 5: Determining the carry-out (C-out).
  14. A = 1 B = 1 C-in = 0 OR(A AND B, C-in) = OR(1, 0) = 1
  15. The OR gate outputs 1 because either A AND B or C-in is 1, indicating a carry-out.

Therefore, when adding 1 + 1 (with C-in = 0), the full adder produces a sum (S) of 1 and a carry-out (C-out) of 1.

Step 3: Circuit Schematic

To build a 4-bit adder, you'll require three full adders and one-half adder. These adders need to be interconnected in a cascading manner, where the carry-out of one adder is connected to the carry-in of the next adder. This ensures that the carry is propagated correctly throughout the 4-bit addition. The diagram provided visually represents this concept, where the blocks represent the adders and the arrows denote the flow of carry-ins and carry-outs. By combining these adders and appropriately connecting the carry signals, you can create a functional 4-bit adder circuit. If you place your mouse next to the orange rectangle square next to either an input which is represented as the keys of the dipswitch or the led which is considered to be the output, you will see numbers such as a0, a1, a2, a3, b0 ,b1, b2, b3 for the inputs and c0,s0,s1,s2,s3, for the output. Labeling each input and output in a 4-bit-adder is crucial because it provides clarity and facilitates understanding. By clearly identifying and labeling each component's purpose, beginners can easily comprehend how different signals flow through the circuit. It helps them visualize the input and output connections, allowing for a better understanding of how the circuit functions. Additionally, labeling promotes organization by ensuring that the correct signals are connected to the intended inputs and outputs, reducing the risk of confusion and mistakes during construction and troubleshooting.

Step 4: Understanding the Mathematics of the Four Bit-adder Using a Truth Table

Let's understand the mathematics of a four-bit adder using a truth table with a simple example. Imagine we want to add the numbers 5 (binary 0101) and 3 (binary 0011) together. Here's how we can break it down using a truth table:

  1. Inputs: In our example, we have two four-bit numbers, A and B. A is 0101 (decimal 5) and B is 0011 (decimal 3). We will create a truth table to cover all possible combinations of A and B.
  2. Outputs: Since we are adding two four-bit numbers, the sum (S) will also be a four-bit number. Therefore, we will have bits in the sum: S3, S2, S1, S0, and C0. We will also have one bit for the carry-out (C_out).
  3. Filling in the Truth Table: We fill in the truth table by performing the addition of A and B, bit by bit. Starting with the least significant bit (LSB), we add 1+1, which gives a sum of 0 and a carry of 1. We fill in S0 with 0 and move the carry of 1 to the next bit. Then, we add 0+1 (carry) + 0+1, resulting in a sum of 0 and a carry of 1 again. We fill in S1 with 0 and move the carry of 1 to the next bit. Continuing this process, we add 0+0 (carry) + 1+0, which gives a sum of 1 and a carry of 0. We fill in S2 with 1 and move to the MSB. Finally, we add 0+0 (carry) + 1+0, which gives a sum of 1 and a carry of 0. We fill in S3 with 1 and S4 become leave C_out as 0.

Let's take the example above us

Analyzing the Results: By examining the truth table, we can see that the sum of 5 and 3 (0101 + 0011) is 00110, which is equal to decimal 6. The carry-out (C_out) is 0, indicating that there is no carry from the most significant bit.

This example allows us to understand how to use a truth table to perform binary addition. They can see how each bit is added, including any carries that occur. It helps them visualize the step-by-step process of adding binary numbers and obtain the correct result.

Step 5: Powering the Components of Your Adder

Before starting the wiring process, make sure all the required components are properly placed on the breadboard. In the provided picture, the initial setup includes dip switches on the left side and logic gates in the correct order to simplify wiring. The order of the logic gates is XOR, XOR, AND, AND, and OR. Additionally, all five LEDs are positioned on the bottom right of the breadboard and connected directly to the ground.

Now, let's proceed with the wiring process step-by-step, ensuring it's beginner-friendly:

  1. Begin by connecting the power supply to the dip switches. Locate the positive (+) and negative (-) terminals on the breadboard. Connect the positive terminal of the power supply to one of the rows on the same side as the dip switches. This row will provide power to the switches.
  2. Next, connect the ground (GND) terminal of the power supply to the ground (GND) rail on the breadboard. This establishes the common ground reference for all components.
  3. Each logic gate needs power and ground connections. Connect each gate's VCC (power) pin to the positive rail on the breadboard. This ensures that the gates receive power.
  4. Connect the GND (ground) pin of each logic gate to the ground (GND) rail on the breadboard. This completes the ground connection for the gates.
  5. Take note of the orientation of the IC (integrated circuit) chips containing the logic gates. The notch or dot on the chip indicates the orientation, and it should be facing towards the left side.
  6. wire the dip switches to the corresponding inputs of the logic gates. Connect each switch's output pin to one of the input pins on the logic gates. Ensure that the connections are made in the correct order, maintaining the desired functionality.
  7. Finally, connect the LEDs to the output pins of the logic gates. Connect the positive (anode) terminal of each LED to a current-limiting resistor (usually around 330 ohms), and then connect the other end of the resistor to the output pin of the respective logic gate. Connect all LEDs' negative (cathode) terminal directly to the ground (GND) rail.

By following these steps, you will have successfully connected the dip switches to power, established power and ground connections for the logic gates, and connected the LEDs to the ground for visual output. Remember to double-check your connections and ensure everything is securely attached before applying power to the circuit.

Step 6: Start With Making the Half Adder

Next, start by making a half-adder which gives the first sum and carry for the 1st full adder of the 3. The wiring for this circuit is pretty easy. In this circuit, the 1st dip switch, 4th switch is connected to both XOR and AND gate, which goes for the 2nd dip switch 4th switch as well. The XOR output would be the first sum (s0) connecting to the AND output becomes the carry for the full adder.

Step 7: Add the Next 3 Full Adders and Test Using Binary Calulator

After constructing the half-adder, we can proceed to build one of the three full adders in the 3-bit addition circuit. For the first full adder, the carry output from the half-adder is used as the carry input. The switches, located one position to the left of those used in the half-adder, are connected to both an XOR gate and an AND gate, similar to the previous circuit. However, in the full adder, an additional XOR gate is introduced. To incorporate the carry from the previous adder, the carry output and the XOR output from the first XOR gate are fed into another XOR gate. The resulting output of this XOR gate becomes the sum (s1) for this adder. Once the circuit is fully wired, you can test its functionality by connecting LEDs to a separate breadboard. Try different calculations and verify the accuracy of the 4-bit adder by using a Binary Calculator website or similar tool which is used to validate the accuracy of calculations performed by a 4-bit adder. It provides an independent means of verifying the correctness of the binary addition operations. If the 4-bit adder displays the correct values, you can take pride in successfully creating an impressive 4-bit adder. Congratulations on your accomplishment!

Step 8: Final Project