Designing a 2-bit full adder using nothing but NAND gates?

  • Thread starter Thread starter Crushforce
  • Start date Start date
  • Tags Tags
    Adder Designing
Click For Summary
The discussion focuses on designing a 2-bit full adder using only NAND gates, with participants exploring ways to minimize the number of gates used. Initial designs included errors in carry logic, prompting suggestions to utilize Karnaugh maps for optimizing logical expressions. A proposed solution involves constructing 3-input EXOR and MAJORITY gates from 2-input NAND gates, which can effectively create a full adder with fewer gates. One participant claims to have achieved a design using only 18 NAND gates, while another notes that a carry input is necessary for a complete 2-bit adder. The conversation emphasizes the importance of adhering to the constraints of using only NAND gates and the potential for further optimization.
Crushforce
Messages
4
Reaction score
0
Greetings,

I just wanted to post a 2-bit full adder I have been working on and which I think is my final design. I wanted to ask if there was any way that I could make it with less logic gates?
6pZAgvY.jpg


Any advice is appreciated!
 

Attachments

  • 6pZAgvY.jpg
    6pZAgvY.jpg
    30.2 KB · Views: 9,424
Engineering news on Phys.org
I don't see how. Check your Cout, however. If b1 is zero, your carry is always on.
 
  • Like
Likes Crushforce
Does it do addition? Is that what you mean by 'adder'?
 
2sa9M.png
 

Attachments

  • 2sa9M.png
    2sa9M.png
    5 KB · Views: 4,245
mfb said:
I don't see how. Check your Cout, however. If b1 is zero, your carry is always on.
Yeah I just realized that, how about this?
4lhASK6.jpg
Svein said:
While that is a 2-bit adder it is designed with gates other than NAND. Granted I could simply replace each gate with the NAND equivalent, I kinda want to make this with the least amount of gates possible. Which is why I have come to this forum to see if I can get this simplified as much as possible.
 

Attachments

  • 4lhASK6.jpg
    4lhASK6.jpg
    26 KB · Views: 3,207
Crushforce said:
While that is a 2-bit adder it is designed with gates other than NAND. Granted I could simply replace each gate with the NAND equivalent, I kinda want to make this with the least amount of gates possible. Which is why I have come to this forum to see if I can get this simplified as much as possible.
Are you familiar with Karnaugh diagrams? ( https://en.wikipedia.org/wiki/Karnaugh_map )
 
Slight update there should be a not gate where it says "carry-out"
Svein said:
Are you familiar with Karnaugh diagrams? ( https://en.wikipedia.org/wiki/Karnaugh_map )
Somewhat... but not entirely. I've seen them online but I have no formal experience other than reading them.
 
Crushforce said:
Somewhat... but not entirely. I've seen them online but I have no formal experience other than reading them.
I asked because a Karnaugh map is used for minimizing logical expressions with respect to gates.
Anyhow - check out https://en.wikipedia.org/wiki/Adder_(electronics) .
 
  • Like
Likes donpacino
I think the main point was to use only NAND gates since they can perform the function of any gate...
 
  • #10
jerromyjon said:
I think the main point was to use only NAND gates since they can perform the function of any gate...
Yes, You use the kmap to get the minimum logical expression, you then convert them to nand gates. You can also use the kmap and OLNY find nand gate connections
 
  • Like
Likes jerromyjon
  • #11
donpacino said:
You can also use the kmap and OLNY find nand gate connections
Sorry, I skimmed and missed that point. And thank you that saves some brain strain!
 
  • #12
jerromyjon said:
Sorry, I skimmed and missed that point. And thank you that saves some brain strain!
Happens to the best of us

Crushforce said:
Yeah I just realized that, how about this?

A good way to organize this in the future, make a block consisting of 2 inputs, 1 carry in bit, 1 output, and 1 carry out.

This will then scale to any number of bits. you just attach the carry out from one to the carry in from another. Then if you want to optimize, remove the carry in section from your first bit (although in a real system you might need it).
 
  • #13
Crushforce said:
I wanted to ask if there was any way that I could make it with less logic gates?
Your design is for a 1 bit half adder followed by a 1 bit full adder.
A two bit adder needs a carry input to make it a “full” adder.
Your solution, 4 inputs; in decimal, 3+3 = 6; which needs three outputs.
A full adder, 5 inputs; in decimal, 1+3+3 = 7; which also needs three outputs.

We need to know the rules of the challenge, what is the target technology?
Is there a carry input to the first stage?
Is the design restricted to using NAND gates only?
Can gates with three or more inputs be used?
 
  • #14
Baluncore said:
Your design is for a 1 bit half adder followed by a 1 bit full adder.
A two bit adder needs a carry input to make it a “full” adder.
Your solution, 4 inputs; in decimal, 3+3 = 6; which needs three outputs.
A full adder, 5 inputs; in decimal, 1+3+3 = 7; which also needs three outputs.

We need to know the rules of the challenge, what is the target technology?
Is there a carry input to the first stage?
Is the design restricted to using NAND gates only?
Can gates with three or more inputs be used?

1) We need to know the rules of the challenge, what is the target technology?
-There is no target tech, simply creating it using 7400 integrated circuits on a bread board.
2) Is there a carry input to the first stage?
-I'll get back to you on this.
3)Is the design restricted to using NAND gates only?
-Yes
4)Can gates with three or more inputs be used?
-No

Sorry I cannot reply to everyone, I've gotten a bit busy. I am still reading what people have to say though.
 
  • #15
When only NAND gates with two inputs are used, the fundamental 3-input EXOR gates and 3-input MAJority gates can be constructed. Each pair of those 3-input gates makes a one bit slice of full adder with ripple carry, in and out.

A two bit full adder can be made using 4 of those constructed 3-input gates.
A total of 28 primitive 2-input NAND gates are needed.
That can be reduced to 26 since one NAND gate is duplicated between the EXOR and MAJ gates.

The 74x00 chip is a Quad 2-input NAND gate. There is an alternative quad 2-input NAND that has open-collector outputs, which can be used for negative-logic wired-OR, the 74x01. It would reduce the total gate count, which is why it was quickly introduced, immediately after the 74x00.

There is a trick that can generate carry from the three input EXOR gate without need for the MAJ gate. Here is my two bit full adder, with carry in and out, that seems to work, but needs only 18 primitive NAND gates.
Code:
c1       ' carry input, bit value 1
a1, b1   ' data inputs, bit value 1
a2, b2   ' data inputs, bit value 2
c2        ' internal carry, bit value 2
s1, s2, s4  ' sum output terms, s4 is carry out
t11 = NAND(  a1,  b1 )
t12 = NAND( t11,  b1 )
t13 = NAND(  a1, t11 )
t14 = NAND( t12, t13 )
t15 = NAND(  c1, t14 )
t16 = NAND( t14, t15 )
t17 = NAND(  c1, t15 )
s1  = NAND( t16, t17 )     ' sum, bit value 1
c2  = NAND( t11, t15 )     ' internal carry
           
t21 = NAND(  a2,  b2 )
t22 = NAND( t21,  b2 )
t23 = NAND(  a2, t21 )
t24 = NAND( t22, t23 )
t25 = NAND(  c2, t24 )
t26 = NAND( t24, t25 )
t27 = NAND(  c2, t25 )
s2  = NAND( t26, t27 )     ' sum, bit value 2
s4  = NAND( t21, t25 )     ' sum or carry out, bit value 4
 
Last edited:
  • Like
Likes mfb
  • #16
@Crushforce, I think you just need one more NAND in the diagram from post 5 to invert the carry from bit 0, so you'll need 14 gates total for your 2-bit adder. But this is not a full 2-bit adder because it doesn't have a carry in, your bit 0 is a half adder, so you can't chain them to make an arbitrary length adder. That's ok though if you only need two bits and want to minimize the number of gates used.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 6 ·
Replies
6
Views
7K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
12
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 6 ·
Replies
6
Views
19K
  • · Replies 16 ·
Replies
16
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K