Or in other words, what is the more fundamental building block of an IC below transistors? When I load a code onto my microprocessor, how (fundamentally, sure some people here could write books about this!) does it translate these virtual instructions into a set of real world actions? I assume transistors are pretty fundamental to the process, but what then controls those transistors? Many thanks!

- 158,152
- 3
- 173
- 387

- 241
- 1
- 7
-
2But why you want to go into transistor-level? For example, do you know how a AND gate work at the transistor level? Or even more complex devices a binary counter? At the transistor level, nothing interesting is going on. The transistor is Cut-OFF or saturated nothing more. – G36 Apr 12 '20 at 11:00
-
On this page, you can find online working compute in your browser based on logic gates and counters and registers and a clock signal. http://www.buthowdoitknow.com/cpu_model_intro.html – G36 Apr 12 '20 at 11:30
-
1We etch and wire slices of silicon a particular way to behave like nanometre scale switches. This arrangement is named transistor. – TEMLIB Apr 12 '20 at 12:33
-
The transistors of a microprocessor are controlled by other transistors of the same microprocessor. In a multiprocessor circuit transistors of one microprocessor are controlled by transistors of other microprocessors. – Uwe Apr 12 '20 at 15:07
-
@G36 I understand what an AND gate is - but however many gates you had in something, feed it one thing and you will always get the same thing back out. To me a transistor is a more fundamental tool which can be used to have active control over a process - so you can change the flow and get something else out dependent on how you control it, unlike a gate. I've studied flip flops and binary counters a little, but to me they are essentially the same as the gate in this situation, carrying out predefined sequence, allowing no active control in the process – Oliver Walters Apr 12 '20 at 17:52
-
But you can build the gates with the transistor see here https://electronics.stackexchange.com/questions/491917/having-trouble-with-determining-why-my-xnor-transistor-circuit-is-not-behaving/491990#491990 or here https://electronics.stackexchange.com/questions/304642/ttl-nand-gate-totem-pole-current-and-voltage-analysis/304722#304722 – G36 Apr 12 '20 at 18:11
-
And using this we can build more complex devices e.g counters/registers and so on. But once we have it we can use it as building-blocks and treat them as a black-box. And we can go level-up in our abstraction and build much more sophisticated devices. And we do not need to go back to the BJT level. And we can focus on more building the CPU. – G36 Apr 12 '20 at 18:11
-
1There is a theorem from logic that NAND is functionally complete. Any logic function can be realized from a combination of NAND gates (or NOR gates). You are correct that AND, by itself, is incomplete. A NAND gate is built from 4 transistors (same for NOR). NAND gates can also be combined to make flip-flops. Once you have flip flops and logic, you can make a very simple microprocessor. You would rely on hard-wired ones and zeros to get it to start in a known state. – user57037 Apr 12 '20 at 22:51
-
Modern performance processors typically have very large cache memory capacity on chip, and the area of the microchip dedicated to cache is very large. More than half the area is likely devoted to cache. Maybe even more (my memory is fuzzy on this and I am too lazy to research it). – user57037 Apr 12 '20 at 23:00
-
2Other transistors control the transistors. It's circular once you jump start things. Like an engine after you jump start it. Once it is running, the engine makes ignites fuel and makes explosions to spin. What keeps the engine running? The explosions themselves keep the engine running by driving the carbuerator and valves. Once you get it going, it keeps itself going in a circular fashion. This sounds like a duplicate of this question: https://electronics.stackexchange.com/questions/455897/how-does-a-computer-chip-read-code-interpret-it-and-convert-it-into-action/455898#455898 – DKNguyen Apr 12 '20 at 23:55
-
1"How does a microprocessor control its transistors?" is like "how does a human control their cells?" - it doesn't, and the question doesn't make much sense. How do you control your cells? – user253751 Apr 13 '20 at 00:02
-
How does a brain control its neurons? It can't just let the neurons do whatever they want, can it? – user57037 Apr 13 '20 at 00:31
-
1@mkeith The government! If tin foils hats were really effective, you would drop dead when you put one one because nothing is there anymore to control the neurons. – DKNguyen Apr 13 '20 at 00:34
-
1You **must** read: [Code: The Hidden Language of Computer Hardware and Software by Charles Petzold](https://amzn.to/34wOzqo). It provides one of the best explanations I have ever read that starts with very simple principles and makes its way to transistors, gates, CPUs, programming. Absolutely incredible. It **will** make sense after reading this book! – manassehkatz-Moving 2 Codidact Apr 13 '20 at 01:14
-
@DKNguyen thanks, you're right, that question is basically asking the same thing – Oliver Walters Apr 13 '20 at 08:26
5 Answers
There is nothing below transistor. The transistor IS the fundamental building block.
Transistors are used to form gates, and gates are used to build memory and logic, including the finite state machine that constitutes the CPU.
When the CPU runs, it fetches data from memory, and some of that data is actually instructions that tell the CPU what to do next.
If you really want to dig into this at the transistor level, you might find the following sites interesting:
- Visual 6502 - a simulation of the transistors as laid out on the silicon chip.
- Monster 6502 - a discrete transistor implementation of a 6502 on a large PCB.

- 168,369
- 17
- 228
- 393
-
-
3I don't think it is helpful to mention that transistors are made of atoms. And besides, atoms are made of subatomic particles, so why stop there. – user57037 Apr 13 '20 at 00:32
Well, the transistors are controlled by the laws of physics. But I'm guessing that's not what you meant.
I think what you're asking is, "What tells the transistors what to do?" And the answer is... transistors. Each of the transistors on a CPU is controlled by the other transistors. What controls those transistors? More transistors. A CPU has lots and lots and loops, where (for example) one transistor is controlled by a second transistor which is controlled by a third transistor which is controlled by the first transistor again.
How does a transistor know which other transistors it should listen to? It's literally set in stone; each transistor is physically connected to a certain set of other transistors, and it will always listen to those transistors and only those transistors. How does a transistor know what to do in response to the signals it's receiving? Once again, it's literally set in stone; each transistor has only one logical operation that it executes, and it will always execute that operation and only that operation.
In other words, a transistor is not programmable. A transistor only does one thing, and there's no way to control a transistor so that it does something else instead.
But, as you've noticed, there's an obvious paradox here:
- CPUs are programmable.
- Transistors are not programmable.
- CPUs are made entirely out of transistors.
How can a network of transistors, which only does one thing and can never do anything else, make up a CPU, which can do an endless variety of different things?
The answer is that actually, a CPU does merely do the same thing over and over again, and can never do anything else... but the one single thing that it does is cleverly designed to be useful for executing a variety of programs.
A CPU can be made out of the following components:
- A collection of data buses, which are merely collections of wires that can be used to transmit data.
- A collection of registers, which store data. They receive control signals from the instruction decoder, and data from the data buses.
- An instruction decoder. This reads an instruction from a register and translates it into a collection of control signals.
All three of these components are "dumb" components which blindly perform the same task over and over again. Notice that the registers are controlled by the instruction decoder, and the instruction decoder is controlled by the registers!
These components are all you need to build a CPU that's capable of executing program code.

- 2,991
- 12
- 21
-
1In other words: The CPU is always executing `if instruction==5 then {c=a+b}; if instruction==6 then {c=a-b}; if instruction==7 then {a=c;}` etc. You can't stop it from executing that, and you can't change it, because you can't un-wire and re-wire the transistors. But you can choose the instruction – user253751 Apr 13 '20 at 11:27
Transistors are effectively the fundamental building block of a processor. However I think you are asking how the transistors themselves are controlled to achieve the higher level functions of the CPU. For example executing opcodes (fundamental machine instructions) e.g. like adding a number into an 32 bit register-"ADD EAX, 14" on x64.
The mapping of these opcodes to form the "wiring" of the transistors can be achieved through Microcode written by the CPU designers. This is the lowest level of programming driving the behavior of the transistor groupings. Beneath this level functionality is achieved in the hardware by groups of transistors acting in concert e.g. adder circuitry see https://en.wikipedia.org/wiki/Adder_(electronics)

- 1,476
- 9
- 12
-
Microcode is interpreted by transistors (of course) and simpler CPUs don't have microcode. If you say code is interpreted with microcode then you have to say how the microcode is interpreted, because it isn't turtles all the way down. – user253751 Apr 13 '20 at 00:04
-
1"Microcode" is probably a poor name for it although it might be cross-compiled on a specific development platform that supports the CPU in question. Putting that to one side essentially Microcode maps the opcodes directly onto the hardware in the CPU. This might be helpful l https://en.wikipedia.org/wiki/Microcode. Nice TP reference! – mhaselup Apr 13 '20 at 00:20
-
So the code controls the CPU because it's interpreted by microcode... how does the microcode control the CPU? – user253751 Apr 13 '20 at 00:28
-
If you are really interested in that level of detail try reading the book referenced on this article https://www.nytimes.com/1981/08/23/books/the-hardy-boys-and-the-microkids-make-a-computer.html. Find the section in the book on the "Microkids". – mhaselup Apr 13 '20 at 01:24
-
But that is what this question is about. You haven't answered the question, you've just added another layer of abstraction. The question *is about* that level of detail! – user253751 Apr 13 '20 at 11:24
-
The opcodes are physically "wired" to the transistor structures within the CPU. So execution of a particular opcode drives a sequence of digital operations in the CPU. The opcode is at the bottom of the programmable stack in programming terms, after that it's all electronic operations in the digital domain. The reason a CPU does anything useful is that the program data provided with the opcodes drives a useful outcome. – mhaselup Apr 13 '20 at 12:56
Think of the transistors, or maybe the logic switches, a bit like dominoes setup ready to fall on each other when they are knocked. Your program is the particular arrangement of those dominoes, and your data is like the finger that starts the sequence at a particular location. Your output is the resultant pattern of the dominoes that fell (and those that didn't)

- 284
- 1
- 3
Transistors are combined to logical gates and memory cells
Logical gates are combined to arithmetic and logical operators ->(Arithmetic Logical Unit, ALU)
Memory cells are combined to registers and RAM.
Logical gates are as well combined to a control unit. It decodes instructions (your program) and "wires" the right registers to the input of the ALU. This control unit is what you are asking for. So in the end - transistors control transistors =)

- 330
- 1
- 7