SURF  1.0
RstSync.vhd
Go to the documentation of this file.
1 -------------------------------------------------------------------------------
2 -- File : RstSync.vhd
3 -- Company : SLAC National Accelerator Laboratory
4 -- Created : 2013-05-01
5 -- Last update: 2017-02-23
6 -------------------------------------------------------------------------------
7 -- Description: Synchronizes the trailing edge of an asynchronous reset to a
8 -- given clock.
9 -------------------------------------------------------------------------------
10 -- This file is part of 'SLAC Firmware Standard Library'.
11 -- It is subject to the license terms in the LICENSE.txt file found in the
12 -- top-level directory of this distribution and at:
13 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
14 -- No part of 'SLAC Firmware Standard Library', including this file,
15 -- may be copied, modified, propagated, or distributed except according to
16 -- the terms contained in the LICENSE.txt file.
17 -------------------------------------------------------------------------------
18 
19 library IEEE;
20 use IEEE.STD_LOGIC_1164.all;
21 use work.StdRtlPkg.all;
22 
23 --! @see entity
24  --! @ingroup base_sync
25 entity RstSync is
26  generic (
27  TPD_G : time := 1 ns; -- Simulation FF output delay
28  IN_POLARITY_G : sl := '1'; -- 0 for active low rst, 1 for high
29  OUT_POLARITY_G : sl := '1';
30  BYPASS_SYNC_G : boolean := false; -- Bypass Synchronizer module for synchronous data configuration
31  RELEASE_DELAY_G : integer range 3 to positive'high := 3; -- Delay between deassertion of async and sync resets
32  OUT_REG_RST_G : boolean := true); -- Apply async reset to final reg stage
33  port (
34  clk : in sl;
35  asyncRst : in sl;
36  syncRst : out sl);
37 end RstSync;
38 
39 architecture rtl of RstSync is
40 
41  signal syncInt : sl := OUT_POLARITY_G;
42 
43 begin
44 
45 -- assert (RELEASE_DELAY_G >= 3) report "RELEASE_DELAY_G must be >= 3" severity failure;
46 
47  -- Reuse synchronizer that turns off shift reg extraction and register balancing for you
48  Synchronizer_1 : entity work.Synchronizer
49  generic map (
50  TPD_G => TPD_G,
52  RST_ASYNC_G => true,
56  port map (
57  clk => clk,
58  rst => asyncRst,
59  dataIn => not OUT_POLARITY_G ,
60  dataOut => syncInt);
61 
62  -- Final stage does not have async constraints applied, can be duplicated to ease timing
63  OUT_REG : process (clk, asyncRst) is
64  begin
65  if (asyncRst = IN_POLARITY_G and OUT_REG_RST_G) then
66  syncRst <= OUT_POLARITY_G after TPD_G;
67  elsif (rising_edge(clk)) then
68  syncRst <= syncInt after TPD_G;
69  end if;
70  end process OUT_REG;
71 
72 end rtl;
73 
INIT_Gslv := "0"
out syncRstsl
Definition: RstSync.vhd:36
IN_POLARITY_Gsl := '1'
Definition: RstSync.vhd:28
std_logic sl
Definition: StdRtlPkg.vhd:28
in rstsl :=not RST_POLARITY_G
_library_ IEEEIEEE
Definition: StdRtlPkg.vhd:18
BYPASS_SYNC_Gboolean := false
STAGES_Gpositive := 2
RST_POLARITY_Gsl := '1'
in asyncRstsl
Definition: RstSync.vhd:35
out dataOutsl
in clksl
Definition: RstSync.vhd:34
OUT_POLARITY_Gsl := '1'
Definition: RstSync.vhd:29
BYPASS_SYNC_Gboolean := false
Definition: RstSync.vhd:30
RELEASE_DELAY_Ginteger range 3 to positive'high:= 3
Definition: RstSync.vhd:31
TPD_Gtime := 1 ns
Definition: RstSync.vhd:27
TPD_Gtime := 1 ns
OUT_REG_RST_Gboolean := true
Definition: RstSync.vhd:32
RST_ASYNC_Gboolean := false