Luc*_*ali 0 architecture vhdl modelsim
我对Modelsim很新,我不断从中得到这个"错误".基本上我用vhdl编写了一个计数器:
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
entity Contatore16bit is
port (
CLK: in std_logic;
RESET: in std_logic;
LOAD: in std_logic;
UP_DOWN: in std_logic;
ENABLE: in std_logic;
USCITA: out unsigned(15 downto 0) );
end Contatore16bit;
architecture Arch of Contatore16bit is
signal temp_value, next_value: unsigned(15 downto 0);
begin
process (CLK)
begin
if CLK'Event and CLK='1' then
if RESET='1' then
temp_value <= (others => '0');
elsif ENABLE='1' then
temp_value <= next_value;
end if;
end if;
--CASE UP_DOWN IS
--WHEN '0' => next_value <= temp_value + conv_unsigned(1, 16);
--WHEN '1' => next_value <= temp_value - conv_unsigned(1, 16);
--END CASE;
--CASE LOAD IS
--WHEN '0' => USCITA <= conv_unsigned(0, 16);
--WHEN '1' => USCITA <= temp_value;
--END CASE;
end process;
end Arch;
Run Code Online (Sandbox Code Playgroud)
我可以在没有任何问题的情况下开始模拟.但是,如果我退出"case"行,modelsim将不再识别该架构,并会给我错误:
错误:(vsim-3173)实体'... Contatore\simulation\modelsim\rtl_work.contatore16bit'没有架构.
任何想法为什么会这样?
那不是我得到的错误.我的信息更丰富:
** Error: test.vhd(28): (vcom-1339) Case statement choices cover only 2 out of 9 cases.
** Error: test.vhd(32): (vcom-1339) Case statement choices cover only 2 out of 9 cases.
Run Code Online (Sandbox Code Playgroud)
这是因为std_logic还有许多其他值而不是'1'和'0' - 具体来说:
U - 未经初始化X - 冲突Z - 高阻抗W - 弱高阻抗H - 弱上拉L - 弱下拉- - 不在乎1 - 强高0 - 强低VHDL的一个规则是你必须说出你想要为每个可能的输入值做什么.一种方法是使用
when others =>
Run Code Online (Sandbox Code Playgroud)
如果您不希望其他输入发生任何特定情况,您可以使用该null语句来说明.
然后,合成器将此优化为您指定的值.