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 ). Programmers write code in high level language. This high level program needs to be compiled into machine instructions in Binary ( 0 And 1 ).

In other words, 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.

What Is Instruction Format ?

What Is Machine Instruction ?

Computer program consists of set of instructions which directs the processor to perform specified task. In computer architecture, an instruction format refers to the layout of bits in an instruction, which includes information necessary for the processor to understand and execute the tasks as per the program instruction.

The instruction format is crucial because it determines how program communicate efficiently with a processor. The CPU decodes and executes the instructions one by one. Different architectures may use different instruction formats.

Machine Instructions In Binary

When a high level program is compiled into low level binary code, it is referred as machine code that CPU can directly execute. A machine code can have many instructions and these instructions in binary are referred as machine instructions.

A machine instruction in binary is the lowest level of programming in binary instruction that a computer’s central processing unit (CPU) can understand and execute directly.

It consists of a series of binary digits (0s and 1s) that represent specific operations, addresses, and data required for the CPU to perform a task. Each binary digit within the instruction corresponds to a particular control signal or piece of data within the CPU. It is the job of the control unit present in the CPU to decode the instruction.

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

Machine Instruction Format

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 executes 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 ?

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 the 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

The binary machine instruction is encoded according to the computer’s instruction set architecture (ISA). which defines the set of instructions that the processor can understand and execute. Each CPU architecture has its own unique instruction set. Therefore, the high level programs are compiled for a specific platform.

Programmers write application software, usually in high level. Whereas, system software coding is done in either machine code or assembly language, which directly corresponds to these binary instructions, to communicate with the CPU.

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 ).

Instruction Format Example

Instruction Cycle , Instruction Format

Program Instruction Execution

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

Instruction Set Architecture

What Is ISA ?

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 ).

Instruction Format, Program Instruction Format , Instruction Cycle, Computer Organization And Architecture

Instruction Format

Addressing Modes

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 the location of  the data ( OPERAND ) that needs to be operated by the CPU as specified in the machine instruction. 

Instruction Format 16 Bits , Instruction Register

Addressing Modes Types

The addressing mode bit in the instruction format defines the rules for the operand. The addressing mode supported by the processor depends upon the microprocessor architecture and the ISA – Instruction Set Architecture.

For example, the RISC architecture supports only five basic addressing modes. Whereas, the CISC architecture supports over ten plus addressing modes.  

Operation Code

What Is Operation Code ?

What Is OPCODE ?

The operation code ( OPCODE ) is a group of bits specified in the instruction format which directs the processor to perform the specific operation.

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 the 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 , Control Unit Functions

The operation code OPCODE is decoded by the decoder unit 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 arithmetic logic unit  ALU to execute the desired operation on the OPRAND.

Control Unit And Instruction Format

Control Unit Decodes OPCODE

Instruction Format

What Is Operand ?

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

After decoding the instruction, the CPU next needs to know the location of 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 Addressing Modes, Instruction Format

If the value of the addressing mode is 0 ( zero ) then it is referred as direct referencing. For the 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 the indirect referencing, the operand contains the memory address that points to the data.

Instruction Format

Types Of Instruction Formats

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.

Instruction Format Types

One , Two And Three Address Instructions

Instruction Format

Zero Address Instruction

As the name suggest , the zero address instruction format does not have any operand field . This is an 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

Zero Address Instruction Example

Assembly Language Instruction

PUSH    A

PUSH    B

ADD 

PUSH    C

PUSH    D

ADD 

MUL  

POP      X 

Stack Transfer Operation

TOS ←  A

TOS ←  B

TOS ← ( A + B )

TOS ←  C

TOS ←  D

TOS ← ( C + D )

TOS ← ( C + D ) * ( A + B )

M[X] ←  TOS

The TOS  stands for Top Of The Stack

Instruction Format , Zero Address Instruction Format Example

Instruction Format Types

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.

One Address Instruction Example

Assembly Language Instruction

LOAD     A   

ADD       B          

STORE  T   

LOAD     C     

ADD       D      

MUL       T       

STORE  X     

Register Operation Instruction

AC ←  M[A]

AC ←  AC + M[B]

M[T] ← AC

AC ←  M[C]

AC ←  AC + M[D]

AC ←  AC * M[T]

M[X] ←  AC  

Instruction Format Types

Instruction Format , One Address Instruction Format Example

Two Address Instruction

The two address instruction format is the most commonly used instruction format used in the all commercial computers. The two address instruction format has two operand fields. These two address fields can be either memory address or registers.

The main advantage of the two address instruction is that it requires shorter assembly language instructions. The disadvantage of the of the two address instruction is that it requires more number of bits in its binary machine instruction form.

Two Address Instruction

Two Address Instruction Example

Assembly Language Instruction

MOV  R1, A

ADD R1, B

MOV  R2, C

ADD R2, D

MUL R1, R2

MOV  X, R1   

Register Operation Instruction

R1 ←  M[A]

R1 ←  R1  +  M[B]

R2 ←  M[C]

R2 ←  R2  +  M[D]

R1 ←  R1  *  R2

M[X]  ←  R1   

Instruction Format Types

Instruction Format , Two Address Instruction Format Example

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 fourth field indicates the operation code ( OPCODE ). The operation code specify the operation to be performed on the data. The fifth field indicates the addressing mode.

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 .

Three Address Instruction Example

Assembly Language Instruction

ADD   R1, A, B   

ADD   R2, C, D

MUL   X, R1, R2

Register Operation Instruction

R1 ←  M[A] +  M[B]

R2 ←  M[C] +  M[D]

M[X] ←  R1 * R2

Instruction Format Types

Three Address Instruction Format Example , Instruction Format

Instruction Format And Computer Architecture

In computer architecture, a computer program consists of number of instructions for CPU to perform specific tasks. An instruction format defines the structure and organization of machine instructions that a computer’s central processing unit (CPU) can execute.

The instruction format specifies how the operation code (opcode) and operands are represented within an instruction. Different computer architectures use various instruction formats, and each format has its unique characteristics.

Each computer architecture may have a different set of instruction formats tailored to its design and intended use cases. The choice of instruction format can significantly impact the efficiency and capabilities of a CPU, making it a crucial consideration in computer architecture design.

Here are some common types of instruction formats:

  1. R-Type (Register) Instruction Format.
  2. I-Type (Immediate) Instruction Format.
  3. J-Type (Jump) Instruction Format.
  4. Memory Load and Store Formats.
  5. Format for Floating-Point Instructions.
  6. Format for Control and Branch Instructions.
  7. Format for Vector and SIMD Instructions.
  8. Variable-Length Instruction Formats.

Instruction Format Types

Instruction Format And Computer Architecture

R-Type (Register) Instruction Format

  • Opcode: Specifies the operation to be performed.
  • Source Registers: Registers that store source data for the operation.
  • Destination Register: The register where the result is stored.
  • Function Code: Additional control information, often used to distinguish between suboperations.

I-Type (Immediate) Instruction Format

  • Opcode: Specifies the operation.
  • Source Register: A register that provides a source operand.
  • Immediate Value: A constant or immediate value used as an operand.
  • Destination Register: The register where the result is stored.

J-Type (Jump) Instruction Format

  • Opcode: Specifies a jump operation.
  • Address: The target address for the jump or branch instruction.

Memory Load And Store Formats

  • These formats are used for memory-related operations like loading data from memory (load) and storing data into memory (store).
  • They typically include opcode, source/destination registers, and an offset to specify the memory location.

J-Type (Jump) Instruction Format

In computer architecture, a computer program consists of number of instructions for CPU to perform specific tasks.

Format For Floating-Point Instructions

  • Floating-point instruction formats are used for operations involving floating-point numbers.
  • They include opcode, source registers, destination register, and sometimes immediate values.

Format For Control And Branch Instructions

  • Branch and control instructions often have a unique format that includes conditions, target addresses, and opcodes for control flow operations.

Format For Vector And SIMD Instructions

  • In modern processors, vector and single instruction, multiple data (SIMD) instructions have their own formats for processing multiple data elements simultaneously.

Variable-Length Instruction Formats

  • Some architectures use variable-length instruction formats, where the length of the instruction can vary based on the specific opcode and operands.

Instruction Format FAQ

What Is Instruction Format ?

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

The instruction format is simply a sequence of bits contained in a machine instruction that defines the layout of the instruction.

The instruction format defines the layout of the machine instruction.

What Are Types Of Instruction Formats ?

In computer architecture, there are four types of instruction formats.

  1. Zero Address Instruction Format.
  2. One Address Instruction Format.
  3. Two Address Instruction Format.
  4. Three Address Instruction Format.

What Is Instruction ?

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

The computer program in high level language is compiled to low level set of machine instructions in binary.

Each machine instruction directs the CPU to perform a specific task.

Why Do We Need Instruction Format ?

In computer architecture, the main function of the processor is to execute the program.  in order to execute the program, the processor needs to know three things.

  1. Which operation is to be performed ( OPCODE ).
  2. The location ( Address ) of the data ( Operand ).
  3. Rules to find the data ( Addressing Mode ).

The instruction format provides this information to the processor. The instruction formats supported by the processor depends upon the instruction set architecture ( ISA ) of the processor.

What Are Parts Of The Instruction ?

In computer architecture, the machine instruction is represented by a specific number of bits such as 8 bits or 16 bits instruction.

the instruction has three important parts. These are group of bits also called as fields of instruction format.

  1. Operation Code called as OPCODE.
  2. The Operand part of the instruction contains either the data or the address of the data.
  3. The addressing mode part of the instruction defines the rules for the operand represented into the machine instruction.

What Is The Difference Between Instruction And Instruction Formats ?

The instruction and the instruction format are two different things.

In computer architecture, the term instruction refers to the program instruction or machine instruction in the binary format. The computer program consists of set of instructions.

Different types of instructions are used in computer programming depending upon the syntax of the programming language.

Whereas, the term instruction format refers to the layout of the instruction in terms of group of bits called the fields.

The instruction format fields include operand, OPCODE, and the addressing mode.

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 .

Other Related Topics

What Is Control Unit ?

What Is Central Processing Unit ?

What Are CPU Registers ?

Instruction Set Architecture

Introduction To Computer System

Don`t copy text!