Andrew Gacek wrote
I was implementing Inc16 and I stumbled into some very strange behavior (bug?) from the hardware simulator. My code is attached below. What happens is that Inc16.tst fails on the very first test. But if I swap the first two tests (and update the cmp file accordingly), then all tests pass. Am I doing something wrong? I know my implementation is messy. I've since cleaned it up and it works while avoiding the bug. I'm posting this now just to see if there really is a bug or if I'm doing something explicitly wrong.
Here's my code:
CHIP Inc16 {
IN in[16];
OUT out[16];
PARTS:
One16(out=one);
Add16(a=in, b=one, out=out);
}
Yes, it's a strange simulator bug, probably related to the output-only One16 chip.
Some things I found playing around with it:
If you replace the One16() with Add16(a=false, b[0]=true, b[1..15]=false, out=one) the test passes.
If you replace the guts of the One16 chip with the above Add16 the test still fails.
If you change the test to begin
set in %B0000000000001000, // must be != 0
set in %B0000000000000000,
eval,
output;
the test will pass.
--Mark