SURF  1.0
JesdSysrefDly.vhd
Go to the documentation of this file.
1 -------------------------------------------------------------------------------
2 -- File : JesdSysrefDly.vhd
3 -- Company : SLAC National Accelerator Laboratory
4 -- Created : 2015-04-15
5 -- Last update: 2015-04-15
6 -------------------------------------------------------------------------------
7 -- Description: Delay sysref signal to align timing on two different receiver devices (FPGA, DAC).
8 -- The receiver devices in this core are already aligned and separate delay for separate
9 -- RX modules is not necessary.
10 --
11 -- Delays the sysref for 1 to 2^DLY_WIDTH_G clock cycles.
12 --
13 -------------------------------------------------------------------------------
14 -- This file is part of 'SLAC Firmware Standard Library'.
15 -- It is subject to the license terms in the LICENSE.txt file found in the
16 -- top-level directory of this distribution and at:
17 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
18 -- No part of 'SLAC Firmware Standard Library', including this file,
19 -- may be copied, modified, propagated, or distributed except according to
20 -- the terms contained in the LICENSE.txt file.
21 -------------------------------------------------------------------------------
22 
23 library ieee;
24 use ieee.std_logic_1164.all;
25 use ieee.std_logic_unsigned.all;
26 use ieee.std_logic_arith.all;
27 
28 use work.StdRtlPkg.all;
29 use work.Jesd204bPkg.all;
30 
31 --! @see entity
32  --! @ingroup protocols_jesd204b
33 entity JesdSysrefDly is
34  generic (
35  TPD_G : time := 1 ns;
36  DLY_WIDTH_G : positive := 5 -- number of bits in the delay setting (2**DLY_WIDTH_G is the max size of delay)
37  );
38  port (
39  clk : in sl;
40  rst : in sl;
41 
42  dly_i : in slv(DLY_WIDTH_G-1 downto 0);
43 
44  -- Synchronization input
45  sysref_i : in sl;
46 
47  -- Synchronization delayed input
48  sysref_o : out sl
49  );
50 end entity JesdSysrefDly;
51 
52 architecture rtl of JesdSysrefDly is
53 
54  type RegType is record
55  shft : slv(2**DLY_WIDTH_G-1 downto 0);
56  end record RegType;
57 
58  constant REG_INIT_C : RegType := (
59  shft => (others => '0')
60  );
61 
62  signal r : RegType := REG_INIT_C;
63  signal rin : RegType;
64 
65 begin
66 
67  comb : process (r, rst,sysref_i) is
68  variable v : RegType;
69  begin
70  v := r;
71 
72  -- Delay sysref for one clock cycle
73  v.shft := r.shft(2**DLY_WIDTH_G-2 downto 0) & sysref_i;
74 
75  if (rst = '1') then
76  v := REG_INIT_C;
77  end if;
78 
79  rin <= v;
80 
81  end process comb;
82 
83  seq : process (clk) is
84  begin
85  if (rising_edge(clk)) then
86  r <= rin after TPD_G;
87  end if;
88  end process seq;
89 
90  -- Output assignment
91  sysref_o <= varIndexOutFunc(r.shft, dly_i);
92 
93 end architecture rtl;
TPD_Gtime := 1 ns
std_logic sl
Definition: StdRtlPkg.vhd:28
in dly_islv( DLY_WIDTH_G- 1 downto 0)
DLY_WIDTH_Gpositive := 5
std_logic_vector slv
Definition: StdRtlPkg.vhd:29