Skip to content

This is a personal project which purpose is to learn computer architecture by implementing the Hack Computer.

Notifications You must be signed in to change notification settings

VitorgsRuffo/Building-The-Hack-Computer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Logo

Building the Hack Computer

This is a personal project which purpose is to learn computer architecture by implementing the Hack Computer.

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. Contact

About The Project

hack-computer

This is a personal project which purpose is to learn computer architecture by implementing the Hack Computer (Noam Nisan and Shimon Schocken. 2008. The Elements of Computing Systems: Building a Modern Computer from First Principles (History of Computing S.). The MIT Press).

The aforementioned book, a.k.a NandToTetris, aims to take the reader on a journey to build a simple but powerful 16-bit general-purpose computer. It gives you the knowledge and tools to gradually and modularly implement it from the ground up. The reader starts by building elementary logic gates, such as NOT, AND, OR, ..., and goes all the way until high-level applications, as the classic Tetris game, can be run on the computer that has been built.

I have only read the book until the 5th chapter in which the system hardware is already implemented and ready to run low-level code. Firstly, I have described the computer in a Hardware Description Language (HDL) by following the book instructions (check out computer description). Then, I have implemented the computer in Logisim, which is an educational software to simulate logic gates (check out the Logisim project). This book is awesome and presents many computer architecture fundamental concepts, I recommend it to everyone interested in computer science.

Getting Started

The computer description in HDL can be interpreted and tested by using the software suite provided by the book. But, its implementation in Logisim is a thing that I have done by myself, so let's see how you can get a local copy of that project and run it.

Prerequisites

  1. Go to this website and follow the instructions to install Logisim.

  2. Clone this repo:

    git clone https://github.com/VitorgsRuffo/Building-The-Hack-Computer.git

Usage

  1. Open Logisim and inside it open the "hack-computer.circ" file located at "/path/to/repository/Building-The-Hack-Computer/Hack Computer (Logisim)":
open
  1. Click on the Hack Computer chip:
chip
  1. Go to the Simulate option on Logisim's menu and enable clock ticks:
simulate
  1. The computer will start to run the program that is preloaded in its ROM. After the first four intructions, value 10 gets loaded at RAM's 6th address. The 2 last instructions are there to avoid that the computer runs garbage instructions stored at subsequential ROM addresses, compromising the result of the actual program.

  1. By inspecting RAM chip we can see that the value 10 has actually been loaded at RAM's 6th address.
ram

The book's 4th chapter defines the computer machine language. After understanding it you can write machine-level programs, load them into ROM chip and get the computer to run your program. For more information, check out the book.

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Contact

Vitor G. S. Ruffo - LinkedIn - [email protected]

About

This is a personal project which purpose is to learn computer architecture by implementing the Hack Computer.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published