Altera_Forum
Honored Contributor
8 years agoAsynchronous pulse generator code rising edge
Newbie here.
I need to generate pulses at rising/falling edges of an input signal. I would like to avoid using an internal clock for this application because parts of my system is inherently asynchronous (for one thing, the clock used to count and do other things changes frequency in time). The width of the pulses is not important, I will not be sampling at more than 1Mhz. The code I am failing with is:library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity edge_detector is
Port ( dclk : in STD_LOGIC;
notdclk : in STD_LOGIC;
gclk : out STD_LOGIC;
gclk2 : out STD_LOGIC);
end edge_detector;
architecture Behavioral of edge_detector is
begin
process (dclk,notdclk)
begin
if (rising_edge(dclk)) then
gclk <= '1' after 10 ns, '0' after 20 ns;
end if;
if (rising_edge(notdclk)) then
gclk2 <= '1' after 10ns, '0' after 20ns;
end if;
end process;
end Behavioral;
Thanks!