Results 1 to 3 of 3

Thread: [resolved]asm to c code

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member voidflux's Avatar
    Join Date
    Jun 2003
    Location
    Brockway, PA
    Posts
    290

    [resolved]asm to c code

    I 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?
    Last edited by voidflux; Sep 14th, 2006 at 12:05 PM.
    C¤ry Sanchez
    Computer Science/Engineering
    @ Penn State
    IBM.zSeries Intern
    Mandriva 2007

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width