3 input XOR gate using NAND gate only ( Logic )

Click For Summary
The discussion focuses on constructing a 3-input XOR gate using only NAND gates, building on the established 2-input XOR configuration. The circuit requires eight NAND gates to achieve the desired output, which is expressed as Y = (A'B'C) + (A'BC') + (AB'C') + (A'B'C'). Participants explore how to derive the output at each NAND gate and clarify the logic behind active high and active low interpretations of NAND gates. The conversation emphasizes the flexibility of NAND gates to create various logical functions, including AND, OR, and NOT, by manipulating the interpretation of input and output voltages. Overall, the thread highlights the complexity and versatility of digital logic design using NAND gates.
i_madini
Messages
4
Reaction score
0
We can use NAND gate only to get ( XOR gate ) of 2 input ( A and B ) :

By using (4) NAND gate :

The output of 1'st NAND : (AB)'

The output of 2'nd NAND : ((AB)'.A)' = (A'B)

The output of 3'rd NAND : ((AB)'.B)' = (AB')

The output of the hole circuit will be: ((A'B).(AB'))' = AB' + A'B ( Which is an XOR gate )

The truth table of ( XOR gate ) is:

00 0
01 1 A'B
10 1 AB'
11 0

What about in case of 3 input ( A, B, and C ) ?!

I Know the output should be by using (8) NAND gates :

000
001 (A'B'C)
010 (A'BC')
011
100 (AB'C')
101
110
111 (A'B'C')

Y= (A'B'C)+(A'BC')+(AB'C')+ (A'B'C')

But how to drive it ? I mean the output at each NAND ?


Any HELP !
 
Physics news on Phys.org
i_madini said:
Y= (A'B'C)+(A'BC')+(AB'C')+ (A'B'C')

But how to drive it ? I mean the output at each NAND ?

I am going to tell you a secret that I haven't seen formally taught in textbooks. I'd like to hear if anyone knows differently.

It's about understanding active high and active low logic.

A NAND gate, when drawn, looks like an AND with a bubble on the output. This is because it takes two active high inputs (no bubbles), ANDs them and generates an active low output (a bubble). Active high means 1s are high voltage and 0s are low voltage. Active low means 1s are low voltage and 0s are high voltage. You can see this from the truth table, which works on voltages:

A B NAND
0 0 1 (0 active low)
0 1 1 (0 active low)
1 0 1 (0 active low)
1 1 0 (1 active high)

See how it's just a straight AND gate if you interpret the output voltages as active low logic? So when you draw the NAND circuit symbol, you can interpret it as performing AND with active high inputs and active low outputs.

We can also apply DeMorgan's Law to a NAND gate. !(A AND B) = !A OR !B

The meaning of this: take two active low inputs OR together to make an active high output.

We're still using the NAND gate to implement this function so we still have the same truth table but this time we are going to interpret the high and low voltages differently:


A B NAND
0 (1 active low) 0 (1 active low) 1 (active high)
0 (1 active low ) 1 (0 active low) 1 (active high)
1 (0 active low) 0 (1 active low) 1 (active high)
1 (0 active low) 1 (0 active low) 0 (active high)

Just by interpretting the inputs to the NAND gate as active low and the output as active high, using the *same* gate we have found an OR function.


The last missing ingredient is an inverter, which is simply tying both inputs together (check with a truth table).


So now with a NAND gate we can make inverters, OR, AND if we interpret the voltage levels appropriately (active high or active low) and this can be summarized with graphical circuit symbols.

AND:

Draw an AND gate with no bubbles on the input and a bubble on the output (ie the usual NAND symbol). The interpretation is active high inputs are ANDed together to form an active low output.

OR:

Draw an OR gate with bubbles on both inputs and no bubble on the output. The interpretation is two active low inputs are ORed together to form an active high output.

NOT:

Draw like a regular inverter. The inverter is the same in active low or active high logic; you can draw the bubbles on either side of the buffer symbol.


It may sound confusing at first but an actual application will show how easy it is. The implementation strategy being used is called pushing bubbles around the circuit.

Your equation:


Y= (A'B'C)+(A'BC')+(AB'C')+ (A'B'C')

We are ORing together four things. You only have two input NAND gates so you need to use two gates to OR two things and then another gate to OR the results together. A nand OR gate looks like an OR gate with bubbles on the input and no bubbles on the output. I have attached a really bad drawing of four terms A,B,C,D being ORed together using NAND gates.

The top drawing, I have not connected the last OR gate because there is an active high / active low incompatibility. The outputs from the first OR gate are active high but the inputs to the last OR gate are active low. So what I did was push the bubbles through the first OR gates to make a NAND gate with a bubble on the output. Now I can connect that last OR gate because the logic levels are correct. Changing the OR to NAND is allowed because the same NAND gate does both, logically; in the process of changing the symbol I have changed the inputs to active high logic. But I need the inputs to be active low to implement the correct function. So I have put bars over them to indicate they are active low. The bars can indicate /A active high or A active low.

See if you can proceed from there and fill in the rest for A,B,C,D.
 

Attachments

  • bubbles.png
    bubbles.png
    2.3 KB · Views: 2,889
Last edited:
Thank you, Sir.

I really appreciate it ..

And that little secret is so helpful to switch between gates ..

But what I'm interesting in is to find the output at every single NAND gate ..

Starting from X1, X2, X3, X4, X5, X6, X7, and Y.

These X's is shown in attachment.

I'm stuck at,

X5: (( AB' + A'B ) . ( C ) )' = ?


Again, Thanks a lot.
 

Attachments

  • IMAG0229.jpg
    IMAG0229.jpg
    9.7 KB · Views: 3,082
I thought you were trying to implement a three input XOR gate from your truth function using NANDs? Y= (A'B'C)+(A'BC')+(AB'C')+ (A'B'C')

Or are you trying to analyze your circuit? With your circuit I can see the same gates are repeated from X5 on. So if up to X4 is XOR, then the whole thing is XORing three inputs. I'd slice the circuit after X4, show what the output to X4 is, see that X5 on is the same function and put them together.

I see you have a NAND implementation for XOR of two inputs...you can always use three XOR gates to implement XOR for three inputs but the implementation won't necessarily be optimal.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 4 ·
Replies
4
Views
5K
Replies
9
Views
3K
  • · Replies 1 ·
Replies
1
Views
7K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 2 ·
Replies
2
Views
26K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 14 ·
Replies
14
Views
24K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K