• A computer instruction is made up of an operation code (op-code) followed by either zero, one or two bytes of operands.


  • Instruction
    • An instruction is a signal(command) in the form of sequence of 0s and 1s(machine language) that is given to a computer’s processor(microprocessor) to do some specific task/physical operation, with the help of the hardware on a specified data.
    • In another way, the words of a machine language are known as instructions. 
  • Instruction Set
    • The syntax of an instruction is known as an instruction set.
    • Instruction set is the collection of machine language instructions that a particular processor understands and executes.
    • In other words, instruction set is a set of assembly language mnemonics represents the machine code for a particular computer.
    • A complete set of instruction is called Instruction set hence an instruction is better called Instruction set.


  • Instruction
    • An instruction is usually supplied by a user or computer program.
    • They are stored in memory and registers.
    • The instruction execution is achieved by executing micro-operations in a specific sequence. For different instructions, this sequence may be different.
    • The purpose of instruction is to communicate with CPU what to do, i.e.
      • What operation to perform?
      • On what operands?
    • A computer can have a large number of instructions and addressing modes. The older computers with the growth of Integrated circuit technology have a very large and complex set of instructions(CISC) whereas in latest computers which execute simple instructions much faster having simple instructions, registers addressing and move registers(RISC).
    • The basic assumption for an instruction set when design includes –
      • A set of data types (e.g. integers, long integers, doubles, character strings etc.).
      • A set of operations on those data types.
      • A set of instruction formats which includes number of addresses, instruction length etc.
      • A set of techniques for addressing data in memory or in registers.
      • The number of registers which can be referenced by an instruction and how they are used.
  • Instruction Set
    • The instructions available in a computer are machine dependent, that is, a different processors have different instruction sets.
    • Instruction set is the boundary where the computer designer and the computer programmer see the same computer from different way/viewpoints i.e. from the designer’s point of view, the computer instruction set provides a functional description of a processor and from the programmer’s point of view, the user must understand machine or assembly language for low-level programming.

Structure/Format of an Instruction

  • The arrangement or layout of elements/components of instruction is called Instruction format.
  • Instruction formats are primarily machine dependent.
  • A CPU instruction set can use many instruction formats at a time. Even the length of opcode varies in the same processor. 
  • Instruction set can take different formats for different machine i.e. instruction format may be  of variable length instructions but a typical/most common instruction set consists of : –
      • The instruction length
      • The instruction type
      • The length and position of operation codes(Opcode) in an instruction
      • The number and length of Operand addresses.

Instruction Length :

      • This field gives the total length of Instruction format.

Operation code(Opcode) : 

      • Opcode is the instruction machine code that specifies the operation/task to be performed.
      • An operation code field specifies what operation to be performed.
      • The size of opcode is 6 bits and hence it will have 26 = 32 operations.
      • The opcode field of an instruction is really a group of bits that define various processor operations such as LOAD, STORE, ADD, SHIFT etc. to be performed on some data stored in registers or memory.

Addressing Mode : 

      • The addressing mode field of an instruction specifies a variety of alternatives for referring to operands using the given address.
      • There are two bits for addressing modes and hence there are 22 = 4 different addressing modes possible for a machine.

Operands : 

      • An operand is a data value on which data processing is to be performed.
      • In computer programming, an operand is a term used to describe any object that is capable of being manipulated or the data to be operated on, called the operand.
      • For example, in an expression 2+4  the 2 and 4 are the operands and the plus symbol is the operator.
      • An operand can be a constant value, a variable, a function result,  register values, values in the stack, other memory values, I/O ports etc.
      • The operand (or data) can be specified in various ways i.e., it may include 8-bit (or 16-bit) data, an internal register, a memory location, or 8- bit (or 16-bit) address.
      • In some instructions, the operand is implicit.
      • An address field of operand is so important because data processing is to be performed on it.
      • An operand can reside in the memory or a processor register or can be incorporated within the operand field of instruction as an immediate constant. Therefore a mode field is needed that specifies the way the operand or its address is to be determined.
      • The operand address field can be data, or address of data, or can be labels, which may be the address of an instruction we want to execute next, such labels are commonly used in Subroutine call instructions. Thus, an operand address can be: –
        • The memory address
        • CPU register address
        • I/O device address
      • It is an address of operand in memory. The maximum physical memory size supported by a machine is 224 = 16 MB.
      • In case of immediate operand(roughly constant value), the maximum size of the unsigned operand would be 224.
      • Operand is the part of an instruction that specifies the address of the source or result, or the data itself on which the processor is to operate.
      • Operand Types
        • Operand types usually give operand size implicitly.
        • In general, operand data types can be divided in the following categories-

(1.) Addresses:

        • Operands residing in memory are specified by their memory address and operands residing in registers are specified by a register address are used by the processor.
        • Addresses provided in the instruction are operand references.

(2.) Numbers:

        • All machine languages include numeric data types.
        • Numeric data usually use one of three representations:-
          (I) Floating-point numbers :
          • These are Single precision of 32 bit  (1bit for sign bit, 8 bit for exponent bits, 23 bit for mantissa bits) and Double precision of 64 bit (1 bit for sign bit, 11 bit for exponent bits, 52 bits for mantissa bits).

    (II) Fixed point numbers :

          • These numeric values may be signed or unsigned.

    (III)Binary Coded Decimal Numbers:

          • Most of the machines provide instructions for performing arithmetic operations on fixed point and floating-point numbers. However, there is a limit in magnitude of numbers due to underflow and overflow.

(3.) Characters:

        • It is a common form of data is text or character strings.
        • Characters are represented in numeric form, mostly in ASCII (American Standard Code for Information Exchange).
        • Another form of Code is used to encode characters is the Extended Binary Coded Decimal Interchange Code (EBCDIC).

(4.) Logical Data:

        • Each word or byte of data is treated as a single unit of data.
        • When an n-bit data unit is considered as consisting of n 1-bit items of data with each item having the value 0 or 1, then they are viewed as logical data. Such bit-oriented data can be used to store an array of Boolean or binary data variables where each variable can take on only the values 1 (true) and 0 (false).
        • One simple application of such a data may be the cases where we manipulate bits of a data item.
        • For example, in floating-point addition we need to shift mantissa bits.

Type of Instruction set.

(A) On the basis of Word size of an Instruction,the instruction set may be classified into the following three groups :-(Here, byte and word are consider synonymous because when we consider an 8-bit microprocessor. However, instructions are commonly referred to in terms of bytes rather than words.)

(i)One-word or 1-byte instructions

    • A 1-byte instruction includes the opcode and operand in the same byte.
    • Here, operand(s) are internal register and are coded into the instruction. 

(ii)Two-word or 2-byte instructions

    • In a two-byte instruction, the first byte specifies the operation code and the second byte specifies the operand.
    • Here, source operand is a data byte immediately following the opcode.

(iii)Three-word or 3-byte instructions

    • In a three-byte instruction, the first byte specifies the opcode, and the following two bytes specify the 16-bit address. The second byte is the low-order address and the third byte is the high order address.
    • In consists of  – opcode + data byte + data byte
    • This instruction would require three memory locations to store in memory.   

(B) On the basis of use or function of instruction, they are classified into :- 

(a) Data Transfer Instructions

  • These instructions transfer data from one memory location in the computer to another location without changing the data content.
  • The most common data transfers occurs between –
    • registers and memory
    • registers and I/O
    • registers  to registers
  • Examples are – Load(LD), Store(ST), Move(MOV), Exchange(XCH), Clear, Set, Push, Pop etc.

(b) Data Processing Instructions

  • These instructions are responsible for arithmetic as well as logical operations on data.
  • Data Manipulation/Processing Instructions can be divided into three basic types:-
    • Arithmetic Instructions :
      • These instructions perform mathematical calculations mainly.
      • The four basic arithmetic operations are ADD, SUB, MUL and DIV.
      • An arithmetic instruction may operate on fixed-point data, binary or decimal data etc.
      • The execution of arithmetic instructions requires the operands in the operational registers so that the data can be processed by ALU.
      • The other possible arithmetic operations include a variety of single-operand instructions, for example ABSOLUTE, NEGATE, INCREMENT, DECREMENT.
    • Logical Instructions :
      • These instructions operate on binary data stored in registers.
      • Examples are – AND, OR, NOT, XOR etc. 
      • We can explain this instruction like as follows – Suppose two registers contain the data say
        R1 = 1011 0111
        R2 = 1111 0000
        R1 AND R2 results = 1011 0000.

Thus, the AND operation can be used as a mask that selects certain bits in a word and zeros out the remaining bits. 

    • Shift Instructions :
      • Shift operation is used for transfer/move/shift bits stepwise or one by one either to the left or to the right.
      • It can be used to realize simple arithmetic operation or data communication/recognition etc.
      • Shift operation is of three types :-
        (i) Logical shifts:
        • Logical shift instructions works in two modes – LOGICAL SHIFT LEFT and LOGICAL SHIFT RIGHT insert zeros to the end bit position and the other bits of a word are shifted left or right respectively.
        • The end bit position is the leftmost bit for shift right and the rightmost bit position for the shift left. The bit shifted out is lost.

    (ii) Arithmetic shifts :

        • Arithmetic shift instructions works in two modes – ARITHMETIC SHIFT LEFT and ARITHMETIC SHIFT RIGHT are the same as LOGICAL SHIFT LEFT and LOGICAL SHIFT RIGHT except that the sign bit it remains unchanged.
        • On an arithmetic shift right, the sign bit is replicated into the bit position to its right.
        • On an arithmetic shift left, a logical shift left is performed on all bits but the sign bit, which is retained.
        • The arithmetic left shift and a logical left shift when performed on numbers represented in two’s complement notation cause multiplication by 2 when there is no overflow. Arithmetic shift right corresponds to a division by 2 provided there is no underflow.

     (iii) Circular shifts :

        • Circular shift instructions also works in two modes – ROTATE LEFT and ROTATE RIGHT.
        • Here, Bits shifted out at one end of the word are not lost as in a logical shift but are circulated back into the other end.

(c) String Processing Instructions

  • These instructions are applied on Characters and Strings.
  • String manipulation typically is done in memory.
  • Character & String instructions are – COMPARE STRING, COMPARE CHARACTER, MOVE STRING and MOVE CHARACTER.
  • While compare character usually is a byte-comparison operation, whereas compare string always involves memory address.

(d) Program Control Instructions

  • These instructions specify conditions for altering the sequence of program execution or the content of PC (program counter) register.
  • The most common program control instructions are: – BRANCH, JUMP, SKIP, CALL, RETN, 

(e) Privileged Instructions

  • Most computer instructions are broadly divided into two categories – privileged and non-privileged.
  • A process running in privileged mode can execute all instructions from the instruction set while a process running in user mode can only execute a sub-set of the instructions.
  • I/O instructions are one example of privileged instruction, clock interrupts are another one.

(f) Miscellaneous Instructions

  • These instructions do not fit in any of the above categories.
  • Some of the important miscellaneous instructions are –
    • I/O instructions :
      • Examples are – start I/O, stop I/O, and test I/O.
      • Typically, I/O destination is specified as an address.
    • Interrupts and state-swapping operations :



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.