Re: Problems understanding the material
Posted by
ivant on
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/Problems-understanding-the-material-tp4031969p4031971.html
It takes a little time to wrap your mind around hardware. The "if-else" for example works quite differently than from software. Instead of selecting which part to execute (the software way), you generally compute both parts and select which answer to use depending on the condition. One way to do this is to use a multiplexer.
Demultiplexers on the other hand are useful to "route" the value to one of several possible outputs. This is useful in chips like RAM, where you want to select exactly one of the cells to be written to.
For the ALU you just need to go from the inputs. For example, the first function line in figure 2.5 reads "if zx then x = 0". So you need to select (think MUX) either x or 0. You can use constants like true and false to obtain the 1 or 0 that you need. From then on, you treat the output wire of this "if" as the current value of x. Next you need to negate it if nx is 1 or to leave it unchanged otherwise. Sounds like another small "if-else".
The same goes for y. Then you get these two values and feed them in the next "if-else" and you go on like that. Focus on the output out first. When you have it working, you can think how to compute zr and ng.
As for tool I can recommend
logisim. It's quite good to visually see what's going on.
You can also try the book
Code by Charles Petzold. It explains a lot of the same concepts, so you may find it more understandable. In any case, don't give up!