0

我对 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;

我可以用这段代码毫无问题地开始模拟。但是,如果我对“案例”行进行注释,modelsim 将不再识别架构并会给我错误:

错误:(vsim-3173) 实体 '...Contatore\simulation\modelsim\rtl_work.contatore16bit' 没有架构。

任何想法为什么会发生这种情况?

4

1 回答 1

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- 未初始化
  • X- 矛盾的
  • Z- 高阻抗
  • W- 弱高阻抗
  • H- 弱上拉
  • L- 弱下拉
  • -- 不在乎
  • 1- 强高
  • 0- 强低

VHDL 的规则之一是你必须说出你想对每个可能的输入值做什么。一种方法是使用

when others =>

如果您不希望其他输入特别发生任何事情,则可以使用该null语句来说明。

然后,合成器会将其优化为您指定的值。

于 2013-04-17T09:19:11.837 回答