Instruction Format In Computer Architecture

Instruction Format

Instruction Format In Computer Architecture

In computer architecture , the instruction format is defined as standard machine instruction format that can be directly decoded and executed by the central processing unit ( CPU ).

The instruction format is simply a sequence of bits ( binary 0 Or 1 ) contained in a machine instruction that defines the layout of the instruction.

The machine instruction contains number of bits ( pattern of 0 and 1 ). These bits are grouped together called fields.

Each field of the machine instruction provides specific information to the CPU regarding the operation to be performed and the location of the data.

Instruction Format Type

Instruction Format

Example

Zero Address Instruction

CMA 

CME

One Address Instruction

ADD 06H 

LDA 20H

Two  Address Instruction

MOV R1 , R2

ADD AX , BX

Three Address Instruction

ADD R1 , R2 , R3

SUB R1 , R2 , R3

Instruction Format Types

An instruction format is also defied as layout or pattern of bits in the machine instruction that directs the CPU to decode and execute the instruction.

In other words , the instruction format defines the layout of the bits for the instruction. The  instruction formats supported by the CPU depends upon the instruction set architecture ( ISA ) implemented by the processor.

In this tutorial , you will learn what is instruction format , how CPU decodes and execute the instruction , different types of instruction formats and other related important topics.

Before we discuss the instruction format , let us first understand what is a instruction in computer architecture.

What Is Instruction Format ?

What Is Instruction ?

Every task performed by the computer needs a program. A computer program is set of instructions that directs the computer to perform specific task.

A computer program contains a set of program statements. Each program statement performs a part of the intended operation. The computer program can contain many such statements.

Program Source Code

Computer Program , Instruction Cycle

Program Compilation

Computer Program Compilation

However , the central processing unit ( CPU) of the computer cannot directly execute the program written in any high level language. The CPU can execute only machine instructions in binary.

 And therefore , all computer programs are first compiled ( converted ) to binary format. The compiler converts the program statements into its equivalent machine instructions in binary format.

The compiler converts the high level program instructions into low level machine instructions in binary that consist of either zero or one.

In computer architecture , the instruction is defined as  a machine instruction in binary that can be directly executed by the processor.

Computer Program Compilation And Linking

Instruction Format

What Is Instruction Format ?

The instruction format is a pattern of bits that control unit of the CPU can decode. After the decode operation is complete the CPU executes the instruction as per the instruction set architecture ( ISA ).

The instruction format describes the layout of the instruction in terms of group of bits called fields of the instruction format.

Each field ( group of bits ) in the instruction format provide a specific information to the processor. The processor needs to know the information regarding the operation to be performed and the location of the data ( address ).

Program Source Code

Instruction Cycle , Instruction Format

Program Compilation

Instruction Cycle , Instruction Format

For example , the OPERAND part of the instruction format indicates either data or the address of the data . The operation code OPCODE part indicates the type of operation to be performed on the data.

And the addressing mode part of the instruction format indicates the manner in which the data is represented into the instruction format.

The types of instruction formats supported by the CPU depends upon the instruction set architecture ( ISA ) implemented by the CPU.

Instruction Set Architecture
Microprocessor Instruction Set Architecture

The operating system loads the machine instructions and the data into the main memory RAM. The processor initiates the program execution.

The CPU starts the program execution by fetching these instructions one by one. The fetched instruction is stored into the instruction register of the control unit.

The standard machine instruction format is in binary and consist of multiple bits . Each bit in the machine instruction format is represented in binary ( either 0 Or 1 ) .

In machine instruction format , the bits are grouped together depending upon the type of the instruction format. Each part ( group of bits ) gives specific information to the CPU required to decode and execute the operation.

Computer Organization

In order to execute the instruction, the CPU needs to know three things.

The CPU first needs to know which operation is to be performed and  the address of the data that CPU needs to operate. The instruction also contains the details of direct or indirect referencing.

In instruction format , the bits are grouped together in three parts. The first part specifies the  addressing mode ( MODE ), the second part contains the operation code ( OPCODE ). And the third part indicates the address of the data ( OPERAND ).

Program Instruction Format , Instruction Cycle, Computer Organization And Architecture

Instruction Format

Addressing Mode

What Is Addressing Mode ?

The first part of the instruction format  is called addressing mode. The data can either be stored in the main memory RAM or it can be located in the CPU register.

The addressing mode is defined as the manner in which data is represented into the instruction format.

The addressing mode is the third field in the instruction format represented by a single bit. For example , in 16 bit instruction format the addressing mode is represented by the 15th bit.

The addressing mode directs the CPU to locate the data ( OPERAND ) as specified in the machine instruction format.

Instruction Addressing Modes

Operation Code

What Is Operation Code ?

During the program execution , the instruction is fetched into the instruction register. The instruction register ( IR )  is a 16 bit register and a part of the IR is used to store the operation code.

The second part of the instruction format  is called operation code. For sixteen bit instruction format the group of three bits ( bit number 12, 13, 14  ) indicates the operation code ( OPCODE ) .

CPU Registers

Control Unit , CPU Control Unit, Computer Organization And Architecture

The operation code OPCODE is decoded by the decoder of the control unit. The control unit is one of the three important component of the microprocessor architecture.

The control unit decodes the OPCODE as per the instruction set architecture of the CPU . The control unit generates the control signals for the ALU to execute the desired operation on the OPRAND.

What Is Operand ?

In computing , the OPERAND part of the instruction format specifies either data or the address of the data that needs to be operated by the processor.

After decoding the instruction, the CPU next needs to know the data on which the operation is to be performed as per the operation code.

Depending upon the type of the format supported by the processor , the instruction might contain zero to three operands. The zero address type of instruction does not contain the operand part.

The operand can either contain the data or the address of the data. The addressing mode value directs the CPU to fetch the data.

Instruction Format 16 Bits , Instruction Register

If the value of the addressing mode is 0 ( zero ) then it is referred as direct referencing. For direct referencing the operand contains the data.

Whereas, If the value of the addressing mode is 1 ( one ) then it is referred as indirect referencing. For indirect referencing the operand contains the memory address that points to the data.

Instruction Format

Types Of Instruction Format

In computer architecture , the instruction formats can be classified into two main groups .

The first type is based on the number of operands present into the instruction format . And second types of instruction group is based on the memory organization of the CPU.

One , Two And Three Address Instructions

Zero Address Instruction

As the name suggest , the zero address instruction format does not have any operand field . This is a instruction format without any operand.

The zero address instruction format is supported by the stack organized computer system.

In order to evaluate the arithmetic expressions in stack organized computer, it is necessary to convert the expression into reverse polish notation.

Zero Address Instruction

One Address Instruction

The one address instruction format makes use of an implied accumulator for all data manipulation operations. An accumulator ( AC ) is a type of register used by the CPU to perform the mathematical and logical operations.

In this type of instruction format , the accumulator is implied and does not require explicit reference. The one address instruction format is supported by the CPU with single accumulator organization.

The one address instruction format has only one operand fields. This single address fields can be either memory address or register.

One Address Instruction

The one address instruction format use two special instructions ( LOAD and STORE ) for data transfer operations.

The Load instruction  is used to transfer the data to the accumulator ( AC ). The STORE instruction is used to move the data from accumulator to the memory.

Instruction Format

Two Address Instruction

The two address instruction format is the most commonly used instruction format used in the all commercial computers.

The address instruction format has three operand fields. These two address fields can be either memory address or registers.

The main advantage of the three address instruction is that it requires shorter assembly language instructions.

The disadvantage of the of the three address instruction is that it requires more number of bits in its binary machine instruction form.

Two Address Instruction

Three Address Instruction

The three address instruction format has three operand fields. These three address fields can be either memory address or registers.

The main advantage of the three address instruction is that it requires shorter assembly language instructions.

The disadvantage of the of the three address instruction is that it requires more number of bits in its binary machine instruction form.

Three Address Instruction

In three address instruction format , the first field indicates the operation code ( OPCODE ). The operation code specify the operation to be performed on the data.

The second and third field of the instruction format contain the ( OPERAND 1 ) and ( ( OPERAND 2 ) respectively.

The OPERAND 1 and OPERAND 2 will contain the data or the address of data that will be operated by the CPU. Whereas , the third field contains the OPERAND 3. This field contains the address of the result .

Join The Best Seller

Computer Science Online Course

This is the most comprehensive  and unique  Computer Science  And Programming Fundamentals course Online which will give you in depth understanding of most important fundamental concepts in computer science And Programming .

Don`t copy text!