I do not have any in-depth knowledge of electrical engineering, but I would like to understand the purpose of a transistor in a microprocessor. There's usually some talk of Moore's law and that transistors somehow increase computation speed, but it's not clear to me exactly how these transistors are used. I figure it has something to do with pipelining. For example, when a CPU reads some instruction from memory, how are the operations required for that instruction performed with transistors?

  • \$\begingroup\$ transistors make logic gates, these gates are used to make flip flops. Gates are used to make combinations circuits while flip-flops are used to make sequential circuits. These are than used to make the different building blocks of a microprocessor like the ALU and others. \$\endgroup\$ – quantum231 Apr 22 '13 at 14:17

It would be pretty hard to design a modern microcontroller from the transistor level. Transistors are used to make logic gates, as the lowest level building blocks. The most simple gate is the NOT gate, which inverts the input level: a logic 0 becomes a 1, and vice versa. The NOT gate is built with 2 transistors:

enter image description here

The top transistor conducts if its input (the small dot) is low, the bottom transistor (no dot) if its input is high. So if you apply a high input the bottom transistor conducts, acting as a switch, and switch the output Q to Vss (that's your -), or low level. We've inverted the input. Other gates are based on that. Take the NAND gate for instance. It has two or more inputs, and the output is low if all inputs are high. In all other cases the input is high.

enter image description here

This is a 2-input NAND gate, you still can see some of the inverter in it. If both inputs are high the bottom transistors both conduct, and the output is made low through its connection with Vss. If either of the inputs is low at least one of the top transistors conducts and output will be made high through its connection with Vdd (that's your +). We've got a working NAND gate. And so it goes on, we can build an XOR gate using 4 NAND gates, and other more complex logic is built from a combination of building blocks. You need a building block to create a register function: a part which can hold its state, like a memory.

If an instruction wants to read from RAM there's first the instruction decoder. Through a combination of gates it derives a number of signals it needs to execute the instruction. One of those will be to pass the RAM address to be read to the adress bus. (Busses are channels of signals, an address bus for an 8-bit controller may for instance have 16 parallel wires. Busses are a way to get things organized. Without them the controller's design would become very inefficient.) Another signal will activate the RD line (for "read"), which signals the RAM that it should place the data on the databus. Yet another signal will latch that data in a register.

An important thing is timing. You can't latch the data if you haven't given the RAM the time to place it on the bus. All done by the same logic, from building blocks which in turn are built from transistors.

"transistors somehow increase computation speed"

There's nothing else than transistors and their connections. Transistors by themselves won't increase speed. What is true, however, is that technological improvements allow for faster transistors, and faster transistors means faster computation. Some of these improvements are unique technology steps, which you can do only once. But scaling is another factor, and they've kept repeating that since the first ICs were designed. 40 years ago an IC would typically have a 5 to 8 \$\mu\$m feature size. Today we can produce down to 22nm feature size. (DNA has a 15nm diameter.) With smaller feature size the physical properties of the transistor change allowing it to switch faster. Moore saw in this continuing scaling a trend, which became known as Moore's Law. This can't go on forever without having to take a leap in the used technology. In the 80s it was feared that the then used technology would have its limits at around 200nm to 300nm, because the lithographic process may not work at wavelengths below visible light. But lithography is still the technology used by today's steppers.


Without re-writing the book on digital logic and Computer Organization and Design, a transistor implements the function of a switch in the context of microprocessors. They are used to create "switching circuits" typically (e.g. CMOS logic gates). Moore's law is about how many transistors you can fit on a given surface area (i.e. transistor density), and consequently the complexity of logic that you can implement in the hardware (and as an aside the yield that can be achieve in manufacturing).

Since microprocessors are spending most of their time waiting for memory operations (loads and stores) to be completed, a lot of these transistors are being dedicated to high speed memories on the chip called caches that help reduce the frequency of these memory operations actually having to leave the chip. Smaller transistors means you can keep a larger subset of the RAM local to the CPU at any given time. More transistors are also being used to implement fancy predictive circuits, like branch predictors and load value predictors.

Branch predictors and Out of Order Execution units are there to help keep the pipeline full by guessing which way a branch instruction will go based on heuristics associated with the program counter and the recent history of branching results (taken or not).

Load value predictors are there to avoid going to memory to fetch a value (for example assuming a certain "stride" or other heuristic on what the data will be at a certain address based on previous values seen at that address).

Along with these predictive logic circuits comes all the logic circuits that are required to undo and correct computed results when the predictions turn out to have been wrong.

In summary, all these extra transistors are being used to:

  1. Avoid instructions from having to leave the chip (i.e. go to RAM) to complete, and
  2. Keep the pipeline full or avoid going to RAM by predicting dependency outcomes

One last thing is that they can be used to make your data path wider (i.e. 64-bit processors instead of 32-bit processors).

  • \$\begingroup\$ You talk about optimization techniques like caches and pipelining without explaining basic functionality. I think that may be confusing. \$\endgroup\$ – stevenvh Jun 2 '12 at 11:08
  • \$\begingroup\$ @stevenvh sure, but the question he is really asking is not "what is a transistor used for in general", but rather "how does having more transistors make computing faster"... \$\endgroup\$ – vicatcu Jun 2 '12 at 23:10
  • \$\begingroup\$ Load dependence prediction is not the same as load value prediction. Load dependence prediction can allow a later load to be executed when there was an earlier store to a not-yet-known address if independence is predicted. Prediction of dependence on a particular store might be considered value prediction. More general value prediction is not currently implemented commercially. \$\endgroup\$ – Paul A. Clayton Jan 7 '15 at 11:44

The answer to your question comprises roughly 3 full length university courses. Possibly more.

In a modern CMOS processor, transistors are used to perform various Boolean logic operations, store ones and zeros, and amplify signals so that they can be sent down wires, e.g. all the basic operations of digital logic. All the functional units, including instruction decoders, inside a processor are just big, sometimes very complicated, state machines built with transistors.

Moore's law created an industry technology roadmap, where semiconductor companies, to stay competitive, keep putting more and more transistors closer and closer together on a chip, which tends to make microprocessors more powerful and faster every new product generation.


Not the answer you're looking for? Browse other questions tagged or ask your own question.