Hacker News new | comments | show | ask | jobs | submit login
Build an 8-Bit Computer from Scratch (eater.net)
392 points by peter_d_sherman on May 31, 2017 | hide | past | web | favorite | 41 comments



Watching Ben's videos inspired me to finally assemble my Brainfuck-based CPU. That is to say, its native instruction set is Brainfuck.

https://hackaday.io/project/4237-mental-1-a-brainfuck-cpu/lo...

And a more recent video, showcasing PS/2 keyboard input: https://twitter.com/treykeown/status/867809790294097920


Sometimes I forget how crazy hackers are, and then someone goes and builds a CPU... and uses BF as an instructions set. Thank you :)


It's impractical, but it's not theoretically out-there: Brainfuck is essentially a minimal Turing-machine system. Someone attempting to build a computer based soley on Turing's "On Computable Numbers" might very well wind up with something like a Brainfuck-CPU.


Exactly, the beauty of the internet is that its taught us that we are not alone. We are legion.


I've been doing the same thing for the past couple weeks. http://blog.cogwheel.info/2017/05/ttl-brainfuck-computer-par...


Slick work! I've been on the hunt for similar projects to compare approaches, but I haven't find many implementations outside of FPGAs.

I like the approach for handling [ and ]. My design is "dumb" in the sense that it uses a `scan` register to handle jumping forward and backwards (so it's quite slow). So far it seems easiest to bite the bullet and scan forwards when [ is zero, but have something similar to your stack pointer for jumping back. Building the jump table for both [ and ] on reset is also a nice optimization.


Thanks :) I love that I'm not the first/only one to do one of these in Brainfuck (especially in direct response to Ben's series).

I have a feeling the approach I take will follow from whatever I decide for RAM zeroing. The purist in me is still a bit put off by the idea of preprocessing. It feels more like a compiler+CPU rather than just a CPU. If I go the "highest address counter" approach where I synthesize zeros the first time a RAM location is passed, I probably won't do the loop pre-processing.

I could do a hybrid approach where both jump points are indexed the first time the loop is scanned. This would achieve amortized constant time. I think I could live with that...


That's amazing! And there was me half-thinking about writing an interpreter as an exercise...

Edit: Have you posted this as a 'show hn'?


Not yet! I have a bit of work to do before trying to show this project. There's a MENTAL-2 being built right now, and a few software tools I need to clean up. Hoping to get it up to at least 1MHz.


This is really amazing. In addition to the interesting project this individual has a great gift for articulating everything in a concise manner and with a very pleasant cadence. What a great teacher. Thanks for sharing. I'm looking forward to seeing the rest of this series.

If you only have a limited amount of time I would highly recommend the control logic video:

https://www.youtube.com/watch?v=dXdoim96v5A


Thanks for the kind words! And thanks to everyone for your interest.


Hi ben, how do you feel about minecraft as a tool to learn about and practice computer design? Most of my comp-eng work has been in minecraft, but i constantly feel as if it isnt quite 'legit'. The main reason i used it is because it has no cost for components.


I'm not OP but speaking solely for myself, Minecraft has really turned me back on to all the logic design stuff. For example, see my single-push-button castle gate control, http://imgur.com/a/tBzJh. Of course, Minecraft physics aren't the same as real physics, but I think this is a great way to introduce anyone to circuits. It's certainly a lot more fun than the various exercises I had to do in my college EE classes.


Amazing Ben! Your videos are great!! But I have a question for everyone. Once built, what do you do with it? Yes it's an amazing learning project, but after it's complete I'd like to put it in a case maybe for display. Just not sure what would be best or what code would be most interesting to display. Perhaps replacing the 555 clock with a RTC DS1307 and using it as a time piece?


He explains everything i wish i had the ability to ezplain about computers. I jave a feeling that this is going to be the 3blue1brown of computer enegineering.


I would also recommend Art of the problem for a CS oriented 3blue1brown style videos.

https://www.youtube.com/channel/UCotwjyJnb-4KW7bmsOoLfkg


I've been building PCBs for this series in my spare time for the past couple months, this last weekend I finished the design for the ALU: https://github.com/lelandbatey/custom_cpu--ALU

I've then been having them manufactured in China for, which you can have done for ~$15 for 5, shipped. It's very satisfying to have finished fancy PCBs to solder together, and I've learned so much about electronics, PCB design, and small scale board manufacturing since starting this project!


do you have a link to the manufacturer you are using?

also, do you have images of the empty pcb and finished product after soldering the components that could be added to the git repo?

edit.. just saw some pics from your other comment: https://news.ycombinator.com/item?id=14457760


Here's who I've been having the boards manufactured by: https://www.elecrow.com/5pcs-2-layer-pcb.html

They're by far the cheapest I've found. They charge $5 for 5 PCBs, with a 10cmx10cm area each. The cheapest shipping at $6 will get them to you in about 20 days from order date, while the Shenzhen DHL shipping option will get them to you in about 7 days from order date. At least, that's been my experience ordering from them.


I'd love it if Ben sold a single package kit that had everything and printed instructions inside of it. It would be a fun thing for bored highschool students or university students.

Maybe it could even have a PCB that has everything socketed like a breadboard except closer together.


I've actually been designing PCB versions of the modules for Ben Eaters tiny CPU, you can see them on my GitHub. Here's the latest one I've done, the ALU: https://github.com/lelandbatey/custom_cpu--ALU

Here's what the physical versions of the clock and the register look like during testing (red is clock, blue is register): https://goo.gl/photos/NSAEYVu7AbXVjcBK6


Very cool! I've been considering going this direction with the videos once I've finished everything for the breadboard version. Modular PCBs would make it a lot easier to rearrange things to experiment with different architectures, which could be interesting.

But I've got a lot of other ideas too, so who knows...


Wow these are great. Is your background in EE then?


No, my background is entirely in CS. This is the first circuit and electronics work I've done, though I have two friends much more acquainted with electronics than I who have been giving advice.


That would be super cool. In the meantime, The Dodo is higher level kit featuring a 6502 processor. http://www.dodolabs.io/


...and here is a project to make a discrete 6502, which currently isn't commercial but might be: http://monster6502.com/


Over 4000 surface mount components. But not many different part numbers. He probably has access to a pick and place machine.


jaw drops


Honestly Ben, you should seriously consider doing this.


I've been following this series for a while now and it's been fantastic. In particular I recommend the videos on making an EEPROM programmer with an Arduino.

To help me understand everything better I've been writing a kind of emulator/simulator[0] (I'm never quite sure of the difference). It still needs work and some terminology changing to match Ben's, but it's got basically the same functionality as the real one.

It's actually a really nice way to be able to rapidly prototype new microcode because the instructions are defined as a slice of bit-fields representing which control lines are set for each cycle[1].

[0]: https://github.com/tomnomnom/eater-cpu

[1]: https://github.com/tomnomnom/eater-cpu/blob/master/instructi...


Emulators can be used in place of the system they are crafted after for real world use. Simulators on the other hand are more meant for analysis as they offer more variable control.


This remimds me so much of the computer i made in minecraft.

http://m.imgur.com/a/lPZbk


That, for want of better words, is absolutely amazing.


He's on patreon: https://www.patreon.com/beneater

His videos are so great, I'm happy when I get my monthly emails that he's receiving money. It's a good reminder that I need to hop back on them!


This is awesome!

I had to build a 4 bit computer in college and it looked almost exactly like this (less breadboards and components though). The professor wrote the textbook herself. If she made it into a webpage I imagine it would be a longer version of this.

To date is one of my favorite classes I took.


Still waiting for the Primitive Technology guy to do the same thing, with the camera opening on a pile of sand.

Sure, it's still cool to see someone use 4-bit binary full adder etc and build a computer, but the from Scratch always feels disingenuous.


To make an apple pie from scratch, you must first invent the universe.


To make an apple pie from scratch, you must first invent the universe from scratch.


I've been waiting for something like this for awhile and am super excited. I'd be even more stoked if the next project was building a small Forth from scratch and flashing that on the board.

You could show how you could interactively test and control the board that way.


Been following his YouTube channel for quite a while now. Very fascinating


For some definition of "scratch".




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: