strahd_von_zarovich
Advanced Member level 4
Hi everyone, i have a question below. I will solve the question if I know how to read values from memory. How can I know what are the memory addresses for INIT and MAX or A . I have a plenty of examples in my book but in all questions some information is given like “ A in $s0” or “base address of array is in $s0 so I can get values with load word function and offset : lw $t0, 8($s0)
Give the MIPS assembly code corresponding to the below for- statement. INIT and MAX values must be read from memory. A[ ] array is stored in memory address pointed to by value stored at A.
Sum=0;
for(i=INIT; i<MAX;i++) {
Sum= Sum + A; }
Give the MIPS assembly code corresponding to the below for- statement. INIT and MAX values must be read from memory. A[ ] array is stored in memory address pointed to by value stored at A.
Sum=0;
for(i=INIT; i<MAX;i++) {
Sum= Sum + A; }