Login  Register

Re: ALU Help

Posted by cadet1620 on Sep 15, 2016; 3:11am
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/ALU-Help-tp4030242p4030266.html

These posts might be helpful.
  Getting started with ALU
  ALU Trouble in starting

To begin with ignore the 'zr' and 'ng' status outputs. Get your ALU to pass the ALU-nostat.tst.
Once your ALU is properly computing the 'out' value, then you can concentrate on 'zr' and ng'.

Think about how to break the ALU into smaller conceptual blocks. For instance, 'x', 'zx' and 'nx' are used to generate one of the inputs to the And16 and Add16. 'y', 'zy', and 'ny' similarly generate the other input to the And and Add. Function processing and output processing can also be thought about as individual blocks.


For 'zr' think about what the bits need to be for a 16-bit number to be 0 and how you might detect that. It might be easier to to think about how you can detect that a number is not 0.

For 'ng', what nakes a 2's-complement number negative?

--Mark