1 -------------------------------------------------------------------------------     2 -- File       : Pgp2bGtx7FixedLatWrapper.vhd     3 -- Company    : SLAC National Accelerator Laboratory     4 -- Created    : 2014-01-29     5 -- Last update: 2016-11-04     6 -------------------------------------------------------------------------------     7 -- Description: Gtx7 Fixed Latency Wrapper     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;
    29 use unisim.vcomponents.
all;
    32  --! @ingroup protocols_pgp_pgp2b_gtx7    65       -- PLL and clock configurations    77       -- Status and Clock Signals    80       -- Output internally configured clocks    91       -- Frame Transmit Interface - 1 Lane, Array of 4 VCs    94       -- Frame Receive Interface - 1 Lane, Array of 4 VCs   112       -- AXI-Lite Interface    119 end Pgp2bGtx7FixedLatWrapper;
   125    signal gtClk0 : sl := '0';
   126    signal gtClk1 : sl := '0';
   128    signal txRefClk : sl := '0';
   129    signal txOutClk : sl := '0';
   130    signal rxRefClk : sl := '0';
   132    signal stableClkRef  : sl := '0';
   133    signal stableClkRefG : sl := '0';
   134    signal stableClk     : sl := '0';
   135    signal stableRst     : sl := '0';
   137    signal pgpTxClkBase : sl;
   138    signal pgpTxClk     : sl;
   139    signal pgpTxReset   : sl;
   141    signal pgpRxRecClk     : sl;
   142    signal pgpRxRecClkRst  : sl;
   143    signal pgpRxClkLoc     : sl;
   144    signal pgpRxReset      : sl;
   145    signal pgpRxMmcmReset  : sl;
   146    signal pgpRxMmcmLocked : sl;
   148    signal gtCPllRefClk : sl := '0';
   149    signal gtCPllLock   : sl := '0';
   151    signal qPllRefClk     : sl := '0';
   152    signal qPllOutClk     : sl := '0';
   153    signal qPllOutRefClk  : sl := '0';
   154    signal qPllLock       : sl := '0';
   155    signal pllLockDetClk  : sl := '0';
   156    signal qPllRefClkLost : sl := '0';
   157    signal qPllReset      : sl := '0';
   163    -------------------------------------------------------------------------------------------------   164    -- Bring in the refclocks through IBUFDS_GTE2 instances   165    -------------------------------------------------------------------------------------------------   167       IBUFDS_GTE2_0 : IBUFDS_GTE2
   177       IBUFDS_GTE2_1 : IBUFDS_GTE2
   186    -------------------------------------------------------------------------------------------------   187    -- Create the stable clock and reset   188    -------------------------------------------------------------------------------------------------   194    BUFG_stableClkRef : BUFG
   204    PwrUpRst_Inst : 
entity work.
PwrUpRst   215    -------------------------------------------------------------------------------------------------   216    -- Select the rxRefClk   217    -------------------------------------------------------------------------------------------------   223    -------------------------------------------------------------------------------------------------   224    -- Select the txRefClk   225    -- Generate TX user (PGP) clock   226    -- Might want option to bypass MMCM   227    -------------------------------------------------------------------------------------------------   234    -- pgpTxClk and stable clock might be the same   255             clkIn     => pgpTxClkBase,
   257             clkOut
(0) => pgpTxClk,
   258             rstOut
(0) => pgpTxReset
);
   259    end generate TX_CM_GEN;
   268          RstSync_pgpTxRst : 
entity work.
RstSync   274                clk      => pgpTxClk,
     -- [in]   276                syncRst  => pgpTxReset
);
  -- [out]   277       end generate PGP_TX_CLK_BUFG;
   279          pgpTxClk   <= pgpTxClkBase;
   280          pgpTxReset <= stableRst;
   282    end generate NO_TX_CM_GEN;
   285    RstSync_pgpTxRst : 
entity work.
RstSync   291          clk      => pgpRxClkLoc,
       -- [in]   293          syncRst  => pgpRxReset
);
       -- [out]   295    -------------------------------------------------------------------------------------------------   296    -- Determine PLL clocks   297    -------------------------------------------------------------------------------------------------   298    gtCPllRefClk <= txRefClk when (TX_PLL_G = "CPLL") else   299                    rxRefClk when (RX_PLL_G = "CPLL") else   302    qPllRefClk <= txRefClk when (TX_PLL_G = "QPLL") else   303                  rxRefClk when (RX_PLL_G = "QPLL") else   306    pllLockDetClk <= stableClk;
   308    -- Set the status outputs   327    end generate QPLL_GEN;
   384          pgpRxClk         => pgpRxClkLoc,
  -- RecClk fed back, optionally though MMCM   393          -- Frame Transmit Interface - 1 Lane, Array of 4 VCs   396          -- Frame Receive Interface - 1 Lane, Array of 4 VCs   404          -- AXI-Lite Interface    412    -------------------------------------------------------------------------------------------------   413    -- Clock manager to clean up recovered clock   414    -------------------------------------------------------------------------------------------------   430             clkIn     => pgpRxRecClk,
   431             rstIn     => pgpRxMmcmReset,
   432             clkOut
(0) => pgpRxClkLoc,
   433             locked    => pgpRxMmcmLocked
);
   435       -- I think this is right, sync reset to mmcm clk   436       RstSync_1 : 
entity work.
RstSync   443    end generate RxClkMmcmGen;
   446       pgpRxClkLoc     <= pgpRxRecClk;
   448       pgpRxMmcmLocked <= '1';
   449    end generate RxClkNoMmcmGen;
 in pgpTxMastersAxiStreamMasterArray( 3 downto  0)  :=( others =>   AXI_STREAM_MASTER_INIT_C)
 
SIM_VERSION_Gstring  :=   "4.0"
 
PMA_RSV_Gbit_vector  := x"00018480"
 
in axilReadMasterAxiLiteReadMasterType  :=   AXI_LITE_READ_MASTER_INIT_C
 
in txPreCursorslv( 4 downto  0)  :=( others => '0')
 
RXCDR_CFG_Gbit_vector  := x"03000023ff40200020"
 
QPLL_FBDIV_Gbit_vector  :=   "0100100000"
 
SIM_GTRESET_SPEEDUP_Gstring  :=   "FALSE"
 
array(natural range <> ) of AxiStreamSlaveType   AxiStreamSlaveArray
 
TX_CM_CLKFBOUT_MULT_F_Greal  := 8.000
 
CPLL_CFG_GGtx7CPllCfgType  :=   getGtx7CPllCfg( 250.0E6, 3.125E9)
 
TX_CM_CLKIN_PERIOD_Greal  := 8.000
 
out pgpTxSlavesAxiStreamSlaveArray( 3 downto  0)  
 
TX_CM_DIVCLK_DIVIDE_Gnatural  := 8
 
PAYLOAD_CNT_TOP_Ginteger  := 7
 
in pgpTxMastersAxiStreamMasterArray( 3 downto  0)  :=( others =>   AXI_STREAM_MASTER_INIT_C)
 
SIMULATION_Gboolean  :=   false
 
in axilReadMasterAxiLiteReadMasterType  :=   AXI_LITE_READ_MASTER_INIT_C
 
RX_DFE_KL_CFG2_Gbit_vector  := x"3008E56A"
 
AxiStreamMasterType  :=(tValid  => '0',tData  =>( others => '0'),tStrb  =>( others => '1'),tKeep  =>( others => '1'),tLast  => '0',tDest  =>( others => '0'),tId  =>( others => '0'),tUser  =>( others => '0')) AXI_STREAM_MASTER_INIT_C
 
RXCDR_CFG_Gbit_vector  := x"03000023ff40200020"
 
TX_CLK25_DIV_Ginteger  := 5
 
TX_CM_CLKOUT_DIVIDE_F_Greal  := 8.000
 
out pgpRxMastersAxiStreamMasterArray( 3 downto  0)  
 
SIM_VERSION_Gstring  :=   "4.0"
 
RX_CM_DIVCLK_DIVIDE_Gnatural  := 8
 
CPLL_REFCLK_SEL_Gbit_vector  :=   "001"
 
TX_ENABLE_Gboolean  :=   true
 
out axilWriteSlaveAxiLiteWriteSlaveType  
 
CLKIN_PERIOD_Greal  := 10.0
 
RX_REFCLK_SRC_Gstring  :=   "gtClk1"
 
NUM_VC_EN_Ginteger   range  1 to  4:= 4
 
out axilReadSlaveAxiLiteReadSlaveType  
 
QPLL_CFG_GGtx7QPllCfgType  :=   getGtx7QPllCfg( 156.25e6, 3.125e9)
 
TX_BUF_EN_Gboolean  :=   false
 
RST_IN_POLARITY_Gsl  := '1'
 
VC_INTERLEAVE_Ginteger  := 0
 
RX_OS_CFG_Gbit_vector  :=   "0000010000000"
 
in txPreCursorslv( 4 downto  0)  :=( others => '0')
 
TX_REFCLK_SRC_Gstring  :=   "gtClk0"
 
in axilWriteMasterAxiLiteWriteMasterType  :=   AXI_LITE_WRITE_MASTER_INIT_C
 
in txPostCursorslv( 4 downto  0)  :=( others => '0')
 
SIM_GTRESET_SPEEDUP_Gstring  :=   "FALSE"
 
INPUT_BUFG_Gboolean  :=   true
 
out pgpRxOutPgp2bRxOutType  
 
out pgpTxOutPgp2bTxOutType  
 
out axilWriteSlaveAxiLiteWriteSlaveType  
 
in arstsl  :=not    IN_POLARITY_G
 
STABLE_CLK_SRC_Gstring  :=   "gtClk0"
 
AXI_ERROR_RESP_Gslv( 1 downto  0)  :=   AXI_RESP_DECERR_C
 
RELEASE_DELAY_Ginteger   range  3 to    positive'high:= 3
 
TX_PHASE_ALIGN_Gstring  :=   "MANUAL"
 
slv( 1 downto  0)  :=   "11" AXI_RESP_DECERR_C
 
RX_CM_TYPE_Gstring  :=   "MMCM"
 
RX_OS_CFG_Gbit_vector  :=   "0000010000000"
 
RX_CM_EN_Gboolean  :=   false
 
BANDWIDTH_Gstring  :=   "OPTIMIZED"
 
out pgpRxOutPgp2bRxOutType  
 
in txDiffCtrlslv( 3 downto  0)  :=   "1000"
 
out axilReadSlaveAxiLiteReadSlaveType  
 
CLKFBOUT_MULT_F_Greal   range  1.0 to  64.0:= 1.0
 
RX_CM_CLKIN_PERIOD_Greal  := 8.000
 
in txPostCursorslv( 4 downto  0)  :=( others => '0')
 
DIVCLK_DIVIDE_Ginteger   range  1 to  106:= 1
 
CLKOUT0_RST_HOLD_Ginteger   range  3 to    positive'high:= 3
 
out pgpTxSlavesAxiStreamSlaveArray( 3 downto  0)  
 
in gtQPllRefClkLostsl  := '0'
 
in txDiffCtrlslv( 3 downto  0)  :=   "1000"
 
array(natural range <> ) of AxiStreamCtrlType   AxiStreamCtrlArray
 
AXI_ERROR_RESP_Gslv( 1 downto  0)  :=   AXI_RESP_DECERR_C
 
RX_ENABLE_Gboolean  :=   true
 
array(natural range <> ) of AxiStreamMasterType   AxiStreamMasterArray
 
out pgpRxMasterMuxedAxiStreamMasterType  
 
RX_ENABLE_Gboolean  :=   true
 
RX_CM_CLKFBOUT_MULT_F_Greal  := 8.000
 
AxiLiteReadMasterType  :=(araddr  =>( others => '0'),arprot  =>( others => '0'),arvalid  => '0',rready  => '1') AXI_LITE_READ_MASTER_INIT_C
 
CPLL_FBDIV_45_Ginteger  := 5
 
RX_DFE_KL_CFG2_Gbit_vector  := x"3008E56A"
 
OUT_REG_RST_Gboolean  :=   true
 
QPLL_REFCLK_DIV_Ginteger  := 1
 
VC_INTERLEAVE_Ginteger  := 0
 
TX_OUTCLK_SRC_Gstring  :=   "PLLREFCLK"
 
QPLL_REFCLK_SEL_Gbit_vector  :=   "001"
 
CLKOUT0_DIVIDE_F_Greal   range  1.0 to  128.0:= 1.0
 
CPLL_REFCLK_DIV_Ginteger  := 1
 
AxiLiteWriteMasterType  :=(awaddr  =>( others => '0'),awprot  =>( others => '0'),awvalid  => '0',wdata  =>( others => '0'),wstrb  =>( others => '1'),wvalid  => '0',bready  => '1') AXI_LITE_WRITE_MASTER_INIT_C
 
PAYLOAD_CNT_TOP_Ginteger  := 7
 
in pgpRxCtrlAxiStreamCtrlArray( 3 downto  0)  
 
RX_CM_CLKOUT_DIVIDE_F_Greal  := 8.000
 
STABLE_CLOCK_PERIOD_Greal  := 8.0E-9
 
TX_ENABLE_Gboolean  :=   true
 
QPLL_FBDIV_RATIO_Gbit  := '1'
 
TX_CM_EN_Gboolean  :=   false
 
SIMULATION_Gboolean  :=   false
 
PMA_RSV_Gbit_vector  := x"00018480"
 
NUM_VC_EN_Ginteger   range  1 to  4:= 4
 
in axilWriteMasterAxiLiteWriteMasterType  :=   AXI_LITE_WRITE_MASTER_INIT_C
 
RX_CLK25_DIV_Ginteger  := 5
 
in pgpRxCtrlAxiStreamCtrlArray( 3 downto  0)  
 
out pgpTxOutPgp2bTxOutType  
 
out pgpRxMasterMuxedAxiStreamMasterType  
 
in pgpRxMmcmLockedsl  := '1'
 
SIM_SPEEDUP_Gboolean  :=   false
 
out pgpRxMastersAxiStreamMasterArray( 3 downto  0)  
 
TX_CM_TYPE_Gstring  :=   "MMCM"
 
NUM_CLOCKS_Ginteger   range  1 to  7