Sep13-06, 08:24 PM
have the following MIPS 32 asm code:
Assuming B is an array of 10 words whose base address is in register $s0, andvariable c and i are in $s1 and $s2, respectively. What is the C statement implemented by the below MIPS assembly code?
add $t0, $s2, $s2
add $t0, $t0, $t0
lw $t1, 0($s0)
lw $t2, 8($s0)
sub $s1, $t2, $t1
In C what does it look like?
i said c = B[i+2] - B[i]
but the other optpoins are:
c = B[i] - B[i+2]
c = B[i] - B[i+8]
c = B[i+8] - B[i]
Can someone see if i'm correct?
I said was really index B because, in mips memory is set up by 4's.
If i have memory set up like this:
32 bit data and the numbers are word address
I'm confused on what the beginning codes prupose is for, the 2 add statements.
It basically does this i think:
$t0 = i + i;
$t0 = (i+i) + (i+i)?
Sep14-06, 12:40 AM
Yep it was correct
|Register to reply|
|MIPS help||Programming & Computer Science||7|
|pros and cons of MIPS relative to instruction set choices||Electrical Engineering||1|
|help with MIPS||Programming & Computer Science||0|
|some MIPS programming help||Programming & Computer Science||0|
|small MIPS programmes||Introductory Physics Homework||2|