另一个 ModelSIM 错误

ModelSIM ALTERA error

我有以下代码,在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部分的代码,是我设计的。

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

以前,我必须为每个位地址做一个过程。

唯一没有编译的行是

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 中似乎不起作用。

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

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