logo

Arithmetic Operations with General Register Computer

   

Added on  2023-01-19

9 Pages1059 Words74 Views
Q1. Consider the arithemetic operation below,
x=(3*A*B*C+D*E*F)/(G-H-2*K)
A) using general resister computer with three address instructions
MUL R1,3,A R1=3+M[A]
MUL R1,R1,B R1=R1+M[B]
MUL R1,R1,C R1=R1+M[C]
MUL R2,D,E R2=M[D]+M[E]
MUL R2,R2,F R2=R2+M[F]
ADD R1,R1,R2 R1=R1+R2
SUB R2,G,H R2=M[G]-M[H]
MUL R3,2,K R3=2*M[K]
SUB R2,R2,R3 R2=R2-R3
DIV X,R1,R2 M[X]=R1/R2
B) using general register computer with two address instructions
MOV R1,3 R1=3
MUL R1,A R1=R1*M[A]
MUL R1,B R1=R1*M[B
MUL R1,C R1=R1*M[C]
MOV R2,D R2=M[D]
MUL R2,E R2=R2*M[E]
MUL R2,F R2=R2*M[F]
ADD R1,R2 R1=R1+R2
MOV R2,G R2=M[G]
Arithmetic Operations with General Register Computer_1
SUB R2,H R2=R2-M[H]
MOV R3,2 R3=2
MUL R3,K R3=R3*M[K]
SUB R2,R3 R2=R2-R3
DIV R1,R2 R1=R1/R2
MOV X,R1 M[X]=R1
C) Using a general register computer with one address instructions
LOAD 3 AC=3
MUL A AC=AC*M[A]
MUL B AC=AC*M[B]
MUL C AC=AC*M[C]
STORE T M[T]=AC
LOAD D AC=M[D]
MUL E AC=AC*M[E]
MUL F AC=AC*M[F]
ADD T AC=AC+M[T]
STORE T1 M[T1]=AC
LOAD G AC=M[G]
SUB H AC=AC-M[H]
STORE T2 M[T2]=AC
LOAD 2 AC=2
MUL K AC=AC*M[K]
STORE T3 M[T3]=AC
Arithmetic Operations with General Register Computer_2
LOAD T2 AC=M[T2]
SUB T3 AC=AC-M[T3]
STORE T4 M[T4]=AC
LOAD T1 AC=M[T1]
DIV T4 AC=AC/M[T4]
STORE X M[X]=AC
D) zero address(stack)
PUSH 3 TOP=3
PUSH A TOP=A
MUL TOP=3*A
PUSH B TOP=B
MUL TOP=3*A*B
PUSH C TOP=3*A*B*C
PUSH D TOP=D
PUSH E TOP=E
MUL TOP=D*E
PUSH F TOP=F
MUL TOP=D*E*F
ADD TOP=(3*A*B*C+D*E*F)
PUSH G TOP =G
PUSH H TOP=H
SUB TOP=(G-H)
Arithmetic Operations with General Register Computer_3

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Computer Organization and Architecture : Assignment
|6
|778
|175

Computer Architecture and Organization | Report
|6
|671
|355

Computer Organization and Architecture | Document
|6
|543
|88

Report on Computer Organization and Architecture
|5
|527
|86

Assignment Computer Organization and Architecture
|6
|520
|39

FIN700 Financial Management Assignment
|16
|2365
|84