Assembly Language - CPU architecture

Assembly Language - CPU architecture


                  Welcome guys in this post, we are going to learn two things which are important in order for us to understand the CPU behavior and also this is the prerequisite to learn the assembly language.

                   But first what do you guys think is the fastest thing in our computer, well some might say its the RAM even my little brother who is into computer thinks the same way.

                   But the fastest thing in our computer is the CPU (microprocessor) then comes your cache and at last comes your main memory which is your RAM


Assembly Language, Reverse Engineering, Binary Exploitation

So the two things I am going to talk in this post are:-

  • System Organization 
  • CPU

So lets talk about the System Organization,

System Organization:-

Assembly Language, Reverse Engineering, Binary Exploitation

  • Well system organization is just the way your system is organized.
  • As you can see in the above diagram the CPU, Main Memory (RAM), input/output devices are connected with each other via system bus.
  • You can imagine system buses as carrier because they carries the data and addresses. I will not go into much deeper but imagine them as real world example like your public transport bus and how they carry multiple people from one place to another
  • The main memory contains your program means when you run any program there is some space allocated for it in the memory. A program is just a set of instruction and the CPU executes those instruction.


Now lets talk about the CPU.

CPU (Central Processing Unit) :-

  • As I said earlier the CPU only executes the instruction. I mean it do more than that but for now only consider the way I say. I will go into deeper if it needs.
  • The CPU consist of four things shown in the diagram below


Assembly Language, Reverse Engineering, Binary Exploitation


1. Control Unit:-

A control unit perform following functions:-
  • Retrieve instructions from memory
  • Decode those instructions
  • load and store data to/from memory

2. Execution Unit:-

A Execution unit perform following functions:-
  • As its name suggest actual execution of instructions happens in this unit.
  • There is a part of this unit known as ALU (Arithmetic and Logical Unit) which executes all the arithmetic and logical instructions such as, addition, subtraction, multiplication, division, and, or, not etc.

3. Registers:-

  • Registers are internal memory locations used as 'variables' to store data in them.
  • This is the main part of our course and i will be discussing them in much detail in later part. 

4. Flags:-

  • This is also a register which has various flag such as carry flag, zero flag etc. And don't worry i will be discussing them in much detail in later part.
  • Just remember flags are sets and resets after each instruction being executed by Execution Unit.
That's it for the system organization and CPU working. As I already said i will be taking only important part so I just give you the simple explanation about these units.

Also the diagrams you see in these posts are my handmade simple drawings to give you the high level view about these concepts.

Now that's it for this post thank you and see you guys in the next post where we are going to learn the register organization.

Assembly Language - CPU architecture Assembly Language - CPU architecture Reviewed by h4kk4 on February 21, 2020 Rating: 5

No comments:

Enter your comments here if you need any help:

Powered by Blogger.