XaiJu
frooxius
frooxius

patreon


AttoWPU - extremely minimalist CPU architecture (FrooxArchive #6)

UPDATE: I published the old compiler and simulator sources on GitHub here: https://github.com/Frooxius/AttoWPU - they're provided as-is and pretty old, use on your own risk, but have fun!

The first of the series is dubbed “AttoWPU” (with atto being an SI prefix for really small units). The core idea of this processor was that it’s very minimalist, especially in the way it’s programmed - there are no traditional CPU instructions and only three “atto instructions” (four if an optional one is counted, that’s mostly for debugging).

Today I’m going to show you something quite a bit different from the previous posts, the first of a series of hobby projects I worked on during my last year of high school, dubbed Weird Processor Architectures - WPU’s.

The project logo is a circular chip, because it's weird! (and yes, I included the source .blend file of this in the files below ;)

During this time, I became a bit obsessed with playing with digital circuits, micro controllers, programming them in assembly and learning how they work. The more I learned about them, the more I started thinking - why are the CPU’s designed the way they are? What would it be like if they worked differently?

From this stemmed idea of a number of “WPU’s” - weird processing units. Essentially simple CPU architectures that were intentionally “weird” in some way. The original goal wasn’t even necessarily to produce something useful, but just try something odd and unexpected and see what it is going to be like.

Best case scenario, I’d find something novel that’s potentially useful and practical, worst case scenario I make something that’s fun to toy with and educational - a bit of a blend between technology and art, and something that pokes and prods at parts of design that seem “obvious” and that we don’t generally think about.

If you’re familiar with the concept of esoteric programming languages (like Befunge, Brainfuck and similar) - this project is a bit like that, but for processor architectures.

The first of the series is dubbed “AttoWPU” (with atto being an SI prefix for really small units). The core idea of this processor was that it’s very minimalistic, especially in the way it’s programmed - there are no traditional CPU instructions and only three “atto instructions” (four if an optional one is counted, that’s mostly for debugging).


The three instructions are very simple - they each set/flip bits on the CPU’s bus. All the CPU’s units are attached to this bus. In order to control them, you have to flip the right bits on the bus to address them and provide them with the right input data.

This includes even things like the program counter - part of the CPU that keeps track of where it currently is in a program. If you want to jump to another part of the program, you have to do it yourself, there’s no shortcut instruction to help you.

This minimalist approach allowed me to develop a curious programming language - Attoassembly. To make programming like this simpler, the language has a macro system which allows for wrapping sets of bit flipping instructions into named ones and in turn wrapping those into more.

Old screenshot from when I was working on the simulator. 

As a result, you’d actually end up composing certain common instructions yourself as a macros. For example, as an exercise, I ended up implementing the classic “MOV'' instruction in attoassembly, which resulted in a few dozen lines of code - which is quite a bit for something that’s normally a very common instruction in CPU’s!

If you’d like to play around a bit, I’ve included the compiler, along with a graphical emulator of the architecture. There’s a number of simple sample applications included as well. The most interesting one is probably Pong.att, which is a fully playable pong game, implemented fully in Attoassembly! It even features very simple AI which you can toggle by flipping some of the virtual switches.

The Pong game is how I actually introduced the program when presenting it at a science fair competition. I’d start the presentation, saying that I made a pong game, in my own programming language, for my own processor. That managed to actually get me all the way to the national round of this science fair and after that to Intel ISEF in 2012 and the first time I got to visit the US.

This experience was crucial for me, because it set me on a new path. When I started working on AttoWPU, it was just a personal hobby that I didn’t think anyone would ever care about. My idea of my future was that I get hired somewhere, work on boring stuff and maybe do this kind of thing in my free time.

Instead, I learned the value of going after things you’re passionate about and following your dreams and started looking into ways to forge my own path, which led to me where I am today.

While I ultimately dropped the project itself and started focusing on game development again, a lot of the principles and lessons learned working on these architectures remain - notably, designing and implementing complex systems in a manageable and sustainable manner - something that became very important for my future projects.

AttoWPU - extremely minimalist CPU architecture (FrooxArchive #6)

Comments

It's out! :D https://github.com/Frooxius/AttoWPU I did a few tests and stuff seems to compile, but it's mostly provided as-is. The code is pretty old and parts aren't finished, so you kinda have to fend for yourself with this one, but I hope it'll be fun!

Frooxius

I was waiting for this one!

Martin Konečný

Ok I'll get them ready when I can!

Frooxius

Yes please! It'd be a nice stepping stone if someone wants to play around with cool projects like this! Having only the spec sheets would make it a little more difficult

'Lex

Would any of you be interested if I published the old C++ sources for the compiler/assembler and the simulator, if they were provided "as is" (meaning horrible code quality of Froox from10 years ago)?

Frooxius


More Creators