INSTRUCTION FORMAT IN COA

Instruction Format
An instruction format defines:
ü  Operands reside in the memory are specified by their memory address.
ü  Operands residing in the processor register are specified by the register address.
ü  A register address is a binary number of k bits that define one of the 2k  registers of the CPU.

a)     3 ADDRESS
b)    2 ADDRESS
c)     1 ADDRESS
d)    0 ADDRESS


These can be explain by taking an example:
X= (A+B)*(C+D)



Ø   3 ADDRESS:
ADD       R1,A,B            R1<-M[A]+M[B]
ADD        R2,C,D          R2<-M[C]+[D]
MUL       X,R1,R2          M[X]<-R1*R2
Ø  2 ADDRESS:

MOV        R1,A            R1<-M[A]
ADD         R1,B           R1<-R1+M[B]
MOV        R2,C           R2<-M[C]
ADD         R2,D           R2<-R1+M[D]
MUL         R1,R2         R2<-R2*R1
MOV         X,R2           M[X]<-R2

Ø  1 ADDRESS:
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*M[T]
STORE     X                 M[X]<- AC
Ø  0 ADDRESS
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<-(A+B)*(C+D)
POP         X                M[X]<-TOS



In my next post I will explain about addressing mode.








Share this

Related Posts

Previous
Next Post »

Powered by Blogger.

Popular Posts