converting floating point number to integer and vice versa

Discussion in 'VHDL' started by FPGA, Jan 4, 2008.

  1. FPGA

    FPGA Guest

    I want to write a function to
    1) convert single precision 32 bit floating point number to integer
    and return integer
    2) convert integer to single precision floating point number and
    return 32 bit floating point

    What are the parameters I should give to each functions and what logic
    do I use for both the functions.

    Do i need to write seperate function for signed and unsigned numbers?

    Your help would be appreciated
     
    FPGA, Jan 4, 2008
    #1
    1. Advertising

  2. FPGA

    Jon Beniston Guest

    On 4 Jan, 17:08, FPGA <> wrote:
    > I want to write a function to
    > 1) convert single precision 32 bit floating point number to integer
    > and return integer
    > 2) convert integer to single precision floating point number and
    > return 32 bit floating point
    >
    > What are the parameters I should give to each functions and what logic
    > do I use for both the functions.
    >
    > Do i need to write seperate function for signed and unsigned numbers?
    >
    > Your help would be appreciated


    Is this homework / an assignment?
     
    Jon Beniston, Jan 4, 2008
    #2
    1. Advertising

  3. FPGA

    FPGA Guest

    On Jan 4, 12:56 pm, Jon Beniston <> wrote:
    > On 4 Jan, 17:08, FPGA <> wrote:
    >
    > > I want to write a function to
    > > 1) convert single precision 32 bit floating point number to integer
    > > and return integer
    > > 2) convert integer to single precision floating point number and
    > > return 32 bit floating point

    >
    > > What are the parameters I should give to each functions and what logic
    > > do I use for both the functions.

    >
    > > Do i need to write seperate function for signed and unsigned numbers?

    >
    > > Your help would be appreciated

    >
    > Is this homework / an assignment?


    yes
     
    FPGA, Jan 4, 2008
    #3
  4. FPGA

    Guest

    On Fri, 4 Jan 2008 10:15:45 -0800 (PST), FPGA <>
    wrote:

    >On Jan 4, 12:56 pm, Jon Beniston <> wrote:
    >> On 4 Jan, 17:08, FPGA <> wrote:
    >>
    >> > I want to write a function to
    >> > 1) convert single precision 32 bit floating point number to integer
    >> > and return integer
    >> > 2) convert integer to single precision floating point number and
    >> > return 32 bit floating point

    >>
    >> > What are the parameters I should give to each functions and what logic
    >> > do I use for both the functions.

    >>
    >> > Do i need to write seperate function for signed and unsigned numbers?

    >>
    >> > Your help would be appreciated

    >>
    >> Is this homework / an assignment?

    >
    >yes


    do we get the diploma if we answer or does it still go to you?
     
    , Jan 4, 2008
    #4
  5. FPGA

    HT-Lab Guest

    "FPGA" <> wrote in message
    news:...
    On Jan 4, 12:56 pm, Jon Beniston <> wrote:
    > On 4 Jan, 17:08, FPGA <> wrote:
    >
    > > I want to write a function to
    > > 1) convert single precision 32 bit floating point number to integer
    > > and return integer
    > > 2) convert integer to single precision floating point number and
    > > return 32 bit floating point

    >
    > > What are the parameters I should give to each functions and what logic
    > > do I use for both the functions.

    >
    > > Do i need to write seperate function for signed and unsigned numbers?

    >
    > > Your help would be appreciated

    >
    > Is this homework / an assignment?
    >
    > yes


    At least you are honest.

    I would suggest you search the web first since there is a lot of stuff
    available on-line and then come back with specific questions.

    If you know a bit of C/C++ then I would suggest you also look at GCC's
    floatlibc.c which contains these 2 functions, if you understand them then
    translating them to VHDL shouldn't be too difficult.

    Good luck!
    Hans
    www.ht-lab.com
     
    HT-Lab, Jan 4, 2008
    #5
  6. On 4 Jan., 23:09, "HT-Lab" <> wrote:
    > At least you are honest.
    >
    > I would suggest you search the web first since there is a lot of stuff
    > available on-line and then come back with specific questions.


    I would suggest "+float +vhdl" and take the first hit in google for a
    careful inspection.

    bye Thomas
     
    Thomas Stanka, Jan 8, 2008
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. carmen
    Replies:
    4
    Views:
    30,720
    ersecchio
    Jan 12, 2010
  2. anonymous
    Replies:
    28
    Views:
    603
    anonymous
    Nov 29, 2005
  3. rz0
    Replies:
    4
    Views:
    453
  4. Astan Chee
    Replies:
    1
    Views:
    389
    Paul McGuire
    Mar 13, 2007
  5. Amit Khemka
    Replies:
    1
    Views:
    1,444
    Paul Boddie
    Mar 13, 2007
Loading...

Share This Page