Skip to content
Related Articles

Related Articles

Improve Article
Computer Organization | Instruction Formats (Zero, One, Two and Three Address Instruction)
  • Difficulty Level : Easy
  • Last Updated : 28 Jun, 2020

Computer perform task on the basis of instruction provided. An instruction in computer comprises of groups called fields. These field contains different information as for computers every thing is in 0 and 1 so each field has different significance on the basis of which a CPU decide what to perform. The most common fields are:

  • Operation field which specifies the operation to be performed like addition.
  • Address field which contain the location of operand, i.e., register or memory location.
  • Mode field which specifies how operand is to be founded.

An instruction is of various length depending upon the number of addresses it contain. Generally CPU organization are of three types on the basis of number of address fields:

  1. Single Accumulator organization
  2. General register organization
  3. Stack organization

In first organization operation is done involving a special register called accumulator. In second on multiple registers are used for the computation purpose. In third organization the work on stack basis operation due to which it does not contain any address field. It is not necessary that only a single organization is applied a blend of various organization is mostly what we see generally.

On the basis of number of address, instruction are classified as:

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

  1. Zero Address Instructions –

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

    Expression: X = (A+B)*(C+D)
    Postfixed : X = AB+CD+*
    TOP means top of stack
    M[X] is any memory location
    ADDTOP = A+B
    ADDTOP = C+D
    MULTOP = (C+D)*(A+B)
    POPXM[X] = TOP
  2. One Address Instructions –
    This use a 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 know that one operand is in accumulator so there is no need to specify it.

    Expression: X = (A+B)*(C+D)
    AC is accumulator
    M[] is any memory location
    M[T] is temporary location
    LOADAAC = M[A]
    ADDBAC = AC + M[B]
    LOADCAC = M[C]
    ADDDAC = AC + M[D]
    MULTAC = AC * M[T]
  3. Two Address Instructions –
    This is common in commercial computers.Here two address can be specified in the instruction.Unlike earlier in one address instruction the result was stored in accumulator here result cab be stored at different location rather than just accumulator, but require more number of bit to represent address.

    Here destination address can also contain operand.

    Expression: X = (A+B)*(C+D)
    R1, R2 are registers
    M[] is any memory location
    MOVR1, AR1 = M[A]
    ADDR1, BR1 = R1 + M[B]
    MOVR2, CR2 = C
    ADDR2, DR2 = R2 + D
    MULR1, R2R1 = R1 * R2
    MOVX, R1M[X] = R1
  4. Three Address Instructions –
    This has three address field 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.

    Expression: X = (A+B)*(C+D)
    R1, R2 are registers
    M[] is any memory location
    ADDR1, A, BR1 = M[A] + M[B]
    ADDR2, C, DR2 = M[C] + M[D]
    MULX, R1, R2M[X] = R1 * R2

Attention reader! Don’t stop learning now. Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up
Recommended Articles
Page :