Go to the documentation of this file. 1 ------------------------------------------------------------------------------- 2 -- File : JesdLmfcGen.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2015-04-15 5 -- Last update: 2017-05-02 6 ------------------------------------------------------------------------------- 7 -- Description: LMFC Generator 8 -- Local Multi Frame Clock Generator 9 -- Periodically outputs one clock cycle pulse (LMFC). 10 -- Synchronizes with the rising edge of sysref_i if sync is requested 11 -- by any of the on-board JESD receivers. 12 -- Outputs first pulse 2 c-c after sysref_i='1' 13 -- Period determined by F_G*K_G/GT_WORD_SIZE_C. 14 -- (Example: 2*32/4 = 16) 15 ------------------------------------------------------------------------------- 16 -- This file is part of 'SLAC Firmware Standard Library'. 17 -- It is subject to the license terms in the LICENSE.txt file found in the 18 -- top-level directory of this distribution and at: 19 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. 20 -- No part of 'SLAC Firmware Standard Library', including this file, 21 -- may be copied, modified, propagated, or distributed except according to 22 -- the terms contained in the LICENSE.txt file. 23 ------------------------------------------------------------------------------- 26 use ieee.std_logic_1164.
all;
27 use ieee.std_logic_unsigned.
all;
28 use ieee.std_logic_arith.
all;
31 use work.jesd204bpkg.
all;
34 --! @ingroup protocols_jesd204b 44 -- Synchronization inputs 52 end entity JesdLmfcGen;
56 constant PERIOD_C : positive := ((K_G * F_G)/GT_WORD_SIZE_C)-1;
57 constant CNT_WIDTH_C : positive := bitSize(PERIOD_C);
59 type RegType is record 61 cnt : slv(CNT_WIDTH_C-1 downto 0);
66 constant REG_INIT_C : RegType := ( 68 cnt => (others => '0'), 73 signal r : RegType := REG_INIT_C;
83 -- Delay sysref for one clock cycle 86 -- Detect rising edge on sysref 87 v.sysrefRe := sysref_i and not r.sysrefD1;
92 -- LMFC is aligned to sysref on rising edge of sysref_i. 93 -- The alignment is only done when nSync_i='0' 94 if (r.sysrefRe = '1' and nSync_i = '0' ) then 95 v.cnt := (others => '0');
97 elsif (r.cnt = PERIOD_C) then 98 v.cnt := (others => '0');
113 seq :
process (
clk)
is 115 if (rising_edge(clk)) then 116 r <= rin after TPD_G;
123 --------------------------------------- 124 end architecture rtl;