mardi 18 septembre 2018

Creating (if, then) from NAND

As the question states I don't see how to create a true if statement from NAND gates. Given the NAND logic gate, I can create an ersatz IF function which is also just a multiplexing function. So,

IF(a,b,c) = (c NAND (a NAND a)) NAND (b NAND a)

where a,b,c are all Boolean inputs. Example:

print(IF(0,1,0))
1
print(IF(1,1,0))
0

printing 1 if the condition fails, and 0 if the condition passes. My problem is that the NAND statement must always result in an output unlike a true if statement which will output nothing if the condition fails. So when wired, the IF function composed of NAND will still return a 0 into the circuit. Perhaps I'm missing something really obvious here.

Aucun commentaire:

Enregistrer un commentaire