Small MCUs Dominate the Computer Chip Market
All life on earth is really just insects. Statistically speaking, that’s the deal. There are more different species of insects than of all other forms of life put together – by a lot. Similarly, most computer chips sold every year don’t go into computers… Instead, over 99% of “computer” chips are microcontrollers (MCUs) that go into embedded devices, which we don’t perceive as computers. As it truns out, the same market forces, known as the Moore’s Law, that drive prices of high-end processor down, create even more opportunities at the low-end of the price spectrum.
Memory Efficiency is King
The silicon manufacturing has always been a real estate business (with prices around $1 billion per acre). By this I mean that the profits in the business depend on the number of tyiny chips that fit on a silicon waver, whereas it almost doesn’t matter what kind of chips these are.
With this in mind, one must only look at a die of a typical single-chip microcontroller (MCU) to immediately realize that it is dominated by the ROM and RAM blocks. The CPU itself sits somewhere in the corner rather insiginificant. Consequently, the most deciding factor for the price (die ara) of a MCU is the efficiency of its memory use, in other words, the code density.
Myth About "Tiny 8-bit Processors"
The recent Jack Ganssle’s “Breakpoints” blog on Embedded.com claims that “tiny (8-bit) processors make more efficient use of memory” (presumably than the bigger 16- or 32-bit processors). I disagree. From my experience with several single-chip MCUs I draw the opposite conclusion: the 8-bit processors make the least efficient use of memory. Actually, the deciding factor turns out not to be the CPU register size, but rather how old a design is, whereas the newer instruction set architectures (ISAs) far outperform the older ISAs. The problem with 8-bitters is that they are all old, as no new 8-bit designs have been introduced since the 1980’s.
To support the point, I present below a table that shows the code size of a tiny state machine framework written in C (called QP-nano), which has been compiled for a dozen or so very different single-chip MCUs. The code consists of a small hierarchical state machine processor (called QEP-nano), and a tiny framework (called QF-nano). The QEP-nano consists mostly of a conditional logic to execute hierarchical state machines. QF-nano contains an event queue, a timer module, and a simple event loop. I believe that this code is quite representative to typical projects that run on these small MCUs.
|PIC18||MPLAB-C18 (student edition)||3,214||2,072|
|8051 (SiLabs)||IAR EW8051||952||603|
|PSoC (M8C)||ImageCraft M8C||2,765||2,425|
|AVR (ATmega)||IAR EWAVR||541||650|
|TMS320C28x (Piccolo)||C2000||369 words|
|ARM7(ARM/THUMB)||IAR EWARM||588 (THUMB)||1,112 (ARM)|
|ARM Cortex-M3||IAR EWARM||524||504|
Interestingly, the winner is MSP430, which is a 16-bit architecture. It seems that the 16-bit ISA hits somehow the “sweet spot” for the best code density, perhaps because the addresses are also 16-bit wide and are handled in a single instruction. In contrast, 8-bitters need multiple instructions to handle 16-bit addresses.
I would also point out the excellent code density (and C-friendliness) of the new ARM Cortex-M, which is a modern 16/32-bit ISA, and even though it’s 32-bit it far outperforms all 8-bitters, including the good ol’8051.
The Market Leader is the Worst
On the other hand, the venerable PIC architecture is by far the worst (as well as particularly unfriendly to programming in C). That’s interesting, because this is the 8-bit market leader. I honestly don’t understand how Microchip makes money when their chips require the most silicon for given functionality. Clearly some other forces than just technical merits must be at work here.