0

私はVHDLが初めてです。私はこのエンティティを持っています(短縮):

entity foo is
  port (CLK   : in  std_logic;
        out_A : out std_logic;
        );
end foo;

architecture Structure of foo is

  component D_Flipflop
    port (
      D     : in  std_logic;
      CLK   : in  std_logic;
      Q     : out std_logic;
      not_Q : out std_logic);
  end component;

  signal D_A, qA, not_qA : std_logic;

begin
  my_Flipflop : D_Flipflop
    port map(
      not_qA,
      CLK,
      qA,
      not_qA
      );
end Structure;

ご覧のとおりD_Flipflop、トグル フリップフロップのようなものを使用したいので、信号によって出力を入力にリダイレクトしましたnot_qA(それは可能ですか?)。問題は、外部からは のポートのみがCLK入力fooとして表示され、少なくとも Vivado シミュレータでは信号qAnot_qAが評価されないことです。

のアーキテクチャは次のD_Flipflopとおりです。

architecture Behavioral of D_Flipflop is

begin

  set_state : process(CLK, D)
    variable state : std_logic := '0';
  begin
    if falling_edge(CLK) then
      state := D;
      Q     <= state;
      not_Q <= not state;
    end if;
  end process set_state;

end Behavioral;

私はこれについてたくさんグーグルで検索しました。チャンスは無い。解決策はありますか?

4

1 に答える 1

1

コンポーネントへの内部信号がmy_Flipflopトリガーされなかったという質問のタイトルに示されているのではなく、既知の非メタ値状態を提供する方法がないことです-「U」のnotは「U」です。

これはnotオペレーターが原因です。パッケージ std_logic_1164 の本体にある not_table を参照してください。

    -- truth table for "not" function
    CONSTANT not_table: stdlogic_1d :=
    --  -------------------------------------------------
    --  |   U    X    0    1    Z    W    L    H    -   |
    --  -------------------------------------------------
         ( 'U', 'X', '1', '0', 'X', 'X', '1', '0', 'X' );

変更と追加されたテストベンチを確認してください。

library ieee;                   -- Added Context clause (MCVe)
use ieee.std_logic_1164.all;

entity D_Flipflop is
    port (
        D:      in  std_logic;
        CLK:    in  std_logic;
        Q:      out std_logic; 
        not_Q:  out std_logic := '0'
);
end entity;

architecture behavioral of D_Flipflop is  
begin
set_state:  
    process (CLK)                -- removed D from sensitivity list
        variable state:  std_logic := '0';  
    begin
        if falling_edge(CLK) then
            state := D;
            Q <= state;
            not_Q <= not state;
        end if;
    end process;  
end architecture;

library ieee;                    -- added context clause
use ieee.std_logic_1164.all;

entity foo is
    port (
        CLK:    in  std_logic;
        out_A:  out std_logic     -- removed extra ';'
    );
end entity;

architecture Structure of foo is

    component D_Flipflop is
        port (
            D:      in  std_logic;
            CLK:    in  std_logic;
            Q:      out std_logic;
            not_Q:  out std_logic
      );
  end component;

    -- signal D_A:     std_logic;  -- not used
    signal qA:      std_logic;       
    signal not_qA:  std_logic := '1';  -- notice this didn't matter

begin
my_Flipflop:  
    D_Flipflop
        port map (
            not_qA,
            CLK,
            qA,
            not_qA
        );

    out_A <= qA;                -- Added

end architecture;

library ieee;
use ieee.std_logic_1164.all;

entity foo_tb is
end entity;

architecture fum of foo_tb is
    signal CLK:     std_logic := '0';
    signal out_A:   std_logic;
begin

DUT:
    entity work.foo 
        port map (
            CLK => CLK,
            out_A => out_A
        );
CLOCK:
    process
    begin
        wait for 10 ns;
        CLK <= not CLK;
        if Now > 200 ns then
            wait;
        end if;
    end process;
end architecture;

D_Flipflopのnot_Q出力は '0' に初期化されています ('1' に初期化することも簡単にできます)。これは、電源投入時のフリップフロップのコレクター セットに相当します。

フリップフロップがトグルできるようになりました - 入力に既知の非メタ値がありDます。

これは与える:

ここに画像の説明を入力 (クリック可能)

于 2015-06-10T17:05:00.700 に答える