ISim 显示所有触发器输出的 U

ISim shows U for all flip flops outputs

当我尝试使用 ISIM 模拟我的 VHDL 代码时,它只显示 U 所有输出。

那只是由三个级联的 D 型触发器组成。

这是我的 VHDL 代码:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity az_4_2 is
    Port ( clk: in std_logic;
            X : in  STD_LOGIC;
              Ain : in  STD_LOGIC;
           Bin : in  STD_LOGIC;
              Cin : in  STD_LOGIC;
           Aout : out  STD_LOGIC;
           Bout : out  STD_LOGIC;
              Cout : out  STD_LOGIC;
           Y : out  STD_LOGIC;
              reset : in std_logic);
end az_4_2;

architecture Behavioral of az_4_2 is
begin


process(clk, reset, Ain, Bin, Cin, X)
begin

if (reset = '1') then
Y <= '0';

elsif (Ain = '0') and (Bin = '0') and (Cin = '0') then
Y <= '0';

elsif (Ain = '0') and (Bin = '0') and (Cin = '1') then
Y <= '0';

elsif (Ain = '0') and (Bin = '1') and (Cin = '0') then
Y <= '0';

elsif (Ain = '0') and (Bin = '1') and (Cin = '1') then
if (x = '0') then
Y <= '0';
else
Y <= '1';
end if;

elsif (Ain = '1') and (Bin = '0') and (Cin = '0') then
if (x = '0') then
Y <= '0';
else
Y <= '1';
end if;

end if;


if(rising_edge(clk)) then


if (reset = '1') then
Aout <= '0';
Bout <= '0';
Cout <= '0';

elsif (Ain = '0') and (Bin = '0') and (Cin = '0') then
if (x = '0') then
Aout <= '0';
Bout <= '0';
Cout <= '0';
else
Aout <= '1';
Bout <= '0';
Cout <= '0';
end if;

elsif (Ain = '0') and (Bin = '0') and (Cin = '1') then
if (x = '0') then
Aout <= '0';
Bout <= '1';
Cout <= '0';
else
Aout <= '0';
Bout <= '1';
Cout <= '1';
end if;

elsif (Ain = '0') and (Bin = '1') and (Cin = '0') then
if (x = '0') then
Aout <= '0';
Bout <= '0';
Cout <= '0';
else
Aout <= '0';
Bout <= '1';
Cout <= '1';
end if;

elsif (Ain = '0') and (Bin = '1') and (Cin = '1') then
if (x = '0') then
Aout <= '1';
Bout <= '0';
Cout <= '0';
else
Aout <= '0';
Bout <= '1';
Cout <= '1';
end if;

elsif (Ain = '1') and (Bin = '0') and (Cin = '0') then
if (x = '0') then
Aout <= '0';
Bout <= '0';
Cout <= '0';
else
Aout <= '0';
Bout <= '1';
Cout <= '1';

end if;
end if;
end if;
end process;
end Behavioral;

这是我的 TEST_BENCH:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

ENTITY tb_az_4 IS
END tb_az_4;

ARCHITECTURE behavior OF tb_az_4 IS 

COMPONENT az_4
    Port ( clk: in std_logic;
            reset: in std_logic;
            X : in  STD_LOGIC;
              Ain : in  STD_LOGIC;
           Bin : in  STD_LOGIC;
              Cin : in  STD_LOGIC;
           Aout : out  STD_LOGIC;
           Bout : out  STD_LOGIC;
              Cout : out  STD_LOGIC;
           Y : out  STD_LOGIC);
END COMPONENT;

   --Inputs
   signal clk, reset : std_logic := '0';

    --BiDirs
   signal X, Ain, Bin, Cin, Aout, Bout, Cout, Y : std_logic;

begin
   uut: az_4 PORT MAP (
          clk => clk,
             reset => reset,
          X => X,
          Ain => Ain,
             Aout => Aout,
             Bin => Bin,
          Bout => Bout,
             Cin => Cin,
             Cout => Cout,
          Y => Y
        );

   -- Clock process definitions
clock_process :process
begin
     clk <= '0';
     wait for 5 ns;
     clk <= '1';
     wait for 5 ns;
end process;


-- Stimulus process
stim_proc: process
begin        
   -- hold reset state for 100 ns.
   reset <= '1';    
    wait for 10 ns;
    reset <= '0';   
   Ain <= '0';
   Bin <= '0';
    Cin <= '0';
    x <= '0'; 

   wait;
end process;

END behavior;

那么为什么会这样呢?我该如何解决这个问题?

在详细说明期间,组件声明的组件实例与特定设计实体相关联。这可以显式完成 - 通过封闭块声明区域中的配置规范或提供绑定指示的配置声明,或通过默认绑定隐式完成。

由于您的示例中缺少配置规范和配置声明,因此在详细说明过程中尝试了默认绑定指示。查找组件实例化语句中的组件名称(az_4)。

搜索找到第一个:

  • 具有相同简单名称且直接可见的实体声明(通过形式为 L.all 的 use 子句;其中 L 是参考库)。
  • 如上所示的实体将直接可见,除非具有隐藏实体的相同简单名称的可见组件声明。

  • 由L.C表示的实体声明,其中L是声明组件C的目标库逻辑名。

在您的情况下,搜索没有找到 az_4,请注意您确实提供了 az_4_2。

您在测试台架构主体中的 uut 在默认绑定指示中未绑定,没有直接可见名为 az_4 的实体。

有三种方法可以解决这个问题。

  1. 可以让四个名称匹配(实体az_4_2中的实体名称,它匹配的架构体,testbench架构体中的组件声明和组件实例化语句)和依靠默认绑定。

  2. 您可以提供绑定指示作为配置规范作为测试平台架构声明项:

     for uut: az_4                    -- ADDED configuration  specification
         use entity work.az_4_2;
    begin
       uut: az_4 port map (
    
  3. 或者您可以在配置声明中提供绑定指示,这对于单个组件实例化来说似乎不值得。

我已经检查过您的代码是否会使用前两种方法进行分析、详细说明和模拟,请注意您的测试台不会停止模拟,直到模拟时间达到 TIME'HIGH 而无需实施干预(例如 运行 设定时间间隔的模拟)。时钟连续运行。

提供上面显示的配置规范会产生:

这表明绑定指示有效,并且您的测试平台 stim_proc 流程尚未完全开发。