How to convert a boolean expression from AND and OR to only NAND

60,821

Solution 1

This has a breakdown of how to build other logic gates via NAND. Should be a straightforward application:

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

E.g. C = A AND B is equivalent to

C = NOT (A NAND B)  
or
C' = (A NAND B)
C = C' NAND C'   (effectively NOT'ing A NAND B)

Solution 2

For a good in-depth discussion of how to build boolean expressions with only one kind of function/logic gate (in this case, NOR, but changing it to NAND is straightforward), have a look at

The Pragmatic Programmer Magazine 2012-03: The NOR Machine

Solution 3

c * b * a + /c * b * /a

only NAND

/( /(c * b * a)  *  /( /(c * c) * b * /(a * a) ) )

NAND( NAND(c,b,a) , NAND( NAND(c,c), b, NAND (a, a)))

So you need, two 3 gate NAND, three 2 gate NAND.

NOT (A) = NAND (A,A)

A OR B = NAND (NAND (A, A), NAND(B, B))

Share:
60,821
Askin Geeks
Author by

Askin Geeks

Updated on July 09, 2022

Comments

  • Askin Geeks
    Askin Geeks almost 2 years

    I have a task that's driving me crazy because i have no clue where to start.

    The task is the following: Convert the given boolean expression so that it only contains NAND operations and no negations.

    c * b * a + /c * b * /a
    

    I assume that it's possible, :D but i have no idea how to do it and spent several hours just for spinning in circles.

    Could someone please point me in the right direction?

    Best regards,
    askin

    Update:

    thanks to the answers I think I found the solution:

    c*b*a = /(/(c*b*a)*/(c*b*a)) = A; 
    
    /c*b*/a = /(/(/(a*a)*b*/(c*c))*/(/(a*a)*b*/(c*c))) = B; 
    
    c*b*a+/c*b*/a = A + B = /(/(A*A)*/(B*B))