1
LEDがONになる前に20秒遅れる単純なVHDLコードを作りたいと思います。私はシグナルカウンターを20秒の遅延を作るために使用しましたが、私は非常に奇妙なことに気がつきました。もし私がLEDが遅れる前にOFFであると宣言していなければ、LEDは常にONになります。 2つのコード(クロックが50MHzの場合)で照明の前のVHDLの遅延
外観:このコードで
LEDが常にオンです。
library ieee;
use ieee.std_logic_1164.all;
entity check is
port(clk : in std_logic;
led : out std_logic);
end check;
architecture arc of check is
signal counter : integer range 0 to 100e6;
begin
process(clk)
begin
if rising_edge(clk) then
if counter<500e6 then
counter<=counter+1;
else
led<='1';
end if;
end if;
end process;
end arc;
このコードでは、LEDは20秒後にのみオンになります。
library ieee;
use ieee.std_logic_1164.all;
entity check is
port(clk : in std_logic;
led : out std_logic);
end check;
architecture arc of check is
signal counter : integer range 0 to 100e6;
begin
process(clk)
begin
if rising_edge(clk) then
if counter<500e6 then
counter<=counter+1;
led<='0';
else
led<='1';
end if;
end if;
end process;
end arc;
そのコードがシミュレーションで機能する場合、シミュレータは壊れています。それは決してLEDをオンにすることはできません。 –