#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    1
    Rep Power
    0

    MIPS Converting integer to float


    I'm really new in MIPS assembly and I am wondering can I do something like:

    postimg.org/image/q5ga51wdd/


    Not just three characters number, any length of X and Y

    Please help to write the code

    (Sorry I thought image might describe better and faster)


    Thank you ...
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2007
    Posts
    765
    Rep Power
    929
    You didn't say what exactly is giving you trouble. I'm assuming it's converting integer values to floating point. (Once you have both numbers as floating point values it's simply a matter of division and addition to combine them.)

    Given the simplicity of the MIPS instruction set, it wouldn't surprise me if there is no integer/floating point conversion instruction. You should check the documentation for the assembler you're using; it may provide a function or macro to perform this operation.

    Worst comes to worst, you should be able to construct the desired floating point value in a register and use the mtc* instructions to move it into a floating point register. Your processor/simulator documentation should explain the formatting, (IEEE 754 is pretty standard).
    sub{*{$::{$_}}{CODE}==$_[0]&& print for(%:: )}->(\&Meh);

IMN logo majestic logo threadwatch logo seochat tools logo