我对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;
我可以在没有任何问题的情况下开始模拟。但是,如果我对“case”行进行解除,modelsim将不再识别该架构并且会给我错误:
错误:(vsim-3173)实体 '... Contatore \ simulation \ modelsim \ rtl_work.contatore16bit'没有 架构。
为什么会发生这种情况?
答案 0 :(得分:5)
这不是我得到的错误。我的信息更丰富:
** 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.
这是因为std_logic
除了'1'和'0'之外还有许多其他值 - 具体来说:
U
- uninitalised X
- 冲突Z
- 高阻抗W
- 弱高阻抗H
- 弱上拉L
- 弱下拉-
- 不在乎1
- 强高0
- 强低VHDL的一个规则是你必须说出你想要为每个可能的输入值做什么。一种方法是使用
when others =>
如果您不希望其他输入发生任何特定情况,您可以使用null
语句来表示。
然后,合成器会将其优化为您指定的值。