1 |
15 |
mohor |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// eth_registers.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.3 2001/10/18 12:07:11 mohor
|
45 |
|
|
// Status signals changed, Adress decoding changed, interrupt controller
|
46 |
|
|
// added.
|
47 |
|
|
//
|
48 |
21 |
mohor |
// Revision 1.2 2001/09/24 15:02:56 mohor
|
49 |
|
|
// Defines changed (All precede with ETH_). Small changes because some
|
50 |
|
|
// tools generate warnings when two operands are together. Synchronization
|
51 |
|
|
// between two clocks domains in eth_wishbonedma.v is changed (due to ASIC
|
52 |
|
|
// demands).
|
53 |
|
|
//
|
54 |
20 |
mohor |
// Revision 1.1 2001/08/06 14:44:29 mohor
|
55 |
|
|
// A define FPGA added to select between Artisan RAM (for ASIC) and Block Ram (For Virtex).
|
56 |
|
|
// Include files fixed to contain no path.
|
57 |
|
|
// File names and module names changed ta have a eth_ prologue in the name.
|
58 |
|
|
// File eth_timescale.v is used to define timescale
|
59 |
|
|
// All pin names on the top module are changed to contain _I, _O or _OE at the end.
|
60 |
|
|
// Bidirectional signal MDIO is changed to three signals (Mdc_O, Mdi_I, Mdo_O
|
61 |
|
|
// and Mdo_OE. The bidirectional signal must be created on the top level. This
|
62 |
|
|
// is done due to the ASIC tools.
|
63 |
|
|
//
|
64 |
15 |
mohor |
// Revision 1.2 2001/08/02 09:25:31 mohor
|
65 |
|
|
// Unconnected signals are now connected.
|
66 |
|
|
//
|
67 |
|
|
// Revision 1.1 2001/07/30 21:23:42 mohor
|
68 |
|
|
// Directory structure changed. Files checked and joind together.
|
69 |
|
|
//
|
70 |
|
|
//
|
71 |
|
|
//
|
72 |
|
|
//
|
73 |
|
|
//
|
74 |
|
|
//
|
75 |
|
|
|
76 |
|
|
`include "eth_defines.v"
|
77 |
22 |
mohor |
`include "timescale.v"
|
78 |
15 |
mohor |
|
79 |
|
|
|
80 |
|
|
module eth_registers( DataIn, Address, Rw, Cs, Clk, Reset, DataOut, r_DmaEn,
|
81 |
|
|
r_RecSmall, r_Pad, r_HugEn, r_CrcEn, r_DlyCrcEn,
|
82 |
|
|
r_Rst, r_FullD, r_ExDfrEn, r_NoBckof, r_LoopBck, r_IFG,
|
83 |
21 |
mohor |
r_Pro, r_Iam, r_Bro, r_NoPre, r_TxEn, r_RxEn,
|
84 |
|
|
TxB_IRQ, TxE_IRQ, RxB_IRQ, RxF_IRQ, Busy_IRQ,
|
85 |
|
|
r_IPGT, r_IPGR1, r_IPGR2, r_MinFL, r_MaxFL, r_MaxRet,
|
86 |
15 |
mohor |
r_CollValid, r_TxFlow, r_RxFlow, r_PassAll,
|
87 |
|
|
r_MiiMRst, r_MiiNoPre, r_ClkDiv, r_WCtrlData, r_RStat, r_ScanStat,
|
88 |
|
|
r_RGAD, r_FIAD, r_CtrlData, NValid_stat, Busy_stat,
|
89 |
|
|
LinkFail, r_MAC, WCtrlDataStart, RStatStart,
|
90 |
21 |
mohor |
UpdateMIIRX_DATAReg, Prsd, r_RxBDAddress, RX_BD_ADR_Wr, int_o
|
91 |
15 |
mohor |
);
|
92 |
|
|
|
93 |
|
|
parameter Tp = 1;
|
94 |
|
|
|
95 |
|
|
input [31:0] DataIn;
|
96 |
|
|
input [5:0] Address;
|
97 |
|
|
|
98 |
|
|
input Rw;
|
99 |
|
|
input Cs;
|
100 |
|
|
input Clk;
|
101 |
|
|
input Reset;
|
102 |
|
|
|
103 |
|
|
input WCtrlDataStart;
|
104 |
|
|
input RStatStart;
|
105 |
|
|
|
106 |
|
|
input UpdateMIIRX_DATAReg;
|
107 |
|
|
input [15:0] Prsd;
|
108 |
|
|
|
109 |
|
|
output [31:0] DataOut;
|
110 |
|
|
reg [31:0] DataOut;
|
111 |
|
|
|
112 |
|
|
output r_DmaEn;
|
113 |
|
|
output r_RecSmall;
|
114 |
|
|
output r_Pad;
|
115 |
|
|
output r_HugEn;
|
116 |
|
|
output r_CrcEn;
|
117 |
|
|
output r_DlyCrcEn;
|
118 |
|
|
output r_Rst;
|
119 |
|
|
output r_FullD;
|
120 |
|
|
output r_ExDfrEn;
|
121 |
|
|
output r_NoBckof;
|
122 |
|
|
output r_LoopBck;
|
123 |
|
|
output r_IFG;
|
124 |
|
|
output r_Pro;
|
125 |
|
|
output r_Iam;
|
126 |
|
|
output r_Bro;
|
127 |
|
|
output r_NoPre;
|
128 |
|
|
output r_TxEn;
|
129 |
|
|
output r_RxEn;
|
130 |
|
|
|
131 |
21 |
mohor |
input TxB_IRQ;
|
132 |
|
|
input TxE_IRQ;
|
133 |
|
|
input RxB_IRQ;
|
134 |
|
|
input RxF_IRQ;
|
135 |
|
|
input Busy_IRQ;
|
136 |
15 |
mohor |
|
137 |
|
|
output [6:0] r_IPGT;
|
138 |
|
|
|
139 |
|
|
output [6:0] r_IPGR1;
|
140 |
|
|
|
141 |
|
|
output [6:0] r_IPGR2;
|
142 |
|
|
|
143 |
|
|
output [15:0] r_MinFL;
|
144 |
|
|
output [15:0] r_MaxFL;
|
145 |
|
|
|
146 |
|
|
output [3:0] r_MaxRet;
|
147 |
|
|
output [5:0] r_CollValid;
|
148 |
|
|
|
149 |
|
|
output r_TxFlow;
|
150 |
|
|
output r_RxFlow;
|
151 |
|
|
output r_PassAll;
|
152 |
|
|
|
153 |
|
|
output r_MiiMRst;
|
154 |
|
|
output r_MiiNoPre;
|
155 |
|
|
output [7:0] r_ClkDiv;
|
156 |
|
|
|
157 |
|
|
output r_WCtrlData;
|
158 |
|
|
output r_RStat;
|
159 |
|
|
output r_ScanStat;
|
160 |
|
|
|
161 |
|
|
output [4:0] r_RGAD;
|
162 |
|
|
output [4:0] r_FIAD;
|
163 |
|
|
|
164 |
21 |
mohor |
output [15:0]r_CtrlData;
|
165 |
15 |
mohor |
|
166 |
|
|
|
167 |
|
|
input NValid_stat;
|
168 |
|
|
input Busy_stat;
|
169 |
|
|
input LinkFail;
|
170 |
|
|
|
171 |
21 |
mohor |
output [47:0]r_MAC;
|
172 |
15 |
mohor |
output [7:0] r_RxBDAddress;
|
173 |
|
|
output RX_BD_ADR_Wr;
|
174 |
21 |
mohor |
output int_o;
|
175 |
15 |
mohor |
|
176 |
21 |
mohor |
reg irq_txb;
|
177 |
|
|
reg irq_txe;
|
178 |
|
|
reg irq_rxb;
|
179 |
|
|
reg irq_rxf;
|
180 |
|
|
reg irq_busy;
|
181 |
15 |
mohor |
|
182 |
|
|
wire Write = Cs & Rw;
|
183 |
|
|
wire Read = Cs & ~Rw;
|
184 |
|
|
|
185 |
21 |
mohor |
wire MODER_Wr = (Address == `ETH_MODER_ADR ) & Write;
|
186 |
|
|
wire INT_SOURCE_Wr = (Address == `ETH_INT_SOURCE_ADR ) & Write;
|
187 |
|
|
wire INT_MASK_Wr = (Address == `ETH_INT_MASK_ADR ) & Write;
|
188 |
|
|
wire IPGT_Wr = (Address == `ETH_IPGT_ADR ) & Write;
|
189 |
|
|
wire IPGR1_Wr = (Address == `ETH_IPGR1_ADR ) & Write;
|
190 |
|
|
wire IPGR2_Wr = (Address == `ETH_IPGR2_ADR ) & Write;
|
191 |
|
|
wire PACKETLEN_Wr = (Address == `ETH_PACKETLEN_ADR ) & Write;
|
192 |
|
|
wire COLLCONF_Wr = (Address == `ETH_COLLCONF_ADR ) & Write;
|
193 |
|
|
|
194 |
|
|
wire CTRLMODER_Wr = (Address == `ETH_CTRLMODER_ADR ) & Write;
|
195 |
|
|
wire MIIMODER_Wr = (Address == `ETH_MIIMODER_ADR ) & Write;
|
196 |
|
|
wire MIICOMMAND_Wr = (Address == `ETH_MIICOMMAND_ADR ) & Write;
|
197 |
|
|
wire MIIADDRESS_Wr = (Address == `ETH_MIIADDRESS_ADR ) & Write;
|
198 |
|
|
wire MIITX_DATA_Wr = (Address == `ETH_MIITX_DATA_ADR ) & Write;
|
199 |
|
|
wire MIIRX_DATA_Wr = UpdateMIIRX_DATAReg;
|
200 |
|
|
wire MIISTATUS_Wr = (Address == `ETH_MIISTATUS_ADR ) & Write;
|
201 |
|
|
wire MAC_ADDR0_Wr = (Address == `ETH_MAC_ADDR0_ADR ) & Write;
|
202 |
|
|
wire MAC_ADDR1_Wr = (Address == `ETH_MAC_ADDR1_ADR ) & Write;
|
203 |
|
|
assign RX_BD_ADR_Wr = (Address == `ETH_RX_BD_ADR_ADR ) & Write;
|
204 |
15 |
mohor |
|
205 |
|
|
|
206 |
|
|
|
207 |
|
|
wire [31:0] MODEROut;
|
208 |
|
|
wire [31:0] INT_SOURCEOut;
|
209 |
|
|
wire [31:0] INT_MASKOut;
|
210 |
|
|
wire [31:0] IPGTOut;
|
211 |
|
|
wire [31:0] IPGR1Out;
|
212 |
|
|
wire [31:0] IPGR2Out;
|
213 |
|
|
wire [31:0] PACKETLENOut;
|
214 |
|
|
wire [31:0] COLLCONFOut;
|
215 |
|
|
wire [31:0] CTRLMODEROut;
|
216 |
|
|
wire [31:0] MIIMODEROut;
|
217 |
|
|
wire [31:0] MIICOMMANDOut;
|
218 |
|
|
wire [31:0] MIIADDRESSOut;
|
219 |
|
|
wire [31:0] MIITX_DATAOut;
|
220 |
|
|
wire [31:0] MIIRX_DATAOut;
|
221 |
|
|
wire [31:0] MIISTATUSOut;
|
222 |
|
|
wire [31:0] MAC_ADDR0Out;
|
223 |
|
|
wire [31:0] MAC_ADDR1Out;
|
224 |
|
|
wire [31:0] RX_BD_ADROut;
|
225 |
|
|
|
226 |
20 |
mohor |
eth_register #(32) MODER (.DataIn(DataIn), .DataOut(MODEROut), .Write(MODER_Wr), .Clk(Clk), .Reset(Reset), .Default(`ETH_MODER_DEF));
|
227 |
|
|
eth_register #(32) INT_MASK (.DataIn(DataIn), .DataOut(INT_MASKOut), .Write(INT_MASK_Wr), .Clk(Clk), .Reset(Reset), .Default(`ETH_INT_MASK_DEF));
|
228 |
|
|
eth_register #(32) IPGT (.DataIn(DataIn), .DataOut(IPGTOut), .Write(IPGT_Wr), .Clk(Clk), .Reset(Reset), .Default(`ETH_IPGT_DEF));
|
229 |
|
|
eth_register #(32) IPGR1 (.DataIn(DataIn), .DataOut(IPGR1Out), .Write(IPGR1_Wr), .Clk(Clk), .Reset(Reset), .Default(`ETH_IPGR1_DEF));
|
230 |
|
|
eth_register #(32) IPGR2 (.DataIn(DataIn), .DataOut(IPGR2Out), .Write(IPGR2_Wr), .Clk(Clk), .Reset(Reset), .Default(`ETH_IPGR2_DEF));
|
231 |
|
|
eth_register #(32) PACKETLEN (.DataIn(DataIn), .DataOut(PACKETLENOut), .Write(PACKETLEN_Wr), .Clk(Clk), .Reset(Reset), .Default(`ETH_PACKETLEN_DEF));
|
232 |
|
|
eth_register #(32) COLLCONF (.DataIn(DataIn), .DataOut(COLLCONFOut), .Write(COLLCONF_Wr), .Clk(Clk), .Reset(Reset), .Default(`ETH_COLLCONF_DEF));
|
233 |
15 |
mohor |
|
234 |
|
|
// CTRLMODER registers
|
235 |
20 |
mohor |
wire [31:0] DefaultCtrlModer = `ETH_CTRLMODER_DEF;
|
236 |
15 |
mohor |
assign CTRLMODEROut[31:3] = 29'h0;
|
237 |
|
|
eth_register #(3) CTRLMODER2 (.DataIn(DataIn[2:0]), .DataOut(CTRLMODEROut[2:0]), .Write(CTRLMODER_Wr), .Clk(Clk), .Reset(Reset), .Default(DefaultCtrlModer[2:0]));
|
238 |
|
|
// End: CTRLMODER registers
|
239 |
|
|
|
240 |
|
|
|
241 |
|
|
|
242 |
|
|
|
243 |
|
|
|
244 |
20 |
mohor |
eth_register #(32) MIIMODER (.DataIn(DataIn), .DataOut(MIIMODEROut), .Write(MIIMODER_Wr), .Clk(Clk), .Reset(Reset), .Default(`ETH_MIIMODER_DEF));
|
245 |
15 |
mohor |
|
246 |
|
|
assign MIICOMMANDOut[31:3] = 29'h0;
|
247 |
|
|
eth_register #(1) MIICOMMAND2 (.DataIn(DataIn[2]), .DataOut(MIICOMMANDOut[2]), .Write(MIICOMMAND_Wr), .Clk(Clk), .Reset(Reset | WCtrlDataStart), .Default(1'b0));
|
248 |
|
|
eth_register #(1) MIICOMMAND1 (.DataIn(DataIn[1]), .DataOut(MIICOMMANDOut[1]), .Write(MIICOMMAND_Wr), .Clk(Clk), .Reset(Reset | RStatStart), .Default(1'b0));
|
249 |
|
|
eth_register #(1) MIICOMMAND0 (.DataIn(DataIn[0]), .DataOut(MIICOMMANDOut[0]), .Write(MIICOMMAND_Wr), .Clk(Clk), .Reset(Reset), .Default(1'b0));
|
250 |
|
|
|
251 |
20 |
mohor |
eth_register #(32) MIIADDRESS (.DataIn(DataIn), .DataOut(MIIADDRESSOut), .Write(MIIADDRESS_Wr), .Clk(Clk), .Reset(Reset), .Default(`ETH_MIIADDRESS_DEF));
|
252 |
|
|
eth_register #(32) MIITX_DATA (.DataIn(DataIn), .DataOut(MIITX_DATAOut), .Write(MIITX_DATA_Wr), .Clk(Clk), .Reset(Reset), .Default(`ETH_MIITX_DATA_DEF));
|
253 |
|
|
eth_register #(32) MIIRX_DATA (.DataIn({16'h0, Prsd}), .DataOut(MIIRX_DATAOut), .Write(MIIRX_DATA_Wr), .Clk(Clk), .Reset(Reset), .Default(`ETH_MIIRX_DATA_DEF));
|
254 |
|
|
//eth_register #(32) MIISTATUS (.DataIn(DataIn), .DataOut(MIISTATUSOut), .Write(MIISTATUS_Wr), .Clk(Clk), .Reset(Reset), .Default(`ETH_MIISTATUS_DEF));
|
255 |
|
|
eth_register #(32) MAC_ADDR0 (.DataIn(DataIn), .DataOut(MAC_ADDR0Out), .Write(MAC_ADDR0_Wr), .Clk(Clk), .Reset(Reset), .Default(`ETH_MAC_ADDR0_DEF));
|
256 |
|
|
eth_register #(32) MAC_ADDR1 (.DataIn(DataIn), .DataOut(MAC_ADDR1Out), .Write(MAC_ADDR1_Wr), .Clk(Clk), .Reset(Reset), .Default(`ETH_MAC_ADDR1_DEF));
|
257 |
15 |
mohor |
|
258 |
|
|
assign RX_BD_ADROut[31:8] = 24'h0;
|
259 |
20 |
mohor |
eth_register #(8) RX_BD_ADR (.DataIn(DataIn[7:0]), .DataOut(RX_BD_ADROut[7:0]), .Write(RX_BD_ADR_Wr), .Clk(Clk), .Reset(Reset), .Default(`ETH_RX_BD_ADR_DEF));
|
260 |
15 |
mohor |
|
261 |
|
|
|
262 |
|
|
reg LinkFailRegister;
|
263 |
20 |
mohor |
wire ResetLinkFailRegister = Address == `ETH_MIISTATUS_ADR & Read;
|
264 |
15 |
mohor |
reg ResetLinkFailRegister_q1;
|
265 |
|
|
reg ResetLinkFailRegister_q2;
|
266 |
|
|
|
267 |
|
|
always @ (posedge Clk or posedge Reset)
|
268 |
|
|
begin
|
269 |
|
|
if(Reset)
|
270 |
|
|
begin
|
271 |
|
|
LinkFailRegister <= #Tp 0;
|
272 |
|
|
ResetLinkFailRegister_q1 <= #Tp 0;
|
273 |
|
|
ResetLinkFailRegister_q2 <= #Tp 0;
|
274 |
|
|
end
|
275 |
|
|
else
|
276 |
|
|
begin
|
277 |
|
|
ResetLinkFailRegister_q1 <= #Tp ResetLinkFailRegister;
|
278 |
|
|
ResetLinkFailRegister_q2 <= #Tp ResetLinkFailRegister_q1;
|
279 |
|
|
if(LinkFail)
|
280 |
|
|
LinkFailRegister <= #Tp 1;
|
281 |
|
|
if(~ResetLinkFailRegister_q1 & ResetLinkFailRegister_q2)
|
282 |
|
|
LinkFailRegister <= #Tp 0;
|
283 |
|
|
end
|
284 |
|
|
end
|
285 |
|
|
|
286 |
|
|
|
287 |
|
|
always @ (Address or Read or MODEROut or INT_SOURCEOut or INT_MASKOut or IPGTOut or
|
288 |
|
|
IPGR1Out or IPGR2Out or PACKETLENOut or COLLCONFOut or CTRLMODEROut or
|
289 |
|
|
MIIMODEROut or MIICOMMANDOut or MIIADDRESSOut or MIITX_DATAOut or
|
290 |
|
|
MIIRX_DATAOut or MIISTATUSOut or MAC_ADDR0Out or MAC_ADDR1Out or
|
291 |
|
|
RX_BD_ADROut)
|
292 |
|
|
begin
|
293 |
|
|
if(Read) // read
|
294 |
|
|
begin
|
295 |
|
|
case(Address)
|
296 |
20 |
mohor |
`ETH_MODER_ADR : DataOut<=MODEROut;
|
297 |
|
|
`ETH_INT_SOURCE_ADR : DataOut<=INT_SOURCEOut;
|
298 |
|
|
`ETH_INT_MASK_ADR : DataOut<=INT_MASKOut;
|
299 |
|
|
`ETH_IPGT_ADR : DataOut<=IPGTOut;
|
300 |
|
|
`ETH_IPGR1_ADR : DataOut<=IPGR1Out;
|
301 |
|
|
`ETH_IPGR2_ADR : DataOut<=IPGR2Out;
|
302 |
|
|
`ETH_PACKETLEN_ADR : DataOut<=PACKETLENOut;
|
303 |
|
|
`ETH_COLLCONF_ADR : DataOut<=COLLCONFOut;
|
304 |
|
|
`ETH_CTRLMODER_ADR : DataOut<=CTRLMODEROut;
|
305 |
|
|
`ETH_MIIMODER_ADR : DataOut<=MIIMODEROut;
|
306 |
|
|
`ETH_MIICOMMAND_ADR : DataOut<=MIICOMMANDOut;
|
307 |
|
|
`ETH_MIIADDRESS_ADR : DataOut<=MIIADDRESSOut;
|
308 |
|
|
`ETH_MIITX_DATA_ADR : DataOut<=MIITX_DATAOut;
|
309 |
|
|
`ETH_MIIRX_DATA_ADR : DataOut<=MIIRX_DATAOut;
|
310 |
|
|
`ETH_MIISTATUS_ADR : DataOut<=MIISTATUSOut;
|
311 |
|
|
`ETH_MAC_ADDR0_ADR : DataOut<=MAC_ADDR0Out;
|
312 |
|
|
`ETH_MAC_ADDR1_ADR : DataOut<=MAC_ADDR1Out;
|
313 |
|
|
`ETH_RX_BD_ADR_ADR : DataOut<=RX_BD_ADROut;
|
314 |
15 |
mohor |
default: DataOut<=32'h0;
|
315 |
|
|
endcase
|
316 |
|
|
end
|
317 |
|
|
else
|
318 |
|
|
DataOut<=32'h0;
|
319 |
|
|
end
|
320 |
|
|
|
321 |
|
|
|
322 |
|
|
assign r_DmaEn = MODEROut[17];
|
323 |
|
|
assign r_RecSmall = MODEROut[16];
|
324 |
|
|
assign r_Pad = MODEROut[15];
|
325 |
|
|
assign r_HugEn = MODEROut[14];
|
326 |
|
|
assign r_CrcEn = MODEROut[13];
|
327 |
|
|
assign r_DlyCrcEn = MODEROut[12];
|
328 |
|
|
assign r_Rst = MODEROut[11];
|
329 |
|
|
assign r_FullD = MODEROut[10];
|
330 |
|
|
assign r_ExDfrEn = MODEROut[9];
|
331 |
|
|
assign r_NoBckof = MODEROut[8];
|
332 |
|
|
assign r_LoopBck = MODEROut[7];
|
333 |
|
|
assign r_IFG = MODEROut[6];
|
334 |
|
|
assign r_Pro = MODEROut[5];
|
335 |
|
|
assign r_Iam = MODEROut[4];
|
336 |
|
|
assign r_Bro = MODEROut[3];
|
337 |
|
|
assign r_NoPre = MODEROut[2];
|
338 |
|
|
assign r_TxEn = MODEROut[1];
|
339 |
|
|
assign r_RxEn = MODEROut[0];
|
340 |
|
|
|
341 |
|
|
assign r_IPGT[6:0] = IPGTOut[6:0];
|
342 |
|
|
|
343 |
|
|
assign r_IPGR1[6:0] = IPGR1Out[6:0];
|
344 |
|
|
|
345 |
|
|
assign r_IPGR2[6:0] = IPGR2Out[6:0];
|
346 |
|
|
|
347 |
|
|
assign r_MinFL[15:0] = PACKETLENOut[31:16];
|
348 |
|
|
assign r_MaxFL[15:0] = PACKETLENOut[15:0];
|
349 |
|
|
|
350 |
|
|
assign r_MaxRet[3:0] = COLLCONFOut[19:16];
|
351 |
|
|
assign r_CollValid[5:0] = COLLCONFOut[5:0];
|
352 |
|
|
|
353 |
|
|
assign r_TxFlow = CTRLMODEROut[2];
|
354 |
|
|
assign r_RxFlow = CTRLMODEROut[1];
|
355 |
|
|
assign r_PassAll = CTRLMODEROut[0];
|
356 |
|
|
|
357 |
|
|
assign r_MiiMRst = MIIMODEROut[10];
|
358 |
|
|
assign r_MiiNoPre = MIIMODEROut[8];
|
359 |
|
|
assign r_ClkDiv[7:0] = MIIMODEROut[7:0];
|
360 |
|
|
|
361 |
|
|
assign r_WCtrlData = MIICOMMANDOut[2];
|
362 |
|
|
assign r_RStat = MIICOMMANDOut[1];
|
363 |
|
|
assign r_ScanStat = MIICOMMANDOut[0];
|
364 |
|
|
|
365 |
|
|
assign r_RGAD[4:0] = MIIADDRESSOut[12:8];
|
366 |
|
|
assign r_FIAD[4:0] = MIIADDRESSOut[4:0];
|
367 |
|
|
|
368 |
|
|
assign r_CtrlData[15:0] = MIITX_DATAOut[15:0];
|
369 |
|
|
|
370 |
|
|
assign MIISTATUSOut[31:10] = 22'h0 ;
|
371 |
|
|
assign MIISTATUSOut[9] = NValid_stat ;
|
372 |
|
|
assign MIISTATUSOut[8] = Busy_stat ;
|
373 |
|
|
assign MIISTATUSOut[7:3]= 5'h0 ;
|
374 |
|
|
assign MIISTATUSOut[2] = 1'b0;
|
375 |
|
|
assign MIISTATUSOut[1] = 1'b0;
|
376 |
|
|
assign MIISTATUSOut[0] = LinkFailRegister ;
|
377 |
|
|
|
378 |
|
|
assign r_MAC[31:0] = MAC_ADDR0Out[31:0];
|
379 |
|
|
assign r_MAC[47:32] = MAC_ADDR1Out[15:0];
|
380 |
|
|
|
381 |
|
|
assign r_RxBDAddress[7:0] = RX_BD_ADROut[7:0];
|
382 |
|
|
|
383 |
|
|
|
384 |
21 |
mohor |
// Interrupt generation
|
385 |
|
|
|
386 |
|
|
always @ (posedge Clk or posedge Reset)
|
387 |
|
|
begin
|
388 |
|
|
if(Reset)
|
389 |
|
|
irq_txb <= 1'b0;
|
390 |
|
|
else
|
391 |
|
|
if(TxB_IRQ & INT_MASKOut[0])
|
392 |
|
|
irq_txb <= #Tp 1'b1;
|
393 |
|
|
else
|
394 |
|
|
if(INT_SOURCE_Wr & DataIn[0])
|
395 |
|
|
irq_txb <= #Tp 1'b0;
|
396 |
|
|
end
|
397 |
|
|
|
398 |
|
|
always @ (posedge Clk or posedge Reset)
|
399 |
|
|
begin
|
400 |
|
|
if(Reset)
|
401 |
|
|
irq_txe <= 1'b0;
|
402 |
|
|
else
|
403 |
|
|
if(TxE_IRQ & INT_MASKOut[1])
|
404 |
|
|
irq_txe <= #Tp 1'b1;
|
405 |
|
|
else
|
406 |
|
|
if(INT_SOURCE_Wr & DataIn[1])
|
407 |
|
|
irq_txe <= #Tp 1'b0;
|
408 |
|
|
end
|
409 |
|
|
|
410 |
|
|
always @ (posedge Clk or posedge Reset)
|
411 |
|
|
begin
|
412 |
|
|
if(Reset)
|
413 |
|
|
irq_rxb <= 1'b0;
|
414 |
|
|
else
|
415 |
|
|
if(RxB_IRQ & INT_MASKOut[2])
|
416 |
|
|
irq_rxb <= #Tp 1'b1;
|
417 |
|
|
else
|
418 |
|
|
if(INT_SOURCE_Wr & DataIn[2])
|
419 |
|
|
irq_rxb <= #Tp 1'b0;
|
420 |
|
|
end
|
421 |
|
|
|
422 |
|
|
always @ (posedge Clk or posedge Reset)
|
423 |
|
|
begin
|
424 |
|
|
if(Reset)
|
425 |
|
|
irq_rxf <= 1'b0;
|
426 |
|
|
else
|
427 |
|
|
if(RxF_IRQ & INT_MASKOut[3])
|
428 |
|
|
irq_rxf <= #Tp 1'b1;
|
429 |
|
|
else
|
430 |
|
|
if(INT_SOURCE_Wr & DataIn[3])
|
431 |
|
|
irq_rxf <= #Tp 1'b0;
|
432 |
|
|
end
|
433 |
|
|
|
434 |
|
|
always @ (posedge Clk or posedge Reset)
|
435 |
|
|
begin
|
436 |
|
|
if(Reset)
|
437 |
|
|
irq_busy <= 1'b0;
|
438 |
|
|
else
|
439 |
|
|
if(Busy_IRQ & INT_MASKOut[4])
|
440 |
|
|
irq_busy <= #Tp 1'b1;
|
441 |
|
|
else
|
442 |
|
|
if(INT_SOURCE_Wr & DataIn[4])
|
443 |
|
|
irq_busy <= #Tp 1'b0;
|
444 |
|
|
end
|
445 |
|
|
|
446 |
|
|
// Generating interrupt signal
|
447 |
|
|
assign int_o = irq_txb | irq_txe | irq_rxb | irq_rxf | irq_busy;
|
448 |
|
|
|
449 |
|
|
// For reading interrupt status
|
450 |
|
|
assign INT_SOURCEOut = {28'h0, irq_busy, irq_rxf, irq_rxb, irq_txe, irq_txb};
|
451 |
|
|
|
452 |
|
|
|
453 |
|
|
|
454 |
15 |
mohor |
endmodule
|