在to_integer调用中获取“VHDL子程序错误”

时间:2013-10-05 18:53:44

标签: vhdl hdl intel-fpga

我想获取作为输入参数传递的float32值的整数值,我使用的是to_integer()函数。但我在编译步骤中得到错误:

Warning (10445): VHDL Subtype or Type Declaration warning at float_pkg_c.vhdl(1022): subtype or type has null range
Warning (10036): Verilog HDL or VHDL warning at teste.vhd(13): object "my_integer" assigned a value but never read
Error (10779): VHDL error at float_pkg_c.vhdl(4314): expression is not constant
Error (10657): VHDL Subprogram error at float_pkg_c.vhdl(4314):  failed to elaborate call to subprogram "TO_INTEGER"
Error (10657): VHDL Subprogram error at teste.vhd(19):  failed to elaborate call to subprogram "to_integer"
Error (12153): Can't elaborate top-level user hierarchy
Error: Quartus II 64-Bit Analysis & Synthesis was unsuccessful. 4 errors, 6 warnings
    Error: Peak virtual memory: 537 megabytes
    Error: Processing ended: Sat Oct 05 12:23:02 2013
    Error: Elapsed time: 00:00:01
    Error: Total CPU time (on all processors): 00:00:01
Error (293001): Quartus II Full Compilation was unsuccessful. 6 errors, 6 warnings

如果我声明一个变量,请指定一个值并在to_integer函数中使用它。但我需要用于转换的float32值作为参数传递。

我使用VHDL-2008支持库(http://www.eda.org/fphdl/fpfaq.html)和 Altera Quartus II 13.0。

我的代码:

LIBRARY ieee;
use ieee.float_pkg.all;

entity teste is
    PORT ( my_input : float32 );
end entity;

architecture arquitetura_teste of teste is
begin   
    process(my_input) is
      variable my_float_a : float32;
      variable my_float_b : float32;
      variable my_integer : integer;
    begin   
         my_float_a := my_input;
         my_float_b := to_float(3.14, my_float_b);

         my_integer := to_integer(my_float_b);
         my_integer := to_integer(my_float_a); -- Error!
    end process;
end arquitetura_teste;  

0 个答案:

没有答案