代码覆盖率分析中带有 "WHEN OTHERS" 的案例陈述

Case statement with "WHEN OTHERS" in code coverage analysis

一段VHDL代码,用于向输入数据注入错误:

entity error_test
Port ( 
clk           : in  STD_LOGIC;
force_error_i : in  STD_LOGIC_VECTOR(1 downto 0);
din           : in  STD_LOGIC_VECTOR(127 downto 0);
dout          : out STD_LOGIC_VECTOR(127 downto 0)
);
end error_test;

architecture Behavioral of error_test is

signal single_error_2   : std_logic_vector(127 downto 0) := x"00000000000000000000000000000001"; 
signal double_error_2   : std_logic_vector(127 downto 0) := x"00000000000000000000000000000003";
signal triple_error_2   : std_logic_vector(127 downto 0) := x"00000000000000000000000000000007";
signal din_errinj_2     : std_logic_vector(127 downto 0);

process (force_error_i, din, single_error, double_error, triple_error)
  begin
   case (force_error_i) is 
    when "00" =>
      din_errinj_2        <= din;

    when "01" =>
      din_errinj_2        <= din xor single_error_2(127 downto 0);

    when "10" =>
      din_errinj_2        <= din xor double_error_2(127 downto 0);

    when "11" =>   
      din_errinj_2        <= din xor triple_error_2(127 downto 0);

    when others =>
      din_errinj_2        <= din;
  end case;
end process;
end Behavioral;

该模块在主设计和测试平台模拟中工作正常。

但问题出在代码覆盖率工具分析上。代码覆盖工具(Aldec 的 Reviera-PRO)显示当输入 force_error_i(2) 为“00”时 当“00” 被覆盖并且 当其他 条件也被覆盖! when others 条件在这里是多余的吗?还是我们需要其他声明但这里有其他问题?

不,这不是多余的,因为您可以拥有 "UU" 这样的值。我猜这是你的问题,因为你不是同步的,而且这个过程最初会 运行 一次。不过不确定在您的模拟器中什么算作覆盖范围。