2017-11-04 3 views
0

ISIMでVHDLコードをシミュレートしようとすると、すべての出力に対して唯一Uが表示されます。ISimはすべてのフリップフロップ出力に対してUを表示します

ちょうど3つのカスケード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; 

、なぜこれが起こっていますか?どうすればこの問題を解決できますか?

+1

コンポーネント自体ではなく、テストベンチをシミュレートするかどうかを確認してください。あなたの質問にインデントを修正してください。 – JHBonarius

答えて

0

コンポーネントの宣言のコンポーネントインスタンス化は、特定の設計エンティティに関連付けられます。これは、囲みブロック宣言領域内の構成仕様またはバインディング指示を提供する構成宣言、またはデフォルトバインディングによって暗黙的に行われます。

例で構成仕様と構成宣言の両方が欠落している場合、詳細な作成中にデフォルトのバインディング指示が試行されます。コンポーネントのインスタンシエーション文のコンポーネント名が検索されます(az_4)。

検索は、最初の発見:

  • 同じ単純名を持ち、直接見えるエンティティ宣言(フォームL.allの使用句を介して、Lが基準ライブラリです)。
  • エンティティを隠すのと同じ簡単な名前で、可視コンポーネント宣言を禁止して直接表示できるエンティティ。

  • L.Cで示されるエンティティ宣言は、コンポーネントCが宣言されているターゲットライブラリの論理名です。

あなたのケースでは、検索でaz_4が見つかりませんでした。あなたはaz_4_2を提供しています。

テストベンチ・アーキテクチャ本体のuutは、デフォルトのバインディング・インジケーションでアンバインドされており、エンティティaz_4は直接表示されません。

これを解決するには3つの方法があります。

  1. あなたは4名が一致することができます(エンティティaz_4_2内のエンティティ名を、それが建築本体、コンポーネント宣言とテストベンチ・アーキテクチャ本体内のコンポーネントのインスタンス文をマッチングです)とデフォルトのバインディングを頼りにしています。

  2. あなたはテストベンチ・アーキテクチャ、宣言項目として構成仕様として結合指示を提供することができます

    for uut: az_4     -- ADDED configuration specification 
        use entity work.az_4_2; 
    begin 
        uut: az_4 port map (
    
  3. それとも、ほとんど単一コンポーネントのインスタンス化のために価値があるようだ、構成宣言、中綴じ指示を提供することができます。

    私は、このような実行しているとして(シミュレーション時間は、実装の介入なしTIME'HIGHに到達するまで、あなたのテストベンチは、シミュレーションを停止することはありません注意して、あなたのコードは、分析精巧で、最初の2つの方法でシミュレートします見てチェックしました

設定された時間間隔のシミュレーション)。クロックは連続的に実行されます。上記のような構成の仕様を提供

は生成:結合兆候を示し

tb_az_4.png

働いて、あなたのテストベンチ・stim_procプロセスはまだ完全に開発されていないこと。

関連する問題