From the time we are born,
we are free…
It doesn’t matter how strong
those who would deny us that freedom are…
Flaming water… Frozen earth… I don’t care what it is!
The one who sees them
will be the freest person in the world!
I’d willingly give my life for that!
It doesn’t matter how terrifying the world is.
It doesn’t matter how cruel the world is!
These words and the whole scene are quite beautiful.
So the Nand2Tetris project was a self-study course where you build a complete general purpose computer from the gate-level all the way up the software hierarchy that powers it. It is divided into 12 modules each with a hands-on project. In the first half, the hardware part, you build the computer’s hardware platform (adders, muxes, registers, RAM, ALU, CPU, etc.) and in the software portion you write the assembler, virtual machine translator, compiler, and basic operating system. The purpose of the course is to develop an understanding of how computers work “in the marrow of your bones.” Completing it has been a proud accomplishment and one of the best projects I’ve ever worked on.
The first few chapters were pretty easy, but things became much more complicated afterwards, especially in the software portion. I first downloaded the materials at the end of last winter break and finished it during this winter break, so it took me a year to finish it (mostly because I was pre-occupied with classwork and I was working full-time during the summer). The software part was definitely quite challenging, especially when the compiler was being written. That module alone took me almost 3000 lines of code in Java. It was probably the first time I wrote that much code for a specific project on my own. One of the things that became difficult while writing it was scrolling back and forth between code when debugging. The most challenging part of working on the VM Translator and OS was debugging VM code or bytecode. This was difficult because the way you debug that kind of code is different from what programmers might be used to in Java or some other high level language (you can’t do print statements and see what your output is easily). With the bytecode it’s not as easy. And it’s not always immediately obvious which part of the code you’re in since all of the instructions look the same. And plus, the bytecode you’re debugging is a bunch of primitive instructions executing a higher level algorithm so it gets frustrating trying to keep track of exactly what is going on, what you’re looking at, and whether it all makes sense. My main issue with that part was keeping myself oriented. Fortunately, they provided a very good tool for us and I really got a chance to learn how to use breakpoints as a debugging technique.
The computer that was built is a very primitive one. It is a 16-bit computer (the largest number the CPU can add are 16-bits wide), has 64K RAM, and has a screen resolution of 256 x 512 pixels. So it has very limited resources. Yet, it is still a general purpose computer and can amazingly still do a lot. You can write lots of useful programs on it using the Java-like language, Jack. It’s powerful enough to run games like Pong and Tetris written in Jack. Surprisingly, using a limited resource computer is actually really great as a learning tool. It made me more conscious about writing efficient code in order to reduce the number of operations as much as possible. I also tried to use variables sparingly so as not to waste memory.
On the hardware side, I think I learned more from this project than I did in my Fundamentals of Computer Systems course. There were some things in that class that were not covered in this project, but for the things that were, I learned it much better in Nand2Tetris. In fact, when I started on the first few chapters of Nand2Tetris, I felt I had a huge leg up when I later took that Fundamentals class that semester.
One of the creator of the courses, Shimon Schocken, has occasionally called this a “Nand2Tetris pilgrimmage” and I think it is a really great phrase for it. It’s certainly a worthwhile adventure for any serious student (not just academic students) of CS and CE. You emerge from it with such a deep and connected understanding of computers. And you come out of it really proud that you have accomplished a very challenging technical project.
In response to “Hell” on an exam, I counter first saying that he incorrectly assumes that souls have mass. Second, if Hell were to expand, it would require energy. Assuming the energy supplied comes from within Hell and that some of it is wasted in the process, it is exothermic. Lastly, if souls are burned in Hell and the number of souls is increasing exponentially, then more souls are being burned which means more energy is being released. So yes, I can agree that Hell is exothermic but for slightly different reasons.