How a cpu works???

zaka100

W͂Oͨ̍̍̒̈́͛̕
Messages
762
Location
Birmingham, UK
Can anyone give me a simple explanation how a minimal cpu works? I want to know things like how does a ALU work and everything else. E.g, I want something a lot more detailed this:
260px-CPU_block_diagram.svg.png

but I dont want a whole book on it or an explanation talking about intel 8086 cpu's from 40 years ago or something ;)
 
Last edited:
I learnt this all in my Comptia cert, I cant remember now of the top of my head lol. Ill find my notes and post back later, unless someone does before me
 

I was going to upload a pic of my notes but they are really messy lol..

here's a link to a more accurate diagram; http://static.commentcamarche.net/en.kioskea.net/faq/images/KjBt8WVH4Epro7ik.png

Im finding it hard to think of how to explain how it all works..

The CPU basically has components inside it, a control unit with priortises data or instructions, a execution unit (or units if you have multiple cores) which processes the data or instructions and registers (L1 - L2 caches) that store frequently used data so it doesn't have to grab it from the RAM.

you have two types of units in the execution unit, ALU and FPU.
ALU (arithmetic logic unit) handles most processes, best suited to whole numbers.
FPU (floating point unit) handles less process and is really just designed to deal with real numbers (very large, small or precise numbers).

I cant explain what it means by numbers, but I just know ALU does most the work lol.

with a single core, you have one execution unit so it orders, executes and then selectively stores strings of instructions in the registers.

With a multi core, each core can handle incoming strings of instructions or data simultaneously, e.g. when one core is executing instructions the other core can be storing instructions in the registers and another core can be executing data.

This is why its much faster.

L1 - L3 caches in the CPU

The level 1 cache is the fastest and smallest memory, level 2 cache is larger and slightly slower but still smaller and faster than the main memory, level 3 cache (main CPU memory) again usually is larger and slightly slower again then 2 and 1.

Data gets stored in each cache based on how frequently used it is, so if its being used alot! itll stay closest to the EU so it can process the data the fastest which would mean it stays in cache 1, then it would be 2, then 3 (if the CPU has L3) then back to the RAM, then HDD...

I may have not made this clear but im trying to explain the best I can lol. I may of missed a thing or two, just ask me and I could try and explain further. :cool:
 
I was going to type stuff out, then remembered that there was a HUGE argument over an AMD lawsuit not too long ago and a lot of guys go into detail about how the CPU works. If you're reading for some reading and sifting through fanboy flame BS you can look at this thread.
 
you have two types of units in the execution unit, ALU and FPU.
ALU (arithmetic logic unit) handles most processes, best suited to whole numbers.
FPU (floating point unit) handles less process and is really just designed to deal with real numbers (very large, small or precise numbers).
Thanks for the info, I didn't know anything about fpu's until now, I guess thats why you have floats and ints in code :)
I was going to type stuff out, then remembered that there was a HUGE argument over an AMD lawsuit not too long ago and a lot of guys go into detail about how the CPU works. If you're reading for some reading and sifting through fanboy flame BS you can look at this thread.
Lol this is nothing got to do with AMD, I'm not even an AMD fanboy :p
I just want to know how the actual CPU works, tbh I need a bit more depth. I want to know how a CPU adds data (watching CPU building tutorials in minecraft helped my knowledge but if only it was using electricity instead of redstone :lol:)

Basically my project is that I want to build a minimal computer that has the power of like a pocket calculator. I want to also maybe print it out in pcb. I'm just doing this as a hobby btw
 
Last edited:
Well I didn't link for the AMD BS, just they go into great detail about the core definition, what integer cores, FPUs, and ALUs as well as the cache and such does.
 
Basically my project is that I want to build a minimal computer that has the power of like a pocket calculator. I want to also maybe print it out in pcb. I'm just doing this as a hobby btw

NP zaka.

Look at raspberry pi?
 
Pi runs a distro of Debian. Edison runs Linux. If you want to get really small, check this out.

Adafruit Pro Trinket - 5V 16MHz ID: 2000 - $9.95 : Adafruit Industries, Unique & fun DIY electronics and kits
or this
Arduino bootloader-programmed chip (Atmega328P) ID: 123 - $5.95 : Adafruit Industries, Unique & fun DIY electronics and kits To roll your own creation.
Or this
Arduino Micro without Headers - 5V 16MHz ATmega32u4 - Assembled ID: 1315 - $22.95 : Adafruit Industries, Unique & fun DIY electronics and kits
And finally this
DC Boarduino (Arduino compatible) Kit (w/ATmega328) [v1.0] ID: 72 - $17.50 : Adafruit Industries, Unique & fun DIY electronics and kits

All of this is open source so you can copy and modify to your heart's content. All of the Arduino data including layouts and schematics are at the Arduino website.
(No I don't work for Adafruit. It's just I won't refer some one unless I shop there. Check out SparkFun and Pololu. Careful at Pololu. It's a geeks candy store.)
 
Last edited:
Back
Top Bottom