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

PDF of Instruction Format

The document discusses instruction formats and the instruction cycle. It describes the main components of an instruction as the opcode and operands. It then covers four types of instruction formats - zero address, one address, two address, and three address - based on the number of operands. The instruction cycle is also summarized as a four step process: 1) fetching the instruction from memory, 2) decoding the instruction, 3) executing the decoded instruction, and 4) storing the results back in memory. Finally, the document defines an instruction set as the set of all basic operations for a processor to complete tasks.

Uploaded by

SaGar Malla
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)
41 views

PDF of Instruction Format

The document discusses instruction formats and the instruction cycle. It describes the main components of an instruction as the opcode and operands. It then covers four types of instruction formats - zero address, one address, two address, and three address - based on the number of operands. The instruction cycle is also summarized as a four step process: 1) fetching the instruction from memory, 2) decoding the instruction, 3) executing the decoded instruction, and 4) storing the results back in memory. Finally, the document defines an instruction set as the set of all basic operations for a processor to complete tasks.

Uploaded by

SaGar Malla
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/ 18

Welcome To Everyone

Presentation Given By Hemraj Shah


Instruction Format:
An instruction format defines the different component of an instruction. The
main components of an instruction are opcode (which instruction to be executed)
and operands (data on which instruction to be executed).

Opcode: The operation code (opcode) represents action that the processor must
execute. It tells the processor what basic operations to perform.

Operands: The operand code defines the parameters of the action and depends
on the operation. It specifies the locations of the data or the operand on which
the operation is to be performed. It can be data or a memory address.
In instruction format, the bits are grouped together in three parts. The first parts
specifies the addressing modes (MODE),the second parts contains the operation code
(OPCODE).And the third part indicates the address of the data(OPERAND).
Instruction Format Types:

Instruction is of variable length depending upon the number of addresses it


contains. Generally, CPU organization is of three types based on the number of
address fields:
• Single Accumulator organization
• General register organization
• Stack organization
In the first organization, the operation is done involving a special
register called the accumulator. In second on multiple registers are used
for the computation purpose. In the third organization the work on
stack basis operation due to which it does not contain any address field.
Only a single organization doesn’t need to be applied, a blend of
various organizations is mostly what we see generally.
Based on the number of address, instructions are classified as:
• Zero Address Instructions :
A stack-based computer does not use the address field in the instruction. To evaluate an
expression first it is converted to reverse Polish Notation i.e. Postfix Notation.
Expression: X = (A+B)*(C+D)
Postfixed : X = AB+CD+*
TOP means top of stack
M[X] is any memory location

PUSH A TOP = A

PUSH B TOP = B

ADD TOP = A+B

PUSH C TOP = C

PUSH D TOP = D

ADD TOP = C+D

MUL TOP = (C+D)*(A+B)

POP X M[X] = TOP


2 .One Address Instructions:
This uses an implied ACCUMULATOR register for data manipulation. One operand is in
the accumulator and the other is in the register or memory location. Implied means that
the CPU already knows that one operand is in the accumulator so there is no need to
specify it.
Expression: X = (A+B)*(C+D)
AC is accumulator
M[] is any memory location
M[T] is temporary location

LOAD A AC = M[A]

ADD B AC = AC + M[B]

STORE T M[T] = AC

LOAD C AC = M[C]

ADD D AC = AC + M[D]

MUL T AC = AC * M[T]

STORE X M[X] = AC
3.Two Address Instructions :
This is common in commercial computers. Here two addresses can be
specified in the instruction. Unlike earlier in one address instruction, the result was
stored in the accumulator, here the result can be stored at different locations rather
than just accumulators, but require more number of bit to represent address.
Here destination address can also
contain operand.
Expression: X = (A+B)*(C+D)
R1, R2 are registers
M[] is any memory location

MOV R1, A R1 = M[A]

ADD R1, B R1 = R1 + M[B]

MOV R2, C R2 = C

ADD R2, D R2 = R2 + D

MUL R1, R2 R1 = R1 * R2

MOV X, R1 M[X] = R1
4.Three Address Instructions :
This has three address field to specify a register or a memory location. Program created
are much short in size but number of bits per instruction increase. These instructions make
creation of program much easier but it does not mean that program will run much faster
because now instruction only contain more information but each micro operation
(changing content of register, loading address in address bus etc.) will be performed in one
cycle only.
Expression: X = (A+B)*(C+D)
R1, R2 are registers
M[] is any memory location

ADD R1, A, B R1 = M[A] + M[B]

ADD R2, C, D R2 = M[C] + M[D]

MUL X, R1, R2 M[X] = R1 * R2


Instruction Set:

An instruction set is the set of instructions. It is a part of computer architecture. It


specifies the operations, operands, and sequence for the processing of
instructions. They are the set of all basic operations for a processor to complete.

All programs do communicate with the processor using these instruction sets.
These involve a series of logical operations that perform a complete task. The
processor understands the coded instructions.
Instruction Cycle:

• The instruction cycle (also known as the Fetch–Decode–Execute cycle or the


fetch-execute cycle) is the basic operational process of a computer system.

• The time taken for the execution of an instruction is known as Instruction Cycle.

• It is the process by which a computer retrieves a program instruction from its


memory, determines what actions the instruction describes, and then carries
out those actions.

• This cycle is repeated continuously by a computer's central processing unit


(CPU), from boot-up until the computer has shut down
A instruction cycle involves four steps:

Fig: Instruction Cycle


1. Fetching: The processor fetches the instruction from the memory. The
fetched instruction is placed in the Instruction Register. Program Counter holds the
address of next instruction to be fetched and is incremented after each fetch.

2. Decoding: The instruction that is fetched is broken down into parts or decoded. The
instruction is translated into commands so that they correspond to those in the CPU’s
instruction set. The instruction set architecture of the CPU defines the way in which an
instruction is decoded.

3. Executing: The decoded instruction or the command is executed. CPU


performs the operation implied by the program instruction. For example, if it is an
ADD instruction, addition is performed.

4. Storing: CPU writes back the results of execution, to the computer’s memory.
Thank You …...
Any questions ….?

You might also like