views:

96

answers:

4

I am trying to wrap my mind around how to do this. For what i understand is that a set of logic gates is called "functionally complete" if some combination of the gates can be used to do each of the basic logic operations AND, OR, and NOT. The claim is the NAND gate is functionally complete.

What i dont understand is how to build a OR gate as a nand gate. build a AND gate from a NAND gate etc.. would the formula i come up with have to have the same output?

 X' = X NAND 1
 X + Y = ?
 X * Y = ?

using a truth table how is X' = X NAND 1?

I am not sure what X NAND 1 means.. I understand 1 is fixed as y?

I get confused when i see the gate inbetween 2 inputs like x NAND y

How can i construct a truth table for x+y = NAND?

or should i do it a different way?

+3  A: 

Just go by definition:

X NAND Y = ~ (X AND Y) = ~X OR ~Y

Substitute Y = 1 and see you will get

X NAND 1 = ~X OR ~1 = ~X OR 0 = ~X = X'

Edit:

Just so that you get a sense on how to build other gates using NAND gate, this wikipedia article is very good and informative. Hope it helps.

http://en.wikipedia.org/wiki/NAND_logic

Mahesh Velaga
What does ~ mean?
icelated
~ means logical NOT
Joseph
`~` is shorthand for `NOT`.
Lord Torgamus
can you make a truth table showing how this works?
icelated
@icelated, see my answer; comparing to 1 is just like having a column full of 1s
Lord Torgamus
A: 

Quick truth tables:

NAND 1 0
0    1 1
1    0 1

OR 1 0
0  1 0
1  1 1

NOT
1   0
0   1

What functionally complete means is that, given a pile of the complete gate, you can construct any other gate type.

So if you build a circuit with 1 NAND gate, you get exactly the opposite of an OR gate (inputs reversed). If your goal is to build the OR gate, you have to invert the inputs of the NAND gate. That's easy to do with a couple NOT gates (which is, if you look carefully, the same as a NAND gate with one of its inputs tied to logical 1). So you put those NOT gates before your NAND gate and voila, an OR gate falls out.

For your confusion, putting the gate between its two inputs is just using that gate as a binary operator, like a + sign. It's the same as saying NAND(X, 1) or "The output of the NAND gate when its inputs are X and 1."

Nathon
+1 @Joren; see DeMorgan's Laws on [Wikipedia](http://en.wikipedia.org/wiki/De_Morgan%27s_laws) for source
Lord Torgamus
+2  A: 

Yes, X NAND 1 is like X NAND Y with Y fixed as 1. The thing you're comparing X with doesn't have to be called Y; it can be any variable, any constant or the result of another comparison. All that matters is whether the value is a 0 or a 1, in the end.

Example:

 X | Y | 1 | X OR Y
---+---+---+--------
 0 | 0 | 1 |    0
 0 | 1 | 1 |    1
 1 | 0 | 1 |    1
 1 | 1 | 1 |    1

Now you could do X AND Y, X AND 1 or X AND (X OR Y) just by comparing the numbers in the first column with numbers in the second, third or fourth columns, respectively.

As for NAND specifically, just remember that it means the opposite of AND. It actually stands for "not and." So if you ANDed two things together and got 0, then NANDing the same two things together would give you 1.

That said, your last question doesn't make much sense. There's no such thing as X+Y = NAND. X, Y and X+Y are values; NAND is a gate. You can't compare numbers to gates. Your question is asking you to use NAND gates to compare things over and over until you you get a column of zeroes and ones that looks the same as X+Y does.

EDIT:
Okay, let's look at your question "using a truth table how is X' = X NAND 1?"

 X | X' | 1 |   X AND 1   | X NAND 1 is the same as the opposite of X AND 1
---+----+---+-------------+-------------------------------------------------
 0 | 1  | 1 | 0 AND 1 = 0 |               1 (opposite of 0)
 0 | 1  | 1 | 0 AND 1 = 0 |               1 (opposite of 0)
 1 | 0  | 1 | 1 AND 1 = 1 |               0 (opposite of 1)
 1 | 0  | 1 | 1 AND 1 = 1 |               0 (opposite of 1)

And looking at each column, we can see that X' has the same values as X NAND 1

Lord Torgamus
so i would just need to x' = NAND to get the x+y to works as a NAND gate?
icelated
As I said in the answer, you can't compare a value (like `X'`) to a gate (like `NAND`). I don't really understand your question, could you reword it?
Lord Torgamus
what gets me confused is i look at a truth table for NAND and the output is 1 1 1 0 im not getting that for x'
icelated
what i mean is if x + y needs to be like a NAND dont they need the same output? Dont i look at the truth table for x+y and then alter the NAND table to get it to output the same as a x + y?
icelated
@icelated, not quite. What they want you to do is use the `NAND` gate in different places until the output looks the same as an `OR` gate. You will definitely have to use more than one NAND gate. It'll take some trial and error. Just look for patterns; for example, if you get a result that looks like the opposite of `OR`, you can just `NAND` it with itself. __In other words, `X NAND X = X'.`__ You can prove this with a truth table that looks a __lot__ like the one in my edit.
Lord Torgamus
so i see if i use x' + y' in the OR gate it acts as an NAND gate
icelated
@icelated, oh, I think I see your problem now. You said "i look at a truth table for NAND and the output is 1 1 1 0"; that's the result for `X NAND Y` if you use 0 0 1 1 for `X` and 0 1 0 1 for `Y`. What you should be looking at is `X NAND X`, which has a different result.
Lord Torgamus
Can you give me one example on a truth table on how x + y can work a s a NAND gate?
icelated
why should i be looking at X NAND X? i am a bit confused
icelated
@icelated, "if i use x' + y' in the OR gate it acts as an NAND gate" - yep, that's right.
Lord Torgamus
so, its safe to say that x + y is the same as x' NAND y'
icelated
@icelated, I just thought that `X NAND X` might be a little easier to understand because you don't have to worry about `Y`. But if it's confusing you, you can forget about it.
Lord Torgamus
@icelated, "x + y is the same as x' NAND y'" is also true. Now all you have to do is find out how to get `X'` and `Y'`. Except we already talked about that, so you basically know the answer.
Lord Torgamus
my problem is if i look at aNAND truth table i see th e outputs so i am trying to make a OR x+y to alter it to make it a NAND output.. i just cant do it
icelated
@icelated, but you already did it! You figured out one half of it, and I told you the other half before. Remember, just like in "regular" algebra, you can use variables to stand in for the results of operations. So if `A = B OR C` and `X = Y AND A`, then `X = Y AND (B OR C)`
Lord Torgamus
thank you for all your help.. i appreciate you taking the time to help me. i dont see how "and I told you the other half before. " not seeing that =(
icelated
@icelated, sure. The part I'm talking about is "In other words, `X NAND X = X'.` You can prove this with a truth table that looks a lot like the one in my edit." Remember, variables can stand for anything... if `X NAND X = X'` then `Y NAND Y = Y'` and `[result of some other expression] NAND [result of some other expression] = [result of some other expression]'`
Lord Torgamus
x + y = x' NAND y'?? or am i just a retard?
icelated
@icelated, "x + y = x' NAND y'" is true .
Lord Torgamus
i dont understand how x' + y' is half the answer? =(
icelated
So, thats how i do the rest of the problems then?
icelated
to do this X * Y = ? to work as a NAND gate i would just alter the AND table to work as a NAND gate?
icelated
@icelated, well, you know how to create `X'` using only `NAND` gates. You know how to create `Y'` using only `NAND` gates. And you know that `X' NAND Y' = X + Y`. I can't really say anything else without explicitly writing out the answer. But yes, this is the basic strategy for the rest of your problems.
Lord Torgamus
+1  A: 

NAND is basically the reverse of AND:
Truth Table

A    B    A NAND B   A AND B   A OR B   A NOR B
0    0       1         0         o         1
0    1       1         0         1         0
1    0       1         0         1         0
1    1       0         1         1         0

By making the right combinations using these and the remaining boolean operators you should be able to construct any one in terms of the others

slashmais