GithubHelp home page GithubHelp logo

hugoferreira / from-zero-to-computer-ts Goto Github PK

View Code? Open in Web Editor NEW
11.0 3.0 2.0 662 KB

8 bit CPU implemented on top of a Digital Circuit Simulator in TypeScript

TypeScript 100.00%
cpu simulator discrete-event-simulation electronics

from-zero-to-computer-ts's Introduction

From Zero to Computer in TypeScript

An 8 bit CPU implemented on top of a Digital Circuit Simulator in TypeScript. Probably the digital equivalent to building the CPU out of transistors. To see a nice GUI, run:

npm i

... followed by

npm rum start

Which will provide you a minimalistic visualizer like so:

Roadmap

  • Design a logic circuit simulator in Scala Typescript;
  • Proceeded to implement the fundamentals of electronic systems, such as logic gates, flip-flops, muxes/demuxes, etc;
  • Design on top of that a computer system, where I'll do my best effort to be non-von-Neumann (bottom line, it's von-Neumann);
    • ... 8bit registers/ALU, 8bit Memory BUS (SAP-1)
    • ... 8bit registers/ALU, 16bit Memory BUS (SAP-2)
    • ... a functional clone of a 70's era CPU (6502)
    • ... a logic-gate equivalent of a 70's era CPU (6502)
    • ... a superset of the above CPU
  • Implement a basic compiler for that computer in Scala assembler that supports macros;
  • Implement a basic operating system to run on that computer;
  • Implement an application for that OS that acts as a monitor, akin to what the Apple II had;
  • Proceed to bootstrap that assembler (i.e., make the monitor be able to assemble stuff during runtime);
  • Physically build this system;
    • ... using 74xxx-era discrete ICs (waiting for eBay);
    • ... with VGA output (easy with a FPGA or an Arduino; not so easy with 74xxx because of the IC count).

History

Some time ago I decided that, in order to truly understand a computer, I would have to design one... from scratch. Don't get me wrong; most of my professional life is kept at a very high-level of abstraction and I actively evangelize people that way. I spent the last eight years basically programming in Scala. I teach Agile. Part of my research involves mixing machine learning with software engineering. I once studied typed lambda-calculus, got my dose of theorem-proving in Coq, and proceded to teach formal methods. I understand the phenomena of computation as being decoupled from the physical media where it is performed, up to the point that I believe in hard-AI.

And yet, somehow, the low-level engineering details of electronics fascinate me...

So, around 2014, I decided to set a new hobby goal, where "no further than the 31th of December 2014, I would have done the following":

  1. Designed a logic circuit simulator in Scala
  2. Proceeded to implement the fundamentals of electronic systems, such as logic gates, flip-flops, muxes/demuxes, etc.
  3. Design on top of that a computer system, where I'll do my best effort to be non-von-Neumann (though this is not guaranteed)
  4. Implement a basic compiler for that computer in Scala
  5. Proceed to bootstrap that compiler (i.e., make the compiler able to compile itself)
  6. Implement a basic operating system to run on that computer
  7. Implement an application for that OS that acts as a real-time monitor of the code being executed
  8. Physically build this system with VGA output from common IC's

With little more than 8 months to complete the above list, it meant that each topic would have to be completed in just one month. While teaching, researching, and being the CTO of a company, without ever attempting anything similar.

I failed.

But not necessarily because I underestimated the effort required to complete it (which I did), but because I grossly underestimated my knowledge of digital systems and CPU design.

Notwithstanding, as you can see, I recently decided to tackle this project... again! No deadlines for now. Just coding and doing some breadboard magic whenever I feel to. Progress has been made.

from-zero-to-computer-ts's People

Contributors

dependabot[bot] avatar hugoferreira avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

djireland gi972

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.