Sunday, 11 January 2015

CENTRAL PROCESSING UNIT

 Main Components and Structure of the Central Processing Unit

What does the CPU do?:
Carries out instructions and tells the rest of the computer system what to do. This is done by the Control Unit of the CPU which sends command signals to the other components of the system.
Performs arithmetic calculations and data manipulation, e.g, comparisons, sorting, combining, etc. The computer's calculator is a part of the CPU known as the Arithmetic Logic Unit.
Holds data and instructions which are in current use. These are kept in the Main Store or Memory.
To understand how the whole system works, consider the diagram shown below. This diagram shows the basic components of a generalised CPU. An actual CPU may have these components, or other with different names that provide the same functions.

Central Processing UnitInputControl UnitArithmetic Logic UnitMemory UnitOutputBacking Storage

                                                                                                                                                                 
 Control Unit
The control unit directs the entire computer system to carry out stored program instructions.
The control unit must communicate with both the arithmetic logic unit and main memory.
The control unit uses the instruction contained in the Instruction Register to decide which circuits need to be activated.
The control unit co-ordinates the activities of the other two units as well as all peripheral and auxiliary storage devices linked to the computer.
The control unit instructs the arithmetic logic unit which arithmetic operations or logical operation is to be performed.
The control unit is literally in control.


Specialised electronic circuitry in the control unit is designed to decode program instructions held in the main memory. Each instruction is read from the memory into the instruction register. The process of reading an instruction, is often referred to as the fetch-execute process.

 Arithmetic Logic Unit
The arithmetic logic unit executes arithmetic and logical operations.
Arithmetic operations include addition, subtration, multiplication and division.
Logical operations compare numbers, letters and special characters.
Comparison operations test for three conditions:
equal-to condition in which two values are the same
less-than condition in which one value is smaller than the other
greater-than condition in which one value is larger than the other
Relational operations (=, <, >) are used to describe the comparison operations used by the arithmetic logic unit.
The arithmetic logic unit performs logic functions such as AND, OR and NOT.


The accumulator is used to accumulate results. It is the place where the answers from many operations are stored temporarily before being put out to the computer's memory.
The other general-purpose registers hold data on which operations are to be performed by the arithmetic logic unit.

 Memory Unit
The Memory Unit is the part of the computer that holds data and instructions for processing.
Although it is closely associated with the CPU, in actual fact it is seperate from it.
Memory associated with the CPU is also called primary storage, primary memory, main storage, internal storage and main memory.
When we load software from a floppy disk, hard disk or CD-ROM, it is stored in the Main Memory.
There are two types of computer memory inside the computer, RAM and ROM.

RAM
RAM stands for Random Access Memory.
This is really the main store and is the place where the programs and software we load gets stored. When the Central Processing Unitruns a program, it fetches the program instructions from the RAM and carries them out.
If the Central Processing Unit needs to store the results of calculations it can store them in RAM.
Random Access Memory can have instructions READ from it by the CPU and also it can have numbers or other computer data WRITTENto it by the CPU.
The more RAM in your computer, the larger the programs you can run.
When we switch a computer off, whatever is stored in the RAM gets erased.
The following is a photo of a common RAM chip.

ROM
ROM stands for Read Only Memory.
The CPU can only fetch or read instructions from Read Only Memory (or ROM). ROM comes with instructions permanently stored inside and these instructions cannot be over-written by the computer's CPU.
ROM memory is used for storing special sets of instructions which the computer needs when it starts up.
When we switch the computer off, the contents of the ROM does not become erased but remains stored permanently. Therefore it is non-volatile.

The following is a diagram showing the relationship between the Central Processing Unit and the Main Memory (RAM and ROM).


    
 How the CPU works

The CPU is centrally located on the motherboard. Since the CPU carries out a large share of the work in the computer, data pass continually through it. The data come from the RAM and the units (keyboard, drives, etc.). After processing, the data is sent back to the RAM and the units.
The CPU continually receives instructions to be executed. Each instruction is a data processing order. The work itself consists mostly of calculations and data transport.

The Instruction-Execution Cycle
Many types of personal computers can execute instructions in less than one-millionth of a second; supercomputers can execute instructions in less than one-billionth of a second.
The CPU performs four steps in executing an instruction:
  1. The control unit gets the instruction from memory.
  2. The control unit decides what the instruction means and directs the necessary data to be moved from the memory to thearithmetic logic unit.
  3. The arithmetic logic unit performs the actual operation on the data.
  4. The result of the operation is stored in memory or a register.
The first two instructions make up what is called the instruction time. The last two instructions make up what is called the execution time.
The combination of these two is called a machine cycle.
Each central processing unit has an internal clock (or system clock), which produces pulses at a fixed rate to synchronise all computer operations. A single machine cycle instruction is made up of a number of subinstructions, each of which must take at least one clock cycle.
Each type of CPU is designed to understand a specific group of instruction called the instruction set.

How the CPU finds Instructions and Data
The location in memory for each instruction and each piece of data is identified by an address, or a number that stands for a location in the computer memory.
An address may be compared to a mailbox in everyday life, except that the address can hold only one item - a fixed amount of data, a number or a word - at any one time.

The following is an example of a simple case of adding two numbers together and placing the result in a location X.
The command executed is - Let X = N1 + N2. See the diagram below.

Adding 2 Numbers



No comments:

Post a Comment