Thanks to visit codestin.com
Credit goes to github.com

Skip to content

radavis/nand2tetris

Repository files navigation

nand2tetris

Notes and code from the book Elements of Computing Systems.

Hardware/Software Hierarchy

Construct a complete computer system: hardware + software.

Hardware: Hack

  • 16-bit computer written in HDL

Software: Jack

  • 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.

Chapter Breakdown

Getting Set Up (OSX)

Extract nand2tetris.zip.

Hardware Simulator

Add to path

# 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.

Run a test

From the nand2tetris folder.

HardwareSimulator projects/01/Nand.tst

Jack Language Example

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.

Compiler

The compiler's task is broken into two stages:

  • syntax analysis via constructing a parse tree
  • code generation via processing the parse tree

Virtual Machine

  • runs intermediate language code
  • stack-based machine

Assembler

Translates assembly code into binary code.

Notes

References

Quotes

"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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published