Notes and code from the book Elements of Computing Systems.
Construct a complete computer system: hardware + software.
- 16-bit computer written in HDL
- Assembler
- Virtual Machine
- High-Level Language
- Compiler
- OS
The software components can be written in any modern programming language.
It is possible to build all of these components independently via the process of abstraction: ignoring the details of how a component functions, and utilizing the component for what it does.
Extract nand2tetris.zip.
# in your .bashrc or .zshrc file
export PATH=/usr/local/bin:$PATH
# from the command line
ln -s ~/code/nand2tetris/tools/HardwareSimulator.sh /usr/local/bin/HardwareSimulator
chmod +x /usr/local/bin/HardwareSimulator
Perform this sequence of commands for development tools in the tools folder, as necessary.
From the nand2tetris folder.
HardwareSimulator projects/01/Nand.tst
class Main {
function void main() {
do Output.printString("Hello World");
do Output.println();
return;
}
}
Compilation is the process of parsing text and converting it into a low-level language that a computer understands (machine code). This process is broken up into several layers of abstraction and typically involves three translators: a compiler, a vm, and an assembler.
The compiler's task is broken into two stages:
- syntax analysis via constructing a parse tree
- code generation via processing the parse tree
- runs intermediate language code
- stack-based machine
Translates assembly code into binary code.
- Chapter 1 - Boolean Logic
- Chapter 2 - Boolean Arithmetic
- Chapter 3 - Sequential Logic
- Chapter 4 - Machine Lanugage
"Mistakes are the portals of discovery." - James Joyce
"The only kind of learning which significantly influences behavior is self-discovered or self-appropriated--truth that has been assimilated in experience." - Carl Rogers