You are on page 1of 52

Components of Central Processing Unit (CPU)

SLO # 3
What is the role of CPU in
computer system;
SLO # 3.1.1
Role of CPU in computer system

The central processing unit (CPU) of a computer is a piece of


hardware that carries out the instructions of a computer program. It
performs the basic arithmetical, logical, and input/output operations
of a computer system. The CPU is like the brains of the computer -
every instruction, no matter how simple, must go through the CPU.
The CPU is sometimes also referred to as the central processor unit,
or processor for short.
Describe functions of components of CPU,
i.e. Arithmetic and logic unit, control unit,
registers, cache, Internal buses (data bus,
address bus and control bus) with the help
of block diagram;
SLO # 3.1.2
Arithmetic Logic Unit

An arithmetic logic unit (ALU) is a major component of the


central processing unit of a computer system. It does all
processes related to arithmetic and logic operations that
need to be done on instruction words. In some
microprocessor architectures, the ALU is divided into the
arithmetic unit (AU) and the logic unit (LU).
Control Unit (CU)

A control unit (CU) handles all processor control signals. It


directs all input and output flow, fetches code for instructions
from microprograms and directs other units and models by
providing control and timing signals. A CU component is
considered the processor brain because it issues orders to just
about everything and ensures correct instruction execution.
Control Unit (CU)
CU functions are as follows:
• Controls sequential instruction execution.
• Interprets instructions.
• Guides data flow through different computer areas.
• Regulates and controls processor timing.
• Sends and receives control signals from other computer
devices.
• Handles multiple tasks, such as fetching, decoding, execution
handling and storing results.
Registers

Register are used to quickly accept, store, and transfer data


and instructions that are being used immediately by the CPU,
there are various types of Registers those are used for various
purpose. Among of the some Mostly used Registers named as
AC or Accumulator, Data Register or DR, the AR or Address
Register, program counter (PC), Memory Data Register (MDR),
Index register, Memory Buffer Register.
Cache Memory

Cache memory is a small-sized type of volatile computer


memory that provides high-speed data access to a processor
and stores frequently used computer programs, applications
and data. It is the fastest memory in a computer, and is
typically integrated onto the motherboard and directly
embedded in the processor.
Bus

The electrically conducting path along which data is transmitted inside


any digital electronic device. A Computer bus consists of a set of
parallel conductors, which may be conventional wires, copper tracks on
a PRINTED CIRCUIT BOARD. Each wire carries just one bit, so the
number of wires determines the largest data WORD the bus can
transmit: a bus with eight wires can carry only 8-bit data words, and
hence defines the device as an 8-bit device.
Bus
Types of Computer Bus

Data Bus: The data bus allows data to travel back and forth between
the microprocessor (CPU) and memory (RAM).

Address Bus: The address bus carries information about the location of


data in memory.

Control Bus : The control bus carries the control signals that make sure
everything is flowing smoothly from place to place.
Describe the functions of following registers
and their types, i.e.

b. Special Purpose Register


i. Program Counter (PC)
ii. Instruction Register (IR)
iii. Memory Address Register (MAR)
iv. Memory Buffer Register (MBR);

SLO # 3.1.3
CPU Registers
• These are the high speed memory locations built into the
microprocessor.
CPU Registers

• These are the high speed memory locations built into the microprocessor.
• The CPU uses these locations to store data and instructions temporarily
for processing.
• CPU processes, stores and transfer data from one component to another
with the help of registers.
• The number of register varies among computers.
• It increases the performance of CPU.
• Each register receives the information, holds it temporarily and pass it on,
as directed by CU.
• The size of register depends on the computer architecture.
There are four types Special Purpose
Register

i. Program Counter (PC)


ii. Instruction Register (IR)
iii. Memory Address Register (MAR)
iv. Memory Buffer Register (MBR);

SLO # 3.1.3
Special Purpose Registers
Program Counter (PC)

• Used to store the address of the next instruction to be fetched for


execution.

• When the instruction is fetched, the value of program counter is


incremented.
RAM

2134 10110011 1 PC
2134
ADDRESS

2135 10100011 4

2136 11100011 2

2137

2138 11110000 3
Special Purpose Registers
Instruction Register (IR)

• Instruction register is used to store the fetched the instruction.


• The instruction is also decoded in this register.
RAM

2134 10110011 1 PC
2134
ADDRESS

2135 10100011 4

2136 11100011 2 IR
10110011
2137

2138 11110000 3
Special Purpose Registers
Memory Address Register (MAR)

• Used to store memory address being used by the processor.

• When processor wants to READ data from or WRITE data in memory, it


stores the address of that memory location in this register.
RAM

2134 10110011 1 PC
2134
ADDRESS

2135 10100011 4

2136 11100011 2 IR
10110011
2137

2138 11110000 3 MAR


2137
Special Purpose Registers
Memory Buffer Register (MBR)

• Used to store data coming from or going from the memory.


RAM PC
2134
2134 10110011 1
IR
10110011
ADDRESS

2135 10100011 4

2136 11100011 2 MAR


2137
2137 10101010

2138 11110000 3 MBR


10101010
Describe the functions of following registers
and their types, i.e.

a. General Purpose Register


i. Accumulator (AC)
ii. Data Register (DR)
iii. Base Register (BR)
iv. Counter Register (CR);
SLO # 3.1.3
General Purpose Register

Accumulator (AX)
An accumulator is a register for short-term, intermediate storage
of arithmetic and logic data in a computer's CPU (central
processing unit). It is used for arithmetic and data operations.
 
Data Register (DX)
The data register is responsible for division and multiplication
operations.
 
General Purpose Register

Base Register (BX) 


It is used for arithmetic and data movement. It has special addressing
capabilities.
 
Counter Register (CX)
It is used for counting purpose. It acts as a counter for repetition of
loops.
Various operations performed by CPU

SLO # 3.2
Compare three types of instructions of CPU, i.e.
data transfer instructions, data processing
instructions and program control instructions;

SLO # 3.2.1
Data Transfer Instructions

• Data transfer instructions are the instructions which


transfers data in the microprocessor.
• These instructions move data between registers, or
between memory and registers.
• These instructions copy data from source to destination.
• While copying, the contents of source are not modified.
• They are also called copy instructions.
Data Processing Instructions

The data processing instructions manipulate data


within registers. They include move instructions,
arithmetic instructions, shifts, logical instructions,
comparison instructions, and multiply instructions.
Program Control Instructions

These instructions used to change the sequence of


instruction of a program are called control transfer
instructions. These instructions transfer the
execution control to certain part of program instead
of next instruction. Some examples of these
operations are JUMP and JUMPZ (Jump if zero) etc.
Compare different types of CPU instruction
formats, i.e. zero address instruction, one address
instruction and two address instruction;

SLO # 3.2.2
What is instruction set?
An instruction is a statement that tells the computer to do
something. The way an instruction is given is called instruction
format.
A computer has a variety of instruction formats. The control unit of
CPU is responsible to interpret the instruction code. The control
unit also provides the necessary control function required to
process the instructions. A simple instruction format consists of 16
bits.
There are two parts of instruction code format:
• Operand code
• Address of Operand
Instruction Code Format

1. Operand code

The operand code specifies the operation to be performed by the


computer such as ADD, SUB, MOV etc. It takes 4 bits. An operand can be a
value or register number on which the operation is performed.
Opcode Operand Reference 1 Operand Reference 2

16 bits
Instruction Code Format

2. Address of Operand

The address of operand refers to a location in main memory where the


value is stored.
Types of instruction formats
Different types of instruction formats are as follows:

Two-Address instruction format


This format uses two address fields. Each address field can specify either a
register or memory address. It is the most common instruction format.

The example of this instruction format are MOV, ADD, MUL etc.
How Two-Address instruction format works

Suppose A=2, B=4, C=3 AND D = 6

X = (A+B) * (C+D)
MOV R1 2 A 2
MOV R1, A ADD R1 6 B 4
ADD R1, B
MOV R2 3 C 3
MOV R2, C ADD R2 9 D 6
ADD R2, D
MUL R1 54 R2 9
MUL R1,R2 MOV X 54 R1 54

MOV X, R1
Types of instruction formats
Different types of instruction formats are as follows:

One-Address instruction format


This format uses only one address field. It uses one accumulator register
(AC) for all data manipulation. A second register is required for
multiplication and division.
How One-Address instruction format works
Suppose A=2, B=4, C=3 AND D = 6
X = (A+B) * (C+D) LOAD A 2

LOAD A ADD B+A 6


ADD B STORE T=B+A 6
STORE T
LOAD C 3
LOAD C
ADD C+D 9
ADD D
MUL T MUL T*(C+D) 54
STORE X=T 54
STORE X
Types of instruction formats
Different types of instruction formats are as follows:

Zero-Address instruction format


In zero-address instruction format, an address field is absent in the
instruction. A stack-organized computer does not use address field for the
instruction like ADD and MUL. However, the instructions such as PUSH
and POP require an address field to specify the operand that
communicates with the stack.
How Zero-Address instruction format works
Suppose A=2, B=4, C=3 AND D = 6
X = (A+B) * (C+D)
POP X 54

MUL (6)*(9)
PUSH A
PUSH B ADD (6+3)
PUSH D 6
ADD
PUSH C PUSH C 3
PUSH D
ADD (2+4)
ADD
PUSH B 4
MUL
PUSH A 2
POP X
https://bit.ly/356NdSa
Describe
fetch – decode – execute cycle with
the help of a diagram;

SLO # 3.2.3
Fetch Execute Cycle?

The fetch execute cycle is the basic operation (instruction) cycle of a


computer (also known as the fetch decode execute cycle).

During the fetch execute cycle, the computer retrieves a program


instruction from its memory.  It then establishes and carries out the
actions that are required for that instruction.

The cycle of fetching, decoding, and executing an instruction is


continually repeated by the CPU whilst the computer is turned on.
How this cycle works

Step Fetch execute cycle steps Simplified description

The PC contains the address of the memory


PC has address of next
1 location that has the next instruction which has to
instruction
be fetched

This address is then copied from the PC to


2 PC copied to the MAR
the MAR via the address bus

The contents (instruction) at the memory location Lookup MAR and get
3 (address) contained in MAR are then copied into contents. Copy contents
the MDR into the MDR
How this cycle works

The contents (instruction) in the MDR is then Copy MDR contents into
4
copied and placed into the CIR the CIR

The value in the PC is then incremented by 1 so


5 that it now points to the next instruction which PC is then incremented by 1
has to be fetched

The instruction is finally decoded and then


executed by sending out signals (via control The instruction is decoded
6
bus) to the various components of the and then executed
computer

7 Repeat
Fetch Execute Cycle
Differentiate between Complex Instruction Set
Computer (CISC) and Reduced Instruction Set
Computer (RISC) Architecture;

SLO # 3.2.4
Difference between RISC and CISC
RISC CISC

1. RISC stands for Reduced Instruction Set 1. CISC stands for Complex Instruction Set
Computer. Computer.

2. CSIC processor has complex instructions that


2. RISC processors have simple instructions take up multiple clocks for execution. The average
taking about one clock cycle. The average clock clock cycle per instruction (CPI) is in the range of 2
cycle per instruction (CPI) is 1.5 and 15.
3. Execution time is very less 3. Execution time is very high
4. The decoding of instructions is simple. 4. Decoding of instructions is complex

5. The most common RISC microprocessors are 5. Examples of CISC processors are the
Alpha, ARC, ARM, AVR, MIPS, PA-RISC, PIC, System/360, VAX, PDP-11, Motorola 68000 family,
Power Architecture, and SPARC. AMD, and Intel x86 CPUs.
Differentiate between Intel P4 and
advance micro devices (AMD) Athlon
on the basis of clock speed, bus width,
cache and architecture.

SLO # 3.2.5
Intel P4 VS (AMD) Athlon

Specification Intel AMD Athlon

Clock Speed 4.25x+ 5x+


Bus Width 64 bit 64 Bit
Cache L1(2 x 16) L1(2 x 64KB)
L2(128 KB) L2(256 KB)
L3(-) L3(-)
Architecture Willamette Thunderbird

You might also like