Page 1 of 1

SPIM

Posted: Tue Feb 15, 2005 1:04 am
by modman
Anyone use this before?

I'm trying to get myself back into "assembly mode", and was just wondering if this would be usefull:

http://www.cs.wisc.edu/~larus/spim.html

??

It says that the new version supports the MIPS32 architecture.

I used this before in my Computer Organization class; but I never really got into the simulator.

I've always liked practical programming more i.e. x86 with MASM or NASM.

Posted: Tue Feb 15, 2005 4:01 am
by DracoLacertae
SPIM is great for starting out or practicing MIPS code. But for PS2 stuff, keep in mind the memory, IO and all that type of stuff will be different. I used SPIM in school to practice MIPS, and it's pretty good. There is a slight difference with load delay slots: I think in SPIM the value you load is available immediately while in a MIPS processor you need to wait one clock; I'm not sure I haven't had to deal with delay slots since we had to implement a mips processor.

I'll definetely be looking into more asm programming soon though, because I need it is for my project as well.

Posted: Tue Feb 15, 2005 4:57 am
by Guest
DracoLacertae wrote: There is a slight difference with load delay slots: I think in SPIM the value you load is available immediately while in a MIPS processor you need to wait one clock; I'm not sure I haven't had to deal with delay slots since we had to implement a mips processor.
There are reasons it may not have even mattered.

Modern MIPS cpu's implement interlock on the registers affected by the delay slot. If you do not fill the delay slot appropriately, interlock occurs such that the next instruction is forced to wait it out anyhow, if it is accessing a register being written by the previous instruction within the delay slot boundries.

Posted: Tue Feb 15, 2005 6:17 am
by modman
Thank you for the good overview DracoLacertae and gorim!

I did not recall load delay slots from my class... must have been dreaming of getting my PS2 back then :-)

I found a good explaination of delay slots on MIPS here: http://www.go-ecs.com/mips/miptek1.htm

So does the instruction in the delay slot actually see the data in the register used by the previous instruction, or does it wait it out? It seems from the link above that you can actually write code without taking into account the delay slot; but if you want your code to be optimized you should plan accordingly. Any thoughts?

Posted: Tue Feb 15, 2005 6:30 am
by Guest
modman wrote:Thank you for the good overview DracoLacertae and gorim!

I did not recall load delay slots from my class... must have been dreaming of getting my PS2 back then :-)

I found a good explaination of delay slots on MIPS here: http://www.go-ecs.com/mips/miptek1.htm

So does the instruction in the delay slot actually see the data in the register used by the previous instruction, or does it wait it out? It seems from the link above that you can actually write code without taking into account the delay slot; but if you want your code to be optimized you should plan accordingly. Any thoughts?
Absolutely correct. The delay slot is an opporuntity for another independant instruction to do something whilst another would otherwise have to wait.

Nowadays, scheduling of instructions into the delay slot is normally done by the assembler, but if you are getting into learning assembly, it never hurts to write the code with an eye towards some efficiency. Just keep in mind that, whatever you do, unless you direct an optimizing assembler to do otherwise, it may automatically reorder your instructions to take advantage of delays slots. But unless you disassemble the result, you also may never know.

Posted: Tue Feb 15, 2005 7:55 pm
by DracoLacertae
Oh yeah I forgot about the interlocks. We didn't study interlocks that much. The original MIPS stood for Microprocessor without Interlocked Pipeline Stages. (Well that's what Prof. Patterson told us.)