Re: ZR and NG using 16wayOR gate?
Posted by
WBahn on
Jul 11, 2020; 5:29am
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/ZR-and-NG-using-16wayOR-gate-tp4034824p4034840.html
guynextdoor wrote
Hi, the confusion is the following:
I understand the output is 16 bit ZR, and ZR has to be equal to 1.
I don't know what you mean by this, particularly the statement that "ZR has to be equal to 1".
One of the output signals from the ALU is called "out" and that signal is a 16-bit output.
The "zr" and "ng" signals are 1-bit signals. They are either a 0 or a 1 -- only two possible values and so only a single bit is needed.
The "zr" output is a 1 if the 16-bit "out" signal is exactly "0000000000000000" and a 0 if the 16-bit "out" signal is anything else.
However when we add OR8way gate, it selects 1 input from the 8 bit input and outputs a 0, this is then converted by NOT gate to 1 for ZR.
Again, your description makes little sense. You are stating that it does something and then "outputs a 0". Well, if it always outputs a 0, then there is not point having any inputs at all.
An Or8Way gate does not select 1 input from among the 8 bits, it takes eight individual inputs and does a logical OR of all eight of them, meaning that it will output a 1 if ANY of the eight inputs is a 1 and will output a 0 only if ALL eight inputs are 0.