OpenCores
URL https://opencores.org/ocsvn/versatile_mem_ctrl/versatile_mem_ctrl/trunk

Subversion Repositories versatile_mem_ctrl

[/] [versatile_mem_ctrl/] [trunk/] [doc/] [src/] [versatile_mem_ctrl.texi] - Blame information for rev 106

Details | Compare with Previous | View Log

Line No. Rev Author Line
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 106 unneback
 
64
@section Dependencies to other IP cores
65
 
66
This design uses the following IP coreas available from OpenCores project verstile library.
67
@itemize @bullet
68
@item vl_cnt_shreg_ce_clear
69
@item vl_dff_ce_clear
70
@item vl_cnt_lfsr_zq
71
@item vl_dff
72
@item vl_o_dff
73
@item vl_io_dff_oe
74
@end itemize
75
 
76 103 unneback
@node Block diagram
77
@chapter Block Diagram
78
@cindex Block diagram
79
 
80 106 unneback
@section Synchronous design
81
@image{block-sdram}
82
Synchronous design where wishbone clock domain is equal to SDRAM and SDRAM controller clock domain.
83 103 unneback
 
84 106 unneback
@section Asynchronous design
85
@image{block-sdram-wbwb}
86
Asynchronous design where wishbone and SDRAM clock domain are independant. A wishbone rev B3 compatilble bridge
87
is available in project versatile_library from OpenCores, http://www.opencores.org.
88 103 unneback
 
89 106 unneback
@section Asynchronous design with multiple wishbone interfaces
90
@image{block-sdram-wbwb-arbiter}
91
Asynchronous design where wishbone and SDRAM clock domain are independant. Multiple wishbone port with use of a wishbone arbiter.
92 103 unneback
 
93 106 unneback
@node SDR SDRAM controller
94
@chapter SDR SDRAM controller
95 103 unneback
 
96 106 unneback
@section Module defines
97
@multitable @columnfractions .2 .8
98
@headitem Name @tab Description
99
@item NO_BURST @tab Define if burst cycles not used
100
@item WRAP4 @tab Define to support 4 word wrap burst
101
@item WRAP8 @tab Define to support 8 word wrap burst
102
@item WRAP16 @tab Define to support 16 word wrap burst
103 103 unneback
@end multitable
104
 
105 106 unneback
@section Module parameters
106 103 unneback
 
107 106 unneback
@multitable @columnfractions .2 .1 .7
108
@headitem Name @tab Default value @tab Description
109
@item ba_size @tab 2 @tab Bank adress vector size
110
@item row_size @tab 13 @tab Row adress vector size
111
@item col_size @tab 9 @tab Column adress vector size
112
@item cl @tab 2 @tab CAS latency
113 103 unneback
@end multitable
114
 
115 106 unneback
Parameters ba_size, col_size and row_size should be set depending on memory configuration. The following
116
table holds figures for some SDRAM memories.
117 103 unneback
 
118 106 unneback
@multitable @columnfractions .15 .25 .1 .1 .1 .3
119
@headitem Manufacturer @tab Partnumber @tab ba_size  @tab row_size @tab col_size @tab Memory size
120
@item Micron @tab MT48LC4M16 @tab 2 @tab 12 @tab 8 @tab 8Mbyte
121
@item Micron @tab MT48LC8M16 @tab 2 @tab 12 @tab 9 @tab 16Mbyte
122
@item Micron @tab MT48LC16M16 @tab 2 @tab 13 @tab 9 @tab 32Mbyte
123
@item Micron @tab MT48LC32M16 @tab 2 @tab 13 @tab 10 @tab 64Mbyte
124 103 unneback
@end multitable
125
 
126 106 unneback
Parameter cl should be set to either 2 or 3 depending on SDRAM clock.
127 103 unneback
 
128 106 unneback
@section Module IO signals
129
@subsection Wishbone signals
130
@multitable @columnfractions .2 .1 .1 .6
131
@headitem Name @tab Dir @tab Width @tab Description
132
@item dat_i @tab I  @tab 32 @tab Input data vector
133
@item adr_i @tab I  @tab  @tab Adress vector
134
@item sel_i @tab I  @tab 4 @tab Byte select signals
135
@item bte_i @tab I  @tab 2 @tab Bus tag identifier
136
@item we_i @tab I  @tab 1 @tab Write enable
137
@item cyc_i @tab I  @tab 1 @tab Active cycle indicator
138
@item stb_i @tab I  @tab 1 @tab Strobe
139
@item dat_o @tab O  @tab 32 @tab Output data vector
140
@item ack_o @tab O  @tab 1 @tab Acknowledge signal
141 103 unneback
@end multitable
142
 
143 106 unneback
Wishbone signal bte_i is optional and is only used for designs supporting burst transfer.
144
@subsection SDRAM signals
145
@multitable @columnfractions .2 .1 .1 .6
146
@headitem Name @tab Dir @tab Width @tab Description
147
@item ba @tab O @tab ba_size @tab Bank adress vector
148
@item a @tab O @tab 13 @tab Adress vector
149
@item cmd @tab O @tab 3 @tab SDRAM command, {ras_n, cas_n, we_n}
150
@item cke @tab O @tab 1 @tab Clock enable
151
@item cs_n @tab O @tab 1 @tab Chip select, active low
152
@item dqm @tab O @tab 2 @tab Data mask
153
@item dq_i @tab I @tab 16 @tab Data input vector
154
@item dq_o @tab O @tab 16 @tab Data output vector
155
@item dq_oe @tab O @tab 1 @tab Data output enable
156 103 unneback
@end multitable
157
 
158 106 unneback
@subsection System signals
159
@multitable @columnfractions .2 .1 .1 .6
160
@headitem Name @tab Dir @tab Width @tab Description
161
@item clk @tab I @tab 1 @tab SDRAM system clock
162
@item rst @tab I @tab 1 @tab Asynchronous reset, active hig
163 103 unneback
@end multitable
164
 
165 106 unneback
@node SDR SDRAM 16 bit data bus controller
166
@chapter SDR SDRAM 16 bit data bus controller
167
@cindex SDR SDRAM 16 bit data bus controller
168 103 unneback
 
169 106 unneback
@section State machine implementation
170 103 unneback
 
171 106 unneback
Design is based on a state machine as described below.
172 103 unneback
 
173 106 unneback
@image{sdr_sdram_16,14cm,16cm,,.png}
174 103 unneback
 
175 106 unneback
A counter is incremented on each cycle the state machine reside in any given state.
176
When changing state a counter clear is issued. The counter state vector is used for
177
two things
178 103 unneback
@itemize
179 106 unneback
@item controlling outputs, ie defining cmd and other control signals
180
@item to make sure timing reqiurements are fulfilled, ie define time from precharge to activate
181 103 unneback
@end itemize
182
 
183 106 unneback
@subsection State - init
184 103 unneback
 
185 106 unneback
The init state is responsible to make sure that a proper start-up and initialization of the SDRAM is
186
performed. The following sequence should be applied:
187
@enumerate
188
@item assert CKE low
189
@item provide stable clock
190
@item bring CKE high
191
@item perform PRECHARGE ALL command and wait for tRP
192
@item issue AUTO RERFESH and wait for tRFC
193
@item issue AUTO RERFESH and wait for tRFC
194
@item LOAD MODE REGISTER and wait for tMR
195
@end enumerate
196
After this state machine advances to idle state
197
 
198
@subsection State - idle
199
 
200
In state idle implementation awaits two different condition, appearing in order of priority
201
@enumerate
202
@item refresh request => next state is rfr
203
@item cyc_i & stb_i => next state is adr
204
@end enumerate
205
 
206
 
207
@subsection State - adr
208
 
209
Depending on status of open bank and open rows choice is taken whether to precharge and activate, activate or go
210
directly to read write state. Reason for this as a separate state is to be able to have comparison result as a
211
registered signal to achive an higher clock frequency.
212
 
213
@subsection State - pch
214
 
215
Open row in current bank is deactivated. State machine waits in pch state to fulfill tRP.
216
 
217
@subsection State - act
218
 
219
Row in current bank is activated. State machine waits in act state to fulfill tRCD.
220
 
221
@subsection State - rw
222
 
223
A two word read or write burst is started. If wishbone cycle is of type burst column will get incremented
224
with possible wrap around and a new burst started for each 32 bit word.
225
 
226
@section Timing
227
 
228
The follwoing timing requirements must be fulfilled:
229
 
230 103 unneback
@itemize
231 106 unneback
@item tMR - Load Mode Register period
232
@item tRCD - Active to read/write delay
233
@item tRP - Precharge command period
234
@item tRFC - Auto refresh period
235
@item tREF - refresh period
236 103 unneback
@end itemize
237
 
238 106 unneback
In the SDRAM datasheet the above timing figures will be given in ns and should be
239
converted to number of clock cycles. All of the above timing figures, except tREF, are implemented as parameters
240
in the design and should be set depending on SDRAM figures and actual clock period. All
241
parameters have default values of 2 clock cycles.
242
 
243
@subsection Bank/Row activation - tRCD
244
 
245
@image{tRCD,15cm,5cm,,.png}
246
 
247
Minimum time between activation of and read or write command.
248
@subsection Auto refresh mode
249
 
250
@image{aref,15cm,15cm,,.png}
251
 
252
Minumum time between precharge and auto refresh and active command.
253
 
254
@subsection Refresh period - tREF
255
 
256
The auto refresh period, tREF must be met. During auto refresh an internal address counter
257
is used and adress signals are treated as don't care. During the refresh period each row must
258
be refreshed. @*
259
For example consider a SDRAM with tREF = 64 ms and row size of 8K. An auto refresh command
260
should be issued once every 64 ms / 8192 = 7.813 us.@*
261
The refresh interval counter is implemented as an LFSR style counter for minimal area and maximum
262
performance. To accurately set the wrap value for this counter use the application VersatileCounter found
263
in the versatile library project at opencores. This program gives the wrap value for a given vector length.
264
Assuming an SDRAM clock frequency of 133 MHz which equals a period time of 7.5 ns we should issue an auto
265
refresh every 7.813 us / 7.5 ns = 1041 cycle. We need a state vector of 11 bits in the counter.@*
266
To get the wrap value we use the application@*
267
@command{./VersatileCounter.php 11 1041@*11111110101}
268
 
269
@node Example: Timing setup
270
@chapter Example: Timing setup
271
 
272
@section Requirements
273
 
274
SDRAM device to use:
275 103 unneback
@itemize
276 106 unneback
@item Micron MT48LC32M16-7E
277 103 unneback
@end itemize
278
 
279 106 unneback
@multitable @columnfractions .4 .2 .1 .1 .1 .1
280
@headitem Parameter @tab Symbol @tab Min @tab Max @tab Unit
281
@item Auto refresh period @tab tRFC @tab 66 @tab - @tab ns
282
@item Precharge command period @tab tRP @tab 15 @tab - @tab ns
283
@item Active to read or write delay @tab tRCD @tab 15 @tab - @tab ns
284
@item Load mode register command to active or refresh @tab tMRD @tab 2 @tab - @tab tCK
285
@item Refresh periods (8192 rows) @tab tREF @tab 66 @tab -@tab ms
286
@end multitable
287 103 unneback
 
288 106 unneback
Intended operating frequency is 75 MHz, tCK = 13.333 ns
289 103 unneback
 
290 106 unneback
@section Parameter settings
291
 
292
@multitable @columnfractions .2 .8
293
@headitem Symbol @tab Value
294
@item tRFC @tab 5
295
@item tRP  @tab 2
296
@item tRCD @tab 2
297
@item tMRD @tab 2
298
@end multitable
299
@*
300
Refresh rate is 66 ms / 8192 = 8.057 us@*
301
Number of clock cycles between refresh request 8.057 us / 13.333 ns = 604@*
302
@*
303
To get the wrap value we use the application from Versatile Library@*
304
@command{./VersatileCounter.php 10 604@*0101001110}
305
 
306
 
307 103 unneback
@c ****************************************************************************
308
@c End bits
309
@c ****************************************************************************
310
 
311 106 unneback
@node GNU Free Documentation License
312 103 unneback
@chapter GNU Free Documentation License
313
@cindex license for @value{DESIGN}
314
 
315
@include fdl.texi
316
 
317
@node Index
318
 
319
@unnumbered Index
320
 
321
@printindex cp
322
 
323
@bye

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.