Homemade CPU – from scratch

General architecture notes

Some tricks

BMOW – Big Mess of Wires

MyCPU

Harry Porter's Relay Computer

Magic-1

Mark-1 Forth computer

MT15

Epilogue

Since 1975 when one need a processor – the only option is to buy one. In the most complex case one might consider going for configurable FPGA processor (like Nios II) with few extra commands, and that's it. Nowadays it is hard to believe that these fancy processors might be obtained some other way than just buying one. It's just like thinking that beef and bread is only made in the local shop.Why one would need to return to "root" technology? Well, to be sure that we can resurrect the technology if something happens with current Chinese factories and Engeneering centers in few countriesand to know in very detail how exactly things works.It appeared that there are guys who did developed homemade processors as a hobby. They are usually made out of low-scale microchips (registers, counters, e.t.c) or low level discrete elements (transistors, relays). The only big chips used are memory and flash memory.In this article I want to do a brief on architecture of homemade processors and show some greatest processors made at home.Majority of self-made processors work on microcode (just like most of commercial processors), which is red from flash/SRAM memory and here is usually the greatest bottleneck – during last 20 years random access time for flash or memory in separate chips didn't scaled well, it is still around 70ns in average which does not allow to go over ~14Mhz. Self made processors usually have 8 or 16-bit data-bus width, address bus of 16, 20 or 24 bits (no one is really happy to limit amount of memory to 64Kb these days even for simplified processors). ALU is 1-bit-slice (i.e. for 16-bit numbers it would take 16 clock to do the calculation) or several single-chip ALUs are used (4-bit). Microcode-based processors usually store both code and data in the same RAM area (von Neumann architecture), while RISC-like processors have separate memory for code and data (Harvard architecture, usually it is even impossible to read/write data from code memory). All self-made processors have fixed length of commands – that is vital in order to simplify instruction decoding (variable instruction ).SRAM memory is usually used – it's very easy to work with (no need to mess with DRAM refresh each 32-64 ms), and not as expensive as before.Most of used chips are indeed simple, but there are some which are not really simple, and were not available like 30 years ago: complete ALUs, large SRAM (8x1M SRAM have ~48 million transistors) and EEPROM memory chips which can be used as very flexible ALU(FPGA uses same principle for building custom circuits). For example, if you take 8x65K flash memory chip, you can perform 8 bit add or mul operation, and on 8x1M chip you are getting ALU for custom 16 8-bit operations. And finally, nowadays for homemade CPUs you don't need to worry much about microcode and program code size.And now I am going to tell a little about the greatest home-grown processors:Made of low-scale chips, clock rate is 2Mhz.Made of low-scale chips. Clock rate is 8Mhz. Lots of peripherals, including network card (mycpu.eu site itself is hosted on this computer). Reproducible, there are several ones built.Made of 415 relays, around 7Hz clock rate, nice clicking sound during computations :-)Made of ~200 low-scale chips, clock rate is up to 4Mhz. Have working Minux port, homebrewcpu.com site is served by this computer.Made of slow-scale chips, clock rate is 1Mhz. Obviously, optimized for Forth programs. Microcode is stored in diode matrix, opposed to "dirty" flash-memory trick :-).The most juicy part: 16-bit processor made of simplest low-frequency transistors (around 3000 transistors). Clock rate is 500Khz, chips are used for memory and clock generation. You can start producing that kind of transistors in like 1 year after nuclear warI hope this article would lead someone to dig deeper into internal processor architecture (and make you own one probably). Personally, I reconsidered what I've thought about x86: I've though it's architecture is ugly, but now I see that every single hated "feature" of x86 had a very strong motivation at the time it was designed.