2

我希望在 VHDL 中的通用参数之后调整实体端口的大小。

这是我的实体声明

library ieee;
use ieee.std_logic_1164.all;
use IEEE.math_real.all;
use ieee.numeric_std.all;

entity counter is
generic( 
    ticks   : natural := 10
);
port(
        clk : in  std_logic;
        f_v : in std_logic_vector(natural(FLOOR(LOG2(Real(ticks)))) downto 0); --forced value
        res : in std_logic;
          z : out std_logic_vector(natural(FLOOR(LOG2(Real(ticks)))) downto 0)
);
end counter;

更具体地说,我想在实例化计数器实体时在函数 nest natural(FLOOR(LOG2(Real(ticks))))之后调整f_vz的大小。

代码可以编译,但是当我尝试生成符号文件时,我收到以下错误消息

Error (10017): Can't create symbol/include/instantiation/component file for entity "counter" because port "f_v" has an unsupported type    

Error (10017): Can't create symbol/include/instantiation/component file for entity "counter" because port "z" has an unsupported type

我正在使用Altera Quartus II 9.1 Web Edition

我怎样才能得到这个工作?

4

1 回答 1

2

这适用于我使用 Quartus II 12.1(完整版)。您应该预先知道,当涉及到 VHDL 时,有效且看似可综合的代码与您的综合工具实际上可以理解的代码之间存在差异。当您尝试以非标准方式做某事或使用不常用的语言功能时,此类问题经常发生。在您的情况下,该工具很可能存在real类型问题。我会推荐:

  1. 升级到最新版本的 Quartus II
  2. 将端口的宽度作为通用传递
  3. 使用您自己的库中的 log2 函数(这就是我所做的。)
于 2013-01-23T14:28:55.007 回答