How does a processor actually interpret instructions?

tphp

New Member
First post here but a question I've been seeking an answer to for some time...

How exactly does the logic circuitry inside a processor interpret code...I guess at the lowest level being microcode. When an instruction explicitly asks for some microcode to be executed, how does that happen? How does microcode, or even binary strings actually turn into voltages inside the processor? I understand logic and boolean equations and I also understand how higher-level languages get turned into asm, and then asm is interpreted by microcode, I just don't understand how the actual zeros and ones turn into a voltage.
 
The 0's and 1's in the system are represented by high's and low's, periods of voltage or no voltage. The best analogy I can think of is a light switch, flip it on, the light lights up (1), flip it off the light goes out (0). The microcode, via registers, gates and other circuitry is used to basically flip switches in a specific pattern that is then interpreted as instructions.
 
not 1's and 0s but hex machine language opcodes that are fed to the device, to perform addition/subtraction and such, there are books upon books of instructions and instruction sets that these devices can do.
 
The 0's and 1's in the system are represented by high's and low's, periods of voltage or no voltage. The best analogy I can think of is a light switch, flip it on, the light lights up (1), flip it off the light goes out (0). The microcode, via registers, gates and other circuitry is used to basically flip switches in a specific pattern that is then interpreted as instructions.

I understand how transistors work and logic, but what I'm asking is what is the actual mechanism that recognizes a 0 or a 1 and turns it into a voltage. How does the cpu know that the actual character '1' is being sent and how does that character actually become a voltage inside the cpu?


Sorry if this sounds a bit vague but I can't really think of another way to word it.
 
I understand how transistors work and logic, but what I'm asking is what is the actual mechanism that recognizes a 0 or a 1 and turns it into a voltage. How does the cpu know that the actual character '1' is being sent and how does that character actually become a voltage inside the cpu?


Sorry if this sounds a bit vague but I can't really think of another way to word it.

You have it backwards. A 0 or a 1 is simply a representation of two logic states. You could call it on, off; up, down; left, right and so on. In a basic computer hard drive the binary state is held magnetically, which is converted to electrons at relatively different voltages. That causes transistors to behave in switch like fashions. Thus the logic that BIOS, OS and drivers etc use to make decisions.
 
I understand how transistors work and logic, but what I'm asking is what is the actual mechanism that recognizes a 0 or a 1 and turns it into a voltage. How does the cpu know that the actual character '1' is being sent and how does that character actually become a voltage inside the cpu?


Sorry if this sounds a bit vague but I can't really think of another way to word it.

they answered right. voltage for one is generated or nothing is a zero. The binary is added like in a 4 bit nibble or 1 byte or several bytes. The processor will make the calculation. the voltage (a one) will become a weight and be calculated for the instruction to be executed. Or a zero.
 
Last edited:
One thing I find amazing is how many transistors there are in modern day processors. Transistors create the on and off for central processing units. My current processor is a Phenom II 945 processor (it has 45 nanometer technology). It has close to 758 million transistors in it.

The Intel Core i7 980X Six-Core central processing unit has close to 1,170 million transistors in it.

These central processing unit chips are also about the size of a thumbnail.
 
/me slides this under the door and wanders out...

http://pastraiser.com/cpu/i8088/i8088_opcodes.html

While those are all valid instructions, and interesting in their own right, they don't really tell you how, for example, "mov eax, 18" turns the mov command into put voltage into the eax register to represent 18.

Realistically, when you type in code, it never exists the way you see it on screen. Your keyboard is just a device that produces particular electrical signals. It only ever exists as a series of on and off switches. All the complier/assembler/etc is doing is converting long sets of switches (i.e. whatever x = x + 1 looks like as a chain of ons/offs) into a set the computer understands. And instead of physical switches you have to flip on and off yourself we use a computer to turn them on and off really fast.

Everything that happens on a CPU works by applying voltages to the correct pins to make something go. When you write code you are actually writing electrical signals that someone has figured out how to make look like code.
 
One thing I find amazing is how many transistors there are in modern day processors. Transistors create the on and off for central processing units. My current processor is a Phenom II 945 processor (it has 45 nanometer technology). It has close to 758 million transistors in it.

The Intel Core i7 980X Six-Core central processing unit has close to 1,170 million transistors in it.

These central processing unit chips are also about the size of a thumbnail.

Thats why they are called micro chips.
 
While those are all valid instructions, and interesting in their own right, they don't really tell you how, for example, "mov eax, 18" turns the mov command into put voltage into the eax register to represent 18.

Realistically, when you type in code, it never exists the way you see it on screen. Your keyboard is just a device that produces particular electrical signals. It only ever exists as a series of on and off switches. All the complier/assembler/etc is doing is converting long sets of switches (i.e. whatever x = x + 1 looks like as a chain of ons/offs) into a set the computer understands. And instead of physical switches you have to flip on and off yourself we use a computer to turn them on and off really fast.

Everything that happens on a CPU works by applying voltages to the correct pins to make something go. When you write code you are actually writing electrical signals that someone has figured out how to make look like code.

But code is required to talk to the cpu...cant exactly hardwire them nowadays...i mean i wrote my SSID to a memory module using a shift register... but programming a processor like that is another matter all together.

Thats why they are called micro processors.

-fix'd
 
Last edited:
thats what the cpu does. Op codes are the instructions from the cpu. then the op codes or hex is acted upon based off the instruction set for the cpu. then the instruction are generated and acted on. thats what the operating system does. it does it and what it wants for the window environment. and all the programs you use that are free or buy.
best bet to get all the answers will not be from a conversation. You need to buy a book.
Wrox publishing was always a good one. if ya want to get technical. A lot to it and complicated. If ya buy a book then read the preface from the author. Who is he catering too. Beginner, beginner intermediate or advanced. its associated with machine assembly, assemblers and debuggers to step through the process and fix it. And then its which language you want to use to build on it.
 
Last edited:
True. the voltage is interpreted as binary. thats the electrical part of it. (on or off).
 
Last edited:
If you zoom in, I'm pretty sure you won't see opcodes represented as text floating in the wires :-)
This.
But code is required to talk to the cpu...cant exactly hardwire them nowadays...i mean i wrote my SSID to a memory module using a shift register... but programming a processor like that is another matter all together.



-fix'd

Code is just a tool to make it easier for us. The thing with programming computers now is you have a lot of tools that have been built upon time and time again to make it easier.

For a simplier example, look at your keyboard, each key press shorts some contacts so that it sends a voltage across the bus, it's not sending the actual letters.
 
All hardware on a windows pc for example has a hardware abstraction layer which allows user friendly inputs and outputs to be converted into hardware direct inputs and outputs. Research HAL.
 
All hardware on a windows pc for example has a hardware abstraction layer which allows user friendly inputs and outputs to be converted into hardware direct inputs and outputs. Research HAL.

Good evening, you called?

hal9000.jpg
 
Back
Top