Electronic – Is there more to a Microcontroller than a few logic gates

microcontroller

I am a software developer (using high level languages like .NET,C,C++ etc) trying to understand how computers work at a lower level.

I asked this question a few days ago: Lower level system development. I have setup my arduino and I have written a few programs in C and assembly language.

However, please see the following diagram: here. This diagram suggests that the microcontroller is simply a component with a few AND gates. Surely I am missing something here? What happens if your program has an OR operation or a NOT operation? I realise this is a big topic with lots of different areas. However, I have a good GCSE level of electronics and I studied the basics of this at university whilst studying computing. I just struggle to piece it all together. What is inside a Microcontroller (physically)?

Best Answer

Pretty much just transistors. Lots of them. Starting with a couple of thousand for the 4004 (the first commercially successful microprocessor) in 1971, to billions in the latest chips. Transistors are used to create logic gates, which in turn are used to create the basic building blocks of the processor:

Instruction decoder
ALU (arithmetic logic unit)
Registers
Multiplexors/buffers to route signals between the above sections and the outside

Microcontrollers in addition have program and data memory, which is also constructed from transistors, along with analog circuitry and I/O ports.

High-level language languages are compiled or interpreted, in the first case eventually translated into machine instructions which are decoded by the instruction decoder. Opcodes in the instruction dictate which operation takes place. Arithmetic (add subtract and so forth) and logic operations like AND, OR etc. are handled by the ALU. So yes there are gates buried within the ALU that perform AND and OR operations, corresponding to AND and OR operations in your program.

However such operations need not actually be done by AND or OR gates Any logic function can be performed using either all NAND gates (AND followed by and inverter) or all NOR gates (OR gates followed by and inverter) so no other type of gate would be needed. The guidance computer for the Apollo 11 spacecraft which landed on the moon in 1969, consisted entirely of 2800 IC's with dual three-input NOR gates.

Here is the transistor count for a selected number of microprocessors over the years:

Intel 4004           (1971)          2,300
MOS Tech 6502        (1975)          3,510
Motorola 6800        (1974)          4,100
Intel 8080           (1974)          4,500
Intel 8086 & 8088    (1974)         29,000
Motorola 68000       (1979)         68,000
Intel 80386          (1985)        275,000
ARM 1                (1985)         25,000
Intel 80486          (1989)      1,180,235
Intel Pentium        (1993)      3,100,000
AMD K7               (1999)     22,000,000
Intel Pentium 4      (2000)     42,000,000
Intel Core 2 Duo     (2006)    291,000,000
ARM Cortex-A9        (2007)     26,000,000
AMD K10 quad-core    (2008)    758,000,000
Intel 6-core i7      (2010)  1,170,000,000
Intel 8-core Itanium (2012)  3,100,000,000 

It's astonishing that the number of transistors has increased by more than six orders of magnitude in 41 years (1971-2012). This increase has almost exactly matched Moore's Law:

$$ 2300(2^{41/2}) = 3,410,693,920 $$

which states the number of transistors in an integrated circuit doubles every two years.

Some notes about the table:

  1. The number of transistors in the 8088 (used in the first PC) and the 8086 were the same because internally, the chips were essentially identical. It was only the bus interface (8 for the 8088 vs 16 bits for the 8086) that were different.
  2. The number of transistors for the Motorola 68000 were 68,000 give or take. This was used in marketing materials.
  3. Note the striking difference between CISC (Complex instruction set computing) and RISC (Reduced instruction set computing) architectures: the Intel 80386, released in 1985 had 275,000 transistors, while the ARM 1, released the same year, had 25,000, a ratio of 11 to 1. And the Intel Core 2 Duo, released in 2006, had 291,000,000 transistors, whereas the ARM Cortex-A9, introduced a year later, had 22,000,000, a similar ratio of 13 to 1.

The earliest microprocessors, such as the 6502 used in the very popular Apple ][, had low enough transistor counts that with only little magnification you can see the individual transistors. Here is a 6502 simulator that actually shows the data paths through the chip as it executes a program. Just click on the Play button on the right side. You can zoom in and get more detail. The simulator was created by exposing the die, photographing the surface and substrates at high resolution, and then creating a complete digital model of the chip.

The very first computers in the 1940's were made up of either vacuum tubes or relays, but in either case they performed the same Boolean algebra as the digital circuits today. Discrete transistor computers came along ion the late 1950's/early 1960's. They were superseded by processors using SSI (small scale integrated circuits). This was largely driven by the aerospace industry, both the space race and defense. to minimize weight. The microprocessors in the list earlier are an example of LSI (large scale integration).