Express the statement X= (A*B)-(C*D)-E in the assembly language of each of 0- me
ID: 3557527 • Letter: E
Question
Express the statement X= (A*B)-(C*D)-E in the assembly language of each of 0- memory address machine, 3-register address machine with 3 registers R1,R2,R3, and 2-memory-register-address machine with three registers R1,R2, R3. Your solution should use a minimum number of statements and a minimum number of memory accesses. Compute the number of memory accesses for data and for instructions using the following assumptions: Each memory access is of length one memory word; Opcode and any number of modes and register addresses require only one memory word.
Explanation / Answer
MOV R1,[0]
MOV R2,[0]
MOV R3,[0]
MOV A,R1 ; A=R1
MOV B,R2 ; B=R2
MULT A,B ; A=A*B
MOV C,R3 ;C=R3
MOV D, R1
MOV E, R2
MULT C,D ; C=C*D
SUB C,E ; C=C-E (C=(C*D)-E)
SUB A,C ; A=A-C (A=(A*B)-(C*D)-E)
MOV X, A ; X=A (X=(A*B)-(C*D)-E)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.