In this course we take a hands-on approach to build a modern computer from Nand to Tetris, guided by the professors Noam Nisan and Shimon Shocken.
In this week we learned the concepts behind modern hardware: Boolean logic. We then built a total of 16 logic gates starting only with a nand gate, and then building more complex ones, like multiplexors and demultiplexors.
- And16.hdl
- And.hdl
- DMux4Way.hdl
- DMux8Way.hdl
- DMux.hdl
- Mux16.hdl
- Mux4Way16.hdl
- Mux8Way16.hdl
- Mux.hdl
- Not16.hdl
- Not.hdl
- Or16.hdl
- Or8Way.hdl
- Or.hdl
- Xor.hdl
In this week we've learned about boolean arithmetic, comparison, half-adders, full-adders. We used those chips to build the heart of every modern CPU - the Arithmetic Logic Unit.
In this week we learned about how computers remember information with the use of flip-flops, which then form registers and RAMS.
In this week we went up a layer in abstraction and started talking about the Hack Assembly language, a very simple kind of assembly language for a 16 bit platform. The language includes instructions to access a location in memory, load a value to a register, compare two values and jump.
This was the last week working on the hardware platform for the Hack Computer. We learned about many computer architectures (Harvard, Von Neumann) and implented our own creating a fully functional machine.
With our machine completely finished, we took a look at essential programs for modern software: Assemblers and went on to build our own implementation.
In this week we were introduced to the concept of a Virtual Machine (VM) for a high level language. We learned how abstractions like the stack and memory segments work in the assembly level. We then built a VM translator that supports simple instructions, like push, pop, add, sub, gt...
We finally complete our Virtual Machine by introducing function calls, labels, goto's and if-goto's.
After completing the virtual machine, we were introduced to a high level, object-oriented language called Jack. It's similar to Java and supports most of the features of any modern programming language. We then were asked to build a program with it, and I chose Tetris (since it's the name of the course).
In this week we looked at the first steps of compilation: tokenization and lexical analysis, and built a simple parser that produces XML code from Jack source files.
We finished the Jack Compiler by generating VM code from the Parsing Trees. The result is a compiler for a modern object-oriented language.
The final week of the course was reserved for the development of our skills in the construction of an Operating System written in Jack, providing memory allocation, arrays, I/O (Keyboard and Screen), mathematical functions (algorithms for multiplication, division and square roots) and Strings (and string-related functions).
In this week we celebrate the construction of fully functional computer, built from Nand to Tetris.