Login  Register

Re: .hdl file won't load after changes are made

Posted by WBahn on Apr 29, 2020; 9:52pm
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/hdl-file-won-t-load-after-changes-are-made-tp4034502p4034512.html

One way is to put the truth table for the Nand gate in one column and the truth table for the gate you want in another column. In the case of the Not, you only have one input, so let's use 'a' as our 'in'.

a  b  Nand  Not
0  0     1      1
0  1     1      1
1  0     1      0
1  1     0      0

Notice that if we force 'b' to 'false' that this reduces to

a  b  Nand  Not
0  0     1      1
1  0     1      0

While if we force 'b' to 'true it reduces to

a  b  Nand  Not
0  1     1      1
1  1     0      0

Another option is to force 'b' to be whatever 'a' is

a  b  Nand  Not
0  0     1      1
1  1     0      0

Do any of these result in the output of the Nand being what you want the output of a Not to be?

If so, then all you have to do is wire up the part so as to impose the appropriate constraint.

Once this is done, you now have two parts in your tool box that you can use, Nand and Not.

For the And, think about the "double negative" that we are always getting chastised about in English.

Nand is short for "Not And", so what would "Not Not And" be equivalent to?

For Or, remember that you can use a Not gate to invert either or both input signals before it gets to the Nand and only to invert the signal after it comes out. So that's three places you can optionally either use or not use a Not gate, yielding eight possibilities. Try all eight and see which, if any, of them yield the same output as an Or gate.