Eli5 What is the mechanism that physically puts voltages on wires in the CPU.

339 views

I have a fairly strong understanding of how code like C is compiled into machine code and how transistors form gates which can be put together to compute lots of operations which can eventually become a computer. Say you have a machine instruction that says to add the contents of register 3 and register 5 and put the result in register 6. What is physically putting the voltages on the transistors in a way that achieves the desired result given that nothing is flipping a mechanical switch?

In: 2

7 Answers

Anonymous 0 Comments

I assume you understand the basic function of a transistor.

A transistor is essentially a piece of wire that electricity can flow across. But it also has a third wire sticking out the middle of it, and depending on whether that third wire has a voltage applied, it “shuts off” the flow across the primary wire.

The way all computers function is that they are, rather simply, a *huge* mass of transistors arranged extremely cleverly. They are arranged in such a way that if you supply voltages into their input wires in an extremely specific pattern, they will cut each other off in a very precise, pre-planned way that results in a very specific pattern coming out the other end. Really, there is no “logic” being done here, it’s all hard-baked into the physical structure of the device. It will just naturally fall into that specific output when you apply the specific inputs based on its shape. All you have to do other than supply the inputs is supply power to the device.

So what something like a CPU *is*, is a carefully planned tangle of electricity pipes. They are meticulously designed with tons of foresight in such a way that, if you tickle the input pipes with voltage in a very specific pattern, all the transistors inside will add up and cancel out in just the right ways to cause a very specific, known output signal. Design your CPU with the ability to “understand” a whole range of inputs and you can create a very powerful computer. All you need is a list of magic patterns to feed into it one at a time that, when run in sequence, cause something useful to happen. AKA, code.

When you move the contents of one register to another, for example, what you’re doing is feeding into the processor the magic pattern that cause the transistors to freak out in just the right way that a perfect path of wires connecting the two registers together opens up. This will cause one register to take on the state of the other as the voltages equalize. The next instruction will close this pathway, trapping the voltage pattern in the register and thus locking in the new value. That physical path of wires connecting them continues to exist, but due to the clever design of the CPU, it’s always blocked by some mess of transistors, *somewhere*. The only way to fully open that particular path is to supply the magic combination that unlocks them.

You are viewing 1 out of 7 answers, click here to view all answers.