How are individual bits controlled inside of a CPU?

327 views

I know there are transistors to represent 1 and 0 (on and off), and I know that assembly is the lowest human-readable level you can get to telling the CPU exactly what to do. Any and all processes between that are an enigma to me, and I would love to know how it works.

In: 35

10 Answers

Anonymous 0 Comments

You should think of the internals as “gates” more than 0s and 1s. That’s something humans see and think to better understand this, but what is inside the CPU is all electrical signals that are controlled using gates. There are many many sections to a CPU internally – in particular modern CPUs are quite complex. Each section is a “simple” electronic circuit controlled by an input gate. For instance there are parts of a CPU that hold values (registers), and another part that does arithmetic. By setting the gate to read from a register and another that tells the ALU to add that to a value in the ALU, two control signals are sent to the gates of these items, “turning them on” while keeping the rest off. This is extremely simplified – watch videos, read books, take a free course to get the details.

Machine code (assembler is for humans – you translate that into machine code using a computer we often call “an assembler”) basically represents patterns that turn these switches on/off. So a “value” (op-code) is just a set of bits, which will turn on/off sections of the CPU which causes it to do something.

It doesn’t know anything. Electricity flows through these gates and we have made software that creates “human output” from these electrical signals that look like numbers, letters or graphical interfaces. The CPU has no idea it’s doing this. It’s just electricity.

The basic building blocks are gates. Yes, transistors are used to build gates but it’s not “one transistor one value”. It’s quite a bit more complex, so it’s more correct to talk about circuits.

As you can see, the instructions at this level are very simple when looked at this way. Modern processors have complex instructions, or you can stick to the risc processors and each instruction is extremely simple but very fast to execute. It’s “load this number”, “add 5 to register A”, “jump to address X if value is 0” – very very simple stuff, and a lot of bit magic (algorithms).

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