Monday, May 16, 2016

CPU ( ALU ,Control Unit and Registers )

A central processing unit (CPU) is the hardware within a computer system that carries out the instructions of a computer program by performing the basic arithmetical, logical, and input/output operations of the system.


In addition to executing a program, the CPU is also responsible for keeping an eye over system functions, for executing scripts, and for making complex calculations, which are often used in software rendering. CPUs also initiate transfer of large blocks of data, as well as read or write data to and from peripheral devices, such as CDs, DVD, USB drives, etc. Since, the CPU is responsible for practically all the processes running in the computer, it is only acceptable to state that the faster the CPU is, the faster the applications can run. However, a very large CPU is also not necessary for most home computers, as many of us do not run that many programs at a single time.

There are Three typical components of a CPU: arithmetic logic unit (ALU) , the control unit (CU) and registers .

CPU= ALU + Registers + Control Unit 


ALU (Arithmetic Logic Unit ) integrated circuit within CPU or GPU that performs arithmetic and logic operation.
Arithmetic Operation Like Addition , Subtraction and Shifting operation.
Logic Operation  Like AND , OR and XOR.



Control Unit  is the circuitry that controls the flow of data through the processor and coordinates the activities of the other units within it .



There are eight types of registers :

1-  Program Counter 
  • Most Important CPU Register.
  • Hold the address of the next instruction in programming memory space.
  • Size (Width) of program counter is directly related to the size of the Micro-controller program memory. 


2- Instruction Register 

  • Contain the next instruction (Op-Code) to be decoded by the instruction decoder.

3- Instruction Decoder
  • Take Op-Code stored in instruction register and decodes it then tell CPU what to do for it.

4- Stack Pointer 
  • Is basically a register that hold either :
  1. The memory address of the last location on the stack where data store.
  2. The memory address of the next available location on the stack to store data.  

5- Status Register
  • Contains Flags Represent the status of the last operation to control the following instructions
- Overflow Flag : Indicates that the result is too large to fit in the register width.
- Negative Flag : Indicates that the result is negative.
- Zero Flag : Indicates that the result was zero.
- Carry Flag : Indicates a carry in the last arithmetic or  logical operation.
- Half Carry Flag : Indicates that a bit carry was produced between 4-bit halves of a byte operand as a result of the last arithmetic operation.
- Global Interrupt Mask



6- Index Register 

  • Index Register used in indirect addressing modes as the accessed address.



7- Accumulator Register 
  • Accumulator is a register which intermediate arithmetic and logic result are stored.

8- General Purpose Register 
  • Available to store any transient  data required by the program.
  • In general the more registers a CPU has available , faster it can work.

Share this

0 Comment to "CPU ( ALU ,Control Unit and Registers )"

Post a Comment