• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

What happens inside a CPU?

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

KeystoneKeygen

New Member
Joined
Jul 19, 2011
When electric binary code gets to the CPU does it go through logic gates and/or arrays/configurations of logic gates?

What are the instructional capabilities of a 1-bit and 2-bit processor? :-/
 
If you are asking these questions, and you are young, you should become a computer engineer. Now to answer your questions. I will keep them simple, and can go more in depth if you want me to. Also I have been writing an article that talks about CPUs to great detail and about how they wrok.

First the inside of a CPU:

The short version:

Silicon plater houses billions of transistors, those transistors make up logic gates, those logic gates can be sectioned off to house particular parts of a CPU ie Flash, ALU, Fetch, etc. From there, the flow of data (interpretted by electrical signals of on and off that are translated by the logic gates) will go through the 4 basic stages of a CPU: Fetch, Decode, Execution, Memory, and Write Back. In these 4 stages, the CPU will complete fullfil a task or command.

The long version:

To first think about a CPU, you have to get on the nano level. The CPU is comprised of Billions of transistors that sit on a silicon platter. These transistors will be linked together so that they start to create logic gates. Logic gates are basically truth tables, when a 0 or 1 (off or on) is passed through a logic gate, based on what type it is, the logic gate will either spit out a 0 or 1. For example, OR logic gate will take in a 2 bit logic. Lets say a 0 and 1 are passed into the OR gate, the output would be 1.

So how does this help with creating a section of a CPU, such as the ALU? Now I really wish I was still back at school, because than I could bring up a picture of one of my past projects where I made a simple ALU. But to help a bit with the represintation here is refrence picture:

1-bit-alu.gif

In this pciture, we can see a simple 1-bit ALU. This does not have the same capacity of those found in your modern day processors. In fact it can only take in two bits and add them or subtract them. Now if you were to stack these 1-bit ALUs we can start to perform longer instructions. Here is an 8-bit ALU stacked with 1-bit ALUs

8-bit-alu2.jpg

Now you should be able to see the pattern with logic gates. It brings in an instruction than outputs it according to variables set. The variables set, are determined by the Fetch and the Decode. A CPU is comprised of 4 basic stages to process an instruction: Fetch, Decode, Execute, Memory, and Write Back. The Fetch stage recieves an instruction from outside the CPU. After putting it into a Que, the Decode will than pickup the instruction. In there the Decode will decide what the Execution unti will have to do in order for instruction to be processed, and will handle how much memory space is needed. For example, lets say that a 2+2 instruction was sent to the CPU. The Decode will see that the Execution will need 2 spaces of memory, and that it will need to perform an addition. Once the Decode sends this packet to the Execution unit, the Execution will than retrieve the information of the data from memory, and apply an addition operation to the instruction. After it has done this, the Memory unit will take the outcome and store it into Memory. That memory is usually L1, L2, and L3. The Write back stage is when the instruction is finally commited to the program. This is the part when the CPU finally spits it back out to which ever component initially asked for this to happen.

Wow, that is sure a lot to process. And this is only the tip of the iceburg :D

To understand more about how a CPU executes instructions read up on RISC Architecture, and Tomasulo's Algorithm. Tom's Algo is what modern day Processors are based on. If you have not taken a basic Microcontroller class yet, I would read up on all the different parts and understand registers, memory banks, etc before trying to understand Tom's Algo.


Refrences and Helpful reads:

Logic Gates
http://mark.stosberg.com/Tech/alu/
Computer Architecture A Quantitative Approach by John L. Hennessy and David A. Patterson. Fourth Edition.
 
As for your 1-bit and 2-bit Processors. This term indicates the limit of the operations it can perform. For example, a 1-bit Processor can only perform 2 operations, and a 2-bit processor can only perform 4 operations. An 8-bit processor can perform 256 operations.
 
As for your 1-bit and 2-bit Processors. This term indicates the limit of the operations it can perform. For example, a 1-bit Processor can only perform 2 operations, and a 2-bit processor can only perform 4 operations. An 8-bit processor can perform 256 operations.

Not quite. The bit width of a processor refers to its datapath width. Width of memory bus and registers, etc. Basically how many bits it can naturally work with at a time.

It has nothing to do with opcode (instruction) length. Most CPUs have variable opcode lengths that are different from CPU bit width.
 
I couldn't remeber if it was what you said or the opcode. Its been sometime since I've worked with Micorcontrollers, and especially with something that was not in the 16/32bit range.
 
Back