x393  1.0
FPGAcodeforElphelNC393camera
gtx_wrap.v
Go to the documentation of this file.
1 
39 //`include "gtx_8x10enc.v"
40 //`include "gtx_10x8dec.v"
41 //`include "gtx_comma_align.v"
42 //`include "gtx_elastic.v"
43 // All computations have been done in assumption of GTX interface being 20 bits wide!
44 //`include "system_defines.v"
45 //`define DEBUG_ELASTIC
46 module gtx_wrap #(
47 `ifdef USE_DATASCOPE
48  parameter ADDRESS_BITS = 10, // for datascope
49  parameter DATASCOPE_START_BIT = 14, // bit of DRP "other_control" to start recording after 0->1 (needs DRP)
50  parameter DATASCOPE_POST_MEAS = 16, // number of measurements to perform after event
51 `endif
52  parameter DATA_BYTE_WIDTH = 4,
53  parameter TXPMARESET_TIME = 5'h1,
54  parameter RXPMARESET_TIME = 5'h11,
55  parameter RXCDRPHRESET_TIME = 5'h1,
56  parameter RXCDRFREQRESET_TIME = 5'h1,
57  parameter RXDFELPMRESET_TIME = 7'hf,
58  parameter RXISCANRESET_TIME = 5'h1,
59 
60  parameter ELASTIC_DEPTH = 4, //5, With 4/7 got infrequent overflows!
61  parameter ELASTIC_OFFSET = 7 // 5 //10
62 )
63 (
64  output reg debug = 0,
65  output wire cplllock,
66  input wire cplllockdetclk,
67  input wire cpllreset,
68  input wire gtrefclk,
69  input wire rxuserrdy,
70  input wire txuserrdy,
71 // input wire rxusrclk,
72  input wire rxusrclk2,
73  input wire rxp,
74  input wire rxn,
75  output wire rxbyteisaligned,
76  input wire rxreset,
77  output wire rxcomwakedet,
78  output wire rxcominitdet,
79  output wire rxelecidle,
80  output wire rxresetdone,
81 
82  input wire clk_phase_align_req,
83  output wire clk_phase_align_ack,
84 
85  input wire txreset,
86  input wire txusrclk,
87  input wire txusrclk2,
88  input wire txelecidle,
89  output wire txp,
90  output wire txn,
91  output wire txoutclk, // global clock
92  input wire txpcsreset,
93  output wire txresetdone,
94  input wire txcominit,
95  input wire txcomwake,
96  output wire txcomfinish, // @txusrclk2
97  // elastic buffer status
98  output wire rxelsfull,
99  output wire rxelsempty,
100 
101  input wire [DATA_BYTE_WIDTH * 8 - 1:0] txdata,
102  input wire [DATA_BYTE_WIDTH - 1:0] txcharisk,
103  output wire [DATA_BYTE_WIDTH * 8 - 1:0] rxdata,
104  output wire [DATA_BYTE_WIDTH - 1:0] rxcharisk,
105  output wire [DATA_BYTE_WIDTH - 1:0] rxnotintable,
106  output wire [DATA_BYTE_WIDTH - 1:0] rxdisperr,
107 
108  output wire dbg_rxphaligndone,
109  output wire dbg_rx_clocks_aligned,
110  output wire dbg_rxcdrlock,
111  output wire dbg_rxdlysresetdone,
112 
113  output wire [1:0] txbufstatus,
114 
115  output xclk // just to measure frequency to set the local clock (global clock)
116 
117 `ifdef USE_DATASCOPE
118 // Datascope interface (write to memory that can be software-read)
119  ,output datascope_clk,
120  output [ADDRESS_BITS-1:0] datascope_waddr,
121  output datascope_we,
122 // output reg [31:0] datascope_di,
123  output [31:0] datascope_di,
124  input datascope_trig // external trigger event for the datascope
125 `endif
126 
127 `ifdef USE_DRP
128  ,input drp_rst,
129  input drp_clk,
130  input drp_en, // @aclk strobes drp_ad
131  input drp_we,
132  input [14:0] drp_addr,
133  input [15:0] drp_di,
134  output drp_rdy,
135  output [15:0] drp_do
136 `endif
137 `ifdef DEBUG_ELASTIC
138  ,output reg [15:0] dbg_data_cntr // 4 MSB - got other primitives during data receive
139 
140 `endif
141 
142 
143 
144 );
149 reg wrap_rxreset_;
151 // resets while PCS resets, active low
152 always @ (posedge rxusrclk2) wrap_rxreset_ <= rxuserrdy & rxresetdone_gtx;
153 always @ (posedge txusrclk2) wrap_txreset_ <= txuserrdy & txresetdone_gtx;
154 wire [63:0] rxdata_gtx;
155 wire [7:0] rxcharisk_gtx;
156 wire [7:0] rxdisperr_gtx;
157 wire [63:0] txdata_gtx;
158 wire [7:0] txcharisk_gtx;
159 wire [7:0] txchardispval_gtx;
161 // 8/10 encoder ifaces
162 wire [19:0] txdata_enc_out;
163 wire [15:0] txdata_enc_in;
164 wire [1:0] txcharisk_enc_in;
165 
166 /*
167  TX PCS, minor changes: 8/10 encoder + user interface resync
168  */
169 // assuming GTX interface width = 20 bits
170 assign txdata_gtx = {48'h0, txdata_enc_out[17:10], txdata_enc_out[7:0]};
171 assign txcharisk_gtx = 8'h0; // 8/10 encoder is bypassed in gtx
172 assign txchardispmode_gtx = {6'h0, txdata_enc_out[19], txdata_enc_out[9]};
173 assign txchardispval_gtx = {6'h0, txdata_enc_out[18], txdata_enc_out[8]};
174 
175 // Interface part
176 // @ gtx iface clk
178 wire txcomwake_gtx;
179 wire txelecidle_gtx;
181 `ifdef USE_DRP
182  wire [1:0] drp_en_w; // [0] - select GTX, [1] - select drp_other_registers
183  wire [1:0] drp_we_w; // [0] - select GTX, [1] - select drp_other_registers
184  reg [1:0] drp_sel; // [0] - select GTX, [1] - select drp_other_registers
185  wire [15:0] drp_do_gtx;
186  wire [15:0] drp_do_meas;
188  wire drp_rdy_meas;
189  wire [15:0] other_control; // control bits programmed over DRP interface
190 
191  assign drp_rdy = (drp_sel[0] & drp_rdy_gtx) | (drp_sel[1] & drp_rdy_meas);
192  assign drp_do = ({16{drp_sel[0]}} & drp_do_gtx) | ({16{drp_sel[1]}} & drp_do_meas);
193  assign drp_en_w = {2{drp_en & ~(|drp_addr[14:10])}} & {drp_addr[9],~drp_addr[9]};
194  assign drp_we_w = {2{drp_we & ~(|drp_addr[14:10])}} & {drp_addr[9],~drp_addr[9]};
195 
196  always @ (posedge drp_clk) drp_sel <= {2{~(|drp_addr[14:10])}} & {drp_addr[9],~drp_addr[9]};
197 
198 `endif
199 
200 
202 // insert resync if it's necessary
203 generate
204 if (DATA_BYTE_WIDTH == 4) begin
205  // resync to txusrclk
206  // 2*Fin = Fout => WIDTHin = 2*WIDTHout
207  // Andrey:
208  reg txdata_resync_strobe;
209  reg [15:0] txdata_enc_in_r; // TODO: remove async reset
210  reg [ 1:0] txcharisk_enc_in_r; // TODO: remove async reset
211  wire [38:0] txdata_resync_out;
212  wire txdata_resync_valid;
213  reg [1:0] txcomwake_gtx_f; // 2 registers just to match latency (data to the 3 next) in Alexey's code, probably not needed
214  reg [1:0] txcominit_gtx_f;
215  reg [1:0] txelecidle_gtx_f;
216 
217  resync_data #( // TODO: update output register.. OK as it is
218  .DATA_WIDTH(39),
219  .DATA_DEPTH(3),
220  .INITIAL_VALUE(39'h4000000000) // All 0 but txelecidle_gtx
221  ) txdata_resynchro (
222  .arst (txreset), // input
223  .srst (~wrap_txreset_), // input
224  .wclk (txusrclk2), // input
225  .rclk (txusrclk), // input
226  .we (1'b1), // input
227  .re (txdata_resync_strobe), // input
228  .data_in ({txelecidle, txcominit, txcomwake, txcharisk, txdata}), // input[15:0]
229  .data_out (txdata_resync_out), // output[15:0] reg
230  .valid (txdata_resync_valid) // output reg
231  );
232  always @ (posedge txreset or posedge txusrclk) begin
233  if (txreset) txdata_resync_strobe <= 0;
234  else if (txdata_resync_valid) txdata_resync_strobe <= ~txdata_resync_strobe;
235 
236  if (txreset) begin
237  txcomwake_gtx_f <= 0;
238  txcominit_gtx_f <= 0;
239  txelecidle_gtx_f <= ~0;
240  end else begin
241  txcomwake_gtx_f <= {txdata_resync_out[36],txcomwake_gtx_f[1]};
242  txcominit_gtx_f <= {txdata_resync_out[37],txcominit_gtx_f[1]};
243  txelecidle_gtx_f <= {txdata_resync_out[38],txelecidle_gtx_f[1]};
244  end
245  end
246 // Changing to sync reset (otherwise WARNING: [DRC 23-20] Rule violation (REQP-1839) RAMB36 async control check ...)
247  always @ (posedge txusrclk) begin
248  if (txreset) begin
249  txdata_enc_in_r <= 0;
250  txcharisk_enc_in_r <= 0;
251  end else if (txdata_resync_valid) begin
252  txdata_enc_in_r <= txdata_resync_strobe? txdata_resync_out[31:16]: txdata_resync_out[15:0];
253  txcharisk_enc_in_r <= txdata_resync_strobe? txdata_resync_out[35:34]: txdata_resync_out[33:32];
254  end
255 
256  end
257 
258 
259  assign txdata_enc_in = txdata_enc_in_r;
260  assign txcharisk_enc_in = txcharisk_enc_in_r;
261  assign txcominit_gtx = txcominit_gtx_f[0];
262  assign txcomwake_gtx = txcomwake_gtx_f[0];
263  assign txelecidle_gtx = txelecidle_gtx_f[0];
264 
265  end
266 
267 else
268 if (DATA_BYTE_WIDTH == 2) begin
269  // no resync is needed => straightforward assignments
270  assign txdata_enc_in = txdata[15:0];
271  assign txcharisk_enc_in = txcharisk[1:0];
272  assign txcominit_gtx = txcominit;
273  assign txcomwake_gtx = txcomwake;
274  assign txelecidle_gtx = txelecidle;
275 end
276 else begin
277  // unconsidered case
278  always @ (posedge txusrclk)
279  begin
280  $display("Wrong width set in %m, value is %d", DATA_BYTE_WIDTH);
281  end
282 end
283 endgenerate
285 // 8/10 encoder @ txusrclk, 16 + 1 bits -> 20
287  .rst (~wrap_txreset_),
288  .clk (txusrclk),
292 );
293 
294 // Adjust RXOUTCLK so RXUSRCLK (==xclk) matches SIPO output data
295 `ifdef CLK_ADJUST_VARIANT_1
296  wire rxcdrlock; // Marked as "reserved" - maybe not use it, only rxelecidle?
297  reg rxdlysreset = 0;
298  wire rxphaligndone;
299  wire rxdlysresetdone; // gtx output
300  reg rx_clocks_aligned = 0;
301  reg [2:0] rxdlysreset_cntr = 7;
302  reg rxdlysresetdone_r;
303 
304  assign dbg_rxphaligndone = rxphaligndone; // never gets up?
305  assign dbg_rx_clocks_aligned = rx_clocks_aligned;
306  assign dbg_rxcdrlock = rxcdrlock; //goes in/out (because of the SS ?
307  assign dbg_rxdlysresetdone = rxdlysresetdone_r;
308  always @ (posedge xclk) begin
309  // if (rxelecidle || !rxcdrlock) rxdlysreset_cntr <= 5;
310  if (rxelecidle) rxdlysreset_cntr <= 5;
311  else if (|rxdlysreset_cntr) rxdlysreset_cntr <= rxdlysreset_cntr - 1;
312 
313  // if (rxelecidle || !rxcdrlock) rxdlysreset <= 0;
314  if (rxelecidle) rxdlysreset <= 0;
315  else rxdlysreset <= |rxdlysreset_cntr;
316 
317  // if (rxelecidle || !rxcdrlock || rxdlysreset || |rxdlysreset_cntr) rx_clocks_aligned <= 0;
318  // if (rxelecidle || rxdlysreset || |rxdlysreset_cntr) rx_clocks_aligned <= 0;
319  if (rxelecidle) rx_clocks_aligned <= 0;
320  // else if (rxphaligndone) rx_clocks_aligned <= 1;
321  else if (rxphaligndone) rx_clocks_aligned <= 1;
322 
323  if (rxelecidle || rxdlysreset || |rxdlysreset_cntr) rxdlysresetdone_r <= 0;
324  else if (rxdlysresetdone) rxdlysresetdone_r <= 1;
325  end
326 `else
327  // time to first rxphaligndone ~450ns, time to second (that should stay - 4.9 usec, still much less than allowed ALIGNp response time)
328 
329  wire rxdlysreset = clk_phase_align_req;
330  reg rxphaligndone1_r = 0; // first time rxphaligndone gets active
331  reg rxphaligndone2_r = 0; // rxphaligndone deasserted
332  reg rx_clocks_aligned = 0; // second time rxphaligndone gets active (and is supposed to stay)
333  reg rxdlysresetdone_r; // debug only
334  wire rxphaligndone;
335  wire rxdlysresetdone;
336  wire rxcdrlock; // Marked as "reserved" - maybe not use it, only rxelecidle? (seems alternating 0/1 forever- SS?)
337  assign clk_phase_align_ack = rx_clocks_aligned;
338 
339  assign dbg_rxphaligndone = rxphaligndone; // never gets up?
340  assign dbg_rx_clocks_aligned = rx_clocks_aligned;
341  assign dbg_rxcdrlock = rxcdrlock; //goes in/out (because of the SS ?
342  assign dbg_rxdlysresetdone = rxdlysresetdone_r;
343  wire bypass_aligned;
344  `ifdef USE_DRP
345  assign bypass_aligned = other_control[0];
346  `else
347  assign bypass_aligned = 0;
348  `endif
349 `ifdef ALIGN_CLOCKS
350  wire first_confirm = rxphaligndone || (bypass_aligned && clk_phase_align_req);
351  always @ (posedge xclk) begin
352  if (rxelecidle) rxphaligndone1_r <= 0;
353  else if (first_confirm) rxphaligndone1_r <= 1;
354 
355  if (rxelecidle) rxphaligndone2_r <= 0;
358  if (rxelecidle) rx_clocks_aligned <= 0;
360 
361  if (rxelecidle || rxdlysreset) rxdlysresetdone_r <= 0; // debug only
362  else if (rxdlysresetdone) rxdlysresetdone_r <= 1;
363  end
364 `else // ALIGN_CLOCKS - just bypassing
365  always @ (posedge xclk) begin
366  if (rxelecidle) rxphaligndone1_r <= 0;
367  else if (clk_phase_align_req) rxphaligndone1_r <= 1;
369  if (rxelecidle) rxphaligndone2_r <= 0;
370  else if (rxphaligndone1_r && !clk_phase_align_req) rxphaligndone2_r <= 1;
372  if (rxelecidle) rx_clocks_aligned <= 0;
373  else if (rxphaligndone2_r) rx_clocks_aligned <= 1;
375  if (rxelecidle || rxdlysreset) rxdlysresetdone_r <= 0;
376  else if (rxphaligndone2_r) rxdlysresetdone_r <= 1;
377  end
378 `endif
379 
380 `endif
381 
383 
384 
385 
386 
387 
388 
389 
390 /*
391  RX PCS part: comma detect + align module, 10/8 decoder, elastic buffer, interface resynchronisation
392  all modules before elastic buffer shall work on a restored clock - xclk
393  */
394 // wire xclk; make it output to measure frequency
395 // assuming GTX interface width = 20 bits
396 // comma aligner
397 wire [19:0] rxdata_comma_out;
398 wire [19:0] gtx_rx_data20 = {rxdisperr_gtx[1], rxcharisk_gtx[1], rxdata_gtx[15:8], rxdisperr_gtx[0], rxcharisk_gtx[0], rxdata_gtx[7:0]};
399 wire [19:0] rxdata_comma_in;
400 // TODO: Add timing constraints on gtx_rx_data20 to reduce spread between bits?
401 //`ifndef USE_DRP
402 // `define USE_DRP
403 //`endif
404 
405  // asynchronous signals to be controlled by external programmable bits
406 wire RXPHDLYRESET; // 1 (1'b0),
407 wire RXPHALIGN; // 2 (1'b0),
408 wire RXPHALIGNEN; // 3 (1'b0),
409 wire RXPHDLYPD; // 4 (1'b0),
410 wire RXPHOVRDEN; // 5 (1'b0),
411 wire RXDLYSRESET; // 6 (rxdlysreset),
412 wire RXDLYBYPASS; // 7 (1'b0), // Andrey: p.243: "0: Uses the RX delay alignment circuit."
413 wire RXDLYEN; // 8 (1'b0),
414 wire RXDLYOVRDEN; // 9 (1'b0),
415 wire RXDDIEN; // 10 (1'b1), // Andrey: p.243: "Set high in RX buffer bypass mode"
416 wire RXLPMEN; // 11 (1'b0) 1 - enable LP, 0 - DXE
417 
418 reg [19:0] rxdata_comma_in_r;
420 always @ (posedge xclk)
422 
423 `ifdef USE_DRP
425  .DRP_ABITS(8),
426  .DRP_REG0(8),
427  .DRP_REG1(9),
428  .DRP_REG2(10),
429  .DRP_REG3(11)
430  ) drp_other_registers_i (
431  .drp_rst (drp_rst), // input
432  .drp_clk (drp_clk), // input
433  .drp_en (drp_en_w[1]), // input
434  .drp_we (drp_we_w[1]), // input
435  .drp_addr (drp_addr[7:0]), // input[7:0]
436  .drp_di (drp_di), // input[15:0]
437  .drp_rdy (drp_rdy_meas), // output reg
438  .drp_do (drp_do_meas), // output[15:0] reg
439  .drp_register0 (), // output[15:0] // reserved for future use
440  .drp_register1 (), // output[15:0] // reserved for future use
441  .drp_register2 (), // output[15:0] // reserved for future use
442  .drp_register3 (other_control) // output[15:0] // reserved for future use
443  );
444 
445  assign RXPHDLYRESET = other_control[ 1]; // 1 (1'b0),
446  assign RXPHALIGN = other_control[ 2]; // 2 (1'b0),
447  assign RXPHALIGNEN = other_control[ 3]; // 3 (1'b0),
448  assign RXPHDLYPD = other_control[ 4]; // 4 (1'b0),
449  assign RXPHOVRDEN = other_control[ 5]; // 5 (1'b0),
450  assign RXDLYSRESET = other_control[ 6]; // 6 (rxdlysreset),
451  assign RXDLYBYPASS = other_control[ 7]; // 7 (1'b0), // Andrey: p.243: "0: Uses the RX delay alignment circuit."
452  assign RXDLYEN = other_control[ 8]; // 8 (1'b0),
453  assign RXDLYOVRDEN = other_control[ 9]; // 9 (1'b0),
454  assign RXDDIEN = other_control[10]; // 10 (1'b1), // Andrey: p.243: "Set high in RX buffer bypass mode"
455  assign RXLPMEN = other_control[11]; // 11 (1'b0) 1 - enable LP, 0 - DXE
456 `else
457  // VDT bug - considered USE_DRP undefined during closure, temporary including unconnected module
458  drp_other_registers #(
459  .DRP_ABITS (8),
460  .DRP_REG0 (8),
461  .DRP_REG1 (9),
462  .DRP_REG2 (10),
463  .DRP_REG3 (11)
464  ) drp_other_registers_i (
465  .drp_rst (1'b0), // input
466  .drp_clk (1'b0), // input
467  .drp_en (1'b0), // input
468  .drp_we (1'b0), // input
469  .drp_addr (8'b0), // input[7:0]
470  .drp_di (16'b0),// input[15:0]
471  .drp_rdy (), // output reg
472  .drp_do (), // output[15:0] reg
473  .drp_register0 (), // output[15:0] // reserved for future use
474  .drp_register1 (), // output[15:0] // reserved for future use
475  .drp_register2 (), // output[15:0] // reserved for future use
476  .drp_register3 () // output[15:0] // reserved for future use
477  );
478  assign RXPHDLYRESET = 1'b0;; // 1 (1'b0),
479  assign RXPHALIGN = 1'b0;; // 2 (1'b0),
480  assign RXPHALIGNEN = 1'b0;; // 3 (1'b0),
481  assign RXPHDLYPD = 1'b0;; // 4 (1'b0),
482  assign RXPHOVRDEN = 1'b0;; // 5 (1'b0),
483  assign RXDLYSRESET = 1'b0;; // 6 (rxdlysreset),
484  `ifdef ALIGN_CLOCKS
485  assign RXDLYBYPASS = 1'b0; // 7 (1'b0), // Andrey: p.243: "0: Uses the RX delay alignment circuit."
486  `else
487  assign RXDLYBYPASS = 1'b1; // 7 (1'b0), // Andrey: p.243: "0: Uses the RX delay alignment circuit."
488  `endif
489  assign RXDLYEN = 1'b0; // 8 (1'b0),
490  assign RXDLYOVRDEN = 1'b0; // 9 (1'b0),
491  `ifdef ALIGN_CLOCKS
492  assign RXDDIEN = 1'b1; // Andrey: p.243: "Set high in RX buffer bypass mode"
493  `else
494  assign RXDDIEN = 1'b0; // 10 (1'b1), // Andrey: p.243: "Set high in RX buffer bypass mode"
495  `endif
496  assign RXLPMEN = 1'b0; // 11 (1'b0) 1 - enable LP, 0 - DXE
497 `endif
498 // aligner status generation
499 // if we detected comma & there was 1st realign after non-aligned state -> triggered, we wait until the next comma
500 // if no realign would be issued, assumes, that we've aligned to the stream otherwise go back to non-aligned state
501 wire comma;
502 wire realign;
503 wire state_nonaligned;
504 reg state_aligned;
505 reg state_triggered;
506 wire set_aligned;
507 wire set_triggered;
508 wire clr_aligned;
509 wire clr_triggered;
510 
514 assign clr_aligned = realign;
515 assign clr_triggered = realign;
516 
517 always @ (posedge xclk)
518 begin
521 end
524 // .rst (~rx_clocks_aligned), // ~wrap_rxreset_),
526 
527  .clk (xclk),
530  .comma (comma),
531  .realign (realign)
532 );
533 
534 //
535 
536 // 10x8 decoder
537 wire [15:0] rxdata_dec_out;
538 wire [1:0] rxcharisk_dec_out;
539 wire [1:0] rxnotintable_dec_out;
540 wire [1:0] rxdisperr_dec_out;
541 
543 // .rst (~rx_clocks_aligned), // ~wrap_rxreset_),
544  .rst (~wrap_rxreset_),
545  .clk (xclk),
551 );
552 // iface resync
554 wire rxcominitdet_gtx;
555 
556 
557 elastic1632 #(
558  .DEPTH_LOG2 (ELASTIC_DEPTH), // 16 //4),
559  .OFFSET (ELASTIC_OFFSET) // 10 //5)
560 ) elastic1632_i (
561  .wclk (xclk), // input 150MHz, recovered
562  .rclk (rxusrclk2), // input 75 MHz, system
563  .isaligned_in (state_aligned), // input Moved clock phase reset/align to OOB module to handle
564  .charisk_in (rxcharisk_dec_out), // input[1:0]
565  .notintable_in (rxnotintable_dec_out), // input[1:0]
566  .disperror_in (rxdisperr_dec_out), // input[1:0]
567  .data_in (rxdata_dec_out), // input[15:0]
568  .isaligned_out (rxbyteisaligned), // output
569  .charisk_out (rxcharisk), // output[3:0] reg
570  .notintable_out (rxnotintable), // output[3:0] reg
571  .disperror_out (rxdisperr), // output[3:0] reg
572  .data_out (rxdata), // output[31:0] reg
573  .full (rxelsfull), // output
574  .empty (rxelsempty) // output
575 );
576 
577 `ifdef DEBUG_ELASTIC
578  localparam ALIGN_PRIM = 32'h7B4A4ABC;
579  localparam SOF_PRIM = 32'h3737b57c;
580  localparam EOF_PRIM = 32'hd5d5b57c;
581  localparam CONT_PRIM = 32'h9999aa7c;
582  localparam HOLD_PRIM = 32'hd5d5aa7c;
583  localparam HOLDA_PRIM = 32'h9595aa7c;
584  localparam WTRM_PRIM = 32'h5858b57c;
585 
586 
587  reg [15:0] dbg_data_in_r;
588  reg [1:0] dbg_charisk_in_r;
589  reg dbg_aligned32_in_r; // input data is word-aligned and got ALIGNp
590  reg dbg_msb_in_r; // input contains MSB
591  reg [11:0] dbg_data_cntr_r;
592  reg [3:0] got_prims_r;
593  reg dbg_frun;
594  reg dbg_is_sof_r;
595  reg dbg_is_eof_r;
596  reg dbg_is_data_r;
597 
598  wire dbg_is_alignp_w = ({rxdata_dec_out, dbg_data_in_r} == ALIGN_PRIM) && ({rxcharisk_dec_out, dbg_charisk_in_r} == 4'h1);
599 
600  wire dbg_is_sof_w = ({rxdata_dec_out, dbg_data_in_r} == SOF_PRIM) && ({rxcharisk_dec_out, dbg_charisk_in_r} == 4'h1);
601  wire dbg_is_eof_w = ({rxdata_dec_out, dbg_data_in_r} == EOF_PRIM) && ({rxcharisk_dec_out, dbg_charisk_in_r} == 4'h1);
602 
603  wire dbg_is_cont_w = ({rxdata_dec_out, dbg_data_in_r} == CONT_PRIM) && ({rxcharisk_dec_out, dbg_charisk_in_r} == 4'h1);
604  wire dbg_is_hold_w = ({rxdata_dec_out, dbg_data_in_r} == HOLD_PRIM) && ({rxcharisk_dec_out, dbg_charisk_in_r} == 4'h1);
605  wire dbg_is_holda_w = ({rxdata_dec_out, dbg_data_in_r} == HOLDA_PRIM) && ({rxcharisk_dec_out, dbg_charisk_in_r} == 4'h1);
606  wire dbg_is_wrtm_w = ({rxdata_dec_out, dbg_data_in_r} == WTRM_PRIM) && ({rxcharisk_dec_out, dbg_charisk_in_r} == 4'h1);
607 
608 
609  wire dbg_is_data_w = ({rxcharisk_dec_out, dbg_charisk_in_r} == 4'h0);
610 
611  always @ (posedge xclk) begin
612  dbg_data_in_r <= rxdata_dec_out;
613  dbg_charisk_in_r <= rxcharisk_dec_out;
614 
615  dbg_is_sof_r <= dbg_is_sof_w;
616  dbg_is_eof_r <= dbg_is_eof_w;
617  dbg_is_data_r <=dbg_is_data_w && dbg_msb_in_r;
618 
619  if (!dbg_aligned32_in_r && !dbg_is_alignp_w) dbg_msb_in_r <= 1;
620  else dbg_msb_in_r <= !dbg_msb_in_r;
621 
622  if (!state_aligned) dbg_aligned32_in_r <= 0;
623  else if (dbg_is_alignp_w) dbg_aligned32_in_r <= 1;
624 
625  if (!dbg_aligned32_in_r || dbg_is_sof_r) got_prims_r <= 0;
626  else if (dbg_frun) got_prims_r <= got_prims_r | {dbg_is_cont_w, dbg_is_hold_w, dbg_is_holda_w, dbg_is_wrtm_w};
627 
628 
629  if (!dbg_aligned32_in_r || dbg_is_eof_r) dbg_frun <= 0;
630  else if (dbg_is_sof_r) dbg_frun <= 1;
631 
632  if (!dbg_aligned32_in_r || dbg_is_sof_r) dbg_data_cntr_r <= 0;
633  else if (dbg_frun && dbg_is_data_r) dbg_data_cntr_r <= dbg_data_cntr_r + 1;
634 
635  if (!dbg_aligned32_in_r || dbg_is_sof_r) dbg_data_cntr <= {got_prims_r, dbg_data_cntr_r}; // copy previous value
636 
637  end
638 
639 `endif // DEBUG_ELASATIC
640 
641 
642 reg rxresetdone_r;
643 reg txresetdone_r;
644 always @ (posedge rxusrclk2) rxresetdone_r <= rxresetdone_gtx;
645 always @ (posedge txusrclk2) txresetdone_r <= txresetdone_gtx;
646 assign rxresetdone = rxresetdone_r;
647 assign txresetdone = txresetdone_r;
648 
650  .EXTRA_DLY(0)
651 ) pulse_cross_clock_rxcominitdet_i (
652  .rst (~wrap_rxreset_), // input
653  .src_clk (xclk), // input
654  .dst_clk (rxusrclk2), // input
655  .in_pulse (rxcominitdet_gtx), // input
656  .out_pulse (rxcominitdet), // output
657  .busy () // output
658 );
659 
661  .EXTRA_DLY(0)
662 ) pulse_cross_clock_rxcomwakedet_i (
663  .rst (~wrap_rxreset_), // input
664  .src_clk (xclk), // input
665  .dst_clk (rxusrclk2), // input
666  .in_pulse (rxcomwakedet_gtx), // input
667  .out_pulse (rxcomwakedet), // output
668  .busy () // output
669 );
670 wire txoutclk_gtx;
671 wire xclk_gtx;
672 
674  .BUFFER_TYPE("BUFG")
675 ) bufg_txoutclk (
676  .o (txoutclk), // output
677  .i (txoutclk_gtx), // input
678  .clr (1'b0) // input
679 );
681  .BUFFER_TYPE("BUFG")
682 ) bug_xclk (
683  .o (xclk), // output
684  .i (xclk_gtx), // input
685  .clr (1'b0) // input
686 );
687 
689  .SIM_RECEIVER_DETECT_PASS ("TRUE"),
690  .SIM_TX_EIDLE_DRIVE_LEVEL ("X"),
691  .SIM_RESET_SPEEDUP ("FALSE"),
692  .SIM_CPLLREFCLK_SEL (3'b001),
693  .SIM_VERSION ("4.0"),
694  .ALIGN_COMMA_DOUBLE ("FALSE"),
695  .ALIGN_COMMA_ENABLE (10'b1111111111),
696  .ALIGN_COMMA_WORD (1),
697  .ALIGN_MCOMMA_DET ("TRUE"),
698  .ALIGN_MCOMMA_VALUE (10'b1010000011),
699  .ALIGN_PCOMMA_DET ("TRUE"),
700  .ALIGN_PCOMMA_VALUE (10'b0101111100),
701  .SHOW_REALIGN_COMMA ("TRUE"),
702  .RXSLIDE_AUTO_WAIT (7),
703  .RXSLIDE_MODE ("OFF"),
704  .RX_SIG_VALID_DLY (10),
705  .RX_DISPERR_SEQ_MATCH ("TRUE"),
706  .DEC_MCOMMA_DETECT ("TRUE"),
707  .DEC_PCOMMA_DETECT ("TRUE"),
708  .DEC_VALID_COMMA_ONLY ("FALSE"),
709  .CBCC_DATA_SOURCE_SEL ("DECODED"),
710  .CLK_COR_SEQ_2_USE ("FALSE"),
711  .CLK_COR_KEEP_IDLE ("FALSE"),
712  .CLK_COR_MAX_LAT (9),
713  .CLK_COR_MIN_LAT (7),
714  .CLK_COR_PRECEDENCE ("TRUE"),
715  .CLK_COR_REPEAT_WAIT (0),
716  .CLK_COR_SEQ_LEN (1),
717  .CLK_COR_SEQ_1_ENABLE (4'b1111),
718  .CLK_COR_SEQ_1_1 (10'b0100000000),
719  .CLK_COR_SEQ_1_2 (10'b0000000000),
720  .CLK_COR_SEQ_1_3 (10'b0000000000),
721  .CLK_COR_SEQ_1_4 (10'b0000000000),
722  .CLK_CORRECT_USE ("FALSE"),
723  .CLK_COR_SEQ_2_ENABLE (4'b1111),
724  .CLK_COR_SEQ_2_1 (10'b0100000000),
725  .CLK_COR_SEQ_2_2 (10'b0000000000),
726  .CLK_COR_SEQ_2_3 (10'b0000000000),
727  .CLK_COR_SEQ_2_4 (10'b0000000000),
728  .CHAN_BOND_KEEP_ALIGN ("FALSE"),
729  .CHAN_BOND_MAX_SKEW (1),
730  .CHAN_BOND_SEQ_LEN (1),
731  .CHAN_BOND_SEQ_1_1 (10'b0000000000),
732  .CHAN_BOND_SEQ_1_2 (10'b0000000000),
733  .CHAN_BOND_SEQ_1_3 (10'b0000000000),
734  .CHAN_BOND_SEQ_1_4 (10'b0000000000),
735  .CHAN_BOND_SEQ_1_ENABLE (4'b1111),
736  .CHAN_BOND_SEQ_2_1 (10'b0000000000),
737  .CHAN_BOND_SEQ_2_2 (10'b0000000000),
738  .CHAN_BOND_SEQ_2_3 (10'b0000000000),
739  .CHAN_BOND_SEQ_2_4 (10'b0000000000),
740  .CHAN_BOND_SEQ_2_ENABLE (4'b1111),
741  .CHAN_BOND_SEQ_2_USE ("FALSE"),
742  .FTS_DESKEW_SEQ_ENABLE (4'b1111),
743  .FTS_LANE_DESKEW_CFG (4'b1111),
744  .FTS_LANE_DESKEW_EN ("FALSE"),
745  .ES_CONTROL (6'b000000),
746  .ES_ERRDET_EN ("FALSE"),
747  .ES_EYE_SCAN_EN ("TRUE"),
748  .ES_HORZ_OFFSET (12'h000),
749  .ES_PMA_CFG (10'b0000000000),
750  .ES_PRESCALE (5'b00000),
751  .ES_QUALIFIER (80'h00000000000000000000),
752  .ES_QUAL_MASK (80'h00000000000000000000),
753  .ES_SDATA_MASK (80'h00000000000000000000),
754  .ES_VERT_OFFSET (9'b000000000),
755  .RX_DATA_WIDTH (20),
756  .OUTREFCLK_SEL_INV (2'b11),
757  .PMA_RSV (32'h00018480),
758  .PMA_RSV2 (16'h2050),
759  .PMA_RSV3 (2'b00),
760  .PMA_RSV4 (32'h00000000),
761  .RX_BIAS_CFG (12'b000000000100),
762  .DMONITOR_CFG (24'h000A00),
763 // .RX_CM_SEL (2'b11),
764  .RX_CM_SEL (2'b00), // Andrey
765  .RX_CM_TRIM (3'b010),
766  .RX_DEBUG_CFG (12'b000000000000),
767  .RX_OS_CFG (13'b0000010000000),
768  .TERM_RCAL_CFG (5'b10000),
769  .TERM_RCAL_OVRD (1'b0),
770  .TST_RSV (32'h00000000),
771  .RX_CLK25_DIV (6),
772  .TX_CLK25_DIV (6),
773  .UCODEER_CLR (1'b0),
774  .PCS_PCIE_EN ("FALSE"),
775  .PCS_RSVD_ATTR (48'h0100),
776  .RXBUF_ADDR_MODE ("FAST"),
777  .RXBUF_EIDLE_HI_CNT (4'b1000),
778  .RXBUF_EIDLE_LO_CNT (4'b0000),
779  .RXBUF_EN ("FALSE"),
780  .RX_BUFFER_CFG (6'b000000),
781  .RXBUF_RESET_ON_CB_CHANGE ("TRUE"),
782  .RXBUF_RESET_ON_COMMAALIGN ("FALSE"),
783  .RXBUF_RESET_ON_EIDLE ("FALSE"),
784  .RXBUF_RESET_ON_RATE_CHANGE ("TRUE"),
785  .RXBUFRESET_TIME (5'b00001),
786  .RXBUF_THRESH_OVFLW (61),
787  .RXBUF_THRESH_OVRD ("FALSE"),
788  .RXBUF_THRESH_UNDFLW (4),
789  .RXDLY_CFG (16'h001F),
790  .RXDLY_LCFG (9'h030),
791  .RXDLY_TAP_CFG (16'h0000),
792  .RXPH_CFG (24'h000000),
793  .RXPHDLY_CFG (24'h084020),
794  .RXPH_MONITOR_SEL (5'b00000),
795 `ifdef ALIGN_CLOCKS
796 // .RX_XCLK_SEL ("RXUSR"), // ("RXREC"), // Andrey: Now they are the same, just using p.247 "Using RX Buffer Bypass..."
797  .RX_XCLK_SEL ("RXREC"), // Andrey: Does not align clocks if in this mode
798 `else
799  .RX_XCLK_SEL ("RXREC"), // Andrey: Does not align clocks if in this mode
800 `endif
801  .RX_DDI_SEL (6'b000000),
802  .RX_DEFER_RESET_BUF_EN ("TRUE"),
803 /// .RXCDR_CFG (72'h03_0000_23ff_1020_0020),// 1.6G - 6.25G, No SS, RXOUT_DIV=2
804  .RXCDR_CFG (72'h03_8800_8BFF_4020_0008),// http://www.xilinx.com/support/answers/53364.html - SATA-2, div=2
805  .RXCDR_FR_RESET_ON_EIDLE (1'b0),
806  .RXCDR_HOLD_DURING_EIDLE (1'b0),
807  .RXCDR_PH_RESET_ON_EIDLE (1'b0),
808  .RXCDR_LOCK_CFG (6'b010101),
812  .RXPCSRESET_TIME (5'b00001),
814  .RXOOB_CFG (7'b0000110),
815  .RXGEARBOX_EN ("FALSE"),
816  .GEARBOX_MODE (3'b000),
817  .RXPRBS_ERR_LOOPBACK (1'b0),
818  .PD_TRANS_TIME_FROM_P2 (12'h03c),
819  .PD_TRANS_TIME_NONE_P2 (8'h3c),
820  .PD_TRANS_TIME_TO_P2 (8'h64),
821  .SAS_MAX_COM (64),
822  .SAS_MIN_COM (36),
823  .SATA_BURST_SEQ_LEN (4'b0101),
824  .SATA_BURST_VAL (3'b100),
825  .SATA_EIDLE_VAL (3'b100),
826  .SATA_MAX_BURST (8),
827  .SATA_MAX_INIT (21),
828  .SATA_MAX_WAKE (7),
829  .SATA_MIN_BURST (4),
830  .SATA_MIN_INIT (12),
831  .SATA_MIN_WAKE (4),
832  .TRANS_TIME_RATE (8'h0E),
833  .TXBUF_EN ("TRUE"),
834  .TXBUF_RESET_ON_RATE_CHANGE ("TRUE"),
835  .TXDLY_CFG (16'h001F),
836  .TXDLY_LCFG (9'h030),
837  .TXDLY_TAP_CFG (16'h0000),
838  .TXPH_CFG (16'h0780),
839  .TXPHDLY_CFG (24'h084020),
840  .TXPH_MONITOR_SEL (5'b00000),
841  .TX_XCLK_SEL ("TXOUT"),
842  .TX_DATA_WIDTH (20),
843  .TX_DEEMPH0 (5'b00000),
844  .TX_DEEMPH1 (5'b00000),
845  .TX_EIDLE_ASSERT_DELAY (3'b110),
846  .TX_EIDLE_DEASSERT_DELAY (3'b100),
847  .TX_LOOPBACK_DRIVE_HIZ ("FALSE"),
848  .TX_MAINCURSOR_SEL (1'b0),
849  .TX_DRIVE_MODE ("DIRECT"),
850  .TX_MARGIN_FULL_0 (7'b1001110),
851  .TX_MARGIN_FULL_1 (7'b1001001),
852  .TX_MARGIN_FULL_2 (7'b1000101),
853  .TX_MARGIN_FULL_3 (7'b1000010),
854  .TX_MARGIN_FULL_4 (7'b1000000),
855  .TX_MARGIN_LOW_0 (7'b1000110),
856  .TX_MARGIN_LOW_1 (7'b1000100),
857  .TX_MARGIN_LOW_2 (7'b1000010),
858  .TX_MARGIN_LOW_3 (7'b1000000),
859  .TX_MARGIN_LOW_4 (7'b1000000),
860  .TXGEARBOX_EN ("FALSE"),
861  .TXPCSRESET_TIME (5'b00001),
863  .TX_RXDETECT_CFG (14'h1832),
864  .TX_RXDETECT_REF (3'b100),
865  .CPLL_CFG (24'hBC07DC),
866  .CPLL_FBDIV (4),
867  .CPLL_FBDIV_45 (5),
868  .CPLL_INIT_CFG (24'h00001E),
869  .CPLL_LOCK_CFG (16'h01E8),
870  .CPLL_REFCLK_DIV (1),
871  .RXOUT_DIV (2),
872  .TXOUT_DIV (2),
873  .SATA_CPLL_CFG ("VCO_3000MHZ"),
875  .RXLPM_HF_CFG (14'b00000011110000),
876  .RXLPM_LF_CFG (14'b00000011110000),
877  .RX_DFE_GAIN_CFG (23'h020FEA),
878  .RX_DFE_H2_CFG (12'b000000000000),
879  .RX_DFE_H3_CFG (12'b000001000000),
880  .RX_DFE_H4_CFG (11'b00011110000),
881  .RX_DFE_H5_CFG (11'b00011100000),
882  .RX_DFE_KL_CFG (13'b0000011111110),
883 /// .RX_DFE_LPM_CFG (16'h0954),
884  .RX_DFE_LPM_CFG (16'h0904),
885  .RX_DFE_LPM_HOLD_DURING_EIDLE (1'b0),
886  .RX_DFE_UT_CFG (17'b10001111000000000),
887  .RX_DFE_VP_CFG (17'b00011111100000011),
888  .RX_CLKMUX_PD (1'b1),
889  .TX_CLKMUX_PD (1'b1),
890  .RX_INT_DATAWIDTH (0),
891  .TX_INT_DATAWIDTH (0),
892  .TX_QPI_STATUS_EN (1'b0),
893  .RX_DFE_KL_CFG2 (32'h301148AC),
894  .RX_DFE_XYD_CFG (13'b0000000000000),
895  .TX_PREDRIVER_MODE (1'b0)
896 )
898  .CPLLFBCLKLOST (),
899  .CPLLLOCK (cplllock),
900  .CPLLLOCKDETCLK (cplllockdetclk),
901  .CPLLLOCKEN (1'b1),
902  .CPLLPD (1'b0),
903  .CPLLREFCLKLOST (),
904  .CPLLREFCLKSEL (3'b001),
905  .CPLLRESET (cpllreset),
906  .GTRSVD (16'b0),
907  .PCSRSVDIN (16'b0),
908  .PCSRSVDIN2 (5'b0),
909  .PMARSVDIN (5'b0),
910  .PMARSVDIN2 (5'b0),
911  .TSTIN (20'h1),
912  .TSTOUT (),
913  .CLKRSVD (4'b0000),
914  .GTGREFCLK (1'b0),
915  .GTNORTHREFCLK0 (1'b0),
916  .GTNORTHREFCLK1 (1'b0),
917  .GTREFCLK0 (gtrefclk),
918  .GTREFCLK1 (1'b0),
919  .GTSOUTHREFCLK0 (1'b0),
920  .GTSOUTHREFCLK1 (1'b0),
921 `ifdef USE_DRP
922  .DRPADDR (drp_addr[8:0]),
923  .DRPCLK (drp_clk),
924  .DRPDI (drp_di),
925  .DRPDO (drp_do_gtx),
926  .DRPEN (drp_en_w[0]),
927  .DRPRDY (drp_rdy_gtx),
928  .DRPWE (drp_we_w[0]),
929 `else
930  .DRPADDR (9'b0),
931  .DRPCLK (1'b0),
932  .DRPDI (16'b0),
933  .DRPDO (),
934  .DRPEN (1'b0),
935  .DRPRDY (),
936  .DRPWE (1'b0),
937 `endif
938  .GTREFCLKMONITOR (),
939  .QPLLCLK (1'b0/*gtrefclk**/),
940  .QPLLREFCLK (1'b0/*gtrefclk**/),
941  .RXSYSCLKSEL (2'b00),
942  .TXSYSCLKSEL (2'b00),
943  .DMONITOROUT (),
944  .TX8B10BEN (1'b0),
945  .LOOPBACK (3'd0),
946  .PHYSTATUS (),
947  .RXRATE (3'd0),
948  .RXVALID (),
949  .RXPD (2'b00),
950  .TXPD (2'b00),
951  .SETERRSTATUS (1'b0),
952  .EYESCANRESET (1'b0),//rxreset), // p78
953  .RXUSERRDY (rxuserrdy),
954  .EYESCANDATAERROR (),
955  .EYESCANMODE (1'b0),
956  .EYESCANTRIGGER (1'b0),
957  .RXCDRFREQRESET (1'b0),
958  .RXCDRHOLD (1'b0),
959  .RXCDRLOCK (rxcdrlock),
960  .RXCDROVRDEN (1'b0),
961  .RXCDRRESET (1'b0),
962  .RXCDRRESETRSV (1'b0),
963  .RXCLKCORCNT (),
964  .RX8B10BEN (1'b0),
965 
966 /// .RXUSRCLK (rxusrclk),
967 /// .RXUSRCLK2 (rxusrclk),
968 /// When internal elastic buffer is bypassed, these clocks should be restored clock synchronous
969  .RXUSRCLK (xclk),
970  .RXUSRCLK2 (xclk),
971 
972  .RXDATA (rxdata_gtx),
973  .RXPRBSERR (),
974  .RXPRBSSEL (3'd0),
975  .RXPRBSCNTRESET (1'b0),
976  .RXDFEXYDEN (1'b1),
977  .RXDFEXYDHOLD (1'b0),
978  .RXDFEXYDOVRDEN (1'b0),
980  .RXNOTINTABLE (),
981  .GTXRXP (rxp),
982  .GTXRXN (rxn),
983  .RXBUFRESET (1'b0),
984  .RXBUFSTATUS (),
985 `ifdef ALIGN_CLOCKS
986  .RXDDIEN (RXDDIEN), // (1'b1), // Andrey: p.243: "Set high in RX buffer bypass mode"
987  .RXDLYBYPASS (RXDLYBYPASS), // (1'b0), // Andrey: p.243: "0: Uses the RX delay alignment circuit."
988 `else
989  .RXDDIEN (RXDDIEN), // (1'b0),
990  .RXDLYBYPASS (RXDLYBYPASS), // (1'b1),
991 `endif
992  .RXDLYEN (RXDLYEN), // (1'b0),
993  .RXDLYOVRDEN (RXDLYOVRDEN), // (1'b0),
996  .RXPHALIGN (RXPHALIGN), // (1'b0),
998  .RXPHALIGNEN (RXPHALIGNEN), // (1'b0),
999  .RXPHDLYPD (RXPHDLYPD), // (1'b0),
1000  .RXPHDLYRESET (RXPHDLYRESET), // (1'b0),
1001  .RXPHMONITOR (),
1002  .RXPHOVRDEN (RXPHOVRDEN), // (1'b0),
1003  .RXPHSLIPMONITOR (),
1004  .RXSTATUS (),
1005  .RXBYTEISALIGNED (),
1006  .RXBYTEREALIGN (),
1007  .RXCOMMADET (),
1008  .RXCOMMADETEN (1'b0),
1009  .RXMCOMMAALIGNEN (1'b0),
1010  .RXPCOMMAALIGNEN (1'b0),
1011  .RXCHANBONDSEQ (),
1012  .RXCHBONDEN (1'b0),
1013  .RXCHBONDLEVEL (3'd0),
1014  .RXCHBONDMASTER (1'b0),
1015  .RXCHBONDO (),
1016  .RXCHBONDSLAVE (1'b0),
1017  .RXCHANISALIGNED (),
1018  .RXCHANREALIGN (),
1019  .RXLPMHFHOLD (1'b0),
1020  .RXLPMHFOVRDEN (1'b0),
1021  .RXLPMLFHOLD (1'b0),
1022  .RXDFEAGCHOLD (1'b0),
1023  .RXDFEAGCOVRDEN (1'b0),
1024  .RXDFECM1EN (1'b0),
1025  .RXDFELFHOLD (1'b0),
1026  .RXDFELFOVRDEN (1'b1),
1027  .RXDFELPMRESET (rxreset),
1028  .RXDFETAP2HOLD (1'b0),
1029  .RXDFETAP2OVRDEN (1'b0),
1030  .RXDFETAP3HOLD (1'b0),
1031  .RXDFETAP3OVRDEN (1'b0),
1032  .RXDFETAP4HOLD (1'b0),
1033  .RXDFETAP4OVRDEN (1'b0),
1034  .RXDFETAP5HOLD (1'b0),
1035  .RXDFETAP5OVRDEN (1'b0),
1036  .RXDFEUTHOLD (1'b0),
1037  .RXDFEUTOVRDEN (1'b0),
1038  .RXDFEVPHOLD (1'b0),
1039  .RXDFEVPOVRDEN (1'b0),
1040 // .RXDFEVSEN (1'b0),
1041  .RXLPMLFKLOVRDEN (1'b0),
1043  .RXMONITORSEL (2'b01),
1044  .RXOSHOLD (1'b0),
1045  .RXOSOVRDEN (1'b0),
1046  .RXRATEDONE (),
1047  .RXOUTCLK (xclk_gtx),
1048  .RXOUTCLKFABRIC (),
1050  .RXOUTCLKSEL (3'b010),
1052  .RXHEADER (),
1055  .RXGEARBOXSLIP (1'b0),
1056  .GTRXRESET (rxreset),
1057  .RXOOBRESET (1'b0),
1058  .RXPCSRESET (1'b0),
1059  .RXPMARESET (1'b0),//rxreset), // p78
1060  .RXLPMEN (RXLPMEN), // 1'b0),
1064  .RXELECIDLE (rxelecidle),
1065  .RXELECIDLEMODE (2'b00),
1066  .RXPOLARITY (1'b0),
1067  .RXSLIDE (1'b0),
1068  .RXCHARISCOMMA (),
1070  .RXCHBONDI (5'b00000),
1072  .RXQPIEN (1'b0),
1075  .TXPHDLYTSTCLK (1'b0),
1076  .TXPOSTCURSOR (5'b00000),
1078  .TXPRECURSOR (5'd0),
1079  .TXPRECURSORINV (1'b0),
1080  .TXQPIBIASEN (1'b0),
1081  .TXQPISTRONGPDOWN (1'b0),
1082  .TXQPIWEAKPUP (1'b0),
1083  .CFGRESET (1'b0),
1084  .GTTXRESET (txreset),
1086  .TXUSERRDY (txuserrdy),
1087  .GTRESETSEL (1'b0),
1088  .RESETOVRD (1'b0),
1091  .TXUSRCLK (txusrclk),
1092  .TXUSRCLK2 (txusrclk),
1094  .TXMARGIN (3'd0),
1095  .TXRATE (3'd0),
1096  .TXSWING (1'b0),
1097  .TXPRBSFORCEERR (1'b0),
1098  .TXDLYBYPASS (1'b1),
1099  .TXDLYEN (1'b0),
1100  .TXDLYHOLD (1'b0),
1101  .TXDLYOVRDEN (1'b0),
1102  .TXDLYSRESET (1'b0),
1103  .TXDLYSRESETDONE (),
1104  .TXDLYUPDOWN (1'b0),
1105  .TXPHALIGN (1'b0),
1106  .TXPHALIGNDONE (),
1107  .TXPHALIGNEN (1'b0),
1108  .TXPHDLYPD (1'b0),
1109  .TXPHDLYRESET (1'b0),
1110  .TXPHINIT (1'b0),
1111  .TXPHINITDONE (),
1112  .TXPHOVRDEN (1'b0),
1113  .TXBUFSTATUS (txbufstatus[1:0]), // Andrey
1114  .TXBUFDIFFCTRL (3'b100),
1115  .TXDEEMPH (1'b0),
1116  .TXDIFFCTRL (4'b1000),
1117  .TXDIFFPD (1'b0),
1118  .TXINHIBIT (1'b0),
1119  .TXMAINCURSOR (7'b0000000),
1120  .TXPISOPD (1'b0),
1122  .GTXTXN (txn),
1123  .GTXTXP (txp),
1127  .TXOUTCLKSEL (3'b010),
1131  .TXHEADER (3'd0),
1132  .TXSEQUENCE (7'd0),
1133  .TXSTARTSEQ (1'b0),
1134  .TXPCSRESET (txpcsreset),
1135  .TXPMARESET (1'b0),
1137  .TXCOMFINISH (txcomfinish),
1139  .TXCOMSAS (1'b0),
1142  .TXPOLARITY (1'b0),
1143  .TXDETECTRX (1'b0),
1144  .TX8B10BBYPASS (8'd0),
1145  .TXPRBSSEL (3'd0),
1148 );
1151 `ifdef USE_DATASCOPE
1152  `ifdef DATASCOPE_INCOMING_RAW
1153  datascope_incoming_raw #(
1154  .ADDRESS_BITS (ADDRESS_BITS),
1155  .DATASCOPE_POST_MEAS (DATASCOPE_POST_MEAS)
1156  ) datascope_incoming_i (
1157  .clk (xclk), // input
1158  .charisk (rxcharisk_dec_out[1:0]), // input[1:0]
1159  .rxdata (rxdata_dec_out[15:0]), // input[15:0]
1160  .realign (realign), // input
1161  .comma (comma), // input
1162  .aligned (state_aligned), // input
1163  .not_in_table (rxnotintable_dec_out[1:0]), // input[1:0]
1164  .disp_err (rxdisperr_dec_out[1:0]), // input[1:0]
1165  .datascope_arm (other_control[DATASCOPE_START_BIT]), // input
1166  .datascope_clk (datascope_clk), // output
1167  .datascope_waddr (datascope_waddr), // output[9:0]
1168  .datascope_we (datascope_we), // output
1169  .datascope_di (datascope_di), // output[31:0] reg
1170  .datascope_trig (datascope_trig) // input
1171  );
1172  `else // DATASCOPE_INCOMING_RAW
1176  ) datascope_incoming_i (
1177  .clk (xclk), // input
1178  .charisk (rxcharisk_dec_out[1:0]), // input[1:0]
1179  .rxdata (rxdata_dec_out[15:0]), // input[15:0]
1180  .aligned (state_aligned), // input
1181  .not_in_table (rxnotintable_dec_out[1:0]), // input[1:0]
1182  .disp_err (rxdisperr_dec_out[1:0]), // input[1:0]
1184  .datascope_clk (datascope_clk), // output
1185  .datascope_waddr (datascope_waddr), // output[9:0]
1186  .datascope_we (datascope_we), // output
1187  .datascope_di (datascope_di), // output[31:0] reg
1188  .datascope_trig (datascope_trig) // input
1189  );
1190 
1191  `endif // not DATASCOPE_INCOMING_RAW
1192 `endif
1193 
1194  always @ (posedge gtrefclk)
1195  debug <= ~rxelecidle | debug;
1196 
1197 endmodule
1198 
1200 
1202  parameter ADDRESS_BITS = 10, // for datascope
1203  parameter DATASCOPE_POST_MEAS = 16 // number of measurements to perform after event
1204 )(
1205  input clk, // source-synchronous clock (150MHz)
1206  input [1:0] charisk,
1207  input [15:0] rxdata,
1208  input realign,
1209  input comma,
1210  input aligned,
1211  input [1:0] not_in_table,
1212  input [1:0] disp_err,
1213  input datascope_arm,
1214  output datascope_clk,
1215  output [ADDRESS_BITS-1:0] datascope_waddr,
1216  output datascope_we,
1217  output reg [31:0] datascope_di,
1218  input datascope_trig // external trigger event for the datascope
1219 );
1221  reg [ADDRESS_BITS - 1:0 ] datascope_post_cntr;
1228 // wire datascope_start_w = other_control[DATASCOPE_START_BIT]; // datascope requires USE_DRP to be defined
1230  reg [2:0] datascope_trig_r;
1233  assign datascope_clk = clk;
1235 
1236 
1237  always @ (posedge clk) begin
1241 
1243 
1244  if (!datascope_start_r[1]) datascope_run <= 0;
1245  else if (!datascope_start_r[2]) datascope_run <= 1;
1246  else if (datascope_stop) datascope_run <= 0;
1247 
1248  if (!datascope_run) datascope_post_run <= 0;
1249  else if (datascope_event_r) datascope_post_run <= 1;
1250 
1253 
1254  if (!datascope_start_r[1] && datascope_start_r[0]) datascope_waddr_r <= 0; // for simulator
1256 
1257  if (datascope_start_r[1]) datascope_di <= {
1258  6'b0,
1259  realign, // 25
1260  comma, // 24
1261  1'b0, // 23
1262  aligned, // 22
1263  not_in_table[1:0], // 21:20
1264  disp_err[1:0], // 19:18
1265  charisk[1:0], // 17:16
1266  rxdata[15:0]}; // 15: 0
1267  end
1268 
1269 endmodule
1270 
1271 module datascope_incoming#(
1272  parameter ADDRESS_BITS = 10, // for datascope
1273  parameter DATASCOPE_POST_MEAS = 16 // number of measurements to perform after event
1274 )(
1275  input clk, // source-synchronous clock (150MHz)
1276  input [1:0] charisk,
1277  input [15:0] rxdata,
1278  input aligned,
1279  input [1:0] not_in_table,
1280  input [1:0] disp_err,
1281  input datascope_arm,
1282  output datascope_clk,
1283  output [ADDRESS_BITS-1:0] datascope_waddr,
1284  output datascope_we,
1285  output [31:0] datascope_di,
1286  input datascope_trig // external trigger event for the datascope
1287 
1288 );
1289  localparam ALIGN_PRIM = 32'h7b4a4abc;
1290  localparam CONT_PRIM = 32'h9999aa7c;
1291  localparam DMAT_PRIM = 32'h3636b57c;
1292  localparam EOF_PRIM = 32'hd5d5b57c;
1293  localparam HOLD_PRIM = 32'hd5d5aa7c;
1294  localparam HOLDA_PRIM = 32'h9595aa7c;
1295  localparam PMACK_PRIM = 32'h9595957c;
1296  localparam PMNAK_PRIM = 32'hf5f5957c;
1297  localparam PMREQ_P_PRIM = 32'h1717b57c;
1298  localparam PMREQ_S_PRIM = 32'h7575957c;
1299  localparam R_ERR_PRIM = 32'h5656b57c;
1300  localparam R_IP_PRIM = 32'h5555b57c;
1301  localparam R_OK_PRIM = 32'h3535b57c;
1302  localparam R_RDY_PRIM = 32'h4a4a957c;
1303  localparam SOF_PRIM = 32'h3737b57c;
1304  localparam SYNC_PRIM = 32'hb5b5957c;
1305  localparam WTRM_PRIM = 32'h5858b57c;
1306  localparam X_RDY_PRIM = 32'h5757b57c;
1307 
1308  localparam NUM_NIBBLES = 6;
1309  reg [15:0] rxdata_r;
1310  reg [ 1:0] charisk_r;
1311 
1312  wire is_alignp = ({rxdata, rxdata_r} == ALIGN_PRIM) && ({charisk, charisk_r} == 4'h1);
1313  wire is_cont = ({rxdata, rxdata_r} == CONT_PRIM) && ({charisk, charisk_r} == 4'h1);
1314  wire is_dmat = ({rxdata, rxdata_r} == DMAT_PRIM) && ({charisk, charisk_r} == 4'h1);
1315  wire is_eof = ({rxdata, rxdata_r} == EOF_PRIM) && ({charisk, charisk_r} == 4'h1);
1316  wire is_hold = ({rxdata, rxdata_r} == HOLD_PRIM) && ({charisk, charisk_r} == 4'h1);
1317  wire is_holda = ({rxdata, rxdata_r} == HOLDA_PRIM) && ({charisk, charisk_r} == 4'h1);
1318  wire is_pmack = ({rxdata, rxdata_r} == PMACK_PRIM) && ({charisk, charisk_r} == 4'h1);
1319  wire is_pmnak = ({rxdata, rxdata_r} == PMNAK_PRIM) && ({charisk, charisk_r} == 4'h1);
1320  wire is_pmreq_p = ({rxdata, rxdata_r} == PMREQ_P_PRIM) && ({charisk, charisk_r} == 4'h1);
1321  wire is_pmreq_s = ({rxdata, rxdata_r} == PMREQ_S_PRIM) && ({charisk, charisk_r} == 4'h1);
1322  wire is_r_err = ({rxdata, rxdata_r} == R_ERR_PRIM) && ({charisk, charisk_r} == 4'h1);
1323  wire is_r_ip = ({rxdata, rxdata_r} == R_IP_PRIM) && ({charisk, charisk_r} == 4'h1);
1324  wire is_r_ok = ({rxdata, rxdata_r} == R_OK_PRIM) && ({charisk, charisk_r} == 4'h1);
1325  wire is_r_rdy = ({rxdata, rxdata_r} == R_RDY_PRIM) && ({charisk, charisk_r} == 4'h1);
1326  wire is_sof = ({rxdata, rxdata_r} == SOF_PRIM) && ({charisk, charisk_r} == 4'h1);
1327  wire is_sync = ({rxdata, rxdata_r} == SYNC_PRIM) && ({charisk, charisk_r} == 4'h1);
1328  wire is_wrtm = ({rxdata, rxdata_r} == WTRM_PRIM) && ({charisk, charisk_r} == 4'h1);
1329  wire is_xrdy = ({rxdata, rxdata_r} == X_RDY_PRIM) && ({charisk, charisk_r} == 4'h1);
1330 
1331  wire is_data_w = {charisk, charisk_r} == 4'h0;
1332 
1333  wire [17:0] is_prim_w = {is_alignp,
1334  is_cont,
1335  is_dmat,
1336  is_eof,
1337  is_hold,
1338  is_holda,
1339  is_pmack,
1340  is_pmnak,
1341  is_pmreq_p,
1342  is_pmreq_s,
1343  is_r_err,
1344  is_r_ip,
1345  is_r_ok,
1346  is_r_rdy,
1347  is_sof,
1348  is_sync,
1349  is_wrtm,
1350  is_xrdy};
1351  wire [ 2:0] is_err_w = {~aligned, |not_in_table, |disp_err};
1352 
1353  reg [17:0] is_prim_r;
1354  reg is_data_r;
1355  reg [ 2:0] is_err_r;
1356 
1357  reg [17:0] is_prim_r2;
1358  reg is_data_r2;
1359  reg [ 3:0] is_err_r2;
1360  wire [31:0] states = {9'b0, is_err_r2[3:0], is_prim_r2[17:0], is_data_r2}; // to add more states ?
1361  wire [ 4:0] encoded_states_w ={(|states[31:16]),
1362  (|states[31:24]) | (|states[15:8]),
1363  (|states[31:28]) | (|states[23:20]) | (|states[15:12]) | (|states[7:4]),
1364  (|states[31:30]) | (|states[27:26]) | (|states[23:22]) | (|states[19:18]) | (|states[15:14]) | (|states[11:10]) | (|states[7:6]) | (|states[3:2]),
1365  states[31] | states[29] | states[27] | states[25] | states[23] | states[21] | states[19] | states[17] |
1366  states[15] | states[13] | states[11] | states[9] | states[7] | states[5] | states[3] | states[1]};
1367 // wire stop = (DATASCOPE_POST_MEAS == 0) ? datascope_trig: (post_cntr == 0);
1368 
1369  reg [5*NUM_NIBBLES-1:0] encoded_states_r3;
1370  reg [ADDRESS_BITS - 1:0 ] post_cntr;
1371  reg post_run;
1372  reg [ADDRESS_BITS - 1:0 ] waddr_r;
1373 
1374  reg [2:0] arm_r;
1375  reg [2:0] trig_r;
1376  reg [NUM_NIBBLES-1:0] wen;
1377  reg run_r = 0;
1378  wire event_w = trig_r[1] && !trig_r[2]; // re-clocked single-cycle external trigger
1379  reg event_r;
1380  wire stop = (DATASCOPE_POST_MEAS == 0) ? event_w: (post_cntr == 0);
1381  reg [1:0] we_r=0;
1382  reg msb_in_r;
1383 
1384  reg is_aligned_r; // input aligned and got ALIGNp
1385 
1386  assign datascope_clk = clk;
1387  assign datascope_waddr = waddr_r;
1388  assign datascope_we = we_r[1];
1389  assign datascope_di = {1'b0, post_run, encoded_states_r3};
1390 
1391  always @ (posedge clk) begin
1392  if (!aligned) is_aligned_r <= 0;
1393  else if (is_alignp) is_aligned_r <= 1;
1394 
1395  if (!is_aligned_r && !is_alignp) msb_in_r <= 1;
1396  else msb_in_r <= !msb_in_r;
1397 
1398 
1399  rxdata_r <= rxdata;
1400  charisk_r <= charisk;
1401 
1402 
1403  arm_r <= {arm_r[1:0], datascope_arm};
1404  trig_r <= {trig_r[1:0],datascope_trig};
1405 
1406  if (!arm_r[1]) run_r <= 0;
1407  else if (!arm_r[2]) run_r <= 1;
1408  else if (stop) run_r <= 0;
1409 
1410  event_r <= event_w;
1411 
1412  if (!run_r) post_run <= 0;
1413  else if (event_r) post_run <= 1;
1414 
1415  if (msb_in_r) begin
1416  is_prim_r <= is_prim_w;
1417  is_err_r <= is_err_w;
1418  is_data_r <= is_data_w;
1419 
1420  is_prim_r2 <= {18{~(|is_err_r)}} & is_prim_r;
1421  is_err_r2 <= {is_err_r[2],is_err_r[1] & ~is_err_r[2],is_err_r[0] & ~(|is_err_r[2:1]), ~(|is_prim_r) & ~is_data_r & ~(|is_err_r)}; // make errors 1-hot by priority
1422  is_data_r2 <= is_data_r & ~(|is_err_r);
1423 
1425 
1426  if (!run_r) wen <= 0;
1427  else wen <= {wen[NUM_NIBBLES-2:0],~(|wen[NUM_NIBBLES-2:0])};
1428 
1429 
1430  we_r[0] <= run_r && wen[NUM_NIBBLES-1];
1431  end
1432 
1433  we_r[1] <=we_r[0] && !msb_in_r;
1434 
1435  if (!arm_r[1] && arm_r[0]) waddr_r <= 0; // for simulator
1436  else if (we_r[1]) waddr_r <= waddr_r + 1;
1437 
1439  else if (we_r[1]) post_cntr <= post_cntr - 1;
1440 
1441  end
1442 endmodule
1443 
1444 
datascope_incoming_i datascope_incoming
Definition: gtx_wrap.v:1021
14930rxdata_comma_in_rreg[19:0]
Definition: gtx_wrap.v:376
14899drp_we_wwire[1:0]
Definition: gtx_wrap.v:181
reg [3:0] 14666notintable_out
Definition: elastic1632.v:44
15040post_cntrreg[ADDRESS_BITS-1:0]
Definition: gtx_wrap.v:1218
14909rx_clocks_alignedreg
Definition: gtx_wrap.v:303
[1:0] 14661notintable_in
Definition: elastic1632.v:38
14997PMREQ_P_PRIM32'h1717b57c
Definition: gtx_wrap.v:1145
wire 14714clk
Definition: gtx_10x8dec.v:41
14885rxdata_gtxwire[63:0]
Definition: gtx_wrap.v:152
14932realignwire
Definition: gtx_wrap.v:425
14989ALIGN_PRIM32'h7b4a4abc
Definition: gtx_wrap.v:1137
14946rxresetdone_rreg
Definition: gtx_wrap.v:522
[31:0] 14987datascope_di
Definition: gtx_wrap.v:1133
15050we_rreg[1:0]
Definition: gtx_wrap.v:1229
gtx_10x8dec gtx_10x8dec
Definition: gtx_wrap.v:465
14882txresetdone_gtxwire
Definition: gtx_wrap.v:146
14874RXCDRPHRESET_TIME5'h1
Definition: gtx_wrap.v:55
14889txcharisk_gtxwire[7:0]
Definition: gtx_wrap.v:156
14886rxcharisk_gtxwire[7:0]
Definition: gtx_wrap.v:153
wire [1:0] 14719disperror
Definition: gtx_10x8dec.v:46
15039encoded_states_r3reg[5*NUM_NIBBLES-1:0]
Definition: gtx_wrap.v:1217
14921RXPHALIGNENwire
Definition: gtx_wrap.v:366
14910rxdlysresetdone_rreg
Definition: gtx_wrap.v:304
14967datascope_waddr_rreg[ADDRESS_BITS-1:0]
Definition: gtx_wrap.v:1070
15008rxdata_rreg[15:0]
Definition: gtx_wrap.v:1157
14923RXPHOVRDENwire
Definition: gtx_wrap.v:368
reg [DATA_WIDTH-1:0] 10742data_out
Definition: resync_data.v:57
reg [31:0] 14964datascope_di
Definition: gtx_wrap.v:1065
[15:0] 14663data_in
Definition: elastic1632.v:40
14879ELASTIC_OFFSET7
Definition: gtx_wrap.v:61
14992EOF_PRIM32'hd5d5b57c
Definition: gtx_wrap.v:1140
15043arm_rreg[2:0]
Definition: gtx_wrap.v:1222
14922RXPHDLYPDwire
Definition: gtx_wrap.v:367
14890txchardispval_gtxwire[7:0]
Definition: gtx_wrap.v:157
14901drp_do_gtxwire[15:0]
Definition: gtx_wrap.v:183
14942rxnotintable_dec_outwire[1:0]
Definition: gtx_wrap.v:462
14945rxcominitdet_gtxwire
Definition: gtx_wrap.v:477
[ADDRESS_BITS-1:0] 14985datascope_waddr
Definition: gtx_wrap.v:1131
14919RXPHDLYRESETwire
Definition: gtx_wrap.v:364
14870DATASCOPE_POST_MEAS16
Definition: gtx_wrap.v:50
14877RXISCANRESET_TIME5'h1
Definition: gtx_wrap.v:58
14931commawire
Definition: gtx_wrap.v:424
14937set_triggeredwire
Definition: gtx_wrap.v:430
14974datascope_trig_rreg[2:0]
Definition: gtx_wrap.v:1078
14929RXLPMENwire
Definition: gtx_wrap.v:374
15034is_prim_r2reg[17:0]
Definition: gtx_wrap.v:1205
[DRP_ABITS-1:0] 14631drp_addr
wire [19:0] 14715indata
Definition: gtx_10x8dec.v:42
15031is_prim_rreg[17:0]
Definition: gtx_wrap.v:1201
14906rxdlysresetwire
Definition: gtx_wrap.v:300
14884wrap_txreset_reg
Definition: gtx_wrap.v:148
14917gtx_rx_data20wire[19:0]
Definition: gtx_wrap.v:356
14995PMACK_PRIM32'h9595957c
Definition: gtx_wrap.v:1143
wire 14742clk
Definition: gtx_8x10enc.v:41
14991DMAT_PRIM32'h3636b57c
Definition: gtx_wrap.v:1139
14907rxphaligndone1_rreg
Definition: gtx_wrap.v:301
wire [1:0] 14718notintable
Definition: gtx_10x8dec.v:45
[15:0] 14979rxdata
Definition: gtx_wrap.v:1125
14872TXPMARESET_TIME5'h1
Definition: gtx_wrap.v:53
15042waddr_rreg[ADDRESS_BITS-1:0]
Definition: gtx_wrap.v:1220
14926RXDLYENwire
Definition: gtx_wrap.v:371
[ADDRESS_BITS-1:0] 14962datascope_waddr
Definition: gtx_wrap.v:1063
drp_other_registers_i drp_other_registers
Definition: gtx_wrap.v:382
14934state_alignedreg
Definition: gtx_wrap.v:427
wire [1:0] 14743inisk
Definition: gtx_8x10enc.v:42
15009charisk_rreg[1:0]
Definition: gtx_wrap.v:1158
reg [31:0] 14668data_out
Definition: elastic1632.v:46
14908rxphaligndone2_rreg
Definition: gtx_wrap.v:302
wire [15:0] 14716outdata
Definition: gtx_10x8dec.v:43
14893txdata_enc_inwire[15:0]
Definition: gtx_wrap.v:161
wire [19:0] 14764outdata
14903drp_rdy_gtxwire
Definition: gtx_wrap.v:185
14925RXDLYBYPASSwire
Definition: gtx_wrap.v:370
elastic1632_i elastic1632
Definition: gtx_wrap.v:480
14927RXDLYOVRDENwire
Definition: gtx_wrap.v:372
14898drp_en_wwire[1:0]
Definition: gtx_wrap.v:180
15029is_prim_wwire[17:0]
Definition: gtx_wrap.v:1181
15037stateswire[31:0]
Definition: gtx_wrap.v:1208
14916rxdata_comma_outwire[19:0]
Definition: gtx_wrap.v:355
14896txcomwake_gtxwire
Definition: gtx_wrap.v:176
14892txdata_enc_outwire[19:0]
Definition: gtx_wrap.v:160
15005WTRM_PRIM32'h5858b57c
Definition: gtx_wrap.v:1153
14940rxdata_dec_outwire[15:0]
Definition: gtx_wrap.v:460
14881rxresetdone_gtxwire
Definition: gtx_wrap.v:145
15038encoded_states_wwire[4:0]
Definition: gtx_wrap.v:1209
14914bypass_alignedwire
Definition: gtx_wrap.v:314
15003SOF_PRIM32'h3737b57c
Definition: gtx_wrap.v:1151
reg [3:0] 14665charisk_out
Definition: elastic1632.v:43
14943rxdisperr_dec_outwire[1:0]
Definition: gtx_wrap.v:463
14902drp_do_measwire[15:0]
Definition: gtx_wrap.v:184
bug_xclk select_clk_buf
Definition: gtx_wrap.v:560
14894txcharisk_enc_inwire[1:0]
Definition: gtx_wrap.v:162
14915first_confirmwire
Definition: gtx_wrap.v:319
pulse_cross_clock_rxcomwakedet_i pulse_cross_clock
Definition: gtx_wrap.v:540
15002R_RDY_PRIM32'h4a4a957c
Definition: gtx_wrap.v:1150
14868ADDRESS_BITS10
Definition: gtx_wrap.v:48
14869DATASCOPE_START_BIT14
Definition: gtx_wrap.v:49
reg [3:0] 14667disperror_out
Definition: elastic1632.v:45
15000R_IP_PRIM32'h5555b57c
Definition: gtx_wrap.v:1148
14990CONT_PRIM32'h9999aa7c
Definition: gtx_wrap.v:1138
14904drp_rdy_measwire
Definition: gtx_wrap.v:186
14911rxphaligndonewire
Definition: gtx_wrap.v:305
14933state_nonalignedwire
Definition: gtx_wrap.v:426
14878ELASTIC_DEPTH4
Definition: gtx_wrap.v:60
14891txchardispmode_gtxwire[7:0]
Definition: gtx_wrap.v:158
14912rxdlysresetdonewire
Definition: gtx_wrap.v:306
14895txcominit_gtxwire
Definition: gtx_wrap.v:175
reg 14880debug
Definition: gtx_wrap.v:64
[1:0] 14662disperror_in
Definition: elastic1632.v:39
14993HOLD_PRIM32'hd5d5aa7c
Definition: gtx_wrap.v:1141
[1:0] 14978charisk
Definition: gtx_wrap.v:1124
wire 14741rst
Definition: gtx_8x10enc.v:40
wire [15:0] 14744indata
Definition: gtx_8x10enc.v:43
14966datascope_post_cntrreg[ADDRESS_BITS-1:0]
Definition: gtx_wrap.v:1069
14897txelecidle_gtxwire
Definition: gtx_wrap.v:177
15006X_RDY_PRIM32'h5757b57c
Definition: gtx_wrap.v:1154
14938clr_alignedwire
Definition: gtx_wrap.v:431
14998PMREQ_S_PRIM32'h7575957c
Definition: gtx_wrap.v:1146
14936set_alignedwire
Definition: gtx_wrap.v:429
14968datascope_start_rreg[2:0]
Definition: gtx_wrap.v:1071
14944rxcomwakedet_gtxwire
Definition: gtx_wrap.v:476
gtx_8x10enc gtx_8x10enc
Definition: gtx_wrap.v:284
14935state_triggeredreg
Definition: gtx_wrap.v:428
15036is_err_r2reg[3:0]
Definition: gtx_wrap.v:1207
gtxe2_channel_wrapper gtxe2_channel_wrapper
Definition: gtx_wrap.v:568
14994HOLDA_PRIM32'h9595aa7c
Definition: gtx_wrap.v:1142
14871DATA_BYTE_WIDTH4
Definition: gtx_wrap.v:52
wire 14713rst
Definition: gtx_10x8dec.v:40
14976DATASCOPE_POST_MEAS16
Definition: gtx_wrap.v:1121
14939clr_triggeredwire
Definition: gtx_wrap.v:432
14913rxcdrlockwire
Definition: gtx_wrap.v:307
14947txresetdone_rreg
Definition: gtx_wrap.v:523
14924RXDLYSRESETwire
Definition: gtx_wrap.v:369
gtx_comma_align gtx_comma_align
Definition: gtx_wrap.v:446
14905other_controlwire[15:0]
Definition: gtx_wrap.v:187
15033is_err_rreg[2:0]
Definition: gtx_wrap.v:1203
15045wenreg[NUM_NIBBLES-1:0]
Definition: gtx_wrap.v:1224
14941rxcharisk_dec_outwire[1:0]
Definition: gtx_wrap.v:461
wire [1:0] 14717outisk
Definition: gtx_10x8dec.v:44
14948txoutclk_gtxwire
Definition: gtx_wrap.v:550
[1:0] 14981not_in_table
Definition: gtx_wrap.v:1127
14883wrap_rxreset_reg
Definition: gtx_wrap.v:147
[1:0] 14660charisk_in
Definition: elastic1632.v:37
14999R_ERR_PRIM32'h5656b57c
Definition: gtx_wrap.v:1147
14920RXPHALIGNwire
Definition: gtx_wrap.v:365
[DATA_WIDTH-1:0] 10741data_in
Definition: resync_data.v:56
txdata_resynchro resync_data[generate]
Definition: gtx_wrap.v:215
14918rxdata_comma_inwire[19:0]
Definition: gtx_wrap.v:357
wire [19:0] 14745outdata
Definition: gtx_8x10enc.v:44
[1:0] 14982disp_err
Definition: gtx_wrap.v:1128
reg 10743valid
Definition: resync_data.v:58
14876RXDFELPMRESET_TIME7'hf
Definition: gtx_wrap.v:57
14875RXCDRFREQRESET_TIME5'h1
Definition: gtx_wrap.v:56
14873RXPMARESET_TIME5'h11
Definition: gtx_wrap.v:54
14900drp_selreg[1:0]
Definition: gtx_wrap.v:182
15001R_OK_PRIM32'h3535b57c
Definition: gtx_wrap.v:1149
14949xclk_gtxwire
Definition: gtx_wrap.v:551
15004SYNC_PRIM32'hb5b5957c
Definition: gtx_wrap.v:1152
14887rxdisperr_gtxwire[7:0]
Definition: gtx_wrap.v:154
14928RXDDIENwire
Definition: gtx_wrap.v:373
15030is_err_wwire[2:0]
Definition: gtx_wrap.v:1199
wire [19:0] 14763indata
14996PMNAK_PRIM32'hf5f5957c
Definition: gtx_wrap.v:1144
14888txdata_gtxwire[63:0]
Definition: gtx_wrap.v:155
15044trig_rreg[2:0]
Definition: gtx_wrap.v:1223