Prev

Home

Next

Suggestion Box

CPSC 418: Solution 3 correction

There were some typos with the DLOAD and DSTORE instructions in the solution for HW-03, prob 1(a). The solution has been corrected on the web pages and is included below:

         LADDx   0x1000, NULL, R3       ; R3  = i (loop count)
 LOOP_D: ADD     R11,    R3,   R12      ; R12 = &B[i]
         DLOAD   0(R12),  R13           ; R13 = M[R12] !!
         ADD     R14,    R3,   R15      ; R15 = &C[i]
         DLOAD   0(R15),  R16           ; R16 = M[R15] !!
         NOP
         MULx    R13,    R16,  R10      ; R10 = B[i] * C[i]
         ADD     R8,     R3,   R9       ; R9  = &A[i]
         DSTORE  R10,    0(R9)          ; M[R9] = R10 (result)  !!
         LSUBc   R3,     1,    R3       ; i   = i - 1
         JUMPGTE LOOP_D
         NOP
Thanks to Dominic for pointing this out.

NOTE: the syntax is inst src1 src2 dest
NOTE: with displacement addressing mode, if the displacement field is 0, you don't need to write it


Prev

Home

Next

Suggestion Box
Last modified: 13 Mar 96