Forum Discussion
Altera_Forum
Honored Contributor
17 years agoCapture the falling edge of signals in VHDL
Hi, Please bear me with a newbie's question: I want to capture a PWM signal's falling edge. But, I can not use "falling_edge" as the PWM signal is not a clock signal. Can any exper...
Altera_Forum
Honored Contributor
17 years ago
process(reset_n,clk)
variable detect : std_ulogic_vector (1 downto 0);
begin
if reset_n ='0' then
detect := "00";
elsif rising_edge(clk) then
detect(1) := detect(0); -- record last value of sync in detect(1)
detect(0) := sync ; --record current sync in detect(0)
if detect = "01" then -- rising_edge
elsif detect = "10" then --falling_edge
end if;
end if;
end process;
Voilà :-) je l'ai déniché je ne sais où : désolé de ne pas pouvoir citer l'auteur sorry, i forget original author's name EDIT : translations