0

I want to use fphdl packages in order to convert floating point to integer in my vhdl code. However i cannot even compile the assignment that uses the related function to_integer . I always get error 'no feasible entries for subprogram to integer'

the function is declared as

  function to_integer (
arg                : UNRESOLVED_float;  -- floating point input
constant round_style : round_type := float_round_style;  -- rounding option
constant check_error : BOOLEAN    := float_check_error)  -- check for errors
return INTEGER;

i have tried to use it like :

library ieee;
use ieee.fixed_float_types.all;
use ieee.fixed_pkg.all;
use ieee.float_pkg.all;
......

test_sig<=to_integer(sig_name); or 
test_sig<=to_integer(sig_name,round_zero,false);

but neither works

an help from someone who has used this package successfully?

user2609910
  • 157
  • 8
  • 1
    The declarations of `sig_name` and `test_sig` might be important to see. The error message indicates that there is either NO visible definition of `to_integer` that matches the parameter and return types, or more than one (so it doesn't know which to pick). I also recommend named association for arguments to make problems easier to spot. (And You ARE compiling in VHDL-2008 mode, right?) –  Feb 20 '16 at 00:03
  • 1
    You might also want to provide a [Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). Two signal assignments with a dangling "or" in between doesn't fill the reader with a clear understanding of whether your question relates to something else beside the to_integer call(s). –  Feb 20 '16 at 00:17
  • yes i compile with vhdl 2008. the two signals are declared as std_logic_vectors(31 downto 0); i think the problem is that it cannot distinguish between to_integer function of this package with to_integer function of the numeric package. i tried to rename the function and the package (adding my_ in front) but still no luck.... maybe there is a special way to invoke this fphdl functions? – user2609910 Feb 20 '16 at 10:14

1 Answers1

0

ok it seems i found a solution like this: using float32 subtype from the package as input to the function to _integer before that i had to also use to_float function to convert an std_logic_vector to float. results seem fine! thanks for your comments!!! I hope everything goes well on synthesis :)

user2609910
  • 157
  • 8