I am building the ALU but keep running into a problem where the Not16 gate seems to fail. I have Not16(in=x, out=notx), but when I test it on the Hardware Simulator, notx is always equal to -1, regardless of what x is set equal to.
I checked and I do not have the Not16 hdl file in my project folder, which I know could be interferring with the implementation of the builtin. Does anyone have any ideas for why this test is failing?
To try and identify the problem, I actually cut everything out of my ALU program except for the Not16 gate ( Not16(in=x, out=notx);). I am testing it by reloading the file in the Hardware Simulator and then running the test file. It evaluates notx as -1 when x is 0 (as it should), but continues to output notx as -1 even when x is changed (in the test) to 17.
If you still think it would be helpful, I would happy to send you my ALU program. I know it's very unlikely that the Not16 implementation would be failing, but am not sure what else might be going on.
I discovered that when I change the output variable (i.e. Not16(in=x, out=out);), 'out' displays as the correct value. Any idea why 'out' would display correctly, but an internal variable (notx) wouldn't? It seems very strange!
This is really bizarre. Working with my ALU.hdl in an otherwise empty subdirectory (no need for the test script):
o The "eval" button is properly enabled using the complete HDL file.
o Commenting out the connections to all three outputs -- out, zr and ng -- causes the eval button to be permanently disabled.
o Commenting out one or two of the output connections does not cause the failure.
o Commenting out the connections to out and ng and leaving an internal wire disconnected from its intended input causes the failure.
o Commenting out other combinations of two outputs and leaving an internal wire disconnected from its intended input does not cause the failure.
If this is happening to you, I'd suggest checking that all chip outputs are connected to a part output and that all your internal pins/wires are connected on both ends.