0% found this document useful (0 votes)
40 views

UNIT-1 Computer - Instruction - PDF

computer system architecture

Uploaded by

swatee89
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

UNIT-1 Computer - Instruction - PDF

computer system architecture

Uploaded by

swatee89
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Computer System

Architecture
BCA-303

by
prof.(dr.) rattan rana

M M INSTITUTE OF COMPUTER TECHNOLOGY & BUSINESS MANAGEMENT


Topics to be covered
➢Computer Instructions
➢Instruction Code Format
➢Instruction Cycle
➢Performance
➢Multiprocessors & Multicomputer

2
Computer Instructions
Computer instructions are a set of machine language instructions that a particular processor
understands and executes. A computer performs tasks on the basis of the instruction provided.
An instruction comprises of groups called fields. These fields include
▪ The Operation code (Opcode) field which specifies the operation to be performed
▪ The Address field which contains the location of the operand, i.e., register or memory location.
▪ The Mode field which specifies how the operand will be located
Computer Instructions (Contd.)

Instruction Code Format:


A basic computer has three instruction code formats which are:
1. Memory - reference instruction
2. Register - reference instruction
3. Input-Output instruction
Computer Instructions (Contd.)

Instruction Code Format:


A basic computer has three instruction code formats which are:
1. Memory - reference instruction:
✓ It uses 12 bits to specify an address
✓ 1 bit to specify the addressing mode I. I=0 for direct address or I=1 for
indirect address.
2. Register - reference instruction
3. Input-Output instruction
Computer Instructions (Contd.)

Instruction Code Format:


2. Register - reference instruction
✓A Register-reference instruction is recognized by the operation code i.e. 111
with a 0 in the leftmost bit (bit 15) of the instruction.

✓A Register-reference instruction specifies an operation on or a test of the AC


register.
Computer Instructions (Contd.)

Instruction Code Format:


3. Input-output - reference instruction
✓This instructions does not need a reference to memory and is recognized by
the operation code 111 with a 1 in the left most bit of the instruction

✓The remaining 12 bits are used to specify the type of input-output operation or
test perfomed.
Computer Instructions (Contd.)

Instruction Code Format:


The computer recognizes the instruction through the last four bits positions i.e
✓ if the bits in position 12 to 14 are not equal to 111, the instruction is said to be
memory-reference type and the bit at position 15 will be taken as addressing
mode I.
✓If the bit in position 12 to 15 are 111 then the control will inspect the bit
position of 15. If the bit is 0, the instruction is said to be register-reference.
✓If the bit in the position 12 to 15 are 111 and the bit of position 15 is 1, then
instruction is an input-output type.
Instruction Cycle

Instruction Cycle
The basic function of CPU is the execution of program and program contains the set of
instructions.
✓ The sequence of instructions is executed by the CPU
✓ The instruction cycle is the time period during which one instruction is fetched from
memory and executed when a computer is given an instruction in machine language.
✓ There are typically five stages of an instruction cycle that the CPU carries out
Instruction Cycle (Contd.)

CPU Instruction Cycle


Instruction Cycle (Contd.)

Instruction Cycle
1. Fetch : fetching the instruction from the memory, it loads the instruction into IR. So
that the instruction can be decoded.
2. Decode: The instruction is decoded
3. Read: it reads the effective address from memory if the instruction has an indirect
address
4. Execute: The instruction is executed
5. Write: It write back the result into register
An instruction cycle is also called as machine cycle.
Instruction Cycle (Contd.)

CPU Instruction Cycle

Start Fetch Decode Read Execute Store End

Fetch Cycle Execute Cycle

Instruction Cycle
Instruction Cycle (Contd.)

Fetch Cycle:
The first step CPU carries out is to fetch some data and instructions from the main memory then
store them in its own internal temporary memory area (Registers). This is called the fetch part
of the cycle. For this to happen CPU uses the vital hardware path called the address bus.
✓ The CPU places the address of next item to be fetched on the address bus.
✓ Data from the address bus then moves from main memory into the CPU
✓ The next step is for CPU is to make sense of the instruction it has just fetched. This process is
called ‘decode’
✓ The CPU decodes the instruction and process various areas within the chip in readiness of
next step
Instruction Cycle (Contd.)

Fetch Cycle:
The sequence of event in fetching an instruction can be summarized as follow:
✓ The contents of PC are loaded into MAR register
✓ The value of PC is incremented by one.
✓ As a result of memory read operation, the instruction is loaded into the register MDR
✓ The content of MDR are loaded int the register IR
Instruction Cycle (Contd.)

Execute Cycle:
This is the part of the cycle when data processing actually takes place. The result of this
processing is stored in yet another register. Once the execution stage is complete, the CPU sets
itself to begin another cycle once more
For example Add R1, R2, R3
This instruction add the content of R1 and R2 then store the result in R3
✓ The Register R3, R2, R2 are extracted from the IR
✓ The contents of R1 and R2 are passed to the ALU for addition
✓ The output of the ALU is transferred to R3
Performance
❑ The speed with which a computer executes programs is affected by
the design of its hardware and its machine language instructions

❑ Because programs are usually written in a high-level language,


performance is also affected by the compiler that translates
programs into machine languages

❑ For best performance, the following factors must be


considered
◆ Compiler
◆ Instruction set
◆ Hardware design
Performance
➢ Processor circuits are controlled by a timing signal called a clock
➢ The clock defines regular time intervals, called clock cycles

➢ To execute a machine instruction, the processor divides the action to be


performed into a sequence of basic steps, such that each step can be
completed in one clock cycle

➢ Let the length P of one clock cycle, its inverse is the clock rate,
R=1/P

➢ Basic performance equation


◆ T=(NxS)/R, where T is the processor time required to execute a program, N is
the number of instruction executions, and S is the average number of basic
steps needed to execute one machine instruction

◆ Note: these are not independent to each other


◆ How to improve T?
Compiler

❖ A compiler translates a high-level language program into a


sequence of machine instructions.
❖ To reduce N, we need a suitable machine instruction set
and
a compiler that makes good use of it.
❖ Goal – reduce N×S
❖ A compiler may not be designed for a specific processor;
however, a high-quality compiler is usually designed for,
and with, a specific processor.
Multiprocessors and Multicomputer

❑ Multiprocessor computer
➢ Execute a number of different application tasks in parallel
➢ Execute subtasks of a single large task in parallel
➢ All processors have access to all of the memory – shared-memory multiprocessor
➢ Cost – processors, memory units, complex interconnection networks

❑ Multicomputers
➢ Each computer only have access to its own memory
➢ Exchange message via a communication network – message-
passing multicomputers

You might also like