|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
THE HALF ADDER
|
TRUTH TABLE | ||||
---|---|---|---|---|
Input | Output | |||
A | B | Cout | Sum | |
0 | 0 | 0 | 0 | |
0 | 1 | 0 | 1 | |
1 | 0 | 0 | 1 | |
1 | 1 | 1 | 0 |
There are three steps to designing a digital circuit:
Step 1. Convert the problem description into a truth table.
Step 2. Find a switching function defined by the truth table.
Step 3. Use the logic of the function to build the circuit.
If you think back a little, you will remember that back in grade school you did a lot of homework converting English statements into algebraic expressions. As an instance, for Angie is eight years older than Dina, you had to write
A= 8+D. Converting a problem description into a truth table is a lot easier than that.
For our purpose, we need to design a circuit that is capable of adding two single-bit binary numbers. Hence, our circuit should be able to perform the following four possible calculations:
0 | 0 | 1 | 1 | |||
+ 0 | +1 | + 0 | + 1 | |||
0 | 1 | 1 | 10 |
And this line of four operations is essentially your truth table! All that's left is to make it look like a table, with labels. So first you rotate the line of operations from the current horicontal position to a vertical position, and then you label each column. In addition, since one of the result is two bit, we turn all the answers into two-bit format —like below:
A | B | RESULT | |
---|---|---|---|
0 | 0 | 00 | |
0 | 1 | 01 | |
1 | 0 | 01 | |
1 | 1 | 10 |
Now for the finishing touch. Every bit in a truth table must have its own label. So you must split the result column in two and label the first bit C and the second bit S. (Of course you can label them whatever you want!)
A | B | C | S | |
---|---|---|---|---|
0 | 0 | 0 | 0 | |
0 | 1 | 0 | 1 | |
1 | 0 | 0 | 1 | |
1 | 1 | 1 | 0 |
Voila! This is the Half-Adders's truth table!
We label each bit of the truth table to make it easy to use the labels to create a switching function. Instead of trying to solve for two or more bits at once, we can solve one bit at a time. For example, notice that the relationship between inputs A and B and output C describes an AND gate. This quick observation is easy because we label the leading bit C. Notice further that the relationship between the inputs A and B and output S describes the XOR gate. Hence, the compound function that defines the Half-Adder is
C = A BOf course, extracting a switching function from a truth table is not always so easy. So we will illustrate a more systematic approach. We start by pretending that you don't know what the XOR truth table looks like (it's on the XOR gate page). Consequently we will form the S bit switching function as follows: for every row where S = 1, we will write the relationship between the inputs A, B and the S bit—like below.
S = AB.
A | B | S | S | |
---|---|---|---|---|
0 | 0 | 0 | ||
0 | 1 | 1 | A B | |
1 | 0 | 1 | A B | |
1 | 1 | 0 |