chp 5 new

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

Computer science,XI Ch#3: Central Processsing Unit

Central Processing Unit (CPU)


The Central Processing Unit (CPU) is the integral part of any computer system, often referred to as the
brain of the computer. Like the human brain, it manages all operations and is connected to all
components of the computer. The CPU executes instructions, controls data storage, and manages
input/output activities for various devices.
1. Basic Components of CPU
The CPU consists of several essential components:
1.1 Arithmetic and Logic Unit (ALU)
The Arithmetic and Logic Unit (ALU) is the main processing unit of the CPU. The Arithmetic and Logic
Unit (ALU) is a critical component of the CPU responsible for performing essential calculations and
logical operations.
Arithmetic operations: It performs arithmetic operations such as addition, subtraction,
multiplication, and division.

Logic Operations:Also performs logical operations which are

 Comparisons: Evaluating relationships between values (e.g., greater than, less than, equal to).
 Logical Operations: Performing operations such as AND, OR, NOT on binary data.
Data Processing

The ALU processes input data, executes operations, and returns results to be stored in registers, which
serve as temporary storage locations within the CPU.

Modern ALU Design

Many modern CPUs incorporate multiple ALUs to enhance processing efficiency, enabling simultaneous
calculations and improving overall performance.
1.2 Control Unit (CU)
The Control Unit (CU) manages the operations of the CPU and coordinates the functions of various
components.

Functions of the Control Unit


Instruction Fetching

 Retrieves program instructions from memory for processing.

Instruction Decoding

 Interprets the fetched instructions to understand the required operations.

1
Computer science,XI Ch#3: Central Processsing Unit

Execution Coordination

 Directs the Arithmetic and Logic Unit (ALU) and other units to perform the specified tasks.

Flow of Instructions and Data

The CU regulates the movement of instructions and data within the CPU, ensuring efficient processing.

Timing and Control Signals

 Generates necessary timing and control signals to synchronize operations and maintain orderly
execution.
1.3 Registers
Registers are small, highspeed storage locations within the CPU that temporarily hold data and
instructions. Each register is designed for special purpose.
Measurement
Registers are measured by the size of bits they can hold e.g 16bits,32 or 64 bits registers.
Classification
Processor contains different kinds of registers and is classified according to their content pr instructions.
Importance of Registers

Registers play a critical role in the CPU’s performance by:

 Reducing the time needed to access data.


 Minimizing the frequency of slower memory accesses.
 Supporting efficient execution of instructions.

1.4 Cache Memory


Cache memory is a small, high speed type of volatile memory that stores frequently accessed data and
instructions. It improves processor efficiency by providing quick access to commonly used information.
Cache memory is typically divided into different levels:
Level 1 (L1) Cache: Located inside the processor, it provides the fastest access. Directly accessible by
the CPU for the quickest data retrieval.
Level 2 (L2) Cache: Positioned outside the microprocessor, it is slower than L1 but faster than main
memory.
Level 3 (L3) Cache: Found on the motherboard, offering additional storage for data. Shared among
multiple cores of the CPU.
1.5 Internal Buses
Multiple bits simultaneously) or in Internal buses are subsystems that transfer data between computer
components. They connect all components to the motherboard, facilitating communication between the
CPU, memory, and other devices

2
Computer science,XI Ch#3: Central Processsing Unit

Functions of Internal Buses

 Data Transfer: Enable the movement of data between the CPU, memory, and other devices.
 Component Connectivity: Connect all components to the motherboard for integrated
functionality.

Modes of Operation

Parallel Operation

 Allows multiple bits to be transferred simultaneously, increasing data transfer rates.

Serial Operation

 Transfers one bit at a time, which can simplify the design but may reduce speed compared to
parallel buses.

Importance of Internal Buses


 Efficiency: Enhance communication speeds between components, contributing to overall
system performance.
 Coordination: Ensure synchronized operation of the CPU, memory, and peripherals.

2 Registers
Registers are small, highspeed storage locations within the CPU that temporarily hold data and
instructions. Each register is designed for special purpose. They are crucial for efficient processing and
play a significant role in the execution of instructions.
Characteristics of Registers:
 Speed: Registers are much faster than RAM, allowing the CPU to access data quickly.
 Size: Typically range from 32 to 64 bits in modern CPUs.
 Functionality: Used to store operands, results of calculations, and control information.

Types of Registers
General Purpose Registers
These registers are versatile and used in various arithmetic and data movement operations.They are
used to save data as well as their addresses.Theseare8-64bits registers.

The AX, BX, CX, and DX registers are key general-purpose registers.

AX Register (Accumulator Register)

3
Computer science,XI Ch#3: Central Processsing Unit

 Function: Primarily used for arithmetic operations, input/output operations, and as the default
register for many instructions.AX can hold a 16-bit value, with its lower 8 bits referred to as AL
(low byte) and the upper 8 bits as AH (high byte).
 Usage: Often used to store results of arithmetic operations or data that is frequently accessed.It
is included in a CPU and act as a temporary storage location.The results of an operation are
written to Accumulator ,overwriting the previous values,

32 bit Register usage:A complete 32 bits register ca be use in three ways As ;

BX Register (Base Register)

Function: It can perform Arithmetic and data movement and it has some special addressing
abilities.Serves as a pointer to data in memory, especially useful for addressing modes that require base
addresses. The BX register also has two sub-registers: BL (the lower 8 bits) and BH (the upper 8 bits),
enabling operations on individual bytes.

 Usage: Frequently used in data manipulation and memory addressing.


 32 bit Register usage:A complete 32 bits register ca be use in three ways As

Counter register(CX)

A counter register is a special type of register in a computer's CPU that keeps track of how many times a
certain operation has occurred, often used in loops or repetitive tasks. . When the operation is
performed, the count decreases until it reaches zero, signaling that the loop should stop. This helps
manage control flow in programs efficiently.

Usage
 Counts how many times a loop should run, decreasing with each iteration.
 Tells the program how many characters to copy or process in string operations.
 Tracks the number of times something happens, like counting items.
 Counts down time for delays or triggers events.

 Keeps track of specific events, such as button presses


 32 bit Register usage:A complete 32 bits register ca be use in three ways As
Data Register(DX)
It has a special role in multiply and divide operations.It works as a buffer and holds anything
tahst is copied from memory ready for the processor to use it.
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 and by the operating system programs to control the execution of the programs. Following are
the special purpose registers;
Instruction register(IR) is a part of control unit, which stores the instructions currently being
executed. Eac instruction to be executed is loaded into the instruction register.

4
Computer science,XI Ch#3: Central Processsing Unit

current instruction register (CIR)


It is also known as current instruction register (CIR) because it holds the current instruction being
executed.

Memory Address Register (MAR)

Memory Address Register holds the memory address, the memory address from which data will be
provided to the CPU or will have the address to which data will be sent and then stored.

parallel load register

MAR is a parallel load register containing the next memory address to be manipulated.

For example: the next address to be read or written. It basically holds the memory location of data
that needs to be accessed. When reading from memory, the data addressed by MAR is fed into the MDR
(Memory Data Register) and then is used by the CPU. When writing to memory, the CPU writes data
from Data Register to the memory location whose address is stored in MAR. So, in both reading and
writing, it is holding the address of the memory location where the data is to be read or stored.

Memory Buffer Register (MBR)

The Memory Buffer Register actually holds the contents of the memory which are to be moved from
memory to other components or from components to the other memory. In order to store a word, it
must be transferred to the MBR and then from here it will go to the specific memory location. It word, it
must be allowing the processor and memory units to act independently.

Program Counter (PC)

Program Counter is also known as Instruction counter. It is a register in a computer processor that
contains the address (location) of the instruction being executed at the current time. As each instruction
gets fetched, the program counter increases in stored value by 1 After each instruction is fetched, the
program counter points to the next instruction in the sequence.

2.5 Internal Buses Types


Buses can be classified into:
Parallel Buses: Allow simultaneous data transfer across multiple wires.
Serial Buses: Transfer data one bit at a time, which can be more efficient for long distances.
System Bus and CPU Operations
1. Introduction to System Bus
A system bus is a communication pathway that connects the central processing unit (CPU) to the main
memory on the motherboard. It consists of cables and connectors that transport data, control signals,
and addresses between major components of a computer system. The system bus typically consists of
three types of buses: Data Bus, Address Bus, and Control Bus.

5
Computer science,XI Ch#3: Central Processsing Unit

1.1 Types of System Buses


(a) Data Bus
Data bus is the bidirectional bus. It can communicate in two ways, but in one direction at a time. It
handles the transfer of data and instructions. The data bus is used to transfer instructions and data from
memory to the CPU for execution and vice versa. It is also used to transfer data between memory and
1/O devices during input output operations. A typical data bus is 32-bits wide. This means that up to 32-
bits of data can travel through a data bus every unit of time. New computers have 64-bit data buses and
even more.
(b) Address Bus
Address bus carries addresses not data. An address is defined as a label, symbol, or other set of
characters lused to designate a location or register where information is stored. Before data or
instructions can be written into or read from memory by the CPU or I/O sections, an address must be
transmitted to memory over the address bus. The number of lines on the bus determines the number of
addressable memory elements. For example, an 8-bit bus can represent 2' i.e., 256 unique addresses. A
16-bit bus can address uted. Ea 65536 unique addresses.
(c) Control Bus
The control bus is used by the CPU to direct and monitor the actions of other functional areas of
computer. It is used to transmit a variety of individual signals (read, write, interrupt, acknowledge)
necessary to control and coordinate the operations of the computer. The size of control bus is from 8 to
16 bits
2. CPU Operations
The fundamental operation of a CPU is executing programs represented by a series of instructions
stored in memory. The CPU follows a cycle to fetch, decode, and execute these instructions. There are
four steps that CPUs use in their operation, these stored instructions called a program. The program is
represented by a series of fetch, decode, execute and store.
2.1 Instruction and their Types
An instruction (or instruction code) is a group of bits that tells the computer to perform a specific
operations.Instruction is an elementary operation that the processor can accomplish. Instructions are
stored in the me memory, waiting to be processed by the processor. An instruction has two fields:
Operation code:which represents the action that the processor will execute
Operand: which defines the parameters of the action. The operand code depends on the operation can
be data or a memory address.
Types of instructions:
Data transfer Instruction
These instructions are used when the data needs to be moved from memory location to register. These
instructions transfer data from one location in the computer to a another location without changing the
content. The most common transfers are between:
registers and memory registers and I/O registers to registers.
Examples of some common data transfer instructions are MOVE, LOAD and STORE.

6
Computer science,XI Ch#3: Central Processsing Unit

MOVE (MOV) instruction transfers data from a memory location to a register, register to memory
and register to register. This is also used to obtain the data to perform a computation on it later, or to
store the result of a computation.

Example: MOVA, B (Move the contents of register A to B)

LOAD (LD) instruction loads particular register contents from memory.


Example: LDA (Load the data to register A from memory)

STORE (STO) instruction stores information from register to memory location.

(b) 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.
Types
Data manipulation instructions can be divided into three basic types:
arithmetic, logical and shift instructions.
1. Arithmetic Instructions
The four basic operations are ADD, SUB, MUL and DIV. An arithmetic instruction may operate on fixed-
point data, binary or decimal data .The other possible operations include a variety of instructions .
Example: ABSOLUTE,NEGATE,INCREMENT,DECREMENT.

ii. Logical Instructions AND, OR, NOT, XOR operate on binary data stored in registers.iii. Shift
Instructions

Shift operation is used for transfer of bits either to the left or to the right of an operand.
Program Control Instructions
These instructions specify conditions for altering the sequence of program execution or in other words
the content of PC (program counter) register. 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 like JMP (Jump)
and
LOOP.
The JMP instruction jumps to begin the execution at another location.
The LOOP instruction is used when number of statements are to be repeated.
3. Instruction Formats
An instruction format defines the layout of an instruction. An instruction format must include an Op-
code (Operation-Code) and zero or more Operands. The Op-code will always be present.

Op-Code Operand

7
Computer science,XI Ch#3: Central Processsing Unit

Different instruction formats are used. A few of them are explained below.

Zero Address instruction

Zero Address instruction format requires only Op-Code, having no operand to work with .

Example of the Zero Address instruction format is HALT, STOP, which do not have any address.

b) 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. Like JMP requires one address in order to jump to
that specific address location.

(c) Two-Address Instruction


Two Address instruction format requires one Op-Code and two operands.

Example of such instruction format is the MOV (Move), which moves data from the memory
location to the register and vice versa.
4. Instruction Cycle
The instruction cycle is the process by which a computer retrieves, decodes, and executes instructions
from memory. It typically consists of several stages, often summarized as:

1. Fetch: The CPU retrieves an instruction from memory, using the program counter (PC) to
determine the address of the next instruction.

2. Decode: The fetched instruction is interpreted by the CPU to understand what actions are
required. This often involves determining the operation code (opcode) and the operands .

3. Execute: The CPU performs the operation specified by the instruction, which may involve
arithmetic calculations, logic operations, or data transfer.

4. Store: If the instruction produces a result that needs to be saved, this stage writes the result
back to memory or a register.

5. CISC and RISC Architecture


8
Computer science,XI Ch#3: Central Processsing Unit

CPUs can be categorized based on their instruction set architectures (ISAs), which define the set of
instructions the CPU can execute. Here are some common types of CPU architectures based on their
instruction sets:
1. RISC (Reduced Instruction Set Computer) 2. RISC (Reduced Instruction Set Computing)

1. RISC (Reduced Instruction Set Computer


Theinstructions which the preniessor could execute were built into the chip. In common CISC chips are
relatively slow per instruction. CISC have a large amount of different and complex instructions. CISC
architecture was a bit complex because of the instructions used at the hardware level. The more
complex the instruction set, the greater the overhead of decoding an instruction. CISC emphasizes on
hardware. Examples of CISC processors are the Motorola 680x0 families and Intel x86, AMD, VAX, and
the System/360.
advantage
The advantage of CISC processor is that the compiler requires little effort to translate high-level
programs or statement languages into assembly or machine language in CISC processors. The
disadvantage is that CISC chips are slower than RISC chips to execute per cycle instruction of each
program.
Characteristics
Following are the main characteristics of the CISC processor:
1. The length of the code is short, so it requires very little RAM.
2. CISC or complex instructions may take longer than a single clock cycle to execute the code
3. Less instruction is needed to write an application.
4. It provides easier programming in assembly language.
5. Support for complex data structure and easy compilation of high-level languages.
6. It is composed of fewer registers and more addressing nodes, typically 5 to 20.
7. Instructions can be larger than a single word.
8. It emphasizes the building of instruction on hardware because it is faster to create than the software.
(b) RISC (Reduced Instruction Set Computer)
RISC is a microprocessor architecture that is designed to perform a smaller number of instructions. The
simplicity of RISC allows more freedom to choose how to use the space on a microprocessor. It is built to
minimize the instruction execution time by optimizing and limiting the number of instructions. It means
each instruction cycle requires only one clock cycle, and each cycle contains three parameters: fetch,
decode and execute. The RISC processor is also used to perform various complex instructions by
combining them into simpler ones. RISC chips require several transistors, making it cheaper to design
and reduce the execution time for instruction. RISC architecture was developed around mid 1980 as a
reaction to the CISC chips. It is designed to perform smaller number of instructions in order to operate
on a higher speed.
Larger set of instructions make the microprocessor more complicated and slower in operation.
Operating System and application programmers will find it easier to work with smaller instruction set.
One of the drawbacks of the RISC is that it puts a lot of burden on software due to its smaller size of
instruction set.
RISC emphasizes on software. Examples of RISC processor are IBM PowerPC, Sun SPARC, Microchip PIC
processors, RISC-V.Features of RISC Processor.
Characteristics
Following are the main characteristics of the RISC processor:

9
Computer science,XI Ch#3: Central Processsing Unit

1. One cycle execution time: For executing each instruction in a computer, the RISC processors require
one CPI (Clock per cycle).
2. Pipelining technique: The pipelining technique is used in the RISC processors to execute multiple
parts or stages of instructions to perform more efficiently.
3. A large number of registers: RISC processors are optimized with multiple registers that can be used to
store instruction and quickly respond to the computer andminimize interaction with computer memory.
4. It supports a simple addressing mode and fixed length of instruction for executing the pipeline.
5. It uses LOAD and STORE instruction to access thememory location.
6. Simple and limited instruction reduces the execution time of a process in a RISC.

Intel and AMD Processor are the two major players in the CPU market, each offering a
range of processors for different needs Intel 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 Intel and AMD make processors for a variety of systems. Intel makes the Core, Pentium and
Celeron families of processors, matched by the Phenom, Athlon and Sempron processors from AMD..
Here’s a brief overview of both:

Intel Processors
1. Architecture: Intel’s current architecture, known as "Alder Lake" and "Raptor Lake," combines
performance and efficiency cores for better multitasking and energy efficiency.

2. Performance: Generally, Intel processors have been known for strong single-core performance,
making them excellent for gaming and applications that rely heavily on single-threaded
performance.

3. Integrated Graphics: Most Intel CPUs come with integrated graphics, which can be a good
option for users who don’t need a dedicated GPU.

4. Platforms: Intel has several chipsets, with the most recent being the Z690 and Z790 for high-end
desktops. Their compatibility can vary, so it's essential to check motherboard support.

5. Price: Typically, Intel CPUs are priced at a premium, especially their high-end offerings.

AMD Processors
1. Architecture: AMD’s latest architecture, "Zen 3" and "Zen 4," offers strong multi-core
performance, making them ideal for tasks like content creation, video editing, and gaming.

2. Performance: AMD processors have gained ground in single-core performance and often lead in
multi-core scenarios due to higher core and thread counts in many models.

3. Integrated Graphics: AMD's Ryzen series also features models with integrated graphics (APUs),
providing a good balance for budget builds without a dedicated GPU.

10
Computer science,XI Ch#3: Central Processsing Unit

4. Platforms: AMD's AM4 socket has supported multiple generations of Ryzen processors, making
upgrades easier for users. The new AM5 platform introduces support for next-gen features like
DDR5 RAM.

5. Price: AMD often provides better value for performance, especially in mid-range and budget
segments.

Choosing Between Them


 Gaming: Intel often has a slight edge in gaming due to higher clock speeds, but AMD offers
strong performance as well, especially in budget builds.
 Content Creation: AMD tends to perform better in multi-threaded tasks, making it a popular
choice for creators.
 Budget: AMD generally offers better performance for the price in the mid-range segment, while
Intel might be preferred for higher-end gaming rigs.

Difference between Intel P4 and AMD Athlon

Intel P4
The Pentium 4 brand refers to Intel's line of CPUs introduced in November 20, 2000. The first
Pentium 4 processor cores were capable of speeds from 1.3 to 2 GHz. Pentium technology was
succeeded by Intel's core technology e.g., Core i3, Core i5, Core i7, Core i9 etc.

AMD Athlon
Athlon is the brand name applied to a series of x86-compatible microprocessors designed and
manufacturedby AMD. Typical speed for these processors ranges from 1333 MHz to 2.33 GHz
and their bus speed lies in between 100 and 200 MHz. The original Athlon processors were 32
bit and the later Athlon64 are 64 bit processors. Latest AMD

11

You might also like