A New Formula for a RISC CPU

The Super RISC CPU, a virtual processor built entirely in Excel, runs at 12-14 Hz and is a great platform for computer science education.

Nick Bild
6 months agoRetro Tech
The Super RISC CPU runs entirely inside an Excel workbook (📷: Inkbox)

People have done some pretty wild things with Microsoft Excel over the years, from building full-length role-playing games to creating complex animations and puzzles. You didn’t think these worksheets were just for crunching numbers and doing things that generally make you hate your life, now did you? Using Excel sheets is certainly not the most efficient way to hack a new creation into being, but if you want a challenge, it can be a fun learning experience.

It may seem like an odd platform to use at first, and well, that’s because it definitely is. But if you think about it, storing and retrieving values, and performing mathematical operations on those values, is about all you need to build a complex application if you are creative (and patient). There are even features like conditional cell formatting to develop simple graphics with. The possibilities are virtually endless for those that inexplicably want to build software into a spreadsheet.

YouTuber Inkbox took things down the chain another level and instead of building software, built a virtual processor on top of which software can be executed. In a previous project, Inkbox created a 16-bit Excel processor that ran at about 1 to 2 Hz. Given the slow clock speed, and the fact that it contained only 100,000 cells for storage, this first version was more or less on par with a machine from the 1950s.

Not a bad start, but Inkbox wanted to see how much more could be squeezed out of a spreadsheet processor. After tinkering extensively with the design, a new virtual processor called the Super RISC CPU was developed. The goal was to make this new processor much faster so that it could handle larger workloads — certainly nothing like what a modern processor can handle, but maybe with performance comparable to a machine of a few decades past.

Toward this goal, the instruction set architecture was first sliced down from 26 instructions to just 10, only including crucial commands like store, load, add, compare, and clear and set carry. The register count was also reduced by one, giving the Super RISC just a single 8-bit register. Next, a stack was created, along with push and pop instructions to work with it. Other instructions, like add, assume that they operate on a value at the top of the stack to save time fetching values that would otherwise be specified in parameters.

Another speedup involved leaving IF statements out of the formulas used in the worksheets. Instead, binary logic operations were created to perform the same functions, but quite a bit faster.

Dozens of other little optimizations were sprinkled throughout the design to make the CPU run as fast as possible — even if these optimizations do make programming for the virtual processor something of a nightmare.

The CPU was built into a Harvard architecture system, with separate RAM and ROM storage locations. A 10-bit program counter is used to track the execution of code stored in these locations, which are each one kilobyte in size. For visual output, Inkbox included a small, multicolor 16x16 pixel display (composed of colored spreadsheet cells, of course).

I know what you’re thinking, but no Visual Basic was used in the development of the Super RISC CPU. It is a pure, spreadsheet-based virtual CPU. To program this processor, a custom assembler, called Excel-ASM8 was created. When a program is assembled, this software automatically copies the raw machine code it produces into the spreadsheet’s ROM cells.

So, how did it turn out? Well, it is still a very underpowered processor, but that doesn’t really matter since it is not like it will ever be used as anything more than a toy. But the size of the spreadsheet was reduced to just 4 percent of what the previous processor required. And that reduction came with a significant performance increase — the CPU now runs at about 12-14 Hz.

Everything has been open-sourced and released on GitHub, so go grab it if you want a new way to learn about the operation of CPUs.

Nick Bild
R&D, creativity, and building the next big thing you never knew you wanted are my specialties.
Latest articles
Sponsored articles
Related articles
Get our weekly newsletter when you join Hackster.
Latest articles
Read more
Related articles