• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

trouble with spim.....

Gibson486

Lifer
I am trying to run a program in SPIM, but when i tell it to run it just tells me that _start is undefined. Am I missing a directive or something?
 
yeah

I type my program in notepad...I give it the .asm extension

I got to file->open-> I open the file I want

i then go to Simulator->Go

It asks for address and command line. If I leave both blank, it just does nothing

If I start at address 0x00400000 (this is the first address that corresponds to the assmebly code when it is loaded into the window), it gives me the _start message.
 
That is interesting, when I load up a program and hit go it automatically fills in the start value for me. Go into settings and see if everything is there.

If you can post your code I can perhaps take a look at it to see if I can get it to run over here.

Also try this program and see if it runs.

 
Your program had the message, but the console actually responded and it ran.

this program is just supposed to take values that I stored in memory and add them. I think i am doing it right.
.data
A: .word 7
B: .word 5
Sum: .word 0
Dif: .word 0

.text
.gobl main
main:
la $s1, A
la $s2, B
la $s3, Sum
la $s4, Dif
add $s3, $s1, $s2
sub $s4, $s1, $s2
 
A few things
.gobl main throws a syntax error. You don't need it at all, any reason why you put it there?

la is not the intstruction you want to use to load your variables.
la loads the address of the label you supplied. So it will be storing 0x10010000 in $s1 and 0x10010004 in $s2

If you use la then you need to use a lw instruction as well, using $s0 and $s1 as your base addresses.

The simpler solution is to just use lw to begin with

lw $s1,A
lw $s2,B
lw $s3, Sum
lw $s4, Dif
 
the globl was put there because my prof. said you need it, but that was the first time i ever seen it written, so i just put it down.

I was gonna use lw, but when teh TA was talking today, he said that using LW would be harder....man, my ece program at my school is messed up......

Does your solution load A from memory. That is what messes me up. I have to retrive it from memory, but to do that, don't you need to define what allocation it is at?
 
To be honest I have never seen la before. My guess is that it is a pseudo instruction for lui as that is what spim is telling me which is not what you want.

You are trying to load a word from memory, so lw would be the way to do it. lw with just a register and label as parameters is a pseudo instruction for

lui $at, .data
lw $s0,8($at)

^^ That is the proper way to do it, but lw $s0,A works because of it being a psuedo instruction.
 
Back
Top