History followed one path
There were many other ways
It will always be like that
Can fewer than 40 old-skool TTL chips implement a multi-megahertz microcomputer with video and sound?
This project started as an exploration of what you can build from 30-40 simple logic chips. It has turned into a general purpose 8-bit microcomputer without any microprocessor driving it. I initially designed this on a large breadboard in early 2017, but soon after that I converted it all to a small PCB. It has VGA-compatible 60 Hz video in 64 colors and can display full-screen images, scroll them and play sound. Soon it will be running games like Pac Man and Space Invaders. But just for fun, I'll keep everything compatible with the breadboard design.
This is what we have now:
• 8-bits system built out of 1970s TTL chips (74LS)
• 34 TTL ICs, or 930 logic gates, for the CPU proper
• No microcontroller and no complex chips (such as the 74181 ALU)
• 16-bit virtual CPU runs ported versions of classic games, WozMon, BASIC, ...
• 8-bit virtual CPU runs 6502 programs without blinking an eye
• Only simple ICs, such as AND/OR, 4-bit adders, multiplexers, registers and so on
• 6.3 MHz. Can be pushed to 15 MHz with 74F logic and faster RAM
• 32kB 70ns RAM
• Harvard architecture with EPROM for kernel and cold storage
• Operates on 2.5W, or below 0.5W for the 74HCT version
• RISC with pipelining: 1 instructions per clock (sometimes 2...)
• Instruction decoding with diodes
• Nice instruction set: ADD/SUB/AND/OR/XOR, conditional jumps, many useful addressing modes
• 60Hz 64 color VGA and 4 sound channels bit-banged from software
• Originally designed and built on a solderless breadboard in 6 weeks (see the logs!)
The build has become a contradiction of itself. To reduce the parts count, every hardware function is essentially software-defined: video, audio and I/O are all handled by software. Video at the pixel level. Audio at the sample level, in 4 channels. Even the applications themselves are running in a non-existent 16-bit processor (aka interpreter).
Yet there is no microprocessor chip in there that runs the software of any of those virtual subsystems: it's all handled by the TTL circuit, acting as a minimalistic CPU and switching rapidly between these tasks. Not only does it work, the board is smaller and faster than the microcomputers of the day, including the first IBM PC. Having no microprocessor might have been better than having any of the time :-)
Check the videos for the current capabilities. The HaD blog section has the full story in all detail, so don't miss that if you're interested.
Some concepts to ponder about before starting
- How many bits? 4, 8, 16, 32, ...
- Software-generated video or hardwired?
- Harvard or Von Neumann architecture?
- Single cycle or multi cycle? Pipelining?
- ALU chips or not?
- Sliced ALU or full width?
A rule of thumb is that a minimalistic four bit system can be done in 10 chips, an eight bitter needs no more than 20 chips and going to 16 bits roughly doubles that again. Not all units double in chip count, but by extending the buses you will also have need for more addressing modes for it all to make sense. For example, a four bitter might work fine with a 256 word memory and absolute addressing, but with larger memories you'll need ways to construct addresses dynamically. Also, add more chips if extra functionality is required, such as high speed, a stack pointer, interrupts, a custom ALU or video.
Simplest possible concept
One concept, probably the simplest, is to replace the TrinketPro from the earlier breadboard VGA from TTL and SRAM with a minimalistic 4-bit TTL CPU. We will then get a working system with around 25 chips, or about 30 if we make a custom ALU. It will indeed be good enough for Pac Man and Space Invaders, but that will then also be the limit: no chance at all to have any fast scrolling, fast color changes, smooth moving objects, large objects, etcetera. Upgrading the CPU part to 8-bits won't bring much, because there will still be a communication bottleneck between the two parts. For any more exciting video we will need more complexity in the video part. If we do both, we certainly end up with more than 40 chips. It is absolutely interesting to try out this 25 chip concept (I would do it with a 74'181 ALU chip), because Space Invaders from such a small system can be very appealing. But first I want to explore another path.
A more daring approach
Lets look at it from another angle. If we look at my earlier video generation circuit it already contains many elements for a CPU: there are counters, ROM, RAM and buses. So the idea I'm going to pursue first is to extend the video part to gain full CPU capability: we will combine video with the CPU logic. The software will bit bang the sync and pixel signals at the right time. The dead time can be used for application code.
I don't know how this choice is going to turn out, it might make the application software timing really complicated, but it has the potential to make more interesting video possible because all flexibility is now in software. It also requires the CPU part to be very fast.
The ALU is the Arithmetic and Logic unit, or the inner calculator in a processor. For the ALU there is the option to use a 74181 or to roll your own. I have several 74181s chips lying around, so that is not the issue. But they have become hard to obtain, so duplicating this project becomes a bit more difficult if it requires them. And they are still quite complex and big, 600 mil, chips. Therefore I find it more interesting to do a custom ALU with simpler blocks. We could still cut functionality, for example only do ADD and NAND. But I really don't like compromising the software in such extreme ways.
Data paths and control signals
Notable prior art and thanks
Lets not pretend this is all new ground. There is a lot to learn from similar projects. There are many projects out there, but the ones most influential to this one were:
- Ben Eater's breadboard computer, for the very clear instruction videos and showing that a breadboard project doesn't have to look like a rat's nest
- Dieter Mueller's MT15, for his ability to break things down to the bare essentials and then build up from there. His pages read like poetry.
- Radical Brad's Quark 85, for making me aware that I shouldn't settle for 8x8 color LED output, as was my original intent
- Alexis Bezverkhyy's BFM3, for making me aware of the part availability aspect of a project like this. Most home-brew CPU's are one-off projects and I want to avoid that
- Steve Chamberlin's 4-bit Nibbler, for showing how simple it can be done
Others worth mentioning are: