Askin Geeks
Askin Geeks

Reputation: 323

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

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))

Upvotes: 4

Views: 62901

Answers (3)

stefan bachert
stefan bachert

Reputation: 9606

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))

Upvotes: 1

Frank Schmitt
Frank Schmitt

Reputation: 30775

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

Upvotes: 1

James
James

Reputation: 8586

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)

Upvotes: 2

Related Questions