Monday, 2 November 2020

Instruction Formats: Zero, One, Two and Three Address Instruction

 

Instruction Formats (Zero, One, Two and Three Address Instruction):

  • Computer perform task on the basis of instruction provided. An instruction in computer comprises of groups called fields.
  • These fields contain different information as for computers everything is in 0 and 1.
  • So, each field has different significance on the basis of which a CPU decides what to perform.
  • The most common fields are:

  1. Operation field: This specifies the operation to be performed like addition.
  2. Address field: contain the location of operand, i.e., register or memory location.
  3. Mode field: This specifies how operand is to be founded.
  • An instruction is of various lengths depending upon the number of addresses it contains.
  • On the basis of number of address instruction are classified as:


Zero Address Instructions:

  • A stack based computer do not use address field in instruction. To evaluate an expression first it is converted to revere Polish Notation i.e. Post fix Notation.


One Address Instructions:

  • This is used as an implied ACCUMULATOR register for data manipulation.
  • One operand is in accumulator and other is in register or memory location.
  • Implied means that the CPU already knows that one operand is in accumulator so there is no need to specify it.

 

opcode

operand/address of operand

mode

 

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 accumulator here result can be stored at different location rather than just accumulator, but require more number of bit to represent address.

 

opcode

Destination address

Source address

mode

 

Three Address Instructions:

  • This has three address fields 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.

 

opcode

Destination address

Source address

Source address

mode

 

No comments:

Post a Comment