【问题标题】:ModelSIM ALTERA errorModelSIM ALTERA 错误
【发布时间】:2015-01-19 18:46:51
【问题描述】:

我有以下代码,在 Altera ModelSim 中测试一个内存 ROM。

LIBRARY ieee;                                               
USE ieee.std_logic_1164.all;
USE ieee.numeric_std_unsigned.all;

ENTITY hex_vhdl_vhd_vec_tst IS
END hex_vhdl_vhd_vec_tst;

ARCHITECTURE hex_vhdl_arch OF hex_vhdl_vhd_vec_tst IS
-- constants                                                 
-- signals                                                   
SIGNAL t_sig_address : STD_LOGIC_VECTOR(10 DOWNTO 0);
SIGNAL t_sig_clock   : STD_LOGIC;
SIGNAL t_sig_q       : STD_LOGIC_VECTOR(7 DOWNTO 0);

COMPONENT hex_vhdl
  PORT(
    address : IN STD_LOGIC_VECTOR(10 DOWNTO 0);
    clock   : IN STD_LOGIC;
    q       : OUT STD_LOGIC_VECTOR(7 DOWNTO 0)
  );
END COMPONENT;

BEGIN
  tb : hex_vhdl
  PORT MAP(
    -- list connections between master ports and signals
    address => t_sig_address,
    clock   => t_sig_clock,
    q       => t_sig_q
  );


TEST: PROCESS
variable L : natural;
begin
  --clock
  for L in 0 to 2048 loop
    t_sig_clock <= '0';
    WAIT FOR 25 ns;
    t_sig_clock <= '1';
    WAIT FOR 25 ns;
    t_sig_address <= std_logic_vector(to_unsigned(L, 11));
  end loop;
  t_sig_clock <= '0';
  wait;
END PROCESS TEST;

END hex_vhdl_arch;

PROCESS部分的代码,是我自己设计的。

我很想不使用更多的地址更改一步一步...

以前,我必须为每个位地址制作一个 PROCESS。

唯一不能编译的行是

t_sig_address <= std_logic_vector(to_unsigned(L, 11));

# ** Error: hex_vhdl.vht(70): (vcom-1136) Unknown identifier "to_unsigned".

所以我在开头添加了以下行

USE ieee.numeric_std_unsigned.all;

但是,开始出现以下错误

# ** Error: (vcom-11) Could not find ieee.numeric_std_unsigned.
# ** Error: hex_vhdl.vht(30): (vcom-1195) Cannot find expanded name "ieee.numeric_std_unsigned".
# ** Error: hex_vhdl.vht(30): Unknown expanded name.

我根据在下面的链接中找到的线索进行了这些安排

Illegal type conversion VHDL

Convert Integer to std_logic_vector in VHDL

不知道为什么不行!!!

这些库在 quartus II 中工作正常,但在 ModelSim 中似乎不工作。

有人可以帮我解决这个问题吗? :)

【问题讨论】:

  • 另外:变量L 从未使用过。皮棉报告:sigasi.com/vhdl-code-check?ID=28031531
  • 是的,这似乎很明显......因为,如果第 3 行中没有正确声明库,第 42 行中的语句就会出错......因此,变量 L 声明在第 34 行,永远不会使用!!!简单。

标签: vhdl


【解决方案1】:

to_unsigned() 的正确包是ieee.numeric_std,其中包括unsigned 类型以及相关的运算符重载和转换函数。另一方面,numeric_std_unsigned 只有在您想将 std_logic_vector 信号隐式处理为无符号时才具有函数重载,即没有显式类型转换或转换。

【讨论】:

  • 感谢您的回答 fru1tbat。现在使用您建议的库,不再显示错误找不到 ieee.numeric_std_unsigned。但是第一个错误,又回来了!未知标识符“to_unsigned”
  • 是的,抱歉,我打算隐含 .all
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-06-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多