Close
0%
0%

MENTAL-1, a Brainfuck CPU

A minimalist computer for a minimalist language

Similar projects worth following
MENTAL-1 is the first iteration of a family of processors I'm building. MENTAL-1 is built using only 7400 series components (excluding the RAM and ROM). The MENTAL family of processors uses Brainfuck as its instruction set.

MENTAL-1 is a CPU that natively runs Brainfuck code. Brainfuck is an incredibly simplistic language. At its core, it consists of only eight basic instructions, a one-dimensional array of bytes, a data pointer, and an instruction pointer. I won't go into detail about the language here, but skimming over the wikipedia page http://en.wikipedia.org/wiki/Brainfuck will give you a good idea of how it works.

Core.pdf

Schematic for MENTAL-1 Core (Excludes ROM, RAM, and SCAN modules).

Adobe Portable Document Format - 559.06 kB - 02/03/2018 at 04:55

Preview
Download

  • Finished Schematic, PCBs Incoming!

    Trey Keown02/03/2018 at 05:11 0 comments

    I recently spent a bit of time drawing up a proper schematic for MENTAL-1. I've had revised schematics laying around on sheets of paper for a while, but nothing official. However, I wanted to make a PCB implementation of MENTAL-1, so I fired up Altium and drew it up. You can find the hi-res schematic PDF here.

    I've had this on a few sheets of paper for a while, but it's nice to have made a proper schematic.
    I'm still learning when it comes to PCB design, but I think this one will turn out quite well. Since I've got a lot of room and I'm working with the larger DIP chips, It wasn't had to fit this on a two-layer board. All hand-routed, for extra fun.

    For now, I'll be referring to this implementation as MENTAL-1P. It's a slightly modified design from MENTAL-1, but I'm not sure if it warrants a version number bump. I'll be posting updates here when I get and test the boards from Seeed.

  • Updates: Status, Maker Faires, and the Future

    Trey Keown01/23/2018 at 08:34 0 comments

    The past few months have been slow for MENTAL-1, but a few important milestones happened. Most importantly, I'm officially calling it finished. The MENTAL line of processors is most definitely not, but MENTAL-1 is. It's able to achieve stable operation at 3MHz, has working peripherals that were designed for it (the PS/2 keyboard input and the 40x2 character display output), and most importantly has a slick laser-cut case. I've included the most recent video I have of it in operation - it's one I created for showing the computer to a few different Reddit communities.

    One of the best things to come from this project was being able to use it as a tool to teach others about building their own CPUs. At the Seattle Mini Maker Faire, I had a blast introducing the ideas behind how computer chips are made, how digital logic works, and how creating a large hand-wired project like this can be tedious but incredibly rewarding.

    Demonstrating digital logic. I had a breadboard hooked up with a NAND gate, NOR gate, and NOT gate. Visitors could toggle switches to see how that makes the outputs change.

    The CPU was running the simple "cat" program I had written, and visitors were able to stop by and type out any message they wanted. The new case on it helped keep my mind at ease when the younger crowd stopped by and wanted to get hands-on.

    My CPU had a bug during a few demonstrations.

    I was able to attend the Wenatchee Mini Maker Faire as well, which was much more relaxed but still a great time. It was a bit after the one in Seattle, so I had time to polish my presentation a bit.

    Rocks, the elements extracted from them, and silicon wafers (which are made of those elements) are on the right side of the table.

    It's been a blast sharing this with local communities.

    So, what's the plan now? MENTAL-1 is finished. I've started work on MENTAL-2, which is fairly messy but much more compact. I'm currently working on an FPGA implementation as well.

    I'll post proper schematics, the source code for my "cat" program, and my notes here in the coming months.

  • Keyboard input!

    Trey Keown06/26/2017 at 23:04 0 comments

    I developed a simple interface for a PS/2 keyboard and wrote a "cat" program to echo out input! The source code can be found here, and the video is below.

  • Hello, world!

    Trey Keown05/11/2017 at 02:01 0 comments

    It works! There's still a lot of cleanup left, but it seems to be running correctly. This test program exercises every instruction. The vertically-oriented breadboard is unnecessary for the CPU to function, it's just a breadboard for I/O.

  • Quick Update: Fixed Clock Design

    Trey Keown05/05/2017 at 01:18 0 comments

    No update photos yet, but I had to make a few modifications to the clock design, as the earlier version had a race condition. I've had difficulties making it possible to change direction while incrementing the 74HC193 without glitching, so I split the clock into one that's consumed by the Instruction Pointer (IP), and another that's consumed by the rest of the logic. I'll go into more detail in the next update, which should come in tonight or tomorrow.

  • It lives!

    Trey Keown05/01/2017 at 18:54 0 comments

    This project has been revived! I've been working on it over the past weeks and have everything laid out on breadboards. Still needs wiring, but it's coming along well!

View all 6 project logs

Enjoy this project?

Share

Discussions

MiloŇ° wrote 09/18/2019 at 07:42 point

Hi, that thing looks awesome.


Could you maybe explain the 'runs Brainfuck natively' part?

I know what Brainfuck is, but I don't understand how it is utilized here.

  Are you sure? yes | no

Qasim wrote 04/20/2018 at 23:47 point

Hi, I was inspired by Ben Eater. I wanna build your CPU, Can you tell how much if costs you for you to build this. Thanks

  Are you sure? yes | no

Dr. Cockroach wrote 02/12/2018 at 11:14 point

Love the circuit and construction. My BF Cardboard Computer wont come close to this :-)

  Are you sure? yes | no

Benchoff wrote 03/18/2015 at 04:46 point

Oh man, you better build this. You need to build this. It even looks like you have a good *plan* to build it.

My only suggestion is that you drop the VIC for the GPU; a propeller can do VGA-resolution video, and can do PS/2 keyboards easily.

  Are you sure? yes | no

Trey Keown wrote 03/18/2015 at 05:28 point

Really appreciate the input, I'm working on it! I've actually got the instruction decoder hooked up and working but I can't quite get the flash memory programmed, of all things. Should have that sorted out soon enough. For now, I'll upload a picture of the decoder in all its (messy) glory.

I originally wanted to use something like the Propellor, but I decided that it goes against the spirit of this project. Why build a processor only to use supporting logic that's more powerful than the CPU itself?

Interesting side note, a PS/2 keyboard was chosen because it's super easy to implement in hardware. See http://www.chuckbolin.com/docs/74LS164_Keyboard.pdf

The video display generator I settled on is the classic MC6847 - it's widely available on the secondhand market and is much nicer to interface with. Plus the TRS-80 romance. But that's a bit down the road. Maybe some SPP/EPP parallel port action, too.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates