SURF  1.0
Pgp2bAxi.vhd
Go to the documentation of this file.
1 -------------------------------------------------------------------------------
2 -- File : Pgp2bAxi.vhd
3 -- Company : SLAC National Accelerator Laboratory
4 -- Created : 2009-05-27
5 -- Last update: 2017-03-28
6 -------------------------------------------------------------------------------
7 -- Description:
8 -- AXI-Lite block to manage the PGP interface.
9 --
10 -- Address map (offset from base):
11 -- 0x00 = Read/Write
12 -- Bits 0 = Count Reset
13 -- 0x04 = Read/Write
14 -- Bits 0 = Reset Rx
15 -- 0x08 = Read/Write
16 -- Bits 0 = Flush
17 -- 0x0C = Read/Write
18 -- Bits 1:0 = Loop Back
19 -- 0x10 = Read/Write
20 -- Bits 7:0 = Sideband data to transmit
21 -- Bits 8 = Sideband data enable
22 -- 0x14 = Read/Write
23 -- Bits 0 = Auto Status Send Enable (PPI)
24 -- 0x18 = Read/Write
25 -- Bits 0 = Disable Flow Control
26 -- 0x20 = Read Only
27 -- Bits 0 = Rx Phy Ready
28 -- Bits 1 = Tx Phy Ready
29 -- Bits 2 = Local Link Ready
30 -- Bits 3 = Remote Link Ready
31 -- Bits 4 = Transmit Ready
32 -- Bits 9:8 = Receive Link Polarity
33 -- Bits 15:12 = Remote Pause Status
34 -- Bits 19:16 = Local Pause Status
35 -- Bits 23:20 = Remote Overflow Status
36 -- Bits 27:24 = Local Overflow Status
37 -- 0x24 = Read Only
38 -- Bits 7:0 = Remote Link Data
39 -- 0x28 = Read Only
40 -- Bits ?:0 = Cell Error Count
41 -- 0x2C = Read Only
42 -- Bits ?:0 = Link Down Count
43 -- 0x30 = Read Only
44 -- Bits ?:0 = Link Error Count
45 -- 0x34 = Read Only
46 -- Bits ?:0 = Remote Overflow VC 0 Count
47 -- 0x38 = Read Only
48 -- Bits ?:0 = Remote Overflow VC 1 Count
49 -- 0x3C = Read Only
50 -- Bits ?:0 = Remote Overflow VC 2 Count
51 -- 0x40 = Read Only
52 -- Bits ?:0 = Remote Overflow VC 3 Count
53 -- 0x44 = Read Only
54 -- Bits ?:0 = Receive Frame Error Count
55 -- 0x48 = Read Only
56 -- Bits ?:0 = Receive Frame Count
57 -- 0x4C = Read Only
58 -- Bits ?:0 = Local Overflow VC 0 Count
59 -- 0x50 = Read Only
60 -- Bits ?:0 = Local Overflow VC 1 Count
61 -- 0x54 = Read Only
62 -- Bits ?:0 = Local Overflow VC 2 Count
63 -- 0x58 = Read Only
64 -- Bits ?:0 = Local Overflow VC 3 Count
65 -- 0x5C = Read Only
66 -- Bits ?:0 = Transmit Frame Error Count
67 -- 0x60 = Read Only
68 -- Bits ?:0 = Transmit Frame Count
69 -- 0x64 = Read Only
70 -- Bits 31:0 = Receive Clock Frequency
71 -- 0x68 = Read Only
72 -- Bits 31:0 = Transmit Clock Frequency
73 -- 0x70 = Read Only
74 -- Bits 7:0 = Last OpCode Transmitted
75 -- 0x74 = Read Only
76 -- Bits 7:0 = Last OpCode Received
77 -- 0x78 = Read Only
78 -- Bits ?:0 = OpCode Transmit count
79 -- 0x7C = Read Only
80 -- Bits ?:0 = OpCode Received count
81 --
82 -- Status vector:
83 -- Bits 31:24 = Rx Link Down Count
84 -- Bits 23:16 = Rx Frame Error Count
85 -- Bits 15:8 = Rx Cell Error Count
86 -- Bits 7:6 = Zeros
87 -- Bits 5 = Remote Link Ready
88 -- Bits 4 = Local Link Ready
89 -- Bits 3:0 = Remote Overflow Status
90 -------------------------------------------------------------------------------
91 -- This file is part of 'SLAC Firmware Standard Library'.
92 -- It is subject to the license terms in the LICENSE.txt file found in the
93 -- top-level directory of this distribution and at:
94 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
95 -- No part of 'SLAC Firmware Standard Library', including this file,
96 -- may be copied, modified, propagated, or distributed except according to
97 -- the terms contained in the LICENSE.txt file.
98 -------------------------------------------------------------------------------
99 
100 library ieee;
101 use ieee.std_logic_1164.all;
102 use IEEE.STD_LOGIC_ARITH.ALL;
103 use IEEE.STD_LOGIC_UNSIGNED.ALL;
104 
105 use work.StdRtlPkg.all;
106 use work.AxiLitePkg.all;
107 use work.Pgp2bPkg.all;
108 
109 --! @see entity
110  --! @ingroup protocols_pgp_pgp2b_core
111 entity Pgp2bAxi is
112  generic (
113  TPD_G : time := 1 ns;
114  COMMON_TX_CLK_G : boolean := false; -- Set to true if axiClk and pgpTxClk are the same clock
115  COMMON_RX_CLK_G : boolean := false; -- Set to true if axiClk and pgpRxClk are the same clock
116  WRITE_EN_G : boolean := false; -- Set to false when on remote end of a link
117  AXI_CLK_FREQ_G : real := 125.0E+6;
118  STATUS_CNT_WIDTH_G : natural range 1 to 32 := 32;
119  ERROR_CNT_WIDTH_G : natural range 1 to 32 := 4;
121  port (
122 
123  -- TX PGP Interface (pgpTxClk)
124  pgpTxClk : in sl;
128  locTxIn : in Pgp2bTxInType := PGP2B_TX_IN_INIT_C;
129 
130  -- RX PGP Interface (pgpRxClk)
131  pgpRxClk : in sl;
135  locRxIn : in Pgp2bRxInType := PGP2B_RX_IN_INIT_C;
136 
137  -- Status Bus (axilClk domain)
138  statusWord : out slv(63 downto 0);
139  statusSend : out sl;
140 
141  -- AXI-Lite Register Interface (axilClk domain)
142  axilClk : in sl;
143  axilRst : in sl;
148  );
149 end Pgp2bAxi;
150 
151 architecture structure of Pgp2bAxi is
152 
153  constant STATUS_OUT_TOP_C : integer := ite(STATUS_CNT_WIDTH_G > 7, 7,STATUS_CNT_WIDTH_G-1);
154 
155  -- Local signals
156  signal rxStatusSend : sl;
157 
158  signal rxErrorOut : slv(17 downto 0);
159  signal rxErrorCntOut : SlVectorArray(17 downto 0, ERROR_CNT_WIDTH_G-1 downto 0);
160  signal rxStatusCntOut : SlVectorArray(0 downto 0, STATUS_CNT_WIDTH_G-1 downto 0);
161 
162  signal txErrorOut : slv(11 downto 0);
163  signal txErrorCntOut : SlVectorArray(11 downto 0, ERROR_CNT_WIDTH_G-1 downto 0);
164  signal txStatusCntOut : SlVectorArray(0 downto 0, STATUS_CNT_WIDTH_G-1 downto 0);
165 
166  signal rxErrorIrqEn : slv(17 downto 0);
167  signal locTxDataEn : sl;
168  signal locTxData : slv(7 downto 0);
169  signal txFlush : sl;
170  signal rxFlush : sl;
171  signal rxReset : sl;
172  signal syncFlowCntlDis : sl;
173 
174  type RegType is record
178  loopBack : slv(2 downto 0);
181  locData : slv(7 downto 0);
182  locDataEn : sl;
185  end record RegType;
186 
187  constant REG_INIT_C : RegType := (
188  flush => '0',
189  resetRx => '0',
190  countReset => '0',
191  loopBack => (others=>'0'),
192  flowCntlDis => '0',
193  autoStatus => '0',
194  locData => (others=>'0'),
195  locDataEn => '0',
198  );
199 
200  signal r : RegType := REG_INIT_C;
201  signal rin : RegType;
202 
203  type RxStatusType is record
205  linkPolarity : slv(1 downto 0);
206  locLinkReady : sl;
208  remLinkData : slv(7 downto 0);
212  remOverflow : slv(3 downto 0);
219  remPause : slv(3 downto 0);
220  rxClkFreq : slv(31 downto 0);
222  rxOpCodeLast : slv(7 downto 0);
223  end record RxStatusType;
224 
226 
227  type TxStatusType is record
230  locOverflow : slv(3 downto 0);
231  locOverflow0Cnt : slv(ERROR_CNT_WIDTH_G-1 downto 0);
232  locOverflow1Cnt : slv(ERROR_CNT_WIDTH_G-1 downto 0);
233  locOverflow2Cnt : slv(ERROR_CNT_WIDTH_G-1 downto 0);
234  locOverflow3Cnt : slv(ERROR_CNT_WIDTH_G-1 downto 0);
235  locPause : slv(3 downto 0);
236  frameErrCount : slv(ERROR_CNT_WIDTH_G-1 downto 0);
237  frameCount : slv(STATUS_CNT_WIDTH_G-1 downto 0);
238  txClkFreq : slv(31 downto 0);
240  txOpCodeLast : slv(7 downto 0);
241  end record TxStatusType;
242 
244 
245 begin
246 
247 
248  ---------------------------------------
249  -- Receive Status
250  ---------------------------------------
251 
252  -- OpCode Capture
253  U_RxOpCodeSync : entity work.SynchronizerFifo
254  generic map (
255  TPD_G => TPD_G,
256  BRAM_EN_G => false,
257  ALTERA_SYN_G => false,
258  ALTERA_RAM_G => "M9K",
259  SYNC_STAGES_G => 3,
260  DATA_WIDTH_G => 8,
261  ADDR_WIDTH_G => 2,
262  INIT_G => "0"
263  ) port map (
264  rst => r.countReset,
265  wr_clk => pgpRxClk,
266  wr_en => pgpRxOut.opCodeEn,
267  din => pgpRxOut.opCode,
268  rd_clk => axilClk,
269  rd_en => '1',
270  valid => open,
271  dout => rxStatusSync.rxOpCodeLast
272  );
273 
274  -- Sync remote data
275  U_RxDataSyncEn : if COMMON_RX_CLK_G = false generate
276  U_RxDataSync : entity work.SynchronizerFifo
277  generic map (
278  TPD_G => TPD_G,
279  BRAM_EN_G => false,
280  ALTERA_SYN_G => false,
281  ALTERA_RAM_G => "M9K",
282  SYNC_STAGES_G => 3,
283  DATA_WIDTH_G => 8,
284  ADDR_WIDTH_G => 2,
285  INIT_G => "0"
286  ) port map (
287  rst => axilRst,
288  wr_clk => pgpRxClk,
289  wr_en => '1',
290  din => pgpRxOut.remLinkData,
291  rd_clk => axilClk,
292  rd_en => '1',
293  valid => open,
294  dout => rxStatusSync.remLinkData
295  );
296  end generate;
297 
298  U_RxDataSyncDis : if COMMON_RX_CLK_G generate
299  rxStatusSync.remLinkData <= pgpRxOut.remLinkData;
300  end generate;
301 
302  -- Errror counters and non counted values
303  U_RxError : entity work.SyncStatusVector
304  generic map (
305  TPD_G => TPD_G,
306  RST_POLARITY_G => '1',
308  RELEASE_DELAY_G => 3,
309  IN_POLARITY_G => "1",
310  OUT_POLARITY_G => '1',
311  USE_DSP48_G => "no",
312  SYNTH_CNT_G => "111110000111100000",
313  CNT_RST_EDGE_G => false,
315  WIDTH_G => 18
316  ) port map (
317  statusIn(0) => pgpRxOut.phyRxReady,
318  statusIn(1) => pgpRxOut.linkReady,
319  statusIn(3 downto 2) => pgpRxOut.linkPolarity,
320  statusIn(4) => pgpRxOut.remLinkReady,
321  statusIn(8 downto 5) => pgpRxOut.remOverflow,
322  statusIn(12 downto 9) => pgpRxOut.remPause,
323  statusIn(13) => pgpRxOut.cellError,
324  statusIn(14) => pgpRxOut.linkDown,
325  statusIn(15) => pgpRxOut.linkError,
326  statusIn(16) => pgpRxOut.frameRxErr,
327  statusIn(17) => pgpRxOut.opCodeEn,
329  cntRstIn => r.countReset,
330  rollOverEnIn => (others=>'0'),
333  irqOut => rxStatusSend,
334  wrClk => pgpRxClk,
335  wrRst => pgpRxClkRst,
336  rdClk => axilClk,
337  rdRst => axilRst
338  );
339 
340  U_RxErrorIrqEn : process (r.autoStatus) begin
341  rxErrorIrqEn <= (others=>'0');
342  rxErrorIrqEn(1) <= r.autoStatus;
343  rxErrorIrqEn(4) <= r.autoStatus;
344  rxErrorIrqEn(5) <= r.autoStatus;
345  rxErrorIrqEn(6) <= r.autoStatus;
346  rxErrorIrqEn(7) <= r.autoStatus;
347  rxErrorIrqEn(8) <= r.autoStatus;
348  rxErrorIrqEn(13) <= r.autoStatus;
349  rxErrorIrqEn(14) <= r.autoStatus;
350  rxErrorIrqEn(16) <= r.autoStatus;
351  end process;
352 
353  -- map status
354  rxStatusSync.phyRxReady <= rxErrorOut(0);
355  rxStatusSync.locLinkReady <= rxErrorOut(1);
356  rxStatusSync.linkPolarity <= rxErrorOut(3 downto 2);
357  rxStatusSync.remLinkReady <= rxErrorOut(4);
358  rxStatusSync.remOverflow <= rxErrorOut(8 downto 5);
359  rxStatusSync.remPause <= rxErrorOut(12 downto 9);
360 
361  -- Map counters
362  rxStatusSync.remOverflow0Cnt <= muxSlVectorArray(rxErrorCntOut,5);
363  rxStatusSync.remOverflow1Cnt <= muxSlVectorArray(rxErrorCntOut,6);
364  rxStatusSync.remOverflow2Cnt <= muxSlVectorArray(rxErrorCntOut,7);
365  rxStatusSync.remOverflow3Cnt <= muxSlVectorArray(rxErrorCntOut,8);
366  rxStatusSync.cellErrorCount <= muxSlVectorArray(rxErrorCntOut,13);
367  rxStatusSync.linkDownCount <= muxSlVectorArray(rxErrorCntOut,14);
368  rxStatusSync.linkErrorCount <= muxSlVectorArray(rxErrorCntOut,15);
369  rxStatusSync.frameErrCount <= muxSlVectorArray(rxErrorCntOut,16);
370  rxStatusSync.rxOpCodeCount <= muxSlVectorArray(rxErrorCntOut,17);
371 
372  -- Status counters
373  U_RxStatus : entity work.SyncStatusVector
374  generic map (
375  TPD_G => TPD_G,
376  RST_POLARITY_G => '1',
378  RELEASE_DELAY_G => 3,
379  IN_POLARITY_G => "1",
380  OUT_POLARITY_G => '1',
381  USE_DSP48_G => "no",
382  SYNTH_CNT_G => "1",
383  CNT_RST_EDGE_G => false,
385  WIDTH_G => 1
386  ) port map (
387  statusIn(0) => pgpRxOut.frameRx,
388  statusOut => open,
389  cntRstIn => r.countReset,
390  rollOverEnIn => (others=>'1'),
392  irqEnIn => (others=>'0'),
393  irqOut => open,
394  wrClk => pgpRxClk,
395  wrRst => pgpRxClkRst,
396  rdClk => axilClk,
397  rdRst => axilRst
398  );
399 
400  rxStatusSync.frameCount <= muxSlVectorArray(rxStatusCntOut,0);
401 
402  U_RxClkFreq: entity work.SyncClockFreq
403  generic map (
404  TPD_G => TPD_G,
405  USE_DSP48_G => "no",
407  REFRESH_RATE_G => 100.0,
408  CLK_LOWER_LIMIT_G => 159.0E+6,
409  CLK_UPPER_LIMIT_G => 161.0E+6,
410  CNT_WIDTH_G => 32
411  ) port map (
412  freqOut => rxStatusSync.rxClkFreq,
413  freqUpdated => open,
414  locked => open,
415  tooFast => open,
416  tooSlow => open,
417  clkIn => pgpRxClk,
418  locClk => axilClk,
419  refClk => axilClk
420  );
421 
422 
423  ---------------------------------------
424  -- Transmit Status
425  ---------------------------------------
426 
427  -- OpCode Capture
428  U_TxOpCodeSync : entity work.SynchronizerFifo
429  generic map (
430  TPD_G => TPD_G,
431  BRAM_EN_G => false,
432  ALTERA_SYN_G => false,
433  ALTERA_RAM_G => "M9K",
434  SYNC_STAGES_G => 3,
435  DATA_WIDTH_G => 8,
436  ADDR_WIDTH_G => 2,
437  INIT_G => "0"
438  ) port map (
439  rst => r.countReset,
440  wr_clk => pgpTxClk,
441  wr_en => locTxIn.opCodeEn,
442  din => locTxIn.opCode,
443  rd_clk => axilClk,
444  rd_en => '1',
445  valid => open,
446  dout => txStatusSync.txOpCodeLast
447  );
448 
449  -- Errror counters and non counted values
450  U_TxError : entity work.SyncStatusVector
451  generic map (
452  TPD_G => TPD_G,
453  RST_POLARITY_G => '1',
455  RELEASE_DELAY_G => 3,
456  IN_POLARITY_G => "1",
457  OUT_POLARITY_G => '1',
458  USE_DSP48_G => "no",
459  SYNTH_CNT_G => "110000111100",
460  CNT_RST_EDGE_G => false,
462  WIDTH_G => 12
463  ) port map (
464  statusIn(0) => pgpTxOut.phyTxReady,
465  statusIn(1) => pgpTxOut.linkReady,
466  statusIn(5 downto 2) => pgpTxOut.locOverflow,
467  statusIn(9 downto 6) => pgpTxOut.locPause,
468  statusIn(10) => pgpTxOut.frameTxErr,
469  statusIn(11) => locTxIn.opCodeEn,
471  cntRstIn => r.countReset,
472  rollOverEnIn => (others=>'0'),
474  irqEnIn => (others=>'0'),
475  irqOut => open,
476  wrClk => pgpTxClk,
477  wrRst => pgpTxClkRst,
478  rdClk => axilClk,
479  rdRst => axilRst
480  );
481 
482  -- Map Status
483  txStatusSync.phyTxReady <= txErrorOut(0);
484  txStatusSync.txLinkReady <= txErrorOut(1);
485  txStatusSync.locOverFlow <= txErrorOut(5 downto 2);
486  txStatusSync.locPause <= txErrorOut(9 downto 6);
487 
488  -- Map counters
489  txStatusSync.locOverflow0Cnt <= muxSlVectorArray(txErrorCntOut,2);
490  txStatusSync.locOverflow1Cnt <= muxSlVectorArray(txErrorCntOut,3);
491  txStatusSync.locOverflow2Cnt <= muxSlVectorArray(txErrorCntOut,4);
492  txStatusSync.locOverflow3Cnt <= muxSlVectorArray(txErrorCntOut,5);
493  txStatusSync.frameErrCount <= muxSlVectorArray(txErrorCntOut,10);
494  txStatusSync.txOpCodeCount <= muxSlVectorArray(txErrorCntOut,11);
495 
496  -- Status counters
497  U_TxStatus : entity work.SyncStatusVector
498  generic map (
499  TPD_G => TPD_G,
500  RST_POLARITY_G => '1',
502  RELEASE_DELAY_G => 3,
503  IN_POLARITY_G => "1",
504  OUT_POLARITY_G => '1',
505  USE_DSP48_G => "no",
506  SYNTH_CNT_G => "1",
507  CNT_RST_EDGE_G => false,
509  WIDTH_G => 1
510  ) port map (
511  statusIn(0) => pgpTxOut.frameTx,
512  statusOut => open,
513  cntRstIn => r.countReset,
514  rollOverEnIn => (others=>'1'),
516  irqEnIn => (others=>'0'),
517  irqOut => open,
518  wrClk => pgpTxClk,
519  wrRst => pgpTxClkRst,
520  rdClk => axilClk,
521  rdRst => axilRst
522  );
523 
524  txStatusSync.frameCount <= muxSlVectorArray(txStatusCntOut,0);
525 
526  U_TxClkFreq: entity work.SyncClockFreq
527  generic map (
528  TPD_G => TPD_G,
529  USE_DSP48_G => "no",
531  REFRESH_RATE_G => 100.0,
532  CLK_LOWER_LIMIT_G => 159.0E+6,
533  CLK_UPPER_LIMIT_G => 161.0E+6,
534  CNT_WIDTH_G => 32
535  ) port map (
536  freqOut => txStatusSync.txClkFreq,
537  freqUpdated => open,
538  locked => open,
539  tooFast => open,
540  tooSlow => open,
541  clkIn => pgpTxClk,
542  locClk => axilClk,
543  refClk => axilClk
544  );
545 
546  -------------------------------------
547  -- Tx Control Sync
548  -------------------------------------
549 
550  -- Sync Tx Control
551  U_TxDataSyncEn : if COMMON_RX_CLK_G = false generate
552  U_TxDataSync : entity work.SynchronizerFifo
553  generic map (
554  TPD_G => TPD_G,
555  BRAM_EN_G => false,
556  ALTERA_SYN_G => false,
557  ALTERA_RAM_G => "M9K",
558  SYNC_STAGES_G => 3,
559  DATA_WIDTH_G => 9,
560  ADDR_WIDTH_G => 2,
561  INIT_G => "0"
562  ) port map (
563  rst => axilRst,
564  wr_clk => axilClk,
565  wr_en => '1',
566  din(8) => r.locDataEn,
567  din(7 downto 0) => r.locData,
568  rd_clk => pgpTxClk,
569  rd_en => '1',
570  valid => open,
571  dout(8) => locTxDataEn,
572  dout(7 downto 0) => locTxData
573  );
574  end generate;
575 
576  -- Sync flow cntl disable
577  U_FlowCntlDis: entity work.Synchronizer
578  generic map (
579  TPD_G => TPD_G,
580  RST_POLARITY_G => '1',
581  OUT_POLARITY_G => '1',
582  RST_ASYNC_G => false,
583  STAGES_G => 2,
584  INIT_G => "0"
585  ) port map (
586  clk => pgpTxClk,
587  rst => pgpTxClkRst,
588  dataIn => r.flowCntlDis,
590  );
591 
592 
593  U_TxDataSyncDis : if COMMON_RX_CLK_G generate
594  locTxDataEn <= r.locDataEn;
595  locTxData <= r.locData;
596  end generate;
597 
598  -- Flush Sync
599  U_TxFlushSync: entity work.RstSync
600  generic map (
601  TPD_G => TPD_G,
602  IN_POLARITY_G => '1',
603  OUT_POLARITY_G => '1',
604  RELEASE_DELAY_G => 3
605  ) port map (
606  clk => pgpTxClk,
607  asyncRst => r.flush,
608  syncRst => txFlush
609  );
610 
611  -- Set tx input
615  pgpTxIn.locData <= locTxData when locTxDataEn = '1' else locTxIn.locData;
617 
618 
619  -------------------------------------
620  -- Rx Control Sync
621  -------------------------------------
622 
623  -- Flush Sync
624  U_RxFlushSync: entity work.RstSync
625  generic map (
626  TPD_G => TPD_G,
627  IN_POLARITY_G => '1',
628  OUT_POLARITY_G => '1',
629  RELEASE_DELAY_G => 3
630  ) port map (
631  clk => pgpRxClk,
632  asyncRst => r.flush,
633  syncRst => rxFlush
634  );
635 
636  -- Reset Rx Sync
637  U_ResetRxSync: entity work.RstSync
638  generic map (
639  TPD_G => TPD_G,
640  IN_POLARITY_G => '1',
641  OUT_POLARITY_G => '1',
642  RELEASE_DELAY_G => 16
643  ) port map (
644  clk => pgpRxClk,
645  asyncRst => r.resetRx,
646  syncRst => rxReset
647  );
648 
649  -- Set rx input
653 
654 
655  ------------------------------------
656  -- AXI Registers
657  ------------------------------------
658 
659  -- Sync
660  process (axilClk) is
661  begin
662  if (rising_edge(axilClk)) then
663  r <= rin after TPD_G;
664  end if;
665  end process;
666 
667  -- Async
668  process (axilRst, axilReadMaster, axilWriteMaster, r, rxStatusSync, txStatusSync) is
669  variable v : RegType;
670  variable axiStatus : AxiLiteStatusType;
671  begin
672  v := r;
673 
675 
676  -- Write
677  if (axiStatus.writeEnable = '1') then
678 
679  -- Decode address and perform write
680  case (axilWriteMaster.awaddr(7 downto 0)) is
681  when X"00" =>
683  when X"04" =>
684  v.resetRx := ite(WRITE_EN_G,axilWriteMaster.wdata(0),'0');
685  when X"08" =>
686  v.flush := ite(WRITE_EN_G,axilWriteMaster.wdata(0),'0');
687  when X"0C" =>
688  v.loopBack := ite(WRITE_EN_G,axilWriteMaster.wdata(2 downto 0),"000");
689  when X"10" =>
691  v.locData := axilWriteMaster.wdata(7 downto 0);
692  when X"14" =>
694  when X"18" =>
695  v.flowCntlDis := ite(WRITE_EN_G,axilWriteMaster.wdata(0),'0');
696  when others => null;
697  end case;
698 
699  -- Send Axi response
700  axiSlaveWriteResponse(v.axilWriteSlave);
701  end if;
702 
703  -- Read
704  if (axiStatus.readEnable = '1') then
705  v.axilReadSlave.rdata := (others => '0');
706 
707  -- Decode address and assign read data
708  case axilReadMaster.araddr(7 downto 0) is
709  when X"00" =>
711  when X"04" =>
712  v.axilReadSlave.rdata(0) := r.resetRx;
713  when X"08" =>
714  v.axilReadSlave.rdata(0) := r.flush;
715  when X"0C" =>
716  v.axilReadSlave.rdata(2 downto 0) := r.loopBack;
717  when X"10" =>
718  v.axilReadSlave.rdata(8) := r.locDataEn;
719  v.axilReadSlave.rdata(7 downto 0) := r.locData;
720  when X"14" =>
722  when X"18" =>
724  when X"20" =>
725  v.axilReadSlave.rdata(0) := rxStatusSync.phyRxReady;
726  v.axilReadSlave.rdata(1) := txStatusSync.phyTxReady;
727  v.axilReadSlave.rdata(2) := rxStatusSync.locLinkReady;
728  v.axilReadSlave.rdata(3) := rxStatusSync.remLinkReady;
729  v.axilReadSlave.rdata(4) := txStatusSync.txLinkReady;
730  v.axilReadSlave.rdata(9 downto 8) := rxStatusSync.linkPolarity;
731  v.axilReadSlave.rdata(15 downto 12) := rxStatusSync.remPause;
732  v.axilReadSlave.rdata(19 downto 16) := txStatusSync.locPause;
733  v.axilReadSlave.rdata(23 downto 20) := rxStatusSync.remOverflow;
734  v.axilReadSlave.rdata(27 downto 24) := txStatusSync.locOverflow;
735  when X"24" =>
736  v.axilReadSlave.rdata(7 downto 0) := rxStatusSync.remLinkData;
737  when X"28" =>
738  v.axilReadSlave.rdata(ERROR_CNT_WIDTH_G-1 downto 0) := rxStatusSync.cellErrorCount;
739  when X"2C" =>
740  v.axilReadSlave.rdata(ERROR_CNT_WIDTH_G-1 downto 0) := rxStatusSync.linkDownCount;
741  when X"30" =>
742  v.axilReadSlave.rdata(ERROR_CNT_WIDTH_G-1 downto 0) := rxStatusSync.linkErrorCount;
743  when X"34" =>
744  v.axilReadSlave.rdata(ERROR_CNT_WIDTH_G-1 downto 0) := rxStatusSync.remOverflow0Cnt;
745  when X"38" =>
746  v.axilReadSlave.rdata(ERROR_CNT_WIDTH_G-1 downto 0) := rxStatusSync.remOverflow1Cnt;
747  when X"3C" =>
748  v.axilReadSlave.rdata(ERROR_CNT_WIDTH_G-1 downto 0) := rxStatusSync.remOverflow2Cnt;
749  when X"40" =>
750  v.axilReadSlave.rdata(ERROR_CNT_WIDTH_G-1 downto 0) := rxStatusSync.remOverflow3Cnt;
751  when X"44" =>
752  v.axilReadSlave.rdata(ERROR_CNT_WIDTH_G-1 downto 0) := rxStatusSync.frameErrCount;
753  when X"48" =>
754  v.axilReadSlave.rdata(STATUS_CNT_WIDTH_G-1 downto 0) := rxStatusSync.frameCount;
755  when X"4C" =>
756  v.axilReadSlave.rdata(ERROR_CNT_WIDTH_G-1 downto 0) := txStatusSync.locOverflow0Cnt;
757  when X"50" =>
758  v.axilReadSlave.rdata(ERROR_CNT_WIDTH_G-1 downto 0) := txStatusSync.locOverflow1Cnt;
759  when X"54" =>
760  v.axilReadSlave.rdata(ERROR_CNT_WIDTH_G-1 downto 0) := txStatusSync.locOverflow2Cnt;
761  when X"58" =>
762  v.axilReadSlave.rdata(ERROR_CNT_WIDTH_G-1 downto 0) := txStatusSync.locOverflow3Cnt;
763  when X"5C" =>
764  v.axilReadSlave.rdata(ERROR_CNT_WIDTH_G-1 downto 0) := txStatusSync.frameErrCount;
765  when X"60" =>
766  v.axilReadSlave.rdata(STATUS_CNT_WIDTH_G-1 downto 0) := txStatusSync.frameCount;
767  when X"64" =>
768  v.axilReadSlave.rdata := rxStatusSync.rxClkFreq;
769  when X"68" =>
770  v.axilReadSlave.rdata := txStatusSync.txClkFreq;
771  when X"70" =>
772  v.axilReadSlave.rdata(7 downto 0) := txStatusSync.txOpCodeLast;
773  when X"74" =>
774  v.axilReadSlave.rdata(7 downto 0) := rxStatusSync.rxOpCodeLast;
775  when X"78" =>
776  v.axilReadSlave.rdata(ERROR_CNT_WIDTH_G-1 downto 0) := txStatusSync.txOpCodeCount;
777  when X"7C" =>
778  v.axilReadSlave.rdata(ERROR_CNT_WIDTH_G-1 downto 0) := rxStatusSync.rxOpCodeCount;
779 
780  when others => null;
781  end case;
782 
783  -- Send Axi Response
784  axiSlaveReadResponse(v.axilReadSlave);
785  end if;
786 
787  -- Reset
788  if (axilRst = '1' ) then
789  v := REG_INIT_C;
790  end if;
791 
792  -- Next register assignment
793  rin <= v;
794 
795  -- Outputs
798 
799  end process;
800 
801 
802  ---------------------------------------
803  -- Status Vector
804  ---------------------------------------
806 
807  U_StatusWord : process ( rxStatusSync ) begin
808  statusWord <= (others=>'0');
809 
810  statusWord(ERROR_CNT_WIDTH_G-1+24 downto 24) <= rxStatusSync.linkDownCount;
811  statusWord(ERROR_CNT_WIDTH_G-1+16 downto 16) <= rxStatusSync.frameErrCount;
812  statusWord(ERROR_CNT_WIDTH_G-1+8 downto 8) <= rxStatusSync.cellErrorCount;
813 
814  statusWord(7 downto 6) <= (others=>'0');
815  statusWord(5) <= rxStatusSync.remLinkReady;
816  statusWord(4) <= rxStatusSync.locLinkReady;
817  statusWord(3 downto 0) <= rxStatusSync.remOverflow;
818  end process;
819 
820 end architecture structure;
821 
out axilWriteSlaveAxiLiteWriteSlaveType
Definition: Pgp2bAxi.vhd:148
INIT_Gslv := "0"
slv( ERROR_CNT_WIDTH_G- 1 downto 0) locOverflow0Cnt
Definition: Pgp2bAxi.vhd:231
AxiLiteWriteSlaveType axilWriteSlave
Definition: Pgp2bAxi.vhd:183
out syncRstsl
Definition: RstSync.vhd:36
slv( 7 downto 0) locTxData
Definition: Pgp2bAxi.vhd:168
slv( 17 downto 0) rxErrorIrqEn
Definition: Pgp2bAxi.vhd:166
in locTxInPgp2bTxInType := PGP2B_TX_IN_INIT_C
Definition: Pgp2bAxi.vhd:128
slv( 31 downto 0) txClkFreq
Definition: Pgp2bAxi.vhd:238
TPD_Gtime := 1 ns
IN_POLARITY_Gsl := '1'
Definition: RstSync.vhd:28
USE_DSP48_Gstring := "no"
ERROR_CNT_WIDTH_Gnatural range 1 to 32:= 4
Definition: Pgp2bAxi.vhd:119
AxiLiteReadSlaveType axilReadSlave
Definition: Pgp2bAxi.vhd:184
in pgpRxOutPgp2bRxOutType
Definition: Pgp2bAxi.vhd:134
SlVectorArray ( 11 downto 0, ERROR_CNT_WIDTH_G- 1 downto 0) txErrorCntOut
Definition: Pgp2bAxi.vhd:163
AxiLiteWriteMasterType
Definition: AxiLitePkg.vhd:111
std_logic sl
Definition: StdRtlPkg.vhd:28
in rstsl :=not RST_POLARITY_G
in pgpTxClksl
Definition: Pgp2bAxi.vhd:124
out axilReadSlaveAxiLiteReadSlaveType
Definition: Pgp2bAxi.vhd:145
in dinslv( DATA_WIDTH_G- 1 downto 0)
_library_ IEEEIEEE
Definition: StdRtlPkg.vhd:18
out pgpTxInPgp2bTxInType
Definition: Pgp2bAxi.vhd:126
slv( 3 downto 0) locPause
Definition: Pgp2bAxi.vhd:235
REF_CLK_FREQ_Greal := 200.0E+6
slv( 7 downto 0) remLinkData
Definition: Pgp2bAxi.vhd:208
COMMON_RX_CLK_Gboolean := false
Definition: Pgp2bAxi.vhd:115
ADDR_WIDTH_Ginteger range 2 to 48:= 4
STAGES_Gpositive := 2
slv( 31 downto 0) rdata
Definition: AxiLitePkg.vhd:89
array(natural range <> ,natural range <> ) of sl SlVectorArray
Definition: StdRtlPkg.vhd:669
slv( ERROR_CNT_WIDTH_G- 1 downto 0) cellErrorCount
Definition: Pgp2bAxi.vhd:209
slv( 3 downto 0) locOverflow
Definition: Pgp2bAxi.vhd:230
out pgpRxInPgp2bRxInType
Definition: Pgp2bAxi.vhd:133
WIDTH_Gpositive := 16
in locRxInPgp2bRxInType := PGP2B_RX_IN_INIT_C
Definition: Pgp2bAxi.vhd:135
slv( 2 downto 0) loopBack
Definition: Pgp2bAxi.vhd:178
RST_POLARITY_Gsl := '1'
slv( ERROR_CNT_WIDTH_G- 1 downto 0) locOverflow2Cnt
Definition: Pgp2bAxi.vhd:233
slv( 17 downto 0) rxErrorOut
Definition: Pgp2bAxi.vhd:158
BRAM_EN_Gboolean := false
slv( STATUS_CNT_WIDTH_G- 1 downto 0) frameCount
Definition: Pgp2bAxi.vhd:218
COMMON_CLK_Gboolean := false
in axilReadMasterAxiLiteReadMasterType
Definition: Pgp2bAxi.vhd:144
in asyncRstsl
Definition: RstSync.vhd:35
slv( ERROR_CNT_WIDTH_G- 1 downto 0) frameErrCount
Definition: Pgp2bAxi.vhd:217
out cntOutSlVectorArray ( WIDTH_G- 1 downto 0, CNT_WIDTH_G- 1 downto 0)
CNT_WIDTH_Gpositive := 32
USE_DSP48_Gstring := "no"
in pgpRxClksl
Definition: Pgp2bAxi.vhd:131
slv( 31 downto 0) wdata
Definition: AxiLitePkg.vhd:117
out dataOutsl
out doutslv( DATA_WIDTH_G- 1 downto 0)
in clksl
Definition: RstSync.vhd:34
out statusSendsl
Definition: Pgp2bAxi.vhd:139
OUT_POLARITY_Gsl := '1'
Definition: RstSync.vhd:29
AxiLiteStatusType axiStatus
Definition: AxiLitePkg.vhd:183
slv( ERROR_CNT_WIDTH_G- 1 downto 0) locOverflow3Cnt
Definition: Pgp2bAxi.vhd:234
slv( 7 downto 0) rxOpCodeLast
Definition: Pgp2bAxi.vhd:222
slv( ERROR_CNT_WIDTH_G- 1 downto 0) linkErrorCount
Definition: Pgp2bAxi.vhd:211
AXI_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_DECERR_C
Definition: Pgp2bAxi.vhd:120
RELEASE_DELAY_Gpositive := 3
slv( 7 downto 0) locData
Definition: Pgp2bAxi.vhd:181
CNT_WIDTH_Gpositive := 32
ALTERA_RAM_Gstring := "M9K"
slv( ERROR_CNT_WIDTH_G- 1 downto 0) locOverflow1Cnt
Definition: Pgp2bAxi.vhd:232
RegType := REG_INIT_C r
Definition: Pgp2bAxi.vhd:200
Pgp2bRxInType
Definition: Pgp2bPkg.vhd:55
RELEASE_DELAY_Ginteger range 3 to positive'high:= 3
Definition: RstSync.vhd:31
slv( 1 downto 0) := "11" AXI_RESP_DECERR_C
Definition: AxiLitePkg.vhd:49
SlVectorArray ( 0 downto 0, STATUS_CNT_WIDTH_G- 1 downto 0) txStatusCntOut
Definition: Pgp2bAxi.vhd:164
in pgpTxClkRstsl
Definition: Pgp2bAxi.vhd:125
out freqOutslv( CNT_WIDTH_G- 1 downto 0)
SlVectorArray ( 17 downto 0, ERROR_CNT_WIDTH_G- 1 downto 0) rxErrorCntOut
Definition: Pgp2bAxi.vhd:159
RegType :=(flush => '0',resetRx => '0',countReset => '0',loopBack =>( others => '0'),flowCntlDis => '0',autoStatus => '0',locData =>( others => '0'),locDataEn => '0',axilWriteSlave => AXI_LITE_WRITE_SLAVE_INIT_C,axilReadSlave => AXI_LITE_READ_SLAVE_INIT_C) REG_INIT_C
Definition: Pgp2bAxi.vhd:187
in rollOverEnInslv( WIDTH_G- 1 downto 0) :=( others => '0')
in axilRstsl
Definition: Pgp2bAxi.vhd:143
in irqEnInslv( WIDTH_G- 1 downto 0) :=( others => '0')
TxStatusType txstatusSync
Definition: Pgp2bAxi.vhd:243
ALTERA_SYN_Gboolean := false
in pgpTxOutPgp2bTxOutType
Definition: Pgp2bAxi.vhd:127
AxiLiteReadMasterType
Definition: AxiLitePkg.vhd:59
slv( ERROR_CNT_WIDTH_G- 1 downto 0) linkDownCount
Definition: Pgp2bAxi.vhd:210
slv( 31 downto 0) awaddr
Definition: AxiLitePkg.vhd:113
in axilClksl
Definition: Pgp2bAxi.vhd:142
slv( ERROR_CNT_WIDTH_G- 1 downto 0) remOverflow3Cnt
Definition: Pgp2bAxi.vhd:216
TPD_Gtime := 1 ns
Definition: RstSync.vhd:27
TPD_Gtime := 1 ns
out freqUpdatedsl
REFRESH_RATE_Greal := 1.0E+3
AxiLiteReadSlaveType :=(arready => '0',rdata =>( others => '0'),rresp =>( others => '0'),rvalid => '0') AXI_LITE_READ_SLAVE_INIT_C
Definition: AxiLitePkg.vhd:95
SYNC_STAGES_Ginteger range 3 to ( 2** 24):= 3
slv( 3 downto 0) remPause
Definition: Pgp2bAxi.vhd:219
RxStatusType rxstatusSync
Definition: Pgp2bAxi.vhd:225
slv( 11 downto 0) txErrorOut
Definition: Pgp2bAxi.vhd:162
OUT_POLARITY_Gsl := '1'
in pgpRxClkRstsl
Definition: Pgp2bAxi.vhd:132
CNT_RST_EDGE_Gboolean := true
AxiLiteReadSlaveType
Definition: AxiLitePkg.vhd:85
WRITE_EN_Gboolean := false
Definition: Pgp2bAxi.vhd:116
SlVectorArray ( 0 downto 0, STATUS_CNT_WIDTH_G- 1 downto 0) rxStatusCntOut
Definition: Pgp2bAxi.vhd:160
_library_ ieeeieee
Definition: JesdTxTest.vhd:20
RST_ASYNC_Gboolean := false
slv( 31 downto 0) araddr
Definition: AxiLitePkg.vhd:61
slv( 31 downto 0) rxClkFreq
Definition: Pgp2bAxi.vhd:220
Pgp2bTxOutType
Definition: Pgp2bPkg.vhd:135
slv( 1 downto 0) linkPolarity
Definition: Pgp2bAxi.vhd:205
sl opCodeEn
Definition: Pgp2bPkg.vhd:78
slv( 3 downto 0) remOverflow
Definition: Pgp2bAxi.vhd:212
COMMON_TX_CLK_Gboolean := false
Definition: Pgp2bAxi.vhd:114
slv( ERROR_CNT_WIDTH_G- 1 downto 0) remOverflow0Cnt
Definition: Pgp2bAxi.vhd:213
AXI_CLK_FREQ_Greal := 125.0E+6
Definition: Pgp2bAxi.vhd:117
slv( 2 downto 0) loopback
Definition: Pgp2bPkg.vhd:58
STATUS_CNT_WIDTH_Gnatural range 1 to 32:= 32
Definition: Pgp2bAxi.vhd:118
slv( ERROR_CNT_WIDTH_G- 1 downto 0) rxOpCodeCount
Definition: Pgp2bAxi.vhd:221
slv( 7 downto 0) opCode
Definition: Pgp2bPkg.vhd:79
out statusOutslv( WIDTH_G- 1 downto 0)
out statusWordslv( 63 downto 0)
Definition: Pgp2bAxi.vhd:138
AxiLiteWriteSlaveType :=(awready => '0',wready => '0',bresp =>( others => '0'),bvalid => '0') AXI_LITE_WRITE_SLAVE_INIT_C
Definition: AxiLitePkg.vhd:156
integer := ite( STATUS_CNT_WIDTH_G> 7, 7, STATUS_CNT_WIDTH_G- 1) STATUS_OUT_TOP_C
Definition: Pgp2bAxi.vhd:153
Pgp2bRxOutType
Definition: Pgp2bPkg.vhd:69
TPD_Gtime := 1 ns
Definition: Pgp2bAxi.vhd:113
slv( 7 downto 0) txOpCodeLast
Definition: Pgp2bAxi.vhd:240
CLK_LOWER_LIMIT_Greal := 159.0E+6
in axilWriteMasterAxiLiteWriteMasterType
Definition: Pgp2bAxi.vhd:146
DATA_WIDTH_Ginteger range 1 to ( 2** 24):= 16
slv( ERROR_CNT_WIDTH_G- 1 downto 0) remOverflow2Cnt
Definition: Pgp2bAxi.vhd:215
std_logic_vector slv
Definition: StdRtlPkg.vhd:29
CLK_UPPER_LIMIT_Greal := 161.0E+6
slv( ERROR_CNT_WIDTH_G- 1 downto 0) remOverflow1Cnt
Definition: Pgp2bAxi.vhd:214
slv( ERROR_CNT_WIDTH_G- 1 downto 0) txOpCodeCount
Definition: Pgp2bAxi.vhd:239