library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity A is
Port (
clk : in STD_LOGIC;
reset: in std_logic; -- reset input
counter: out std_logic_vector(3 downto 0) := "0000"-- output 4-bit counter
);
end A;
architecture Behavioral of A is
signal counter_up: std_logic_vector(3 downto 0) := "0000";
signal countOf : integer := -1;
signal count : integer := 0;
signal temp : std_logic := '0';
begin
-- up counter
process(clk)
begin
if(clk'event and clk='1') then
count <=count+1;
if(count = 50000000) then
temp <= not temp;
count <=1;
end if;
end if;
end process;
process(temp,reset)
begin
if(reset = '1') then
countOf <= 0;
else
if(temp = '1') then
if(countOf < 4) then countOf <= countOf + 1;
else countOf <= 0; end if;
if(countOf = 0) then counter_up <= "0000"; end if;
if(countOf = 1) then counter_up <= "0001"; end if;
if(countOf = 2) then counter_up <= "0010"; end if;
if(countOf = 3) then counter_up <= "0100"; end if;
if(countOf = 4) then counter_up <= "1000"; end if;
end if;
end if;
end process;
counter <= counter_up;
end Behavioral;
を数えますどのようにしたいですか。それは非常に奇妙です。どうすれば修正できますか?前もって感謝します。いけないあなたは、私が1 HZへと一時の過程で私の時計を分割し、リセット見ての通りこんにちは、私はしかし、それは、カウントをdoesntのすべての条件を割り当てられ、4までの0からカウンターを作りたいそれぞれVHDL
あなたのコンビナトリアルプロセスは機能しません。なぜ時計プロセスにすべてを入れないのですか? P.S.あなたがテストベンチを書いたなら、あなたはすでにこれがうまくいかないことを知っていたでしょう。 – JHBonarius