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

Subversion Repositories ethmac

[/] [ethmac/] [tags/] [rel_27/] [rtl/] [verilog/] [eth_top.v] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 15 mohor
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  eth_top.v                                                   ////
4
////                                                              ////
5
////  This file is part of the Ethernet IP core project           ////
6 37 mohor
////  http://www.opencores.org/projects/ethmac/                   ////
7 15 mohor
////                                                              ////
8
////  Author(s):                                                  ////
9
////      - Igor Mohor (igorM@opencores.org)                      ////
10
////                                                              ////
11 202 mohor
////  All additional information is available in the Readme.txt   ////
12 15 mohor
////  file.                                                       ////
13
////                                                              ////
14
//////////////////////////////////////////////////////////////////////
15
////                                                              ////
16 202 mohor
//// Copyright (C) 2001, 2002 Authors                             ////
17 15 mohor
////                                                              ////
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 321 igorm
// Revision 1.49  2003/11/12 18:24:59  tadejm
45
// WISHBONE slave changed and tested from only 32-bit accesss to byte access.
46
//
47 304 tadejm
// Revision 1.48  2003/10/17 07:46:16  markom
48
// mbist signals updated according to newest convention
49
//
50 302 markom
// Revision 1.47  2003/10/06 15:43:45  knguyen
51
// Update RxEnSync only when mrxdv_pad_i is inactive (LOW).
52
//
53 301 knguyen
// Revision 1.46  2003/01/30 13:30:22  tadejm
54
// Defer indication changed.
55
//
56 276 tadejm
// Revision 1.45  2003/01/22 13:49:26  tadejm
57
// When control packets were received, they were ignored in some cases.
58
//
59 272 tadejm
// Revision 1.44  2003/01/21 12:09:40  mohor
60
// When receiving normal data frame and RxFlow control was switched on, RXB
61
// interrupt was not set.
62
//
63 270 mohor
// Revision 1.43  2002/11/22 01:57:06  mohor
64
// Rx Flow control fixed. CF flag added to the RX buffer descriptor. RxAbort
65
// synchronized.
66
//
67 261 mohor
// Revision 1.42  2002/11/21 00:09:19  mohor
68
// TPauseRq synchronized to tx_clk.
69
//
70 255 mohor
// Revision 1.41  2002/11/19 18:13:49  mohor
71
// r_MiiMRst is not used for resetting the MIIM module. wb_rst used instead.
72
//
73 253 mohor
// Revision 1.40  2002/11/19 17:34:25  mohor
74
// AddressMiss status is connecting to the Rx BD. AddressMiss is identifying
75
// that a frame was received because of the promiscous mode.
76
//
77 250 mohor
// Revision 1.39  2002/11/18 17:31:55  mohor
78
// wb_rst_i is used for MIIM reset.
79
//
80 248 mohor
// Revision 1.38  2002/11/14 18:37:20  mohor
81
// r_Rst signal does not reset any module any more and is removed from the design.
82
//
83 244 mohor
// Revision 1.37  2002/11/13 22:25:36  tadejm
84
// All modules are reset with wb_rst instead of the r_Rst. Exception is MII module.
85
//
86 240 tadejm
// Revision 1.36  2002/10/18 17:04:20  tadejm
87
// Changed BIST scan signals.
88
//
89 227 tadejm
// Revision 1.35  2002/10/11 13:36:58  mohor
90
// Typo error fixed. (When using Bist)
91
//
92 218 mohor
// Revision 1.34  2002/10/10 16:49:50  mohor
93
// Signals for WISHBONE B3 compliant interface added.
94
//
95 214 mohor
// Revision 1.33  2002/10/10 16:29:30  mohor
96
// BIST added.
97
//
98 210 mohor
// Revision 1.32  2002/09/20 17:12:58  mohor
99
// CsMiss added. When address between 0x800 and 0xfff is accessed within
100
// Ethernet Core, error acknowledge is generated.
101
//
102 202 mohor
// Revision 1.31  2002/09/12 14:50:17  mohor
103
// CarrierSenseLost bug fixed when operating in full duplex mode.
104
//
105 168 mohor
// Revision 1.30  2002/09/10 10:35:23  mohor
106
// Ethernet debug registers removed.
107
//
108 164 mohor
// Revision 1.29  2002/09/09 13:03:13  mohor
109
// Error acknowledge is generated when accessing BDs and RST bit in the
110
// MODER register (r_Rst) is set.
111
//
112 161 mohor
// Revision 1.28  2002/09/04 18:44:10  mohor
113
// Signals related to the control frames connected. Debug registers reg1, 2, 3, 4
114
// connected.
115
//
116 149 mohor
// Revision 1.27  2002/07/25 18:15:37  mohor
117
// RxAbort changed. Packets received with MRxErr (from PHY) are also
118
// aborted.
119
//
120 125 mohor
// Revision 1.26  2002/07/17 18:51:50  mohor
121
// EXTERNAL_DMA removed. External DMA not supported.
122
//
123 114 mohor
// Revision 1.25  2002/05/03 10:15:50  mohor
124
// Outputs registered. Reset changed for eth_wishbone module.
125
//
126 106 mohor
// Revision 1.24  2002/04/22 14:15:42  mohor
127
// Wishbone signals are registered when ETH_REGISTERED_OUTPUTS is
128
// selected in eth_defines.v
129
//
130 103 mohor
// Revision 1.23  2002/03/25 13:33:53  mohor
131
// md_padoen_o changed to md_padoe_o. Signal was always active high, just
132
// name was incorrect.
133
//
134 95 mohor
// Revision 1.22  2002/02/26 16:59:54  mohor
135
// Small fixes for external/internal DMA missmatches.
136
//
137 80 mohor
// Revision 1.21  2002/02/26 16:21:00  mohor
138
// Interrupts changed in the top file
139
//
140 76 mohor
// Revision 1.20  2002/02/18 10:40:17  mohor
141
// Small fixes.
142
//
143 70 mohor
// Revision 1.19  2002/02/16 14:03:44  mohor
144
// Registered trimmed. Unused registers removed.
145
//
146 68 mohor
// Revision 1.18  2002/02/16 13:06:33  mohor
147
// EXTERNAL_DMA used instead of WISHBONE_DMA.
148
//
149 67 mohor
// Revision 1.17  2002/02/16 07:15:27  mohor
150
// Testbench fixed, code simplified, unused signals removed.
151
//
152 65 mohor
// Revision 1.16  2002/02/15 13:49:39  mohor
153
// RxAbort is connected differently.
154
//
155 63 mohor
// Revision 1.15  2002/02/15 11:38:26  mohor
156
// Changes that were lost when updating from 1.11 to 1.14 fixed.
157
//
158 59 mohor
// Revision 1.14  2002/02/14 20:19:11  billditt
159
// Modified for Address Checking,
160
// addition of eth_addrcheck.v
161
//
162
// Revision 1.13  2002/02/12 17:03:03  mohor
163
// HASH0 and HASH1 registers added. Registers address width was
164
// changed to 8 bits.
165
//
166
// Revision 1.12  2002/02/11 09:18:22  mohor
167
// Tx status is written back to the BD.
168
//
169 43 mohor
// Revision 1.11  2002/02/08 16:21:54  mohor
170
// Rx status is written back to the BD.
171
//
172 42 mohor
// Revision 1.10  2002/02/06 14:10:21  mohor
173
// non-DMA host interface added. Select the right configutation in eth_defines.
174
//
175 41 mohor
// Revision 1.9  2002/01/23 10:28:16  mohor
176
// Link in the header changed.
177
//
178 37 mohor
// Revision 1.8  2001/12/05 15:00:16  mohor
179
// RX_BD_NUM changed to TX_BD_NUM (holds number of TX descriptors
180
// instead of the number of RX descriptors).
181
//
182 34 mohor
// Revision 1.7  2001/12/05 10:45:59  mohor
183
// ETH_RX_BD_ADR register deleted. ETH_RX_BD_NUM is used instead.
184
//
185 33 mohor
// Revision 1.6  2001/10/19 11:24:29  mohor
186
// Number of addresses (wb_adr_i) minimized.
187
//
188 23 mohor
// Revision 1.5  2001/10/19 08:43:51  mohor
189
// eth_timescale.v changed to timescale.v This is done because of the
190
// simulation of the few cores in a one joined project.
191
//
192 22 mohor
// Revision 1.4  2001/10/18 12:07:11  mohor
193
// Status signals changed, Adress decoding changed, interrupt controller
194
// added.
195
//
196 21 mohor
// Revision 1.3  2001/09/24 15:02:56  mohor
197
// Defines changed (All precede with ETH_). Small changes because some
198
// tools generate warnings when two operands are together. Synchronization
199
// between two clocks domains in eth_wishbonedma.v is changed (due to ASIC
200
// demands).
201
//
202 20 mohor
// Revision 1.2  2001/08/15 14:03:59  mohor
203
// Signal names changed on the top level for easier pad insertion (ASIC).
204
//
205 17 mohor
// Revision 1.1  2001/08/06 14:44:29  mohor
206
// A define FPGA added to select between Artisan RAM (for ASIC) and Block Ram (For Virtex).
207
// Include files fixed to contain no path.
208
// File names and module names changed ta have a eth_ prologue in the name.
209
// File eth_timescale.v is used to define timescale
210
// All pin names on the top module are changed to contain _I, _O or _OE at the end.
211
// Bidirectional signal MDIO is changed to three signals (Mdc_O, Mdi_I, Mdo_O
212
// and Mdo_OE. The bidirectional signal must be created on the top level. This
213
// is done due to the ASIC tools.
214
//
215 15 mohor
// Revision 1.2  2001/08/02 09:25:31  mohor
216
// Unconnected signals are now connected.
217
//
218
// Revision 1.1  2001/07/30 21:23:42  mohor
219
// Directory structure changed. Files checked and joind together.
220
//
221
//
222
//
223 20 mohor
// 
224 15 mohor
 
225
 
226
`include "eth_defines.v"
227 22 mohor
`include "timescale.v"
228 15 mohor
 
229
 
230
module eth_top
231
(
232
  // WISHBONE common
233 17 mohor
  wb_clk_i, wb_rst_i, wb_dat_i, wb_dat_o,
234 15 mohor
 
235
  // WISHBONE slave
236 17 mohor
  wb_adr_i, wb_sel_i, wb_we_i, wb_cyc_i, wb_stb_i, wb_ack_o, wb_err_o,
237 15 mohor
 
238 41 mohor
  // WISHBONE master
239
  m_wb_adr_o, m_wb_sel_o, m_wb_we_o,
240
  m_wb_dat_o, m_wb_dat_i, m_wb_cyc_o,
241
  m_wb_stb_o, m_wb_ack_i, m_wb_err_i,
242
 
243 214 mohor
`ifdef ETH_WISHBONE_B3
244
  m_wb_cti_o, m_wb_bte_o,
245
`endif
246
 
247 15 mohor
  //TX
248 20 mohor
  mtx_clk_pad_i, mtxd_pad_o, mtxen_pad_o, mtxerr_pad_o,
249 15 mohor
 
250
  //RX
251 20 mohor
  mrx_clk_pad_i, mrxd_pad_i, mrxdv_pad_i, mrxerr_pad_i, mcoll_pad_i, mcrs_pad_i,
252 15 mohor
 
253
  // MIIM
254 95 mohor
  mdc_pad_o, md_pad_i, md_pad_o, md_padoe_o,
255 17 mohor
 
256 21 mohor
  int_o
257 17 mohor
 
258 210 mohor
  // Bist
259
`ifdef ETH_BIST
260 227 tadejm
  ,
261
  // debug chain signals
262 302 markom
  mbist_si_i,       // bist scan serial in
263
  mbist_so_o,       // bist scan serial out
264
  mbist_ctrl_i        // bist chain shift control
265 210 mohor
`endif
266 21 mohor
 
267 15 mohor
);
268
 
269
 
270
parameter Tp = 1;
271
 
272
 
273
// WISHBONE common
274 17 mohor
input           wb_clk_i;     // WISHBONE clock
275
input           wb_rst_i;     // WISHBONE reset
276
input   [31:0]  wb_dat_i;     // WISHBONE data input
277
output  [31:0]  wb_dat_o;     // WISHBONE data output
278
output          wb_err_o;     // WISHBONE error output
279 15 mohor
 
280
// WISHBONE slave
281 23 mohor
input   [11:2]  wb_adr_i;     // WISHBONE address input
282 17 mohor
input    [3:0]  wb_sel_i;     // WISHBONE byte select input
283
input           wb_we_i;      // WISHBONE write enable input
284
input           wb_cyc_i;     // WISHBONE cycle input
285
input           wb_stb_i;     // WISHBONE strobe input
286
output          wb_ack_o;     // WISHBONE acknowledge output
287 15 mohor
 
288 41 mohor
// WISHBONE master
289
output  [31:0]  m_wb_adr_o;
290
output   [3:0]  m_wb_sel_o;
291
output          m_wb_we_o;
292
input   [31:0]  m_wb_dat_i;
293
output  [31:0]  m_wb_dat_o;
294
output          m_wb_cyc_o;
295
output          m_wb_stb_o;
296
input           m_wb_ack_i;
297
input           m_wb_err_i;
298 15 mohor
 
299 214 mohor
`ifdef ETH_WISHBONE_B3
300
output   [2:0]  m_wb_cti_o;   // Cycle Type Identifier
301
output   [1:0]  m_wb_bte_o;   // Burst Type Extension
302
`endif
303 41 mohor
 
304 15 mohor
// Tx
305 20 mohor
input           mtx_clk_pad_i; // Transmit clock (from PHY)
306 21 mohor
output   [3:0]  mtxd_pad_o;    // Transmit nibble (to PHY)
307
output          mtxen_pad_o;   // Transmit enable (to PHY)
308
output          mtxerr_pad_o;  // Transmit error (to PHY)
309 15 mohor
 
310
// Rx
311 20 mohor
input           mrx_clk_pad_i; // Receive clock (from PHY)
312 21 mohor
input    [3:0]  mrxd_pad_i;    // Receive nibble (from PHY)
313
input           mrxdv_pad_i;   // Receive data valid (from PHY)
314
input           mrxerr_pad_i;  // Receive data error (from PHY)
315 15 mohor
 
316
// Common Tx and Rx
317 21 mohor
input           mcoll_pad_i;   // Collision (from PHY)
318
input           mcrs_pad_i;    // Carrier sense (from PHY)
319 15 mohor
 
320
// MII Management interface
321 21 mohor
input           md_pad_i;      // MII data input (from I/O cell)
322
output          mdc_pad_o;     // MII Management data clock (to PHY)
323
output          md_pad_o;      // MII data output (to I/O cell)
324 95 mohor
output          md_padoe_o;    // MII data output enable (to I/O cell)
325 15 mohor
 
326 21 mohor
output          int_o;         // Interrupt output
327 15 mohor
 
328 210 mohor
// Bist
329
`ifdef ETH_BIST
330 302 markom
input   mbist_si_i;       // bist scan serial in
331
output  mbist_so_o;       // bist scan serial out
332
input [`ETH_MBIST_CTRL_WIDTH - 1:0] mbist_ctrl_i;       // bist chain shift control
333 210 mohor
`endif
334
 
335 15 mohor
wire     [7:0]  r_ClkDiv;
336
wire            r_MiiNoPre;
337
wire    [15:0]  r_CtrlData;
338
wire     [4:0]  r_FIAD;
339
wire     [4:0]  r_RGAD;
340
wire            r_WCtrlData;
341
wire            r_RStat;
342
wire            r_ScanStat;
343
wire            NValid_stat;
344
wire            Busy_stat;
345
wire            LinkFail;
346
wire    [15:0]  Prsd;             // Read Status Data (data read from the PHY)
347
wire            WCtrlDataStart;
348
wire            RStatStart;
349
wire            UpdateMIIRX_DATAReg;
350
 
351
wire            TxStartFrm;
352
wire            TxEndFrm;
353
wire            TxUsedData;
354
wire     [7:0]  TxData;
355
wire            TxRetry;
356
wire            TxAbort;
357
wire            TxUnderRun;
358
wire            TxDone;
359 42 mohor
wire     [5:0]  CollValid;
360 15 mohor
 
361
 
362 149 mohor
reg             WillSendControlFrame_sync1;
363
reg             WillSendControlFrame_sync2;
364
reg             WillSendControlFrame_sync3;
365
reg             RstTxPauseRq;
366 15 mohor
 
367 255 mohor
reg             TxPauseRq_sync1;
368
reg             TxPauseRq_sync2;
369
reg             TxPauseRq_sync3;
370
reg             TPauseRq;
371 15 mohor
 
372 255 mohor
 
373 15 mohor
// Connecting Miim module
374
eth_miim miim1
375
(
376 248 mohor
  .Clk(wb_clk_i),                         .Reset(wb_rst_i),                   .Divider(r_ClkDiv),
377 15 mohor
  .NoPre(r_MiiNoPre),                     .CtrlData(r_CtrlData),              .Rgad(r_RGAD),
378
  .Fiad(r_FIAD),                          .WCtrlData(r_WCtrlData),            .RStat(r_RStat),
379 17 mohor
  .ScanStat(r_ScanStat),                  .Mdi(md_pad_i),                     .Mdo(md_pad_o),
380 95 mohor
  .MdoEn(md_padoe_o),                     .Mdc(mdc_pad_o),                    .Busy(Busy_stat),
381 15 mohor
  .Prsd(Prsd),                            .LinkFail(LinkFail),                .Nvalid(NValid_stat),
382
  .WCtrlDataStart(WCtrlDataStart),        .RStatStart(RStatStart),            .UpdateMIIRX_DATAReg(UpdateMIIRX_DATAReg)
383
);
384
 
385
 
386
 
387
 
388 304 tadejm
wire  [3:0] RegCs;          // Connected to registers
389 17 mohor
wire [31:0] RegDataOut;     // Multiplexed to wb_dat_o
390 42 mohor
wire        r_RecSmall;     // Receive small frames
391 15 mohor
wire        r_LoopBck;      // Loopback
392
wire        r_TxEn;         // Tx Enable
393
wire        r_RxEn;         // Rx Enable
394
 
395
wire        MRxDV_Lb;       // Muxed MII receive data valid
396
wire        MRxErr_Lb;      // Muxed MII Receive Error
397
wire  [3:0] MRxD_Lb;        // Muxed MII Receive Data
398
wire        Transmitting;   // Indication that TxEthMAC is transmitting
399
wire        r_HugEn;        // Huge packet enable
400
wire        r_DlyCrcEn;     // Delayed CRC enabled
401
wire [15:0] r_MaxFL;        // Maximum frame length
402
 
403
wire [15:0] r_MinFL;        // Minimum frame length
404 42 mohor
wire        ShortFrame;
405
wire        DribbleNibble;  // Extra nibble received
406
wire        ReceivedPacketTooBig; // Received packet is too big
407 15 mohor
wire [47:0] r_MAC;          // MAC address
408 42 mohor
wire        LoadRxStatus;   // Rx status was loaded
409 52 billditt
wire [31:0] r_HASH0;        // HASH table, lower 4 bytes
410
wire [31:0] r_HASH1;        // HASH table, upper 4 bytes
411 34 mohor
wire  [7:0] r_TxBDNum;      // Receive buffer descriptor number
412 15 mohor
wire  [6:0] r_IPGT;         // 
413
wire  [6:0] r_IPGR1;        // 
414
wire  [6:0] r_IPGR2;        // 
415
wire  [5:0] r_CollValid;    // 
416 149 mohor
wire [15:0] r_TxPauseTV;    // Transmit PAUSE value
417
wire        r_TxPauseRq;    // Transmit PAUSE request
418 15 mohor
 
419
wire  [3:0] r_MaxRet;       //
420
wire        r_NoBckof;      // 
421
wire        r_ExDfrEn;      // 
422
wire        r_TxFlow;       // Tx flow control enable
423
wire        r_IFG;          // Minimum interframe gap for incoming packets
424
 
425 21 mohor
wire        TxB_IRQ;        // Interrupt Tx Buffer
426
wire        TxE_IRQ;        // Interrupt Tx Error
427
wire        RxB_IRQ;        // Interrupt Rx Buffer
428 76 mohor
wire        RxE_IRQ;        // Interrupt Rx Error
429 21 mohor
wire        Busy_IRQ;       // Interrupt Busy (lack of buffers)
430 15 mohor
 
431 304 tadejm
//wire        DWord;
432
wire        ByteSelected;
433
wire  [3:0] ByteSel;
434 15 mohor
wire        BDAck;
435 103 mohor
wire [31:0] BD_WB_DAT_O;    // wb_dat_o that comes from the Wishbone module (for buffer descriptors read/write)
436 304 tadejm
wire  [3:0] BDCs;           // Buffer descriptor CS
437 202 mohor
wire        CsMiss;         // When access to the address between 0x800 and 0xfff occurs, acknowledge is set
438
                            // but data is not valid.
439 15 mohor
 
440 103 mohor
wire        temp_wb_ack_o;
441
wire [31:0] temp_wb_dat_o;
442
wire        temp_wb_err_o;
443 15 mohor
 
444 103 mohor
`ifdef ETH_REGISTERED_OUTPUTS
445
  reg         temp_wb_ack_o_reg;
446
  reg [31:0]  temp_wb_dat_o_reg;
447
  reg         temp_wb_err_o_reg;
448
`endif
449
 
450 304 tadejm
//assign DWord = &wb_sel_i;
451
assign ByteSelected = |wb_sel_i;
452
assign RegCs[3] = wb_stb_i & wb_cyc_i & ByteSelected & ~wb_adr_i[11] & ~wb_adr_i[10] & wb_sel_i[3];   // 0x0   - 0x3FF
453
assign RegCs[2] = wb_stb_i & wb_cyc_i & ByteSelected & ~wb_adr_i[11] & ~wb_adr_i[10] & wb_sel_i[2];   // 0x0   - 0x3FF
454
assign RegCs[1] = wb_stb_i & wb_cyc_i & ByteSelected & ~wb_adr_i[11] & ~wb_adr_i[10] & wb_sel_i[1];   // 0x0   - 0x3FF
455
assign RegCs[0] = wb_stb_i & wb_cyc_i & ByteSelected & ~wb_adr_i[11] & ~wb_adr_i[10] & wb_sel_i[0];   // 0x0   - 0x3FF
456
assign BDCs[3]  = wb_stb_i & wb_cyc_i & ByteSelected & ~wb_adr_i[11] &  wb_adr_i[10] & wb_sel_i[3];   // 0x400 - 0x7FF
457
assign BDCs[2]  = wb_stb_i & wb_cyc_i & ByteSelected & ~wb_adr_i[11] &  wb_adr_i[10] & wb_sel_i[2];   // 0x400 - 0x7FF
458
assign BDCs[1]  = wb_stb_i & wb_cyc_i & ByteSelected & ~wb_adr_i[11] &  wb_adr_i[10] & wb_sel_i[1];   // 0x400 - 0x7FF
459
assign BDCs[0]  = wb_stb_i & wb_cyc_i & ByteSelected & ~wb_adr_i[11] &  wb_adr_i[10] & wb_sel_i[0];   // 0x400 - 0x7FF
460
assign CsMiss = wb_stb_i & wb_cyc_i & ByteSelected & wb_adr_i[11];                   // 0x800 - 0xfFF
461
assign temp_wb_ack_o = (|RegCs) | BDAck;
462
assign temp_wb_dat_o = ((|RegCs) & ~wb_we_i)? RegDataOut : BD_WB_DAT_O;
463
assign temp_wb_err_o = wb_stb_i & wb_cyc_i & (~ByteSelected | CsMiss);
464 15 mohor
 
465 103 mohor
`ifdef ETH_REGISTERED_OUTPUTS
466
  assign wb_ack_o = temp_wb_ack_o_reg;
467
  assign wb_dat_o[31:0] = temp_wb_dat_o_reg;
468
  assign wb_err_o = temp_wb_err_o_reg;
469
`else
470
  assign wb_ack_o = temp_wb_ack_o;
471
  assign wb_dat_o[31:0] = temp_wb_dat_o;
472
  assign wb_err_o = temp_wb_err_o;
473
`endif
474 15 mohor
 
475
 
476
 
477 103 mohor
`ifdef ETH_REGISTERED_OUTPUTS
478
  always @ (posedge wb_clk_i or posedge wb_rst_i)
479
  begin
480
    if(wb_rst_i)
481
      begin
482
        temp_wb_ack_o_reg <=#Tp 1'b0;
483
        temp_wb_dat_o_reg <=#Tp 32'h0;
484
        temp_wb_err_o_reg <=#Tp 1'b0;
485
      end
486
    else
487
      begin
488 106 mohor
        temp_wb_ack_o_reg <=#Tp temp_wb_ack_o & ~temp_wb_ack_o_reg;
489 103 mohor
        temp_wb_dat_o_reg <=#Tp temp_wb_dat_o;
490 106 mohor
        temp_wb_err_o_reg <=#Tp temp_wb_err_o & ~temp_wb_err_o_reg;
491 103 mohor
      end
492
  end
493
`endif
494
 
495
 
496 15 mohor
// Connecting Ethernet registers
497
eth_registers ethreg1
498
(
499 47 mohor
  .DataIn(wb_dat_i),                      .Address(wb_adr_i[9:2]),                    .Rw(wb_we_i),
500 17 mohor
  .Cs(RegCs),                             .Clk(wb_clk_i),                             .Reset(wb_rst_i),
501 68 mohor
  .DataOut(RegDataOut),                   .r_RecSmall(r_RecSmall),
502 15 mohor
  .r_Pad(r_Pad),                          .r_HugEn(r_HugEn),                          .r_CrcEn(r_CrcEn),
503 244 mohor
  .r_DlyCrcEn(r_DlyCrcEn),                .r_FullD(r_FullD),
504 15 mohor
  .r_ExDfrEn(r_ExDfrEn),                  .r_NoBckof(r_NoBckof),                      .r_LoopBck(r_LoopBck),
505 52 billditt
  .r_IFG(r_IFG),                          .r_Pro(r_Pro),                              .r_Iam(),
506
  .r_Bro(r_Bro),                          .r_NoPre(r_NoPre),                          .r_TxEn(r_TxEn),
507 76 mohor
  .r_RxEn(r_RxEn),                        .Busy_IRQ(Busy_IRQ),                        .RxE_IRQ(RxE_IRQ),
508 21 mohor
  .RxB_IRQ(RxB_IRQ),                      .TxE_IRQ(TxE_IRQ),                          .TxB_IRQ(TxB_IRQ),
509 149 mohor
  .r_IPGT(r_IPGT),
510 15 mohor
  .r_IPGR1(r_IPGR1),                      .r_IPGR2(r_IPGR2),                          .r_MinFL(r_MinFL),
511
  .r_MaxFL(r_MaxFL),                      .r_MaxRet(r_MaxRet),                        .r_CollValid(r_CollValid),
512
  .r_TxFlow(r_TxFlow),                    .r_RxFlow(r_RxFlow),                        .r_PassAll(r_PassAll),
513 253 mohor
  .r_MiiNoPre(r_MiiNoPre),                .r_ClkDiv(r_ClkDiv),
514 15 mohor
  .r_WCtrlData(r_WCtrlData),              .r_RStat(r_RStat),                          .r_ScanStat(r_ScanStat),
515
  .r_RGAD(r_RGAD),                        .r_FIAD(r_FIAD),                            .r_CtrlData(r_CtrlData),
516
  .NValid_stat(NValid_stat),              .Busy_stat(Busy_stat),
517
  .LinkFail(LinkFail),                    .r_MAC(r_MAC),                              .WCtrlDataStart(WCtrlDataStart),
518
  .RStatStart(RStatStart),                .UpdateMIIRX_DATAReg(UpdateMIIRX_DATAReg),  .Prsd(Prsd),
519 321 igorm
  .r_TxBDNum(r_TxBDNum),                  .int_o(int_o),
520 149 mohor
  .r_HASH0(r_HASH0),                      .r_HASH1(r_HASH1),                          .r_TxPauseRq(r_TxPauseRq),
521
  .r_TxPauseTV(r_TxPauseTV),              .RstTxPauseRq(RstTxPauseRq),                .TxCtrlEndFrm(TxCtrlEndFrm),
522
  .StartTxDone(StartTxDone),              .TxClk(mtx_clk_pad_i),                      .RxClk(mrx_clk_pad_i),
523 261 mohor
  .SetPauseTimer(SetPauseTimer)
524 149 mohor
 
525 15 mohor
);
526
 
527
 
528
 
529
wire  [7:0] RxData;
530
wire        RxValid;
531
wire        RxStartFrm;
532
wire        RxEndFrm;
533 41 mohor
wire        RxAbort;
534 15 mohor
 
535
wire        WillTransmit;            // Will transmit (to RxEthMAC)
536
wire        ResetCollision;          // Reset Collision (for synchronizing collision)
537
wire  [7:0] TxDataOut;               // Transmit Packet Data (to TxEthMAC)
538
wire        WillSendControlFrame;
539
wire        ReceiveEnd;
540
wire        ReceivedPacketGood;
541
wire        ReceivedLengthOK;
542 42 mohor
wire        InvalidSymbol;
543
wire        LatchedCrcError;
544
wire        RxLateCollision;
545 59 mohor
wire  [3:0] RetryCntLatched;
546
wire  [3:0] RetryCnt;
547
wire        StartTxAbort;
548
wire        MaxCollisionOccured;
549
wire        RetryLimit;
550
wire        StatePreamble;
551
wire  [1:0] StateData;
552 15 mohor
 
553
// Connecting MACControl
554
eth_maccontrol maccontrol1
555
(
556 255 mohor
  .MTxClk(mtx_clk_pad_i),                       .TPauseRq(TPauseRq),
557 149 mohor
  .TxPauseTV(r_TxPauseTV),                      .TxDataIn(TxData),
558 15 mohor
  .TxStartFrmIn(TxStartFrm),                    .TxEndFrmIn(TxEndFrm),
559
  .TxUsedDataIn(TxUsedDataIn),                  .TxDoneIn(TxDoneIn),
560 20 mohor
  .TxAbortIn(TxAbortIn),                        .MRxClk(mrx_clk_pad_i),
561 15 mohor
  .RxData(RxData),                              .RxValid(RxValid),
562
  .RxStartFrm(RxStartFrm),                      .RxEndFrm(RxEndFrm),
563
  .ReceiveEnd(ReceiveEnd),                      .ReceivedPacketGood(ReceivedPacketGood),
564 261 mohor
  .TxFlow(r_TxFlow),
565 15 mohor
  .RxFlow(r_RxFlow),                            .DlyCrcEn(r_DlyCrcEn),
566
  .MAC(r_MAC),                                  .PadIn(r_Pad | PerPacketPad),
567
  .PadOut(PadOut),                              .CrcEnIn(r_CrcEn | PerPacketCrcEn),
568 240 tadejm
  .CrcEnOut(CrcEnOut),                          .TxReset(wb_rst_i),
569
  .RxReset(wb_rst_i),                           .ReceivedLengthOK(ReceivedLengthOK),
570 15 mohor
  .TxDataOut(TxDataOut),                        .TxStartFrmOut(TxStartFrmOut),
571
  .TxEndFrmOut(TxEndFrmOut),                    .TxUsedDataOut(TxUsedData),
572
  .TxDoneOut(TxDone),                           .TxAbortOut(TxAbort),
573
  .WillSendControlFrame(WillSendControlFrame),  .TxCtrlEndFrm(TxCtrlEndFrm),
574 261 mohor
  .ReceivedPauseFrm(ReceivedPauseFrm),          .ControlFrmAddressOK(ControlFrmAddressOK),
575 272 tadejm
  .SetPauseTimer(SetPauseTimer),
576
  .RxStatusWriteLatched_sync2(RxStatusWriteLatched_sync2),                .r_PassAll(r_PassAll)
577 15 mohor
);
578
 
579
 
580
 
581
wire TxCarrierSense;          // Synchronized CarrierSense (to Tx clock)
582
wire Collision;               // Synchronized Collision
583
 
584
reg CarrierSense_Tx1;
585
reg CarrierSense_Tx2;
586
reg Collision_Tx1;
587
reg Collision_Tx2;
588
 
589
reg RxEnSync;                 // Synchronized Receive Enable
590 301 knguyen
//reg CarrierSense_Rx1;
591
//reg RxCarrierSense;           // Synchronized CarrierSense (to Rx clock)
592 15 mohor
reg WillTransmit_q;
593
reg WillTransmit_q2;
594
 
595
 
596
 
597
// Muxed MII receive data valid
598 17 mohor
assign MRxDV_Lb = r_LoopBck? mtxen_pad_o : mrxdv_pad_i & RxEnSync;
599 15 mohor
 
600
// Muxed MII Receive Error
601 17 mohor
assign MRxErr_Lb = r_LoopBck? mtxerr_pad_o : mrxerr_pad_i & RxEnSync;
602 15 mohor
 
603
// Muxed MII Receive Data
604 17 mohor
assign MRxD_Lb[3:0] = r_LoopBck? mtxd_pad_o[3:0] : mrxd_pad_i[3:0];
605 15 mohor
 
606
 
607
 
608
// Connecting TxEthMAC
609
eth_txethmac txethmac1
610
(
611 240 tadejm
  .MTxClk(mtx_clk_pad_i),             .Reset(wb_rst_i),                   .CarrierSense(TxCarrierSense),
612 15 mohor
  .Collision(Collision),              .TxData(TxDataOut),                 .TxStartFrm(TxStartFrmOut),
613
  .TxUnderRun(TxUnderRun),            .TxEndFrm(TxEndFrmOut),             .Pad(PadOut),
614
  .MinFL(r_MinFL),                    .CrcEn(CrcEnOut),                   .FullD(r_FullD),
615
  .HugEn(r_HugEn),                    .DlyCrcEn(r_DlyCrcEn),              .IPGT(r_IPGT),
616
  .IPGR1(r_IPGR1),                    .IPGR2(r_IPGR2),                    .CollValid(r_CollValid),
617
  .MaxRet(r_MaxRet),                  .NoBckof(r_NoBckof),                .ExDfrEn(r_ExDfrEn),
618 17 mohor
  .MaxFL(r_MaxFL),                    .MTxEn(mtxen_pad_o),                .MTxD(mtxd_pad_o),
619
  .MTxErr(mtxerr_pad_o),              .TxUsedData(TxUsedDataIn),          .TxDone(TxDoneIn),
620 15 mohor
  .TxRetry(TxRetry),                  .TxAbort(TxAbortIn),                .WillTransmit(WillTransmit),
621 59 mohor
  .ResetCollision(ResetCollision),    .RetryCnt(RetryCnt),                .StartTxDone(StartTxDone),
622
  .StartTxAbort(StartTxAbort),        .MaxCollisionOccured(MaxCollisionOccured), .LateCollision(LateCollision),
623 276 tadejm
  .DeferIndication(DeferIndication),  .StatePreamble(StatePreamble),      .StateData(StateData)
624 15 mohor
);
625
 
626
 
627
 
628
 
629
wire  [15:0]  RxByteCnt;
630
wire          RxByteCntEq0;
631
wire          RxByteCntGreat2;
632
wire          RxByteCntMaxFrame;
633
wire          RxCrcError;
634
wire          RxStateIdle;
635
wire          RxStatePreamble;
636
wire          RxStateSFD;
637
wire   [1:0]  RxStateData;
638 250 mohor
wire          AddressMiss;
639 15 mohor
 
640
 
641
 
642
// Connecting RxEthMAC
643
eth_rxethmac rxethmac1
644
(
645 21 mohor
  .MRxClk(mrx_clk_pad_i),               .MRxDV(MRxDV_Lb),                     .MRxD(MRxD_Lb),
646 15 mohor
  .Transmitting(Transmitting),          .HugEn(r_HugEn),                      .DlyCrcEn(r_DlyCrcEn),
647 240 tadejm
  .MaxFL(r_MaxFL),                      .r_IFG(r_IFG),                        .Reset(wb_rst_i),
648 15 mohor
  .RxData(RxData),                      .RxValid(RxValid),                    .RxStartFrm(RxStartFrm),
649 65 mohor
  .RxEndFrm(RxEndFrm),                  .ByteCnt(RxByteCnt),
650 15 mohor
  .ByteCntEq0(RxByteCntEq0),            .ByteCntGreat2(RxByteCntGreat2),      .ByteCntMaxFrame(RxByteCntMaxFrame),
651
  .CrcError(RxCrcError),                .StateIdle(RxStateIdle),              .StatePreamble(RxStatePreamble),
652 52 billditt
  .StateSFD(RxStateSFD),                .StateData(RxStateData),
653 63 mohor
  .MAC(r_MAC),                          .r_Pro(r_Pro),                        .r_Bro(r_Bro),
654 250 mohor
  .r_HASH0(r_HASH0),                    .r_HASH1(r_HASH1),                    .RxAbort(RxAbort),
655 261 mohor
  .AddressMiss(AddressMiss),            .PassAll(r_PassAll),                  .ControlFrmAddressOK(ControlFrmAddressOK)
656 15 mohor
);
657
 
658
 
659
// MII Carrier Sense Synchronization
660 240 tadejm
always @ (posedge mtx_clk_pad_i or posedge wb_rst_i)
661 15 mohor
begin
662 240 tadejm
  if(wb_rst_i)
663 15 mohor
    begin
664
      CarrierSense_Tx1 <= #Tp 1'b0;
665
      CarrierSense_Tx2 <= #Tp 1'b0;
666
    end
667
  else
668
    begin
669 17 mohor
      CarrierSense_Tx1 <= #Tp mcrs_pad_i;
670 15 mohor
      CarrierSense_Tx2 <= #Tp CarrierSense_Tx1;
671
    end
672
end
673
 
674
assign TxCarrierSense = ~r_FullD & CarrierSense_Tx2;
675
 
676
 
677
// MII Collision Synchronization
678 240 tadejm
always @ (posedge mtx_clk_pad_i or posedge wb_rst_i)
679 15 mohor
begin
680 240 tadejm
  if(wb_rst_i)
681 15 mohor
    begin
682
      Collision_Tx1 <= #Tp 1'b0;
683
      Collision_Tx2 <= #Tp 1'b0;
684
    end
685
  else
686
    begin
687 17 mohor
      Collision_Tx1 <= #Tp mcoll_pad_i;
688 15 mohor
      if(ResetCollision)
689
        Collision_Tx2 <= #Tp 1'b0;
690
      else
691
      if(Collision_Tx1)
692
        Collision_Tx2 <= #Tp 1'b1;
693
    end
694
end
695
 
696
 
697
// Synchronized Collision
698
assign Collision = ~r_FullD & Collision_Tx2;
699
 
700
 
701
 
702
// Carrier sense is synchronized to receive clock.
703 301 knguyen
//always @ (posedge mrx_clk_pad_i or posedge wb_rst_i)
704
//begin
705
//  if(wb_rst_i)
706
//    begin
707
//      CarrierSense_Rx1 <= #Tp 1'h0;
708
//      RxCarrierSense <= #Tp 1'h0;
709
//    end
710
//  else
711
//    begin
712
//      CarrierSense_Rx1 <= #Tp mcrs_pad_i;
713
//      RxCarrierSense <= #Tp CarrierSense_Rx1;
714
//    end
715
//end
716 15 mohor
 
717
 
718
// Delayed WillTransmit
719 20 mohor
always @ (posedge mrx_clk_pad_i)
720 15 mohor
begin
721
  WillTransmit_q <= #Tp WillTransmit;
722
  WillTransmit_q2 <= #Tp WillTransmit_q;
723
end
724
 
725
 
726
assign Transmitting = ~r_FullD & WillTransmit_q2;
727
 
728
 
729
 
730
// Synchronized Receive Enable
731 240 tadejm
always @ (posedge mrx_clk_pad_i or posedge wb_rst_i)
732 15 mohor
begin
733 240 tadejm
  if(wb_rst_i)
734 15 mohor
    RxEnSync <= #Tp 1'b0;
735
  else
736 301 knguyen
  //if(~RxCarrierSense | RxCarrierSense & Transmitting)
737
  if(~mrxdv_pad_i)
738 15 mohor
    RxEnSync <= #Tp r_RxEn;
739
end
740
 
741
 
742
 
743 149 mohor
// Synchronizing WillSendControlFrame to WB_CLK;
744
always @ (posedge wb_clk_i or posedge wb_rst_i)
745
begin
746
  if(wb_rst_i)
747
    WillSendControlFrame_sync1 <= 1'b0;
748
  else
749
    WillSendControlFrame_sync1 <=#Tp WillSendControlFrame;
750
end
751 15 mohor
 
752 149 mohor
always @ (posedge wb_clk_i or posedge wb_rst_i)
753
begin
754
  if(wb_rst_i)
755
    WillSendControlFrame_sync2 <= 1'b0;
756
  else
757
    WillSendControlFrame_sync2 <=#Tp WillSendControlFrame_sync1;
758
end
759
 
760
always @ (posedge wb_clk_i or posedge wb_rst_i)
761
begin
762
  if(wb_rst_i)
763
    WillSendControlFrame_sync3 <= 1'b0;
764
  else
765
    WillSendControlFrame_sync3 <=#Tp WillSendControlFrame_sync2;
766
end
767
 
768
always @ (posedge wb_clk_i or posedge wb_rst_i)
769
begin
770
  if(wb_rst_i)
771
    RstTxPauseRq <= 1'b0;
772
  else
773
    RstTxPauseRq <=#Tp WillSendControlFrame_sync2 & ~WillSendControlFrame_sync3;
774
end
775
 
776
 
777 255 mohor
 
778
 
779
// TX Pause request Synchronization
780
always @ (posedge mtx_clk_pad_i or posedge wb_rst_i)
781
begin
782
  if(wb_rst_i)
783
    begin
784
      TxPauseRq_sync1 <= #Tp 1'b0;
785
      TxPauseRq_sync2 <= #Tp 1'b0;
786
      TxPauseRq_sync3 <= #Tp 1'b0;
787
    end
788
  else
789
    begin
790
      TxPauseRq_sync1 <= #Tp (r_TxPauseRq & r_TxFlow);
791
      TxPauseRq_sync2 <= #Tp TxPauseRq_sync1;
792
      TxPauseRq_sync3 <= #Tp TxPauseRq_sync2;
793
    end
794
end
795
 
796
 
797
always @ (posedge mtx_clk_pad_i or posedge wb_rst_i)
798
begin
799
  if(wb_rst_i)
800
    TPauseRq <= #Tp 1'b0;
801
  else
802
    TPauseRq <= #Tp TxPauseRq_sync2 & (~TxPauseRq_sync3);
803
end
804
 
805
 
806 261 mohor
wire LatchedMRxErr;
807
reg RxAbort_latch;
808
reg RxAbort_sync1;
809
reg RxAbort_sync2;
810
reg RxAbort_wb;
811
reg RxAbortRst_sync1;
812
reg RxAbortRst;
813 255 mohor
 
814 261 mohor
// Synchronizing RxAbort to the WISHBONE clock
815
always @ (posedge mrx_clk_pad_i or posedge wb_rst_i)
816
begin
817
  if(wb_rst_i)
818
    RxAbort_latch <= #Tp 1'b0;
819
  else if(RxAbort | (ShortFrame & ~r_RecSmall) | LatchedMRxErr & ~InvalidSymbol | (ReceivedPauseFrm & (~r_PassAll)))
820
    RxAbort_latch <= #Tp 1'b1;
821
  else if(RxAbortRst)
822
    RxAbort_latch <= #Tp 1'b0;
823
end
824 255 mohor
 
825 261 mohor
always @ (posedge wb_clk_i or posedge wb_rst_i)
826
begin
827
  if(wb_rst_i)
828
    begin
829
      RxAbort_sync1 <= #Tp 1'b0;
830
      RxAbort_wb    <= #Tp 1'b0;
831
      RxAbort_wb    <= #Tp 1'b0;
832
    end
833
  else
834
    begin
835
      RxAbort_sync1 <= #Tp RxAbort_latch;
836
      RxAbort_wb    <= #Tp RxAbort_sync1;
837
    end
838
end
839
 
840
always @ (posedge mrx_clk_pad_i or posedge wb_rst_i)
841
begin
842
  if(wb_rst_i)
843
    begin
844
      RxAbortRst_sync1 <= #Tp 1'b0;
845
      RxAbortRst       <= #Tp 1'b0;
846
    end
847
  else
848
    begin
849
      RxAbortRst_sync1 <= #Tp RxAbort_wb;
850
      RxAbortRst       <= #Tp RxAbortRst_sync1;
851
    end
852
end
853
 
854
 
855
 
856 114 mohor
// Connecting Wishbone module
857 41 mohor
eth_wishbone wishbone
858 15 mohor
(
859 41 mohor
  .WB_CLK_I(wb_clk_i),                .WB_DAT_I(wb_dat_i),
860 103 mohor
  .WB_DAT_O(BD_WB_DAT_O),
861 15 mohor
 
862
  // WISHBONE slave
863 76 mohor
  .WB_ADR_I(wb_adr_i[9:2]),           .WB_WE_I(wb_we_i),
864 21 mohor
  .BDCs(BDCs),                        .WB_ACK_O(BDAck),
865 15 mohor
 
866 240 tadejm
  .Reset(wb_rst_i),
867 41 mohor
 
868
  // WISHBONE master
869
  .m_wb_adr_o(m_wb_adr_o),            .m_wb_sel_o(m_wb_sel_o),                  .m_wb_we_o(m_wb_we_o),
870
  .m_wb_dat_i(m_wb_dat_i),            .m_wb_dat_o(m_wb_dat_o),                  .m_wb_cyc_o(m_wb_cyc_o),
871
  .m_wb_stb_o(m_wb_stb_o),            .m_wb_ack_i(m_wb_ack_i),                  .m_wb_err_i(m_wb_err_i),
872 214 mohor
 
873
`ifdef ETH_WISHBONE_B3
874
  .m_wb_cti_o(m_wb_cti_o),            .m_wb_bte_o(m_wb_bte_o),
875
`endif
876
 
877 41 mohor
 
878 15 mohor
    //TX
879 21 mohor
  .MTxClk(mtx_clk_pad_i),             .TxStartFrm(TxStartFrm),                  .TxEndFrm(TxEndFrm),
880 59 mohor
  .TxUsedData(TxUsedData),            .TxData(TxData),
881 15 mohor
  .TxRetry(TxRetry),                  .TxAbort(TxAbort),                        .TxUnderRun(TxUnderRun),
882 149 mohor
  .TxDone(TxDone),
883
  .PerPacketCrcEn(PerPacketCrcEn),    .PerPacketPad(PerPacketPad),
884 15 mohor
 
885
  // Register
886 34 mohor
  .r_TxEn(r_TxEn),                    .r_RxEn(r_RxEn),                          .r_TxBDNum(r_TxBDNum),
887 321 igorm
  .r_RxFlow(r_RxFlow),                      .r_PassAll(r_PassAll),
888 15 mohor
 
889
  //RX
890 21 mohor
  .MRxClk(mrx_clk_pad_i),             .RxData(RxData),                          .RxValid(RxValid),
891 41 mohor
  .RxStartFrm(RxStartFrm),            .RxEndFrm(RxEndFrm),
892 76 mohor
  .Busy_IRQ(Busy_IRQ),                .RxE_IRQ(RxE_IRQ),                        .RxB_IRQ(RxB_IRQ),
893 149 mohor
  .TxE_IRQ(TxE_IRQ),                  .TxB_IRQ(TxB_IRQ),
894 21 mohor
 
895 272 tadejm
  .RxAbort(RxAbort_wb),               .RxStatusWriteLatched_sync2(RxStatusWriteLatched_sync2),
896 41 mohor
 
897 42 mohor
  .InvalidSymbol(InvalidSymbol),      .LatchedCrcError(LatchedCrcError),        .RxLength(RxByteCnt),
898
  .RxLateCollision(RxLateCollision),  .ShortFrame(ShortFrame),                  .DribbleNibble(DribbleNibble),
899 59 mohor
  .ReceivedPacketTooBig(ReceivedPacketTooBig), .LoadRxStatus(LoadRxStatus),     .RetryCntLatched(RetryCntLatched),
900
  .RetryLimit(RetryLimit),            .LateCollLatched(LateCollLatched),        .DeferLatched(DeferLatched),
901 261 mohor
  .CarrierSenseLost(CarrierSenseLost),.ReceivedPacketGood(ReceivedPacketGood),  .AddressMiss(AddressMiss),
902
  .ReceivedPauseFrm(ReceivedPauseFrm)
903 59 mohor
 
904 210 mohor
`ifdef ETH_BIST
905 218 mohor
  ,
906 302 markom
  .mbist_si_i       (mbist_si_i),
907
  .mbist_so_o       (mbist_so_o),
908
  .mbist_ctrl_i       (mbist_ctrl_i)
909 210 mohor
`endif
910 15 mohor
);
911
 
912
 
913
 
914
// Connecting MacStatus module
915
eth_macstatus macstatus1
916
(
917 240 tadejm
  .MRxClk(mrx_clk_pad_i),             .Reset(wb_rst_i),
918 42 mohor
  .ReceiveEnd(ReceiveEnd),            .ReceivedPacketGood(ReceivedPacketGood),     .ReceivedLengthOK(ReceivedLengthOK),
919
  .RxCrcError(RxCrcError),            .MRxErr(MRxErr_Lb),                          .MRxDV(MRxDV_Lb),
920
  .RxStateSFD(RxStateSFD),            .RxStateData(RxStateData),                   .RxStatePreamble(RxStatePreamble),
921
  .RxStateIdle(RxStateIdle),          .Transmitting(Transmitting),                 .RxByteCnt(RxByteCnt),
922
  .RxByteCntEq0(RxByteCntEq0),        .RxByteCntGreat2(RxByteCntGreat2),           .RxByteCntMaxFrame(RxByteCntMaxFrame),
923 261 mohor
  .InvalidSymbol(InvalidSymbol),
924 42 mohor
  .MRxD(MRxD_Lb),                     .LatchedCrcError(LatchedCrcError),           .Collision(mcoll_pad_i),
925
  .CollValid(r_CollValid),            .RxLateCollision(RxLateCollision),           .r_RecSmall(r_RecSmall),
926
  .r_MinFL(r_MinFL),                  .r_MaxFL(r_MaxFL),                           .ShortFrame(ShortFrame),
927
  .DribbleNibble(DribbleNibble),      .ReceivedPacketTooBig(ReceivedPacketTooBig), .r_HugEn(r_HugEn),
928 59 mohor
  .LoadRxStatus(LoadRxStatus),        .RetryCnt(RetryCnt),                         .StartTxDone(StartTxDone),
929
  .StartTxAbort(StartTxAbort),        .RetryCntLatched(RetryCntLatched),           .MTxClk(mtx_clk_pad_i),
930
  .MaxCollisionOccured(MaxCollisionOccured), .RetryLimit(RetryLimit),              .LateCollision(LateCollision),
931 276 tadejm
  .LateCollLatched(LateCollLatched),  .DeferIndication(DeferIndication),           .DeferLatched(DeferLatched),
932 59 mohor
  .TxStartFrm(TxStartFrmOut),         .StatePreamble(StatePreamble),               .StateData(StateData),
933 125 mohor
  .CarrierSense(CarrierSense_Tx2),    .CarrierSenseLost(CarrierSenseLost),         .TxUsedData(TxUsedDataIn),
934 168 mohor
  .LatchedMRxErr(LatchedMRxErr),      .Loopback(r_LoopBck),                        .r_FullD(r_FullD)
935 15 mohor
);
936
 
937
 
938
endmodule

powered by: WebSVN 2.1.0

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