Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Techno International Newtown

Technical Report Writing for CA-2 Examination

Topic- Instruction Format

Name-Manikant Pandey
Roll No.-
Dept.- Information technology
Sec- B
Semester- 3rd
Sub- Computer Organisation
(PCC CS-302)
Introduction
Instruction Formats
A computer executes a task in accordance with the given instructions. Computer
education is divided into sections called domains. Since everything in a computer is a 0
or a 1, each of these fields holds a distinct piece of information from which the CPU
derives its actions. The most typical fields include:
● The operation to be carried out, such as addition, is specified in the operation field.
● Address field that specifies the register or memory location of the operand.
● Mode field, which describes how to establish operand.

The amount of addresses an instruction contains determines its length. Based on the
quantity of address fields, CPU organisation typically falls into one of three categories:
1. Single Accumulator organization
2. General register organization
3. Stack organization

In the first company, the operation is carried out using a unique register known as the
accumulator. Multiple registers are employed for computation from the second on. There
is no address field since stack-based operations are used in the third organisation. A
combination of different organisations is typically what we perceive, thus just one
organisation needs to be used.

The following categories of instructions are based on address number:

1. Zero Address Instructions


2. One Address Instructions
3. Two Address Instructions
4. Three Address Instructions

Note that we will use X = (A+B)*(C+D) expression to showcase the procedure.


Zero Address Instructions

A stack-based computer does not use the instruction's address field. An expression is first
translated to reverse Polish Notation, or Postfix Notation, in order to be evaluated.

The formula X = (A+B)*(C+D)


After fixing: X = AB+CD+*
TOP denotes the top of the stack,
and any memory location is M[X].

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


One Address Instructions

This manipulates data using an inferred ACCUMULATOR register. The


accumulator holds one operand, and the register or memory address holds the
other. Implied indicates that there is no need to explicitly state that one operand is
in the accumulator because the CPU already understands this.

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
Two Address Instructions

This is typical of desktop computers. Here, the instruction has the option of
specifying two addresses. The result can now be stored in several locations rather
than just accumulators, which requires more bits to represent the address than it did
in prior address instructions where the result was saved in the accumulator.

Here the 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
Three Address Instructions

Three address fields on this allow you to define a register or memory location. The
size of the programmes developed is substantially less, but the number of bits per
instruction rises. These instructions simplify programme construction, but they do
not result in faster programme execution because each micro operation (such as
altering a register's contents or loading an address into the address bus) is still
completed in a single cycle.

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


REFERENCE

BOOKS:
Computer organisation and design by Chowdhury P. Pal

WEBSITE:
Google
GeeksforGeeks
Tutorialspoint

You might also like