1

I'm using QtSpim to make a quick program that's supposed to perform two bitwise ori operations on some integers. When I try to assemble the program, it gives me this error message, saying I can't use the same label twice - this is the exact code from the book I'm using, which doesn't work.

    ## Program to bitwise OR two patterns 
        .text
        .globl  main
main:
        ori      $8,$0,0x0FA5       # put first pattern into register $8
        ori     $10,$8,0x368F       # or ($8) with second pattern.  Result to $10.

## End of file

I'd greatly appreciate anybody's help here.

Zonk
  • 11
  • 1
  • 1
    There is nothing wrong with this code, if you load it only once. You might be loading it twice, which is causing problems. Note: MARS is friendlier for this kind of thing, since it has a built-in IDE. – Erik Eidt Jul 05 '21 at 15:03
  • Thank you very much! I'll see if that works better for me then. – Zonk Jul 05 '21 at 15:28
  • To understand the linker error it would be helpful if you specified your whole build process, so people could see which exact command results in an error. – Janus Troelsen Jul 05 '21 at 20:36

1 Answers1

5

For QtSPIM, use option "Reinitialize and Load File" rather than just "Load File".  For your scenario, "Load File" will work once but not a second time for the same file — the 2nd time, "Load File" will accumulate, so it can be used to load separate, different files together, for the same simulation (but it will complain about duplicate labels if loading the same file).

"Reinitialize and Load File" is appropriate for reloading the same file over and over, as it is edited/changed..

(But MARS is easier for repeated editing and simulating, since it has an integrated editor.)

Erik Eidt
  • 23,049
  • 2
  • 29
  • 53