cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
igorkarkanuf
Visitor
Visitor
600 Views
Registered: ‎02-02-2019

What is the result of to_float in float pakage ?

Jump to solution

Hi,

I created a code in VHDL which uses the floating package. (IEEE_proposed) I'm using the function that converts a floating point constant called to_float in the package. However, I was wondering what is the result of this function. Does it convert floating point to a 32 bit floating point binary or does it convert the number to a fixed point? I have to compare 2 codes in floating point, so I need to be sure that it is a good comparison.

Thanks

 

 

0 Kudos
1 Solution

Accepted Solutions
blindobs
Adventurer
Adventurer
560 Views
Registered: ‎09-13-2018

Hi,

If you open Vivado float_pkg/float_generic_pkg you will see that to_float is

 

  function to_float (
    arg                     : REAL;
    constant exponent_width : NATURAL    := float_exponent_width;  -- length of FP output exponent
    constant fraction_width : NATURAL    := float_fraction_width;  -- length of FP output fraction
    constant round_style    : round_type := float_round_style;  -- rounding option
    constant denormalize    : BOOLEAN    := float_denormalize)  -- Use IEEE extended FP
    return UNRESOLVED_float

 

where package default values are:

  generic map (
    FLOAT_EXPONENT_WIDTH => 8,    -- float32'high
    FLOAT_FRACTION_WIDTH => 23,   -- -float32'low
    FLOAT_ROUND_STYLE    => ieee.fixed_float_types.ROUND_NEAREST,  -- round nearest algorithm
    FLOAT_DENORMALIZE    => true,  -- Use IEEE extended floating
    FLOAT_CHECK_ERROR    => true,  -- Turn on NAN and overflow processing
    FLOAT_GUARD_BITS     => 3,     -- number of guard bits
    NO_WARNING           => false, -- show warnings
    FIXED_PKG            => ieee.fixed_pkg
    );

View solution in original post

Tags (1)
0 Kudos
1 Reply
blindobs
Adventurer
Adventurer
561 Views
Registered: ‎09-13-2018

Hi,

If you open Vivado float_pkg/float_generic_pkg you will see that to_float is

 

  function to_float (
    arg                     : REAL;
    constant exponent_width : NATURAL    := float_exponent_width;  -- length of FP output exponent
    constant fraction_width : NATURAL    := float_fraction_width;  -- length of FP output fraction
    constant round_style    : round_type := float_round_style;  -- rounding option
    constant denormalize    : BOOLEAN    := float_denormalize)  -- Use IEEE extended FP
    return UNRESOLVED_float

 

where package default values are:

  generic map (
    FLOAT_EXPONENT_WIDTH => 8,    -- float32'high
    FLOAT_FRACTION_WIDTH => 23,   -- -float32'low
    FLOAT_ROUND_STYLE    => ieee.fixed_float_types.ROUND_NEAREST,  -- round nearest algorithm
    FLOAT_DENORMALIZE    => true,  -- Use IEEE extended floating
    FLOAT_CHECK_ERROR    => true,  -- Turn on NAN and overflow processing
    FLOAT_GUARD_BITS     => 3,     -- number of guard bits
    NO_WARNING           => false, -- show warnings
    FIXED_PKG            => ieee.fixed_pkg
    );

View solution in original post

Tags (1)
0 Kudos