1. PF Contest - Win "Conquering the Physics GRE" book! Click Here to Enter
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Relocation Table MIPS

  1. Jun 25, 2013 #1


    User Avatar
    Gold Member

    1. The problem statement, all variables and given/known data

    List instructions that will contribute an entry to the relocation table.

    1 funca:
    2 la $t0 , n
    3 lw $s0 , 0( $t0 )
    4 addi $s2 , $zero , 1
    5 sub $s1 , $s1 , $s1
    6 loop:
    7 sll $t0 , $s2 , 3 1
    8 slt $t1 , $t0 , $z e ro
    9 bne $t1 , $zero , skip
    10 add $s1 , $s1 , $s2
    11 skip:
    12 addi $s2 , $s2 , 1
    13 beq $s2 , $s0 , done
    14 j loop
    15 done:
    16 addi $v0 , $s1 , 0
    17 j r $ra
    19 n: .word 11

    3. The attempt at a solution

    lines 1, 6, 11, 15, 19...

    This is a shot in the dark. the summer class im taking is sort of off-step between lab and lecture. I've tried google, and searching the book thoroughly but I'm still not exactly sure when the relocation table is considered having an entry contributed. I know that related addresses may not need to, but that absolute addresses would. I haven't seen any solid rules to go by yet though.

    1. The problem statement, all variables and given/known data

    2. Relevant equations

    3. The attempt at a solution
  2. jcsd
  3. Jun 25, 2013 #2


    Staff: Mentor

  4. Jun 25, 2013 #3


    User Avatar
    Gold Member

    I went through that pdf already, actually, and just now again.

    It has some examples in chapter 9 of what might constitute a relocation entry, but frankly I am not an experienced enough MIPS programmer to make heads or tails of WHY those are valid examples. Chapter 11 was also not much help - much of that document is intended to be used as a reference for experienced MIPS programmers, which I am definitely not. We are in week 3, and are very soon going to be starting into verilog, which I have much more experience with than MIPS.

    It's obvious my answers in the above post are incorrect, but I wouldn't know how to change them.
  5. Jun 25, 2013 #4


    Staff: Mentor

    Sorry I can't be of more help. I've done a small amount of MIPS programming, but I'm in no way an expert. The link I found was by doing a web search for mips "relocation table", which gave me a lot of hits. One of them might be more helpful than the one I gave.

    If not, I suggest talking with your instructor during office hours. If you go to him, explain that you have done put in an effort by reading the text and searching on the web, to no avail.
  6. Jun 25, 2013 #5


    User Avatar
    Gold Member

    Exactly what I Google searched for. I'm in lab right now, and I have talked to my TA about it. I think I am getting the idea.

    lines 2 and lines 14 are the only ones that require an entry, since they need to be translated into a 32 bit absolute address. The other instructions, like that on line 9, don't require an absolute value, rather they are relational and specify a certain number of lines of code to jump to in the positive or negative direction.

    This is my understanding of it after talking with the TA.

    edit: Thanks for your help!
    Last edited: Jun 25, 2013
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted