This repository contains Verilog implementation of the Hack computer (as per the specifications from the course Nand2Tetris).
The codes are organized according to the week wise tasks of the course.
The following gates and logic blocks are designed using nand gates only:
- Not
- And
- Or
- Xor
- Multiplexor
- Demultiplexor
- Multi-bit Not
- Multi-bit And
- Multi-bit Or
- Multi-bit Multiplexor
- 4-way Multiplexor
- 8-way Multiplexor
- 4-way Demultiplexor
- 8-way Demultiplexor
- 8-input Or
The following logic blocks are designed using the blocks designed in previous week:
- Half-adder
- Full-adder
- 16-bit adder
- Incrementer
- ALU
The following sequential logic blocks are designed using the blocks designed in previous week:
- D Flip-flop
- Single bit Register
- 16-bit Register
- N-register memory (N is 8,64,512,4K,16K)
- Program Counter
In this week the actual CPU takes shape. I went for a separate controller and datapath approach. Here are the components
- CPU_Datapath
- CPU_FSM
- CPU
Apart from the above modules, I implemented a ROM (as instruction memory) and RAM (as data memory) all of which are instantiated inside the top level entity called hack_computer
All the associated test modules are inside the folder testbenches
NOTE: As the memory modules are large, I am unable to synthesize them on the development platform that I am using. Hence I made another testbench (testbenches/CPU_test.v
) that implements a smaller memory enough to run small programs.