1 ------------------------------------------------------------------------------- 2 -- File : SynchronizerEdge.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2013-05-13 5 -- Last update: 2016-09-22 6 ------------------------------------------------------------------------------- 7 -- Description: A simple multi Flip FLop synchronization module. 8 ------------------------------------------------------------------------------- 9 -- This file is part of 'SLAC Firmware Standard Library'. 10 -- It is subject to the license terms in the LICENSE.txt file found in the 11 -- top-level directory of this distribution and at: 12 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. 13 -- No part of 'SLAC Firmware Standard Library', including this file, 14 -- may be copied, modified, propagated, or distributed except according to 15 -- the terms contained in the LICENSE.txt file. 16 ------------------------------------------------------------------------------- 19 use ieee.std_logic_1164.
all;
24 --! @ingroup base_sync 31 BYPASS_SYNC_G : := false;
-- Bypass Synchronizer module for synchronous data configuration 35 clk : in sl;
-- clock to be SYNC'd to 47 type RegType is record 53 constant REG_INIT_C : RegType := ( 58 signal r : RegType := REG_INIT_C;
64 assert (STAGES_G >= 3) report "STAGES_G must be >= 3" severity failure;
81 comb :
process (r,
rst, syncData)
is 84 -- Latch the current value 87 -- Reset strobe signals 91 -- Keep a record of the last syncData 92 v.syncDataDly := syncData;
94 -- Set the polarity of the output 101 -- Check for a rising edge of the syncData 102 if (syncData = '1') and (r.syncDataDly = '0') then 106 -- Check for a rising edge of the syncData 107 if (syncData = '0') and (r.syncDataDly = '1') then 114 v.syncDataDly := syncData;
-- prevent accidental edge detection 117 -- Register the variable for next clock cycle 127 seq :
process (
clk,
rst, syncData)
is 129 if rising_edge(clk) then 130 r <= rin after TPD_G;
134 r <= REG_INIT_C after TPD_G;
135 r.syncDataDly <= syncData after TPD_G;
-- prevent accidental edge detection 139 end architecture rtl;
RST_ASYNC_Gboolean := false
in rstsl :=not RST_POLARITY_G
BYPASS_SYNC_Gboolean := false
in rstsl :=not RST_POLARITY_G
RST_ASYNC_Gboolean := false
BYPASS_SYNC_Gboolean := false