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:51:55 $
|
11 |
|
|
//
|
12 |
|
|
// Workfile : hssdrc_timing.vh
|
13 |
|
|
//
|
14 |
|
|
// Description : controller sdram timing paramters
|
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 |
|
|
`ifndef __HSSDRC_TIMING_VH__
|
40 |
|
|
|
41 |
|
|
`define __HSSDRC_TIMING_VH__
|
42 |
|
|
|
43 |
|
|
//`define HSSDRC_SIMULATE_TIMING // uncomment for easy debug arefr sequence
|
44 |
|
|
|
45 |
|
|
//-------------------------------------------------
|
46 |
|
|
// sdram controller clock settings in MHz
|
47 |
|
|
//-------------------------------------------------
|
48 |
|
|
parameter real pClkMHz = 133.0;
|
49 |
|
|
//-------------------------------------------------
|
50 |
|
|
// sdram chip timing paramters in "ns" for -6 CL3
|
51 |
|
|
//-------------------------------------------------
|
52 |
|
|
parameter real pTras_time = 42.0; // act a -> prech a
|
53 |
|
|
parameter real pTrfc_time = 60.0; // refr -> !nop
|
54 |
|
|
parameter real pTrc_time = 60.0; // act a -> act a (Tras + Trcd)
|
55 |
|
|
parameter real pTrcd_time = 18.0; // act a -> write/read a
|
56 |
|
|
parameter real pTrp_time = 18.0; // prech a -> !nop
|
57 |
|
|
parameter real pTrrd_time = 12.0; // act a -> act b
|
58 |
|
|
parameter real pTwr_time = 12.0; // write a -> prech a
|
59 |
|
|
|
60 |
|
|
`ifndef HSSDRC_SIMULATE_TIMING
|
61 |
|
|
parameter real pRefr_time = 15625.0; // refr -> refr
|
62 |
|
|
parameter real pInit_time = 100000.0; // power up -> refr
|
63 |
|
|
`else
|
64 |
|
|
parameter real pRefr_time = 500.0; // simulate only refr -> refr
|
65 |
|
|
parameter real pInit_time = 500.0; // simulate only power up -> refr
|
66 |
|
|
`endif
|
67 |
|
|
//-------------------------------------------------
|
68 |
|
|
// sdram chip normalaize to clock parameters
|
69 |
|
|
//-------------------------------------------------
|
70 |
|
|
parameter int cTras = 0.5 + (pTras_time * pClkMHz)/1000.0; // act a -> prech a
|
71 |
|
|
parameter int cTrfc = 0.5 + (pTrfc_time * pClkMHz)/1000.0; // refr -> !nop
|
72 |
|
|
parameter int cTrc = 0.5 + ( pTrc_time * pClkMHz)/1000.0; // act a -> act a
|
73 |
|
|
parameter int cTrcd = 0.5 + (pTrcd_time * pClkMHz)/1000.0; // act a -> write/read a
|
74 |
|
|
parameter int cTrp = 0.5 + ( pTrp_time * pClkMHz)/1000.0; // prech a -> !nop
|
75 |
|
|
parameter int cTrrd = 0.5 + (pTrrd_time * pClkMHz)/1000.0; // act a -> act b
|
76 |
|
|
parameter int cTwr = 0.5 + ( pTwr_time * pClkMHz)/1000.0; // write a -> prech a
|
77 |
|
|
parameter int cTmrd = 2; // lmr -> !nop (not used)
|
78 |
|
|
parameter int cInitTime = 0.5 + (pInit_time * pClkMHz)/1000.0;
|
79 |
|
|
//-------------------------------------------------
|
80 |
|
|
// refresh parameters
|
81 |
|
|
//-------------------------------------------------
|
82 |
|
|
parameter real pRefrWindowLowPriority = 0.85;
|
83 |
|
|
parameter real pRefrWindowHighPriority = 0.95;
|
84 |
|
|
parameter int cRefCounterMaxTime = 0.5 + (pRefr_time * pClkMHz)/1000.0;
|
85 |
|
|
parameter int cRefrWindowLowPriorityTime = 0.5 + (pRefrWindowLowPriority * pRefr_time * pClkMHz)/1000.0;
|
86 |
|
|
parameter int cRefrWindowHighPriorityTime = 0.5 + (pRefrWindowHighPriority * pRefr_time * pClkMHz)/1000.0;
|
87 |
|
|
//-------------------------------------------------
|
88 |
|
|
// sdram controller use 0/1 cycle bus turnaround
|
89 |
|
|
//-------------------------------------------------
|
90 |
|
|
parameter int pBTA = 1; // set 0 if not need
|
91 |
|
|
|
92 |
|
|
//
|
93 |
|
|
`endif
|