1 |
103 |
unneback |
\input texinfo
|
2 |
|
|
@c -*-texinfo-*-
|
3 |
|
|
@c %**start of header
|
4 |
|
|
@setfilename versatile_mem_ctrl
|
5 |
|
|
@include version.texi
|
6 |
|
|
@settitle Versatile memory controller @value{VERSION}
|
7 |
|
|
|
8 |
|
|
@c %**end of header
|
9 |
|
|
|
10 |
|
|
@set DESIGN Versatile memory controller
|
11 |
|
|
@copying
|
12 |
|
|
This file documents the @value{DESIGN}.
|
13 |
|
|
|
14 |
|
|
Copyright @copyright{} 2011 ORSoC
|
15 |
|
|
|
16 |
|
|
@quotation
|
17 |
|
|
Permission is granted to copy, distribute and/or modify this document
|
18 |
|
|
under the terms of the GNU Free Documentation License, Version 1.2 or
|
19 |
|
|
any later version published by the Free Software Foundation; with no
|
20 |
|
|
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
21 |
|
|
Texts. A copy of the license is included in the section entitled ``GNU
|
22 |
|
|
Free Documentation License''.
|
23 |
|
|
@end quotation
|
24 |
|
|
@end copying
|
25 |
|
|
|
26 |
|
|
@afourpaper
|
27 |
|
|
|
28 |
|
|
@titlepage
|
29 |
|
|
@title @value{DESIGN} User Guide
|
30 |
|
|
@c @subtitle subtitle-if-any
|
31 |
|
|
@c @subtitle second-subtitle
|
32 |
|
|
@author Michael Unneback
|
33 |
|
|
@author ORSoC
|
34 |
|
|
|
35 |
|
|
@c The following two commands
|
36 |
|
|
@c start the copyright page.
|
37 |
|
|
@page
|
38 |
|
|
@vskip 0pt plus 1filll
|
39 |
|
|
@insertcopying
|
40 |
|
|
|
41 |
|
|
Published by ORSoC
|
42 |
|
|
@end titlepage
|
43 |
|
|
|
44 |
|
|
@c So the toc is printed at the start.
|
45 |
|
|
@contents
|
46 |
|
|
|
47 |
|
|
@ifnottex
|
48 |
|
|
@node Top
|
49 |
|
|
@top Scope of this Document
|
50 |
|
|
|
51 |
|
|
This document is the user guide for @value{DESIGN}.
|
52 |
|
|
|
53 |
|
|
@end ifnottex
|
54 |
|
|
|
55 |
|
|
@node Document Introduction
|
56 |
|
|
@chapter Introduction
|
57 |
|
|
|
58 |
|
|
@cindex Introduction to this @value{DESIGN}
|
59 |
|
|
|
60 |
|
|
This design implements a versatile memory controller. If used in combination with the versitale library, available from OpenCores,
|
61 |
|
|
different types of system can easily be designed, including use cases where the system bus is in one clock domain and the memory
|
62 |
|
|
controller in an other.
|
63 |
|
|
@node Block diagram
|
64 |
|
|
@chapter Block Diagram
|
65 |
|
|
@cindex Block diagram
|
66 |
|
|
|
67 |
|
|
@section Clock domains
|
68 |
|
|
@value{DESIGN} contains the following clock domains
|
69 |
|
|
@itemize
|
70 |
|
|
@item Wishbone slave clock domain
|
71 |
|
|
@item Wishbone master clock domain
|
72 |
|
|
@item RX GMII clock domain
|
73 |
|
|
@item TX GMII clock domain
|
74 |
|
|
@end itemize
|
75 |
|
|
|
76 |
|
|
@node Configuration registers
|
77 |
|
|
@chapter Configuration registers
|
78 |
|
|
|
79 |
|
|
@section Register memory map
|
80 |
|
|
@multitable @columnfractions .2 .1 .1 .1 .5
|
81 |
|
|
@headitem Name @tab Address @tab Width @tab Access @tab Description
|
82 |
|
|
@item MODER @tab @value{MODER} @tab 32 @tab RW @tab Mode register
|
83 |
|
|
@item INT_SOURCE @tab @value{INT_SOURCE} @tab 32 @tab RW @tab Interrupt source register
|
84 |
|
|
@item INT_MASK @tab @value{INT_MASK} @tab 32 @tab RW @tab Interrupt mask register
|
85 |
|
|
@item TX_BD_NUM @tab @value{TX_BD_NUM} @tab 32 @tab RW @tab Transmit Buffer Descriptor number
|
86 |
|
|
@item MIIMODER @tab @value{MIIMODER} @tab 32 @tab RW @tab MII Mode Register
|
87 |
|
|
@item MIICOMMAND @tab @value{MIICOMMAND} @tab 32 @tab RW @tab MII Command Register
|
88 |
|
|
@item MIIADDRESS @tab @value{MIIADDRESS} @tab 32 @tab RW @tab MII Address Register
|
89 |
|
|
@item MIITX_DATA @tab @value{MIITX_DATA} @tab 32 @tab RW @tab MII Transmit Data
|
90 |
|
|
@item MIIRX_DATA @tab @value{MIIRX_DATA} @tab 32 @tab RW @tab MII Receive Data
|
91 |
|
|
@item MIISTATUS @tab @value{MIISTATUS} @tab 32 @tab RW @tab MII Status Register
|
92 |
|
|
@item MAC_ADDR0 @tab @value{MAC_ADDR0} @tab 32 @tab RW @tab MAC address, LSB four bytes
|
93 |
|
|
@item MAC_ADDR1 @tab @value{MAC_ADDR1} @tab 32 @tab RW @tab MAC address, MSB two bytes
|
94 |
|
|
@end multitable
|
95 |
|
|
|
96 |
|
|
@page
|
97 |
|
|
|
98 |
|
|
@subsection MODER
|
99 |
|
|
@multitable @columnfractions .1 .1 .2 .6
|
100 |
|
|
@headitem Bit @tab Access @tab Description @tab
|
101 |
|
|
@item 31-17 @tab @tab Reserved
|
102 |
|
|
@item 16 @tab RW @tab RECSMALL @tab Receive small packets
|
103 |
|
|
@item 15 @tab RW @tab PAD @tab Padding enabled
|
104 |
|
|
@item 14 @tab RW @tab HUGEN @tab Huge Packets Enable
|
105 |
|
|
@item 13 @tab RW @tab CRCEN @tab CRC enable
|
106 |
|
|
@item 12-8 @tab @tab Reserved
|
107 |
|
|
@item 7 @tab RW @tab LOOPBCK @tab Loopback
|
108 |
|
|
@item 6 @tab RW @tab Resrved
|
109 |
|
|
@item 5 @tab RW @tab PRO @tab Promiscuous
|
110 |
|
|
@item 4 @tab @tab Reserved
|
111 |
|
|
@item 3 @tab RW @tab BRO @tab Broadcast Address
|
112 |
|
|
@item 2 @tab @tab Reserved
|
113 |
|
|
@item 1 @tab RW @tab TXEN @tab Transmit Enable
|
114 |
|
|
@item 0 @tab RW @tab RXEN @tab Receive Enable
|
115 |
|
|
@end multitable
|
116 |
|
|
@example
|
117 |
|
|
Reset value:
|
118 |
|
|
MODER: 0x0000A000
|
119 |
|
|
@end example
|
120 |
|
|
|
121 |
|
|
@page
|
122 |
|
|
|
123 |
|
|
@subsection INT_SOURCE
|
124 |
|
|
@multitable @columnfractions .1 .1 .2 .6
|
125 |
|
|
@headitem Bit @tab Access @tab Description @tab
|
126 |
|
|
@item 31-7 @tab @tab Reserved
|
127 |
|
|
@item 4 @tab RW @tab BUSY @tab Busy@* This bit indicates that a buffer was received and discarded due to a lack of buffers. It is cleared by writing 1 to it. This bit appears regardless to the IRQ bits in the Receive or Transmit Buffer Descriptors.
|
128 |
|
|
@item 3 @tab RW @tab RXE @tab Receive error@* This bit indicates that an error occurred while receiving data. It is cleared by writing 1 to it. This bit appears only when IRQ bit is set in the Receive Buffer Descriptor.
|
129 |
|
|
@item 2 @tab RW @tab RXB @tab Receive buffer@* This bit indicates that a frame was received. It is cleared by writing 1 to it. This bit appears only when IRQ bit is set in the Receive Buffer Descriptor. If a control frame is received, then RXC bit is set instead of the RXB bit.
|
130 |
|
|
@item 1 @tab RW @tab TXE @tab Transmit error@* This bit indicates that a buffer was not transmitted due to a transmit error. It is cleared by writing 1 to it. This bit appears only when IRQ bit is set in the Receive Buffer Descriptor. This bit appears only when IRQ bit is set in the Transmit Buffer Descriptor.
|
131 |
|
|
@item 0 @tab RW @tab TXB @tab Transmit buffer@* This bit indicates that a buffer has been transmitted. It is cleared by writing 1 to it. This bit appears only when IRQ bit is set in the Transmit Buffer Descriptor.
|
132 |
|
|
@end multitable
|
133 |
|
|
@example
|
134 |
|
|
Reset value:
|
135 |
|
|
INT_SOURCE: 0x00000000
|
136 |
|
|
@end example
|
137 |
|
|
|
138 |
|
|
@page
|
139 |
|
|
@subsection INT_MASK
|
140 |
|
|
@multitable @columnfractions .1 .1 .2 .6
|
141 |
|
|
@headitem Bit @tab Access @tab Description @tab
|
142 |
|
|
@item 31-7 @tab @tab Reserved
|
143 |
|
|
@item 4 @tab RW @tab BUSY_M @tab Busy mask@*
|
144 |
|
|
@item 3 @tab RW @tab RXE_M @tab Receive error@* Receive error mask
|
145 |
|
|
@item 2 @tab RW @tab RXB_M @tab Receive buffer@* Receive buffer mask
|
146 |
|
|
@item 1 @tab RW @tab TXE_M @tab Transmit error@* Transmit error mask
|
147 |
|
|
@item 0 @tab RW @tab TXB_M @tab Transmit buffer@* Transmit buffer mask
|
148 |
|
|
@end multitable
|
149 |
|
|
@example
|
150 |
|
|
Reset value:
|
151 |
|
|
INT_MASK: 0x00000000
|
152 |
|
|
@*@*
|
153 |
|
|
|
154 |
|
|
1 -> event causes an interrupt
|
155 |
|
|
@end example
|
156 |
|
|
|
157 |
|
|
@page
|
158 |
|
|
@subsection TX_BD_NUM
|
159 |
|
|
@multitable @columnfractions .1 .1 .2 .6
|
160 |
|
|
@headitem Bit @tab Access @tab Description @tab
|
161 |
|
|
@item 31-8 @tab @tab Reserved
|
162 |
|
|
@item 7-0 @tab RW @tab TX_BD_NUM @tab Transmit Buffer Descriptor Number@* Number of the Tx BD. Number of the Rx BD equals to the (0x80 – Tx BD number). Maximum number of the Tx BD is 0x80. Values greater then 0x80 cannot be written to this register (ignored).
|
163 |
|
|
@end multitable
|
164 |
|
|
@example
|
165 |
|
|
Reset value:
|
166 |
|
|
TX_BD_NUM: 0x00000040
|
167 |
|
|
@end example
|
168 |
|
|
|
169 |
|
|
@page
|
170 |
|
|
@subsection MIIMODER
|
171 |
|
|
@multitable @columnfractions .1 .1 .2 .6
|
172 |
|
|
@headitem Bit @tab Access @tab Description @tab
|
173 |
|
|
@item 31-9 @tab @tab Reserved
|
174 |
|
|
@item 8 @tab RW @tab MIINOPRE @tab No Preamble@* 0 = 32 bit preamble sent@* 1 = No preamble sent
|
175 |
|
|
@item 7-0 @tab RW @tab CLKDIV @tab Clock divider The field is a host clock divider factor. The host clock can be divided by an even number, greater then 1. The default value is 0x64 (100).
|
176 |
|
|
@end multitable
|
177 |
|
|
@example
|
178 |
|
|
Reset value:
|
179 |
|
|
MIIMODER: 0x00000064
|
180 |
|
|
@end example
|
181 |
|
|
|
182 |
|
|
@subsection MIICOMMAND
|
183 |
|
|
@multitable @columnfractions .1 .1 .2 .6
|
184 |
|
|
@headitem Bit @tab Access @tab Description @tab
|
185 |
|
|
@item 31-3 @tab @tab Reserved
|
186 |
|
|
@item 2 @tab RW @tab WCTRLDATA @tab Write control data
|
187 |
|
|
@item 1 @tab RW @tab RSTAT @tab Read status
|
188 |
|
|
@item 0 @tab RW @tab SCANSTAT @tab Scan status
|
189 |
|
|
@end multitable
|
190 |
|
|
@example
|
191 |
|
|
Reset value:
|
192 |
|
|
MIICOMMAND: 0x00000000
|
193 |
|
|
@end example
|
194 |
|
|
|
195 |
|
|
@subsection MIIADDRESS
|
196 |
|
|
@multitable @columnfractions .1 .1 .2 .6
|
197 |
|
|
@headitem Bit @tab Access @tab Description @tab
|
198 |
|
|
@item 31-13 @tab @tab Reserved
|
199 |
|
|
@item 12-8 @tab RW @tab RGAD @tab Register address
|
200 |
|
|
@item 7-5 @tab RW @tab Reserved @tab
|
201 |
|
|
@item 4-0 @tab RW @tab FIAD @tab PHY address
|
202 |
|
|
@end multitable
|
203 |
|
|
@example
|
204 |
|
|
Reset value:
|
205 |
|
|
MIIADDRESS: 0x00000000
|
206 |
|
|
@end example
|
207 |
|
|
|
208 |
|
|
@subsection MIITX_DATA
|
209 |
|
|
@multitable @columnfractions .1 .1 .2 .6
|
210 |
|
|
@headitem Bit @tab Access @tab Description @tab
|
211 |
|
|
@item 31-16 @tab @tab Reserved
|
212 |
|
|
@item 15-0 @tab RW @tab CTRLDATA @tab Data to be written to the PHY
|
213 |
|
|
@end multitable
|
214 |
|
|
@example
|
215 |
|
|
Reset value:
|
216 |
|
|
MIITX_DATA: 0x00000000
|
217 |
|
|
@end example
|
218 |
|
|
|
219 |
|
|
@subsection MIIRX_DATA
|
220 |
|
|
@multitable @columnfractions .1 .1 .2 .6
|
221 |
|
|
@headitem Bit @tab Access @tab Description @tab
|
222 |
|
|
@item 31-16 @tab @tab Reserved
|
223 |
|
|
@item 15-0 @tab R @tab PRSD @tab Data read from the PHY
|
224 |
|
|
@end multitable
|
225 |
|
|
@example
|
226 |
|
|
Reset value:
|
227 |
|
|
MIIRX_DATA: 0x00000000
|
228 |
|
|
@end example
|
229 |
|
|
|
230 |
|
|
@subsection MIISTATUS
|
231 |
|
|
@multitable @columnfractions .1 .1 .2 .6
|
232 |
|
|
@headitem Bit @tab Access @tab Description @tab
|
233 |
|
|
@item 31-3 @tab @tab Reserved
|
234 |
|
|
@item 2 @tab R @tab NVALID @tab Invalid@* 0 = The data in the MSTATUS register is valid.@* 1 = The data in the MSTATUS register is invalid.@* This bit is only valid when the scan status operation is active.
|
235 |
|
|
@item 1 @tab R @tab BUSY @tab 0 = The MII is ready.@* 1 = The MII is busy (operation in progress).
|
236 |
|
|
@item 0 @tab R @tab LINKFAIL @tab 0 = The link is OK.@*1 = The link failed.@*The Link fail condition occurred (now the link might be OK). Another status read gets a new status.
|
237 |
|
|
@end multitable
|
238 |
|
|
@example
|
239 |
|
|
Reset value:
|
240 |
|
|
MIISTATUS: 0x00000000
|
241 |
|
|
@end example
|
242 |
|
|
|
243 |
|
|
@page
|
244 |
|
|
@subsection MAC_ADDR0
|
245 |
|
|
@multitable @columnfractions .1 .1 .8
|
246 |
|
|
@headitem Bit @tab Access @tab Description @tab
|
247 |
|
|
@item 31-24 @tab RW @tab Byte 2 of the Ethernet MAC address
|
248 |
|
|
@item 23-16 @tab RW @tab Byte 3 of the Ethernet MAC address
|
249 |
|
|
@item 15-8 @tab RW @tab Byte 4 of the Ethernet MAC address
|
250 |
|
|
@item 7-0 @tab RW @tab Byte 5 of the Ethernet MAC address
|
251 |
|
|
@end multitable
|
252 |
|
|
@example
|
253 |
|
|
Reset value:
|
254 |
|
|
MAC_ADDR0: 0x00000000
|
255 |
|
|
@end example
|
256 |
|
|
|
257 |
|
|
@subsection MAC_ADDR1
|
258 |
|
|
@multitable @columnfractions .1 .1 .8
|
259 |
|
|
@headitem Bit @tab Access @tab Description @tab
|
260 |
|
|
@item 31-16 @tab @tab Reserved
|
261 |
|
|
@item 15-8 @tab RW @tab Byte 0 of the Ethernet MAC address
|
262 |
|
|
@item 7-0 @tab RW @tab Byte 1 of the Ethernet MAC address
|
263 |
|
|
@end multitable
|
264 |
|
|
@example
|
265 |
|
|
Reset value:
|
266 |
|
|
MAC_ADDR1: 0x00000000
|
267 |
|
|
@end example
|
268 |
|
|
|
269 |
|
|
@node MDIO
|
270 |
|
|
@chapter Management Data Input/Output
|
271 |
|
|
|
272 |
|
|
The MDIO interface is implemented by two lines:
|
273 |
|
|
@itemize
|
274 |
|
|
@item a MDC clock line
|
275 |
|
|
@item an MDIO data line
|
276 |
|
|
@end itemize
|
277 |
|
|
|
278 |
|
|
The clock line is driven by the MAC device. The data line is bidirectional: the PHY drives it to provide register data at the end of a read operation.
|
279 |
|
|
@*@*
|
280 |
|
|
The bus has a single MAC master, but can have up to 32 PHY slaves.
|
281 |
|
|
@*@*
|
282 |
|
|
The MDC clock can be aperiodic, with a minimum period of 400 ns, which corresponds to a maximal frequency of 2.5 MHz. Newer chips, however, allow faster acesses.
|
283 |
|
|
@*@*
|
284 |
|
|
The MDIO data line has a pull-up of 1.5 kOhm in the PHY, allowing the MAC to determine if one or more PHYs are attached. The MAC should have a 2 kOhm pull-down on that same line.
|
285 |
|
|
|
286 |
|
|
@section Bus timing
|
287 |
|
|
@subsection Read operation
|
288 |
|
|
A read operation has the following phases
|
289 |
|
|
@itemize
|
290 |
|
|
@item Preamble with 32 ones
|
291 |
|
|
@item Start sequence, 01
|
292 |
|
|
@item Opcode read, 10
|
293 |
|
|
@item PHY adress
|
294 |
|
|
@item REG adress
|
295 |
|
|
@item Bus turnaround
|
296 |
|
|
@item Register data
|
297 |
|
|
@end itemize
|
298 |
|
|
@image{MDIO_rd,15cm,2.54cm}
|
299 |
|
|
|
300 |
|
|
@subsection Write operation
|
301 |
|
|
A write operation has the following phases
|
302 |
|
|
@itemize
|
303 |
|
|
@item Preamble with 32 ones
|
304 |
|
|
@item Start sequence, 01
|
305 |
|
|
@item Opcode read, 01
|
306 |
|
|
@item PHY adress
|
307 |
|
|
@item REG adress
|
308 |
|
|
@item Bus turnaround
|
309 |
|
|
@item Register data
|
310 |
|
|
@end itemize
|
311 |
|
|
@image{MDIO_wr,15cm,2.54cm}
|
312 |
|
|
|
313 |
|
|
@node Ingress and Egress FIFO
|
314 |
|
|
@chapter Ingress and Egress FIFO
|
315 |
|
|
|
316 |
|
|
@section FIFO implementation
|
317 |
|
|
Both ingress and egress FIFO implementation uses a generic asynchronous FIFO design
|
318 |
|
|
available from OpenCores.@*@*
|
319 |
|
|
@uref{http://opencores.org/project,versatile_library}
|
320 |
|
|
|
321 |
|
|
@c ****************************************************************************
|
322 |
|
|
@c End bits
|
323 |
|
|
@c ****************************************************************************
|
324 |
|
|
|
325 |
|
|
@node GNU Free Documentation License
|
326 |
|
|
@chapter GNU Free Documentation License
|
327 |
|
|
@cindex license for @value{DESIGN}
|
328 |
|
|
|
329 |
|
|
@include fdl.texi
|
330 |
|
|
|
331 |
|
|
@node Index
|
332 |
|
|
|
333 |
|
|
@unnumbered Index
|
334 |
|
|
|
335 |
|
|
@printindex cp
|
336 |
|
|
|
337 |
|
|
@bye
|