how to generate pulse in vhdl
there is a typing mistake in the previous code. replace f2 <= r1 with f2 <= f1 or
copy the following code.
change the output pulse AND equation as you need. See the attached waveform
library ieee;
use ieee.std_logic_1164.all;
entity ex is
port(clk_1Mz, clk_1hz, rst : in std_logic;
output_pulse : out std_logic
);
end ex;
Architecture rtl of ex is
signal r1,r2, f1,f2, r_edge, f_edge : std_logic;
begin
process(rst, clk_1Mz)
begin
if rst = '1' then
r1 <= '0';
r2 <= '0';
elsif rising_edge(clk_1Mz) then
r1 <= clk_1hz;
r2 <= r1;
end if;
end process;
r_edge <= r1 and not r2;
process(rst, clk_1Mz)
begin
if rst = '1' then
f1 <= '0';
f2 <= '0';
elsif falling_edge(clk_1Mz) then
f1 <= clk_1hz;
f2 <= f1;
end if;
end process;
f_edge <= f1 and not f2;
output_pulse <= f_edge and not r_edge;
end rtl;