# Boolean algebra and NAND gate

Discussion in 'Homework Help' started by icelated, Oct 15, 2010.

1. ### icelated Thread Starter New Member

Oct 15, 2010
12
0
I am a software engineering student taking a digital logic class, and i am trying to multiply this binary number. I am not sure what a carry in is and a Carry out. the teachers slides are horrible. It appears he used a truth table to do this but its confusing.
Code ( (Unknown Language)):
1.
2.    X1X0
3.  + Y1Y0
4.    -----
5.  Z2Z1Z0
6.
7.
I think thats how its set up! Now, for the multiplication part. Oh, i think the carry in and carry out is for adding?
If so, dont worry about the carry in and carry out part ok?
but i think i still need to use the multiplication answer for the table?

Code ( (Unknown Language)):
1.
2.
3.        1  carry in?  like if we are adding? Now, that i think about it there is no carry in with multiplication!
4.    110101
5.    X 1101
6.    ------
7.  101011001  thats what i ended up with. Probably, not right!
8.
9.
I think my truth table should look something like this: keep in mind this is not set up to my answer above

Code ( (Unknown Language)):
1.
2.        X1X0
3.      + Y1Y0
4.         ----
5.      Z2Z1Z0
6.
7.        X0   Y0   Carry     Z0
8.        0     0     0          0
9.        1     0     0          1
10.        0     1     0          1
11.        1     1     1          0
12.
13.
14.
15.   X1    Y1     Carryin               Carryout    Z1
16.   0      0           0                    0             0
17.   1      0           0                    0             1
18.   0      1           0                    0             1
19.   1      1           0                    1             0
20.   0      0           1                    0             1
21.   1      0           1                    1             0
22.
23.
I get confused on the x1 and y1 part It would be easier if i can see it in action and labeled what the "carry in" is and "carry out" is while its being multiplied OR adding?.

would the "carry in" be the result of 1+1 and the "carry out" be the result of the next carry result?
I think after we get the truth table done with the carry in and carry out we are to use boolean algebra like:

Code ( (Unknown Language)):
1.
2.   Z1 = X1• Y1' • Carryin' + X1' • Y1• Carryin' + X1' • Y1' • Carryin + X1• Y1• Carryin
3. Carryout = X1• Y1• Carryin' + X1 • Y1' • Carryin + X1' • Y1• Carryin + X1 • Y1• Carryin
4. Z2 = Carryout
5.
6.
We are to "work out the equations for the AND, OR and NOT functions using only the NAND operator." not sure how to do this!

2. ### Georacer Moderator

Nov 25, 2009
5,151
1,266
First things first! You must learn how to add binary numbers correctly. In this example we will learn how to add two 4-bit numbers.

The carry-in refers to a possible 1 that comes from a previous addition and must be taken into account for the current addition. Carry out refers to a possible carry that will be produced from our addition, if the result is larger than 4 bits (it can be at most 5 bits). It is a product of the current addition, not an operand

Suppose we want to add the numbers 1101 (12) and 1000 (8) and we have a carry in from a previous addition:

$\begin{array}{ccccc} B4 & B3 & B2 & B1 & B0 \\
\ &\ &\ &\ &1\\
\ &1&1&0&1\\
+&1&0&0&0\\
-&-&-&-&-\\
1&0&1&1&0
\end{array}$

We make the additions of every column, starting from the right. In the result, we write only the last bit of the minor sum.
I remind that 0+0=0, 0+1=1, 1+1=10 and 1+1+1=11.

That said B0=1+1+0=10. We write 0 on the result and keep 1 as a carry for the next step.
B1=1+0+0=1
B2=1+0=1
B3=1+1=10
B4=1

As the result is larger (5 bits) than the operands, we usually say that we have an overflow and say that B4=1 is the carry out, while the result is 0110.

As for mutliplication, it is done exactly as in the decimal system. Refer here: http://en.wikipedia.org/wiki/Binary_multiplication#Multiplication for more info.