Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

l) Assignment Statements - In general, values in a program are stored in the mem

ID: 667298 • Letter: L

Question

l) Assignment Statements - In general, values in a program are stored in the memory system, and when work is needed, these values are loaded into the registers and used in appropriate ways. When a new value has been calculated for a variable, the value is stored moved from the register where the calculated value is located to the assigned location in memory. In a RISC architecture, all work is done in the registers, and the memory is used as storage only. Create a text file (use the “ s" convention) that contains eight store statements, plus a couple of nop's and a forever loop. These statements take the form of

Explanation / Answer

.copy:
   st ra, 12[sp]
   ld r6, [sp]]
   ld r7, 4[sp]
   ld r8, 8[sp]
   mov r9, 0
   sub r10, r7, r8
   .loop3:
       add r11, r8, r9
       mul r11, r11, 4
       add r12, r6, r9
       mul r12, r12, 4
       ld r13, [r11]
       st r13, [r12]
       add r9, r9, 1
       cmp r10, r9
       bgt .loop3
   ld ra, 12[sp]
   add sp, sp, 16
   ret