J Alan
J Alan

Reputation: 77

Build xy+xz+yz using NAND port

for an homework I have to write xy+xz+yz using only NANDS port. I will use the notation NAND(x,y) - or other types of bracket to make things clearer -, below my attempt and then an explanation for every step. I'd like to know if i'm doing this right and if there are better ways to do it.

My Solution

NAND[NAND(NAND(NAND(x,y),NAND(x,z)),NAND(NAND(x,y),NAND(x,z))),NAND(NAND(NAND(y,z),NAND(y,z)),NAND(NAND(y,z),NAND(y,z))))]`

I know this looks really impossible to read and keep track of. I'm sorry, didn't know how to make this more beautiful. Hope my explanation will clarify things.

I divided xy+xz+yz in two groups: xy+xz and yz

First Group:

xy+xz = NAND(NAND(x,y),NAND(xz)) = NOT[NOT(xy)*NOT(xz)] = xy+xz

Second Group:

yz = NAND(NAND(y,z),NAND(y,z)) = NOT(NOT(yz)*NOT(yz)) = yz (since yz+yz = yz)

Now I have to combine the first group with the second, for readibility I'll call the first group (in NAND as g1) and the second g2;

g1+g2= NAND[NAND(g1,g1),NAND(g2,g2)] = NOT[NOT(g1)*NOT(g2)] = g1+g2

So at the end:

xy+xz+yz= NAND[NAND(NAND(NAND(x,y),NAND(x,z)),NAND(NAND(x,y),NAND(x,z))),NAND(NAND(NAND(y,z),NAND(y,z)),NAND(NAND(y,z),NAND(y,z))))]

Is my reasoning right? There's a more easy way?

Thanks a lot guys

Upvotes: 1

Views: 926

Answers (1)

MFisherKDX
MFisherKDX

Reputation: 2866

Your answer is correct (although you have some missing punctuation -- a couple commas and a parenthesis). You can confirm by generating a truth table of all possible outputs as so. I wrote a few lines of C code to confirm. As for your second question to whether there is an easier way, I don't know. Maybe someone else can help out.

x   y   z   xy+xz+yz     nands
------------------------------
0   0   0      0           0
0   0   1      0           0
0   1   0      0           0
0   1   1      1           1
1   0   0      0           0
1   0   1      1           1
1   1   0      1           1
1   1   1      1           1

Upvotes: 1

Related Questions