1 |
90 |
jeremybenn |
/* mc_dram.h - Memory Controller testbench SDRAM defines
|
2 |
|
|
|
3 |
|
|
Copyright (C) 2001 Ivan Guzvinec
|
4 |
|
|
Copyright (C) 2010 Embecosm Limited
|
5 |
|
|
|
6 |
|
|
Contributor Ivan Guzvinec <ivang@opencores.org>
|
7 |
|
|
Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
|
8 |
|
|
|
9 |
|
|
This file is part of OpenRISC 1000 Architectural Simulator.
|
10 |
|
|
|
11 |
|
|
This program is free software; you can redistribute it and/or modify it
|
12 |
|
|
under the terms of the GNU General Public License as published by the Free
|
13 |
|
|
Software Foundation; either version 3 of the License, or (at your option)
|
14 |
|
|
any later version.
|
15 |
|
|
|
16 |
|
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
17 |
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
18 |
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
19 |
|
|
more details.
|
20 |
|
|
|
21 |
|
|
You should have received a copy of the GNU General Public License along
|
22 |
|
|
with this program. If not, see <http: www.gnu.org/licenses/>. */
|
23 |
|
|
|
24 |
|
|
/* ----------------------------------------------------------------------------
|
25 |
|
|
This code is commented throughout for use with Doxygen.
|
26 |
|
|
--------------------------------------------------------------------------*/
|
27 |
|
|
|
28 |
|
|
#ifndef __MC_DRAM_H
|
29 |
|
|
#define __MC_DRAM_H
|
30 |
|
|
|
31 |
|
|
/* should configuration be read from MC? */
|
32 |
|
|
#define MC_READ_CONF
|
33 |
|
|
|
34 |
|
|
/* TEMPLATE SELECTION */
|
35 |
|
|
/* change #undef to #define */
|
36 |
|
|
#undef _MC_TEST_TEMPLATE1
|
37 |
|
|
#define _MC_TEST_TEMPLATE2
|
38 |
|
|
#undef _MC_TEST_TEMPLATE3
|
39 |
|
|
/* ------------------------ */
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
/* memory configuration that must reflect sim.cfg */
|
43 |
|
|
#define MC_SDRAM_CSMASK 0x02 /* 8 bit mask for 8 chip selects. 1 SDRAM at CS, 0 something else at CS */
|
44 |
|
|
/* bits: CS7|CS6|CS5|CS4|CS3|CS2|CS1|CS0 */
|
45 |
|
|
typedef struct MC_SDRAM_CS
|
46 |
|
|
{
|
47 |
|
|
unsigned long BW;
|
48 |
|
|
unsigned long MS;
|
49 |
|
|
unsigned long M;
|
50 |
|
|
} MC_SDRAM_CS;
|
51 |
|
|
|
52 |
|
|
MC_SDRAM_CS mc_sdram_cs[8] = {
|
53 |
|
|
{ 2, /* Bus Width : 0 - 8bit, 1 - 16bit, 2 - 32bit */
|
54 |
|
|
2, /* Memory Size : 0 - 64Mbit, 1 - 128Mbit, 2 - 256Mbit */
|
55 |
|
|
0x20 /* SELect mask */
|
56 |
|
|
},
|
57 |
|
|
{ 1, 0, 0x20 },
|
58 |
|
|
{ 2, 0, 0x06 },
|
59 |
|
|
{ 2, 0, 0x08 },
|
60 |
|
|
{ 2, 0, 0x0A },
|
61 |
|
|
{ 2, 0, 0x0C },
|
62 |
|
|
{ 2, 0, 0x0E },
|
63 |
|
|
{ 2, 0, 0x10 } };
|
64 |
|
|
|
65 |
|
|
/* SDRAM configuration tests flag defines */
|
66 |
|
|
#define MC_SDRAM_TEST0 0x00000001LU /*no parity, close row, BankAfterCol, R/W, single loc, seq. burst 1 */
|
67 |
|
|
#define MC_SDRAM_TEST1 0x00000002LU /*parity enabled*/
|
68 |
|
|
#define MC_SDRAM_TEST2 0x00000004LU /*keep row*/
|
69 |
|
|
#define MC_SDRAM_TEST3 0x00000008LU /*BankAfterRow*/
|
70 |
|
|
#define MC_SDRAM_TEST4 0x00000010LU /*RO*/
|
71 |
|
|
#define MC_SDRAM_TEST5 0x00000020LU /*prog. burst 1*/
|
72 |
|
|
#define MC_SDRAM_TEST6 0x00000040LU /* -||- 2*/
|
73 |
|
|
#define MC_SDRAM_TEST7 0x00000080LU /* -||- 4*/
|
74 |
|
|
#define MC_SDRAM_TEST8 0x00000100LU /* -||- 8*/
|
75 |
|
|
#define MC_SDRAM_TEST9 0x00000200LU /* -||- fullpage*/
|
76 |
|
|
#define MC_SDRAM_TEST10 0x00000400LU /*prog. burst int. 1*/
|
77 |
|
|
#define MC_SDRAM_TEST11 0x00000800LU /* -||- 2*/
|
78 |
|
|
#define MC_SDRAM_TEST12 0x00001000LU /* -||- 4*/
|
79 |
|
|
#define MC_SDRAM_TEST13 0x00002000LU /* -||- 8*/
|
80 |
|
|
#define MC_SDRAM_TEST14 0x00004000LU /* -||- fullpage*/
|
81 |
|
|
#define MC_SDRAM_TEST15 0x00008000LU /*prog. burst int. fullpage, keep row*/
|
82 |
|
|
#define MC_SDRAM_TEST16 0x00010000LU /* NOT DEFINED */
|
83 |
|
|
|
84 |
|
|
/* test type flag defines */
|
85 |
|
|
#define MC_SDRAM_SROW 0x00000001LU /* perform sequential row access test */
|
86 |
|
|
#define MC_SDRAM_RROW 0x00000010LU /* perform random row access test */
|
87 |
|
|
#define MC_SDRAM_SGRP 0x00000100LU /* perform sequential row-group access test */
|
88 |
|
|
#define MC_SDRAM_RGRP 0x00001000LU /* perform random row-group access test */
|
89 |
|
|
|
90 |
|
|
#define MC_SDRAM_ROWSH_0 16
|
91 |
|
|
#define MC_SDRAM_ROWSH_1 16
|
92 |
|
|
#define MC_SDRAM_ROWSH_2 15
|
93 |
|
|
#define MC_SDRAM_ROWSH_3 16
|
94 |
|
|
#define MC_SDRAM_ROWSH_4 16
|
95 |
|
|
#define MC_SDRAM_ROWSH_5 16
|
96 |
|
|
#define MC_SDRAM_ROWSH_6 17
|
97 |
|
|
#define MC_SDRAM_ROWSH_7 17
|
98 |
|
|
#define MC_SDRAM_ROWSH_8 17
|
99 |
|
|
|
100 |
|
|
|
101 |
|
|
/* TEMPLATE 1 */
|
102 |
|
|
#ifdef _MC_TEST_TEMPLATE1
|
103 |
|
|
#define MC_SDRAM_FLAGS 0x000004A8LU /* MC_TEST_ flags... see mc_common.h */
|
104 |
|
|
#define MC_SDRAM_TESTS 0x00000001LU /* mask for SDRAM configuration, see conf. test flag defines */
|
105 |
|
|
#define MC_SDRAM_ACC 0x00001010LU /* mask for test types */
|
106 |
|
|
|
107 |
|
|
/* memory sizes*/
|
108 |
|
|
#define MC_SDRAM_GROUPSIZE 5
|
109 |
|
|
/* MAX */
|
110 |
|
|
#define MC_SDRAM_ROWSIZE_0 8/* 16 * 1024 * 4 */
|
111 |
|
|
#define MC_SDRAM_ROWSIZE_1 8/* 16 * 1024 * 4 */
|
112 |
|
|
#define MC_SDRAM_ROWSIZE_2 8/* 8 * 1024 * 4 */
|
113 |
|
|
#define MC_SDRAM_ROWSIZE_3 8/* 16 * 1024 * 4 */
|
114 |
|
|
#define MC_SDRAM_ROWSIZE_4 8/* 16 * 1024 * 4 */
|
115 |
|
|
#define MC_SDRAM_ROWSIZE_5 8/* 16 * 1024 * 4 */
|
116 |
|
|
#define MC_SDRAM_ROWSIZE_6 8/* 32 * 1024 * 4 */
|
117 |
|
|
#define MC_SDRAM_ROWSIZE_7 8/* 32 * 1024 * 4 */
|
118 |
|
|
#define MC_SDRAM_ROWSIZE_8 8/* 32 * 1024 * 4 */
|
119 |
|
|
/* MAX */
|
120 |
|
|
#define MC_SDRAM_ROWS_0 25/* 512 */
|
121 |
|
|
#define MC_SDRAM_ROWS_1 25/* 256 */
|
122 |
|
|
#define MC_SDRAM_ROWS_2 25/* 256 */
|
123 |
|
|
#define MC_SDRAM_ROWS_3 25/* 1024 */
|
124 |
|
|
#define MC_SDRAM_ROWS_4 25/* 512 */
|
125 |
|
|
#define MC_SDRAM_ROWS_5 25/* 256 */
|
126 |
|
|
#define MC_SDRAM_ROWS_6 25/* 1024 */
|
127 |
|
|
#define MC_SDRAM_ROWS_7 25/* 512 */
|
128 |
|
|
#define MC_SDRAM_ROWS_8 25/* 256 */
|
129 |
|
|
|
130 |
|
|
#define MC_SDRAM_ROW_OFF 5
|
131 |
|
|
#endif /*_MC_TEST_TEMPLATE1*/
|
132 |
|
|
|
133 |
|
|
/* TEMPLATE 2 */
|
134 |
|
|
#ifdef _MC_TEST_TEMPLATE2
|
135 |
|
|
#define MC_SDRAM_FLAGS 0x000004A8LU /* MC_TEST_ flags... see mc_common.h */
|
136 |
|
|
#define MC_SDRAM_TESTS 0x00000001LU /* mask for SDRAM configuration, see conf. test flag defines */
|
137 |
|
|
#define MC_SDRAM_ACC 0x00001010LU /* mask for test types */
|
138 |
|
|
|
139 |
|
|
/* memory sizes*/
|
140 |
|
|
#define MC_SDRAM_GROUPSIZE 5
|
141 |
|
|
|
142 |
|
|
#define MC_SDRAM_ROWSIZE_0 16 * 1024 * 4
|
143 |
|
|
#define MC_SDRAM_ROWSIZE_1 16 * 1024 * 4
|
144 |
|
|
#define MC_SDRAM_ROWSIZE_2 8 * 1024 * 4
|
145 |
|
|
#define MC_SDRAM_ROWSIZE_3 16 * 1024 * 4
|
146 |
|
|
#define MC_SDRAM_ROWSIZE_4 16 * 1024 * 4
|
147 |
|
|
#define MC_SDRAM_ROWSIZE_5 16 * 1024 * 4
|
148 |
|
|
#define MC_SDRAM_ROWSIZE_6 32 * 1024 * 4
|
149 |
|
|
#define MC_SDRAM_ROWSIZE_7 32 * 1024 * 4
|
150 |
|
|
#define MC_SDRAM_ROWSIZE_8 32 * 1024 * 4
|
151 |
|
|
|
152 |
|
|
#define MC_SDRAM_ROWS_0 512
|
153 |
|
|
#define MC_SDRAM_ROWS_1 256
|
154 |
|
|
#define MC_SDRAM_ROWS_2 256
|
155 |
|
|
#define MC_SDRAM_ROWS_3 1024
|
156 |
|
|
#define MC_SDRAM_ROWS_4 512
|
157 |
|
|
#define MC_SDRAM_ROWS_5 256
|
158 |
|
|
#define MC_SDRAM_ROWS_6 1024
|
159 |
|
|
#define MC_SDRAM_ROWS_7 512
|
160 |
|
|
#define MC_SDRAM_ROWS_8 256
|
161 |
|
|
|
162 |
|
|
#endif /*_MC_TEST_TEMPLATE2*/
|
163 |
|
|
|
164 |
|
|
/* TEMPLATE 3 */
|
165 |
|
|
#ifdef _MC_TEST_TEMPLATE3
|
166 |
|
|
#define MC_SDRAM_FLAGS 0x000004A8LU /* MC_TEST_ flags... see mc_common.h */
|
167 |
|
|
#define MC_SDRAM_TESTS 0x00000001LU /* mask for SDRAM configuration, see conf. test flag defines */
|
168 |
|
|
#define MC_SDRAM_ACC 0x00001010LU /* mask for test types */
|
169 |
|
|
|
170 |
|
|
/* memory sizes*/
|
171 |
|
|
#define MC_SDRAM_GROUPSIZE 5
|
172 |
|
|
/* MAX */
|
173 |
|
|
#define MC_SDRAM_ROWSIZE_0 16 * 1024 * 4
|
174 |
|
|
#define MC_SDRAM_ROWSIZE_1 16 * 1024 * 4
|
175 |
|
|
#define MC_SDRAM_ROWSIZE_2 8 * 1024 * 4
|
176 |
|
|
#define MC_SDRAM_ROWSIZE_3 16 * 1024 * 4
|
177 |
|
|
#define MC_SDRAM_ROWSIZE_4 16 * 1024 * 4
|
178 |
|
|
#define MC_SDRAM_ROWSIZE_5 16 * 1024 * 4
|
179 |
|
|
#define MC_SDRAM_ROWSIZE_6 32 * 1024 * 4
|
180 |
|
|
#define MC_SDRAM_ROWSIZE_7 32 * 1024 * 4
|
181 |
|
|
#define MC_SDRAM_ROWSIZE_8 32 * 1024 * 4
|
182 |
|
|
/* MAX */
|
183 |
|
|
#define MC_SDRAM_ROWS_0 10/* 512 */
|
184 |
|
|
#define MC_SDRAM_ROWS_1 10/* 256 */
|
185 |
|
|
#define MC_SDRAM_ROWS_2 10/* 256 */
|
186 |
|
|
#define MC_SDRAM_ROWS_3 10/* 1024 */
|
187 |
|
|
#define MC_SDRAM_ROWS_4 10/* 512 */
|
188 |
|
|
#define MC_SDRAM_ROWS_5 10/* 256 */
|
189 |
|
|
#define MC_SDRAM_ROWS_6 10/* 1024 */
|
190 |
|
|
#define MC_SDRAM_ROWS_7 10/* 512 */
|
191 |
|
|
#define MC_SDRAM_ROWS_8 10/* 256 */
|
192 |
|
|
|
193 |
|
|
#endif /*_MC_TEST_TEMPLATE3*/
|
194 |
|
|
|
195 |
|
|
#endif
|