1 ------------------------------------------------------------------------------- 2 -- File : Pgp2bGtp7FixedLatWrapper.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2014-01-29 5 -- Last update: 2017-01-24 6 ------------------------------------------------------------------------------- 7 -- Description: Gtp7 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_gtp7 66 -- PLL and clock configurations 79 -- Status and Clock Signals 82 -- Output internally configured clocks 94 -- Frame Transmit Interface - 1 Lane, Array of 4 VCs 97 -- Frame Receive Interface - 1 Lane, Array of 4 VCs 115 -- AXI-Lite Interface 122 end Pgp2bGtp7FixedLatWrapper;
131 signal gtClk0 : sl := '0';
132 signal gtClk0Div2 : sl;
133 signal gtClk1 : sl := '0';
134 signal gtClk1Div2 : sl;
136 signal txRefClk : sl := '0';
137 signal txOutClk : sl := '0';
138 signal rxRefClk : sl := '0';
140 signal stableClkRef : sl := '0';
141 signal stableClkRefG : sl := '0';
142 signal stableClk : sl := '0';
143 signal stableRst : sl := '0';
145 signal pgpTxClkBase : sl;
146 signal pgpTxClk : sl;
147 signal pgpTxReset : sl;
148 signal pgpTxMmcmReset : sl;
149 signal pgpTxMmcmLocked : sl;
151 signal pgpRxRecClk : sl;
152 signal pgpRxRecClkRst : sl;
153 signal pgpRxClkLoc : sl;
154 signal pgpRxReset : sl;
155 signal pgpRxMmcmReset : sl;
156 signal pgpRxMmcmLocked : sl;
158 signal qPllRefClk : slv(1 downto 0) := "00";
159 signal qPllOutClk : slv(1 downto 0) := "00";
160 signal qPllOutRefClk : slv(1 downto 0) := "00";
161 signal qPllLock : slv(1 downto 0) := "00";
162 signal qPllLockDetClk : slv(1 downto 0) := "00";
163 signal qPllRefClkLost : slv(1 downto 0) := "00";
164 signal qPllReset : slv(1 downto 0) := "00";
175 ------------------------------------------------------------------------------------------------- 176 -- Bring in the refclocks through IBUFDS_GTE2 instances 177 ------------------------------------------------------------------------------------------------- 179 IBUFDS_GTE2_0 : IBUFDS_GTE2
189 IBUFDS_GTE2_1 : IBUFDS_GTE2
198 ------------------------------------------------------------------------------------------------- 199 -- Create the stable clock and reset 200 ------------------------------------------------------------------------------------------------- 208 BUFG_stableClkRef : BUFG
218 PwrUpRst_Inst :
entity work.
PwrUpRst 229 ------------------------------------------------------------------------------------------------- 230 -- Select the rxRefClk 231 ------------------------------------------------------------------------------------------------- 237 ------------------------------------------------------------------------------------------------- 238 -- Select the txRefClk 239 -- Generate TX user (PGP) clock 240 -- Might want option to bypass MMCM 241 ------------------------------------------------------------------------------------------------- 248 -- pgpTxClk and stable clock might be the same 270 clkIn => pgpTxClkBase,
271 rstIn => pgpTxMmcmReset,
272 clkOut
(0) => pgpTxClk,
274 locked => pgpTxMmcmLocked
);
278 end generate TX_CM_GEN;
287 RstSync_pgpTxRst :
entity work.
RstSync 293 clk => pgpTxClk,
-- [in] 295 syncRst => pgpTxReset
);
-- [out] 296 end generate PGP_TX_CLK_BUFG;
298 pgpTxClk <= pgpTxClkBase;
299 pgpTxReset <= stableRst;
301 end generate NO_TX_CM_GEN;
307 RstSync_pgpRxRst :
entity work.
RstSync 313 clk => pgpRxClkLoc,
-- [in] 315 syncRst => pgpRxReset
);
-- [out] 318 ------------------------------------------------------------------------------------------------- 319 -- Determine PLL clocks 320 ------------------------------------------------------------------------------------------------- 321 qPllRefClk(0) <= txRefClk when (TX_PLL_G = "PLL0") else 322 rxRefClk when (RX_PLL_G = "PLL0") else 325 qPllRefClk(1) <= txRefClk when (TX_PLL_G = "PLL1") else 326 rxRefClk when (RX_PLL_G = "PLL1") else 329 -- Double check this. I think the pllLockDetClk must be different from the pll refclk 330 -- qPllLockDetClk(0) <= stableClk when ((TX_PLL_G = "PLL0") or (RX_PLL_G = "PLL0")) else '0'; 331 -- qPllLockDetClk(1) <= stableClk when ((TX_PLL_G = "PLL1") or (RX_PLL_G = "PLL1")) else '0'; 332 qPllLockDetClk(0) <= '0';
333 qPllLockDetClk(1) <= '0';
335 -- Set the status outputs 420 pgpRxClk => pgpRxClkLoc,
-- RecClk fed back, optionally though MMCM 429 -- Frame Transmit Interface - 1 Lane, Array of 4 VCs 432 -- Frame Receive Interface - 1 Lane, Array of 4 VCs 440 -- AXI-Lite Interface 448 ------------------------------------------------------------------------------------------------- 449 -- Clock manager to clean up recovered clock 450 ------------------------------------------------------------------------------------------------- 466 clkIn => pgpRxRecClk,
467 rstIn => pgpRxMmcmReset,
468 clkOut
(0) => pgpRxClkLoc,
469 locked => pgpRxMmcmLocked
);
471 -- I think this is right, sync reset to mmcm clk 472 RstSync_1 :
entity work.
RstSync 479 end generate RxClkMmcmGen;
482 pgpRxClkLoc <= pgpRxRecClk;
484 pgpRxMmcmLocked <= '1';
485 end generate RxClkNoMmcmGen;
491 ------------------------------------------------------------------------------------------------- 493 -------------------------------------------------------------------------------------------------
out qPllRefClkLostslv( 1 downto 0)
PMA_RSV_Gbit_vector := x"00018480"
in axilReadMasterAxiLiteReadMasterType := AXI_LITE_READ_MASTER_INIT_C
in qPllRefClkslv( 1 downto 0)
in pgpTxMastersAxiStreamMasterArray( 3 downto 0) :=( others => AXI_STREAM_MASTER_INIT_C)
in mAxiWriteSlavesAxiLiteWriteSlaveArray( NUM_MASTER_SLOTS_G- 1 downto 0)
array(natural range <> ) of AxiStreamSlaveType AxiStreamSlaveArray
in pgpTxMmcmLockedsl := '1'
TX_CM_CLKIN_PERIOD_Greal := 8.000
PLL0_FBDIV_45_IN_Ginteger range 4 to 5:= 5
TX_CM_CLKFBOUT_MULT_F_Greal := 8.000
TX_CM_DIVCLK_DIVIDE_Gnatural := 8
TX_USER_CLK_SRC_Gstring := "txRefClk"
array(natural range <> ) of AxiLiteWriteSlaveType AxiLiteWriteSlaveArray
in axilReadMasterAxiLiteReadMasterType := AXI_LITE_READ_MASTER_INIT_C
in gtQPllLockslv( 1 downto 0) := "00"
in mAxiReadSlavesAxiLiteReadSlaveArray( NUM_MASTER_SLOTS_G- 1 downto 0)
SIMULATION_Gboolean := false
SIM_GTRESET_SPEEDUP_Gboolean := false
out pgpTxSlavesAxiStreamSlaveArray( 3 downto 0)
RX_OS_CFG_Gbit_vector := "0001111110000"
SIMULATION_Gboolean := false
out axilWriteSlaveAxiLiteWriteSlaveType
TX_CM_CLKOUT_DIVIDE_F_Greal := 8.000
NUM_SLAVE_SLOTS_Gnatural range 1 to 16:= 4
out qPllOutClkslv( 1 downto 0)
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
in pgpRxCtrlAxiStreamCtrlArray( 3 downto 0)
out pgpRxMasterMuxedAxiStreamMasterType
out axilReadSlaveAxiLiteReadSlaveType
EXT_RST_POLARITY_Gsl := '1'
TX_PLL_CFG_GGtp7QPllCfgType := getGtp7QPllCfg( 156.25e6, 3.125e9)
RX_CM_DIVCLK_DIVIDE_Gnatural := 8
CLKIN_PERIOD_Greal := 10.0
NUM_VC_EN_Ginteger range 1 to 4:= 4
out pgpRxMastersAxiStreamMasterArray( 3 downto 0)
in axilWriteMasterAxiLiteWriteMasterType := AXI_LITE_WRITE_MASTER_INIT_C
array(natural range <> ) of AxiLiteReadMasterType AxiLiteReadMasterArray
in txPostCursorslv( 4 downto 0) :=( others => '0')
PLL0_REFCLK_SEL_Gbit_vector := "001"
VC_INTERLEAVE_Ginteger := 0
in txPreCursorslv( 4 downto 0) :=( others => '0')
TX_CLK25_DIV_Ginteger := 5
out pgpRxOutPgp2bRxOutType
RST_IN_POLARITY_Gsl := '1'
RXCDR_CFG_Gbit_vector := x"0000107FE206001041010"
out pgpTxMmcmResetsl := '0'
PLL0_FBDIV_IN_Ginteger range 1 to 5:= 4
in txPreCursorslv( 4 downto 0) :=( others => '0')
PLL0_REFCLK_DIV_IN_Ginteger range 1 to 2:= 1
AXI_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_DECERR_C
RX_REFCLK_SRC_Gstring := "gtClk0"
out axilWriteSlaveAxiLiteWriteSlaveType
TX_REFCLK_SRC_Gstring := "gtClk0"
AXI_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_DECERR_C
PLL1_REFCLK_SEL_Gbit_vector := "001"
AXIL_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_DECERR_C
in gtQPllRefClkLostslv( 1 downto 0) := "00"
INPUT_BUFG_Gboolean := true
PAYLOAD_CNT_TOP_Ginteger := 7
out pgpTxOutPgp2bTxOutType
RXCDR_CFG_Gbit_vector := x"00003000023ff40200020"
SIM_VERSION_Gstring := "1.0"
in arstsl :=not IN_POLARITY_G
PMA_RSV_Gbit_vector := x"00000333"
MASTERS_CONFIG_GAxiLiteCrossbarMasterConfigArray := AXIL_XBAR_CFG_DEFAULT_C
SIM_GTRESET_SPEEDUP_Gstring := "FALSE"
RELEASE_DELAY_Ginteger range 3 to positive'high:= 3
DEC_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_DECERR_C
RX_CM_TYPE_Gstring := "MMCM"
PLL1_REFCLK_DIV_IN_Ginteger range 1 to 2:= 1
slv( 1 downto 0) := "11" AXI_RESP_DECERR_C
TX_ENABLE_Gboolean := true
SIM_RESET_SPEEDUP_Gstring := "TRUE"
RX_OS_CFG_Gbit_vector := "0000010000000"
TX_CM_EN_Gboolean := true
BANDWIDTH_Gstring := "OPTIMIZED"
RX_PLL_CFG_GGtp7QPllCfgType := getGtp7QPllCfg( 156.25e6, 3.125e9)
RX_CM_CLKIN_PERIOD_Greal := 8.000
TX_BUF_EN_Gboolean := false
CLKFBOUT_MULT_F_Greal range 1.0 to 64.0:= 1.0
TX_PHASE_ALIGN_Gstring := "MANUAL"
out pgpRxOutPgp2bRxOutType
in gtQPllOutRefClkslv( 1 downto 0) := "00"
DIVCLK_DIVIDE_Ginteger range 1 to 106:= 1
out axilReadSlaveAxiLiteReadSlaveType
CLKOUT0_RST_HOLD_Ginteger range 3 to positive'high:= 3
out mAxiReadMastersAxiLiteReadMasterArray( NUM_MASTER_SLOTS_G- 1 downto 0)
array(natural range <> ) of AxiStreamCtrlType AxiStreamCtrlArray
in txPostCursorslv( 4 downto 0) :=( others => '0')
in txDiffCtrlslv( 3 downto 0) := "1000"
SIM_VERSION_Gstring := "1.0"
AxiLiteReadSlaveType :=(arready => '0',rdata =>( others => '0'),rresp =>( others => '0'),rvalid => '0') AXI_LITE_READ_SLAVE_INIT_C
TX_OUTCLK_SRC_Gstring := "PLLREFCLK"
array(natural range <> ) of AxiStreamMasterType AxiStreamMasterArray
out pgpRxMasterMuxedAxiStreamMasterType
RX_ENABLE_Gboolean := true
NUM_MASTER_SLOTS_Gnatural range 1 to 64:= 4
in gtQPllOutClkslv( 1 downto 0) := "00"
in axilWriteMasterAxiLiteWriteMasterType := AXI_LITE_WRITE_MASTER_INIT_C
out axilWriteSlaveAxiLiteWriteSlaveType
AxiLiteReadMasterType :=(araddr =>( others => '0'),arprot =>( others => '0'),arvalid => '0',rready => '1') AXI_LITE_READ_MASTER_INIT_C
RX_CM_CLKFBOUT_MULT_F_Greal := 8.000
in qPllResetslv( 1 downto 0)
OUT_REG_RST_Gboolean := true
NUM_VC_EN_Ginteger range 1 to 4:= 4
array(natural range <> ) of AxiLiteWriteMasterType AxiLiteWriteMasterArray
in pgpRxCtrlAxiStreamCtrlArray( 3 downto 0)
AXIL_BASE_ADDR_Gslv( 31 downto 0) :=( others => '0')
CLKOUT0_DIVIDE_F_Greal range 1.0 to 128.0:= 1.0
in qPllLockDetClkslv( 1 downto 0)
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
RX_ENABLE_Gboolean := true
RX_CM_CLKOUT_DIVIDE_F_Greal := 8.000
in pgpRxMmcmLockedsl := '1'
SIM_VERSION_Gstring := "1.0"
STABLE_CLOCK_PERIOD_Greal := 4.0E-9
in txDiffCtrlslv( 3 downto 0) := "1000"
PAYLOAD_CNT_TOP_Ginteger := 7
out qPllOutRefClkslv( 1 downto 0)
out gtQPllResetslv( 1 downto 0)
VC_INTERLEAVE_Ginteger := 0
array(natural range <> ) of AxiLiteReadSlaveType AxiLiteReadSlaveArray
in axilReadMasterAxiLiteReadMasterType := AXI_LITE_READ_MASTER_INIT_C
TX_ENABLE_Gboolean := true
out pgpRxMastersAxiStreamMasterArray( 3 downto 0)
PLL1_FBDIV_45_IN_Ginteger range 4 to 5:= 5
out mAxiWriteMastersAxiLiteWriteMasterArray( NUM_MASTER_SLOTS_G- 1 downto 0)
out pgpTxSlavesAxiStreamSlaveArray( 3 downto 0)
in axilWriteMasterAxiLiteWriteMasterType := AXI_LITE_WRITE_MASTER_INIT_C
out qPllLockslv( 1 downto 0)
AxiLiteWriteSlaveType :=(awready => '0',wready => '0',bresp =>( others => '0'),bvalid => '0') AXI_LITE_WRITE_SLAVE_INIT_C
SIM_SPEEDUP_Gboolean := false
RX_CLK25_DIV_Ginteger := 5
in pgpTxMastersAxiStreamMasterArray( 3 downto 0) :=( others => AXI_STREAM_MASTER_INIT_C)
STABLE_CLK_SRC_Gstring := "stableClkIn"
out axilReadSlaveAxiLiteReadSlaveType
NUM_CLOCKS_Ginteger range 1 to 7
PLL1_FBDIV_IN_Ginteger range 1 to 5:= 4
RX_CM_EN_Gboolean := true
TX_CM_TYPE_Gstring := "MMCM"
out pgpTxOutPgp2bTxOutType