1 |
39 |
fisher5090 |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// MODULE NAME: rxRSIO ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// DESCRIPTION: Datapath of Reconciliation Sublayer. ////
|
6 |
|
|
//// ////
|
7 |
|
|
//// ////
|
8 |
|
|
//// This file is part of the 10 Gigabit Ethernet IP core project ////
|
9 |
|
|
//// http://www.opencores.org/projects/ethmac10g/ ////
|
10 |
|
|
//// ////
|
11 |
|
|
//// AUTHOR(S): ////
|
12 |
|
|
//// Zheng Cao ////
|
13 |
|
|
//// ////
|
14 |
|
|
//////////////////////////////////////////////////////////////////////
|
15 |
|
|
//// ////
|
16 |
|
|
//// Copyright (c) 2005 AUTHORS. All rights reserved. ////
|
17 |
|
|
//// ////
|
18 |
|
|
//// This source file may be used and distributed without ////
|
19 |
|
|
//// restriction provided that this copyright statement is not ////
|
20 |
|
|
//// removed from the file and that any derivative work contains ////
|
21 |
|
|
//// the original copyright notice and the associated disclaimer. ////
|
22 |
|
|
//// ////
|
23 |
|
|
//// This source file is free software; you can redistribute it ////
|
24 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
25 |
|
|
//// Public License as published by the Free Software Foundation; ////
|
26 |
|
|
//// either version 2.1 of the License, or (at your option) any ////
|
27 |
|
|
//// later version. ////
|
28 |
|
|
//// ////
|
29 |
|
|
//// This source is distributed in the hope that it will be ////
|
30 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
31 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
32 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
33 |
|
|
//// details. ////
|
34 |
|
|
//// ////
|
35 |
|
|
//// You should have received a copy of the GNU Lesser General ////
|
36 |
|
|
//// Public License along with this source; if not, download it ////
|
37 |
|
|
//// from http://www.opencores.org/lgpl.shtml ////
|
38 |
|
|
//// ////
|
39 |
|
|
//////////////////////////////////////////////////////////////////////
|
40 |
|
|
//
|
41 |
|
|
// CVS REVISION HISTORY:
|
42 |
|
|
//
|
43 |
|
|
// $Log: not supported by cvs2svn $
|
44 |
|
|
// Revision 1.1 2005/12/25 16:43:10 Zheng Cao
|
45 |
|
|
//
|
46 |
|
|
//
|
47 |
|
|
//
|
48 |
|
|
//////////////////////////////////////////////////////////////////////
|
49 |
|
|
|
50 |
|
|
`include "timescale.v"
|
51 |
|
|
`include "xgiga_define.v"
|
52 |
|
|
|
53 |
|
|
module rxRSIO(rxclk, rxclk_180, reset, rxd_in, rxc_in, rxd64, rxc8, local_fault, remote_fault);
|
54 |
|
|
input rxclk;
|
55 |
|
|
input rxclk_180;
|
56 |
|
|
input reset;
|
57 |
|
|
input [31:0] rxd_in;
|
58 |
|
|
input [3:0] rxc_in;
|
59 |
|
|
output [63:0] rxd64;
|
60 |
|
|
output [7:0] rxc8;
|
61 |
|
|
output local_fault;
|
62 |
|
|
output remote_fault;
|
63 |
|
|
|
64 |
|
|
parameter TP =1;
|
65 |
|
|
|
66 |
|
|
reg local_fault, remote_fault;
|
67 |
|
|
// wire get_align, get_seq;
|
68 |
|
|
|
69 |
|
|
always@(posedge rxclk or posedge reset) begin
|
70 |
|
|
if(reset) begin
|
71 |
|
|
local_fault <=#TP 0;
|
72 |
|
|
remote_fault <=#TP 0;
|
73 |
|
|
end
|
74 |
|
|
else begin
|
75 |
|
|
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];
|
76 |
|
|
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];
|
77 |
|
|
end
|
78 |
|
|
end
|
79 |
|
|
// assign get_align = ((rxd_in[7:0]==`START) & rxc_in[0]) & ((rxd_in[15:8]==`PREAMBLE) & ~rxc_in[1]);
|
80 |
|
|
// assign get_seq = (rxd_in[7:0] == `SEQUENCE) & (rxd_in[29:8] == 0) & (rxc_in[3:0]== 4'h8) & rxd_in[31];
|
81 |
|
|
// assign local_fault = get_seq & ~rxd_in[30];
|
82 |
|
|
// assign remote_fault = get_seq & rxd_in[30];
|
83 |
|
|
|
84 |
|
|
reg[7:0] rxc8_in_tmp;
|
85 |
|
|
reg[63:0]rxd64_in_tmp;
|
86 |
|
|
|
87 |
|
|
// reg get_align_reg;
|
88 |
|
|
// always@(posedge rxclk_180 or posedge reset) begin
|
89 |
|
|
// if (reset)
|
90 |
|
|
// get_align_reg <=#TP 0;
|
91 |
|
|
// else if(get_align)
|
92 |
|
|
// get_align_reg <=#TP 1'b1;
|
93 |
|
|
// else
|
94 |
|
|
// get_align_reg <=#TP get_align_reg;
|
95 |
|
|
// end
|
96 |
|
|
|
97 |
|
|
always@(posedge rxclk_180) begin
|
98 |
|
|
if (reset)begin
|
99 |
|
|
rxd64_in_tmp[63:32] <=#TP 0;
|
100 |
|
|
rxc8_in_tmp[7:4] <=#TP 0;
|
101 |
|
|
end
|
102 |
|
|
else begin
|
103 |
|
|
rxd64_in_tmp[63:32] <=#TP rxd_in;
|
104 |
|
|
rxc8_in_tmp[7:4] <=#TP rxc_in;
|
105 |
|
|
end
|
106 |
|
|
end
|
107 |
|
|
|
108 |
|
|
always@(posedge rxclk) begin
|
109 |
|
|
if (reset)begin
|
110 |
|
|
rxd64_in_tmp[31:0] <=#TP 0;
|
111 |
|
|
rxc8_in_tmp[3:0] <=#TP 0;
|
112 |
|
|
end
|
113 |
|
|
else begin
|
114 |
|
|
rxd64_in_tmp[31:0] <=#TP rxd_in;
|
115 |
|
|
rxc8_in_tmp[3:0] <=#TP rxc_in;
|
116 |
|
|
end
|
117 |
|
|
end
|
118 |
|
|
|
119 |
|
|
reg[63:0] rxd64;
|
120 |
|
|
reg[7:0] rxc8;
|
121 |
|
|
always@(posedge rxclk) begin
|
122 |
|
|
// if(reset) begin
|
123 |
|
|
// rxc8<=#TP 0;
|
124 |
|
|
// rxd64 <=#TP 0;
|
125 |
|
|
// end
|
126 |
|
|
// else begin
|
127 |
|
|
rxc8<=#TP rxc8_in_tmp;
|
128 |
|
|
rxd64 <=#TP rxd64_in_tmp;
|
129 |
|
|
// end
|
130 |
|
|
end
|
131 |
|
|
|
132 |
|
|
|
133 |
|
|
endmodule
|