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

Subversion Repositories ethmac

[/] [ethmac/] [branches/] [unneback/] [rtl/] [verilog/] [eth_top.v] - Blame information for rev 327

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

powered by: WebSVN 2.1.0

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