0% found this document useful (0 votes)
8 views10 pages

Unit No 3

unit no. 3 of the computer science book of ics-i in kpk, pakistan

Uploaded by

hameed ullah
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0% found this document useful (0 votes)
8 views10 pages

Unit No 3

unit no. 3 of the computer science book of ics-i in kpk, pakistan

Uploaded by

hameed ullah
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 10

You can also watch my video lectures on youtube bannu professors academy

Chapter no # 3

WhatisCPU?ExplaindifferentcomponentsofCPU?
CPU stands for Central Processing Unit. It is also known as microprocessor orprocessor. It is
the brain of computer system. Just like human brain controls
alltheactivitiesofhumanbody,theCPUcontrolsalltheoperationsofthecomputer.There are
different components of CPU. These are
1. ArithmeticLogicUnit(ALU)

2. ControlUnit(CU)

3.Registers(MemoryUnit)
4.Cache Memory
5.Internal Buses
Arithmetic Logic Unit: It is the main processing unit of CPU which executes
allarithmeticandlogicaloperations. Arithmetic means (+,-,x,/ and modulus) while logical
means comparisons of twovalues. Now a days there can be more than one ALU in single
CPU.
Control Unit: It controls the remaining components of Computer. It controls the flow of
data between RAM and Processor, decodes the data calling on the ALU when necessary. It
communicates with Input/outputdevices for transfer of data or results from storage.
Registers/MemoryUnit:Registersare small memory locations inside the processor and
areresponsibleforholdingthedatathatistobeprocessed.Theystoretheinstructions and data in
a Processor. This data is further used by Control Unit.There are two main categories of
Register. These are General purpose and special Purpose Registers.
Cache Memory: It is small and faster memory inside the processor. It stores the data and
instructions which are frequently used by the processor. The main purpose of using cache
memory in computer is to utilize the processor and make its speed fast.
Internal system Bus. Buses are the paths through which data instructions and address are
passed. There are three different types of buses. These are address bus, control bus and
data bus.
What is cache memory? Explain the types of and purpose of using cache memory in
detail?
Cache memory is basically SRAM which is built inside the processor or located next to CPU.
It is used to store the data and instruction which are frequently used by the processor. The
main purpose of cache memory is to improve overall speed of processor. There are three
levels of cache memory. These are

 L1( Level 1)
 L2(Level 2)
 L3 (Level 3)
Level 1 Cache: it is built into the processor and can hold the necessary data needed by
processor during execution. It’s typical size is from 1 Byte to 128 KB.
You can also watch my video lectures on youtube bannu professors academy

Level 2 Cache: It is used to store data for Level1. First the Data move from RAM to L2 and
from L2 to L1. Its speed is slow than L1 and size is from 64 KB to 16 MB.
Level3 Cache: It works hand-in-hand with L1 and L2 to improve computer performance. It is
slow than L2 but faster than RAM. Its storage capacity is more than L2.CPU first looks for
the instruction in L1, and then it checks L2 and L3 respectively.

WhatisRegister?DiscussdifferenttypesofRegisters?
Registers: A high speed temporary storage areas within CPU is called Registers.Their
function is to temporarily store binary information during program execution.
Thenumberofregistersvariesfromprocessortoprocessor by there are two main types of
registers. These are.
1. GeneralPurposeRegisters
2. SpecialPurposeRegisters
1. General Purpose Registers: It is used to store data as well as addresses.
Thesesregistersareusedforarithmetic anddatamovement. Itssizeis8-64 bits.
Followingarethecommonlyusedgeneralpurposeregisters.

i. AccumulatorRegister(AX)
ii. DataRegister(DX)
iii. BaseRegister(BX)
iv. CounterRegister(CX)

a. AccumulatorRegister(AX):Itisusedforarithmetic(,,,)andlogical(,,
, ) operations and to store result of these operations. It is of 16 bits and is divided into two
8-bit registers AH and AL.Itisinitiallysettozero.
Bits15.....................................................................0

16-bitAXRegister
8-bitAHRegister 8-bitALRegister

b. Base Register (BX): It is 16-bits general purpose register and is used to perform
arithmetic and data movement operations. It can hold a memory address that points to
another variable. It is further divided intoBHandBL.

Bits15.....................................................................0

16-bitBXRegister
8-bitBHRegister 8-bitBLRegister
c. Counter Register (CX): it is general purpose 16-bits register and used for loop/ repetitive
works.
Bits15.....................................................................0
16-bitCX Register
8-bitCHRegister 8-bitCLRegister
d. DataRegister(DX):it is 16-bits general purpose register.Itisusedinmultiplication,division.
During input/outputoperations it is used as a port number. It also works as a buffer. It is
divided intoDHandDL.
Bits15.....................................................................0

16-bitBXRegister
8-bitDHRegister 8-bitDLRegister
2. Special Purpose Registers: It is used to hold the state of a program. These areused by
control unit to control the operations of CPU and by the operatingsystem to control the
execution of the programs. Following are the specialpurposeregisters.
i. InstructionRegister(IR)
ii. ProgramCounter(PC)
iii. MemoryAddressRegister(MAR)
iv. MemoryBufferRegister(MBR)
i. Instruction Register (IR): Instruction register is used to store or hold the
actualinstructionbeingloaded,decodedorexecutedcurrently.Afterloadedtheinstructio
nfrommemory,itisdecodedandthenexecuted.It’salsocalledCurrentInstructionRegister
(CIR).
ii. Memory Address Register (MAR): It holds the address of the active memorylocation.
Suppose CPU wants to store some data in the memory or to read
thedatafromthememory.ItplacestheaddressoftherequiredmemorylocationintheMAR.
iii. MemoryBufferRegister(MBR):It wok as a buffer. When there is a difference between the
speed of sender and receiver then buffer is used.
Itholdsthecontentsofdataorinstructionreadfrom,orwritteninmemory.Itmeansthatthis
registerisusedtostoredata/instructioncomingfromthememoryor goingtothememory.
iv. ProgramCounter(PC):Itholdstheaddressofthenextinstructiontobefetchedand
executed. When instruction is fetched, the value of PC is
automaticallyincrementedby1anditpointstotheaddressofnextinstruction.Itisalsocalle
dInstructionPointer (IP).

System Bus:
3
Bus: A bus is a path/channel/lineused for communication among different types of
components of computer. The system bus is normally made up of 50 to 100 distinct lines.
The system bus consists of the following three (03) types of buses:
1. Data Bus
2. AddressBus
3. Control Bus
1. DataBus:Itisabi-directionalbus. It can communicate data in two ways, but in one
direction at a time. It is used for transmission of data/instructions among
components of computer e.g input/output devices, memory, CPU etc. there was a 32
bit system bus in old computers, but now-a-days computers have 64 bit Data Bus.

2. Address Bus: It is a uni-directional bus that is used for transmission of address of


memory where data/instruction is located.Normally, 8 bit or16 bit addressbus is
installed in computers.

3. Control Bus: It is a bi-directional bus that is used to send signals/instructions to


different components in order to control operations. Acknowledgment are also may
be received from various components to CPU by this Control Bus. Normally, 8 bit or
16 bit addressbus is installed in computers.

CPU OPERATIONS:
A CPU is the main hardware of computer system. Fundamental operation of the CPU is the
execution/processing of instruction of computer program. A simple computer program may
have arithmetical, logical and input/output operations. The processor fetch/receive
instruction from memory, decode it into binary language, execute it and then display or store
its result in memory.

WhatisanInstruction?DiscussdifferenttypesofInstructions?
It is a statement to perform a specific operation. Instructionhastwofields i.e (i) Operation and
(ii) Operand. The main action to be performed by an instruction is called Operation and the
data/parameter required for that operation is called Operand. However, following are the
different types of instructions:

a) DataTransferInstructions
b) DataProcessingInstructions
c) ProgramControlInstructions

a. Data Transfer Instructions: The Data Transfer Instructions are used to transfer data

4
from one component of CPU to another. Examples of Data Transfer Instructions are:
i. MOV (Move Instruction): It transmits data between memory and registers.
ii. LD (Load Instruction): It loads data to a particular register from memory.
iii. STO (Store Instruction): it stores information from register to memory.

b. Data Processing Instructions: The Data Processing Instructions are used to perform
arithmetic, logical and shift operations. For example, ADD, SUB, MUL, DIV, INCREMENT,
DECREMENT are basic arithmetic instructions. Similarly, AND, OR, NOT, XOR are the
logical instructions. Shift Instruction is used to transfer bits to right/left of a location.
c. Program Control Instructions: These are used to change the sequence of a program. For
example, JMP Instruction is used to shift control to another location to start execution
there. LOOP Instruction is used to execute a particular statement repeatedly.
INSTRUCTION FORMAT:
The design or arrangement of bits contained in instruction is called Instruction Format.
Basically, there are two fields of Instruction. Op-code (Operation Code) represent the main
action to be performed like addition, subtraction etc. And, the Operand field represent the
address of data to be processed. There are 03 types of instruction in respect to operands:

i. Zero-Address Instruction: It has no operand field, means that no


need of data for execution of operation. For example, STOP operation.

ii. One-Address Instruction: It has 01 operand field, means that


single value is needed for execution of operation. For example,
JMP AX.

iii. Two-Address Instruction: It has 02 operand fields, means that


02 values are needed for execution of operation. For example,
ADD A, B
What is Instruction Cycle?
The Instruction Cycle is a step by step procedure by which a Processor execute a program.
CPU use the following four steps for execution of a program.

i. Fetch: First of all, the CPU fetch the instruction and the data required for it from memory.
ii. Decode: Then, CPU convert the instruction into machine language.
iii. Execute: Then, the CPU execute the instruction.
iv. Store: Lastly, the CPU store the result in memory. It is optional.

5
RISC and CISC Architecture/Classification of Microprocessors
There are two types of Microprocessors according to the Instruction Set:
1. RISC (Reduced Instruction Set Computer):
The main idea behind this is to make hardware simpler by using a simple instruction set
composed of a few basic steps for loading, evaluating, and storing operations just like a
load command will load data, a store command will store the data. RISC Reduce the
cycles per instruction at the cost of the number of instructions per program. It has
simple instruction, so its decoding will be simple. Instruction takes a single clock cycle
for execution. It needs more general-purpose registers.
2. CISC (Complex Instruction Set Computer):
The main idea is that a single instruction will do all loading, evaluating, and storing
operations. CISC attempts to minimize the number of instructions per program but at
the cost of an increase in the number of cycles per instruction. It has Complex
instruction, so its decoding will also be complex. Instructions are larger, so it will take
more than a single clock cycle for execution. It needs less number of general purpose
registers.
Intel and AMD Processors:
Intel and AMD (Advanced Micro Devices) are the primary manufacturing company of
processors. They make processors for computers, laptops, notebooks and mobiles. For
example, Intel make Core, Pentium, Celeron etc. AMD make Phenom, Athlon and Sempron
etc. Different types of processors have different speed, cost and functions.
Difference between Pentium 4 and Athlon:

Pentium 4 Athlon
i. It is Intel family. i. It is AMD family.
ii. It has clock speed 1300 --- 3800 ii. It has clock speed 1333 --- 2333
iii. It has bus speed 400 --- 1066 iii. It has bus speed 100 ---200
iv. It has cache upto 2GB iv. It has cache y upto 512 MB

6
Exercise:

Q1. Select the best choice for the following MCQs

i. Which of the following performs the arithmetic and logic operations on


data?

a. ALU b. Control Unit

c. BUS d. Memory Unit

ii. ________ Coordinates and controls the computer system just like the
braincontrols the human body

a. BUS b. Control Unit

c. Output Unit d. Register

iii. Where are the logical operations performed in the CPU

a. CU b. Register

c. ALU d. Memory

iv. _________ is a small memory device available in the CPU to store data
temporarily.

a. CU b. Register

c.ALU d. Memory

v. ___ is the small amount of memory located between main memory and
Processor

a. RAM b. ROM

c. Cache d. PROM

vi. Which of the following cache memories resides inside the processor
and is very fast from the other memories

a. L1 Cache b. L2 Cache

c. L3 Cache d. L4 Cache

vii. ___ Register can performarithmetic and data movement and it has
some special addressing abilities.

a. Base Register b. Memory Buffer register

c. Data Register d. Counter Register

7
viii. Which of the following register has a special role in multiply and divide
operations

a. Base Register b. Memory buffer Register

c.Data Register d. Counter Register

ix. _______ register holds either the address oftheinstruction being


executed or the address of the next instruction to be executed

a. ProgramCounter b. Memory buffer Register

c.Data register d.Counter register

x. System Bus connects the CPU to_____ on the mother board

a.Register b. Main Memory

c.ALU d.Input Unit

xi. Which of the following steps, in instruction cycle, interprets the


instruction?

a.Fetch b.Decode

c. Execute d. Write-back

xii. _______ instruction is used when number of statement is to be


repeated

a.LD b. LOOP

c. JMP d. MOV

xiii. _____ is a microprocessor architecture that is designed to perform


smaller number of types of computer instructions.

a. RISC b. CISC

c. DISK d. LIST

xiv. How many op-codes do a Zero-Address instruction has?

a. 1 b. 2

c. 3 d. 0

xv. Which of the following is not an arithmetic instruction?

a. DIV b. MUL

c. SUB e. JMP

Q2. Give short answers to the following questions.

i. What is the function of ALU in the computer?

ALU is the part of CPU that performs arithmetic and logical operation. Arithmetic
operation includes addition, subtraction, multiplication, division and logical operation
means comparing two values. ALU process the data and store the result in register.

ii. What is the function of control unit in the computer?

8
Control Unit manages overall operation performed by the different parts of the
computer. It coordinates and controls the overall computer system. Control unit is
responsible for directing the flow of instruction and data within the CPU. It directs the
operations of the other units by providing timing and control signals. The control unit
performs two actions. These are “fetch” and “execute”.
iii. What is microprocessor?
Microprocessor is the brain of computer. It performs all types of execution of the program. It
is also called processor or shortly CPU. It has four main parts i.e ALU, CU, Register and Cache
memory.
iv. Define system Bus.
System Buses are the paths through which data instructions and address are passed. There
are three different types of buses. These are address bus, control bus and data bus.
v. Write Short note on the MBR.
MBR stands for Memory Buffer Register. Itworks as a buffer. When there is a difference between the
speed of sender and receiver device then buffer is used.
Itholdsthecontentsofdataorinstructionreadfrom,orwritteninmemory.ItmeansthatMBRisusedto
storedata/instructioncomingfromthememoryor goingtothememory.
vi. What are CPU operations?
The different operation perform by the CPU are fetch, decode, execute and store.
Fetch- is the operation which receives instructions from RAM. Decode- is the process of
finding out that which action is to be performed on the instruction. Execute is the actual
processing and store is the operation by which processor store the result back in RAM.
vii. What is meant by an instruction?
An instruction is groupofbitsthattellsthecomputertoperformaspecificoperation.Every
Instruction consists of twofields i.e. operation field and operand field. Operation field contain
information about action to beperformed and operand field contains the data on which
operation is to be performed

viii. Differentiate between op-code and operand?


Every CPU instruction has two parts consider the following instruction
A+B
In this instruction +, is call operator and it will store in operation field whereOperation field or
coderepresentsthe executable of action of the processor. For example add, subtract. In the
instruction given above A and B are operand field where OperandCodeor fields are
theparametersoftheaction.Itcanbedataormemoryaddress.

ix. Show computer instruction format with the help of a diagram and label its parts.
Instruction:Agroupofbitsthattellsthecomputertoperformaspecificoperation.Instructionhastwo
fields;
OperationCode:Itrepresentsanactionthattheprocessorexecutes.
OperandCode:Itdefinestheparametersoftheaction.Itcanbedataormemoryaddress.
OperationCod OperandCode
e

x. Differentiate between CISC and RISC processor architecture?


Besides the classification based on the word length, the classification is alsobased on the
architecture i.e., Instruction Set of the microprocessor. These arecategorizedinto;
RISC(ReducedInstructionSetComputer):ItstandsforReducedInstructionSetComputer. It is a
type of microprocessor architecture that uses a small set
ofinstructionsofuniformlength.RISCchipsarerelativelysimpletodesignandinexpensive RISC
emphasizes on hardware
Examples:SPARC,POWERPCetc.
9
CISC(ComplexInstructionSetComputer):ItstandsforComplexInstructionSetComputer. CISC
architecture includes a complete set of special purpose circuits
thatcarryouttheseinstructionsataveryhighspeed.Theseinstructionsinteractwith
memorybyusingcomplexaddressingmodes. RISC emphasizes on software.
Examples:Motorola680x0family,Intelarchitecture,AMDetc.

10

You might also like