Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

Describe the types of instructions on the basis of address fields used in the instruction with example.

Four types of instructions are available on the basis of referenced address fields :
Now, Let us evaluate the following arithmetic expression, using all instruction types.

X = (A + B) * (C + D)

  1. Three address instruction : Computers with three address instruction formats can use each address fields to specify either a processor register or a memory operand. The program in assembly language to evaluate arithmetic expression is shown as :
    ADD R1, A, B R1 ←M [ A ] + M [ B ]
    ADD R2, C, D R2←M [ C ] + M [ D ]
    MUL X, R1,R2 M [ X ]← R1 * R2
  2. Two address instruction : In this format each address field can specify either a processor register or a memory word. The assembly
    language program to evaluate arithmetic expression is as follows :
    MOV R1, A R1← M [A]
    ADD R1, B R1 ← R1 + M [B]
    MOV R2, C R2 ←M [C]
    ADD R2, D R2← R2 + M [D]
    MUL R1, R2 R1← R1 * R2
    MOV X, R1 M [X] ← R1
  3. One address instruction : One address instruction uses an implied accumulator (AC) register for all data manipulation. The program is as follows :
    LOAD A AC← M [A]
    ADD B AC ← AC + M [B]
    STORE T M [T] ← AC
    LOAD C AC← M [C]
    ADD D AC ← AC + M [D]
    MUL T AC← AC * M [T]
    STORE X M [X] ← AC
    All operations are done between the AC register and a memory operand.
  4. Zero address instruction : A stack organized computer does not use an address field for the instructions ADD and MUL. The PUSH and POP instructions need an address field to specify the operand that communicates with the stack. The program is as follows :
    PUSH A TOS← A
    PUSH B TOS ← B
    ADD TOS ← (A + B)
    PUSH C TOS← C
    PUSH D TOS ← D
    ADD TOS ←(C + D)
    MUL TOS← (C + D) *(A + B)
    POP X M [X] v TOS
    where TOS is TOP of the stack.

Leave a Comment