The FPGA project I am working on requires events within an FPGA to be triggered off a 1Hz PPS coming from a GPS module. I have sampled this pps and then tried implemented logic triggered by this sampled pps in the two processes below.
This SO post
where a respected member commented on a post saying its not good practice to use rising_edge
on a clock as slow as 1Hz(non-clock signal).
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity gen is port(
sys_clk_i : in std_logic;
sys_rst_i : in std_logic;
gps_pps_i : in std_logic;
pps_roll_o : std_logic_vector(5 downto 0) );
end gen;
architecture Behavioral of gen is
signal pps_roll_s : std_logic_vector(5 downto 0);
signal gps_pps_reg_s : std_logic;
PPS_SYNC_PROCESS : process(sys_clk_i, sys_rst_i)
begin
if rising_edge(sys_clk_i) then
if (sys_rst_i = '1') then
gps_pps_reg_s <= '0';
else
gps_pps_reg_s <= gps_pps_i;
end if;
end if;
end process PPS_SYNC_PROCESS;
PPS_ROLL_PROCESS : process(gps_pps_reg_s, sys_clk_i, sys_rst_i)
begin
if (sys_rst_i = '1') then
pps_roll_s <= "000001";
elsif (gps_pps_reg_s'event and gps_pps_reg_s='1') then
--elsif (rising_edge(gps_pps_reg_s)) then
pps_roll_s <= pps_roll_s rol 1;
end if;
end process PPS_ROLL_PROCESS;
pps_roll_o <= pps_roll_s;
end Behavioral;
I am unable to use
if rising_edge(sys_clk_i) then
if rising_edge(gpd_pps_reg_s) then
pps_roll_s <= "000001";
because Vivado does not allow nesting
if rising_edge
I can't think of any other way to achieve this unless I can use rising_edge
on a sampled 1Hz clock?