我有下面的代码,在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;流程部分的代码,是我设计的。
我不想用更多的地址一步一步地改变.
在此之前,我必须为每个位地址创建一个进程。
唯一不编译的行是
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.我做了这些安排的线索,我发现在链接下面
VHDL中的矢量
我不知道为什么不工作!
这些库在quartus II中工作,但在ModelSim中似乎不起作用。
有人能帮我吗?)
发布于 2015-01-19 18:54:29
to_unsigned()的适当包是ieee.numeric_std,它包括thr unsigned类型以及相关的操作符重载和转换函数。另一方面,numeric_std_unsigned只在您想要将std_logic_vector信号隐式处理为无符号时才具有函数重载,即没有显式的类型转换或转换。
https://stackoverflow.com/questions/28031531
复制相似问题