[HN Gopher] Show HN: I made a programmable computer from NAND gates
___________________________________________________________________
Show HN: I made a programmable computer from NAND gates
I am proud to present my solo hobby project NAND. This year-long
undertaking follows the completed Nand to Tetris course, but ported
to the web with its own runtime, user interface, and IDE. Using the
"Load example program" selector, you can try out some programs I
wrote on NAND's emulated hardware such as 2048, a genetic
algorithm, and a manual stack overflow to corrupt the screen.
Check out NAND at https://nand.arhan.sh Additionally, I've
authored an extensive writeup about the project. Read about it on
the GitHub repository's readme.
Author : ArchAndStarch
Score : 187 points
Date : 2024-04-25 16:08 UTC (6 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| rpmw wrote:
| Wow that is a great side-project, and a great README to boot.
| I've been meaning on working through Nand to Tetris after playing
| around some with Ben Eater's 6502 Computer (https://eater.net/)
| laweijfmvo wrote:
| Would it be at all feasible to build a physical NAND-to-tetris
| computer? Or is it purely a virtual exercise?
| dailykoder wrote:
| Probably doable, but takes a lot of dedication. Especially
| debugging such physical endeavors is crazy
| ArchAndStarch wrote:
| A few nand2tetris fanatics have actually done this! And by a
| few, I mean quite a lot of people. Here's one such hardware
| project of nand2tetris: https://gitlab.com/x653/nand2tetris-
| fpga/
|
| But you can Google "nand2tetris fpga" for more.
| moefh wrote:
| There's this one that goes one step beyond that, it's built
| out of 40,000 discrete transistors:
| https://www.youtube.com/watch?v=z71h9XZbAWY
|
| EDIT: there's more information here:
| https://www.megaprocessor.com/
| dhosek wrote:
| I kind of want something midway between the FPGA version
| and the all-transistor version, something that just uses
| 7400 series chips (or, presumably there's a 26-pin
| equivalent with 6 gates instead of three). Heck, I think
| even something that goes ahead and uses the full panoply of
| basic logic chips available could be kind of cool to see.
| moefh wrote:
| I think Ben Eater's 8-bit computer is closer to what you
| want: https://eater.net/8bit/
|
| It's been a few years since I studied it (I even built
| the clock module, registers and the ALU), but from what I
| remember the biggest departing point from what you want
| is that the control logic (from instruction decoding to
| deciding which sub-units to activate for each
| instruction) is done with an EEPROM instead of individual
| logic gates, as described here:
| https://eater.net/8bit/control
| fire_ball wrote:
| this is fantastic! great work...
| kristopolous wrote:
| I could make a few college classes out of this. Well done
| material.
| bramhaag wrote:
| Turing Complete[0] is a fun game similar to this where you create
| your own computer from NAND gates, including your own assembly
| language.
|
| [0] https://store.steampowered.com/app/1444480/Turing_Complete/
| cyanfrog wrote:
| https://www.nand2tetris.org/
| cweagans wrote:
| See also https://nandgame.com
| apienx wrote:
| Thank you. First principles FTW!
| 2OEH8eoCRo0 wrote:
| Fantastic work. NAND to Tetris helped me land my first job out of
| college.
| SilasX wrote:
| How did it help?
| 2OEH8eoCRo0 wrote:
| Resume padding and conversation starter during interviews. It
| also filled in some gaps in knowledge.
| Animats wrote:
| Seymour Cray would have loved this. Some of his computers were
| all NAND gates.
| dhosek wrote:
| The supercomputers (all?) used wirewrap rather than PCBs. I
| heard a story once about someone coming in for a demo of a
| supercomputer and Cray realized there was a bug in the hardware
| during the demo and while the potential customers were at
| lunch, he rewired the machine to fix the bug.
| Animats wrote:
| Right. Seymour Cray said that the two big problems in
| supercomputing were "the thickness of the mat" (of wires on
| the backplane) and getting rid of the heat.
|
| This is a Cray-I backplane.[1]
|
| [1] https://www.flickr.com/photos/geekmuseum/2926520634/
| gmiller123456 wrote:
| Curious, how many NAND gates are there in total?
| ArchAndStarch wrote:
| I've inspected my code closely. Every clock cycle, the NAND
| gate is used 3,234 times :)
| mikestew wrote:
| Awesome work! Bookmarked for in-depth perusal later. As a fan of
| NAND-to-Tetris, but never made it all the way through, I look
| forward to poking around in your project.
| ryeguy_24 wrote:
| This is amazing work. I wanted to build something similar
| (virtual) while I was taking the Nand2Tetris course. I'm so
| impressed that you actually did it. You must have a really good
| understanding of how computers work now.
| marai2 wrote:
| And I was just thinking about the same thing this morning,
| using SVG to model the basic components. And lo and behold
| somebody has done a magnitude more amazing job then what I was
| imagining!
| cubefox wrote:
| Cool project. It reminds me of a theoretical issue. As the
| project page says, this system is clearly Turing equivalent.
| Since it runs software, it even implements a _universal_ Turing
| machine. But the design uses only (synchronic) sequential logic
| [1] and Wikipedia seems to suggest that automata theory considers
| sequential logic only equivalent to finite state machines. Not
| Turing machines. Isn't that clearly a major bug in automata
| theory?
|
| My guess is that automata theory consideres it critically
| important that a "Turing machine" has an infinite tape, while
| intuitively it instead seems relevant that it has something like
| a tape at all, some sort of random access memory, even if it is
| finite. I think such a memory system can't be implemented with
| classical finite state machines, at least not with comparable
| time complexity for read and write, but can be realized with
| sequential logic.
|
| [1] https://en.wikipedia.org/wiki/Sequential_logic
| tomstuart wrote:
| Real-world computers are equivalent to linear bounded automata,
| not true Turing machines, because they have finite memory. This
| technicality is mostly ignored because a computer with a large
| finite memory is a decent enough approximation to a Turing
| machine for practical purposes. But, for example, the halting
| problem is decidable for linear bounded automata -- because
| there are only finitely many states, every computation must
| either halt or eventually revisit an earlier state and get
| stuck in a loop -- so in theory it's an important distinction.
| elevatedastalt wrote:
| Wow, seriously impressive. And the fact that this is the work of
| basically a high-schooler.
|
| I fear for the kind of competition my kids will have just to make
| it to college.
| naikrovek wrote:
| This is a natural extension/expansion of the "NAND to Tetris"
| course on coursera, and is free if you don't want to be graded.
|
| The course walks you through it all, and there is an
| accompanying book that you do not need to buy to finish the
| course.
|
| Anyone who wants to do this and can focus on it for enough time
| can complete it and extend it into whatever shape they like,
| like this person.
|
| It really is a good course.
| brailsafe wrote:
| Absolutely true, I'm working my way through it now; it's
| challenging and time consuming, totally worthwhile imo.
| ArchAndStarch wrote:
| I primarily used the physical book to learn about the
| nand2tetris platform. I highly recommend it, it's an
| enthralling read
___________________________________________________________________
(page generated 2024-04-25 23:00 UTC)