SURF  1.0
Pgp2bGtx7VarLatWrapper.vhd
Go to the documentation of this file.
1 -------------------------------------------------------------------------------
2 -- File : Pgp2bGtx7VarLatWrapper.vhd
3 -- Company : SLAC National Accelerator Laboratory
4 -- Created : 2014-01-29
5 -- Last update: 2016-08-24
6 -------------------------------------------------------------------------------
7 -- Description: Example PGP 3.125 Gbps front end wrapper
8 -- Note: Default generic configurations are for the KC705 development board
9 -- Note: Default uses 125 MHz reference clock to generate 3.125 Gbps PGP link
10 -------------------------------------------------------------------------------
11 -- This file is part of 'SLAC Firmware Standard Library'.
12 -- It is subject to the license terms in the LICENSE.txt file found in the
13 -- top-level directory of this distribution and at:
14 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
15 -- No part of 'SLAC Firmware Standard Library', including this file,
16 -- may be copied, modified, propagated, or distributed except according to
17 -- the terms contained in the LICENSE.txt file.
18 -------------------------------------------------------------------------------
19 
20 library ieee;
21 use ieee.std_logic_1164.all;
22 
23 use work.StdRtlPkg.all;
24 use work.AxiStreamPkg.all;
25 use work.Pgp2bPkg.all;
26 use work.AxiLitePkg.all;
27 
28 library unisim;
29 use unisim.vcomponents.all;
30 
31 --! @see entity
32  --! @ingroup protocols_pgp_pgp2b_gtx7
34  generic (
35  TPD_G : time := 1 ns;
36  -- MMCM Configurations (Defaults: gtClkP = 125 MHz Configuration)
37  CLKIN_PERIOD_G : real := 16.0; -- gtClkP/2
38  DIVCLK_DIVIDE_G : natural range 1 to 106 := 2;
39  CLKFBOUT_MULT_F_G : real range 1.0 to 64.0 := 31.875;
40  CLKOUT0_DIVIDE_F_G : real range 1.0 to 128.0 := 6.375;
41  -- CPLL Configurations (Defaults: gtClkP = 125 MHz Configuration)
42  CPLL_REFCLK_SEL_G : bit_vector := "001";
43  CPLL_FBDIV_G : natural := 5;
44  CPLL_FBDIV_45_G : natural := 5;
45  CPLL_REFCLK_DIV_G : natural := 1;
46  -- MGT Configurations (Defaults: gtClkP = 125 MHz Configuration)
47  RXOUT_DIV_G : natural := 2;
48  TXOUT_DIV_G : natural := 2;
49  RX_CLK25_DIV_G : natural := 5;
50  TX_CLK25_DIV_G : natural := 5;
51  RX_OS_CFG_G : bit_vector := "0000010000000";
52  RXCDR_CFG_G : bit_vector := x"03000023ff40200020";
53  RXDFEXYDEN_G : sl := '1';
54  RX_DFE_KL_CFG2_G : bit_vector := x"301148AC";
55  -- PGP Settings
56  VC_INTERLEAVE_G : integer := 0; -- No interleave Frames
57  PAYLOAD_CNT_TOP_G : integer := 7; -- Top bit for payload counter
58  NUM_VC_EN_G : integer range 1 to 4 := 4;
60  TX_ENABLE_G : boolean := true; -- Enable TX direction
61  RX_ENABLE_G : boolean := true); -- Enable RX direction
62  port (
63  -- Manual Reset
64  extRst : in sl;
65  -- Clocks and Reset
66  pgpClk : out sl;
67  pgpRst : out sl;
68  stableClk : out sl;
69  -- Non VC TX Signals
72  -- Non VC RX Signals
75  -- Frame TX Interface
77  pgpTxSlaves : out AxiStreamSlaveArray(3 downto 0);
78  -- Frame RX Interface
80  pgpRxCtrl : in AxiStreamCtrlArray(3 downto 0);
81  -- GT Pins
82  gtClkP : in sl;
83  gtClkN : in sl;
84  gtTxP : out sl;
85  gtTxN : out sl;
86  gtRxP : in sl;
87  gtRxN : in sl;
88  -- Debug Interface
89  txPreCursor : in slv(4 downto 0) := (others => '0');
90  txPostCursor : in slv(4 downto 0) := (others => '0');
91  txDiffCtrl : in slv(3 downto 0) := "1000";
92  -- AXI-Lite Interface
93  axilClk : in sl := '0';
94  axilRst : in sl := '0';
99 end Pgp2bGtx7VarLatWrapper;
100 
101 architecture mapping of Pgp2bGtx7VarLatWrapper is
102 
103  signal refClk : sl;
104  signal refClkDiv2 : sl;
105  signal stableClock : sl;
106  signal extRstSync : sl;
107 
108  signal pgpClock : sl;
109  signal pgpReset : sl;
110 
111 begin
112 
113  pgpClk <= pgpClock;
114  pgpRst <= pgpReset;
116 
117  IBUFDS_GTE2_Inst : IBUFDS_GTE2
118  port map (
119  I => gtClkP,
120  IB => gtClkN,
121  CEB => '0',
122  ODIV2 => refClkDiv2,
123  O => refClk);
124 
125  BUFG_Inst : BUFG
126  port map (
127  I => refClkDiv2,
128  O => stableClock);
129 
130  RstSync_Inst : entity work.RstSync
131  generic map(
132  TPD_G => TPD_G)
133  port map (
134  clk => stableClock,
135  asyncRst => extRst,
136  syncRst => extRstSync);
137 
138  ClockManager7_Inst : entity work.ClockManager7
139  generic map(
140  TPD_G => TPD_G,
141  TYPE_G => "MMCM",
142  INPUT_BUFG_G => false,
143  FB_BUFG_G => false,
144  RST_IN_POLARITY_G => '1',
145  NUM_CLOCKS_G => 1,
146  -- MMCM attributes
147  BANDWIDTH_G => "OPTIMIZED",
152  port map(
153  clkIn => stableClock,
154  rstIn => extRstSync,
155  clkOut(0) => pgpClock,
156  rstOut(0) => pgpReset);
157 
158  Pgp2bGtx7VarLat_Inst : entity work.Pgp2bGtx7VarLat
159  generic map (
160  TPD_G => TPD_G,
161  -- CPLL Configurations
162  TX_PLL_G => "CPLL",
163  RX_PLL_G => "CPLL",
168  -- MGT Configurations
177  -- VC Configuration
184  port map (
185  -- GT Clocking
187  gtCPllRefClk => refClk,
188  gtCPllLock => open,
189  gtQPllRefClk => '0',
190  gtQPllClk => '0',
191  gtQPllLock => '1',
192  gtQPllRefClkLost => '0',
193  gtQPllReset => open,
194  -- GT Serial IO
195  gtTxP => gtTxP,
196  gtTxN => gtTxN,
197  gtRxP => gtRxP,
198  gtRxN => gtRxN,
199  -- Tx Clocking
200  pgpTxReset => pgpReset,
201  pgpTxRecClk => open,
202  pgpTxClk => pgpClock,
203  pgpTxMmcmReset => open,
204  pgpTxMmcmLocked => '1',
205  -- Rx clocking
206  pgpRxReset => pgpReset,
207  pgpRxRecClk => open,
208  pgpRxClk => pgpClock,
209  pgpRxMmcmReset => open,
210  pgpRxMmcmLocked => '1',
211  -- Non VC TX Signals
212  pgpTxIn => pgpTxIn,
213  pgpTxOut => pgpTxOut,
214  -- Non VC RX Signals
215  pgpRxIn => pgpRxIn,
216  pgpRxOut => pgpRxOut,
217  -- Frame TX Interface
220  -- Frame RX Interface
222  pgpRxCtrl => pgpRxCtrl,
223  -- Debug Interface
227  -- AXI-Lite Interface
228  axilClk => axilClk,
229  axilRst => axilRst,
234 
235 end mapping;
array(natural range <> ) of AxiStreamSlaveType AxiStreamSlaveArray
in txDiffCtrlslv( 3 downto 0) := "1000"
TX_ENABLE_Gboolean := true
TX_CLK25_DIV_Ginteger := 7
out syncRstsl
Definition: RstSync.vhd:36
out pgpTxOutPgp2bTxOutType
in gtQPllRefClkLostsl := '0'
out axilReadSlaveAxiLiteReadSlaveType
TPD_Gtime := 1 ns
RX_DFE_KL_CFG2_Gbit_vector := x"301148AC"
_library_ ieeeieee
AxiLiteWriteMasterType
Definition: AxiLitePkg.vhd:111
std_logic sl
Definition: StdRtlPkg.vhd:28
in pgpRxMmcmLockedsl := '1'
NUM_VC_EN_Ginteger range 1 to 4:= 4
in pgpTxInPgp2bTxInType
in pgpTxMmcmLockedsl := '1'
in txPreCursorslv( 4 downto 0) :=( others => '0')
in axilRstsl := '0'
NUM_VC_EN_Ginteger range 1 to 4:= 4
in txPostCursorslv( 4 downto 0) :=( others => '0')
in txPostCursorslv( 4 downto 0) :=( others => '0')
out axilWriteSlaveAxiLiteWriteSlaveType
CPLL_REFCLK_SEL_Gbit_vector := "001"
in pgpTxMastersAxiStreamMasterArray( 3 downto 0) :=( others => AXI_STREAM_MASTER_INIT_C)
RXOUT_DIV_Ginteger := 2
out pgpRxMastersAxiStreamMasterArray( 3 downto 0)
in axilReadMasterAxiLiteReadMasterType := AXI_LITE_READ_MASTER_INIT_C
CPLL_REFCLK_DIV_Ginteger := 1
CLKIN_PERIOD_Greal := 10.0
RX_ENABLE_Gboolean := true
DIVCLK_DIVIDE_Gnatural range 1 to 106:= 2
RST_IN_POLARITY_Gsl := '1'
CLKFBOUT_MULT_F_Greal range 1.0 to 64.0:= 31.875
in axilClksl := '0'
in rstInsl := '0'
CPLL_FBDIV_Ginteger := 4
in asyncRstsl
Definition: RstSync.vhd:35
TPD_Gtime := 1 ns
INPUT_BUFG_Gboolean := true
in clksl
Definition: RstSync.vhd:34
in gtCPllRefClksl := '0'
in axilReadMasterAxiLiteReadMasterType := AXI_LITE_READ_MASTER_INIT_C
CPLL_FBDIV_45_Ginteger := 5
Pgp2bRxInType
Definition: Pgp2bPkg.vhd:55
slv( 1 downto 0) := "11" AXI_RESP_DECERR_C
Definition: AxiLitePkg.vhd:49
out axilWriteSlaveAxiLiteWriteSlaveType
out pgpTxSlavesAxiStreamSlaveArray( 3 downto 0)
FB_BUFG_Gboolean := true
out pgpRxMastersAxiStreamMasterArray( 3 downto 0)
BANDWIDTH_Gstring := "OPTIMIZED"
in gtQPllClksl := '0'
AxiLiteReadMasterType
Definition: AxiLitePkg.vhd:59
TX_PLL_Gstring := "QPLL"
CLKFBOUT_MULT_F_Greal range 1.0 to 64.0:= 1.0
out axilReadSlaveAxiLiteReadSlaveType
DIVCLK_DIVIDE_Ginteger range 1 to 106:= 1
TXOUT_DIV_Ginteger := 2
in gtQPllRefClksl := '0'
in axilWriteMasterAxiLiteWriteMasterType := AXI_LITE_WRITE_MASTER_INIT_C
TPD_Gtime := 1 ns
Definition: RstSync.vhd:27
in pgpRxCtrlAxiStreamCtrlArray( 3 downto 0)
array(natural range <> ) of AxiStreamCtrlType AxiStreamCtrlArray
array(natural range <> ) of AxiStreamMasterType AxiStreamMasterArray
in gtQPllLocksl := '1'
RX_DFE_KL_CFG2_Gbit_vector := x"3010D90C"
AXI_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_DECERR_C
in pgpTxMastersAxiStreamMasterArray( 3 downto 0)
AxiLiteReadMasterType :=(araddr =>( others => '0'),arprot =>( others => '0'),arvalid => '0',rready => '1') AXI_LITE_READ_MASTER_INIT_C
Definition: AxiLitePkg.vhd:69
RX_OS_CFG_Gbit_vector := "0000010000000"
RX_PLL_Gstring := "CPLL"
in pgpRxInPgp2bRxInType
AxiLiteReadSlaveType
Definition: AxiLitePkg.vhd:85
CLKOUT0_DIVIDE_F_Greal range 1.0 to 128.0:= 1.0
in axilWriteMasterAxiLiteWriteMasterType := AXI_LITE_WRITE_MASTER_INIT_C
in txPreCursorslv( 4 downto 0) :=( others => '0')
RXCDR_CFG_Gbit_vector := x"03000023ff40200020"
PAYLOAD_CNT_TOP_Ginteger := 7
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
Definition: AxiLitePkg.vhd:125
RX_CLK25_DIV_Ginteger := 7
AXI_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_DECERR_C
in txDiffCtrlslv( 3 downto 0) := "1000"
CPLL_REFCLK_SEL_Gbit_vector := "001"
VC_INTERLEAVE_Ginteger := 0
Pgp2bTxOutType
Definition: Pgp2bPkg.vhd:135
CLKOUT0_DIVIDE_F_Greal range 1.0 to 128.0:= 6.375
out pgpTxSlavesAxiStreamSlaveArray( 3 downto 0)
in pgpRxCtrlAxiStreamCtrlArray( 3 downto 0)
TYPE_Gstring := "MMCM"
RXCDR_CFG_Gbit_vector := x"03000023ff40200020"
Pgp2bRxOutType
Definition: Pgp2bPkg.vhd:69
RX_OS_CFG_Gbit_vector := "0000010000000"
std_logic_vector slv
Definition: StdRtlPkg.vhd:29
NUM_CLOCKS_Ginteger range 1 to 7
out pgpRxOutPgp2bRxOutType