I am using the HDL from the Nand2Tetris (Elements of Computing Systems) book, and whilst looking at example gate implementations online I regularly notice something along the lines of;
CHIP ExampleZeroer {
IN a[16], sel;
OUT out[16];
PARTS:
Mux16(a=a, b=false, sel=sel, out=out);
}
In the above example false
is never declared anywhere. I see similar examples using the apparent keyword true
also. If false
is some kind of pre-declared keyword or short-hand then where does the value come from, or what is it short-hand for?
I have implemented all of my gates without using this shorthand but it bothers me that I can't understand where the value could come from.
Yes, you can use false and true as inputs. In the context of a chip, they are equivalent to connecting the pin to the power source or the ground.