1 //////////////////////////////////////////////////////////////////////
\r
3 //// eth_outputcontrol.v ////
\r
5 //// This file is part of the Ethernet IP core project ////
\r
6 //// http://www.opencores.org/projects/ethmac/ ////
\r
9 //// - Igor Mohor (igorM@opencores.org) ////
\r
11 //// All additional information is avaliable in the Readme.txt ////
\r
14 //////////////////////////////////////////////////////////////////////
\r
16 //// Copyright (C) 2001 Authors ////
\r
18 //// This source file may be used and distributed without ////
\r
19 //// restriction provided that this copyright statement is not ////
\r
20 //// removed from the file and that any derivative work contains ////
\r
21 //// the original copyright notice and the associated disclaimer. ////
\r
23 //// This source file is free software; you can redistribute it ////
\r
24 //// and/or modify it under the terms of the GNU Lesser General ////
\r
25 //// Public License as published by the Free Software Foundation; ////
\r
26 //// either version 2.1 of the License, or (at your option) any ////
\r
27 //// later version. ////
\r
29 //// This source is distributed in the hope that it will be ////
\r
30 //// useful, but WITHOUT ANY WARRANTY; without even the implied ////
\r
31 //// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
\r
32 //// PURPOSE. See the GNU Lesser General Public License for more ////
\r
35 //// You should have received a copy of the GNU Lesser General ////
\r
36 //// Public License along with this source; if not, download it ////
\r
37 //// from http://www.opencores.org/lgpl.shtml ////
\r
39 //////////////////////////////////////////////////////////////////////
\r
41 // CVS Revision History
\r
43 // $Log: eth_outputcontrol.v,v $
\r
44 // Revision 1.2 2005/12/13 12:54:49 maverickist
\r
45 // first simulation passed
\r
47 // Revision 1.1.1.1 2005/12/13 01:51:45 Administrator
\r
50 // Revision 1.2 2005/04/27 15:58:46 Administrator
\r
53 // Revision 1.1.1.1 2004/12/15 06:38:54 Administrator
\r
56 // Revision 1.4 2002/07/09 20:11:59 mohor
\r
59 // Revision 1.3 2002/01/23 10:28:16 mohor
\r
60 // Link in the header changed.
\r
62 // Revision 1.2 2001/10/19 08:43:51 mohor
\r
63 // eth_timescale.v changed to timescale.v This is done because of the
\r
64 // simulation of the few cores in a one joined project.
\r
66 // Revision 1.1 2001/08/06 14:44:29 mohor
\r
67 // A define FPGA added to select between Artisan RAM (for ASIC) and Block Ram (For Virtex).
\r
68 // Include files fixed to contain no path.
\r
69 // File names and module names changed ta have a eth_ prologue in the name.
\r
70 // File eth_timescale.v is used to define timescale
\r
71 // All pin names on the top module are changed to contain _I, _O or _OE at the end.
\r
72 // Bidirectional signal MDIO is changed to three signals (Mdc_O, Mdi_I, Mdo_O
\r
73 // and Mdo_OE. The bidirectional signal must be created on the top level. This
\r
74 // is done due to the ASIC tools.
\r
76 // Revision 1.1 2001/07/30 21:23:42 mohor
\r
77 // Directory structure changed. Files checked and joind together.
\r
79 // Revision 1.3 2001/06/01 22:28:56 mohor
\r
80 // This files (MIIM) are fully working. They were thoroughly tested. The testbench is not updated.
\r
84 module eth_outputcontrol(Clk, Reset, InProgress, ShiftedBit, BitCounter, WriteOp, NoPre, MdcEn_n, Mdo, MdoEn);
\r
86 input Clk; // Host Clock
\r
87 input Reset; // General Reset
\r
88 input WriteOp; // Write Operation Latch (When asserted, write operation is in progress)
\r
89 input NoPre; // No Preamble (no 32-bit preamble)
\r
90 input InProgress; // Operation in progress
\r
91 input ShiftedBit; // This bit is output of the shift register and is connected to the Mdo signal
\r
92 input [6:0] BitCounter; // Bit Counter
\r
93 input MdcEn_n; // MII Management Data Clock Enable signal is asserted for one Clk period before Mdc falls.
\r
95 output Mdo; // MII Management Data Output
\r
96 output MdoEn; // MII Management Data Output Enable
\r
106 reg Mdo; // MII Management Data Output
\r
110 // Generation of the Serial Enable signal (enables the serialization of the data)
\r
111 assign SerialEn = WriteOp & InProgress & ( BitCounter>31 | ( ( BitCounter == 0 ) & NoPre ) )
\r
112 | ~WriteOp & InProgress & (( BitCounter>31 & BitCounter<46 ) | ( ( BitCounter == 0 ) & NoPre ));
\r
115 // Generation of the MdoEn signal
\r
116 always @ (posedge Clk or posedge Reset)
\r
128 MdoEn_2d <= SerialEn | InProgress & BitCounter<32;
\r
129 MdoEn_d <= MdoEn_2d;
\r
136 // Generation of the Mdo signal.
\r
137 always @ (posedge Clk or posedge Reset)
\r
149 Mdo_2d <= ~SerialEn & BitCounter<32;
\r
150 Mdo_d <= ShiftedBit | Mdo_2d;
\r