As the title states, given a function \$f(x, y, z, w) = x.(y + z.w) + y.\bar{z}\$, what are the minimum number of NAND gates you need to implement f?
My first attempt at a solution was to draw a kmap to see if there was a further simplified boolean expression (technically I first drew the truth table to find the minterms). From the kmap, I found \$f(x, y, z, w) = x.y + y.\bar{z} + x.z.w\$
I know that you can implement AND using two NAND gates, OR using 3 NAND gates, and NOT using a single NAND gate. Thus, I figured, "well we have 1 NOT, 2 ORs, 3 ANDs, so we'd need \$1 + (2*3) + (3*2) = 13\$ NAND gates". But the correct answer is supposed to be 7.
- What's wrong/insufficient with my reasoning?
- How on earth do you implement the function using just 7 NANDs?