Produce truth tables for logic circuits including half adders and full adders
15.2 Boolean Algebra and Logic Circuits
What is Boolean Algebra? 🤔
Boolean algebra is a branch of mathematics that deals with binary variables (0 or 1). Think of it as a set of rules for working with “yes/no” questions. In digital circuits, these rules help us design devices that can add numbers, make decisions, and store information.
Logic Gates in a Nutshell 🥜
- AND – outputs 1 only if both inputs are 1.
- OR – outputs 1 if at least one input is 1.
- NOT – flips the input (0 becomes 1, 1 becomes 0).
- XOR (Exclusive OR) – outputs 1 if the inputs are different.
Half Adder – Adding Two Bits ⚡️➕
A half adder adds two single binary digits (bits) and produces a sum and a carry‑out. Imagine you have two piles of candies: one pile has 0 or 1 candy, the other pile also has 0 or 1 candy. The half adder tells you how many candies you have in total (sum) and if you need to move one candy to the next higher place (carry).
Truth Table for Half Adder
| A | B | Sum (A ⊕ B) | Carry (A · B) |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
In the table, the Sum column uses the XOR operation ($A \oplus B$) and the Carry column uses the AND operation ($A \cdot B$). The half adder is perfect for adding two single bits but it doesn’t handle a carry coming from a previous addition.
Full Adder – Adding Three Bits 🌟
A full adder adds three bits: two significant bits and an incoming carry from a less significant position. It outputs a sum and a carry‑out. Think of stacking three piles of candies: the first two piles are the bits you’re adding, and the third pile is the carry you received from the previous addition.
Truth Table for Full Adder
| A | B | Cin | Sum (A ⊕ B ⊕ Cin) | Carry ( (A·B) + (A·Cin) + (B·Cin) ) |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 0 | 1 | 0 | 1 |
| 1 | 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 1 | 1 |
The Sum column is the XOR of all three inputs ($A \oplus B \oplus \text{Cin}$). The Carry column can be derived from the expression $ (A \cdot B) + (A \cdot \text{Cin}) + (B \cdot \text{Cin}) $, which captures all cases where at least two of the inputs are 1.
Why These Matter? 🚀
- Half adders and full adders are the building blocks of binary adders, which are used in CPUs, calculators, and all digital devices that perform arithmetic.
- Understanding truth tables lets you predict how a circuit will behave without building it.
- These concepts also introduce you to combinational logic, a key part of computer architecture.
Quick Practice Challenge 🎯
- Draw the truth table for a half adder where the inputs are A = 1 and B = 0.
- Using the full adder truth table, find the sum and carry when A = 1, B = 1, and Cin = 0.
- Explain in one sentence why a full adder is needed when adding multi‑bit numbers.
Takeaway Summary 📚
- Boolean algebra gives us the rules for binary logic. - A half adder adds two bits and outputs a sum and carry. - A full adder adds three bits (including a carry‑in) and outputs a sum and carry‑out. - Truth tables are the “road maps” that show every possible input and its resulting output. - These simple circuits are the foundation for all arithmetic operations in digital computers.
Revision
Log in to practice.