How Is XOR Implemented Using Only NAND Gates?

Click For Summary
The discussion focuses on implementing the XOR function using only 2-input NAND gates, illustrating the transformation of expressions through logical equivalences. The key step involves manipulating the expression from x_1 NAND x_2 to show that it can be expressed as x_1 NAND (x_1 NAND x_2) by applying DeMorgan's Law and recognizing that a variable AND its negation is always false. Participants emphasize the importance of understanding these transformations intuitively rather than solely relying on truth tables. The conversation highlights the logical reasoning behind each transformation step, clarifying how the NAND representation of XOR is derived. This method showcases the versatility of NAND gates in constructing complex logical functions.
Lomion
Messages
9
Reaction score
0
An example in the book asks us to implement the XOR (exclusive-or) function using only 2-input NAND gates.

So:

f = x_1 \overline{x_2} + \overline{x_1}x_2

If we let \uparrow represent the NAND function. That means that: f = (x_1 \uparrow \overline{x_2}) \uparrow (\overline{x_1} \uparrow x_2)

I follow everything up to that step. And then they attempt to decompose it by manipulating one of the terms.

(x_1 \uparrow \overline{x_2} ) = \overline{x_1 \overline{x_2}} = \overline{x_1 (\overline{x_1} + \overline{x_2})} = x_1 \uparrow (\overline{x_1} + \overline{x_2}) = x_1 \uparrow (x_1 \uparrow x_2)

Can anyone please explain what exactly went on in that step? How did they go from the second equation to the third, and then the fourth? I understand the first and final steps, but that's it.

Any help would be greatly appreciated!
 
Physics news on Phys.org
Can anyone please explain what exactly went on in that step? How did they go from the second equation to the third, and then the fourth? I understand the first and final steps, but that's it.
Draw truth tables. If the left side of the second equation has the same truth table as the right side, you know it works. Also, if you have a text, see if they have some general laws that may have used in going from the first to second equation. Or, it shouldn't be too hard (using truth tables) to generalize some "laws" for yourself.
 
A variable AND its negation is always false. A variable OR false is just the variable itself. Those ideas plus DeMorgan's Law are being applied here.
 
Lomion said:
(x_1 \uparrow \overline{x_2} ) = \overline{x_1 \overline{x_2}} = \overline{x_1 (\overline{x_1} + \overline{x_2})} = x_1 \uparrow (\overline{x_1} + \overline{x_2}) = x_1 \uparrow (x_1 \uparrow x_2)

Can anyone please explain what exactly went on in that step? How did they go from the second equation to the third, and then the fourth? I understand the first and final steps, but that's it.

Any help would be greatly appreciated!

To get the third equation from the second

\overline{x_1 \overline{x_2}} = \overline{x_1 (\overline{x_1} + \overline{x_2})}

it was used that x_1 \overline{x_1}=0

The fourth equation came from the third

x_1 \uparrow (\overline{x_1} + \overline{x_2}) = x_1 \uparrow (x_1 \uparrow x_2)

by using Morgan's rule

\overline{x_1} + \overline{x_2}= \overline {x_1 x_2} = x_1\uparrow x_2

ehild
 
You could draw a truth table to verify but I think you'll get more mileage from an intuitive understanding of the reasoning. Here goes:

Ignoring one of the negations in the second expression we can just consider this conjunction: x_1 \overline{x_2}

If x_1 is false then the whole conjunction is false regardless of \overline{x_2}. If however x_1 is true then the truth of the whole conjunction depends on \overline{x_2} being true. I don't alter this dependence in any way if I replace \overline{x_2} with a disjunction with any false expression:

<br /> x_1 \overline{x_2}<br /> = x_1 (\bold{F} + \overline{x_2})<br />

In this context, I can actually guarantee that \overline{x_1} is false whenever \overline{x_2} is relevant to evaluation. This guarantee comes from the observation that \overline{x_2} is relevant only if x_1 is true in which case \overline{x_1} must be false. Therefore:

<br /> x_1 \overline{x_2}<br /> = x_1 (\bold{F} + \overline{x_2})<br /> = x_1 (\overline{x_1} + \overline{x_2})<br />

Hope that clears up why the second step is valid. The third step is just replacing a negated conjunction with a NAND which is valid by definition.

Lomion said:
<br /> (x_1 \uparrow \overline{x_2} )<br /> = \overline{x_1 \overline{x_2}}<br /> = \overline{x_1 (\overline{x_1} + \overline{x_2})}<br /> = x_1 \uparrow (\overline{x_1} + \overline{x_2})<br /> = x_1 \uparrow (x_1 \uparrow x_2)<br />
 
The book claims the answer is that all the magnitudes are the same because "the gravitational force on the penguin is the same". I'm having trouble understanding this. I thought the buoyant force was equal to the weight of the fluid displaced. Weight depends on mass which depends on density. Therefore, due to the differing densities the buoyant force will be different in each case? Is this incorrect?

Similar threads

  • · Replies 21 ·
Replies
21
Views
1K
  • · Replies 8 ·
Replies
8
Views
3K
Replies
1
Views
4K
  • · Replies 12 ·
Replies
12
Views
3K
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K
Replies
3
Views
3K
  • · Replies 4 ·
Replies
4
Views
5K