txdata_resync_strobe <= ~wrap_txreset_ ? 1'b0 : ((~txdata_resync_nempty) ? txdata_resync_strobe : ~txdata_resync_strobe); // -> 1 once every resynced dword = signal to latch it
end
// nempty_rr & nempty => shall be at least 2 elements in fifo
// elastic buffer: transition from xclk to rxusrclk
wire[15:0]rxdata_els_out;
wire[1:0]rxcharisk_els_out;
wire[1:0]rxnotintable_els_out;
wire[1:0]rxdisperr_els_out;
wirelword_strobe;
wireisaligned;
wireelastic_full;
wireelastic_empty;
gtx_elastic#(
.DEPTH_LOG2(3),
.OFFSET(4)
)
gtx_elastic(
// .rst (~rx_clocks_aligned), // ~wrap_rxreset_),
.rst(~wrap_rxreset_),
.wclk(xclk),
.rclk(rxusrclk),
/// .isaligned_in (state_aligned),
.isaligned_in(state_aligned&&rxdlysresetdone_r),// rx_clocks_aligned), //Allow to align early, but do not tell it is aligned until xclk is aligned to SIPO par. clock
.charisk_in(rxcharisk_dec_out),
.notintable_in(rxnotintable_dec_out),
.disperror_in(rxdisperr_dec_out),
.data_in(rxdata_dec_out),
.isaligned_out(isaligned),
.charisk_out(rxcharisk_els_out),
.notintable_out(rxnotintable_els_out),
.disperror_out(rxdisperr_els_out),
.data_out(rxdata_els_out),
.lword_strobe(lword_strobe),
.full(elastic_full),
.empty(elastic_empty)
);
// iface resync
// iface resync
/*
output wire cplllock, - async
output wire rxbyteisaligned,- rxusrclk2
output wire rxcomwakedet, - rxusrclk2
output wire rxcominitdet, - rxusrclk2
output wire rxelecidle, - async
output wire rxresetdone, - rxusrclk2
output wire txresetdone, - txusrclk2
*/
wirerxcomwakedet_gtx;
wirerxcomwakedet_gtx;
wirerxcominitdet_gtx;
wirerxcominitdet_gtx;
regrxcomwakedet_gtx_r;
regrxcominitdet_gtx_r;
`ifdefOLD_ELASTIC
// insert resync if it's necessary
generate
// elastic buffer: transition from xclk to rxusrclk
if(DATA_BYTE_WIDTH==4)begin
wire[15:0]rxdata_els_out;
// resync to rxusrclk
wire[1:0]rxcharisk_els_out;
// Fin = 2*Fout => 2*WIDTHin = WIDTHout
wire[1:0]rxnotintable_els_out;
// first data word arrived = last word of a primitive, second arrived - first one
wire[1:0]rxdisperr_els_out;
// lword_strobe indicates that second data word is arrived
.isaligned_in(state_aligned&&rxdlysresetdone_r),// rx_clocks_aligned), //Allow to align early, but do not tell it is aligned until xclk is aligned to SIPO par. clock
.re(rxdata_resync_nempty&rxdata_resync_nempty_r),
.charisk_in(rxcharisk_dec_out),
.data_in(rxdata_resync_in),
.notintable_in(rxnotintable_dec_out),
.data_out(rxdata_resync_out),
.disperror_in(rxdisperr_dec_out),
.nempty(rxdata_resync_nempty),
.data_in(rxdata_dec_out),
.half_empty()
.isaligned_out(isaligned),
.charisk_out(rxcharisk_els_out),
.notintable_out(rxnotintable_els_out),
.disperror_out(rxdisperr_els_out),
.data_out(rxdata_els_out),
.lword_strobe(lword_strobe),
.full(elastic_full),
.empty(elastic_empty)
);
);
assignrxbyteisaligned=rxdata_resync_out[50];
// iface resync
regrxcomwakedet_gtx_r;
regrxcominitdet_gtx_r;
// insert resync if it's necessary
generate
if(DATA_BYTE_WIDTH==4)begin
// resync to rxusrclk
// Fin = 2*Fout => 2*WIDTHin = WIDTHout
// first data word arrived = last word of a primitive, second arrived - first one
// lword_strobe indicates that second data word is arrived