Saturday, May 30, 2015
Nand to Tetris
After another hiatus, I've finished the six week Nand to Tetris (Part I) course on Coursera.
The premise is to design and build a von Neumann computer from first principles. This has been one of the most interesting courses I've taken so far as it demystifies to a large extent the fundamental workings of a computer and the hardware-software gap. Since it is not an electrical engineering course (and besides, working with hardware would be pretty impractical for Coursera), everything is done in a Java hardware simulator that the instructors wrote.
The only primitives given in Part I are Nand and Data Flip-Flop; pretty much everything else in the "HACK" computer is built from scratch. Part I ends with writing a cross assembler for the HACK machine language in a language of one's choice (no bootstrapping required). Since the machine language is fairly simple, I wrote the assembler in a few hours in Python. It would be a good learning experience to try and rewrite it in Haskell -- maybe using Parsec.
Presumably, Part II is all about building Tetris for the HACK computer, which should be an interesting challenge.
Labels:
assembler,
hardware,
machine language,
python