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

Subversion Repositories hssdrc

[/] [hssdrc/] [trunk/] [rtl/] [hssdrc_decoder.v] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 des00
//
2
// Project      : High-Speed SDRAM Controller with adaptive bank management and command pipeline
3
// 
4
// Project Nick : HSSDRC
5
// 
6
// Version      : 1.0-beta 
7
//  
8
// Revision     : $Revision: 1.1 $ 
9
// 
10
// Date         : $Date: 2008-03-06 13:52:43 $ 
11
// 
12
// Workfile     : hssdrc_decoder.v
13
// 
14
// Description  : sdram command sequence decoder's array
15
// 
16
// HSSDRC is licensed under MIT License
17
// 
18
// Copyright (c) 2007-2008, Denis V.Shekhalev (des00@opencores.org) 
19
// 
20
// Permission  is hereby granted, free of charge, to any person obtaining a copy of
21
// this  software  and  associated documentation files (the "Software"), to deal in
22
// the  Software  without  restriction,  including without limitation the rights to
23
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
24
// the  Software, and to permit persons to whom the Software is furnished to do so,
25
// subject to the following conditions:
26
// 
27
// The  above  copyright notice and this permission notice shall be included in all
28
// copies or substantial portions of the Software.
29
// 
30
// THE  SOFTWARE  IS  PROVIDED  "AS  IS",  WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
32
// FOR  A  PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
33
// COPYRIGHT  HOLDERS  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
34
// IN  AN  ACTION  OF  CONTRACT,  TORT  OR  OTHERWISE,  ARISING  FROM, OUT OF OR IN
35
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
36
//
37
 
38
 
39
`include "hssdrc_timescale.vh"
40
 
41
`include "hssdrc_define.vh"
42
 
43
module hssdrc_decoder (
44
  clk               ,
45
  reset             ,
46
  sclr              ,
47
  //
48
  ba_map_update     ,
49
  ba_map_clear      ,
50
  ba_map_ba         ,
51
  ba_map_rowa       ,
52
  ba_map_pre_act_rw ,
53
  ba_map_act_rw     ,
54
  ba_map_rw         ,
55
  ba_map_all_close  ,
56
  //
57
  arb0_write        ,
58
  arb0_read         ,
59
  arb0_refr         ,
60
  arb0_rowa         ,
61
  arb0_cola         ,
62
  arb0_ba           ,
63
  arb0_burst        ,
64
  arb0_chid         ,
65
  arb0_ready        ,
66
  //
67
  arb1_write        ,
68
  arb1_read         ,
69
  arb1_refr         ,
70
  arb1_rowa         ,
71
  arb1_cola         ,
72
  arb1_ba           ,
73
  arb1_burst        ,
74
  arb1_chid         ,
75
  arb1_ready        ,
76
  //
77
  arb2_write        ,
78
  arb2_read         ,
79
  arb2_refr         ,
80
  arb2_rowa         ,
81
  arb2_cola         ,
82
  arb2_ba           ,
83
  arb2_burst        ,
84
  arb2_chid         ,
85
  arb2_ready        ,
86
  //
87
  dec0_pre_all        ,
88
  dec0_refr           ,
89
  dec0_pre            ,
90
  dec0_act            ,
91
  dec0_read           ,
92
  dec0_write          ,
93
  dec0_pre_all_enable ,
94
  dec0_refr_enable    ,
95
  dec0_pre_enable     ,
96
  dec0_act_enable     ,
97
  dec0_read_enable    ,
98
  dec0_write_enable   ,
99
  dec0_locked         ,
100
  dec0_last           ,
101
  dec0_rowa           ,
102
  dec0_cola           ,
103
  dec0_ba             ,
104
  dec0_chid           ,
105
  dec0_burst          ,
106
  //
107
  dec1_pre_all        ,
108
  dec1_refr           ,
109
  dec1_pre            ,
110
  dec1_act            ,
111
  dec1_read           ,
112
  dec1_write          ,
113
  dec1_pre_all_enable ,
114
  dec1_refr_enable    ,
115
  dec1_pre_enable     ,
116
  dec1_act_enable     ,
117
  dec1_read_enable    ,
118
  dec1_write_enable   ,
119
  dec1_locked         ,
120
  dec1_last           ,
121
  dec1_rowa           ,
122
  dec1_cola           ,
123
  dec1_ba             ,
124
  dec1_chid           ,
125
  dec1_burst          ,
126
  //
127
  dec2_pre_all        ,
128
  dec2_refr           ,
129
  dec2_pre            ,
130
  dec2_act            ,
131
  dec2_read           ,
132
  dec2_write          ,
133
  dec2_pre_all_enable ,
134
  dec2_refr_enable    ,
135
  dec2_pre_enable     ,
136
  dec2_act_enable     ,
137
  dec2_read_enable    ,
138
  dec2_write_enable   ,
139
  dec2_locked         ,
140
  dec2_last           ,
141
  dec2_rowa           ,
142
  dec2_cola           ,
143
  dec2_ba             ,
144
  dec2_chid           ,
145
  dec2_burst
146
  );
147
 
148
  input  wire   clk  ;
149
  input  wire   reset;
150
  input  wire   sclr ;
151
 
152
  //-------------------------------------------------------------------------------------------------- 
153
  // bank map interface 
154
  //-------------------------------------------------------------------------------------------------- 
155
 
156
  output wire   ba_map_update    ;
157
  output wire   ba_map_clear     ;
158
  output ba_t   ba_map_ba        ;
159
  output rowa_t ba_map_rowa      ;
160
  input  wire   ba_map_pre_act_rw;
161
  input  wire   ba_map_act_rw    ;
162
  input  wire   ba_map_rw        ;
163
  input  wire   ba_map_all_close ;
164
 
165
  //-------------------------------------------------------------------------------------------------- 
166
  // interface from input arbiter 
167
  //-------------------------------------------------------------------------------------------------- 
168
 
169
  input   logic   arb0_write ;
170
  input   logic   arb0_read  ;
171
  input   logic   arb0_refr  ;
172
  input   rowa_t  arb0_rowa  ;
173
  input   cola_t  arb0_cola  ;
174
  input   ba_t    arb0_ba    ;
175
  input   burst_t arb0_burst ;
176
  input   chid_t  arb0_chid  ;
177
  output  wire    arb0_ready ;
178
  //
179
  input   logic   arb1_write ;
180
  input   logic   arb1_read  ;
181
  input   logic   arb1_refr  ;
182
  input   rowa_t  arb1_rowa  ;
183
  input   cola_t  arb1_cola  ;
184
  input   ba_t    arb1_ba    ;
185
  input   burst_t arb1_burst ;
186
  input   chid_t  arb1_chid  ;
187
  output  wire    arb1_ready ;
188
  //
189
  input   logic   arb2_write ;
190
  input   logic   arb2_read  ;
191
  input   logic   arb2_refr  ;
192
  input   rowa_t  arb2_rowa  ;
193
  input   cola_t  arb2_cola  ;
194
  input   ba_t    arb2_ba    ;
195
  input   burst_t arb2_burst ;
196
  input   chid_t  arb2_chid  ;
197
  output  wire    arb2_ready ;
198
 
199
  //-------------------------------------------------------------------------------------------------- 
200
  // inteface to output arbiter 
201
  //-------------------------------------------------------------------------------------------------- 
202
 
203
  output logic         dec0_pre_all       ;
204
  output logic         dec0_refr          ;
205
  output logic         dec0_pre           ;
206
  output logic         dec0_act           ;
207
  output logic         dec0_read          ;
208
  output logic         dec0_write         ;
209
  input  wire          dec0_pre_all_enable;
210
  input  wire          dec0_refr_enable   ;
211
  input  wire          dec0_pre_enable    ;
212
  input  wire          dec0_act_enable    ;
213
  input  wire          dec0_read_enable   ;
214
  input  wire          dec0_write_enable  ;
215
  output logic         dec0_locked        ;
216
  output logic         dec0_last          ;
217
  output rowa_t        dec0_rowa          ;
218
  output cola_t        dec0_cola          ;
219
  output ba_t          dec0_ba            ;
220
  output chid_t        dec0_chid          ;
221
  output sdram_burst_t dec0_burst         ;
222
  //
223
  output logic         dec1_pre_all       ;
224
  output logic         dec1_refr          ;
225
  output logic         dec1_pre           ;
226
  output logic         dec1_act           ;
227
  output logic         dec1_read          ;
228
  output logic         dec1_write         ;
229
  input  wire          dec1_pre_all_enable;
230
  input  wire          dec1_refr_enable   ;
231
  input  wire          dec1_pre_enable    ;
232
  input  wire          dec1_act_enable    ;
233
  input  wire          dec1_read_enable   ;
234
  input  wire          dec1_write_enable  ;
235
  output logic         dec1_locked        ;
236
  output logic         dec1_last          ;
237
  output rowa_t        dec1_rowa          ;
238
  output cola_t        dec1_cola          ;
239
  output ba_t          dec1_ba            ;
240
  output chid_t        dec1_chid          ;
241
  output sdram_burst_t dec1_burst         ;
242
  //
243
  output logic         dec2_pre_all       ;
244
  output logic         dec2_refr          ;
245
  output logic         dec2_pre           ;
246
  output logic         dec2_act           ;
247
  output logic         dec2_read          ;
248
  output logic         dec2_write         ;
249
  input  wire          dec2_pre_all_enable;
250
  input  wire          dec2_refr_enable   ;
251
  input  wire          dec2_pre_enable    ;
252
  input  wire          dec2_act_enable    ;
253
  input  wire          dec2_read_enable   ;
254
  input  wire          dec2_write_enable  ;
255
  output logic         dec2_locked        ;
256
  output logic         dec2_last          ;
257
  output rowa_t        dec2_rowa          ;
258
  output cola_t        dec2_cola          ;
259
  output ba_t          dec2_ba            ;
260
  output chid_t        dec2_chid          ;
261
  output sdram_burst_t dec2_burst         ;
262
 
263
  //-------------------------------------------------------------------------------------------------- 
264
  //
265
  //-------------------------------------------------------------------------------------------------- 
266
 
267
  ba_t    ba_latched  ;
268
  rowa_t  rowa_latched;
269
 
270
  //
271
  // local state ba_map signals 
272
  // 
273
 
274
  wire state0__ba_map_update      ;
275
  wire state0__ba_map_clear       ;
276
  wire state0__ba_map_pre_act_rw  ;
277
  wire state0__ba_map_act_rw      ;
278
  wire state0__ba_map_rw          ;
279
  wire state0__ba_map_all_close   ;
280
 
281
  wire state1__ba_map_update      ;
282
  wire state1__ba_map_clear       ;
283
  wire state1__ba_map_pre_act_rw  ;
284
  wire state1__ba_map_act_rw      ;
285
  wire state1__ba_map_rw          ;
286
  wire state1__ba_map_all_close   ;
287
 
288
  wire state2__ba_map_update      ;
289
  wire state2__ba_map_clear       ;
290
  wire state2__ba_map_pre_act_rw  ;
291
  wire state2__ba_map_act_rw      ;
292
  wire state2__ba_map_rw          ;
293
  wire state2__ba_map_all_close   ;
294
 
295
  //-------------------------------------------------------------------------------------------------- 
296
  // we can capture bank map data into register, becouse we have +1 tick in FSM 
297
  // for bank map decoding we can take data from any arbiter channel 
298
  //-------------------------------------------------------------------------------------------------- 
299
 
300
  always_ff @(posedge clk) begin : ba_map_data_register
301
    ba_latched    <= arb0_ba;
302
    rowa_latched  <= arb0_rowa;
303
  end
304
 
305
  //
306
  //
307
  //
308
 
309
  assign ba_map_ba     = ba_latched;
310
  assign ba_map_rowa   = rowa_latched;
311
  assign ba_map_update = state0__ba_map_update | state1__ba_map_update | state2__ba_map_update ;
312
  assign ba_map_clear  = state0__ba_map_clear  | state1__ba_map_clear  | state2__ba_map_clear  ;
313
 
314
  assign state0__ba_map_pre_act_rw  = ba_map_pre_act_rw  ;
315
  assign state0__ba_map_act_rw      = ba_map_act_rw      ;
316
  assign state0__ba_map_rw          = ba_map_rw          ;
317
  assign state0__ba_map_all_close   = ba_map_all_close   ;
318
 
319
  assign state1__ba_map_pre_act_rw  = ba_map_pre_act_rw  ;
320
  assign state1__ba_map_act_rw      = ba_map_act_rw      ;
321
  assign state1__ba_map_rw          = ba_map_rw          ;
322
  assign state1__ba_map_all_close   = ba_map_all_close   ;
323
 
324
  assign state2__ba_map_pre_act_rw  = ba_map_pre_act_rw  ;
325
  assign state2__ba_map_act_rw      = ba_map_act_rw      ;
326
  assign state2__ba_map_rw          = ba_map_rw          ;
327
  assign state2__ba_map_all_close   = ba_map_all_close   ;
328
 
329
  //-------------------------------------------------------------------------------------------------- 
330
  //
331
  //-------------------------------------------------------------------------------------------------- 
332
  hssdrc_decoder_state state0 (
333
    .clk               (clk  ),
334
    .reset             (reset),
335
    .sclr              (sclr ),
336
    //
337
    .ba_map_update     (state0__ba_map_update    ),
338
    .ba_map_clear      (state0__ba_map_clear     ),
339
    .ba_map_pre_act_rw (state0__ba_map_pre_act_rw),
340
    .ba_map_act_rw     (state0__ba_map_act_rw    ),
341
    .ba_map_rw         (state0__ba_map_rw        ),
342
    .ba_map_all_close  (state0__ba_map_all_close ),
343
    //                 
344
    .arb_write         (arb0_write),
345
    .arb_read          (arb0_read ),
346
    .arb_refr          (arb0_refr ),
347
    .arb_rowa          (arb0_rowa ),
348
    .arb_cola          (arb0_cola ),
349
    .arb_ba            (arb0_ba   ),
350
    .arb_burst         (arb0_burst),
351
    .arb_chid          (arb0_chid ),
352
    .arb_ready         (arb0_ready),
353
    //                 
354
    .dec_pre_all       (dec0_pre_all),
355
    .dec_refr          (dec0_refr   ),
356
    .dec_pre           (dec0_pre    ),
357
    .dec_act           (dec0_act    ),
358
    .dec_read          (dec0_read   ),
359
    .dec_write         (dec0_write  ),
360
    //                 
361
    .dec_pre_all_enable(dec0_pre_all_enable),
362
    .dec_refr_enable   (dec0_refr_enable   ),
363
    .dec_pre_enable    (dec0_pre_enable    ),
364
    .dec_act_enable    (dec0_act_enable    ),
365
    .dec_read_enable   (dec0_read_enable   ),
366
    .dec_write_enable  (dec0_write_enable  ),
367
    //                 
368
    .dec_locked        (dec0_locked),
369
    .dec_last          (dec0_last  ),
370
    //                 
371
    .dec_rowa          (dec0_rowa ),
372
    .dec_cola          (dec0_cola ),
373
    .dec_ba            (dec0_ba   ),
374
    .dec_chid          (dec0_chid ),
375
    //                 
376
    .dec_burst         (dec0_burst)
377
  );
378
  //-------------------------------------------------------------------------------------------------- 
379
  //
380
  //-------------------------------------------------------------------------------------------------- 
381
  hssdrc_decoder_state state1 (
382
    .clk               (clk  ),
383
    .reset             (reset),
384
    .sclr              (sclr ),
385
    //
386
    .ba_map_update     (state1__ba_map_update    ),
387
    .ba_map_clear      (state1__ba_map_clear     ),
388
    .ba_map_pre_act_rw (state1__ba_map_pre_act_rw),
389
    .ba_map_act_rw     (state1__ba_map_act_rw    ),
390
    .ba_map_rw         (state1__ba_map_rw        ),
391
    .ba_map_all_close  (state1__ba_map_all_close ),
392
    //                 
393
    .arb_write         (arb1_write),
394
    .arb_read          (arb1_read ),
395
    .arb_refr          (arb1_refr ),
396
    .arb_rowa          (arb1_rowa ),
397
    .arb_cola          (arb1_cola ),
398
    .arb_ba            (arb1_ba   ),
399
    .arb_burst         (arb1_burst),
400
    .arb_chid          (arb1_chid ),
401
    .arb_ready         (arb1_ready),
402
    //                 
403
    .dec_pre_all       (dec1_pre_all),
404
    .dec_refr          (dec1_refr   ),
405
    .dec_pre           (dec1_pre    ),
406
    .dec_act           (dec1_act    ),
407
    .dec_read          (dec1_read   ),
408
    .dec_write         (dec1_write  ),
409
    //                 
410
    .dec_pre_all_enable(dec1_pre_all_enable),
411
    .dec_refr_enable   (dec1_refr_enable   ),
412
    .dec_pre_enable    (dec1_pre_enable    ),
413
    .dec_act_enable    (dec1_act_enable    ),
414
    .dec_read_enable   (dec1_read_enable   ),
415
    .dec_write_enable  (dec1_write_enable  ),
416
    //                 
417
    .dec_locked        (dec1_locked),
418
    .dec_last          (dec1_last  ),
419
    //                 
420
    .dec_rowa          (dec1_rowa ),
421
    .dec_cola          (dec1_cola ),
422
    .dec_ba            (dec1_ba   ),
423
    .dec_chid          (dec1_chid ),
424
    //                 
425
    .dec_burst         (dec1_burst)
426
  );
427
  //-------------------------------------------------------------------------------------------------- 
428
  //
429
  //-------------------------------------------------------------------------------------------------- 
430
  hssdrc_decoder_state state2 (
431
    .clk               (clk  ),
432
    .reset             (reset),
433
    .sclr              (sclr ),
434
    //
435
    .ba_map_update     (state2__ba_map_update    ),
436
    .ba_map_clear      (state2__ba_map_clear     ),
437
    .ba_map_pre_act_rw (state2__ba_map_pre_act_rw),
438
    .ba_map_act_rw     (state2__ba_map_act_rw    ),
439
    .ba_map_rw         (state2__ba_map_rw        ),
440
    .ba_map_all_close  (state2__ba_map_all_close ),
441
    //                 
442
    .arb_write         (arb2_write),
443
    .arb_read          (arb2_read ),
444
    .arb_refr          (arb2_refr ),
445
    .arb_rowa          (arb2_rowa ),
446
    .arb_cola          (arb2_cola ),
447
    .arb_ba            (arb2_ba   ),
448
    .arb_burst         (arb2_burst),
449
    .arb_chid          (arb2_chid ),
450
    .arb_ready         (arb2_ready),
451
    //                 
452
    .dec_pre_all       (dec2_pre_all),
453
    .dec_refr          (dec2_refr   ),
454
    .dec_pre           (dec2_pre    ),
455
    .dec_act           (dec2_act    ),
456
    .dec_read          (dec2_read   ),
457
    .dec_write         (dec2_write  ),
458
    //                 
459
    .dec_pre_all_enable(dec2_pre_all_enable),
460
    .dec_refr_enable   (dec2_refr_enable   ),
461
    .dec_pre_enable    (dec2_pre_enable    ),
462
    .dec_act_enable    (dec2_act_enable    ),
463
    .dec_read_enable   (dec2_read_enable   ),
464
    .dec_write_enable  (dec2_write_enable  ),
465
    //                 
466
    .dec_locked        (dec2_locked),
467
    .dec_last          (dec2_last  ),
468
    //                 
469
    .dec_rowa          (dec2_rowa ),
470
    .dec_cola          (dec2_cola ),
471
    .dec_ba            (dec2_ba   ),
472
    .dec_chid          (dec2_chid ),
473
    //                 
474
    .dec_burst         (dec2_burst)
475
  );
476
 
477
endmodule

powered by: WebSVN 2.1.0

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