Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

KCA 101

Lec. (4)

IMSEC, GHAZIABAD
Dept of MCA

The central processing unit(CPU).


The brain of any computer system is the CPU. It controls the functioning of the other
units and process the data. The CPU is sometimes called the processor, or in the personal
computer field called “microprocessor”. It is a single integrated circuit that contains all the
electronics needed to execute a program. The processor calculates (add, multiplies and so
on), performs logical operations (compares numbers and make decisions), and controls the
transfer of data among devices.

The processor acts as the controller of all actions or services provided by the system.
Processor actions are synchronized to its clock input. A clock signal consists of clock cycles.
The time to complete a clock cycle is called the clock period. Normally, we use the clock
frequency, which is the inverse of the clock period, to specify the clock. The clock frequency
is measured in Hertz, which represents one cycle/second. Hertz is abbreviated as Hz.
Usually, we use mega Hertz (MHz) and giga Hertz (GHz) as in 1.8 GHz Pentium. The
processor can be thought of as executing the following cycle forever:
1. Fetch an instruction from the memory,
2. Decode the instruction (i.e., determine the instruction type),
3. Execute the instruction (i.e., perform the action specified by the instruction).

Execution of an instruction involves fetching any required operands, performing the


specified operation, and writing the results back. This process is often referred to as the fetch-
execute cycle, or simply the execution cycle. The execution cycle is repeated as long as there
are more instructions to execute. This raises several questions. Who provides the instructions
to the processor? Who places these instructions in the main memory? How does the processor
know where in memory these instructions are located?
When we write programs—whether in a high-level language or in an assembly language
— we provide a sequence of instructions to perform a particular task (i.e., solve a problem).
A compiler or assembler will eventually translate these instructions to an equivalent
sequence of machine language instructions that the processor understands. The operating
system, which provides instructions to the processor whenever a user program is not
executing, loads the user program into the main memory. The operating system then indicates
the location of the user program to the processor and instructs it to execute the program.
The actions of the CPU during an execution cycle are defined by micro-orders issued by
the control unit. These micro-orders are individual control signals sent over dedicated control
lines. For example, let us assume that we want to execute an instruction that moves the
contents of register X to register Y. Let us also assume that both registers are connected to the
data bus, D. The control unit will issue a control signal to tell register X to place its contents
on the data bus D. After some delay, another control signal will be sent to tell register Y to
read from data bus D.
The CPU can be divided into a data section and a control section. The data section, which is
also called the datapath, contains the registers (known as the register file) and the ALU.
Control Section has Control unit.

The components of CPU.


A typical CPU has three major components:

(1) register set,

(2) arithmetic logic unit (ALU),

(3) control unit (CU).

(1) Registers/ Register set

Registers are small amounts of high-speed memory contained within the CPU. They are
used by the processor to store small amounts of data that are needed during processing,
such as:
 the address of the next instruction to be executed
 the current instruction being decoded
 the results of calculations
Different processors have different numbers of registers for different purposes, but most
have some, or all, of the following:

 program counter
 memory address register (MAR)
 memory data register (MDR)
 current instruction register (CIR)
 accumulator (ACC)

(The register set differs from one computer architecture to another. It is usually a
combination of general-purpose and special purpose registers. General-purpose registers are
used for any purpose, hence the name general purpose. Special- purpose registers have
specific functions within the CPU. For example, the program counter (PC) is a special-
purpose register that is used to hold the address of the instruction to be executed next.
Another example of special-purpose registers is the instruction register (IR), which is used to
hold the instruction that is currently executed. Figure 1 shows the main components of the
CPU and its interactions with the memory system and the input/output devices.)
Memory System

Instructions Data

Input / Output

Figure 1: Central processing unit main components and interactions with the memory
and I/O.

2) Arithmetic logic unit(ALU)

The ALU performs calculations and makes logical decisions.

It has two main functions:

 It performs arithmetic and logical operations (decisions). The ALU is where


calculations are done and where decisions are made.
 It acts as a gateway between primary memory and secondary storage . Data
transferred between them passes through the ALU.
 The ALU provides the circuitry needed to perform the arithmetic, logical and shift
operations demanded of the instruction set. The control unit is the entity
responsible for fetching the instruction to be executed from the main memory and
decoding and then executing it.
(The datapath is capable of performing certain operations on data items. The register file can be thought of
as a small, fast memory, separate from the system memory, which is used for temporary storage during computation.)

3) Control Unit
The CU provides several functions:

 it fetches, decodes and executes instructions(executing the program instructions, which are stored in the


main memory.)

 it issues control signals that control hardware


 it moves data around the system
 It can be thought of as a form of a “computer within a computer” in the sense that it makes
decisions as to how the rest of the machine behaves.
(Like the system memory, each register in the register file is assigned an address in sequence starting
from zero. These register “addresses” are much smaller than main memory addresses: a register file
containing 32 registers would have only a 5-bit address, for example. The major differences between the
register file and the system memory is that the register file is contained within the CPU, and is therefore
much faster. An instruction that operates on data from the register file can often run ten times faster than the
same instruction that operates on data in memory. For this reason, register-intensive programs are faster than
the equivalent memory intensive programs, even if it takes more register operations to do the same tasks that
would require fewer operations with the operands located in memory.)

Fig2: CPU Components and their relationship

You might also like