获得;VHDL子程序错误“;in to_整数调用

获得;VHDL子程序错误“;in to_整数调用,vhdl,hdl,intel-fpga,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

我想获取作为输入参数传递的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支持库()和 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;  

如果你在页面上查看,你会发现一个特定于Altera的版本,在底部是作者David Bishop的电子邮件地址。文档链接说他没有对Altera进行任何修改。我建议尝试第二个目标,而不是重复使用我的_整数。从其他事件来看,夸特斯似乎对这一论点不满意。细化子程序调用将创建一个接口表。请参阅,以获取错误描述。出于好奇,您没有关联的前面的错误消息是什么?来自错误(10657)链接。您好@DavidKoontz,非常感谢您的回复。我使用的是正确版本的Altera。我做了一些测试,效果很好。如果我将实体的float32输入用于to_integer函数,问题就会发生。如果我不使用float32输入(my_input)并使用变量to_integer()可以正常工作。但我需要将实体的输入(my_input)用于to_integer()。第4314行的float_pkg_c.vhdl错误似乎是由允许使用子类型float32代替float(从参数检索范围)的机制引起的。Quartus告诉您,它无法合成对第4314行中的to_整数函数的调用,范围不是静态的。这看起来与我的第一条评论链接中的错误类型相同(请参阅错误(10657)。您可以复制/更改为_integer(arg:float32)硬编码范围以匹配float32,使其不可变(float32是float的子类型,范围约束生成子类型)。