This project is about building Hack on real hardware as proposed in chapter 13 of the course nand2tetris using only FOSS, free and open source hard- and software.
Go to file
Michael Schröder b16bfcfd43 changed python tools to python3.11 2023-08-04 16:44:31 +02:00
00_Requirement added v2.0 2023-01-11 23:04:57 +01:00
01_Boolean_Logic added v2.0 2023-01-11 23:04:57 +01:00
02_Boolean_Arithmetic added v2.0 2023-01-11 23:04:57 +01:00
03_Sequential_Logic corrected typo in BitShift9R 2023-04-15 08:29:38 +02:00
04_Machine_Language changed python tools to python3.11 2023-08-04 16:44:31 +02:00
05_Computer_Architecture corrected leds.png and mult.png 2023-08-04 09:42:15 +02:00
06_IO_Devices changed python tools to python3.11 2023-08-04 16:44:31 +02:00
07_Operating_System changed python tools to python3.11 2023-08-04 16:44:31 +02:00
08_3D_Printer added v2.0 2023-01-11 23:04:57 +01:00
doc added v2.0 2023-01-11 23:04:57 +01:00
tools changed python tools to python3.11 2023-08-04 16:44:31 +02:00
.gitignore added v2.0 2023-01-11 23:04:57 +01:00
LICENSE added v2.0 2023-01-11 23:04:57 +01:00
Readme.md added v2.0 2023-01-11 23:04:57 +01:00
Revision.md changed python tools to python3.11 2023-08-04 16:44:31 +02:00

Readme.md

nand2tetris-FPGA (v2.0)

... Would'nt it be nice to make Hack or Jack also run on some "real platform," made from some "real stuff"? ...

---Noam Nisan and Shimon Schocken

This project is about building HACK on real hardware as proposed in Chapter 13 of the course nand2tetris using only FOSS, free and open source hard- and software.

Our final implementation of HACK will have the following specs:

  • original CPU/ALU design of HACK from nand2tetris

  • implemented on iCE40HX1K-EVB from Olimex

  • clocked at 25 MHz

  • RAM 3840 x 16 bit (R0-R15/static/stack/heap)

  • SRAM 64K x 16 bit (instruction memory)

  • bootloader boots HACK-code from SPI-Flash into SRAM

  • 2.8 inch color LCD with 320x240 pixel

  • touch-panel support

  • powerfull enough to run Tetris!


Roadmap

In every project folder you find a file Readme.md containing specifications and implementation details.

... This is your last chance. After this, there is no turning back. You take the blue pill — the story ends, you wake up in your bed and believe whatever you want to believe. You take the red pill — you stay in Wonderland and I show you how deep the rabbit-hole goes. ...

---Morpheus

00 Requirement

Get the hardware and install the tools.

01 Boolean Logic

Start with a simple Nand gate and build the logic chips: Not, Buffer, And, Or, Xor, Mux, DMux, and theire multibit versions Not16, Buffer16, And16, Or16, Mux16, Or8Way, Mux4Way16, Mux8Way16, DMux4Way and DMux8Way.

02 Boolean Arithmetic

Proceed and build HalfAdder, FullAdder, Add16, Inc16 and the ALU.

03 Sequential Logic

Build sequential chips Bit , Register and PC, that make use of the data flip flop (DFF) to store the state. DFF is considered primitive, so it's not necessary to implement it. The memory chips RAM512 and RAM3840 are based on the primitive RAM256, which uses block ram structures integrated in iCE40HX1K. BitShift9R and BitShift8L are new chips not explained in the original nand2tetris course. They serve to connect HACK to different IO-Devices, which are connected using a serial protocol, where data is transmitted bitwise.

04 Machine Language

Write two little machine language programms to run on HACK. The first programm leds.asm will test I/O capability of HACK. Every time the user presses the buttons BUT1/2 on the iCE40HX1K-EVB board the LEDs will change accordingly. With the second programm mult.asm we will calculate the product of two numbers to test the arithmetic capabilities of the CPU/ALU.

05 Computer Architecture

Build HACK computer system consisting of the chips CPU, Memory, Clock25_Reset20, RAM and ROM. ROM uses a block ram structure (256 words) of iCE40HX1K and can be considered primitive. It can be preloaded with the instructions of the assembler programs implemented in 04_Machine_Language .

06 IO Devices

We will expand HACK computer platform by adding chips to handle communication to I/O devices, which we connect to HACK.

  • UART communicates with 115200 baud 8N1 to computer
  • SPI reads the 2MByte flash memory on iCE40HX1K-EVB
  • SRAM writes data to the external SRAM chip
  • GO enables booting JACK-OS software
  • LCD connects a little color screen with 320x240 pixel
  • RTP connects the resistive touch panel

07 Operating System

Implement the operating system JACK-OS, written in the high level language JACK consisting of the classes GPIO.jack, UART.jack, Memory.jack, Math.jack, Array.jack, String.jack, Screen.jack, Output.jack, Touch.jack and Sys.jack

Finally you can compile and run Tetris!

08 3D Printer

We provide construction files to print a little case for your HACK computer with a 3D-Printer. The case is designed with FOSS software blender.

Credits

  • Noam Nisan and Shimon Schocken, "The Elements of Computing Systems", MIT Press

  • Noam Nisan and Shimon Schocken: Visit nand2tetris and learn to build a modern general-purpose computer system from ground up.

  • Olimex Ltd: Buy your hardware from the Company with highest number of registered OSHW projects :)

  • Wolf Clifford: The master of open source FPGA with iCE40 and Project IceStorm

  • Jesús Arroyo Torrens, Juan González (Obijuan): Open source ecosystem for open FPGA boards APIO

  • Juan González-Gomez (Obijuan): Lern verilog with open-fpga-verilog-tutorial, best tutorial!

  • Icons made by Those Icons from www.flaticon.com


For questions or comments write an email to mi.schroeder@netcologne.de