MIPS (or SPIM): Loading floating point numbers...

Posted by James on Stack Overflow See other posts from Stack Overflow or by James
Published on 2010-04-07T00:24:29Z Indexed on 2010/04/07 0:33 UTC
Read the original article Hit count: 692

Filed under:
|
|

Hey hey,

I am working on a little mini compiler while trying to learn some MIPS here. Here's my issue:

MIPS has an instruction li (load immediate) which would work like this

li $5,100

which would load 100 into register 5.

However, I need to load floats into registers right now and am struggling with figuring out a way to do it...since li $5,2.5 does not work.

Anyone have any advice?

I am working in C, I was thinking I could somehow get the integer representation of the float I am working with (i.e. so the floats binary representation == the ints binary representation) then load the "integer" into the register and treat it like a float from then on.

Maybe its too late but Im stuck right now.

© Stack Overflow or respective owner

Related posts about spim

Related posts about mips