我在用VHDL编一个闹钟程序,其中计数器、分频器都出现了24个错误。大致描述是这样的:
第一类:Error: Symbolic name "WIDTH_Q" is used but not defined
第二类:Error: Can't find an inherited or default value for parameter "WIDTH_N" -- specify a parameter value
其中计数器程序如下:
--60counter(60进制计数器)
LIBRARY ieee;
USE ieee.Std_logic_1164.ALL;
USE ieee.Std_logic_unsigned.ALL;
ENTITY counter60 IS
PORT (clock, reset, enable : IN Std_logic;
count : OUT Std_logic_vector(7 downto 0);
cout:OUT Std_logic);
END counter60;
architecture v1 OF counter60 IS
begin
process(clock, reset, enable )
variable count1:Std_logic_vector (7 downto 0);
begin
if reset = '1' then
count1 := (others => '0');
if enable = '1' then
if count1 <59 then count1:=count1 + 1;
else count1:= (others => '0');
end if;
end if;
end if;
if count1=59 then cout<='1';
else cout<='0';
end if;
count <= count1;--
end process;
end v1;
烦请各位大牛帮忙答一下疑。
VHDL Error: Symbolic name "WIDTH_Q" is used but not defined什么意思?
答案:2 悬赏:0
解决时间 2021-02-16 15:36
- 提问者网友:白越
- 2021-02-16 09:26
最佳答案
- 二级知识专家网友:寂寞的炫耀
- 2021-02-16 10:08
你里面的WIDTH_Q没有定义,,你是不是使用在实体类属里面!!
你的WIDTH_Q是不是跟WIDTH_N有关,导致WIDTH_N也出现错误,,,
在你给出的计数器,里面根本没用上clock,那要怎么计数,,,
把程序改成下面这样:
LIBRARY ieee;
USE ieee.Std_logic_1164.ALL;
USE ieee.Std_logic_unsigned.ALL;
ENTITY counter60 IS
PORT (clock, reset, enable : IN Std_logic;
count : OUT Std_logic_vector(7 downto 0);
cout:OUT Std_logic);
END counter60;
architecture v1 OF counter60 IS
begin
process(clock, reset, enable )
variable count1:Std_logic_vector (7 downto 0);
begin
if reset = '1' then
count1 := (others => '0');
elsif enable = '1' then
elsif clock'event and clock='1' then
if count1 <59 then count1:=count1 + 1;
else count1:= (others => '0');
end if;
end if;
if count1=59 then cout<='1';
else cout<='0';
end if;
count <= count1;--
end process;
end v1;
你的WIDTH_Q是不是跟WIDTH_N有关,导致WIDTH_N也出现错误,,,
在你给出的计数器,里面根本没用上clock,那要怎么计数,,,
把程序改成下面这样:
LIBRARY ieee;
USE ieee.Std_logic_1164.ALL;
USE ieee.Std_logic_unsigned.ALL;
ENTITY counter60 IS
PORT (clock, reset, enable : IN Std_logic;
count : OUT Std_logic_vector(7 downto 0);
cout:OUT Std_logic);
END counter60;
architecture v1 OF counter60 IS
begin
process(clock, reset, enable )
variable count1:Std_logic_vector (7 downto 0);
begin
if reset = '1' then
count1 := (others => '0');
elsif enable = '1' then
elsif clock'event and clock='1' then
if count1 <59 then count1:=count1 + 1;
else count1:= (others => '0');
end if;
end if;
if count1=59 then cout<='1';
else cout<='0';
end if;
count <= count1;--
end process;
end v1;
全部回答
- 1楼网友:浪者不回头
- 2021-02-16 10:27
你好!
把头文件USE ieee.std_logic_unsigned.all换成
USE ieee.numeric.all
另外补充一点,你的这个程序犯了一个很低级的错误,就是再对counter进行计数的时候,没有使用时序逻辑。建议使用clock,否则仿真,或者上板都很容易出问题
如有疑问,请追问。
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯