Know Your Computer

PROCESSING


CPU Architechture

The CPU is acts as the 'brain' of the computer. The function of the CPU is to execute programs stored in the main memory by fetching instructions, examining them, and executing them one after the other. The CPU consists of a single control unit, an arithmetic logic unit (ALU), and registers.

Control Unit - is the part of the CPU that controls the actions of the other components so that instructions are executed in the correct sequence. It synchronizes all the processor's operations, both externally and internally. The control unit manipulates address, data, and control and is responsible for decoding the instructions. It controls the sequence in which instructions are executed and also controls the operations performed by the ALU.
Arithmetic/Logical Unit (ALU) - is the part of the CPU that performs arithmetic and logical operations. It performs manipulations of data: add, shift left/right, rotate, compliment. Using those basic functions, the CPU can perform more sophisticated tasks such as subtraction, multiplication and division.
Registers - allow for temporary storage of data for the ALU and keep track of important addresses, such as the next instruction to be executed and the location of an area of memory known as a stack. These registers are typically given names such as A, B, C to identify themselves. Most instructions in the microprocessor apply directly to these registers.

How does the CPU Work?

The CPU performs arithmetic and logical operations on data obtained from the memory or from different input devices. The CPU functions as directed by a set of instructions called a program. This program is either written in assembly language or in high level language. It is then translated to machine language by assemblers.

  • Machine Language - The binary representation of the instructions that a computer's hardware can perform.
  • Assembly Language - A low-level programming language in which a mnemonic is used to represent each of the machine language instructions for a specific computer.
  • High-Level Language - A computer language that is more understandable and closer to standard notations than assembler language.

    Machine Language
    Assembly Language
    High-Level Language
    100101
    ADD
    C ++
    110100
    SUB
    Fortran
    101001
    MPY
    Java

The program is passed on to the main memory of the computer, which is known as the Random Access Memory (RAM). Here, each instruction is given a unique address in the memory. The CPU accesses the data it wants by specifying the memory address of the data stored.

The data flows from the RAM to the CPU through an interface unit called data bus, which connects the CPU and the RAM. A processing unit inside the CPU called the instruction decoder then decodes the data before interpreting and implementing the software instructions. From the instruction decoder the data passes on to the ALU, which performs the necessary calculations.

Frequently accessed data is stored in temporary memory locations called registers. Registers are special types of memory, which are located inside the CPU for faster access of frequently used data. They are faster than the system RAM. The absence of registers would slow down the CPU operations because the CPU would repeatedly have to go all the way to the main memory and search for the necessary instruction to carry out the specified operations. A unit called the program counter is employed during this process to keep track of each successive instruction to make sure that the program instructions are followed by the CPU in the correct order.