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

Subversion Repositories ethmac

[/] [ethmac/] [trunk/] [rtl/] [verilog/] [ethmac.v] - Blame information for rev 20

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
////  http://www.opencores.org/cores/ethmac/                      ////
7
////                                                              ////
8
////  Author(s):                                                  ////
9
////      - Igor Mohor (igorM@opencores.org)                      ////
10
////                                                              ////
11
////  All additional information is avaliable in the Readme.txt   ////
12
////  file.                                                       ////
13
////                                                              ////
14
//////////////////////////////////////////////////////////////////////
15
////                                                              ////
16
//// Copyright (C) 2001 Authors                                   ////
17
////                                                              ////
18
//// This source file may be used and distributed without         ////
19
//// restriction provided that this copyright statement is not    ////
20
//// removed from the file and that any derivative work contains  ////
21
//// the original copyright notice and the associated disclaimer. ////
22
////                                                              ////
23
//// This source file is free software; you can redistribute it   ////
24
//// and/or modify it under the terms of the GNU Lesser General   ////
25
//// Public License as published by the Free Software Foundation; ////
26
//// either version 2.1 of the License, or (at your option) any   ////
27
//// later version.                                               ////
28
////                                                              ////
29
//// This source is distributed in the hope that it will be       ////
30
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
31
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
32
//// PURPOSE.  See the GNU Lesser General Public License for more ////
33
//// details.                                                     ////
34
////                                                              ////
35
//// You should have received a copy of the GNU Lesser General    ////
36
//// Public License along with this source; if not, download it   ////
37
//// from http://www.opencores.org/lgpl.shtml                     ////
38
////                                                              ////
39
//////////////////////////////////////////////////////////////////////
40
//
41
// CVS Revision History
42
//
43
// $Log: not supported by cvs2svn $
44 20 mohor
// Revision 1.2  2001/08/15 14:03:59  mohor
45
// Signal names changed on the top level for easier pad insertion (ASIC).
46
//
47 17 mohor
// Revision 1.1  2001/08/06 14:44:29  mohor
48
// A define FPGA added to select between Artisan RAM (for ASIC) and Block Ram (For Virtex).
49
// Include files fixed to contain no path.
50
// File names and module names changed ta have a eth_ prologue in the name.
51
// File eth_timescale.v is used to define timescale
52
// All pin names on the top module are changed to contain _I, _O or _OE at the end.
53
// Bidirectional signal MDIO is changed to three signals (Mdc_O, Mdi_I, Mdo_O
54
// and Mdo_OE. The bidirectional signal must be created on the top level. This
55
// is done due to the ASIC tools.
56
//
57 15 mohor
// Revision 1.2  2001/08/02 09:25:31  mohor
58
// Unconnected signals are now connected.
59
//
60
// Revision 1.1  2001/07/30 21:23:42  mohor
61
// Directory structure changed. Files checked and joind together.
62
//
63
//
64
//
65 20 mohor
// 
66 15 mohor
 
67
 
68
`include "eth_defines.v"
69
`include "eth_timescale.v"
70
 
71
 
72
module eth_top
73
(
74
  // WISHBONE common
75 17 mohor
  wb_clk_i, wb_rst_i, wb_dat_i, wb_dat_o,
76 15 mohor
 
77
  // WISHBONE slave
78 17 mohor
  wb_adr_i, wb_sel_i, wb_we_i, wb_cyc_i, wb_stb_i, wb_ack_o, wb_err_o,
79
  wb_req_o, wb_ack_i, wb_nd_o, wb_rd_o,
80 15 mohor
 
81
  //TX
82 20 mohor
  mtx_clk_pad_i, mtxd_pad_o, mtxen_pad_o, mtxerr_pad_o,
83 15 mohor
 
84
  //RX
85 20 mohor
  mrx_clk_pad_i, mrxd_pad_i, mrxdv_pad_i, mrxerr_pad_i, mcoll_pad_i, mcrs_pad_i,
86 15 mohor
 
87
  // MIIM
88 20 mohor
  mdc_pad_o, md_pad_i, md_pad_o, md_padoen_o
89 17 mohor
 
90
 
91 15 mohor
);
92
 
93
 
94
parameter Tp = 1;
95
 
96
 
97
// WISHBONE common
98 17 mohor
input           wb_clk_i;     // WISHBONE clock
99
input           wb_rst_i;     // WISHBONE reset
100
input   [31:0]  wb_dat_i;     // WISHBONE data input
101
output  [31:0]  wb_dat_o;     // WISHBONE data output
102
output          wb_err_o;     // WISHBONE error output
103 15 mohor
 
104
// WISHBONE slave
105 17 mohor
input   [31:0]  wb_adr_i;     // WISHBONE address input
106
input    [3:0]  wb_sel_i;     // WISHBONE byte select input
107
input           wb_we_i;      // WISHBONE write enable input
108
input           wb_cyc_i;     // WISHBONE cycle input
109
input           wb_stb_i;     // WISHBONE strobe input
110
output          wb_ack_o;     // WISHBONE acknowledge output
111 15 mohor
 
112
// DMA
113 17 mohor
input    [1:0]  wb_ack_i;     // DMA acknowledge input
114
output   [1:0]  wb_req_o;     // DMA request output
115
output   [1:0]  wb_nd_o;      // DMA force new descriptor output
116
output          wb_rd_o;      // DMA restart descriptor output
117 15 mohor
 
118
// Tx
119 20 mohor
input           mtx_clk_pad_i; // Transmit clock (from PHY)
120 17 mohor
output   [3:0]  mtxd_pad_o;   // Transmit nibble (to PHY)
121
output          mtxen_pad_o;  // Transmit enable (to PHY)
122
output          mtxerr_pad_o; // Transmit error (to PHY)
123 15 mohor
 
124
// Rx
125 20 mohor
input           mrx_clk_pad_i; // Receive clock (from PHY)
126 17 mohor
input    [3:0]  mrxd_pad_i;   // Receive nibble (from PHY)
127
input           mrxdv_pad_i;  // Receive data valid (from PHY)
128
input           mrxerr_pad_i; // Receive data error (from PHY)
129 15 mohor
 
130
// Common Tx and Rx
131 17 mohor
input           mcoll_pad_i;  // Collision (from PHY)
132
input           mcrs_pad_i;   // Carrier sense (from PHY)
133 15 mohor
 
134
// MII Management interface
135 17 mohor
input           md_pad_i;     // MII data input (from I/O cell)
136
output          mdc_pad_o;    // MII Management data clock (to PHY)
137
output          md_pad_o;     // MII data output (to I/O cell)
138 20 mohor
output          md_padoen_o;    // MII data output enable (to I/O cell)
139 15 mohor
 
140
 
141
wire     [7:0]  r_ClkDiv;
142
wire            r_MiiNoPre;
143
wire    [15:0]  r_CtrlData;
144
wire     [4:0]  r_FIAD;
145
wire     [4:0]  r_RGAD;
146
wire            r_WCtrlData;
147
wire            r_RStat;
148
wire            r_ScanStat;
149
wire            NValid_stat;
150
wire            Busy_stat;
151
wire            LinkFail;
152
wire            r_MiiMRst;
153
wire    [15:0]  Prsd;             // Read Status Data (data read from the PHY)
154
wire            WCtrlDataStart;
155
wire            RStatStart;
156
wire            UpdateMIIRX_DATAReg;
157
 
158
wire            TxStartFrm;
159
wire            TxEndFrm;
160
wire            TxUsedData;
161
wire     [7:0]  TxData;
162
wire            TxRetry;
163
wire            TxAbort;
164
wire            TxUnderRun;
165
wire            TxDone;
166
 
167
 
168
 
169
 
170
// Connecting Miim module
171
eth_miim miim1
172
(
173 17 mohor
  .Clk(wb_clk_i),                         .Reset(r_MiiMRst),                  .Divider(r_ClkDiv),
174 15 mohor
  .NoPre(r_MiiNoPre),                     .CtrlData(r_CtrlData),              .Rgad(r_RGAD),
175
  .Fiad(r_FIAD),                          .WCtrlData(r_WCtrlData),            .RStat(r_RStat),
176 17 mohor
  .ScanStat(r_ScanStat),                  .Mdi(md_pad_i),                     .Mdo(md_pad_o),
177 20 mohor
  .MdoEn(md_padoen_o),                      .Mdc(mdc_pad_o),                    .Busy(Busy_stat),
178 15 mohor
  .Prsd(Prsd),                            .LinkFail(LinkFail),                .Nvalid(NValid_stat),
179
  .WCtrlDataStart(WCtrlDataStart),        .RStatStart(RStatStart),            .UpdateMIIRX_DATAReg(UpdateMIIRX_DATAReg)
180
);
181
 
182
 
183
 
184
 
185
wire        RegCs;          // Connected to registers
186 17 mohor
wire [31:0] RegDataOut;     // Multiplexed to wb_dat_o
187 15 mohor
wire        r_DmaEn;        // DMA enable
188
wire        r_Rst;          // Reset
189
wire        r_LoopBck;      // Loopback
190
wire        r_TxEn;         // Tx Enable
191
wire        r_RxEn;         // Rx Enable
192
 
193
wire        MRxDV_Lb;       // Muxed MII receive data valid
194
wire        MRxErr_Lb;      // Muxed MII Receive Error
195
wire  [3:0] MRxD_Lb;        // Muxed MII Receive Data
196
wire        Transmitting;   // Indication that TxEthMAC is transmitting
197
wire        r_HugEn;        // Huge packet enable
198
wire        r_DlyCrcEn;     // Delayed CRC enabled
199
wire [15:0] r_MaxFL;        // Maximum frame length
200
 
201
wire [15:0] r_MinFL;        // Minimum frame length
202
wire [47:0] r_MAC;          // MAC address
203
 
204
wire  [7:0] r_RxBDAddress;  // Receive buffer descriptor base address
205
wire  [6:0] r_IPGT;         // 
206
wire  [6:0] r_IPGR1;        // 
207
wire  [6:0] r_IPGR2;        // 
208
wire  [5:0] r_CollValid;    // 
209
wire        r_TPauseRq;     // Transmit PAUSE request pulse
210
 
211
wire  [3:0] r_MaxRet;       //
212
wire        r_NoBckof;      // 
213
wire        r_ExDfrEn;      // 
214
wire        RX_BD_ADR_Wr;   // Write enable that writes RX_BD_ADR to the registers.
215
wire        TPauseRq;       // Sinhronized Tx PAUSE request
216
wire [15:0] TxPauseTV;      // Tx PAUSE timer value
217
wire        r_TxFlow;       // Tx flow control enable
218
wire        r_IFG;          // Minimum interframe gap for incoming packets
219
 
220
wire        EthAddMatch;
221
wire        WB_STB_I_eth;
222
wire        WB_CYC_I_eth;
223
 
224
wire        DWord;
225
wire        RegAck;
226
wire        BDAck;
227 17 mohor
wire [31:0] DMA_WB_DAT_O;   // wb_dat_o that comes from the WishboneDMA module
228 15 mohor
 
229
 
230
 
231 20 mohor
assign EthAddMatch = wb_adr_i[31:16] == `ETH_ETHERNET_SPACE;
232 17 mohor
assign WB_STB_I_eth = wb_stb_i & EthAddMatch;
233
assign WB_CYC_I_eth = wb_stb_i & EthAddMatch;
234 15 mohor
 
235 17 mohor
assign wb_err_o = wb_stb_i & wb_cyc_i & EthAddMatch & ~DWord;
236
assign DWord = &wb_sel_i;
237 20 mohor
assign RegCs = wb_stb_i & wb_cyc_i & DWord & EthAddMatch & (wb_adr_i[15:12] == `ETH_REG_SPACE);
238 15 mohor
assign RegAck = RegCs;
239 17 mohor
assign wb_ack_o = RegAck | BDAck;
240 15 mohor
 
241
 
242
// Selecting the WISHBONE output data
243 17 mohor
assign wb_dat_o[31:0] = (RegCs & ~wb_we_i)? RegDataOut : DMA_WB_DAT_O;
244 15 mohor
 
245
 
246
// Connecting Ethernet registers
247
eth_registers ethreg1
248
(
249 17 mohor
  .DataIn(wb_dat_i),                      .Address(wb_adr_i[7:2]),                    .Rw(wb_we_i),
250
  .Cs(RegCs),                             .Clk(wb_clk_i),                             .Reset(wb_rst_i),
251 15 mohor
  .DataOut(RegDataOut),                   .r_DmaEn(r_DmaEn),                          .r_RecSmall(),
252
  .r_Pad(r_Pad),                          .r_HugEn(r_HugEn),                          .r_CrcEn(r_CrcEn),
253
  .r_DlyCrcEn(r_DlyCrcEn),                .r_Rst(r_Rst),                              .r_FullD(r_FullD),
254
  .r_ExDfrEn(r_ExDfrEn),                  .r_NoBckof(r_NoBckof),                      .r_LoopBck(r_LoopBck),
255
  .r_IFG(r_IFG),                          .r_Pro(),                                   .r_Iam(),
256
  .r_Bro(),                               .r_NoPre(r_NoPre),                          .r_TxEn(r_TxEn),
257
  .r_RxEn(r_RxEn),                        .Busy_IRQ(),                                .RxF_IRQ(),
258
  .RxB_IRQ(),                             .TxE_IRQ(),                                 .TxB_IRQ(),
259
  .Busy_MASK(),                           .RxF_MASK(),                                .RxB_MASK(),
260
  .TxE_MASK(),                            .TxB_MASK(),                                .r_IPGT(r_IPGT),
261
  .r_IPGR1(r_IPGR1),                      .r_IPGR2(r_IPGR2),                          .r_MinFL(r_MinFL),
262
  .r_MaxFL(r_MaxFL),                      .r_MaxRet(r_MaxRet),                        .r_CollValid(r_CollValid),
263
  .r_TxFlow(r_TxFlow),                    .r_RxFlow(r_RxFlow),                        .r_PassAll(r_PassAll),
264
  .r_MiiMRst(r_MiiMRst),                  .r_MiiNoPre(r_MiiNoPre),                    .r_ClkDiv(r_ClkDiv),
265
  .r_WCtrlData(r_WCtrlData),              .r_RStat(r_RStat),                          .r_ScanStat(r_ScanStat),
266
  .r_RGAD(r_RGAD),                        .r_FIAD(r_FIAD),                            .r_CtrlData(r_CtrlData),
267
  .NValid_stat(NValid_stat),              .Busy_stat(Busy_stat),
268
  .LinkFail(LinkFail),                    .r_MAC(r_MAC),                              .WCtrlDataStart(WCtrlDataStart),
269
  .RStatStart(RStatStart),                .UpdateMIIRX_DATAReg(UpdateMIIRX_DATAReg),  .Prsd(Prsd),
270
  .r_RxBDAddress(r_RxBDAddress),          .RX_BD_ADR_Wr(RX_BD_ADR_Wr)
271
);
272
 
273
 
274
 
275
wire  [7:0] RxData;
276
wire        RxValid;
277
wire        RxStartFrm;
278
wire        RxEndFrm;
279
 
280
wire        WillTransmit;            // Will transmit (to RxEthMAC)
281
wire        ResetCollision;          // Reset Collision (for synchronizing collision)
282
wire  [7:0] TxDataOut;               // Transmit Packet Data (to TxEthMAC)
283
wire        WillSendControlFrame;
284
wire        TxCtrlEndFrm;
285
wire        ReceivedPauseFrm;
286
wire        ReceiveEnd;
287
wire        ReceivedPacketGood;
288
wire        ReceivedLengthOK;
289
 
290
// Connecting MACControl
291
eth_maccontrol maccontrol1
292
(
293 20 mohor
  .MTxClk(mtx_clk_pad_i),                        .TPauseRq(TPauseRq),
294 15 mohor
  .TxPauseTV(TxPauseTV),                        .TxDataIn(TxData),
295
  .TxStartFrmIn(TxStartFrm),                    .TxEndFrmIn(TxEndFrm),
296
  .TxUsedDataIn(TxUsedDataIn),                  .TxDoneIn(TxDoneIn),
297 20 mohor
  .TxAbortIn(TxAbortIn),                        .MRxClk(mrx_clk_pad_i),
298 15 mohor
  .RxData(RxData),                              .RxValid(RxValid),
299
  .RxStartFrm(RxStartFrm),                      .RxEndFrm(RxEndFrm),
300
  .ReceiveEnd(ReceiveEnd),                      .ReceivedPacketGood(ReceivedPacketGood),
301
  .PassAll(r_PassAll),                          .TxFlow(r_TxFlow),
302
  .RxFlow(r_RxFlow),                            .DlyCrcEn(r_DlyCrcEn),
303
  .MAC(r_MAC),                                  .PadIn(r_Pad | PerPacketPad),
304
  .PadOut(PadOut),                              .CrcEnIn(r_CrcEn | PerPacketCrcEn),
305
  .CrcEnOut(CrcEnOut),                          .TxReset(r_Rst),
306
  .RxReset(r_Rst),                              .ReceivedLengthOK(ReceivedLengthOK),
307
  .TxDataOut(TxDataOut),                        .TxStartFrmOut(TxStartFrmOut),
308
  .TxEndFrmOut(TxEndFrmOut),                    .TxUsedDataOut(TxUsedData),
309
  .TxDoneOut(TxDone),                           .TxAbortOut(TxAbort),
310
  .WillSendControlFrame(WillSendControlFrame),  .TxCtrlEndFrm(TxCtrlEndFrm),
311
  .ReceivedPauseFrm(ReceivedPauseFrm)
312
);
313
 
314
 
315
 
316
wire TxCarrierSense;          // Synchronized CarrierSense (to Tx clock)
317
wire Collision;               // Synchronized Collision
318
 
319
reg CarrierSense_Tx1;
320
reg CarrierSense_Tx2;
321
reg Collision_Tx1;
322
reg Collision_Tx2;
323
 
324
reg RxEnSync;                 // Synchronized Receive Enable
325
reg CarrierSense_Rx1;
326
reg RxCarrierSense;           // Synchronized CarrierSense (to Rx clock)
327
reg WillTransmit_q;
328
reg WillTransmit_q2;
329
 
330
 
331
 
332
// Muxed MII receive data valid
333 17 mohor
assign MRxDV_Lb = r_LoopBck? mtxen_pad_o : mrxdv_pad_i & RxEnSync;
334 15 mohor
 
335
// Muxed MII Receive Error
336 17 mohor
assign MRxErr_Lb = r_LoopBck? mtxerr_pad_o : mrxerr_pad_i & RxEnSync;
337 15 mohor
 
338
// Muxed MII Receive Data
339 17 mohor
assign MRxD_Lb[3:0] = r_LoopBck? mtxd_pad_o[3:0] : mrxd_pad_i[3:0];
340 15 mohor
 
341
 
342
 
343
// Connecting TxEthMAC
344
eth_txethmac txethmac1
345
(
346 20 mohor
  .MTxClk(mtx_clk_pad_i),              .Reset(r_Rst),                      .CarrierSense(TxCarrierSense),
347 15 mohor
  .Collision(Collision),              .TxData(TxDataOut),                 .TxStartFrm(TxStartFrmOut),
348
  .TxUnderRun(TxUnderRun),            .TxEndFrm(TxEndFrmOut),             .Pad(PadOut),
349
  .MinFL(r_MinFL),                    .CrcEn(CrcEnOut),                   .FullD(r_FullD),
350
  .HugEn(r_HugEn),                    .DlyCrcEn(r_DlyCrcEn),              .IPGT(r_IPGT),
351
  .IPGR1(r_IPGR1),                    .IPGR2(r_IPGR2),                    .CollValid(r_CollValid),
352
  .MaxRet(r_MaxRet),                  .NoBckof(r_NoBckof),                .ExDfrEn(r_ExDfrEn),
353 17 mohor
  .MaxFL(r_MaxFL),                    .MTxEn(mtxen_pad_o),                .MTxD(mtxd_pad_o),
354
  .MTxErr(mtxerr_pad_o),              .TxUsedData(TxUsedDataIn),          .TxDone(TxDoneIn),
355 15 mohor
  .TxRetry(TxRetry),                  .TxAbort(TxAbortIn),                .WillTransmit(WillTransmit),
356
  .ResetCollision(ResetCollision)
357
);
358
 
359
 
360
 
361
 
362
wire  [15:0]  RxByteCnt;
363
wire          RxByteCntEq0;
364
wire          RxByteCntGreat2;
365
wire          RxByteCntMaxFrame;
366
wire          RxCrcError;
367
wire          RxStateIdle;
368
wire          RxStatePreamble;
369
wire          RxStateSFD;
370
wire   [1:0]  RxStateData;
371
 
372
 
373
 
374
 
375
// Connecting RxEthMAC
376
eth_rxethmac rxethmac1
377
(
378 20 mohor
  .MRxClk(mrx_clk_pad_i),                .MRxDV(MRxDV_Lb),                     .MRxD(MRxD_Lb),
379 15 mohor
  .Transmitting(Transmitting),          .HugEn(r_HugEn),                      .DlyCrcEn(r_DlyCrcEn),
380
  .MaxFL(r_MaxFL),                      .r_IFG(r_IFG),                        .Reset(r_Rst),
381
  .RxData(RxData),                      .RxValid(RxValid),                    .RxStartFrm(RxStartFrm),
382
  .RxEndFrm(RxEndFrm),                  .CrcHash(),                           .CrcHashGood(),
383
  .Broadcast(),                         .Multicast(),                         .ByteCnt(RxByteCnt),
384
  .ByteCntEq0(RxByteCntEq0),            .ByteCntGreat2(RxByteCntGreat2),      .ByteCntMaxFrame(RxByteCntMaxFrame),
385
  .CrcError(RxCrcError),                .StateIdle(RxStateIdle),              .StatePreamble(RxStatePreamble),
386
  .StateSFD(RxStateSFD),                .StateData(RxStateData)
387
);
388
 
389
 
390
// MII Carrier Sense Synchronization
391 20 mohor
always @ (posedge mtx_clk_pad_i or posedge r_Rst)
392 15 mohor
begin
393
  if(r_Rst)
394
    begin
395
      CarrierSense_Tx1 <= #Tp 1'b0;
396
      CarrierSense_Tx2 <= #Tp 1'b0;
397
    end
398
  else
399
    begin
400 17 mohor
      CarrierSense_Tx1 <= #Tp mcrs_pad_i;
401 15 mohor
      CarrierSense_Tx2 <= #Tp CarrierSense_Tx1;
402
    end
403
end
404
 
405
assign TxCarrierSense = ~r_FullD & CarrierSense_Tx2;
406
 
407
 
408
// MII Collision Synchronization
409 20 mohor
always @ (posedge mtx_clk_pad_i or posedge r_Rst)
410 15 mohor
begin
411
  if(r_Rst)
412
    begin
413
      Collision_Tx1 <= #Tp 1'b0;
414
      Collision_Tx2 <= #Tp 1'b0;
415
    end
416
  else
417
    begin
418 17 mohor
      Collision_Tx1 <= #Tp mcoll_pad_i;
419 15 mohor
      if(ResetCollision)
420
        Collision_Tx2 <= #Tp 1'b0;
421
      else
422
      if(Collision_Tx1)
423
        Collision_Tx2 <= #Tp 1'b1;
424
    end
425
end
426
 
427
 
428
// Synchronized Collision
429
assign Collision = ~r_FullD & Collision_Tx2;
430
 
431
 
432
 
433
// Carrier sense is synchronized to receive clock.
434 20 mohor
always @ (posedge mrx_clk_pad_i or posedge r_Rst)
435 15 mohor
begin
436
  if(r_Rst)
437
    begin
438
      CarrierSense_Rx1 <= #Tp 1'h0;
439
      RxCarrierSense <= #Tp 1'h0;
440
    end
441
  else
442
    begin
443 17 mohor
      CarrierSense_Rx1 <= #Tp mcrs_pad_i;
444 15 mohor
      RxCarrierSense <= #Tp CarrierSense_Rx1;
445
    end
446
end
447
 
448
 
449
// Delayed WillTransmit
450 20 mohor
always @ (posedge mrx_clk_pad_i)
451 15 mohor
begin
452
  WillTransmit_q <= #Tp WillTransmit;
453
  WillTransmit_q2 <= #Tp WillTransmit_q;
454
end
455
 
456
 
457
assign Transmitting = ~r_FullD & WillTransmit_q2;
458
 
459
 
460
 
461
// Synchronized Receive Enable
462 20 mohor
always @ (posedge mrx_clk_pad_i or posedge r_Rst)
463 15 mohor
begin
464
  if(r_Rst)
465
    RxEnSync <= #Tp 1'b0;
466
  else
467
  if(~RxCarrierSense | RxCarrierSense & Transmitting)
468
    RxEnSync <= #Tp r_RxEn;
469
end
470
 
471
 
472
 
473
 
474
// Connecting WishboneDMA module
475
eth_wishbonedma wbdma
476
(
477 17 mohor
  .WB_CLK_I(wb_clk_i),                .WB_RST_I(wb_rst_i),                      .WB_DAT_I(wb_dat_i),
478 15 mohor
  .WB_DAT_O(DMA_WB_DAT_O),
479
 
480
  // WISHBONE slave
481 17 mohor
  .WB_ADR_I(wb_adr_i),                .WB_SEL_I(wb_sel_i),                      .WB_WE_I(wb_we_i),
482 15 mohor
  .WB_CYC_I(WB_CYC_I_eth),            .WB_STB_I(WB_STB_I_eth),                  .WB_ACK_O(BDAck),
483 17 mohor
  .WB_REQ_O(wb_req_o),                .WB_ACK_I(wb_ack_i),                      .WB_ND_O(wb_nd_o),
484
  .WB_RD_O(wb_rd_o),
485 15 mohor
 
486
    //TX
487 20 mohor
  .MTxClk(mtx_clk_pad_i),              .TxStartFrm(TxStartFrm),                  .TxEndFrm(TxEndFrm),
488 15 mohor
  .TxUsedData(TxUsedData),            .TxData(TxData),                          .StatusIzTxEthMACModula(16'h0),
489
  .TxRetry(TxRetry),                  .TxAbort(TxAbort),                        .TxUnderRun(TxUnderRun),
490
  .TxDone(TxDone),                    .TPauseRq(TPauseRq),                      .TxPauseTV(TxPauseTV),
491
  .PerPacketCrcEn(PerPacketCrcEn),    .PerPacketPad(PerPacketPad),              .WillSendControlFrame(WillSendControlFrame),
492
  .TxCtrlEndFrm(TxCtrlEndFrm),
493
 
494
  // Register
495
  .r_TxEn(r_TxEn),                    .r_RxEn(r_RxEn),                          .r_RxBDAddress(r_RxBDAddress),
496
  .r_DmaEn(r_DmaEn),                  .RX_BD_ADR_Wr(RX_BD_ADR_Wr),
497
 
498
  //RX
499 20 mohor
  .MRxClk(mrx_clk_pad_i),              .RxData(RxData),                          .RxValid(RxValid),
500 15 mohor
  .RxStartFrm(RxStartFrm),            .RxEndFrm(RxEndFrm)
501
);
502
 
503
 
504
 
505
// Connecting MacStatus module
506
eth_macstatus macstatus1
507
(
508 20 mohor
  .MRxClk(mrx_clk_pad_i),              .Reset(r_Rst),                            .TransmitEnd(),
509 15 mohor
  .ReceiveEnd(ReceiveEnd),            .ReceivedPacketGood(ReceivedPacketGood),  .ReceivedLengthOK(ReceivedLengthOK),
510
  .RxCrcError(RxCrcError),            .MRxErr(MRxErr_Lb),                       .MRxDV(MRxDV_Lb),
511
  .RxStateSFD(RxStateSFD),            .RxStateData(RxStateData),                .RxStatePreamble(RxStatePreamble),
512
  .RxStateIdle(RxStateIdle),          .Transmitting(Transmitting),              .RxByteCnt(RxByteCnt),
513
  .RxByteCntEq0(RxByteCntEq0),        .RxByteCntGreat2(RxByteCntGreat2),        .RxByteCntMaxFrame(RxByteCntMaxFrame),
514
  .ReceivedPauseFrm(ReceivedPauseFrm)
515
);
516
 
517
 
518
endmodule

powered by: WebSVN 2.1.0

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