SURF  1.0
TenGigEthGtx7.vhd
Go to the documentation of this file.
1 -------------------------------------------------------------------------------
2 -- File : TenGigEthGtx7.vhd
3 -- Company : SLAC National Accelerator Laboratory
4 -- Created : 2015-02-12
5 -- Last update: 2016-09-29
6 -------------------------------------------------------------------------------
7 -- Description: 10GBASE-R Ethernet for Gtx7
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 -------------------------------------------------------------------------------
17 
18 library ieee;
19 use ieee.std_logic_1164.all;
20 
21 use work.StdRtlPkg.all;
22 use work.AxiStreamPkg.all;
23 use work.AxiLitePkg.all;
24 use work.TenGigEthPkg.all;
25 use work.EthMacPkg.all;
26 
27 --! @see entity
28  --! @ingroup ethernet_TenGigEthCore_gtx7
29 entity TenGigEthGtx7 is
30  generic (
31  TPD_G : time := 1 ns;
32  -- AXI-Lite Configurations
33  EN_AXI_REG_G : boolean := false;
35  -- AXI Streaming Configurations
37  port (
38  -- Local Configurations
39  localMac : in slv(47 downto 0) := MAC_ADDR_INIT_C;
40  -- Streaming DMA Interface
41  dmaClk : in sl;
42  dmaRst : in sl;
47  -- Slave AXI-Lite Interface
48  axiLiteClk : in sl := '0';
49  axiLiteRst : in sl := '0';
54  -- SFP+ Ports
55  sigDet : in sl := '1';
56  txFault : in sl := '0';
57  txDisable : out sl;
58  -- Misc. Signals
59  extRst : in sl;
60  phyClk : in sl;
61  phyRst : in sl;
62  phyReady : out sl;
63  -- Quad PLL Ports
64  qplllock : in sl;
65  qplloutclk : in sl;
67  qpllRst : out sl;
68  -- MGT Ports
69  gtTxP : out sl;
70  gtTxN : out sl;
71  gtRxP : in sl;
72  gtRxN : in sl);
73 end TenGigEthGtx7;
74 
75 architecture mapping of TenGigEthGtx7 is
76 
77  component TenGigEthGtx7Core
78  port (
79  rxrecclk_out : out std_logic;
80  coreclk : in std_logic;
81  dclk : in std_logic;
82  txusrclk : in std_logic;
83  txusrclk2 : in std_logic;
84  areset : in std_logic;
85  txoutclk : out std_logic;
86  areset_coreclk : in std_logic;
87  gttxreset : in std_logic;
88  gtrxreset : in std_logic;
89  txuserrdy : in std_logic;
90  qplllock : in std_logic;
91  qplloutclk : in std_logic;
92  qplloutrefclk : in std_logic;
93  reset_counter_done : in std_logic;
94  txp : out std_logic;
95  txn : out std_logic;
96  rxp : in std_logic;
97  rxn : in std_logic;
98  sim_speedup_control : in std_logic;
99  xgmii_txd : in std_logic_vector(63 downto 0);
100  xgmii_txc : in std_logic_vector(7 downto 0);
101  xgmii_rxd : out std_logic_vector(63 downto 0);
102  xgmii_rxc : out std_logic_vector(7 downto 0);
103  configuration_vector : in std_logic_vector(535 downto 0);
104  status_vector : out std_logic_vector(447 downto 0);
105  core_status : out std_logic_vector(7 downto 0);
106  tx_resetdone : out std_logic;
107  rx_resetdone : out std_logic;
108  signal_detect : in std_logic;
109  tx_fault : in std_logic;
110  drp_req : out std_logic;
111  drp_gnt : in std_logic;
112  drp_den_o : out std_logic;
113  drp_dwe_o : out std_logic;
114  drp_daddr_o : out std_logic_vector(15 downto 0);
115  drp_di_o : out std_logic_vector(15 downto 0);
116  drp_drdy_o : out std_logic;
117  drp_drpdo_o : out std_logic_vector(15 downto 0);
118  drp_den_i : in std_logic;
119  drp_dwe_i : in std_logic;
120  drp_daddr_i : in std_logic_vector(15 downto 0);
121  drp_di_i : in std_logic_vector(15 downto 0);
122  drp_drdy_i : in std_logic;
123  drp_drpdo_i : in std_logic_vector(15 downto 0);
124  tx_disable : out std_logic;
125  pma_pmd_type : in std_logic_vector(2 downto 0));
126  end component;
127 
132 
133  signal phyRxd : slv(63 downto 0);
134  signal phyRxc : slv(7 downto 0);
135  signal phyTxd : slv(63 downto 0);
136  signal phyTxc : slv(7 downto 0);
137 
138  signal areset : sl;
139  signal txClk322 : sl;
140  signal txUsrClk : sl;
141  signal txUsrClk2 : sl;
142  signal txUsrRdy : sl;
143 
144  signal drpReqGnt : sl;
145  signal drpEn : sl;
146  signal drpWe : sl;
147  signal drpAddr : slv(15 downto 0);
148  signal drpDi : slv(15 downto 0);
149  signal drpRdy : sl;
150  signal drpDo : slv(15 downto 0);
151 
152  signal configurationVector : slv(535 downto 0) := (others => '0');
153 
156 
161 
162 begin
163 
165  areset <= extRst or config.softRst;
167 
168  ------------------
169  -- Synchronization
170  ------------------
171  U_AxiLiteAsync : entity work.AxiLiteAsync
172  generic map (
173  TPD_G => TPD_G)
174  port map (
175  -- Slave Port
176  sAxiClk => axiLiteClk,
182  -- Master Port
183  mAxiClk => phyClk,
184  mAxiClkRst => phyRst,
189 
191 
192  U_Sync : entity work.SynchronizerVector
193  generic map (
194  TPD_G => TPD_G,
195  WIDTH_G => 3)
196  port map (
197  clk => phyClk,
198  -- Input
199  dataIn(0) => sigDet,
200  dataIn(1) => txFault,
201  dataIn(2) => txUsrRdy,
202  -- Output
203  dataOut(0) => status.sigDet,
204  dataOut(1) => status.txFault,
205  dataOut(2) => status.txUsrRdy);
206 
207  --------------------
208  -- Ethernet MAC core
209  --------------------
210  U_MAC : entity work.EthMacTop
211  generic map (
212  TPD_G => TPD_G,
213  PHY_TYPE_G => "XGMII",
215  port map (
216  -- Primary Interface
217  primClk => dmaClk,
218  primRst => dmaRst,
223  -- Ethernet Interface
224  ethClk => phyClk,
225  ethRst => phyRst,
226  ethConfig => config.macConfig,
227  ethStatus => status.macStatus,
228  phyReady => status.phyReady,
229  -- XGMII PHY Interface
230  xgmiiRxd => phyRxd,
231  xgmiiRxc => phyRxc,
232  xgmiiTxd => phyTxd,
233  xgmiiTxc => phyTxc);
234 
235  -----------------
236  -- 10GBASE-R core
237  -----------------
238  U_TenGigEthGtx7Core : TenGigEthGtx7Core
239  port map (
240  -- Clocks and Resets
241  rxrecclk_out => open,
242  coreclk => phyClk,
243  txoutclk => txClk322,
244  areset_coreclk => phyRst,
245  dclk => phyClk,
246  txusrclk => txUsrClk,
247  txusrclk2 => txUsrClk2,
248  areset => areset,
249  gttxreset => status.gtTxRst,
250  gtrxreset => status.gtRxRst,
251  txuserrdy => txUsrRdy,
252  reset_counter_done => status.rstCntDone,
253  -- Quad PLL Interface
254  qplllock => status.qplllock,
255  qplloutclk => qplloutclk,
256  qplloutrefclk => qplloutrefclk,
257  -- MGT Ports
258  txp => gtTxP,
259  txn => gtTxN,
260  rxp => gtRxP,
261  rxn => gtRxN,
262  -- PHY Interface
263  xgmii_txd => phyTxd,
264  xgmii_txc => phyTxc,
265  xgmii_rxd => phyRxd,
266  xgmii_rxc => phyRxc,
267  -- Configuration and Status
268  sim_speedup_control => '0',
269  configuration_vector => configurationVector,
270  status_vector => open,
271  core_status => status.core_status,
272  tx_resetdone => status.txRstdone,
273  rx_resetdone => status.rxRstdone,
274  signal_detect => status.sigDet,
275  tx_fault => status.txFault,
276  tx_disable => status.txDisable,
277  pma_pmd_type => config.pma_pmd_type,
278  -- DRP interface
279  -- Note: If no arbitration is required on the GT DRP ports
280  -- then connect REQ to GNT and connect other signals i <= o;
281  drp_req => drpReqGnt,
282  drp_gnt => drpReqGnt,
283  drp_den_o => drpEn,
284  drp_dwe_o => drpWe,
285  drp_daddr_o => drpAddr,
286  drp_di_o => drpDi,
287  drp_drdy_o => drpRdy,
288  drp_drpdo_o => drpDo,
289  drp_den_i => drpEn,
290  drp_dwe_i => drpWe,
291  drp_daddr_i => drpAddr,
292  drp_di_i => drpDi,
293  drp_drdy_i => drpRdy,
294  drp_drpdo_i => drpDo);
295 
296  -------------------------------------
297  -- 10GBASE-R's Reset Module
298  -------------------------------------
299  U_TenGigEthRst : entity work.TenGigEthRst
300  generic map (
301  TPD_G => TPD_G)
302  port map (
303  -- Clocks and Resets
304  extRst => extRst,
305  phyClk => phyClk,
306  phyRst => phyRst,
307  txClk322 => txClk322,
308  txUsrClk => txUsrClk,
309  txUsrClk2 => txUsrClk2,
310  gtTxRst => status.gtTxRst,
311  gtRxRst => status.gtRxRst,
312  txUsrRdy => txUsrRdy,
313  rstCntDone => status.rstCntDone,
314  -- Quad PLL Ports
315  qplllock => status.qplllock,
316  qpllRst => qpllRst);
317 
318  -------------------------------
319  -- Configuration Vector Mapping
320  -------------------------------
321  configurationVector(0) <= config.pma_loopback;
322  configurationVector(15) <= config.pma_reset;
323  configurationVector(110) <= config.pcs_loopback;
324  configurationVector(111) <= config.pcs_reset;
325  configurationVector(399 downto 384) <= x"4C4B"; -- timer_ctrl = 0x4C4B (default)
326 
327  ----------------------
328  -- Core Status Mapping
329  ----------------------
331 
332  --------------------------------
333  -- Configuration/Status Register
334  --------------------------------
335  U_TenGigEthReg : entity work.TenGigEthReg
336  generic map (
337  TPD_G => TPD_G,
340  port map (
341  -- Local Configurations
342  localMac => localMac,
343  -- Clocks and resets
344  clk => phyClk,
345  rst => phyRst,
346  -- AXI-Lite Register Interface
351  -- Configuration and Status Interface
352  config => config,
353  status => status);
354 
355 end mapping;
AxiLiteWriteMasterType mAxiWriteMaster
in axiReadMasterAxiLiteReadMasterType
EN_AXI_REG_Gboolean := false
out axiLiteReadSlaveAxiLiteReadSlaveType
slv( 63 downto 0) phyTxd
in primClksl
Definition: EthMacTop.vhd:65
in axiLiteRstsl := '0'
out xgmiiTxdslv( 63 downto 0)
Definition: EthMacTop.vhd:93
out rstCntDonesl
AxiLiteWriteMasterType
Definition: AxiLitePkg.vhd:111
std_logic sl
Definition: StdRtlPkg.vhd:28
out txUsrClksl
out dmaIbMasterAxiStreamMasterType
in xgmiiRxcslv( 7 downto 0) :=( others => '0')
Definition: EthMacTop.vhd:92
out mAxiReadMasterAxiLiteReadMasterType
slv( 15 downto 0) drpAddr
in ibMacPrimMasterAxiStreamMasterType
Definition: EthMacTop.vhd:67
out axiReadSlaveAxiLiteReadSlaveType
slv( 7 downto 0) core_status
EN_AXI_REG_Gboolean := false
out xgmiiTxcslv( 7 downto 0)
Definition: EthMacTop.vhd:94
AxiLiteReadMasterType mAxiReadMaster
in mAxiWriteSlaveAxiLiteWriteSlaveType
out gtRxRstsl
out txUsrRdysl
AxiStreamMasterType macRxAxisMaster
in obMacPrimSlaveAxiStreamSlaveType
Definition: EthMacTop.vhd:70
in statusTenGigEthStatus
out sAxiWriteSlaveAxiLiteWriteSlaveType
in dmaIbSlaveAxiStreamSlaveType
AxiLiteWriteSlaveType mAxiWriteSlave
in axiLiteWriteMasterAxiLiteWriteMasterType := AXI_LITE_WRITE_MASTER_INIT_C
TPD_Gtime := 1 ns
in sAxiReadMasterAxiLiteReadMasterType
slv( 1 downto 0) := "10" AXI_RESP_SLVERR_C
Definition: AxiLitePkg.vhd:36
in sAxiWriteMasterAxiLiteWriteMasterType
out gtTxRstsl
in primRstsl
Definition: EthMacTop.vhd:66
out obMacPrimMasterAxiStreamMasterType
Definition: EthMacTop.vhd:69
in ethRstsl
Definition: EthMacTop.vhd:63
slv( 535 downto 0) :=( others => '0') configurationVector
in xgmiiRxdslv( 63 downto 0) :=( others => '0')
Definition: EthMacTop.vhd:91
AxiLiteReadMasterType
Definition: AxiLitePkg.vhd:59
out axiWriteSlaveAxiLiteWriteSlaveType
TPD_Gtime := 1 ns
out qpllRstsl
out ibMacPrimSlaveAxiStreamSlaveType
Definition: EthMacTop.vhd:68
in ethClksl
Definition: EthMacTop.vhd:62
in sigDetsl := '1'
TenGigEthStatus status
in dmaObMasterAxiStreamMasterType
in axiLiteClksl := '0'
out sAxiReadSlaveAxiLiteReadSlaveType
AXI_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_SLVERR_C
PRIM_CONFIG_GAxiStreamConfigType := EMAC_AXIS_CONFIG_C
Definition: EthMacTop.vhd:49
AXIS_CONFIG_GAxiStreamConfigType := AXI_STREAM_CONFIG_INIT_C
AxiStreamCtrlType macRxAxisCtrl
in axiWriteMasterAxiLiteWriteMasterType
slv( 7 downto 0) phyTxc
PHY_TYPE_Gstring := "XGMII"
Definition: EthMacTop.vhd:36
TenGigEthConfig config
AxiLiteReadMasterType :=(araddr =>( others => '0'),arprot =>( others => '0'),arvalid => '0',rready => '1') AXI_LITE_READ_MASTER_INIT_C
Definition: AxiLitePkg.vhd:69
AxiStreamConfigType :=(TSTRB_EN_C => false,TDATA_BYTES_C => 16,TDEST_BITS_C => 4,TID_BITS_C => 0,TKEEP_MODE_C => TKEEP_NORMAL_C,TUSER_BITS_C => 4,TUSER_MODE_C => TUSER_NORMAL_C) AXI_STREAM_CONFIG_INIT_C
in txFaultsl := '0'
slv( 15 downto 0) drpDi
out configTenGigEthConfig
AxiLiteReadSlaveType
Definition: AxiLitePkg.vhd:85
in localMacslv( 47 downto 0) := MAC_ADDR_INIT_C
out axiLiteWriteSlaveAxiLiteWriteSlaveType
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
AXI_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_SLVERR_C
in mAxiReadSlaveAxiLiteReadSlaveType
in mAxiClkRstsl
out dmaObSlaveAxiStreamSlaveType
AxiLiteReadSlaveType mAxiReadSlave
in localMacslv( 47 downto 0) := MAC_ADDR_INIT_C
TPD_Gtime := 1 ns
Definition: EthMacTop.vhd:32
slv( 63 downto 0) phyRxd
TPD_Gtime := 1 ns
in ethConfigEthMacConfigType
Definition: EthMacTop.vhd:104
slv( 15 downto 0) drpDo
out ethStatusEthMacStatusType
Definition: EthMacTop.vhd:105
out txUsrClk2sl
AxiStreamMasterType macTxAxisMaster
in axiLiteReadMasterAxiLiteReadMasterType := AXI_LITE_READ_MASTER_INIT_C
slv( 7 downto 0) phyRxc
TPD_Gtime := 1 ns
out mAxiWriteMasterAxiLiteWriteMasterType
in sAxiClkRstsl
std_logic_vector slv
Definition: StdRtlPkg.vhd:29
AxiStreamSlaveType macTxAxisSlave
in phyReadysl
Definition: EthMacTop.vhd:103