Re: Stuck on CPU implementation
Posted by linuxford on
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/Stuck-on-CPU-implementation-tp4032304p4037101.html
Thank you again for the great tips.
It's taking some time and I'm really having to read and reread to make sure I understand the material, but the CPU is coming along. I have the basic control logic working correctly (good suggestion again) and will be working on the jump logic.
Great tips to take it a piece at a time, this really make it manageable. And also to print out the CPU from the book, and highlight the flows as was also suggested.
Also one needs to understand the machine language (the usage of the registers and the A and C instructions). Until I understood this, I was not able to code the CPU. So I would highly recommend for those struggling like I did, to go back to chapter 4 . You have to really understand chapter 4 and play around with doing different assembly programs. It gave me insight into how the machine should operate.
Then in Chapter 5, I had a good feel of how the assembly commands related to the registers and different A and C instructions. Of course, I had quite a few different bugs to work through as it can be a little tricky.
One other tip that one could consider is to take the CPU as it is in the book, and hardcode the control bits to either high or low initially. Then load the hdl code in the Hardware simulator without errors. From there (per the suggestion, thank you again), take a look at the compare script to see what it is testing. Then add logic to get past the first hurdle without error. Once that occurs, then add more logic to get past the second test. Etc.. After I did this, I was able to find bugs more quickly, and things started going smoother.