SPIM

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
User avatar
modman
Posts: 31
Joined: Sat Feb 12, 2005 7:09 am
Location: Philadelphia, PA
Contact:

SPIM

Post 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.
SCPH-50001/N
HD SCPH-20401 U
Eyetoy SLEH-00031
Network Adaptor SCPH-10281
Logitech Z680 via FIber w00t!
Sony Wega TV + USB Keyboard
http://staff.philau.edu/barberej/
User avatar
DracoLacertae
Posts: 22
Joined: Tue Jul 13, 2004 3:49 am
Location: Berkeley, CA
Contact:

Post 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.
Guest

Post 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.
User avatar
modman
Posts: 31
Joined: Sat Feb 12, 2005 7:09 am
Location: Philadelphia, PA
Contact:

Post 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?
SCPH-50001/N
HD SCPH-20401 U
Eyetoy SLEH-00031
Network Adaptor SCPH-10281
Logitech Z680 via FIber w00t!
Sony Wega TV + USB Keyboard
http://staff.philau.edu/barberej/
Guest

Post 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.
User avatar
DracoLacertae
Posts: 22
Joined: Tue Jul 13, 2004 3:49 am
Location: Berkeley, CA
Contact:

Post 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.)
Post Reply