| 1 |
15 |
mohor |
//////////////////////////////////////////////////////////////////////
|
| 2 |
|
|
//// ////
|
| 3 |
|
|
//// eth_miim.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 |
22 |
mohor |
// Revision 1.1 2001/08/06 14:44:29 mohor
|
| 45 |
|
|
// A define FPGA added to select between Artisan RAM (for ASIC) and Block Ram (For Virtex).
|
| 46 |
|
|
// Include files fixed to contain no path.
|
| 47 |
|
|
// File names and module names changed ta have a eth_ prologue in the name.
|
| 48 |
|
|
// File eth_timescale.v is used to define timescale
|
| 49 |
|
|
// All pin names on the top module are changed to contain _I, _O or _OE at the end.
|
| 50 |
|
|
// Bidirectional signal MDIO is changed to three signals (Mdc_O, Mdi_I, Mdo_O
|
| 51 |
|
|
// and Mdo_OE. The bidirectional signal must be created on the top level. This
|
| 52 |
|
|
// is done due to the ASIC tools.
|
| 53 |
|
|
//
|
| 54 |
15 |
mohor |
// Revision 1.2 2001/08/02 09:25:31 mohor
|
| 55 |
|
|
// Unconnected signals are now connected.
|
| 56 |
|
|
//
|
| 57 |
|
|
// Revision 1.1 2001/07/30 21:23:42 mohor
|
| 58 |
|
|
// Directory structure changed. Files checked and joind together.
|
| 59 |
|
|
//
|
| 60 |
|
|
// Revision 1.3 2001/06/01 22:28:56 mohor
|
| 61 |
|
|
// This files (MIIM) are fully working. They were thoroughly tested. The testbench is not updated.
|
| 62 |
|
|
//
|
| 63 |
|
|
//
|
| 64 |
|
|
|
| 65 |
22 |
mohor |
`include "timescale.v"
|
| 66 |
15 |
mohor |
|
| 67 |
|
|
|
| 68 |
|
|
module eth_miim
|
| 69 |
|
|
(
|
| 70 |
|
|
Clk,
|
| 71 |
|
|
Reset,
|
| 72 |
|
|
Divider,
|
| 73 |
|
|
NoPre,
|
| 74 |
|
|
CtrlData,
|
| 75 |
|
|
Rgad,
|
| 76 |
|
|
Fiad,
|
| 77 |
|
|
WCtrlData,
|
| 78 |
|
|
RStat,
|
| 79 |
|
|
ScanStat,
|
| 80 |
|
|
Mdi,
|
| 81 |
|
|
Mdo,
|
| 82 |
|
|
MdoEn,
|
| 83 |
|
|
Mdc,
|
| 84 |
|
|
Busy,
|
| 85 |
|
|
Prsd,
|
| 86 |
|
|
LinkFail,
|
| 87 |
|
|
Nvalid,
|
| 88 |
|
|
WCtrlDataStart,
|
| 89 |
|
|
RStatStart,
|
| 90 |
|
|
UpdateMIIRX_DATAReg
|
| 91 |
|
|
);
|
| 92 |
|
|
|
| 93 |
|
|
|
| 94 |
|
|
|
| 95 |
|
|
input Clk; // Host Clock
|
| 96 |
|
|
input Reset; // General Reset
|
| 97 |
|
|
input [7:0] Divider; // Divider for the host clock
|
| 98 |
|
|
input [15:0] CtrlData; // Control Data (to be written to the PHY reg.)
|
| 99 |
|
|
input [4:0] Rgad; // Register Address (within the PHY)
|
| 100 |
|
|
input [4:0] Fiad; // PHY Address
|
| 101 |
|
|
input NoPre; // No Preamble (no 32-bit preamble)
|
| 102 |
|
|
input WCtrlData; // Write Control Data operation
|
| 103 |
|
|
input RStat; // Read Status operation
|
| 104 |
|
|
input ScanStat; // Scan Status operation
|
| 105 |
|
|
input Mdi; // MII Management Data In
|
| 106 |
|
|
|
| 107 |
|
|
output Mdc; // MII Management Data Clock
|
| 108 |
|
|
output Mdo; // MII Management Data Output
|
| 109 |
|
|
output MdoEn; // MII Management Data Output Enable
|
| 110 |
|
|
output Busy; // Busy Signal
|
| 111 |
|
|
output LinkFail; // Link Integrity Signal
|
| 112 |
|
|
output Nvalid; // Invalid Status (qualifier for the valid scan result)
|
| 113 |
|
|
|
| 114 |
|
|
output [15:0] Prsd; // Read Status Data (data read from the PHY)
|
| 115 |
|
|
|
| 116 |
|
|
output WCtrlDataStart; // This signals resets the WCTRLDATA bit in the MIIM Command register
|
| 117 |
|
|
output RStatStart; // This signal resets the RSTAT BIT in the MIIM Command register
|
| 118 |
|
|
output UpdateMIIRX_DATAReg;// Updates MII RX_DATA register with read data
|
| 119 |
|
|
|
| 120 |
|
|
parameter Tp = 1;
|
| 121 |
|
|
|
| 122 |
|
|
|
| 123 |
|
|
reg Nvalid;
|
| 124 |
|
|
reg EndBusy_d; // Pre-end Busy signal
|
| 125 |
|
|
reg EndBusy; // End Busy signal (stops the operation in progress)
|
| 126 |
|
|
|
| 127 |
|
|
reg WCtrlData_q1; // Write Control Data operation delayed 1 Clk cycle
|
| 128 |
|
|
reg WCtrlData_q2; // Write Control Data operation delayed 2 Clk cycles
|
| 129 |
|
|
reg WCtrlData_q3; // Write Control Data operation delayed 3 Clk cycles
|
| 130 |
|
|
reg WCtrlDataStart; // Start Write Control Data Command (positive edge detected)
|
| 131 |
|
|
reg WCtrlDataStart_q;
|
| 132 |
|
|
reg WCtrlDataStart_q1; // Start Write Control Data Command delayed 1 Mdc cycle
|
| 133 |
|
|
reg WCtrlDataStart_q2; // Start Write Control Data Command delayed 2 Mdc cycles
|
| 134 |
|
|
|
| 135 |
|
|
reg RStat_q1; // Read Status operation delayed 1 Clk cycle
|
| 136 |
|
|
reg RStat_q2; // Read Status operation delayed 2 Clk cycles
|
| 137 |
|
|
reg RStat_q3; // Read Status operation delayed 3 Clk cycles
|
| 138 |
|
|
reg RStatStart; // Start Read Status Command (positive edge detected)
|
| 139 |
|
|
reg RStatStart_q1; // Start Read Status Command delayed 1 Mdc cycle
|
| 140 |
|
|
reg RStatStart_q2; // Start Read Status Command delayed 2 Mdc cycles
|
| 141 |
|
|
|
| 142 |
|
|
reg ScanStat_q1; // Scan Status operation delayed 1 cycle
|
| 143 |
|
|
reg ScanStat_q2; // Scan Status operation delayed 2 cycles
|
| 144 |
|
|
reg SyncStatMdcEn; // Scan Status operation delayed at least cycles and synchronized to MdcEn
|
| 145 |
|
|
|
| 146 |
|
|
wire WriteDataOp; // Write Data Operation (positive edge detected)
|
| 147 |
|
|
wire ReadStatusOp; // Read Status Operation (positive edge detected)
|
| 148 |
|
|
wire ScanStatusOp; // Scan Status Operation (positive edge detected)
|
| 149 |
|
|
wire StartOp; // Start Operation (start of any of the preceding operations)
|
| 150 |
|
|
wire EndOp; // End of Operation
|
| 151 |
|
|
|
| 152 |
|
|
reg InProgress; // Operation in progress
|
| 153 |
|
|
reg InProgress_q1; // Operation in progress delayed 1 Mdc cycle
|
| 154 |
|
|
reg InProgress_q2; // Operation in progress delayed 2 Mdc cycles
|
| 155 |
|
|
reg InProgress_q3; // Operation in progress delayed 3 Mdc cycles
|
| 156 |
|
|
|
| 157 |
|
|
reg WriteOp; // Write Operation Latch (When asserted, write operation is in progress)
|
| 158 |
|
|
reg [6:0] BitCounter; // Bit Counter
|
| 159 |
|
|
|
| 160 |
|
|
|
| 161 |
|
|
wire MdcFrame; // Frame window for limiting the Mdc
|
| 162 |
|
|
wire [3:0] ByteSelect; // Byte Select defines which byte (preamble, data, operation, etc.) is loaded and shifted through the shift register.
|
| 163 |
|
|
wire MdcEn; // MII Management Data Clock Enable signal is asserted for one Clk period before Mdc rises.
|
| 164 |
|
|
wire ShiftedBit; // This bit is output of the shift register and is connected to the Mdo signal
|
| 165 |
|
|
|
| 166 |
|
|
|
| 167 |
|
|
wire LatchByte1_d2;
|
| 168 |
|
|
wire LatchByte0_d2;
|
| 169 |
|
|
reg LatchByte1_d;
|
| 170 |
|
|
reg LatchByte0_d;
|
| 171 |
|
|
reg [1:0] LatchByte; // Latch Byte selects which part of Read Status Data is updated from the shift register
|
| 172 |
|
|
|
| 173 |
|
|
reg UpdateMIIRX_DATAReg;// Updates MII RX_DATA register with read data
|
| 174 |
|
|
|
| 175 |
|
|
|
| 176 |
|
|
|
| 177 |
|
|
|
| 178 |
|
|
|
| 179 |
|
|
// Generation of the EndBusy signal. It is used for ending the MII Management operation.
|
| 180 |
|
|
always @ (posedge Clk or posedge Reset)
|
| 181 |
|
|
begin
|
| 182 |
|
|
if(Reset)
|
| 183 |
|
|
begin
|
| 184 |
|
|
EndBusy_d <= #Tp 1'b0;
|
| 185 |
|
|
EndBusy <= #Tp 1'b0;
|
| 186 |
|
|
end
|
| 187 |
|
|
else
|
| 188 |
|
|
begin
|
| 189 |
|
|
EndBusy_d <= #Tp ~InProgress_q2 & InProgress_q3;
|
| 190 |
|
|
EndBusy <= #Tp EndBusy_d;
|
| 191 |
|
|
end
|
| 192 |
|
|
end
|
| 193 |
|
|
|
| 194 |
|
|
|
| 195 |
|
|
// Update MII RX_DATA register
|
| 196 |
|
|
always @ (posedge Clk or posedge Reset)
|
| 197 |
|
|
begin
|
| 198 |
|
|
if(Reset)
|
| 199 |
|
|
UpdateMIIRX_DATAReg <= #Tp 0;
|
| 200 |
|
|
else
|
| 201 |
|
|
if(EndBusy & ~WCtrlDataStart_q)
|
| 202 |
|
|
UpdateMIIRX_DATAReg <= #Tp 1;
|
| 203 |
|
|
else
|
| 204 |
|
|
UpdateMIIRX_DATAReg <= #Tp 0;
|
| 205 |
|
|
end
|
| 206 |
|
|
|
| 207 |
|
|
|
| 208 |
|
|
|
| 209 |
|
|
// Generation of the delayed signals used for positive edge triggering.
|
| 210 |
|
|
always @ (posedge Clk or posedge Reset)
|
| 211 |
|
|
begin
|
| 212 |
|
|
if(Reset)
|
| 213 |
|
|
begin
|
| 214 |
|
|
WCtrlData_q1 <= #Tp 1'b0;
|
| 215 |
|
|
WCtrlData_q2 <= #Tp 1'b0;
|
| 216 |
|
|
WCtrlData_q3 <= #Tp 1'b0;
|
| 217 |
|
|
|
| 218 |
|
|
RStat_q1 <= #Tp 1'b0;
|
| 219 |
|
|
RStat_q2 <= #Tp 1'b0;
|
| 220 |
|
|
RStat_q3 <= #Tp 1'b0;
|
| 221 |
|
|
|
| 222 |
|
|
ScanStat_q1 <= #Tp 1'b0;
|
| 223 |
|
|
ScanStat_q2 <= #Tp 1'b0;
|
| 224 |
|
|
SyncStatMdcEn <= #Tp 1'b0;
|
| 225 |
|
|
end
|
| 226 |
|
|
else
|
| 227 |
|
|
begin
|
| 228 |
|
|
WCtrlData_q1 <= #Tp WCtrlData;
|
| 229 |
|
|
WCtrlData_q2 <= #Tp WCtrlData_q1;
|
| 230 |
|
|
WCtrlData_q3 <= #Tp WCtrlData_q2;
|
| 231 |
|
|
|
| 232 |
|
|
RStat_q1 <= #Tp RStat;
|
| 233 |
|
|
RStat_q2 <= #Tp RStat_q1;
|
| 234 |
|
|
RStat_q3 <= #Tp RStat_q2;
|
| 235 |
|
|
|
| 236 |
|
|
ScanStat_q1 <= #Tp ScanStat;
|
| 237 |
|
|
ScanStat_q2 <= #Tp ScanStat_q1;
|
| 238 |
|
|
if(MdcEn)
|
| 239 |
|
|
SyncStatMdcEn <= #Tp ScanStat_q2;
|
| 240 |
|
|
end
|
| 241 |
|
|
end
|
| 242 |
|
|
|
| 243 |
|
|
|
| 244 |
|
|
// Generation of the Start Commands (Write Control Data or Read Status)
|
| 245 |
|
|
always @ (posedge Clk or posedge Reset)
|
| 246 |
|
|
begin
|
| 247 |
|
|
if(Reset)
|
| 248 |
|
|
begin
|
| 249 |
|
|
WCtrlDataStart <= #Tp 1'b0;
|
| 250 |
|
|
WCtrlDataStart_q <= #Tp 1'b0;
|
| 251 |
|
|
RStatStart <= #Tp 1'b0;
|
| 252 |
|
|
end
|
| 253 |
|
|
else
|
| 254 |
|
|
begin
|
| 255 |
|
|
if(EndBusy)
|
| 256 |
|
|
begin
|
| 257 |
|
|
WCtrlDataStart <= #Tp 1'b0;
|
| 258 |
|
|
RStatStart <= #Tp 1'b0;
|
| 259 |
|
|
end
|
| 260 |
|
|
else
|
| 261 |
|
|
begin
|
| 262 |
|
|
if(WCtrlData_q2 & ~WCtrlData_q3)
|
| 263 |
|
|
WCtrlDataStart <= #Tp 1'b1;
|
| 264 |
|
|
if(RStat_q2 & ~RStat_q3)
|
| 265 |
|
|
RStatStart <= #Tp 1'b1;
|
| 266 |
|
|
WCtrlDataStart_q <= #Tp WCtrlDataStart;
|
| 267 |
|
|
end
|
| 268 |
|
|
end
|
| 269 |
|
|
end
|
| 270 |
|
|
|
| 271 |
|
|
|
| 272 |
|
|
// Generation of the Nvalid signal (indicates when the status is invalid)
|
| 273 |
|
|
always @ (posedge Clk or posedge Reset)
|
| 274 |
|
|
begin
|
| 275 |
|
|
if(Reset)
|
| 276 |
|
|
Nvalid <= #Tp 1'b0;
|
| 277 |
|
|
else
|
| 278 |
|
|
begin
|
| 279 |
|
|
if(~InProgress & InProgress_q1)
|
| 280 |
|
|
begin
|
| 281 |
|
|
Nvalid <= #Tp 1'b0;
|
| 282 |
|
|
end
|
| 283 |
|
|
else
|
| 284 |
|
|
begin
|
| 285 |
|
|
if(ScanStat_q2 & ~SyncStatMdcEn)
|
| 286 |
|
|
Nvalid <= #Tp 1'b1;
|
| 287 |
|
|
end
|
| 288 |
|
|
end
|
| 289 |
|
|
end
|
| 290 |
|
|
|
| 291 |
|
|
// Signals used for the generation of the Operation signals (positive edge)
|
| 292 |
|
|
always @ (posedge Clk or posedge Reset)
|
| 293 |
|
|
begin
|
| 294 |
|
|
if(Reset)
|
| 295 |
|
|
begin
|
| 296 |
|
|
WCtrlDataStart_q1 <= #Tp 1'b0;
|
| 297 |
|
|
WCtrlDataStart_q2 <= #Tp 1'b0;
|
| 298 |
|
|
|
| 299 |
|
|
RStatStart_q1 <= #Tp 1'b0;
|
| 300 |
|
|
RStatStart_q2 <= #Tp 1'b0;
|
| 301 |
|
|
|
| 302 |
|
|
InProgress_q1 <= #Tp 1'b0;
|
| 303 |
|
|
InProgress_q2 <= #Tp 1'b0;
|
| 304 |
|
|
InProgress_q3 <= #Tp 1'b0;
|
| 305 |
|
|
|
| 306 |
|
|
LatchByte0_d <= #Tp 1'b0;
|
| 307 |
|
|
LatchByte1_d <= #Tp 1'b0;
|
| 308 |
|
|
|
| 309 |
|
|
LatchByte <= #Tp 2'b00;
|
| 310 |
|
|
end
|
| 311 |
|
|
else
|
| 312 |
|
|
begin
|
| 313 |
|
|
if(MdcEn)
|
| 314 |
|
|
begin
|
| 315 |
|
|
WCtrlDataStart_q1 <= #Tp WCtrlDataStart;
|
| 316 |
|
|
WCtrlDataStart_q2 <= #Tp WCtrlDataStart_q1;
|
| 317 |
|
|
|
| 318 |
|
|
RStatStart_q1 <= #Tp RStatStart;
|
| 319 |
|
|
RStatStart_q2 <= #Tp RStatStart_q1;
|
| 320 |
|
|
|
| 321 |
|
|
LatchByte[0] <= #Tp LatchByte0_d;
|
| 322 |
|
|
LatchByte[1] <= #Tp LatchByte1_d;
|
| 323 |
|
|
|
| 324 |
|
|
LatchByte0_d <= #Tp LatchByte0_d2;
|
| 325 |
|
|
LatchByte1_d <= #Tp LatchByte1_d2;
|
| 326 |
|
|
|
| 327 |
|
|
InProgress_q1 <= #Tp InProgress;
|
| 328 |
|
|
InProgress_q2 <= #Tp InProgress_q1;
|
| 329 |
|
|
InProgress_q3 <= #Tp InProgress_q2;
|
| 330 |
|
|
end
|
| 331 |
|
|
end
|
| 332 |
|
|
end
|
| 333 |
|
|
|
| 334 |
|
|
|
| 335 |
|
|
// Generation of the Operation signals
|
| 336 |
|
|
assign WriteDataOp = WCtrlDataStart_q1 & ~WCtrlDataStart_q2;
|
| 337 |
|
|
assign ReadStatusOp = RStatStart_q1 & ~RStatStart_q2;
|
| 338 |
|
|
assign ScanStatusOp = SyncStatMdcEn & ~InProgress & ~InProgress_q1 & ~InProgress_q2;
|
| 339 |
|
|
assign StartOp = WriteDataOp | ReadStatusOp | ScanStatusOp;
|
| 340 |
|
|
|
| 341 |
|
|
// Busy
|
| 342 |
|
|
assign Busy = WCtrlDataStart | RStatStart | SyncStatMdcEn | EndBusy | InProgress | InProgress_q3;
|
| 343 |
|
|
|
| 344 |
|
|
|
| 345 |
|
|
// Generation of the InProgress signal (indicates when an operation is in progress)
|
| 346 |
|
|
// Generation of the WriteOp signal (indicates when a write is in progress)
|
| 347 |
|
|
always @ (posedge Clk or posedge Reset)
|
| 348 |
|
|
begin
|
| 349 |
|
|
if(Reset)
|
| 350 |
|
|
begin
|
| 351 |
|
|
InProgress <= #Tp 1'b0;
|
| 352 |
|
|
WriteOp <= #Tp 1'b0;
|
| 353 |
|
|
end
|
| 354 |
|
|
else
|
| 355 |
|
|
begin
|
| 356 |
|
|
if(MdcEn)
|
| 357 |
|
|
begin
|
| 358 |
|
|
if(StartOp)
|
| 359 |
|
|
begin
|
| 360 |
|
|
if(~InProgress)
|
| 361 |
|
|
WriteOp <= #Tp WriteDataOp;
|
| 362 |
|
|
InProgress <= #Tp 1'b1;
|
| 363 |
|
|
end
|
| 364 |
|
|
else
|
| 365 |
|
|
begin
|
| 366 |
|
|
if(EndOp)
|
| 367 |
|
|
begin
|
| 368 |
|
|
InProgress <= #Tp 1'b0;
|
| 369 |
|
|
WriteOp <= #Tp 1'b0;
|
| 370 |
|
|
end
|
| 371 |
|
|
end
|
| 372 |
|
|
end
|
| 373 |
|
|
end
|
| 374 |
|
|
end
|
| 375 |
|
|
|
| 376 |
|
|
|
| 377 |
|
|
|
| 378 |
|
|
// Bit Counter counts from 0 to 63 (from 32 to 63 when NoPre is asserted)
|
| 379 |
|
|
always @ (posedge Clk or posedge Reset)
|
| 380 |
|
|
begin
|
| 381 |
|
|
if(Reset)
|
| 382 |
|
|
BitCounter[6:0] <= #Tp 7'h0;
|
| 383 |
|
|
else
|
| 384 |
|
|
begin
|
| 385 |
|
|
if(MdcEn)
|
| 386 |
|
|
begin
|
| 387 |
|
|
if(InProgress)
|
| 388 |
|
|
begin
|
| 389 |
|
|
if(NoPre & ( BitCounter == 7'h0 ))
|
| 390 |
|
|
BitCounter[6:0] <= #Tp 7'h21;
|
| 391 |
|
|
else
|
| 392 |
|
|
BitCounter[6:0] <= #Tp BitCounter[6:0] + 1'b1;
|
| 393 |
|
|
end
|
| 394 |
|
|
else
|
| 395 |
|
|
BitCounter[6:0] <= #Tp 7'h0;
|
| 396 |
|
|
end
|
| 397 |
|
|
end
|
| 398 |
|
|
end
|
| 399 |
|
|
|
| 400 |
|
|
|
| 401 |
|
|
// Operation ends when the Bit Counter reaches 63
|
| 402 |
|
|
assign EndOp = BitCounter==63;
|
| 403 |
|
|
|
| 404 |
|
|
assign ByteSelect[0] = InProgress & ((NoPre & (BitCounter == 7'h0)) | (~NoPre & (BitCounter == 7'h20)));
|
| 405 |
|
|
assign ByteSelect[1] = InProgress & (BitCounter == 7'h28);
|
| 406 |
|
|
assign ByteSelect[2] = InProgress & WriteOp & (BitCounter == 7'h30);
|
| 407 |
|
|
assign ByteSelect[3] = InProgress & WriteOp & (BitCounter == 7'h38);
|
| 408 |
|
|
|
| 409 |
|
|
|
| 410 |
|
|
// Latch Byte selects which part of Read Status Data is updated from the shift register
|
| 411 |
|
|
assign LatchByte1_d2 = InProgress & ~WriteOp & BitCounter == 7'h37;
|
| 412 |
|
|
assign LatchByte0_d2 = InProgress & ~WriteOp & BitCounter == 7'h3F;
|
| 413 |
|
|
|
| 414 |
|
|
|
| 415 |
|
|
// Connecting the Clock Generator Module
|
| 416 |
|
|
eth_clockgen clkgen(.Clk(Clk), .Reset(Reset), .Divider(Divider[7:0]), .MdcEn(MdcEn), .MdcEn_n(MdcEn_n), .Mdc(Mdc)
|
| 417 |
|
|
);
|
| 418 |
|
|
|
| 419 |
|
|
// Connecting the Shift Register Module
|
| 420 |
|
|
eth_shiftreg shftrg(.Clk(Clk), .Reset(Reset), .MdcEn_n(MdcEn_n), .Mdi(Mdi), .Fiad(Fiad), .Rgad(Rgad),
|
| 421 |
|
|
.CtrlData(CtrlData), .WriteOp(WriteOp), .ByteSelect(ByteSelect), .LatchByte(LatchByte),
|
| 422 |
|
|
.ShiftedBit(ShiftedBit), .Prsd(Prsd), .LinkFail(LinkFail)
|
| 423 |
|
|
);
|
| 424 |
|
|
|
| 425 |
|
|
// Connecting the Output Control Module
|
| 426 |
|
|
eth_outputcontrol outctrl(.Clk(Clk), .Reset(Reset), .MdcEn_n(MdcEn_n), .InProgress(InProgress),
|
| 427 |
|
|
.ShiftedBit(ShiftedBit), .BitCounter(BitCounter), .WriteOp(WriteOp), .NoPre(NoPre),
|
| 428 |
|
|
.Mdo(Mdo), .MdoEn(MdoEn)
|
| 429 |
|
|
);
|
| 430 |
|
|
|
| 431 |
|
|
endmodule
|