First Year CH 3

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

CENTRAL PROCESSING UNIT

The Central Processing Unit (CPU) is the main part of the computer, which
performs all its activities. It is also called the processor or microprocessor and
is truly the “brain" of the computer system. It combines the circuitry that
generates all the control signals needed to execute instructions.

COMPONENTS OF CPU

Following are main components of CPU.

● ALU

● CU

● Registers

● Cache

● Internal Buses

Arithmetic Logic Unit (ALU)

Arithmetic logic unit (ALU) is the part of the CPU where the actual processing takes place. ALU is capable
of performing arithmetic, logical and data manipulation operations on data.

The ALU consists of logic circuitry that performs operations such as addition, subtraction, multiplication,
division, exponentials, data manipulations, comparison and logical operations such as AND, OR and NOT.

ALU is shown below.

Data Register (DR)

Arithmetic Logic Unit (ALU) Control Input

Accumulator Register (AC)

CH: 03 CENTRAL PROCESSING UNIT PAGE 1 OF 9


How ALU works?

Suppose we want to add two numbers 30 and 45. The ALU will perform the following steps to do this
addition.

1. The first number, 30 will be stored in the Accumulator Register (AC).


2. The second number, 45 will be stored in the Data Register (DR).
3. Control unit (CU) will send the command to add the numbers through the control input.
4. Two numbers. 30 and 45 will be added by the circuitry in the ALU.
5. The result 75 will appear at the ALU output and will be transferred to AC.
6. Finally, the result 75 will be sent to the main memory from AC.

Control Unit (CU):

Control unit directs and coordinates the activities of the entire computer system. It controls the working
of all the input/output devices, all the primary and secondary storage devices and the calculations
performed by the ALU. Control unit controls the operations of computer system based on the
instructions in the program by executing them in a proper order.

Instruction Register
Data Bus

Instruction Decoder

Control Bus

Timing & Control Logic

Control Unit consists of three main components Instruction Register, Instruction Decoder and Timing &
Control Logic.

Instruction Register Stores the instruction while it is being executed. Instruction decoder decodes
(translates) it and timing & Control logic generates the signals to execute it.

Cache Memory:

CH: 03 CENTRAL PROCESSING UNIT PAGE 2 OF 9


Cache memory is a very small amount of memory inside the microprocessor as shown in Fig. It is faster
than main memory but it is very expensive. It stores some active portion of main memory, which is
frequently required by the CPU.

Microprocessor

Main Memory Cache Memory

Data Bus

Internal Buses

A bus is a group of parallel wires used for transmitting data/information from one part of the computer
to another In other words; it provides a pathway for transmitting data/information among various
components of a computer. The buses that are found inside the CPU are known as internal buses. There
are three types of buses inside the microprocessor, which are address bus, data bus and control bus.

REGISTERS

Registers are used to quickly accept, store, and transfer data and instructions that are being used
immediately by the CPU. Registers used in the computer are divided into two types. General purpose
registers and special purpose registers.

General Purpose Registers

General-purpose registers are used to store data as well as addresses. These registers are used for
arithmetic data movement. Typically, these are 8 to 32 bit registers. Following are the commonly used
general-purpose registers.

Accumulator Register (AC)

The Accumulator is used to temporarily store data whilst calculations are being performed within
the Arithmetic Logic Unit (ALU)

Data Register (DR)

A data register is used in microcomputers to temporarily store data that is in the process of being
transferred from the memory to the central processor, or vice versa.

Base Register (BR)

CH: 03 CENTRAL PROCESSING UNIT PAGE 3 OF 9


It is used to hold a number that can be added to (or, in some cases, subtracted from) the address
portion of a computer instruction to form an effective address. it is also known as Index register.

Counter Register (CR)

It contains the address (location) of the instruction being executed at the current time. As each
instruction is fetched, the counter register increases its stored value by 1. After each instruction is
fetched, it points to the next instruction in the sequence.

Special Purpose Registers

These registers hold the state of a program. They include program counter. instruction register, memory
address register and memory buffer registers. These are used by Control Unit to control the operations
of CPU.

Instruction Register (IR)

Instruction register holds program instructions that are fetched from the memory for execution.
It holds the instruction while the instruction decoder circuit decodes it.

Memory Address Register (MAR)

Memory address register hold the address of memory location from where a memory word is to
be fetched or where data is to be stored.

Memory Buffer Register (MBR)

MBR stores the data being transferred to and from the immediate access store. It contains the
copy of designated memory locations specified by the memory address register.

Program Counter (PC)

A program counter (PC) is a CPU register in the computer processor which has the address of the next
instruction to be executed from memory. It is a digital counter needed for faster execution of tasks as
well as for tracking the current execution point.

Buses:

A bus is an electrical pathway inside the computer system over which data/information is transferred
from one part to the other. It connects CPU to the main memory on the motherboard. There are three
types of buses i.e. Address Bus, Data Bus and Control Bus.

Address Bus: It is a group of wires or lines that are used to transfer the addresses of Memory or
I/O devices. The address bus is unidirectional between the main memory and the processor.
Transfer of memory location
Main Memory Processor
Address Bus

CH: 03 CENTRAL PROCESSING UNIT PAGE 4 OF 9


Data Bus: As name tells that it is used to transfer data within Microprocessor and Memory/Input
or Output devices. Data bus is bidirectional. The bidirectional data bus allows the transfer of data
in both the direction

Transfer of data
Main Memory Processor
Data Bus

Control Bus: Microprocessor uses control bus to process data that is what to do with the selected
memory location. Some control signals are Read, Write and Opcode fetch etc.

Central Data Bus


Processing Unit Memory
Address Bus

Input / Output

System Buses
System Buses

INSTRUCTIONS:
An instruction (or instruction code) is a group of bits that tells the computer to perform a
specific operation. Instructions are stored in the main memory, waiting to be processed by the
processor. An instruction has two fields:

● Operation Code: It represents the action that the processor executes.

● Operand Code: It defines the parameters of the action. It depends on the


operation that can be data or a memory address.

Operation Code Operand Code

CH: 03 CENTRAL PROCESSING UNIT PAGE 5 OF 9


Modern computers support many types of instructions. Following are some general types of instructions
used in computers

● Data Transfer Instructions

● Data Processing Instructions

● Program Control Instructions

Data Transfer Instructions:

These instructions transfer data from one location to another location in the computer without
changing the data content. The most common transfers are between

● Register and Memory

● Registers and I/O

● Registers to Registers.

E,g. Move, LD(LOAD) and STO(STORE) etc.

Data Processing Instructions

These instructions are related to the arithmetic and logic operations. The arithmetic or logic
operations are performed on the values of two registers and the result is also placed in a register.
Data manipulation instructions can be divided into three basic types, i.e. Arithmetic, logical and
Shift instructions.

Program Control Instructions

Program control or transfer of control is a way of altering the order in which statements are
executed. There are a number of instructions used for this purpose like JMP (Jump) and LOOP
etc.

INSTRUCTION FORMATS:
Instruction format defines the layout of the instruction. It consists of two parts, an Op-Code (Operation
Code) and Operand.

● Op-Code

● Operand

Op-Code: is a group of bits that define various processor operations such as LOAD, STORE, ADD and
SHIFT

Operand: can be data, or can refer to data i.e. address of data.

CH: 03 CENTRAL PROCESSING UNIT PAGE 6 OF 9


Op-Code Operand

Example:

10010 0101000101110101

The Op-code (10010) specifies the code for ADD operation to be performed on the operand at the
address specified in Operand part. Some of the common instruction formats are

● Zero-Address Instruction

● One-Address Instruction

● Two-Address Instruction

Zero Address Instruction:

The Zero address instruction format requires only op-code, having no operand to work with. Example of
zero Address Instruction format is HALT, STOP. which do not have any address.

Op-Code

One Address Instruction:

One Address instruction format requires one op-code and one Operand. Example of the one address
instruction format is LDA (Load Accumulator), JMP (Jump) etc. These instructions require one address to
do the operation.
Op-Code Operand

Two Address Instruction:

Two Address instruction format requires one op-code and two Operand. Example of the two-address
instruction format is MOV (Move), which moves data from the memory location to the register and from
the register to the memory location. E.g. ADD A, B etc.

Op-Code Operand Operand

INSTRUCTION CYCLE

Instruction cycle is the basic operation cycle of a computer to execute various instructions. A computer
retrieves an instruction from its memory, determines what actions the instruction requires, and carries
out those actions by the process.
FETCH
Instruction

CH: 03 CENTRAL PROCESSING UNIT PAGE 7 OF 9

EXECUTE DECODE
Instruction Instruction
Following are the three main instruction cycle steps.

● Fetch operations

● Decode operation

● Execute operation

Fetch Operation

In this operation, the control unit fetches an instruction from main memory by sending an address
through address bus and a read command through the control bus. The fetch operation places the
instruction into the instruction register (IR) inside the microprocessor.

Decode Operation

In this step the instruction decoder decodes the instruction to determine what the instruction is
intended to do.

Execute Operation

Once the instruction has been decoded. it is to be executed. In this operation, the timing and control
logic circuitry in the control unit generates signals needed to execute the instruction

RISC VS CISC Architecture:

CISC stands for Complex instruction Set Computer. It is traditional architecture of CPU that supports a
large variety of instructions. CISC architecture is complex because of the instructions used at the
hardware level. Examples of CISC processors are the Intel 486 series and Pentium series.

RISC stands for Reduced Instruction Set Computer. It is considered as a new architecture of CPUs. RISC
architecture of CPU supports same size of instructions and it does not use indirect addressing mode. The
instructions of a CPU that uses RISC architecture are very simple and are executed very fast. Examples of
RISC processor are, IBM PowerPC. Sun SPARC, mobiles phones and tablet PCs.

The following are few differences between CISC and RISC architectures.

● CISC instructions utilize more cycles than RISC.

● CISC has way more complex instructions than RISC.

● CISC typically has fewer instructions than RISC.

● CISC implementations tend to be slower than RISC implementations. Computers typically use
CISC while tablets, smartphones and other devices use RISC.

INTEL AND AMD PROCESSORS

CH: 03 CENTRAL PROCESSING UNIT PAGE 8 OF 9


lntel and AMD (Advanced Micro Devices) are the primary manufacturers of processors. They make
processors for desktop computers, laptops, notebooks and mobile devices. Each type of processor has
different functionality, but similarities do exist among various types. Both lntel and AMD make
processors for a variety of systems. Core, Pentium and Celeron families of processors belong to Intel
while Phenom, Athlon and Sempron processors belong to AMD.

Intel Pentium IV Processor

Intel Pentium IV processors have 20 steps execution process. They have high clock speed and perform
fewer operations per clock. Pentium processors generally use 478 pin sockets and use Mega Hertz (MHz)
to specify processor speed.

AMD Processor

AMD processors have 10 steps execution process. These processors generally use 462 Pin sockets. AMD
processors do not use Mega Hertz (MHz) to specify processor speed.

i. Which part of computer performs Fetch, Decode and Execute Cycle


A. ALU B. Control Unit
C. Output Unit D. Registers
ii. Where are the results of ALU operations transferred?

A. Counter register B. Base register

C. Data register D. Accumulator register

iii. Which Of these buses selects a memory word for a read or write Operation?

A. Data bus B. Control bus

C. Address bus D. System bus

iv. Which of these registers controls the sequence in which instructions are fetched from memory
for execution?

A. Program counter B. Memory buffer register

C. Data register D. Counter register

CH: 03 CENTRAL PROCESSING UNIT PAGE 9 OF 9


v. A memory word that is to be stored in or fetched from memory must first be transferred into
which register?

A. Accumulator B. Data register

C. Memory buffer register D. Program counter

vi. Which instruction causes transfer of instruction execution to a specified address?

A. Comparison instruction B. Branch instruction

C. Shift instruction D. Data movement instruction

vii. Which of these instructions will perform addition of two numbers?


A. Operation instruction B. Shift instruction
B. Comparison instruction D. Data movement instruction
viii. Through which bus instructions are transferred from main memory to instruction register.

A. Control bus B. Address bus

C. Instruction Bus D. Data Bus

ix. How many distinct operations can be performed if op-code of a microprocessor of 4 bits?

A. 4 B. 8 C. 16 D. 32

x. Which part of computer decodes instructions?

A. ALU B. Main memory C. Program counter D. Control unit

CH: 03 CENTRAL PROCESSING UNIT PAGE 10 OF 9

You might also like