//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//// ////
|
//// ////
|
//// MODULE NAME: rxRSIO ////
|
//// MODULE NAME: rxRSIO ////
|
//// ////
|
//// ////
|
//// DESCRIPTION: Datapath of Reconciliation Sublayer. ////
|
//// DESCRIPTION: Datapath of Reconciliation Sublayer. ////
|
//// ////
|
//// ////
|
//// ////
|
//// ////
|
//// This file is part of the 10 Gigabit Ethernet IP core project ////
|
//// This file is part of the 10 Gigabit Ethernet IP core project ////
|
//// http://www.opencores.org/projects/ethmac10g/ ////
|
//// http://www.opencores.org/projects/ethmac10g/ ////
|
//// ////
|
//// ////
|
//// AUTHOR(S): ////
|
//// AUTHOR(S): ////
|
//// Zheng Cao ////
|
//// Zheng Cao ////
|
//// ////
|
//// ////
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//// ////
|
//// ////
|
//// Copyright (c) 2005 AUTHORS. All rights reserved. ////
|
//// Copyright (c) 2005 AUTHORS. All rights reserved. ////
|
//// ////
|
//// ////
|
//// This source file may be used and distributed without ////
|
//// This source file may be used and distributed without ////
|
//// restriction provided that this copyright statement is not ////
|
//// restriction provided that this copyright statement is not ////
|
//// removed from the file and that any derivative work contains ////
|
//// removed from the file and that any derivative work contains ////
|
//// the original copyright notice and the associated disclaimer. ////
|
//// the original copyright notice and the associated disclaimer. ////
|
//// ////
|
//// ////
|
//// This source file is free software; you can redistribute it ////
|
//// This source file is free software; you can redistribute it ////
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
//// Public License as published by the Free Software Foundation; ////
|
//// Public License as published by the Free Software Foundation; ////
|
//// either version 2.1 of the License, or (at your option) any ////
|
//// either version 2.1 of the License, or (at your option) any ////
|
//// later version. ////
|
//// later version. ////
|
//// ////
|
//// ////
|
//// This source is distributed in the hope that it will be ////
|
//// This source is distributed in the hope that it will be ////
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
//// details. ////
|
//// details. ////
|
//// ////
|
//// ////
|
//// You should have received a copy of the GNU Lesser General ////
|
//// You should have received a copy of the GNU Lesser General ////
|
//// Public License along with this source; if not, download it ////
|
//// Public License along with this source; if not, download it ////
|
//// from http://www.opencores.org/lgpl.shtml ////
|
//// from http://www.opencores.org/lgpl.shtml ////
|
//// ////
|
//// ////
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//
|
//
|
// CVS REVISION HISTORY:
|
// CVS REVISION HISTORY:
|
//
|
//
|
// $Log: not supported by cvs2svn $
|
// $Log: not supported by cvs2svn $
|
// Revision 1.2 2006/06/16 06:36:28 fisher5090
|
// Revision 1.2 2006/06/16 06:36:28 fisher5090
|
// no message
|
// no message
|
//
|
//
|
// Revision 1.1.1.1 2006/05/31 05:59:43 Zheng Cao
|
// Revision 1.1.1.1 2006/05/31 05:59:43 Zheng Cao
|
// first version
|
// first version
|
//
|
//
|
// Revision 1.1 2005/12/25 16:43:10 Zheng Cao
|
// Revision 1.1 2005/12/25 16:43:10 Zheng Cao
|
//
|
//
|
//
|
//
|
//
|
//
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
|
|
`include "timescale.v"
|
`include "timescale.v"
|
`include "xgiga_define.v"
|
`include "xgiga_define.v"
|
|
|
module rxRSIO(rxclk, rxclk_180, rxclk_2x, reset, rxd_in, rxc_in, rxd64, rxc8, local_fault, remote_fault);
|
module rxRSIO(rxclk, rxclk_180, rxclk_2x, reset, rxd_in, rxc_in, rxd64, rxc8, local_fault, remote_fault);
|
input rxclk;
|
input rxclk;
|
input rxclk_180;
|
input rxclk_180;
|
input rxclk_2x;
|
input rxclk_2x;
|
input reset;
|
input reset;
|
input [31:0] rxd_in;
|
input [31:0] rxd_in;
|
input [3:0] rxc_in;
|
input [3:0] rxc_in;
|
output [63:0] rxd64;
|
output [63:0] rxd64;
|
output [7:0] rxc8;
|
output [7:0] rxc8;
|
output local_fault;
|
output local_fault;
|
output remote_fault;
|
output remote_fault;
|
|
|
parameter TP =1;
|
parameter TP =1;
|
|
|
reg local_fault, remote_fault;
|
reg local_fault, remote_fault;
|
// wire get_align, get_seq;
|
// wire get_align, get_seq;
|
|
|
always@(posedge rxclk or posedge reset) begin
|
always@(posedge rxclk or posedge reset) begin
|
if(reset) begin
|
if(reset) begin
|
local_fault <=#TP 0;
|
local_fault <=#TP 0;
|
remote_fault <=#TP 0;
|
remote_fault <=#TP 0;
|
end
|
end
|
else begin
|
else begin
|
local_fault <=#TP (rxd_in[7:0] == `SEQUENCE) & (rxd_in[29:8] == 0) & (rxc_in[3:0]== 4'h8) & ~rxd_in[30] & rxd_in[31];
|
local_fault <=#TP (rxd_in[7:0] == `SEQUENCE) & (rxd_in[29:8] == 0) & (rxc_in[3:0]== 4'h8) & ~rxd_in[30] & rxd_in[31];
|
remote_fault<=#TP (rxd_in[7:0] == `SEQUENCE) & (rxd_in[29:8] == 0) & (rxc_in[3:0]== 4'h8) & rxd_in[30] & rxd_in[31];
|
remote_fault<=#TP (rxd_in[7:0] == `SEQUENCE) & (rxd_in[29:8] == 0) & (rxc_in[3:0]== 4'h8) & rxd_in[30] & rxd_in[31];
|
end
|
end
|
end
|
end
|
// assign get_align = ((rxd_in[7:0]==`START) & rxc_in[0]);
|
// assign get_align = ((rxd_in[7:0]==`START) & rxc_in[0]);
|
// assign get_seq = (rxd_in[7:0] == `SEQUENCE) & (rxd_in[29:8] == 0) & (rxc_in[3:0]== 4'h8) & rxd_in[31];
|
// assign get_seq = (rxd_in[7:0] == `SEQUENCE) & (rxd_in[29:8] == 0) & (rxc_in[3:0]== 4'h8) & rxd_in[31];
|
// assign local_fault = get_seq & ~rxd_in[30];
|
// assign local_fault = get_seq & ~rxd_in[30];
|
// assign remote_fault = get_seq & rxd_in[30];
|
// assign remote_fault = get_seq & rxd_in[30];
|
|
|
reg[7:0] rxc8_in_tmp;
|
reg[7:0] rxc8_in_tmp;
|
reg[63:0]rxd64_in_tmp;
|
reg[63:0]rxd64_in_tmp;
|
reg[3:0] rxc4_in_tmp;
|
reg[3:0] rxc4_in_tmp;
|
reg[31:0]rxd32_in_tmp;
|
reg[31:0]rxd32_in_tmp;
|
reg[31:0]rxd32_in_tmp_d1;
|
reg[31:0]rxd32_in_tmp_d1;
|
reg[3:0] rxc4_in_tmp_d1;
|
reg[3:0] rxc4_in_tmp_d1;
|
|
|
always@(posedge rxclk_2x or posedge reset) begin
|
always@(posedge rxclk_2x or posedge reset) begin
|
if (reset) begin
|
if (reset) begin
|
rxc4_in_tmp <= #TP 0;
|
rxc4_in_tmp <= #TP 0;
|
rxd32_in_tmp <= #TP 0;
|
rxd32_in_tmp <= #TP 0;
|
rxc4_in_tmp_d1 <= #TP 0;
|
rxc4_in_tmp_d1 <= #TP 0;
|
rxd32_in_tmp_d1 <= #TP 0;
|
rxd32_in_tmp_d1 <= #TP 0;
|
end
|
end
|
else begin
|
else begin
|
rxc4_in_tmp <= #TP rxc_in;
|
rxc4_in_tmp <= #TP rxc_in;
|
rxd32_in_tmp <= #TP rxd_in;
|
rxd32_in_tmp <= #TP rxd_in;
|
rxc4_in_tmp_d1 <= #TP rxc4_in_tmp;
|
rxc4_in_tmp_d1 <= #TP rxc4_in_tmp;
|
rxd32_in_tmp_d1 <= #TP rxd32_in_tmp;
|
rxd32_in_tmp_d1 <= #TP rxd32_in_tmp;
|
end
|
end
|
end
|
end
|
|
|
reg get_align_reg;
|
reg get_align_reg;
|
always@(posedge rxclk_2x or posedge reset) begin
|
always@(posedge rxclk_2x or posedge reset) begin
|
if (reset)
|
if (reset)
|
get_align_reg <=#TP 0;
|
get_align_reg <=#TP 0;
|
else if((rxd32_in_tmp[7:0]==`START) & rxc4_in_tmp[0])
|
else if((rxd32_in_tmp[7:0]==`START) & rxc4_in_tmp[0])
|
get_align_reg <=#TP 1'b1;
|
get_align_reg <=#TP 1'b1;
|
else if((&rxc4_in_tmp)&(rxd32_in_tmp==32'h07070707))
|
else if((&rxc4_in_tmp)&(rxd32_in_tmp==32'h07070707))
|
get_align_reg <=#TP 1'b0;
|
get_align_reg <=#TP 1'b0;
|
end
|
end
|
|
|
reg [1:0] qvWriteCntrl;
|
reg [1:0] qvWriteCntrl;
|
always@(posedge rxclk_2x or posedge reset) begin
|
always@(posedge rxclk_2x or posedge reset) begin
|
if (reset)
|
if (reset)
|
qvWriteCntrl <= 2'b01;
|
qvWriteCntrl <= 2'b01;
|
else if(get_align_reg) begin
|
else if(get_align_reg) begin
|
qvWriteCntrl[1] <= qvWriteCntrl[0];
|
qvWriteCntrl[1] <= qvWriteCntrl[0];
|
qvWriteCntrl[0] <= qvWriteCntrl[1];
|
qvWriteCntrl[0] <= qvWriteCntrl[1];
|
end
|
end
|
else
|
else
|
qvWriteCntrl <= 2'b01;
|
qvWriteCntrl <= 2'b01;
|
end
|
end
|
|
|
always@(posedge rxclk_2x or posedge reset) begin
|
always@(posedge rxclk_2x or posedge reset) begin
|
if (reset)begin
|
if (reset)begin
|
rxd64_in_tmp <= #TP 0;
|
rxd64_in_tmp <= #TP 0;
|
rxc8_in_tmp <= #TP 0;
|
rxc8_in_tmp <= #TP 0;
|
end
|
end
|
else if(qvWriteCntrl[1]) begin
|
else if(qvWriteCntrl[1]) begin
|
rxd64_in_tmp[63:32] <= #TP rxd32_in_tmp_d1;
|
rxd64_in_tmp[63:32] <= #TP rxd32_in_tmp_d1;
|
rxc8_in_tmp[7:4] <= #TP rxc4_in_tmp_d1;
|
rxc8_in_tmp[7:4] <= #TP rxc4_in_tmp_d1;
|
end
|
end
|
else begin
|
else begin
|
rxd64_in_tmp[31:0] <= #TP rxd32_in_tmp_d1;
|
rxd64_in_tmp[31:0] <= #TP rxd32_in_tmp_d1;
|
rxc8_in_tmp[3:0] <= #TP rxc4_in_tmp_d1;
|
rxc8_in_tmp[3:0] <= #TP rxc4_in_tmp_d1;
|
end
|
end
|
end
|
end
|
|
|
wire [71:0] rxdata;
|
wire [71:0] rxdata;
|
|
|
assign rxd64 = rxdata[63:0];
|
assign rxd64 = rxdata[63:0];
|
assign rxc8 = rxdata[71:64];
|
assign rxc8 = rxdata[71:64];
|
|
|
defparam RealignInst.pDepthWidth = 5;
|
defparam RealignInst.pDepthWidth = 5;
|
defparam RealignInst.pWordWidth = 72;
|
defparam RealignInst.pWordWidth = 72;
|
SwitchAsyncFIFO RealignInst(
|
SwitchAsyncFIFO RealignInst(
|
.inReset(!reset),
|
.inReset(!reset),
|
.iWClk(rxclk_2x),
|
.iWClk(rxclk_2x),
|
.iWEn(qvWriteCntrl[0]),
|
.iWEn(qvWriteCntrl[0]),
|
.ivDataIn({rxc8_in_tmp,rxd64_in_tmp}),
|
.ivDataIn({rxc8_in_tmp,rxd64_in_tmp}),
|
.qWFull(),
|
.qWFull(),
|
.qvWCount(),
|
.qvWCount(),
|
.iRClk(rxclk),
|
.iRClk(rxclk),
|
.iREn(1'b1),
|
.iREn(1'b1),
|
.ovDataOut(rxdata),
|
.ovDataOut(rxdata),
|
.qREmpty(),
|
.qREmpty(),
|
.qvRNumberLeft()
|
.qvRNumberLeft()
|
);
|
);
|
|
|
endmodule
|
endmodule
|
|
|