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

Subversion Repositories ethmac10g

[/] [ethmac10g/] [trunk/] [rtl/] [verilog/] [rx_engine/] [rxDataPath.v] - Blame information for rev 63

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 39 fisher5090
//////////////////////////////////////////////////////////////////////
2
////                                                                                                                                                                    ////
3
//// MODULE NAME: Data Path of Receive Module                                                   ////
4
////                                                                                                                                                                    ////
5
//// DESCRIPTION: Data path of Receive Engine of 10 Gigabit       ////
6
////     Ethernet MAC. Used to recognize every field of a         ////
7
////     frame, including SOF, EOF, Length, Destination Addr            ////
8
////     , Source Addr and Data field.                            ////
9
////                                                                                                                                                                    ////
10
//// This file is part of the 10 Gigabit Ethernet IP core project ////
11
////  http://www.opencores.org/projects/ethmac10g/                                              ////
12
////                                                                                                                                                                    ////
13
//// AUTHOR(S):                                                                                                                                 ////
14
//// Zheng Cao                                                               ////
15
////                                                                                                    ////
16
//////////////////////////////////////////////////////////////////////
17
////                                                                                                                                                                    ////
18
//// Copyright (c) 2005 AUTHORS.  All rights reserved.                     ////
19
////                                                                                                                                                                    ////
20
//// This source file may be used and distributed without         ////
21
//// restriction provided that this copyright statement is not    ////
22
//// removed from the file and that any derivative work contains  ////
23
//// the original copyright notice and the associated disclaimer. ////
24
////                                                              ////
25
//// This source file is free software; you can redistribute it   ////
26
//// and/or modify it under the terms of the GNU Lesser General   ////
27
//// Public License as published by the Free Software Foundation; ////
28
//// either version 2.1 of the License, or (at your option) any   ////
29
//// later version.                                               ////
30
////                                                              ////
31
//// This source is distributed in the hope that it will be       ////
32
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
33
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
34
//// PURPOSE.  See the GNU Lesser General Public License for more ////
35
//// details.                                                     ////
36
////                                                              ////
37
//// You should have received a copy of the GNU Lesser General    ////
38
//// Public License along with this source; if not, download it   ////
39
//// from http://www.opencores.org/lgpl.shtml                                                   ////
40
////                                                                                                                                                                    ////
41
//////////////////////////////////////////////////////////////////////
42
//
43
// CVS REVISION HISTORY:
44
//
45
// $Log: not supported by cvs2svn $
46
// Revision 1.1  2005/12/25 16:43:10  Zheng Cao
47
// 
48
// 
49
//
50
//////////////////////////////////////////////////////////////////////
51
 
52
`include "timescale.v"
53
`include "xgiga_define.v"
54
 
55
module rxDataPath(rxclk, reset, rxd64, rxc8, inband_fcs, receiving, start_da, start_lt, wait_crc_check, get_sfd,
56
                  get_terminator, get_error_code, tagged_frame, pause_frame, da_addr, terminator_location, CRC_DATA,
57
                                                rx_data_valid, rx_data,get_terminator_d1, bad_frame_get, good_frame_get,check_reset,rx_good_frame,rx_bad_frame);
58
//                                    fcTxPauseData);
59
    input rxclk;
60
    input reset;
61
    input [63:0] rxd64;
62
    input [7:0] rxc8;
63
         input inband_fcs;
64
         input receiving;
65
         input start_da;
66
         input start_lt;
67
         input wait_crc_check;
68
         input get_terminator_d1;
69
         input bad_frame_get;
70
         input good_frame_get;
71
 
72
         output get_sfd;
73
         output get_terminator; //get T indicator
74
         output get_error_code; //get Error indicator
75
    output tagged_frame;
76
         output pause_frame;
77
         output[47:0] da_addr;
78
         output[2:0] terminator_location;
79
    output[63:0] CRC_DATA;
80
         output[7:0] rx_data_valid;
81
         output[63:0] rx_data;
82
         output check_reset;
83
         output rx_good_frame;
84
         output rx_bad_frame;
85
//       output [31:0]fcTxPauseData;
86
 
87
         parameter TP = 1;
88 52 fisher5090
         parameter IDLE = 0, READ = 2, WAIT_TMP = 3, WAIT = 1;
89 39 fisher5090
 
90
         //////////////////////////////////////////////
91
         // Pipe Line Stage
92
         //////////////////////////////////////////////
93
         reg [63:0] rxd64_d1,rxd64_d2,rxd64_d3,CRC_DATA;
94
         reg [7:0] rxc8_d1, rxc8_d2, rxc8_d3;
95
         reg receiving_d1, receiving_d2;
96
         reg wait_crc_check_d1;
97
 
98
//       assign fcTxPauseData = rxd64_d1[31:0];
99
         // Data pipeline
100
         always@(posedge rxclk or posedge reset) begin
101
               if (reset)       begin
102
                                 rxd64_d1<=#TP 0;
103
                                 rxd64_d2<=#TP 0;
104
                                 rxd64_d3<=#TP 0;
105
                         CRC_DATA<=0;
106
 
107
                         end
108
                         else begin
109
                                 rxd64_d1<=#TP rxd64;
110
                                 rxd64_d2<=#TP rxd64_d1;
111
                                 rxd64_d3<=#TP rxd64_d2;
112
                                 CRC_DATA <={rxd64_d2[0],rxd64_d2[1],rxd64_d2[2],rxd64_d2[3],rxd64_d2[4],rxd64_d2[5],rxd64_d2[6],rxd64_d2[7],
113
                        rxd64_d2[8],rxd64_d2[9],rxd64_d2[10],rxd64_d2[11],rxd64_d2[12],rxd64_d2[13],rxd64_d2[14],rxd64_d2[15],
114
                        rxd64_d2[16],rxd64_d2[17],rxd64_d2[18],rxd64_d2[19],rxd64_d2[20],rxd64_d2[21],rxd64_d2[22],rxd64_d2[23],
115
                        rxd64_d2[24],rxd64_d2[25],rxd64_d2[26],rxd64_d2[27],rxd64_d2[28],rxd64_d2[29],rxd64_d2[30],rxd64_d2[31],
116
                        rxd64_d2[32],rxd64_d2[33],rxd64_d2[34],rxd64_d2[35],rxd64_d2[36],rxd64_d2[37],rxd64_d2[38],rxd64_d2[39],
117
                        rxd64_d2[40],rxd64_d2[41],rxd64_d2[42],rxd64_d2[43],rxd64_d2[44],rxd64_d2[45],rxd64_d2[46],rxd64_d2[47],
118
                        rxd64_d2[48],rxd64_d2[49],rxd64_d2[50],rxd64_d2[51],rxd64_d2[52],rxd64_d2[53],rxd64_d2[54],rxd64_d2[55],
119
                        rxd64_d2[56],rxd64_d2[57],rxd64_d2[58],rxd64_d2[59],rxd64_d2[60],rxd64_d2[61],rxd64_d2[62],rxd64_d2[63]};
120
                        end
121
         end
122
         //control pipeline
123
         always@(posedge rxclk or posedge reset)begin
124
              if (reset)        begin
125
                                 rxc8_d1<=#TP 0;
126
                                 rxc8_d2<=#TP 0;
127
                                 rxc8_d3<=#TP 0;
128
                         end
129
                         else begin
130
                                 rxc8_d1<=#TP rxc8;
131
                                 rxc8_d2<=#TP rxc8_d1;
132
                                 rxc8_d3<=#TP rxc8_d2;
133
                         end
134
         end
135
 
136
         always @(posedge rxclk or posedge reset)begin
137
               if (reset) begin
138
                            receiving_d1 <=#TP 0;
139
                                 receiving_d2 <=#TP 0;
140
                                 wait_crc_check_d1 <=#TP 0;
141
                         end
142
                         else   begin
143
                            receiving_d1 <=#TP receiving;
144
                                 receiving_d2 <=#TP receiving_d1;
145
                                 wait_crc_check_d1 <=#TP wait_crc_check;
146
                         end
147
         end
148
 
149
         ////////////////////////////////////////////
150
         // Frame analysis
151
         ////////////////////////////////////////////
152
         reg get_sfd; //get sfd indicator
153
         reg get_terminator; //get T indicator
154
         reg get_error_code; //get Error indicator
155
         reg[7:0] get_e_chk;
156
         reg[7:0] rxc_end_data; //seperate DATA with FCS
157
         reg [2:0]terminator_location; //for n*8bits(n<8), get n
158
         reg[47:0] da_addr; //get Desetination Address
159
         reg tagged_frame;  //Tagged frame indicator(type interpret)
160
         reg pause_frame;   //Pause frame indicator(type interpret)
161
 
162
         //1. SFD 
163
         always@(posedge rxclk or posedge reset) begin
164
               if (reset)
165
                            get_sfd <=#TP 0;
166
                         else
167
                            get_sfd <=#TP (rxd64[7:0] ==`START) & (rxd64[63:56]== `SFD) & (rxc8 == 8'h01);
168
         end
169
 
170
         //2. EFD
171
         reg this_cycle;
172
         // -----------------------------------------------
173
         //|  0  |  1  |  2  |  3  |  4  |  5  |  6  |  7  | 
174
         // -----------------------------------------------
175
         //|<-------- EFD -------->|<-------- EFD -------->|
176
         //|<-- this_cycle = '1' ->|<-- this_cycle = '0' ->|
177
 
178
         always@(posedge rxclk or posedge reset) begin
179
               if (reset)       begin
180
                            get_terminator <=#TP 0;
181
                                 terminator_location <=#TP 0;
182
                            this_cycle <=#TP 1'b0;
183
                            rxc_end_data <=#TP 0;
184
                         end
185
                         else begin
186
                            if (rxc8[0] & (rxd64[7:0]  ==`TERMINATE)) begin
187
                                     get_terminator <=#TP 1'b1;
188
                                          terminator_location <=#TP 0;
189
                                          this_cycle <=#TP 1'b1;
190
                                          rxc_end_data <=#TP 8'b00001111;
191
                            end
192
                            else if (rxc8[1] & (rxd64[15:8] ==`TERMINATE)) begin
193
                                     get_terminator <=#TP 1'b1;
194
                                          terminator_location <=#TP 1;
195
                                          this_cycle <=#TP 1'b1;
196
                                          rxc_end_data <=#TP 8'b00011111;
197
                                 end
198
                                 else if (rxc8[2] & (rxd64[23:16]==`TERMINATE)) begin
199
                 get_terminator <=#TP 1'b1;
200
                                          terminator_location <=#TP 2;
201
                 this_cycle <=#TP 1'b1;
202
                                          rxc_end_data <=#TP 8'b00111111;
203
                                 end
204
                                 else if (rxc8[3] & (rxd64[31:24]==`TERMINATE)) begin
205
                 get_terminator <=#TP 1'b1;
206
                                          terminator_location <=#TP 3;
207
                 this_cycle <=#TP 1'b1;
208
                                          rxc_end_data <=#TP 8'b01111111;
209
                                 end
210
             else if (rxc8[4] & (rxd64[39:32]==`TERMINATE)) begin
211
                                     get_terminator <=#TP 1'b1;
212
                                          terminator_location <=#TP 4;
213
                 this_cycle <=#TP 1'b1;
214
                                          rxc_end_data <=#TP 8'b11111111;
215
                                 end
216
                                 else if (rxc8[5] & (rxd64[47:40]==`TERMINATE)) begin
217
                 get_terminator <=#TP 1'b1;
218
                                          terminator_location <=#TP 5;
219
                                          this_cycle <=#TP 1'b0;
220
                                          rxc_end_data <=#TP 8'b00000001;
221
                                 end
222
                                 else if (rxc8[6] & (rxd64[55:48]==`TERMINATE)) begin
223
                 get_terminator <=#TP 1'b1;
224
                                          terminator_location <=#TP 6;
225
                                          this_cycle <=#TP 1'b0;
226
                                          rxc_end_data <=#TP 8'b00000011;
227
                                 end
228
                                 else if (rxc8[7] & (rxd64[63:56]==`TERMINATE)) begin
229
                 get_terminator <=#TP 1'b1;
230
                                          terminator_location <=#TP 7;
231
                                          this_cycle <=#TP 1'b0;
232
                                          rxc_end_data <=#TP 8'b00000111;
233
                                 end
234
                                 else   begin
235
                                     get_terminator <=#TP 1'b0;
236
                                          terminator_location <=#TP terminator_location;
237
                                          this_cycle <=#TP this_cycle;
238
                                          rxc_end_data <=#TP rxc_end_data;
239
                                 end
240
                         end
241
         end
242
 
243
         //3. Error Character
244
    always@(posedge rxclk or posedge reset) begin
245
               if (reset)
246
                            get_e_chk <=#TP 0;
247
                         else begin
248
                                 get_e_chk[0] <=#TP rxc8[0] & (rxd64[7:0]  ==`ERROR);
249
                            get_e_chk[1] <=#TP rxc8[1] & (rxd64[15:8] ==`ERROR);
250
             get_e_chk[2] <=#TP rxc8[2] & (rxd64[23:16]==`ERROR);
251
             get_e_chk[3] <=#TP rxc8[3] & (rxd64[31:24]==`ERROR);
252
             get_e_chk[4] <=#TP rxc8[4] & (rxd64[39:32]==`ERROR);
253
             get_e_chk[5] <=#TP rxc8[5] & (rxd64[47:40]==`ERROR);
254
             get_e_chk[6] <=#TP rxc8[6] & (rxd64[55:48]==`ERROR);
255
             get_e_chk[7] <=#TP rxc8[7] & (rxd64[63:56]==`ERROR);
256
                         end
257
         end
258
 
259
         always@(posedge rxclk or posedge reset) begin
260
               if (reset)
261
                            get_error_code <=#TP 0;
262
          else
263
                            get_error_code <=#TP receiving & (| get_e_chk);
264
         end
265
 
266
         //////////////////////////////////////
267
         // Get Destination Address
268
         //////////////////////////////////////
269
 
270
         always@(posedge rxclk or posedge reset)begin
271
       if (reset)
272
               da_addr <=#TP 0;
273
         else if (start_da)
274
               da_addr <=#TP rxd64_d1[47:0];
275
                 else
276
                    da_addr <=#TP da_addr;
277
    end
278
 
279
         //////////////////////////////////////
280
         // Get Length/Type Field
281
         //////////////////////////////////////
282
 
283 52 fisher5090
         reg[15:0] lt_data;
284
         always@(posedge rxclk or posedge reset)begin
285
       if (reset)
286
               lt_data <=#TP 0;
287
         else if (start_lt)
288 63 fisher5090
               lt_data <=#TP {rxd64_d1[39:32], rxd64_d1[47:40]};
289 52 fisher5090
                 else
290
                    lt_data <=#TP lt_data;
291
    end
292 63 fisher5090
 
293
         reg[5:0] pad_integer;
294
         reg[5:0] pad_remain;
295
         always@(posedge rxclk or posedge reset) begin
296
            if (reset) begin
297
                    pad_integer <=#TP 0;
298
                         pad_remain <=#TP 0;
299
                 end
300
                 else begin
301
                    pad_integer <=#TP (lt_data[5:0] - 2)>>3;
302
               pad_remain <=#TP lt_data[5:0] - 2;
303
                 end
304
         end
305
         //Remove PAD counter
306
         reg[2:0] pad_cnt;
307
         always@(posedge rxclk or posedge reset) begin
308
            if (reset)
309
                    pad_cnt <=#TP 0;
310
                 else if(lt_data[5:0] == 1)
311
                    pad_cnt <=#TP 1;
312
                 else
313
                    pad_cnt <=#TP pad_integer[2:0] + 2;
314
         end
315 39 fisher5090
 
316 63 fisher5090
    reg [7:0] pad_last_rxc;
317
    always@(posedge rxclk or posedge reset) begin
318
       if (reset)
319
          pad_last_rxc <=#TP 0;
320
                 else if(lt_data[5:0] == 1)
321
          pad_last_rxc <=#TP 8'h7f;
322
                 else begin
323
                    case (pad_remain[2:0])
324
                             0: pad_last_rxc <=#TP 8'h00;
325
                        1: pad_last_rxc <=#TP 8'h01;
326
                                  2: pad_last_rxc <=#TP 8'h03;
327
                                  3: pad_last_rxc <=#TP 8'h07;
328
                                  4: pad_last_rxc <=#TP 8'h0f;
329
                                  5: pad_last_rxc <=#TP 8'h1f;
330
                                  6: pad_last_rxc <=#TP 8'h3f;
331
                                  7: pad_last_rxc <=#TP 8'h7f;
332
                         endcase
333
       end
334
     end
335
//                  case (lt_data[5:0])
336
//                          1,2: pad_cnt <=#TP 1;
337
//                               3,4,5,6,7,8,9: pad_cnt <=#TP 2;
338
//                               10,11,12,13,14,15,16,17: pad_cnt <=#TP 3;
339
//             18,19,20,21,22,23,24,25: pad_cnt <=#TP 4;
340
//             26,27,28,29,30,31,32,33: pad_cnt <=#TP 5;
341
//             34,35,36,37,38,39,40,41: pad_cnt <=#TP 6;
342
//             42,43,44,45: pad_cnt <=#TP 7;
343
//             default: pad_cnt<= #TP 0;
344
//          endcase
345
 
346
         reg pad_frame;
347
    always@(posedge rxclk or posedge reset) begin
348
       if (reset)
349
          pad_frame <=#TP 0;
350
                 else if(~(lt_data[0]|lt_data[1]|lt_data[2]|lt_data[3]|lt_data[4]|lt_data[5]))
351
                    pad_frame <=#TP 1'b0;
352
       else if(lt_data<46)
353
                    pad_frame <=#TP 1'b1;
354
                 else
355
                    pad_frame <=#TP 1'b0;
356
         end
357
 
358 39 fisher5090
    //tagged frame indicator
359
         always@(posedge rxclk or posedge reset) begin
360
            if (reset)
361
                    tagged_frame <=#TP 1'b0;
362
       else     if (start_lt)
363
                    tagged_frame <=#TP (rxd64[63:32] == `TAG_SIGN);
364
                 else
365
                    tagged_frame <=#TP tagged_frame;
366
         end
367
         //pause frame indicator
368
         always@(posedge rxclk or posedge reset) begin
369
            if (reset)
370
                    pause_frame <=#TP 1'b0;
371
       else     if (start_lt)
372
                    pause_frame <=#TP (rxd64[47:32] == `PAUSE_SIGN);
373
                 else
374
                    pause_frame <=#TP 1'b0;
375
         end
376
 
377
    /////////////////////////////////////////////
378
    // Generate proper rxc to FIFO                                              
379
    /////////////////////////////////////////////
380
 
381
         reg [7:0]rxc_final;
382
         wire [7:0]rxc_fifo; //rxc send to fifo
383
 
384
    always@(posedge rxclk or posedge reset) begin
385
               if (reset)
386
                            rxc_final <=#TP 0;
387
                         else if (get_terminator & this_cycle)
388
             rxc_final <=#TP rxc_end_data;
389
                         else if (get_terminator_d1 & ~this_cycle)
390
                            rxc_final <=#TP rxc_end_data;
391 57 fisher5090
                         else if (get_error_code)
392
             rxc_final <=#TP 0;
393 39 fisher5090
          else if (receiving)
394 57 fisher5090
             rxc_final <=#TP `ALLONES8;
395 39 fisher5090
                         else
396 57 fisher5090
                            rxc_final <=#TP 0;
397 39 fisher5090
    end
398
 
399
         assign rxc_fifo = inband_fcs? ~rxc8_d3:rxc_final;
400
 
401
    ////////////////////////////////////////////////////////////////
402
    // FIFO management, to generate rx_good_frame/rx_bad_frame
403
    // after a frame has been totally received.
404
    ////////////////////////////////////////////////////////////////
405
         wire rxfifo_full;
406
         wire rxfifo_empty;
407
         wire fifo_wr_en;
408
    wire [63:0] rx_data_tmp;
409 63 fisher5090
         wire [7:0] rx_data_valid_tmp;
410 39 fisher5090
 
411
         reg fifo_rd_en;
412
         reg[1:0] fifo_state;
413 52 fisher5090
         wire rx_good_frame;
414
         wire rx_bad_frame;
415 39 fisher5090
         reg check_reset;
416
         always@(posedge rxclk or posedge reset) begin
417
               if(reset) begin
418 63 fisher5090
                           fifo_rd_en <=#TP 1'b0;
419
                           fifo_state <=#TP IDLE;
420
                                check_reset <=#TP 1'b0;
421 39 fisher5090
                         end
422
                         else
423
            case (fifo_state)
424
              IDLE: begin
425 63 fisher5090
                                                check_reset <=#TP 1'b0;
426
                  fifo_state <=#TP IDLE;
427
                                                fifo_rd_en <=#TP 1'b0;
428
                  if(~rxfifo_empty) begin
429
                    fifo_rd_en <=#TP 1'b1;
430
                    fifo_state <=#TP WAIT_TMP;
431 39 fisher5090
                                                end
432
              end
433
              READ: begin
434 63 fisher5090
                                      check_reset <=#TP 1'b0;
435
                  fifo_rd_en <=#TP 1'b1;
436
                                                fifo_state <=#TP READ;
437 52 fisher5090
                  if(rx_data_valid_tmp!=8'hff) begin
438 63 fisher5090
                    fifo_state <=#TP WAIT;
439
                                                  fifo_rd_en <=#TP 1'b0;
440 52 fisher5090
                                                end
441 39 fisher5090
                                  end
442
                                  WAIT_TMP: begin
443 52 fisher5090
                  if(rx_data_valid_tmp == 8'hff)
444 63 fisher5090
                     fifo_state <=#TP READ;
445 52 fisher5090
                                                else
446 63 fisher5090
                                                   fifo_state <=#TP WAIT_TMP;
447 39 fisher5090
              end
448
                                  WAIT: begin
449 63 fisher5090
                  fifo_state <=#TP WAIT;
450
                  check_reset <=#TP 1'b0;
451
                  fifo_rd_en <=#TP 1'b0;
452 39 fisher5090
                  if(bad_frame_get | good_frame_get)begin
453 63 fisher5090
                    fifo_state <=#TP IDLE;
454
                                                  check_reset <=#TP 1'b1;
455 39 fisher5090
                                                end
456
              end
457
            endcase
458
    end
459 63 fisher5090
 
460
         reg[2:0] pad_cnt_reg;
461
         always@(posedge rxclk or posedge reset) begin
462
               if(reset)
463
                           pad_cnt_reg <=#TP 0;
464
                    else if((fifo_state == WAIT_TMP)& pad_frame & ~rxfifo_empty)
465
            pad_cnt_reg <=#TP pad_cnt;
466
                         else if(pad_cnt_reg ==0)
467
                           pad_cnt_reg <=#TP 0;
468
                    else if(fifo_state[1])
469
            pad_cnt_reg <=#TP pad_cnt_reg-1;
470
          else
471
                           pad_cnt_reg <=#TP 0;
472
         end
473
 
474
         reg[7:0] pad_rxc_reg;
475
         always@(posedge rxclk or posedge reset)begin
476
               if(reset)
477
                           pad_rxc_reg <=#TP 0;
478
                         else if((fifo_state == WAIT_TMP)& pad_frame & ~rxfifo_empty)
479
                           pad_rxc_reg <=#TP pad_last_rxc;
480
                         else
481
                           pad_rxc_reg <=#TP pad_rxc_reg;
482
         end
483
 
484
         reg pad_frame_d1;
485
         always@(posedge rxclk or posedge reset) begin
486
            if(reset)
487
                    pad_frame_d1<=#TP 1'b0;
488
                 else if((fifo_state == WAIT_TMP)& pad_frame & ~rxfifo_empty)
489
                    pad_frame_d1<=#TP 1'b1;
490
                 else if(fifo_state == WAIT)
491
                    pad_frame_d1 <=#TP 1'b0;
492
                 else
493
          pad_frame_d1 <=#TP pad_frame_d1;
494
         end
495 52 fisher5090
 
496
         assign rx_good_frame = good_frame_get & (fifo_state == WAIT);
497
         assign rx_bad_frame = bad_frame_get & (fifo_state == WAIT);
498
 
499 39 fisher5090
         assign fifo_wr_en = receiving_d2;
500
 
501
         rxdatafifo rxdatain(.clk(rxclk),
502
                          .sinit(reset),
503
                          .din(rxd64_d3),
504
                                        .wr_en(fifo_wr_en),
505
                        .rd_en(fifo_rd_en),
506
                          .dout(rx_data_tmp),
507
                          .full(rxfifo_full),
508
                          .empty(rxfifo_empty));
509
 
510
         rxcntrlfifo rxcntrlin(.clk(rxclk),
511
                          .sinit(reset),
512
                          .din(rxc_fifo),
513
                                        .wr_en(fifo_wr_en),
514
                        .rd_en(fifo_rd_en),
515
                          .dout(rx_data_valid_tmp),
516
                          .full(),
517
                          .empty());
518
         reg [63:0] rx_data;
519
         always@(posedge rxclk or posedge reset) begin
520 52 fisher5090
              if (reset) begin
521
            rx_data <=#TP 0;
522
                        end
523
         else begin
524
            rx_data <=#TP rx_data_tmp;
525
                        end
526 39 fisher5090
    end
527
 
528
         reg [7:0] rx_data_valid;
529
         always@(posedge rxclk or posedge reset) begin
530 57 fisher5090
              if (reset)
531 39 fisher5090
                          rx_data_valid <=#TP 0;
532 63 fisher5090
         else if(fifo_state[1] & pad_frame_d1)
533
                          if(pad_cnt_reg==1)
534
                            rx_data_valid <=#TP pad_rxc_reg;
535
                          else if(pad_cnt_reg==0)
536
             rx_data_valid <=#TP 0;
537
                          else
538
             rx_data_valid <=#TP rx_data_valid_tmp;
539
         else if(fifo_state[1] & ~pad_frame_d1)
540
             rx_data_valid <=#TP rx_data_valid_tmp;
541 57 fisher5090
                        else
542
                          rx_data_valid <=#TP 0;
543 39 fisher5090
    end
544
 
545
endmodule

powered by: WebSVN 2.1.0

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