How Is XOR Implemented Using Only NAND Gates?

Click For Summary

Homework Help Overview

The discussion revolves around implementing the XOR function using only 2-input NAND gates. Participants are examining the transformation of logical expressions and the application of Boolean algebra principles to achieve this implementation.

Discussion Character

  • Conceptual clarification, Mathematical reasoning

Approaches and Questions Raised

  • Participants are exploring the steps involved in manipulating the expression for XOR using NAND gates. They are questioning how specific transformations between equations are justified and what laws of Boolean algebra apply.

Discussion Status

Several participants have provided insights into the reasoning behind the transformations, referencing laws such as DeMorgan's Law and the properties of conjunctions and disjunctions. There is an ongoing exploration of these concepts, with no explicit consensus reached yet.

Contextual Notes

Some participants suggest using truth tables to verify the equivalence of expressions, while others emphasize understanding the reasoning behind the transformations rather than just the mechanics. There is a focus on the validity of steps taken in the algebraic manipulation.

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:

[tex]f = x_1 \overline{x_2} + \overline{x_1}x_2[/tex]

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

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

[tex](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)[/tex]

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:
[tex](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)[/tex]

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

[tex]\overline{x_1 \overline{x_2}} = \overline{x_1 (\overline{x_1} + \overline{x_2})}[/tex]

it was used that [tex]x_1 \overline{x_1}=0[/tex]

The fourth equation came from the third

[tex]x_1 \uparrow (\overline{x_1} + \overline{x_2}) = x_1 \uparrow (x_1 \uparrow x_2)[/tex]

by using Morgan's rule

[tex]\overline{x_1} + \overline{x_2}= \overline {x_1 x_2} = x_1\uparrow x_2[/tex]

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: [tex]x_1 \overline{x_2}[/tex]

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

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

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

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

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:
[tex] (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)[/tex]
 

Similar threads

  • · Replies 21 ·
Replies
21
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
Replies
1
Views
5K
  • · 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
3K
Replies
3
Views
3K
  • · Replies 3 ·
Replies
3
Views
28K