Re: ALU

Posted by cadet1620 on
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/ALU-tp2411105p2419487.html

Thomas Tetlaw wrote
Okay, I looked at 2.2.2 and saw that it read bit-wise negation, and now I have code that when n(the negate bit) is 1 and in(the 16-bit input bus) is 1(in decimal) the output is -2. Is this correct output? (I don't know if I should post my whole code as it could be a spoiler.)
  1 (decimal) = 0000 0000 0000 0001 (binary)
–2 (decimal) = 1111 1111 1111 1110 (binary)
so you're good so far.

For 2's complement numbers in general, NOT(x) = (-x)-1

--Mark