-1

そのため、現在、1 秒ごとに (0-F) を表示する 7 セグメント ディスプレイ用の VHDL コードを書いています。私はほぼすべてを完了しました。私が立ち往生しているのはコントローラーだけです。

4 つのボタンが必要です。最初のボタンでカウンターを開始し、2 番目のボタンで停止し、3 番目のボタンで 1 ずつ増やし、最後のボタンで 0 に戻します (最後のボタンは既に完了しており、最初の 3 つだけが必要です)。

これが私の全体的なコードです(問題2のコンポーネントが私のカウンターであることに注意してください):

entity SSD is
port (
   seg : out std_logic_vector (6 downto 0);
   an3 : out std_logic;
   btn1, btn2, btn3, btn4 : in std_logic;
   clk : in std_logic);
    end SSD;

    architecture Behavioral of SSD is

    component hex7seg is
    port (
        x : in std_logic_vector (3 downto 0);
        a_to_g : out std_logic_vector (6 downto 0));
    end component;

    component Problem2 is
    port (
        clr : in std_logic;
        ce : in std_logic;
        clk : in std_logic;
        b : out std_logic_vector (3 downto 0);
        tc : out std_logic);
    end component;

component clkdiv is
port (
    rst : in std_logic;
    clk : in std_logic;
    clkout : out std_logic);
end component;

component controller is
port (
    start : in std_logic;
    stop : in std_logic;
    inc : in std_logic;
    rst : in std_logic;
    clk : in std_logic;
    run : out std_logic);
end component;

signal b : std_logic_vector(3 downto 0);
signal run : std_logic;
signal clk_1sec : std_logic;
signal tc : std_logic;

begin

U1: hex7seg port map (x => b, a_to_g => seg);

U2: Problem2 port map (clr=>btn4, ce=>run, clk=>clk_1sec, b=>b, tc=>tc);

U3: controller port map (start => btn1, stop => btn2, inc => btn3, rst => btn4, clk => clk_1sec, run => run);

U4: clkdiv port map (rst => btn4, clk => clk, clkout => clk_1sec);

an3 <= '0';

end Behavioral;

コントローラーコードのこれまでの内容は次のとおりです。

entity controller is
    Port ( start : in  STD_LOGIC;
           stop : in  STD_LOGIC;
           inc : in  STD_LOGIC;
           rst : in  STD_LOGIC;
           clk : in  STD_LOGIC;
           run : out  STD_LOGIC);
end controller;

architecture Behavioral of controller is

begin
    run <= '1';

end Behavioral;

そこから他の 3 つのボタンを機能させるためにどこに行けばよいかわかりません。ヘルプや指示があれば大歓迎です。

4

1 に答える 1