1 |
627 |
stekern |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// eth_defines.v ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// This file is part of the Ethernet IP core project ////
|
6 |
|
|
//// http://opencores.org/project,ethmac ////
|
7 |
|
|
//// ////
|
8 |
|
|
//// Author(s): ////
|
9 |
|
|
//// - Igor Mohor (igorM@opencores.org) ////
|
10 |
|
|
//// ////
|
11 |
|
|
//// Modified by: ////
|
12 |
|
|
//// - Julius Baxter (julius@opencores.org) ////
|
13 |
|
|
//// ////
|
14 |
|
|
//////////////////////////////////////////////////////////////////////
|
15 |
|
|
//// ////
|
16 |
|
|
//// Copyright (C) 2001, 2002 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 |
|
|
|
42 |
|
|
|
43 |
|
|
//`define ETH_BIST // Bist for usage with Virtual Silicon RAMS
|
44 |
|
|
|
45 |
|
|
`define ETH_MBIST_CTRL_WIDTH 3 // width of MBIST control bus
|
46 |
|
|
|
47 |
|
|
// Generic FIFO implementation - hopefully synthesizable with Synplify
|
48 |
|
|
//`define ETH_FIFO_GENERIC
|
49 |
|
|
// specific elements.
|
50 |
|
|
`define ETH_FIFO_XILINX
|
51 |
|
|
//`define ETH_FIFO_RAMB18
|
52 |
|
|
|
53 |
|
|
|
54 |
|
|
`define ETH_MODER_ADR 8'h0 // 0x0
|
55 |
|
|
`define ETH_INT_SOURCE_ADR 8'h1 // 0x4
|
56 |
|
|
`define ETH_INT_MASK_ADR 8'h2 // 0x8
|
57 |
|
|
`define ETH_IPGT_ADR 8'h3 // 0xC
|
58 |
|
|
`define ETH_IPGR1_ADR 8'h4 // 0x10
|
59 |
|
|
`define ETH_IPGR2_ADR 8'h5 // 0x14
|
60 |
|
|
`define ETH_PACKETLEN_ADR 8'h6 // 0x18
|
61 |
|
|
`define ETH_COLLCONF_ADR 8'h7 // 0x1C
|
62 |
|
|
`define ETH_TX_BD_NUM_ADR 8'h8 // 0x20
|
63 |
|
|
`define ETH_CTRLMODER_ADR 8'h9 // 0x24
|
64 |
|
|
`define ETH_MIIMODER_ADR 8'hA // 0x28
|
65 |
|
|
`define ETH_MIICOMMAND_ADR 8'hB // 0x2C
|
66 |
|
|
`define ETH_MIIADDRESS_ADR 8'hC // 0x30
|
67 |
|
|
`define ETH_MIITX_DATA_ADR 8'hD // 0x34
|
68 |
|
|
`define ETH_MIIRX_DATA_ADR 8'hE // 0x38
|
69 |
|
|
`define ETH_MIISTATUS_ADR 8'hF // 0x3C
|
70 |
|
|
`define ETH_MAC_ADDR0_ADR 8'h10 // 0x40
|
71 |
|
|
`define ETH_MAC_ADDR1_ADR 8'h11 // 0x44
|
72 |
|
|
`define ETH_HASH0_ADR 8'h12 // 0x48
|
73 |
|
|
`define ETH_HASH1_ADR 8'h13 // 0x4C
|
74 |
|
|
`define ETH_TX_CTRL_ADR 8'h14 // 0x50
|
75 |
|
|
`define ETH_RX_CTRL_ADR 8'h15 // 0x54
|
76 |
|
|
`define ETH_DBG_ADR 8'h16 // 0x58
|
77 |
|
|
|
78 |
|
|
|
79 |
|
|
`define ETH_MODER_DEF_0 8'h00
|
80 |
|
|
`define ETH_MODER_DEF_1 8'hA0
|
81 |
|
|
`define ETH_MODER_DEF_2 1'h0
|
82 |
|
|
`define ETH_INT_MASK_DEF_0 7'h0
|
83 |
|
|
`define ETH_IPGT_DEF_0 7'h12
|
84 |
|
|
`define ETH_IPGR1_DEF_0 7'h0C
|
85 |
|
|
`define ETH_IPGR2_DEF_0 7'h12
|
86 |
|
|
`define ETH_PACKETLEN_DEF_0 8'h00
|
87 |
|
|
`define ETH_PACKETLEN_DEF_1 8'h06
|
88 |
|
|
`define ETH_PACKETLEN_DEF_2 8'h40
|
89 |
|
|
`define ETH_PACKETLEN_DEF_3 8'h00
|
90 |
|
|
`define ETH_COLLCONF_DEF_0 6'h3f
|
91 |
|
|
`define ETH_COLLCONF_DEF_2 4'hF
|
92 |
|
|
`define ETH_TX_BD_NUM_DEF_0 8'h40
|
93 |
|
|
`define ETH_CTRLMODER_DEF_0 3'h0
|
94 |
|
|
`define ETH_MIIMODER_DEF_0 8'h64
|
95 |
|
|
`define ETH_MIIMODER_DEF_1 1'h0
|
96 |
|
|
`define ETH_MIIADDRESS_DEF_0 5'h00
|
97 |
|
|
`define ETH_MIIADDRESS_DEF_1 5'h00
|
98 |
|
|
`define ETH_MIITX_DATA_DEF_0 8'h00
|
99 |
|
|
`define ETH_MIITX_DATA_DEF_1 8'h00
|
100 |
|
|
`define ETH_MIIRX_DATA_DEF 16'h0000 // not written from WB
|
101 |
|
|
`define ETH_MAC_ADDR0_DEF_0 8'h00
|
102 |
|
|
`define ETH_MAC_ADDR0_DEF_1 8'h00
|
103 |
|
|
`define ETH_MAC_ADDR0_DEF_2 8'h00
|
104 |
|
|
`define ETH_MAC_ADDR0_DEF_3 8'h00
|
105 |
|
|
`define ETH_MAC_ADDR1_DEF_0 8'h00
|
106 |
|
|
`define ETH_MAC_ADDR1_DEF_1 8'h00
|
107 |
|
|
`define ETH_HASH0_DEF_0 8'h00
|
108 |
|
|
`define ETH_HASH0_DEF_1 8'h00
|
109 |
|
|
`define ETH_HASH0_DEF_2 8'h00
|
110 |
|
|
`define ETH_HASH0_DEF_3 8'h00
|
111 |
|
|
`define ETH_HASH1_DEF_0 8'h00
|
112 |
|
|
`define ETH_HASH1_DEF_1 8'h00
|
113 |
|
|
`define ETH_HASH1_DEF_2 8'h00
|
114 |
|
|
`define ETH_HASH1_DEF_3 8'h00
|
115 |
|
|
`define ETH_TX_CTRL_DEF_0 8'h00 //
|
116 |
|
|
`define ETH_TX_CTRL_DEF_1 8'h00 //
|
117 |
|
|
`define ETH_TX_CTRL_DEF_2 1'h0 //
|
118 |
|
|
`define ETH_RX_CTRL_DEF_0 8'h00
|
119 |
|
|
`define ETH_RX_CTRL_DEF_1 8'h00
|
120 |
|
|
|
121 |
|
|
|
122 |
|
|
`define ETH_MODER_WIDTH_0 8
|
123 |
|
|
`define ETH_MODER_WIDTH_1 8
|
124 |
|
|
`define ETH_MODER_WIDTH_2 1
|
125 |
|
|
`define ETH_INT_SOURCE_WIDTH_0 7
|
126 |
|
|
`define ETH_INT_MASK_WIDTH_0 7
|
127 |
|
|
`define ETH_IPGT_WIDTH_0 7
|
128 |
|
|
`define ETH_IPGR1_WIDTH_0 7
|
129 |
|
|
`define ETH_IPGR2_WIDTH_0 7
|
130 |
|
|
`define ETH_PACKETLEN_WIDTH_0 8
|
131 |
|
|
`define ETH_PACKETLEN_WIDTH_1 8
|
132 |
|
|
`define ETH_PACKETLEN_WIDTH_2 8
|
133 |
|
|
`define ETH_PACKETLEN_WIDTH_3 8
|
134 |
|
|
`define ETH_COLLCONF_WIDTH_0 6
|
135 |
|
|
`define ETH_COLLCONF_WIDTH_2 4
|
136 |
|
|
`define ETH_TX_BD_NUM_WIDTH_0 8
|
137 |
|
|
`define ETH_CTRLMODER_WIDTH_0 3
|
138 |
|
|
`define ETH_MIIMODER_WIDTH_0 8
|
139 |
|
|
`define ETH_MIIMODER_WIDTH_1 1
|
140 |
|
|
`define ETH_MIICOMMAND_WIDTH_0 3
|
141 |
|
|
`define ETH_MIIADDRESS_WIDTH_0 5
|
142 |
|
|
`define ETH_MIIADDRESS_WIDTH_1 5
|
143 |
|
|
`define ETH_MIITX_DATA_WIDTH_0 8
|
144 |
|
|
`define ETH_MIITX_DATA_WIDTH_1 8
|
145 |
|
|
`define ETH_MIIRX_DATA_WIDTH 16 // not written from WB
|
146 |
|
|
`define ETH_MIISTATUS_WIDTH 3 // not written from WB
|
147 |
|
|
`define ETH_MAC_ADDR0_WIDTH_0 8
|
148 |
|
|
`define ETH_MAC_ADDR0_WIDTH_1 8
|
149 |
|
|
`define ETH_MAC_ADDR0_WIDTH_2 8
|
150 |
|
|
`define ETH_MAC_ADDR0_WIDTH_3 8
|
151 |
|
|
`define ETH_MAC_ADDR1_WIDTH_0 8
|
152 |
|
|
`define ETH_MAC_ADDR1_WIDTH_1 8
|
153 |
|
|
`define ETH_HASH0_WIDTH_0 8
|
154 |
|
|
`define ETH_HASH0_WIDTH_1 8
|
155 |
|
|
`define ETH_HASH0_WIDTH_2 8
|
156 |
|
|
`define ETH_HASH0_WIDTH_3 8
|
157 |
|
|
`define ETH_HASH1_WIDTH_0 8
|
158 |
|
|
`define ETH_HASH1_WIDTH_1 8
|
159 |
|
|
`define ETH_HASH1_WIDTH_2 8
|
160 |
|
|
`define ETH_HASH1_WIDTH_3 8
|
161 |
|
|
`define ETH_TX_CTRL_WIDTH_0 8
|
162 |
|
|
`define ETH_TX_CTRL_WIDTH_1 8
|
163 |
|
|
`define ETH_TX_CTRL_WIDTH_2 1
|
164 |
|
|
`define ETH_RX_CTRL_WIDTH_0 8
|
165 |
|
|
`define ETH_RX_CTRL_WIDTH_1 8
|
166 |
|
|
|
167 |
|
|
|
168 |
|
|
// Outputs are registered (uncomment when needed)
|
169 |
|
|
`define ETH_REGISTERED_OUTPUTS
|
170 |
|
|
|
171 |
|
|
// Settings for TX FIFO
|
172 |
|
|
`define ETH_TX_FIFO_DATA_WIDTH 32
|
173 |
|
|
|
174 |
|
|
// Defines for ethernet TX fifo size - impacts FPGA resource usage
|
175 |
|
|
|
176 |
|
|
//`define ETH_TX_64BYTE_FIFO // 64 byte TX buffer - uncomment this
|
177 |
|
|
//`define ETH_TX_128BYTE_FIFO // 128 byte TX buffer - uncomment this
|
178 |
|
|
`define ETH_TX_256BYTE_FIFO // 256 byte TX buffer - uncomment this
|
179 |
|
|
//`define ETH_TX_512BYTE_FIFO // 512 byte TX buffer - uncomment this
|
180 |
|
|
//`define ETH_TX_1KBYTE_FIFO // 1024 byte TX buffer - uncomment this
|
181 |
|
|
//`define ETH_TX_FULL_PACKET_FIFO // Full 1500 byte TX buffer - uncomment this
|
182 |
|
|
|
183 |
|
|
`ifdef ETH_TX_FULL_PACKET_FIFO
|
184 |
|
|
`define ETH_TX_FIFO_CNT_WIDTH 9
|
185 |
|
|
`define ETH_TX_FIFO_DEPTH 375
|
186 |
|
|
`endif
|
187 |
|
|
`ifdef ETH_TX_1KBYTE_FIFO
|
188 |
|
|
`define ETH_TX_FIFO_CNT_WIDTH 8
|
189 |
|
|
`define ETH_TX_FIFO_DEPTH 256
|
190 |
|
|
`endif
|
191 |
|
|
`ifdef ETH_TX_512BYTE_FIFO
|
192 |
|
|
`define ETH_TX_FIFO_CNT_WIDTH 7
|
193 |
|
|
`define ETH_TX_FIFO_DEPTH 128
|
194 |
|
|
`endif
|
195 |
|
|
`ifdef ETH_TX_256BYTE_FIFO
|
196 |
|
|
`define ETH_TX_FIFO_CNT_WIDTH 6
|
197 |
|
|
`define ETH_TX_FIFO_DEPTH 64
|
198 |
|
|
`endif
|
199 |
|
|
`ifdef ETH_TX_128BYTE_FIFO
|
200 |
|
|
`define ETH_TX_FIFO_CNT_WIDTH 5
|
201 |
|
|
`define ETH_TX_FIFO_DEPTH 32
|
202 |
|
|
`endif
|
203 |
|
|
`ifdef ETH_TX_128BYTE_FIFO
|
204 |
|
|
`define ETH_TX_FIFO_CNT_WIDTH 4
|
205 |
|
|
`define ETH_TX_FIFO_DEPTH 16
|
206 |
|
|
`endif
|
207 |
|
|
|
208 |
|
|
|
209 |
|
|
|
210 |
|
|
|
211 |
|
|
// Settings for RX FIFO
|
212 |
|
|
//`define ETH_RX_FIFO_CNT_WIDTH 8
|
213 |
|
|
//`define ETH_RX_FIFO_DEPTH 256
|
214 |
|
|
//`define ETH_RX_FIFO_CNT_WIDTH 7
|
215 |
|
|
`define ETH_RX_FIFO_DEPTH 128
|
216 |
|
|
`define ETH_RX_FIFO_CNT_WIDTH 6
|
217 |
|
|
//`define ETH_RX_FIFO_DEPTH 64
|
218 |
|
|
//`define ETH_RX_FIFO_CNT_WIDTH 5
|
219 |
|
|
//`define ETH_RX_FIFO_DEPTH 32
|
220 |
|
|
//`define ETH_RX_FIFO_CNT_WIDTH 4
|
221 |
|
|
//`define ETH_RX_FIFO_DEPTH 16
|
222 |
|
|
|
223 |
|
|
`define ETH_RX_FIFO_DATA_WIDTH 32
|
224 |
|
|
|
225 |
|
|
// Burst length
|
226 |
|
|
`define BURST_4BEAT
|
227 |
|
|
`ifdef BURST_4BEAT
|
228 |
|
|
`define ETH_BURST_LENGTH 4 // Change also ETH_BURST_CNT_WIDTH
|
229 |
|
|
`define ETH_BURST_CNT_WIDTH 3 // The counter must be width enough to count to ETH_BURST_LENGTH
|
230 |
|
|
`endif
|
231 |
|
|
|
232 |
|
|
//`define ETH_BURST_LENGTH 32 // Change also ETH_BURST_CNT_WIDTH
|
233 |
|
|
//`define ETH_BURST_CNT_WIDTH 7 // The counter must be width enough to count to ETH_BURST_LENGTH
|
234 |
|
|
|
235 |
|
|
// Undefine this to enable bursting for RX (writing to memory)
|
236 |
|
|
`define ETH_RX_BURST_EN
|
237 |
|
|
|
238 |
|
|
// WISHBONE interface is Revision B3 compliant (uncomment when needed)
|
239 |
|
|
`define ETH_WISHBONE_B3
|
240 |
|
|
|
241 |
|
|
// Hack where the transmit logic polls each of the TX buffers instead of having to keep track of what's going on
|
242 |
|
|
//`define TXBD_POLL
|
243 |
|
|
|
244 |
|
|
// Define this to allow reading of the Wishbone control state machine on reg
|
245 |
|
|
// address 0x58
|
246 |
|
|
//`define WISHBONE_DEBUG
|