OpenCores
URL https://opencores.org/ocsvn/ethmac10g/ethmac10g/trunk

Subversion Repositories ethmac10g

[/] [ethmac10g/] [trunk/] [rtl/] [verilog/] [rx_engine/] [rxRSIO.v] - Blame information for rev 72

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 39 fisher5090
//////////////////////////////////////////////////////////////////////
2 69 fisher5090
////                                                              ////
3
//// MODULE NAME: rxRSIO                                          ////
4
////                                                              ////
5 39 fisher5090
//// DESCRIPTION: Datapath of Reconciliation Sublayer.            ////
6
////                                                              ////
7 69 fisher5090
////                                                              ////
8 39 fisher5090
//// This file is part of the 10 Gigabit Ethernet IP core project ////
9 69 fisher5090
////  http://www.opencores.org/projects/ethmac10g/                ////
10
////                                                              ////
11
//// AUTHOR(S):                                                   ////
12
//// Zheng Cao                                                    ////
13
////                                                              ////
14 39 fisher5090
//////////////////////////////////////////////////////////////////////
15 69 fisher5090
////                                                              ////
16
//// Copyright (c) 2005 AUTHORS.  All rights reserved.            ////
17
////                                                              ////
18 39 fisher5090
//// 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 69 fisher5090
//// from http://www.opencores.org/lgpl.shtml                     ////
38
////                                                              ////
39 39 fisher5090
//////////////////////////////////////////////////////////////////////
40
//
41
// CVS REVISION HISTORY:
42
//
43
// $Log: not supported by cvs2svn $
44 71 fisher5090
// Revision 1.2  2006/06/16 06:36:28  fisher5090
45
// no message
46
//
47 69 fisher5090
// Revision 1.1.1.1  2006/05/31 05:59:43  Zheng Cao
48
// first version
49
//
50 39 fisher5090
// Revision 1.1  2005/12/25 16:43:10  Zheng Cao
51
// 
52
// 
53
//
54
//////////////////////////////////////////////////////////////////////
55
 
56
`include "timescale.v"
57
`include "xgiga_define.v"
58
 
59 71 fisher5090
module rxRSIO(rxclk, rxclk_180, rxclk_2x, reset, rxd_in, rxc_in, rxd64, rxc8, local_fault, remote_fault);
60 39 fisher5090
    input rxclk;
61 69 fisher5090
    input rxclk_180;
62 71 fisher5090
    input rxclk_2x;
63 69 fisher5090
    input reset;
64 39 fisher5090
    input [31:0] rxd_in;
65 69 fisher5090
    input [3:0] rxc_in;
66 39 fisher5090
    output [63:0] rxd64;
67
    output [7:0] rxc8;
68 69 fisher5090
    output local_fault;
69
    output remote_fault;
70 39 fisher5090
 
71 69 fisher5090
    parameter TP =1;
72 39 fisher5090
 
73 69 fisher5090
    reg local_fault, remote_fault;
74
//  wire get_align, get_seq;
75 39 fisher5090
 
76 69 fisher5090
    always@(posedge rxclk or posedge reset) begin
77
          if(reset) begin
78
            local_fault <=#TP 0;
79
            remote_fault <=#TP 0;
80
          end
81
          else begin
82
            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];
83
            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];
84
          end
85
    end
86 71 fisher5090
//    assign get_align = ((rxd_in[7:0]==`START) & rxc_in[0]);
87 69 fisher5090
//  assign get_seq = (rxd_in[7:0] == `SEQUENCE) & (rxd_in[29:8] == 0) & (rxc_in[3:0]== 4'h8) & rxd_in[31];
88
//  assign local_fault = get_seq & ~rxd_in[30];
89
//  assign remote_fault = get_seq & rxd_in[30];
90
 
91
    reg[7:0] rxc8_in_tmp;
92
    reg[63:0]rxd64_in_tmp;
93 71 fisher5090
    reg[3:0] rxc4_in_tmp;
94
    reg[31:0]rxd32_in_tmp;
95
    reg[31:0]rxd32_in_tmp_d1;
96
    reg[3:0] rxc4_in_tmp_d1;
97
 
98
    always@(posedge rxclk_2x or posedge reset) begin
99
         if (reset) begin
100
           rxc4_in_tmp  <= #TP 0;
101
           rxd32_in_tmp <= #TP 0;
102
           rxc4_in_tmp_d1  <= #TP 0;
103
           rxd32_in_tmp_d1 <= #TP 0;
104
         end
105
         else begin
106
           rxc4_in_tmp  <= #TP rxc_in;
107
           rxd32_in_tmp <= #TP rxd_in;
108
           rxc4_in_tmp_d1  <= #TP rxc4_in_tmp;
109
           rxd32_in_tmp_d1 <= #TP rxd32_in_tmp;
110
         end
111
    end
112
 
113
    reg get_align_reg;
114
    always@(posedge rxclk_2x or posedge reset) begin
115
         if (reset)
116
           get_align_reg <=#TP 0;
117
         else if((rxd32_in_tmp[7:0]==`START) & rxc4_in_tmp[0])
118
           get_align_reg <=#TP 1'b1;
119
         else if((&rxc4_in_tmp)&(rxd32_in_tmp==32'h07070707))
120
           get_align_reg <=#TP 1'b0;
121
    end
122
 
123
    reg [1:0] qvWriteCntrl;
124
    always@(posedge rxclk_2x or posedge reset) begin
125
         if (reset)
126
            qvWriteCntrl <= 2'b01;
127
         else if(get_align_reg) begin
128
            qvWriteCntrl[1] <= qvWriteCntrl[0];
129
            qvWriteCntrl[0] <= qvWriteCntrl[1];
130
         end
131
         else
132
            qvWriteCntrl <= 2'b01;
133
    end
134
 
135
    always@(posedge rxclk_2x or posedge reset) begin
136 69 fisher5090
         if (reset)begin
137 71 fisher5090
           rxd64_in_tmp <= #TP 0;
138
           rxc8_in_tmp  <= #TP 0;
139 69 fisher5090
         end
140 71 fisher5090
         else if(qvWriteCntrl[1]) begin
141
           rxd64_in_tmp[63:32] <= #TP rxd32_in_tmp_d1;
142
           rxc8_in_tmp[7:4] <= #TP rxc4_in_tmp_d1;
143
         end
144 69 fisher5090
         else begin
145 71 fisher5090
           rxd64_in_tmp[31:0] <= #TP rxd32_in_tmp_d1;
146
           rxc8_in_tmp[3:0] <= #TP rxc4_in_tmp_d1;
147 69 fisher5090
         end
148
    end
149 71 fisher5090
 
150
  wire [71:0] rxdata;
151
 
152
  assign rxd64 = rxdata[63:0];
153
  assign rxc8  = rxdata[71:64];
154
 
155
  defparam RealignInst.pDepthWidth = 5;
156
  defparam RealignInst.pWordWidth = 72;
157
  SwitchAsyncFIFO RealignInst(
158
                  .inReset(!reset),
159
                  .iWClk(rxclk_2x),
160
                  .iWEn(qvWriteCntrl[0]),
161
                  .ivDataIn({rxc8_in_tmp,rxd64_in_tmp}),
162
                  .qWFull(),
163
                  .qvWCount(),
164
                  .iRClk(rxclk),
165
                  .iREn(1'b1),
166
                  .ovDataOut(rxdata),
167
                  .qREmpty(),
168
                  .qvRNumberLeft()
169
  );
170
 
171 39 fisher5090
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.