1 |
424 |
markom |
/* config.c -- Simulator configuration
|
2 |
|
|
Copyright (C) 1999 Damjan Lampret, lampret@opencores.org
|
3 |
|
|
|
4 |
|
|
This file is part of OpenRISC 1000 Architectural Simulator.
|
5 |
|
|
|
6 |
|
|
This program is free software; you can redistribute it and/or modify
|
7 |
|
|
it under the terms of the GNU General Public License as published by
|
8 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
9 |
|
|
(at your option) any later version.
|
10 |
|
|
|
11 |
|
|
This program is distributed in the hope that it will be useful,
|
12 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
|
|
GNU General Public License for more details.
|
15 |
|
|
|
16 |
|
|
You should have received a copy of the GNU General Public License
|
17 |
|
|
along with this program; if not, write to the Free Software
|
18 |
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
19 |
|
|
|
20 |
|
|
/* Simulator configuration. Eventually this one will be a lot bigger. */
|
21 |
|
|
|
22 |
|
|
#include <stdlib.h>
|
23 |
|
|
#include "sim-config.h"
|
24 |
|
|
#include "abstract.h"
|
25 |
518 |
markom |
#include "sprs.h"
|
26 |
424 |
markom |
#include "spr_defs.h"
|
27 |
|
|
#include "pic.h"
|
28 |
535 |
markom |
#include "stats.h"
|
29 |
428 |
markom |
#include "icache_model.h"
|
30 |
|
|
#include "dcache_model.h"
|
31 |
424 |
markom |
|
32 |
427 |
markom |
#define WARNING(s) fprintf (stderr, "WARNING: config.%s: %s\n", sections[section].name, (s))
|
33 |
428 |
markom |
#define ERROR(s) {fprintf (stderr, "ERROR: config.%s:%s\n", sections[section].name, s); if (runtime.sim.init) exit (1);}
|
34 |
|
|
#define MERROR(s) {fprintf (stderr, "ERROR: %s\n", s); if (runtime.sim.init) exit (1);}
|
35 |
424 |
markom |
|
36 |
551 |
markom |
#if !FAST_SIM
|
37 |
424 |
markom |
struct config config;
|
38 |
551 |
markom |
#endif
|
39 |
424 |
markom |
struct runtime runtime;
|
40 |
|
|
|
41 |
|
|
int section = 0;
|
42 |
|
|
extern struct section {
|
43 |
|
|
char *name;
|
44 |
|
|
int flags;
|
45 |
|
|
} sections[];
|
46 |
|
|
|
47 |
|
|
void init_defconfig()
|
48 |
|
|
{
|
49 |
|
|
int i;
|
50 |
551 |
markom |
|
51 |
|
|
#if !FAST_SIM
|
52 |
424 |
markom |
memset(&config, 0, sizeof(config));
|
53 |
|
|
/* Sim */
|
54 |
|
|
config.sim.exe_log = 0;
|
55 |
624 |
ivang |
config.sim.spr_log = 0;
|
56 |
424 |
markom |
strcpy (config.sim.exe_log_fn, "executed.log");
|
57 |
624 |
ivang |
strcpy (config.sim.spr_log_fn, "spr.log");
|
58 |
|
|
|
59 |
424 |
markom |
config.sim.debug = 0;
|
60 |
|
|
config.sim.verbose = 1;
|
61 |
|
|
|
62 |
|
|
strcpy (config.sim.prof_fn, "sim.profile");
|
63 |
547 |
markom |
strcpy (config.sim.mprof_fn, "sim.mprofile");
|
64 |
549 |
markom |
strcpy (runtime.sim.script_fn, "(default)");
|
65 |
433 |
markom |
config.sim.clkcycle_ps = 4000; /* 4000 for 4ns (250MHz) */
|
66 |
424 |
markom |
|
67 |
|
|
/* Memory */
|
68 |
554 |
markom |
config.memory.type = MT_UNKNOWN;
|
69 |
424 |
markom |
config.memory.pattern = 0;
|
70 |
|
|
config.memory.random_seed = -1; /* Generate new seed */
|
71 |
551 |
markom |
for (i = 0; i < MAX_MEMORIES; i++)
|
72 |
424 |
markom |
config.memory.table[i].ce = -1; /* memory is disabled by default */
|
73 |
|
|
|
74 |
428 |
markom |
/* IMMU & DMMU*/
|
75 |
|
|
config.immu.enabled = 0;
|
76 |
541 |
markom |
config.immu.hitdelay = 0;
|
77 |
|
|
config.immu.missdelay = 0;
|
78 |
428 |
markom |
config.dmmu.enabled = 0;
|
79 |
541 |
markom |
config.dmmu.hitdelay = 0;
|
80 |
|
|
config.dmmu.missdelay = 0;
|
81 |
428 |
markom |
|
82 |
|
|
/* IC & DC */
|
83 |
|
|
config.ic.enabled = 0;
|
84 |
|
|
config.ic.tagtype = CT_PHYSICAL/*CT_VIRTUAL*/;
|
85 |
541 |
markom |
config.ic.hitdelay = 0;
|
86 |
|
|
config.ic.missdelay = 0;
|
87 |
428 |
markom |
config.dc.enabled = 0;
|
88 |
|
|
config.dc.tagtype = CT_PHYSICAL/*CT_VIRTUAL*/;
|
89 |
541 |
markom |
config.dc.load_hitdelay = 0;
|
90 |
|
|
config.dc.load_missdelay = 0;
|
91 |
|
|
config.dc.store_hitdelay = 0;
|
92 |
|
|
config.dc.store_missdelay = 0;
|
93 |
428 |
markom |
|
94 |
424 |
markom |
/* Memory Controller */
|
95 |
|
|
config.mc.enabled = 0;
|
96 |
|
|
|
97 |
|
|
/* Uarts */
|
98 |
|
|
config.nuarts = 0;
|
99 |
|
|
|
100 |
|
|
/* DMAs */
|
101 |
|
|
config.ndmas = 0;
|
102 |
|
|
|
103 |
|
|
/* CPU */
|
104 |
|
|
config.cpu.superscalar = 0;
|
105 |
|
|
config.sim.history = 0;
|
106 |
|
|
config.cpu.hazards = 0;
|
107 |
|
|
config.cpu.dependstats = 0;
|
108 |
626 |
markom |
config.cpu.raw_range = 0;
|
109 |
|
|
config.cpu.sbuf_len = 0;
|
110 |
424 |
markom |
config.cpu.upr = SPR_UPR_UP | SPR_UPR_DCP | SPR_UPR_ICP | SPR_UPR_DMP
|
111 |
|
|
| SPR_UPR_IMP | SPR_UPR_OB32P | SPR_UPR_DUP | SPR_UPR_PICP
|
112 |
|
|
| SPR_UPR_PMP | SPR_UPR_TTP;
|
113 |
556 |
markom |
config.cpu.sr = 0x00008003;
|
114 |
424 |
markom |
|
115 |
|
|
/* Debug */
|
116 |
|
|
config.debug.enabled = 0;
|
117 |
|
|
config.debug.gdb_enabled = 0;
|
118 |
|
|
config.debug.server_port = 0;
|
119 |
|
|
|
120 |
|
|
/* VAPI */
|
121 |
|
|
config.vapi.enabled = 0;
|
122 |
|
|
strcpy (config.vapi.vapi_fn, "vapi.log");
|
123 |
|
|
|
124 |
|
|
/* Ethernet */
|
125 |
549 |
markom |
config.nethernets = 0;
|
126 |
424 |
markom |
|
127 |
444 |
erez |
/* GPIO */
|
128 |
549 |
markom |
config.ngpios = 0;
|
129 |
|
|
|
130 |
424 |
markom |
/* Tick timer */
|
131 |
|
|
config.tick.enabled = 0;
|
132 |
557 |
markom |
|
133 |
|
|
/* PM */
|
134 |
|
|
config.pm.enabled = 0;
|
135 |
551 |
markom |
#endif
|
136 |
|
|
|
137 |
|
|
/* Configure runtime */
|
138 |
|
|
memset(&runtime, 0, sizeof(runtime));
|
139 |
|
|
|
140 |
|
|
/* Sim */
|
141 |
|
|
runtime.sim.fexe_log = NULL;
|
142 |
624 |
ivang |
runtime.sim.fspr_log = NULL;
|
143 |
551 |
markom |
runtime.sim.iprompt = 0;
|
144 |
|
|
runtime.sim.fprof = NULL;
|
145 |
|
|
runtime.sim.fmprof = NULL;
|
146 |
|
|
runtime.sim.init = 1;
|
147 |
|
|
runtime.sim.script_file_specified = 0;
|
148 |
|
|
|
149 |
|
|
/* VAPI */
|
150 |
|
|
runtime.vapi.vapi_file = NULL;
|
151 |
|
|
runtime.vapi.enabled = 0;
|
152 |
424 |
markom |
}
|
153 |
|
|
|
154 |
|
|
int parse_args(int argc, char *argv[])
|
155 |
|
|
{
|
156 |
|
|
unsigned long val;
|
157 |
|
|
|
158 |
|
|
argv++; argc--;
|
159 |
|
|
while (argc) {
|
160 |
|
|
if (argc && (*argv[0] != '-')) {
|
161 |
|
|
runtime.sim.filename = argv[0];
|
162 |
|
|
argc--;
|
163 |
|
|
argv++;
|
164 |
|
|
} else
|
165 |
551 |
markom |
#if !FAST_SIM /* Constant cfg */
|
166 |
424 |
markom |
if (strcmp(*argv, "-f") == 0 || strcmp(*argv, "--file") == 0) {
|
167 |
|
|
argv++; argc--;
|
168 |
481 |
markom |
if (argv[0]) {
|
169 |
|
|
read_script_file(argv[0]);
|
170 |
|
|
argv++; argc--;
|
171 |
|
|
} else {
|
172 |
|
|
fprintf(stderr, "Configure filename not specified!\n");
|
173 |
|
|
return 1;
|
174 |
|
|
}
|
175 |
424 |
markom |
} else
|
176 |
551 |
markom |
#endif
|
177 |
424 |
markom |
if (strcmp(*argv, "--nosrv") == 0) { /* (CZ) */
|
178 |
|
|
config.debug.gdb_enabled = 0;
|
179 |
|
|
argv++; argc--;
|
180 |
|
|
} else
|
181 |
|
|
if (strcmp(*argv, "--srv") == 0) { /* (CZ) */
|
182 |
|
|
char *s;
|
183 |
|
|
if(!--argc)
|
184 |
|
|
return 1;
|
185 |
|
|
config.debug.enabled = 1;
|
186 |
|
|
config.debug.gdb_enabled = 0;
|
187 |
|
|
config.debug.server_port = strtol(*(++argv),&s,10);
|
188 |
|
|
if(*s)
|
189 |
|
|
return 1;
|
190 |
|
|
argv++; argc--;
|
191 |
|
|
} else
|
192 |
|
|
if (strcmp(*argv, "-i") == 0) {
|
193 |
551 |
markom |
runtime.sim.iprompt = 1;
|
194 |
424 |
markom |
argv++; argc--;
|
195 |
|
|
} else
|
196 |
|
|
if (strcmp(*argv, "-v") == 0) {
|
197 |
|
|
version();
|
198 |
|
|
exit(0);
|
199 |
|
|
} else
|
200 |
551 |
markom |
#if !FAST_SIM
|
201 |
424 |
markom |
if (strcmp(*argv, "--profile") == 0) {
|
202 |
|
|
config.sim.profile = 1;
|
203 |
|
|
argv++; argc--;
|
204 |
547 |
markom |
} else
|
205 |
|
|
if (strcmp(*argv, "--mprofile") == 0) {
|
206 |
|
|
config.sim.mprofile = 1;
|
207 |
|
|
argv++; argc--;
|
208 |
549 |
markom |
} else
|
209 |
551 |
markom |
#endif
|
210 |
549 |
markom |
if (strcmp(*argv, "--output-cfg") == 0) {
|
211 |
|
|
runtime.sim.output_cfg = 1;
|
212 |
|
|
argv++; argc--;
|
213 |
424 |
markom |
} else {
|
214 |
481 |
markom |
fprintf(stderr, "Unknown option: %s\n", *argv);
|
215 |
424 |
markom |
return 1;
|
216 |
|
|
}
|
217 |
|
|
}
|
218 |
|
|
|
219 |
|
|
if (!argc)
|
220 |
|
|
return 0;
|
221 |
|
|
|
222 |
|
|
return 0;
|
223 |
|
|
}
|
224 |
|
|
|
225 |
551 |
markom |
#if !FAST_SIM
|
226 |
434 |
markom |
#define CNV(x) ((isspace(x) || (x) == 0) ? ' ' : (x))
|
227 |
424 |
markom |
|
228 |
|
|
/* Substitute for less powerful fscanf */
|
229 |
549 |
markom |
int fscanf_ex (FILE *f, char *fmt, void *buf, char *str)
|
230 |
|
|
{
|
231 |
424 |
markom |
char tmp[STR_SIZE];
|
232 |
|
|
char ch;
|
233 |
|
|
int i = 0;
|
234 |
|
|
while (*fmt) {
|
235 |
|
|
switch (*fmt) {
|
236 |
|
|
case '%':
|
237 |
|
|
while(*fmt != 0 && !isalpha (*fmt))
|
238 |
|
|
tmp[i++] = *(fmt++);
|
239 |
|
|
tmp[i++] = *(fmt++);
|
240 |
|
|
if (tmp[i - 1] == 's') {
|
241 |
|
|
char *cbuf = (char *)buf;
|
242 |
|
|
i = 0;
|
243 |
434 |
markom |
while (ch = (f ? fgetc (f) : *str++), isspace(ch))
|
244 |
424 |
markom |
if (f ? feof (f) : *str) return 1;
|
245 |
479 |
markom |
if (f)
|
246 |
424 |
markom |
ungetc (ch, f);
|
247 |
|
|
else
|
248 |
|
|
str--;
|
249 |
|
|
while ((*(cbuf++) = ch = (f ? fgetc (f) : *str++), CNV(ch) ) != *fmt) {
|
250 |
|
|
if ((f ? feof (f) : *str)) return 1;
|
251 |
|
|
if (++i >= STR_SIZE) {
|
252 |
|
|
fprintf (stderr, "ERROR: string too long.\n");
|
253 |
|
|
return 1;
|
254 |
|
|
}
|
255 |
|
|
}
|
256 |
|
|
*(--cbuf) = 0;
|
257 |
|
|
fmt++;
|
258 |
|
|
} else {
|
259 |
|
|
tmp[i++] = 0;
|
260 |
|
|
if (f)
|
261 |
|
|
fscanf (f, tmp, buf);
|
262 |
|
|
else
|
263 |
|
|
sscanf (str, tmp, buf);
|
264 |
|
|
}
|
265 |
|
|
break;
|
266 |
|
|
default:
|
267 |
|
|
while ((ch = (f ? fgetc (f) : *str++)) != *fmt) {
|
268 |
434 |
markom |
if (!isspace (ch)) {
|
269 |
424 |
markom |
char tmp[200];
|
270 |
|
|
sprintf (tmp, "unexpected char '%c' (expecting '%c')\n", ch, *fmt);
|
271 |
427 |
markom |
fprintf (stderr, "WARNING: config.%s: %s\n", sections[section], tmp);
|
272 |
424 |
markom |
WARNING(tmp);
|
273 |
|
|
}
|
274 |
|
|
if ((f ? feof (f) : *str)) return 1;
|
275 |
|
|
}
|
276 |
|
|
fmt++;
|
277 |
|
|
break;
|
278 |
|
|
}
|
279 |
|
|
}
|
280 |
|
|
return 0;
|
281 |
|
|
}
|
282 |
551 |
markom |
#endif /* !FAST_SIM */
|
283 |
424 |
markom |
|
284 |
|
|
void print_config()
|
285 |
|
|
{
|
286 |
|
|
if (config.sim.verbose) {
|
287 |
433 |
markom |
char temp[20];
|
288 |
424 |
markom |
printf("Verbose on, ");
|
289 |
|
|
if (config.sim.debug)
|
290 |
|
|
printf("simdebug on, ");
|
291 |
|
|
else
|
292 |
|
|
printf("simdebug off, ");
|
293 |
551 |
markom |
if (runtime.sim.iprompt)
|
294 |
424 |
markom |
printf("interactive prompt on\n");
|
295 |
|
|
else
|
296 |
|
|
printf("interactive prompt off\n");
|
297 |
|
|
|
298 |
|
|
printf("Machine initialization...\n");
|
299 |
433 |
markom |
generate_time_pretty (temp, config.sim.clkcycle_ps);
|
300 |
|
|
printf("Clock cycle: %s\n", temp);
|
301 |
424 |
markom |
if (testsprbits(SPR_UPR, SPR_UPR_DCP))
|
302 |
428 |
markom |
printf("Data cache tag: %s\n", config.dc.tagtype == CT_VIRTUAL ? "virtual" : "physical");
|
303 |
424 |
markom |
else
|
304 |
|
|
printf("No data cache.\n");
|
305 |
|
|
if (testsprbits(SPR_UPR, SPR_UPR_ICP))
|
306 |
428 |
markom |
printf("Insn cache tag: %s\n", config.ic.tagtype == CT_VIRTUAL ? "virtual" : "physical");
|
307 |
424 |
markom |
else
|
308 |
|
|
printf("No instruction cache.\n");
|
309 |
541 |
markom |
if (config.bpb.enabled)
|
310 |
424 |
markom |
printf("BPB simulation on.\n");
|
311 |
|
|
else
|
312 |
|
|
printf("BPB simulation off.\n");
|
313 |
541 |
markom |
if (config.bpb.btic)
|
314 |
424 |
markom |
printf("BTIC simulation on.\n");
|
315 |
|
|
else
|
316 |
|
|
printf("BTIC simulation off.\n");
|
317 |
|
|
}
|
318 |
|
|
}
|
319 |
|
|
|
320 |
551 |
markom |
#if !FAST_SIM
|
321 |
424 |
markom |
/* Forward declarations of functions */
|
322 |
568 |
markom |
void base_include ();
|
323 |
433 |
markom |
void sim_clkcycle ();
|
324 |
424 |
markom |
void change_device ();
|
325 |
|
|
void end_device ();
|
326 |
|
|
void uart_nuarts ();
|
327 |
|
|
void uart_baseaddr ();
|
328 |
|
|
void uart_rxfile ();
|
329 |
|
|
void uart_txfile ();
|
330 |
|
|
void uart_jitter ();
|
331 |
|
|
void uart_irq ();
|
332 |
|
|
void uart_16550 ();
|
333 |
|
|
void uart_vapi_id ();
|
334 |
|
|
void dma_ndmas ();
|
335 |
|
|
void dma_baseaddr ();
|
336 |
|
|
void dma_irq ();
|
337 |
|
|
void dma_vapi_id ();
|
338 |
|
|
void memory_type ();
|
339 |
|
|
void memory_nmemories ();
|
340 |
|
|
void memory_ce ();
|
341 |
|
|
void memory_baseaddr ();
|
342 |
|
|
void memory_size ();
|
343 |
|
|
void memory_name ();
|
344 |
|
|
void memory_log ();
|
345 |
|
|
void memory_delayr ();
|
346 |
|
|
void memory_delayw ();
|
347 |
535 |
markom |
void cpu_raw_range ();
|
348 |
626 |
markom |
void cpu_sbuf_len ();
|
349 |
424 |
markom |
void eth_nethernets ();
|
350 |
|
|
void eth_baseaddr ();
|
351 |
|
|
void eth_dma ();
|
352 |
|
|
void eth_rx_channel ();
|
353 |
|
|
void eth_tx_channel ();
|
354 |
|
|
void eth_rxfile ();
|
355 |
|
|
void eth_txfile ();
|
356 |
|
|
void eth_vapi_id ();
|
357 |
444 |
erez |
void gpio_ngpios ();
|
358 |
|
|
void gpio_baseaddr ();
|
359 |
|
|
void gpio_irq ();
|
360 |
477 |
erez |
void gpio_base_vapi_id ();
|
361 |
425 |
markom |
void immu_enabled ();
|
362 |
|
|
void immu_nsets ();
|
363 |
|
|
void immu_nways ();
|
364 |
|
|
void immu_pagesize ();
|
365 |
|
|
void immu_entrysize ();
|
366 |
|
|
void immu_ustates ();
|
367 |
|
|
void dmmu_enabled ();
|
368 |
|
|
void dmmu_nsets ();
|
369 |
|
|
void dmmu_nways ();
|
370 |
|
|
void dmmu_pagesize ();
|
371 |
|
|
void dmmu_entrysize ();
|
372 |
|
|
void dmmu_ustates ();
|
373 |
428 |
markom |
void ic_enabled ();
|
374 |
|
|
void ic_nsets ();
|
375 |
|
|
void ic_nways ();
|
376 |
|
|
void ic_blocksize ();
|
377 |
|
|
void ic_ustates ();
|
378 |
|
|
void ic_tagtype ();
|
379 |
|
|
void dc_enabled ();
|
380 |
|
|
void dc_nsets ();
|
381 |
|
|
void dc_nways ();
|
382 |
|
|
void dc_blocksize ();
|
383 |
|
|
void dc_ustates ();
|
384 |
|
|
void dc_tagtype ();
|
385 |
424 |
markom |
|
386 |
|
|
unsigned long tempL;
|
387 |
|
|
unsigned long tempUL;
|
388 |
|
|
char tempS[STR_SIZE];
|
389 |
|
|
|
390 |
|
|
#define CPF_SUBSECTION 1
|
391 |
|
|
#define CPF_SUBFIELD 2
|
392 |
549 |
markom |
#define CPF_GLOBAL 4 /* Not part of the substructure (group) in config */
|
393 |
424 |
markom |
|
394 |
|
|
struct section sections[] = {
|
395 |
568 |
markom |
{"base", 0}, /* 0 */
|
396 |
424 |
markom |
{"mc", 0},
|
397 |
|
|
{"uart", 0},
|
398 |
|
|
{"dma", 0},
|
399 |
|
|
{"memory", 0},
|
400 |
541 |
markom |
{"cpu", 0}, /* 5 */
|
401 |
424 |
markom |
{"sim", 0},
|
402 |
|
|
{"debug", 0},
|
403 |
|
|
{"VAPI", 0},
|
404 |
|
|
{"ethernet",0},
|
405 |
425 |
markom |
{"tick", 0}, /* 10 */
|
406 |
|
|
{"immu", 0},
|
407 |
428 |
markom |
{"dmmu", 0},
|
408 |
|
|
{"ic", 0},
|
409 |
444 |
erez |
{"dc", 0},
|
410 |
541 |
markom |
{"gpio", 0}, /* 15 */
|
411 |
557 |
markom |
{"bpb", 0},
|
412 |
|
|
{"pm", 0}
|
413 |
424 |
markom |
};
|
414 |
|
|
|
415 |
|
|
/* *INDENT-OFF* */
|
416 |
|
|
|
417 |
|
|
/* Parameter definitions */
|
418 |
|
|
struct config_params {
|
419 |
|
|
int section;
|
420 |
|
|
char *name;
|
421 |
|
|
char *type;
|
422 |
|
|
void (*func)();
|
423 |
|
|
void *addr;
|
424 |
549 |
markom |
int attr;
|
425 |
424 |
markom |
} config_params[] = {
|
426 |
568 |
markom |
{0, "include", "\"%s\"", base_include, (void *)(&tempS), 0},
|
427 |
|
|
|
428 |
549 |
markom |
{1, "enabled", "=%i", NULL, (void *)(&config.mc.enabled), 0},
|
429 |
|
|
{1, "baseaddr", "=0x%x", NULL, (void *)(&config.mc.baseaddr), 0},
|
430 |
|
|
{1, "POC", "=0x%x", NULL, (void *)(&config.mc.POC), 0},
|
431 |
|
|
|
432 |
|
|
{2, "nuarts", "=%i", uart_nuarts, (void *)(&tempL), CPF_GLOBAL},
|
433 |
|
|
{2, "device", "%i", change_device, (void *)(&tempL), 0},
|
434 |
|
|
{2, "enddevice", "", end_device, NULL, 0},
|
435 |
|
|
{2, "baseaddr", "=0x%x", uart_baseaddr, (void *)(&tempUL), 0},
|
436 |
|
|
{2, "irq", "=%i", uart_irq, (void *)(&tempL), 0},
|
437 |
|
|
{2, "16550", "=%i", uart_16550, (void *)(&tempL), 0},
|
438 |
|
|
{2, "jitter", "=%i", uart_jitter, (void *)(&tempL), 0},
|
439 |
|
|
{2, "rxfile", "=\"%s\"", uart_rxfile, (void *)(&tempS[0]), 0},
|
440 |
|
|
{2, "txfile", "=\"%s\"", uart_txfile, (void *)(&tempS[0]), 0},
|
441 |
|
|
{2, "vapi_id", "=0x%x", uart_vapi_id, (void *)(&tempUL), 0},
|
442 |
424 |
markom |
|
443 |
549 |
markom |
{3, "ndmas", "=%i", dma_ndmas, (void *)(&tempL), CPF_GLOBAL},
|
444 |
|
|
{3, "device", "%i", change_device, (void *)(&tempL), 0},
|
445 |
|
|
{3, "enddevice", "", end_device, NULL, 0},
|
446 |
|
|
{3, "baseaddr", "=0x%x", dma_baseaddr, (void *)(&tempUL), 0},
|
447 |
|
|
{3, "irq", "=%i", dma_irq, (void *)(&tempL), 0},
|
448 |
|
|
{3, "vapi_id", "=0x%x", dma_vapi_id, (void *)(&tempUL), 0},
|
449 |
424 |
markom |
|
450 |
549 |
markom |
{4, "random_seed", "=%i", NULL, (void *)(&config.memory.random_seed), 0},
|
451 |
|
|
{4, "pattern", "=%i", NULL, (void *)(&config.memory.pattern), 0},
|
452 |
|
|
{4, "type", "=%s ", memory_type, (void *)(&tempS[0]), 0},
|
453 |
|
|
{4, "nmemories", "=%i", memory_nmemories,(void *)(&tempL), CPF_GLOBAL},
|
454 |
|
|
{4, "device", "%i", change_device, (void *)(&tempL), 0},
|
455 |
|
|
{4, "enddevice", "", end_device, NULL, 0},
|
456 |
|
|
{4, "ce", "=%i", memory_ce, (void *)(&tempL), 0},
|
457 |
|
|
{4, "baseaddr", "=0x%x", memory_baseaddr,(void *)(&tempUL), 0},
|
458 |
|
|
{4, "size", "=0x%x", memory_size, (void *)(&tempUL), 0},
|
459 |
|
|
{4, "name", "=\"%s\"", memory_name, (void *)(&tempS[0]), 0},
|
460 |
|
|
{4, "log", "=\"%s\"", memory_log, (void *)(&tempS[0]), 0},
|
461 |
|
|
{4, "delayr", "=%i", memory_delayr, (void *)(&tempL), 0},
|
462 |
|
|
{4, "delayw", "=%i", memory_delayw, (void *)(&tempL), 0},
|
463 |
424 |
markom |
|
464 |
549 |
markom |
{5, "ver", "=0x%x", NULL, (void *)(&config.cpu.ver), 0},
|
465 |
|
|
{5, "rev", "=0x%x", NULL, (void *)(&config.cpu.rev), 0},
|
466 |
|
|
{5, "upr", "=0x%x", NULL, (void *)(&config.cpu.upr), 0},
|
467 |
557 |
markom |
{5, "sr", "=0x%x", NULL, (void *)(&config.cpu.sr), 0},
|
468 |
549 |
markom |
{5, "hazards", "=%i", NULL, (void *)(&config.cpu.hazards), 0},
|
469 |
|
|
{5, "superscalar", "=%i", NULL, (void *)(&config.cpu.superscalar), 0},
|
470 |
|
|
{5, "dependstats", "=%i", NULL, (void *)(&config.cpu.dependstats), 0},
|
471 |
|
|
{5, "raw_range", "=%i", cpu_raw_range, (void *)(&config.cpu.raw_range), 0},
|
472 |
626 |
markom |
{5, "sbuf_len", "=%i", cpu_sbuf_len, (void *)(&config.cpu.sbuf_len), 0},
|
473 |
549 |
markom |
|
474 |
|
|
{6, "debug", "=%i", NULL, (void *)(&config.sim.debug), 0},
|
475 |
|
|
{6, "verbose", "=%i", NULL, (void *)(&config.sim.verbose), 0},
|
476 |
|
|
{6, "profile", "=%i", NULL, (void *)(&config.sim.profile), 0},
|
477 |
|
|
{6, "prof_fn", "=\"%s\"", NULL, (void *)(&config.sim.prof_fn[0]), 0},
|
478 |
|
|
{6, "mprofile", "=%i", NULL, (void *)(&config.sim.mprofile), 0},
|
479 |
|
|
{6, "mprof_fn", "=\"%s\"", NULL, (void *)(&config.sim.mprof_fn[0]), 0},
|
480 |
|
|
{6, "history", "=%i", NULL, (void *)(&config.sim.history), 0},
|
481 |
|
|
{6, "exe_log", "=%i", NULL, (void *)(&config.sim.exe_log), 0},
|
482 |
|
|
{6, "exe_log_fn", "=\"%s\"", NULL, (void *)(&config.sim.exe_log_fn[0]), 0},
|
483 |
624 |
ivang |
{6, "spr_log", "=%i", NULL, (void *)(&config.sim.spr_log), 0},
|
484 |
|
|
{6, "spr_log_fn", "=\"%s\"", NULL, (void *)(&config.sim.spr_log_fn[0]), 0},
|
485 |
549 |
markom |
{6, "clkcycle", "=%s ", sim_clkcycle, (void *)(&tempS[0]), 0},
|
486 |
424 |
markom |
|
487 |
549 |
markom |
{7, "enabled", "=%i", NULL, (void *)(&config.debug.enabled), 0},
|
488 |
|
|
{7, "gdb_enabled", "=%i", NULL, (void *)(&config.debug.gdb_enabled), 0},
|
489 |
|
|
{7, "server_port", "=%i", NULL, (void *)(&config.debug.server_port), 0},
|
490 |
|
|
{7, "vapi_id", "=0x%x", NULL, (void *)(&config.debug.vapi_id), 0},
|
491 |
|
|
|
492 |
|
|
{8, "enabled", "=%i", NULL, (void *)(&config.vapi.enabled), 0},
|
493 |
|
|
{8, "server_port", "=%i", NULL, (void *)(&config.vapi.server_port), 0},
|
494 |
|
|
{8, "log_enabled", "=%i", NULL, (void *)(&config.vapi.log_enabled), 0},
|
495 |
|
|
{8, "hide_device_id", "=%i", NULL, (void *)(&config.vapi.hide_device_id), 0},
|
496 |
|
|
{8, "vapi_log_fn", "=\"%s\"", NULL, (void *)(&config.vapi.vapi_fn[0]), 0},
|
497 |
|
|
|
498 |
|
|
{9, "nethernets", "=%i", eth_nethernets,(void *)(&tempL), CPF_GLOBAL},
|
499 |
|
|
{9, "device", "%i", change_device, (void *)(&tempL), 0},
|
500 |
|
|
{9, "enddevice", "", end_device, NULL, 0},
|
501 |
|
|
{9, "baseaddr", "=0x%x", eth_baseaddr, (void *)(&tempUL), 0},
|
502 |
|
|
{9, "dma", "=%i", eth_dma, (void *)(&tempL), 0},
|
503 |
|
|
{9, "rx_channel", "=%i", eth_rx_channel,(void *)(&tempL), 0},
|
504 |
|
|
{9, "tx_channel", "=%i", eth_tx_channel,(void *)(&tempL), 0},
|
505 |
|
|
{9, "rxfile", "=\"%s\"", eth_rxfile, (void *)(&tempS[0]), 0},
|
506 |
|
|
{9, "txfile", "=\"%s\"", eth_txfile, (void *)(&tempS[0]), 0},
|
507 |
|
|
{9, "vapi_id", "=0x%x", eth_vapi_id, (void *)(&tempUL), 0},
|
508 |
|
|
|
509 |
|
|
{10, "enabled", "=%i", NULL, (void *)(&config.tick.enabled), 0},
|
510 |
|
|
|
511 |
|
|
{11, "enabled", "=%i", immu_enabled, (void *)(&tempL), 0},
|
512 |
|
|
{11, "nsets", "=%i", immu_nsets, (void *)(&tempL), 0},
|
513 |
|
|
{11, "nways", "=%i", immu_nways, (void *)(&tempL), 0},
|
514 |
|
|
{11, "pagesize", "=%i", immu_pagesize, (void *)(&tempL), 0},
|
515 |
|
|
{11, "entrysize", "=%i", immu_entrysize,(void *)(&tempL), 0},
|
516 |
|
|
{11, "ustates", "=%i", immu_ustates, (void *)(&tempL), 0},
|
517 |
|
|
{11, "missdelay", "=%i", NULL, (void *)(&config.immu.missdelay), 0},
|
518 |
|
|
{11, "hitdelay", "=%i", NULL, (void *)(&config.immu.hitdelay), 0},
|
519 |
|
|
|
520 |
|
|
{12, "enabled", "=%i", dmmu_enabled, (void *)(&tempL), 0},
|
521 |
|
|
{12, "nsets", "=%i", dmmu_nsets, (void *)(&tempL), 0},
|
522 |
|
|
{12, "nways", "=%i", dmmu_nways, (void *)(&tempL), 0},
|
523 |
|
|
{12, "pagesize", "=%i", dmmu_pagesize, (void *)(&tempL), 0},
|
524 |
|
|
{12, "entrysize", "=%i", dmmu_entrysize,(void *)(&tempL), 0},
|
525 |
|
|
{12, "ustates", "=%i", dmmu_ustates, (void *)(&tempL), 0},
|
526 |
|
|
{12, "missdelay", "=%i", NULL, (void *)(&config.dmmu.missdelay), 0},
|
527 |
|
|
{12, "hitdelay", "=%i", NULL, (void *)(&config.dmmu.hitdelay), 0},
|
528 |
|
|
|
529 |
|
|
{13, "enabled", "=%i", ic_enabled, (void *)(&tempL), 0},
|
530 |
|
|
{13, "nsets", "=%i", ic_nsets, (void *)(&tempL), 0},
|
531 |
|
|
{13, "nways", "=%i", ic_nways, (void *)(&tempL), 0},
|
532 |
|
|
{13, "blocksize", "=%i", ic_blocksize, (void *)(&tempL), 0},
|
533 |
|
|
{13, "ustates", "=%i", ic_ustates, (void *)(&tempL), 0},
|
534 |
|
|
{13, "tagtype", "=%s ", ic_tagtype, (void *)(&tempS), 0},
|
535 |
|
|
{13, "missdelay", "=%i", NULL, (void *)(&config.ic.missdelay), 0},
|
536 |
|
|
{13, "hitdelay", "=%i", NULL, (void *)(&config.ic.hitdelay), 0},
|
537 |
|
|
|
538 |
|
|
{14, "enabled", "=%i", dc_enabled, (void *)(&tempL), 0},
|
539 |
|
|
{14, "nsets", "=%i", dc_nsets, (void *)(&tempL), 0},
|
540 |
|
|
{14, "nways", "=%i", dc_nways, (void *)(&tempL), 0},
|
541 |
|
|
{14, "blocksize", "=%i", dc_blocksize, (void *)(&tempL), 0},
|
542 |
|
|
{14, "ustates", "=%i", dc_ustates, (void *)(&tempL), 0},
|
543 |
|
|
{14, "tagtype", "=%s ", dc_tagtype, (void *)(&tempS), 0},
|
544 |
|
|
{14, "load_missdelay", "=%i", NULL, (void *)(&config.dc.load_missdelay), 0},
|
545 |
|
|
{14, "load_hitdelay", "=%i", NULL, (void *)(&config.dc.load_hitdelay), 0},
|
546 |
|
|
{14, "store_missdelay", "=%i", NULL, (void *)(&config.dc.store_missdelay), 0},
|
547 |
|
|
{14, "store_hitdelay", "=%i", NULL, (void *)(&config.dc.store_hitdelay), 0},
|
548 |
|
|
|
549 |
|
|
{15, "ngpios", "=%i", gpio_ngpios, (void *)(&tempL), CPF_GLOBAL},
|
550 |
|
|
{15, "device", "%i", change_device, (void *)(&tempL), 0},
|
551 |
|
|
{15, "baseaddr", "=0x%x", gpio_baseaddr, (void *)(&tempUL), 0},
|
552 |
|
|
{15, "irq", "=%i", gpio_irq, (void *)(&tempL), 0},
|
553 |
|
|
{15, "base_vapi_id", "=0x%x", gpio_base_vapi_id, (void *)(&tempUL), 0},
|
554 |
|
|
{15, "enddevice", "", end_device, NULL, 0},
|
555 |
|
|
|
556 |
|
|
{16, "enabled", "=%i", NULL, (void *)(&config.bpb.enabled), 0},
|
557 |
|
|
{16, "btic", "=%i", NULL, (void *)(&config.bpb.btic), 0},
|
558 |
|
|
{16, "sbp_bnf_fwd", "=%i", NULL, (void *)(&config.bpb.sbp_bnf_fwd), 0},
|
559 |
|
|
{16, "sbp_bf_fwd", "=%i", NULL, (void *)(&config.bpb.sbp_bf_fwd), 0},
|
560 |
|
|
{16, "missdelay", "=%i", NULL, (void *)(&config.bpb.missdelay), 0},
|
561 |
557 |
markom |
{16, "hitdelay", "=%i", NULL, (void *)(&config.bpb.hitdelay), 0},
|
562 |
|
|
|
563 |
|
|
{17, "enabled", "=%i", NULL, (void *)(&config.pm.enabled), 0}
|
564 |
424 |
markom |
};
|
565 |
|
|
|
566 |
|
|
/* *INDENT-ON* */
|
567 |
|
|
|
568 |
|
|
int current_device = -1;
|
569 |
|
|
void change_device () {
|
570 |
|
|
current_device = tempL;
|
571 |
|
|
}
|
572 |
|
|
|
573 |
|
|
void end_device () {
|
574 |
|
|
current_device = -1;
|
575 |
|
|
}
|
576 |
|
|
|
577 |
568 |
markom |
void base_include () {
|
578 |
|
|
read_script_file (tempS);
|
579 |
|
|
section = 0;
|
580 |
|
|
}
|
581 |
|
|
|
582 |
433 |
markom |
void sim_clkcycle () {
|
583 |
|
|
int len = strlen (tempS);
|
584 |
|
|
int pos = len - 1;
|
585 |
|
|
long time;
|
586 |
|
|
if (len < 2) goto err;
|
587 |
|
|
if (tempS[pos--] != 's') goto err;
|
588 |
|
|
switch (tempS[pos--]) {
|
589 |
|
|
case 'p': time = 1; break;
|
590 |
|
|
case 'n': time = 1000; break;
|
591 |
|
|
case 'u': time = 1000000; break;
|
592 |
|
|
case 'm': time = 1000000000; break;
|
593 |
|
|
default:
|
594 |
|
|
goto err;
|
595 |
|
|
}
|
596 |
490 |
markom |
tempS[pos + 1] = 0;
|
597 |
433 |
markom |
config.sim.clkcycle_ps = time * atol (tempS);
|
598 |
|
|
return;
|
599 |
|
|
err:
|
600 |
|
|
ERROR("invalid time format.");
|
601 |
|
|
}
|
602 |
|
|
|
603 |
424 |
markom |
void uart_nuarts () {
|
604 |
|
|
if (tempL >= 0 && tempL < MAX_UARTS)
|
605 |
|
|
config.nuarts = tempL;
|
606 |
|
|
else
|
607 |
|
|
ERROR("invalid number of devices.");
|
608 |
|
|
}
|
609 |
|
|
|
610 |
|
|
void uart_baseaddr () {
|
611 |
|
|
if (current_device >= 0 && current_device < config.nuarts)
|
612 |
|
|
config.uarts[current_device].baseaddr = tempUL;
|
613 |
|
|
else
|
614 |
|
|
ERROR("invalid device number.");
|
615 |
|
|
}
|
616 |
|
|
|
617 |
|
|
void uart_jitter () {
|
618 |
|
|
if (current_device >= 0 && current_device < config.nuarts)
|
619 |
|
|
config.uarts[current_device].jitter = tempL;
|
620 |
|
|
else
|
621 |
|
|
ERROR("invalid device number.");
|
622 |
|
|
}
|
623 |
|
|
|
624 |
|
|
void uart_irq () {
|
625 |
|
|
if (current_device >= 0 && current_device < config.nuarts)
|
626 |
|
|
config.uarts[current_device].irq = tempL;
|
627 |
|
|
else
|
628 |
|
|
ERROR("invalid device number.");
|
629 |
|
|
}
|
630 |
|
|
|
631 |
|
|
void uart_16550 () {
|
632 |
|
|
if (current_device >= 0 && current_device < config.nuarts)
|
633 |
|
|
config.uarts[current_device].uart16550 = tempL;
|
634 |
|
|
else
|
635 |
|
|
ERROR("invalid device number.");
|
636 |
|
|
}
|
637 |
|
|
|
638 |
|
|
void uart_rxfile () {
|
639 |
|
|
if (current_device >= 0 && current_device < config.nuarts)
|
640 |
|
|
strcpy (config.uarts[current_device].rxfile, tempS);
|
641 |
|
|
else
|
642 |
|
|
ERROR("invalid device number.");
|
643 |
|
|
}
|
644 |
|
|
|
645 |
|
|
void uart_txfile () {
|
646 |
|
|
if (current_device >= 0 && current_device < config.nuarts)
|
647 |
|
|
strcpy (config.uarts[current_device].txfile, tempS);
|
648 |
|
|
else
|
649 |
|
|
ERROR("invalid device number.");
|
650 |
|
|
}
|
651 |
|
|
|
652 |
|
|
void uart_vapi_id () {
|
653 |
|
|
if (current_device >= 0 && current_device < config.nuarts)
|
654 |
|
|
config.uarts[current_device].vapi_id = tempUL;
|
655 |
|
|
else
|
656 |
|
|
ERROR("invalid device number.");
|
657 |
|
|
}
|
658 |
|
|
|
659 |
|
|
void dma_ndmas () {
|
660 |
|
|
if (tempL >= 0 && tempL < MAX_DMAS)
|
661 |
|
|
config.ndmas = tempL;
|
662 |
|
|
else
|
663 |
|
|
ERROR("invalid number of devices.");
|
664 |
|
|
}
|
665 |
|
|
|
666 |
|
|
void dma_baseaddr () {
|
667 |
|
|
if (current_device >= 0 && current_device < config.ndmas)
|
668 |
|
|
config.dmas[current_device].baseaddr = tempUL;
|
669 |
|
|
else
|
670 |
|
|
ERROR("invalid device number.");
|
671 |
|
|
}
|
672 |
|
|
|
673 |
|
|
void dma_irq () {
|
674 |
|
|
if (current_device >= 0 && current_device < config.ndmas)
|
675 |
|
|
config.dmas[current_device].irq = tempL;
|
676 |
|
|
else
|
677 |
|
|
ERROR("invalid device number.");
|
678 |
|
|
}
|
679 |
|
|
|
680 |
|
|
void dma_vapi_id () {
|
681 |
|
|
if (current_device >= 0 && current_device < config.ndmas)
|
682 |
|
|
config.dmas[current_device].vapi_id = tempUL;
|
683 |
|
|
else
|
684 |
|
|
ERROR("invalid device number.");
|
685 |
|
|
}
|
686 |
|
|
|
687 |
|
|
void memory_nmemories () {
|
688 |
|
|
if (tempL >= 0 && tempL < MAX_MEMORIES)
|
689 |
|
|
config.memory.nmemories = tempL;
|
690 |
|
|
else
|
691 |
|
|
ERROR("invalid number of devices.");
|
692 |
|
|
}
|
693 |
|
|
|
694 |
|
|
void memory_type () {
|
695 |
|
|
if (strcmp (tempS, "unknown") == 0)
|
696 |
|
|
config.memory.type = MT_UNKNOWN;
|
697 |
|
|
else if (strcmp (tempS, "random") == 0)
|
698 |
|
|
config.memory.type = MT_RANDOM;
|
699 |
|
|
else if (strcmp (tempS, "pattern") == 0)
|
700 |
|
|
config.memory.type = MT_PATTERN;
|
701 |
|
|
else if (strcmp (tempS, "zero") == 0) {
|
702 |
|
|
config.memory.type = MT_PATTERN;
|
703 |
|
|
config.memory.pattern = 0;
|
704 |
|
|
} else {
|
705 |
|
|
char tmp[200];
|
706 |
|
|
sprintf (tmp, "invalid memory type '%s'.\n", tempS);
|
707 |
|
|
ERROR(tmp);
|
708 |
|
|
}
|
709 |
|
|
}
|
710 |
|
|
|
711 |
|
|
void memory_ce () {
|
712 |
|
|
if (current_device >= 0 && current_device < config.memory.nmemories)
|
713 |
|
|
config.memory.table[current_device].ce = tempL;
|
714 |
|
|
else
|
715 |
|
|
ERROR("invalid device number.");
|
716 |
|
|
}
|
717 |
|
|
|
718 |
|
|
void memory_baseaddr () {
|
719 |
|
|
if (current_device >= 0 && current_device < config.memory.nmemories)
|
720 |
|
|
config.memory.table[current_device].baseaddr = tempUL;
|
721 |
|
|
else
|
722 |
|
|
ERROR("invalid device number.");
|
723 |
|
|
}
|
724 |
|
|
|
725 |
|
|
void memory_size () {
|
726 |
|
|
if (current_device >= 0 && current_device < config.memory.nmemories)
|
727 |
|
|
config.memory.table[current_device].size = tempUL;
|
728 |
|
|
else
|
729 |
|
|
ERROR("invalid device number.");
|
730 |
|
|
}
|
731 |
|
|
|
732 |
|
|
void memory_name () {
|
733 |
|
|
if (current_device >= 0 && current_device < config.memory.nmemories)
|
734 |
|
|
strcpy (config.memory.table[current_device].name, tempS);
|
735 |
|
|
else
|
736 |
|
|
ERROR("invalid device number.");
|
737 |
|
|
}
|
738 |
|
|
|
739 |
|
|
void memory_log () {
|
740 |
|
|
if (current_device >= 0 && current_device < config.memory.nmemories)
|
741 |
|
|
strcpy (config.memory.table[current_device].log, tempS);
|
742 |
|
|
else
|
743 |
|
|
ERROR("invalid device number.");
|
744 |
|
|
}
|
745 |
|
|
|
746 |
|
|
void memory_delayr () {
|
747 |
|
|
if (current_device >= 0 && current_device < config.memory.nmemories)
|
748 |
|
|
config.memory.table[current_device].delayr = tempL;
|
749 |
|
|
else
|
750 |
|
|
ERROR("invalid device number.");
|
751 |
|
|
}
|
752 |
|
|
|
753 |
|
|
void memory_delayw () {
|
754 |
|
|
if (current_device >= 0 && current_device < config.memory.nmemories)
|
755 |
|
|
config.memory.table[current_device].delayw = tempL;
|
756 |
|
|
else
|
757 |
|
|
ERROR("invalid device number.");
|
758 |
|
|
}
|
759 |
|
|
|
760 |
535 |
markom |
void cpu_raw_range () {
|
761 |
|
|
if (config.cpu.raw_range >= RAW_RANGE) {
|
762 |
|
|
config.cpu.raw_range = RAW_RANGE - 1;
|
763 |
|
|
WARNING("raw range too large; truncated.");
|
764 |
|
|
} else if (config.cpu.raw_range < 0) {
|
765 |
|
|
config.cpu.raw_range = 0;
|
766 |
|
|
WARNING("raw range negative; disabled.");
|
767 |
|
|
}
|
768 |
|
|
}
|
769 |
|
|
|
770 |
626 |
markom |
void cpu_sbuf_len () {
|
771 |
|
|
if (config.cpu.sbuf_len >= MAX_SBUF_LEN) {
|
772 |
|
|
config.cpu.sbuf_len = MAX_SBUF_LEN - 1;
|
773 |
|
|
WARNING("sbuf_len too large; truncated.");
|
774 |
|
|
} else if (config.cpu.sbuf_len < 0) {
|
775 |
|
|
config.cpu.sbuf_len = 0;
|
776 |
|
|
WARNING("sbuf_len negative; disabled.");
|
777 |
|
|
}
|
778 |
|
|
}
|
779 |
|
|
|
780 |
424 |
markom |
void eth_nethernets () {
|
781 |
|
|
if (tempL >= 0 && tempL < MAX_ETHERNETS)
|
782 |
|
|
config.nethernets = tempL;
|
783 |
|
|
else
|
784 |
|
|
ERROR("invalid number of devices.");
|
785 |
|
|
}
|
786 |
|
|
|
787 |
|
|
void eth_baseaddr () {
|
788 |
|
|
if (current_device >= 0 && current_device < config.nethernets)
|
789 |
|
|
config.ethernets[current_device].baseaddr = tempUL;
|
790 |
|
|
else
|
791 |
|
|
ERROR("invalid device number.");
|
792 |
|
|
}
|
793 |
|
|
|
794 |
|
|
void eth_dma () {
|
795 |
|
|
if (current_device >= 0 && current_device < config.nethernets)
|
796 |
|
|
config.ethernets[current_device].dma = tempL;
|
797 |
|
|
else
|
798 |
|
|
ERROR("invalid device number.");
|
799 |
|
|
}
|
800 |
|
|
|
801 |
|
|
void eth_rx_channel () {
|
802 |
|
|
if (current_device >= 0 && current_device < config.nethernets)
|
803 |
|
|
config.ethernets[current_device].rx_channel = tempL;
|
804 |
|
|
else
|
805 |
|
|
ERROR("invalid device number.");
|
806 |
|
|
}
|
807 |
|
|
|
808 |
|
|
void eth_tx_channel () {
|
809 |
|
|
if (current_device >= 0 && current_device < config.nethernets)
|
810 |
|
|
config.ethernets[current_device].rx_channel = tempL;
|
811 |
|
|
else
|
812 |
|
|
ERROR("invalid device number.");
|
813 |
|
|
}
|
814 |
|
|
|
815 |
|
|
void eth_rxfile () {
|
816 |
|
|
if (current_device >= 0 && current_device < config.nethernets)
|
817 |
|
|
strcpy (config.ethernets[current_device].rxfile, tempS);
|
818 |
|
|
else
|
819 |
|
|
ERROR("invalid device number.");
|
820 |
|
|
}
|
821 |
|
|
|
822 |
|
|
void eth_txfile () {
|
823 |
|
|
if (current_device >= 0 && current_device < config.nethernets)
|
824 |
|
|
strcpy (config.ethernets[current_device].txfile, tempS);
|
825 |
|
|
else
|
826 |
|
|
ERROR("invalid device number.");
|
827 |
|
|
}
|
828 |
|
|
|
829 |
|
|
void eth_vapi_id () {
|
830 |
|
|
if (current_device >= 0 && current_device < config.nethernets)
|
831 |
|
|
config.ethernets[current_device].vapi_id = tempUL;
|
832 |
|
|
else
|
833 |
425 |
markom |
ERROR("invalid device number.");
|
834 |
424 |
markom |
}
|
835 |
|
|
|
836 |
444 |
erez |
void gpio_ngpios () {
|
837 |
|
|
if (tempL >= 0 && tempL < MAX_GPIOS)
|
838 |
|
|
config.ngpios = tempL;
|
839 |
|
|
else
|
840 |
|
|
ERROR("invalid number of devices.");
|
841 |
|
|
}
|
842 |
|
|
|
843 |
|
|
void gpio_baseaddr () {
|
844 |
|
|
if (current_device >= 0 && current_device < config.ngpios)
|
845 |
|
|
config.gpios[current_device].baseaddr = tempUL;
|
846 |
|
|
else
|
847 |
|
|
ERROR("invalid device number.");
|
848 |
|
|
}
|
849 |
|
|
|
850 |
|
|
void gpio_irq () {
|
851 |
|
|
if (current_device >= 0 && current_device < config.ngpios)
|
852 |
|
|
config.gpios[current_device].irq = tempL;
|
853 |
|
|
else
|
854 |
|
|
ERROR("invalid device number.");
|
855 |
|
|
}
|
856 |
|
|
|
857 |
477 |
erez |
void gpio_base_vapi_id () {
|
858 |
444 |
erez |
if (current_device >= 0 && current_device < config.ngpios)
|
859 |
477 |
erez |
config.gpios[current_device].base_vapi_id = tempUL;
|
860 |
444 |
erez |
else
|
861 |
|
|
ERROR("invalid device number.");
|
862 |
|
|
}
|
863 |
|
|
|
864 |
425 |
markom |
int is_power2 (int x) {
|
865 |
|
|
while (!(x & 1))
|
866 |
|
|
x >>= 1;
|
867 |
|
|
return x == 1;
|
868 |
|
|
}
|
869 |
424 |
markom |
|
870 |
425 |
markom |
void immu_enabled () {
|
871 |
|
|
setsprbits (SPR_UPR, SPR_UPR_IMP, tempL & 1);
|
872 |
572 |
simons |
config.immu.enabled = tempL;
|
873 |
425 |
markom |
}
|
874 |
424 |
markom |
|
875 |
425 |
markom |
void dmmu_enabled () {
|
876 |
|
|
setsprbits (SPR_UPR, SPR_UPR_DMP, tempL & 1);
|
877 |
572 |
simons |
config.dmmu.enabled = tempL;
|
878 |
425 |
markom |
}
|
879 |
|
|
|
880 |
|
|
void immu_nsets () {
|
881 |
|
|
if (is_power2(tempL) && tempL <= 256)
|
882 |
|
|
config.immu.nsets = tempL;
|
883 |
|
|
else
|
884 |
428 |
markom |
ERROR("value of power of two and lower or equal than 256 expected.");
|
885 |
425 |
markom |
}
|
886 |
|
|
|
887 |
|
|
void dmmu_nsets () {
|
888 |
|
|
if (is_power2(tempL) && tempL <= 256)
|
889 |
|
|
config.dmmu.nsets = tempL;
|
890 |
|
|
else
|
891 |
428 |
markom |
ERROR("value of power of two and lower or equal than 256 expected.");
|
892 |
425 |
markom |
}
|
893 |
|
|
|
894 |
|
|
void immu_nways () {
|
895 |
|
|
if (tempL >= 1 && tempL <= 4)
|
896 |
|
|
config.immu.nways = tempL;
|
897 |
|
|
else
|
898 |
|
|
ERROR("value 1, 2, 3 or 4 expected.");
|
899 |
|
|
}
|
900 |
|
|
|
901 |
|
|
void dmmu_nways () {
|
902 |
|
|
if (tempL >= 1 && tempL <= 4)
|
903 |
|
|
config.dmmu.nways = tempL;
|
904 |
|
|
else
|
905 |
|
|
ERROR("value 1, 2, 3 or 4 expected.");
|
906 |
|
|
}
|
907 |
|
|
|
908 |
|
|
void immu_pagesize () {
|
909 |
|
|
if (is_power2(tempL))
|
910 |
|
|
config.immu.pagesize = tempL;
|
911 |
|
|
else
|
912 |
428 |
markom |
ERROR("value of power of two expected.");
|
913 |
425 |
markom |
}
|
914 |
|
|
|
915 |
|
|
void dmmu_pagesize () {
|
916 |
|
|
if (is_power2(tempL))
|
917 |
|
|
config.dmmu.pagesize = tempL;
|
918 |
|
|
else
|
919 |
428 |
markom |
ERROR("value of power of two expected.");
|
920 |
425 |
markom |
}
|
921 |
|
|
|
922 |
|
|
void immu_entrysize () {
|
923 |
|
|
if (is_power2(tempL))
|
924 |
|
|
config.immu.entrysize = tempL;
|
925 |
|
|
else
|
926 |
428 |
markom |
ERROR("value of power of two expected.");
|
927 |
425 |
markom |
}
|
928 |
|
|
|
929 |
|
|
void dmmu_entrysize () {
|
930 |
|
|
if (is_power2(tempL))
|
931 |
|
|
config.dmmu.entrysize = tempL;
|
932 |
|
|
else
|
933 |
428 |
markom |
ERROR("value of power of two expected.");
|
934 |
425 |
markom |
}
|
935 |
|
|
|
936 |
|
|
void immu_ustates () {
|
937 |
|
|
if (tempL >= 2 && tempL <= 4)
|
938 |
|
|
config.immu.ustates = tempL;
|
939 |
|
|
else
|
940 |
|
|
ERROR("invalid USTATE.");
|
941 |
|
|
}
|
942 |
|
|
|
943 |
|
|
void dmmu_ustates () {
|
944 |
|
|
if (tempL >= 2 && tempL <= 4)
|
945 |
|
|
config.dmmu.ustates = tempL;
|
946 |
|
|
else
|
947 |
|
|
ERROR("invalid USTATE.");
|
948 |
|
|
}
|
949 |
|
|
|
950 |
428 |
markom |
void ic_enabled () {
|
951 |
574 |
markom |
config.ic.enabled = tempL;
|
952 |
428 |
markom |
setsprbits (SPR_UPR, SPR_UPR_ICP, tempL & 1);
|
953 |
|
|
}
|
954 |
|
|
|
955 |
|
|
void ic_nsets () {
|
956 |
|
|
if (is_power2(tempL) && tempL <= MAX_IC_SETS)
|
957 |
|
|
config.ic.nsets = tempL;
|
958 |
|
|
else {
|
959 |
|
|
char tmp[200];
|
960 |
|
|
sprintf (tmp, "value of power of two and lower or equal than %i expected.", MAX_IC_SETS);
|
961 |
|
|
ERROR(tmp);
|
962 |
|
|
}
|
963 |
|
|
}
|
964 |
|
|
|
965 |
|
|
void ic_nways () {
|
966 |
|
|
if (tempL >= 1 && tempL <= MAX_IC_WAYS)
|
967 |
|
|
config.ic.nways = tempL;
|
968 |
|
|
else
|
969 |
|
|
ERROR("value 1, 2, 3 or 4 expected.");
|
970 |
|
|
}
|
971 |
|
|
|
972 |
|
|
void ic_blocksize () {
|
973 |
|
|
if (is_power2(tempL))
|
974 |
|
|
config.ic.blocksize = tempL;
|
975 |
|
|
else
|
976 |
|
|
ERROR("value of power of two expected.");
|
977 |
|
|
}
|
978 |
|
|
|
979 |
|
|
void ic_ustates () {
|
980 |
|
|
if (tempL >= 2 && tempL <= 4)
|
981 |
|
|
config.ic.ustates = tempL;
|
982 |
|
|
else
|
983 |
|
|
ERROR("invalid USTATE.");
|
984 |
|
|
}
|
985 |
|
|
|
986 |
|
|
void ic_tagtype () {
|
987 |
|
|
if (strcmp (tempS, "none") == 0)
|
988 |
|
|
config.ic.tagtype = CT_NONE;
|
989 |
|
|
else if (strcmp (tempS, "physical") == 0)
|
990 |
|
|
config.ic.tagtype = CT_PHYSICAL;
|
991 |
|
|
else if (strcmp (tempS, "virtual") == 0)
|
992 |
|
|
config.ic.tagtype = CT_VIRTUAL;
|
993 |
|
|
else {
|
994 |
|
|
char tmp[200];
|
995 |
|
|
sprintf (tmp, "invalid cache type '%s'.\n", tempS);
|
996 |
|
|
ERROR(tmp);
|
997 |
|
|
}
|
998 |
|
|
}
|
999 |
|
|
|
1000 |
|
|
void dc_enabled () {
|
1001 |
574 |
markom |
config.dc.enabled = tempL;
|
1002 |
428 |
markom |
setsprbits (SPR_UPR, SPR_UPR_DCP, tempL & 1);
|
1003 |
|
|
}
|
1004 |
|
|
|
1005 |
|
|
void dc_nsets () {
|
1006 |
|
|
if (is_power2(tempL) && tempL <= MAX_DC_SETS)
|
1007 |
|
|
config.dc.nsets = tempL;
|
1008 |
|
|
else {
|
1009 |
|
|
char tmp[200];
|
1010 |
|
|
sprintf (tmp, "value of power of two and lower or equal than %i expected.", MAX_DC_SETS);
|
1011 |
|
|
ERROR(tmp);
|
1012 |
|
|
}
|
1013 |
|
|
}
|
1014 |
|
|
|
1015 |
|
|
void dc_nways () {
|
1016 |
|
|
if (tempL >= 1 && tempL <= MAX_IC_WAYS)
|
1017 |
|
|
config.dc.nways = tempL;
|
1018 |
|
|
else
|
1019 |
|
|
ERROR("value 1, 2, 3 or 4 expected.");
|
1020 |
|
|
}
|
1021 |
|
|
|
1022 |
|
|
void dc_blocksize () {
|
1023 |
|
|
if (is_power2(tempL))
|
1024 |
|
|
config.dc.blocksize = tempL;
|
1025 |
|
|
else
|
1026 |
|
|
ERROR("value of power of two expected.");
|
1027 |
|
|
}
|
1028 |
|
|
|
1029 |
|
|
void dc_ustates () {
|
1030 |
|
|
if (tempL >= 2 && tempL <= 4)
|
1031 |
|
|
config.dc.ustates = tempL;
|
1032 |
|
|
else
|
1033 |
|
|
ERROR("invalid USTATE.");
|
1034 |
|
|
}
|
1035 |
|
|
|
1036 |
|
|
void dc_tagtype () {
|
1037 |
|
|
if (strcmp (tempS, "none") == 0)
|
1038 |
|
|
config.dc.tagtype = CT_NONE;
|
1039 |
|
|
else if (strcmp (tempS, "physical") == 0)
|
1040 |
|
|
config.dc.tagtype = CT_PHYSICAL;
|
1041 |
|
|
else if (strcmp (tempS, "virtual") == 0)
|
1042 |
|
|
config.dc.tagtype = CT_VIRTUAL;
|
1043 |
|
|
else {
|
1044 |
|
|
char tmp[200];
|
1045 |
|
|
sprintf (tmp, "invalid cache type '%s'.\n", tempS);
|
1046 |
|
|
ERROR(tmp);
|
1047 |
|
|
}
|
1048 |
|
|
}
|
1049 |
|
|
|
1050 |
424 |
markom |
/* Read environment from a script file. Does not fail - assumes defaukt configuration instead.
|
1051 |
|
|
The syntax of script file is:
|
1052 |
|
|
param = value
|
1053 |
|
|
section x
|
1054 |
|
|
data
|
1055 |
|
|
param = value
|
1056 |
|
|
end
|
1057 |
|
|
|
1058 |
|
|
Example:
|
1059 |
|
|
section mc
|
1060 |
|
|
memory_table_file = sim.mem
|
1061 |
|
|
enable = 1
|
1062 |
|
|
POC = 0x47892344
|
1063 |
|
|
end
|
1064 |
|
|
|
1065 |
|
|
*/
|
1066 |
|
|
|
1067 |
|
|
void read_script_file (char *filename)
|
1068 |
|
|
{
|
1069 |
|
|
FILE *f;
|
1070 |
|
|
unsigned long memory_needed = 0;
|
1071 |
|
|
char *home = getenv("HOME");
|
1072 |
|
|
char ctmp[STR_SIZE];
|
1073 |
|
|
int local = 1;
|
1074 |
|
|
section = 0;
|
1075 |
|
|
|
1076 |
|
|
sprintf(ctmp, "%s/.or1k/%s", home, filename);
|
1077 |
|
|
if ((f = fopen (filename, "rt")) != NULL
|
1078 |
|
|
|| home != NULL && !(local = 0) && (f = fopen (ctmp, "rt")) != NULL) {
|
1079 |
|
|
unsigned long start, length;
|
1080 |
|
|
char type[STR_SIZE];
|
1081 |
|
|
int nparam;
|
1082 |
|
|
int rd, wd;
|
1083 |
549 |
markom |
if (config.sim.verbose && !runtime.sim.output_cfg)
|
1084 |
428 |
markom |
printf ("Reading script file from '%s'...\n", local ? filename : ctmp);
|
1085 |
549 |
markom |
strcpy (runtime.sim.script_fn, local ? filename : ctmp);
|
1086 |
|
|
|
1087 |
424 |
markom |
while (!feof(f)) {
|
1088 |
|
|
char param[STR_SIZE];
|
1089 |
|
|
if (fscanf(f, "%s ", ¶m) != 1) break;
|
1090 |
|
|
/* Is this a sections? */
|
1091 |
|
|
if (strcmp (param, "section") == 0) {
|
1092 |
|
|
int i;
|
1093 |
|
|
section = 0;
|
1094 |
|
|
if (fscanf (f, "%s\n", ¶m) != 1) {
|
1095 |
|
|
fprintf (stderr, "%s: ERROR: Section name required.\n", local ? filename : ctmp);
|
1096 |
|
|
exit (1);
|
1097 |
|
|
}
|
1098 |
|
|
for (i = 1; i < sizeof(sections) / sizeof(struct section); i++)
|
1099 |
|
|
if (strcmp (sections[i].name, param) == 0) {
|
1100 |
|
|
section = i;
|
1101 |
|
|
break;
|
1102 |
|
|
}
|
1103 |
|
|
if (!section) {
|
1104 |
|
|
char tmp[200];
|
1105 |
|
|
sprintf (tmp, "Unknown section: %s; ignoring.", param);
|
1106 |
|
|
WARNING(tmp);
|
1107 |
|
|
/* just skip section */
|
1108 |
|
|
while (fscanf (f, "%s\n", ¶m) != 1 && strcmp (param, "end"));
|
1109 |
|
|
}
|
1110 |
|
|
} else if (strcmp (param, "end") == 0) {
|
1111 |
|
|
section = 0;
|
1112 |
|
|
} else if (strncmp (param, "/*", 2) == 0) {
|
1113 |
|
|
char c0 = 0, c1 = 0;
|
1114 |
|
|
while (c0 != '*' || c1 != '/') {
|
1115 |
|
|
c0 = c1;
|
1116 |
|
|
c1 = fgetc(f);
|
1117 |
|
|
if (feof(f)) {
|
1118 |
|
|
fprintf (stderr, "%s: ERROR: Comment reached EOF.\n", local ? filename : ctmp);
|
1119 |
|
|
exit (1);
|
1120 |
|
|
}
|
1121 |
|
|
}
|
1122 |
|
|
} else {
|
1123 |
|
|
int i, found = -1;
|
1124 |
|
|
for (i = 0; i < sizeof(config_params)/sizeof(struct config_params); i++)
|
1125 |
|
|
if (config_params[i].section == section && strcmp (config_params[i].name, param) == 0) {
|
1126 |
|
|
found = i;
|
1127 |
|
|
break;
|
1128 |
|
|
}
|
1129 |
|
|
if (found < 0) {
|
1130 |
|
|
char tmp[200];
|
1131 |
|
|
sprintf (tmp, "Invalid parameter: %s; ignoring.\n", param);
|
1132 |
|
|
WARNING(tmp);
|
1133 |
|
|
while (fgetc(f) != '\n' || feof(f));
|
1134 |
|
|
continue;
|
1135 |
|
|
}
|
1136 |
|
|
|
1137 |
|
|
/* Parse parameter value */
|
1138 |
|
|
{
|
1139 |
|
|
if (config_params[found].type[0])
|
1140 |
|
|
if(fscanf_ex (f, config_params[found].type, config_params[found].addr, 0))
|
1141 |
|
|
exit (1);
|
1142 |
|
|
}
|
1143 |
|
|
if (config_params[found].func)
|
1144 |
|
|
config_params[found].func();
|
1145 |
|
|
}
|
1146 |
|
|
}
|
1147 |
|
|
fclose (f);
|
1148 |
|
|
runtime.sim.script_file_specified = 1;
|
1149 |
|
|
} else
|
1150 |
|
|
if (config.sim.verbose)
|
1151 |
|
|
fprintf (stderr, "WARNING: Cannot read script file from '%s',\nneither '%s'.\n", filename, ctmp);
|
1152 |
|
|
}
|
1153 |
|
|
|
1154 |
|
|
/* Utility for execution of set sim command. */
|
1155 |
|
|
static int set_config (char *s)
|
1156 |
|
|
{
|
1157 |
|
|
char *sec, *item, *params;
|
1158 |
|
|
int noparams = 0, i, noitem = 0;
|
1159 |
434 |
markom |
while (*s && isspace (*s)) s++;
|
1160 |
424 |
markom |
sec = s;
|
1161 |
|
|
printf ("s:%s\n", s);
|
1162 |
|
|
while (*s && *s != ' ') s++;
|
1163 |
|
|
if (!(*s)) noitem = 1;
|
1164 |
|
|
*s = 0;
|
1165 |
|
|
printf ("sec:%s\n", sec);
|
1166 |
|
|
section = 0;
|
1167 |
|
|
for (i = 1; i < sizeof(sections) / sizeof(struct section); i++)
|
1168 |
|
|
if (strcmp (sections[i].name, sec) == 0) {
|
1169 |
|
|
section = i;
|
1170 |
|
|
break;
|
1171 |
|
|
}
|
1172 |
|
|
|
1173 |
|
|
if (!section) return 1;
|
1174 |
|
|
if (noitem) return 2;
|
1175 |
|
|
|
1176 |
|
|
item = ++s;
|
1177 |
|
|
|
1178 |
|
|
while (*s && *s != ' ') s++;
|
1179 |
|
|
if (!(*s)) {
|
1180 |
|
|
noparams = 1;
|
1181 |
|
|
params = "";
|
1182 |
|
|
} else
|
1183 |
|
|
params = s + 1;
|
1184 |
|
|
*s = 0;
|
1185 |
|
|
printf ("item:%s\n", item);
|
1186 |
|
|
printf ("params:%s\n", params);
|
1187 |
|
|
{
|
1188 |
|
|
int i, found = -1;
|
1189 |
|
|
for (i = 0; i < sizeof(config_params)/sizeof(struct config_params); i++)
|
1190 |
|
|
if (config_params[i].section == section && strcmp (config_params[i].name, item) == 0) {
|
1191 |
|
|
found = i;
|
1192 |
|
|
break;
|
1193 |
|
|
}
|
1194 |
|
|
if (found < 0) return 2;
|
1195 |
|
|
|
1196 |
|
|
/* Parse parameter value */
|
1197 |
|
|
if (config_params[found].type[0])
|
1198 |
|
|
if(fscanf_ex (0, config_params[found].type, config_params[found].addr, params))
|
1199 |
|
|
return 3;
|
1200 |
|
|
if (config_params[found].func)
|
1201 |
|
|
config_params[found].func();
|
1202 |
|
|
}
|
1203 |
|
|
return 0;
|
1204 |
|
|
}
|
1205 |
|
|
|
1206 |
|
|
/* Executes set sim command, displays error. */
|
1207 |
|
|
void set_config_command(char *s)
|
1208 |
|
|
{
|
1209 |
|
|
int i;
|
1210 |
|
|
switch (set_config (s)) {
|
1211 |
|
|
case 1:
|
1212 |
|
|
printf ("Invalid or missing section name. One of valid sections must be specified:\n");
|
1213 |
|
|
for (i = 1; i < sizeof(sections) / sizeof(struct section); i++)
|
1214 |
|
|
printf ("%s ", sections[i].name);
|
1215 |
|
|
printf ("\n");
|
1216 |
|
|
break;
|
1217 |
|
|
case 2:
|
1218 |
|
|
printf ("Invalid or missing item name. One of valid items must be specified:\n");
|
1219 |
|
|
for (i = 0; i < sizeof(config_params)/sizeof(struct config_params); i++)
|
1220 |
|
|
if (config_params[i].section == section)
|
1221 |
|
|
printf ("%s ", config_params[i].name);
|
1222 |
|
|
printf ("\n");
|
1223 |
|
|
break;
|
1224 |
|
|
case 3:
|
1225 |
|
|
printf ("Invalid parameters specified.\n");
|
1226 |
|
|
break;
|
1227 |
|
|
}
|
1228 |
|
|
}
|
1229 |
551 |
markom |
#endif /* !FAST_SIM */
|
1230 |
549 |
markom |
|
1231 |
|
|
/* Outputs C structure of current config to file */
|
1232 |
|
|
void output_cfg (FILE *f)
|
1233 |
|
|
{
|
1234 |
|
|
int i, comma;
|
1235 |
|
|
fprintf (f, "/* This file was automatically generated by or1ksim,\n"
|
1236 |
|
|
" using --output-cfg switch (cfg file '%s'). */\n"
|
1237 |
|
|
"const static struct config config = {\n", runtime.sim.script_fn);
|
1238 |
|
|
|
1239 |
599 |
simons |
fprintf (f, " tick:{enabled:%i},\n", config.tick.enabled);
|
1240 |
549 |
markom |
fprintf (f, " nuarts:%i, uarts:{", config.nuarts);
|
1241 |
|
|
comma = 0;
|
1242 |
|
|
for (i = 0; i < config.nuarts; i++) {
|
1243 |
|
|
fprintf (f, "%s\n {rxfile:\"%s\", txfile:\"%s\", jitter:%i, baseaddr:0x%08x, irq:%i, vapi_id:0x%08x, uart16550:%i}",
|
1244 |
|
|
comma ? "," :"", config.uarts[i].rxfile, config.uarts[i].txfile, config.uarts[i].jitter, config.uarts[i].baseaddr, config.uarts[i].irq,
|
1245 |
|
|
config.uarts[i].vapi_id, config.uarts[i].uart16550);
|
1246 |
|
|
comma = 1;
|
1247 |
|
|
}
|
1248 |
|
|
fprintf (f, "},\n");
|
1249 |
|
|
|
1250 |
|
|
fprintf (f, " ndmas:%i, dmas:{", config.ndmas);
|
1251 |
|
|
comma = 0;
|
1252 |
|
|
for (i = 0; i < config.ndmas; i++) {
|
1253 |
|
|
fprintf (f, "%s\n {baseaddr:0x%08x, irq:%i, vapi_id:0x%08x}",
|
1254 |
|
|
comma ? "," :"", config.dmas[i].baseaddr, config.dmas[i].irq, config.dmas[i].vapi_id);
|
1255 |
|
|
comma = 1;
|
1256 |
|
|
}
|
1257 |
|
|
fprintf (f, "},\n");
|
1258 |
|
|
|
1259 |
|
|
fprintf (f, " nethernets:%i, ethernets:{", config.nethernets);
|
1260 |
|
|
comma = 0;
|
1261 |
|
|
for (i = 0; i < config.nethernets; i++) {
|
1262 |
|
|
fprintf (f, "%s\n {baseaddr:0x%08x, dma:%i, tx_channel:0x%08x, rx_channel:0x%08x, rxfile:\"%s\", txfile:\"%s\", vapi_id:0x%08x}",
|
1263 |
|
|
comma ? "," :"", config.ethernets[i].baseaddr, config.ethernets[i].dma, config.ethernets[i].tx_channel, config.ethernets[i].rx_channel,
|
1264 |
|
|
config.ethernets[i].rxfile, config.ethernets[i].txfile, config.ethernets[i].vapi_id);
|
1265 |
|
|
comma = 1;
|
1266 |
|
|
}
|
1267 |
|
|
fprintf (f, "},\n");
|
1268 |
|
|
|
1269 |
|
|
fprintf (f, " ngpios:%i, gpios:{", config.ngpios);
|
1270 |
|
|
comma = 0;
|
1271 |
|
|
for (i = 0; i < config.ngpios; i++) {
|
1272 |
|
|
fprintf (f, "%s\n {baseaddr:0x%08x, irq:%i, base_vapi_id:0x%08x}",
|
1273 |
|
|
comma ? "," :"", config.gpios[i].baseaddr, config.gpios[i].irq, config.gpios[i].base_vapi_id);
|
1274 |
|
|
comma = 1;
|
1275 |
|
|
}
|
1276 |
|
|
fprintf (f, "},\n");
|
1277 |
|
|
|
1278 |
|
|
fprintf (f, " mc:{enabled:%i, baseaddr:%i, POC:%i},\n", config.mc.enabled, config.mc.baseaddr, config.mc.POC);
|
1279 |
|
|
fprintf (f, " memory:{pattern:%i, random_seed:%i, type:%s, nmemories:%i, table:{", config.memory.pattern, config.memory.random_seed,
|
1280 |
|
|
config.memory.type == MT_UNKNOWN ? "MT_UNKNOWN" : config.memory.type == MT_PATTERN ? "MT_PATTERN" : "MT_RANDOM", config.memory.nmemories);
|
1281 |
|
|
comma = 0;
|
1282 |
|
|
for (i = 0; i < config.memory.nmemories; i++) {
|
1283 |
|
|
fprintf (f, "%s\n {ce:%i, baseaddr:0x%08x, size:0x%08x, name:\"%s\", log:\"%s\", delayr:%i, delayw:%i}",
|
1284 |
|
|
comma ? "," :"", config.memory.table[i].ce, config.memory.table[i].baseaddr, config.memory.table[i].size, config.memory.table[i].name,
|
1285 |
|
|
config.memory.table[i].log, config.memory.table[i].delayr, config.memory.table[i].delayw);
|
1286 |
|
|
comma = 1;
|
1287 |
|
|
}
|
1288 |
|
|
fprintf (f, "}},\n");
|
1289 |
|
|
|
1290 |
|
|
fprintf (f, " immu:{enabled:%i, nways:%i, nsets:%i, pagesize:%i, entrysize:%i, ustates:%i, missdelay:%i, hitdelay:%i},\n",
|
1291 |
|
|
config.immu.enabled, config.immu.nways, config.immu.nsets, config.immu.pagesize, config.immu.entrysize, config.immu.ustates,
|
1292 |
|
|
config.immu.missdelay, config.immu.hitdelay);
|
1293 |
|
|
|
1294 |
|
|
fprintf (f, " dmmu:{enabled:%i, nways:%i, nsets:%i, pagesize:%i, entrysize:%i, ustates:%i, missdelay:%i, hitdelay:%i},\n",
|
1295 |
|
|
config.dmmu.enabled, config.dmmu.nways, config.dmmu.nsets, config.dmmu.pagesize, config.dmmu.entrysize, config.dmmu.ustates,
|
1296 |
|
|
config.dmmu.missdelay, config.dmmu.hitdelay);
|
1297 |
|
|
|
1298 |
|
|
fprintf (f, " ic:{enabled:%i, tagtype:%i, nways:%i, nsets:%i, blocksize:%i, ustates:%i, missdelay:%i, hitdelay:%i},\n",
|
1299 |
|
|
config.ic.enabled, config.ic.tagtype, config.ic.nways, config.ic.nsets, config.ic.blocksize, config.ic.ustates,
|
1300 |
|
|
config.ic.missdelay, config.ic.hitdelay);
|
1301 |
|
|
|
1302 |
557 |
markom |
fprintf (f, " dc:{enabled:%i, tagtype:%i, nways:%i, nsets:%i, blocksize:%i, ustates:%i,\n"
|
1303 |
|
|
" load_missdelay:%i, load_hitdelay:%i, store_missdelay:%i, store_hitdelay:%i},\n",
|
1304 |
549 |
markom |
config.dc.enabled, config.dc.tagtype, config.dc.nways, config.dc.nsets, config.dc.blocksize, config.dc.ustates,
|
1305 |
|
|
config.dc.load_missdelay, config.dc.load_hitdelay, config.dc.store_missdelay, config.dc.store_hitdelay);
|
1306 |
|
|
|
1307 |
|
|
fprintf (f, " bpb:{enabled:%i, sbp_bnf_fwd:%i, sbp_bf_fwd:%i, btic:%i, missdelay:%i, hitdelay:%i},\n",
|
1308 |
|
|
config.bpb.enabled, config.bpb.sbp_bnf_fwd, config.bpb.sbp_bf_fwd, config.bpb.btic, config.bpb.missdelay, config.bpb.hitdelay);
|
1309 |
|
|
|
1310 |
557 |
markom |
fprintf (f, " cpu:{upr:0x%08x, ver:0x%04x, rev:0x%04x, superscalar:%i, hazards:%i, dependstats:%i,\n"
|
1311 |
|
|
" raw_range:%i, sr:0x%08x},\n",
|
1312 |
|
|
config.cpu.upr, config.cpu.ver, config.cpu.rev, config.cpu.superscalar, config.cpu.hazards, config.cpu.dependstats,
|
1313 |
|
|
config.cpu.raw_range, config.cpu.sr);
|
1314 |
549 |
markom |
|
1315 |
551 |
markom |
fprintf (f, " sim:{debug:%i, verbose:%i, profile:%i, prof_fn:\"%s\", mprofile:%i, mprof_fn:\"%s\",\n",
|
1316 |
|
|
config.sim.debug, config.sim.verbose, config.sim.profile, config.sim.prof_fn, config.sim.mprofile, config.sim.mprof_fn);
|
1317 |
549 |
markom |
|
1318 |
624 |
ivang |
fprintf (f, " history:%i, exe_log:%i, exe_log_fn:\"%s\", clkcycle_ps:%i,\n",
|
1319 |
549 |
markom |
config.sim.history, config.sim.exe_log, config.sim.exe_log_fn, config.sim.clkcycle_ps);
|
1320 |
|
|
|
1321 |
624 |
ivang |
fprintf (f, " spr_log:%i, spr_log_fn:\"%s\"},\n",
|
1322 |
|
|
config.sim.spr_log, config.sim.spr_log_fn);
|
1323 |
|
|
|
1324 |
549 |
markom |
fprintf (f, " debug:{enabled:%i, gdb_enabled:%i, server_port:%i, vapi_id:0x%08x},\n",
|
1325 |
|
|
config.debug.enabled, config.debug.gdb_enabled, config.debug.server_port, config.debug.vapi_id);
|
1326 |
|
|
|
1327 |
557 |
markom |
fprintf (f, " vapi:{enabled:%i, server_port:%i, log_enabled:%i, hide_device_id:%i, vapi_fn:\"%s\"},\n",
|
1328 |
549 |
markom |
config.vapi.enabled, config.vapi.server_port, config.vapi.log_enabled, config.vapi.hide_device_id, config.vapi.vapi_fn);
|
1329 |
557 |
markom |
|
1330 |
|
|
fprintf (f, " pm:{enabled:%i}\n",
|
1331 |
|
|
config.pm.enabled);
|
1332 |
549 |
markom |
|
1333 |
|
|
fprintf (f, "};\n");
|
1334 |
|
|
}
|