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.
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...
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:
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'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!
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...
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.
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].
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.
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.
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.
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