1 |
7 |
jrydberg |
/* config.h -- Simulator configuration header file
|
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 |
428 |
markom |
|
20 |
|
|
#ifndef _CONFIG_H_
|
21 |
|
|
#define _CONFIG_H_
|
22 |
|
|
|
23 |
173 |
markom |
#include <stdio.h>
|
24 |
|
|
|
25 |
7 |
jrydberg |
/* Simulator configuration macros. Eventually this one will be a lot bigger. */
|
26 |
30 |
lampret |
|
27 |
424 |
markom |
#define MAX_UARTS 4 /* Max. number of UARTs simulated */
|
28 |
|
|
#define MAX_DMAS 4 /* Max. number of DMA controllers */
|
29 |
|
|
#define MAX_ETHERNETS 4 /* Max. number of Ethernet MACs */
|
30 |
444 |
erez |
#define MAX_GPIOS 4 /* Max. number of GPIO modules */
|
31 |
424 |
markom |
#define MAX_MEMORIES 16 /* Max. number of memory devices attached */
|
32 |
|
|
|
33 |
239 |
markom |
#define STR_SIZE (256)
|
34 |
|
|
|
35 |
7 |
jrydberg |
struct config {
|
36 |
239 |
markom |
struct {
|
37 |
332 |
markom |
int enabled; /* Is tick timer enabled? */
|
38 |
|
|
int irq; /* IRQ of this device */
|
39 |
|
|
} tick;
|
40 |
|
|
|
41 |
261 |
markom |
int nuarts;
|
42 |
239 |
markom |
struct {
|
43 |
310 |
markom |
char rxfile[STR_SIZE]; /* Filename for RX */
|
44 |
|
|
char txfile[STR_SIZE]; /* Filename for TX (required) */
|
45 |
|
|
int jitter; /* CZ 250801 - in msecs...time to block */
|
46 |
|
|
unsigned long baseaddr; /* Naturally aligned base address */
|
47 |
332 |
markom |
int irq; /* IRQ of this device */
|
48 |
313 |
markom |
unsigned long vapi_id; /* VAPI id for this instance */
|
49 |
341 |
markom |
int uart16550; /* Whether this device is uart 16450 or 16550 */
|
50 |
424 |
markom |
} uarts[MAX_UARTS];
|
51 |
239 |
markom |
|
52 |
261 |
markom |
int ndmas;
|
53 |
239 |
markom |
struct {
|
54 |
|
|
unsigned long baseaddr;
|
55 |
332 |
markom |
int irq; /* IRQ of this device */
|
56 |
313 |
markom |
unsigned long vapi_id; /* VAPI id for this instance */
|
57 |
424 |
markom |
} dmas[MAX_DMAS];
|
58 |
239 |
markom |
|
59 |
304 |
markom |
int nethernets;
|
60 |
361 |
markom |
struct {
|
61 |
|
|
unsigned long baseaddr;
|
62 |
|
|
unsigned dma; /* Which controller is this ethernet "connected" to */
|
63 |
|
|
unsigned tx_channel; /* DMA channel used for TX */
|
64 |
|
|
unsigned rx_channel; /* DMA channel used for RX */
|
65 |
|
|
char rxfile[STR_SIZE]; /* Filename for RX */
|
66 |
|
|
char txfile[STR_SIZE]; /* File for TX */
|
67 |
|
|
unsigned long vapi_id; /* VAPI id for this instance */
|
68 |
424 |
markom |
} ethernets[MAX_ETHERNETS];
|
69 |
444 |
erez |
|
70 |
|
|
int ngpios;
|
71 |
261 |
markom |
struct {
|
72 |
444 |
erez |
unsigned long baseaddr; /* Base address */
|
73 |
|
|
int irq; /* IRQ of this device */
|
74 |
477 |
erez |
unsigned long base_vapi_id; /* First VAPI ID. GPIO uses 8 consecutive IDs */
|
75 |
444 |
erez |
} gpios[MAX_GPIOS];
|
76 |
|
|
|
77 |
|
|
struct {
|
78 |
261 |
markom |
int enabled; /* is MC enabled? */
|
79 |
|
|
unsigned long baseaddr; /* Naturally aligned base address */
|
80 |
239 |
markom |
unsigned POC; /* power on reset configuration register */
|
81 |
|
|
} mc;
|
82 |
262 |
markom |
|
83 |
|
|
struct {
|
84 |
394 |
markom |
int pattern; /* A user specified memory initialization pattern */
|
85 |
|
|
int random_seed; /* Initialize the memory with random values, starting with seed */
|
86 |
262 |
markom |
enum {
|
87 |
269 |
markom |
MT_UNKNOWN,
|
88 |
262 |
markom |
MT_PATTERN,
|
89 |
|
|
MT_RANDOM
|
90 |
|
|
} type;
|
91 |
424 |
markom |
int nmemories; /* Number of attached memories */
|
92 |
|
|
struct {
|
93 |
|
|
int ce; /* Which ce this memory is associated with */
|
94 |
|
|
unsigned long baseaddr; /* Start address of the memory */
|
95 |
|
|
unsigned long size; /* Memory size */
|
96 |
|
|
char name[STR_SIZE]; /* Memory type string */
|
97 |
|
|
char log[STR_SIZE]; /* Memory log filename */
|
98 |
|
|
int delayr; /* Read cycles */
|
99 |
|
|
int delayw; /* Write cycles */
|
100 |
|
|
} table[MAX_MEMORIES];
|
101 |
262 |
markom |
} memory;
|
102 |
425 |
markom |
|
103 |
|
|
struct {
|
104 |
|
|
int enabled; /* Whether IMMU is enabled */
|
105 |
|
|
int nways; /* Number of ITLB ways */
|
106 |
|
|
int nsets; /* Number of ITLB sets */
|
107 |
|
|
int pagesize; /* ITLB page size */
|
108 |
|
|
int entrysize; /* ITLB entry size */
|
109 |
|
|
int ustates; /* number of ITLB usage states */
|
110 |
541 |
markom |
int missdelay; /* How much cycles does the miss cost */
|
111 |
|
|
int hitdelay; /* How much cycles does the hit cost */
|
112 |
425 |
markom |
} immu;
|
113 |
|
|
|
114 |
|
|
struct {
|
115 |
|
|
int enabled; /* Whether DMMU is enabled */
|
116 |
|
|
int nways; /* Number of DTLB ways */
|
117 |
|
|
int nsets; /* Number of DTLB sets */
|
118 |
|
|
int pagesize; /* DTLB page size */
|
119 |
|
|
int entrysize; /* DTLB entry size */
|
120 |
|
|
int ustates; /* number of DTLB usage states */
|
121 |
541 |
markom |
int missdelay; /* How much cycles does the miss cost */
|
122 |
|
|
int hitdelay; /* How much cycles does the hit cost */
|
123 |
425 |
markom |
} dmmu;
|
124 |
428 |
markom |
|
125 |
|
|
struct {
|
126 |
|
|
int tagtype;
|
127 |
|
|
int enabled; /* Whether instruction cache is enabled */
|
128 |
|
|
int nways; /* Number of IC ways */
|
129 |
|
|
int nsets; /* Number of IC sets */
|
130 |
|
|
int blocksize; /* IC entry size */
|
131 |
|
|
int ustates; /* number of IC usage states */
|
132 |
541 |
markom |
int missdelay; /* How much cycles does the miss cost */
|
133 |
|
|
int hitdelay; /* How much cycles does the hit cost */
|
134 |
428 |
markom |
} ic;
|
135 |
424 |
markom |
|
136 |
263 |
markom |
struct {
|
137 |
541 |
markom |
int enabled; /* Whether data cache is enabled */
|
138 |
428 |
markom |
int tagtype;
|
139 |
|
|
int nways; /* Number of DC ways */
|
140 |
|
|
int nsets; /* Number of DC sets */
|
141 |
|
|
int blocksize; /* DC entry size */
|
142 |
|
|
int ustates; /* number of DC usage states */
|
143 |
541 |
markom |
int store_missdelay; /* How much cycles does the store miss cost */
|
144 |
|
|
int store_hitdelay; /* How much cycles does the store hit cost */
|
145 |
|
|
int load_missdelay; /* How much cycles does the load miss cost */
|
146 |
|
|
int load_hitdelay; /* How much cycles does the load hit cost */
|
147 |
428 |
markom |
} dc;
|
148 |
|
|
|
149 |
|
|
struct {
|
150 |
541 |
markom |
int enabled; /* branch prediction buffer analysis */
|
151 |
|
|
int sbp_bnf_fwd; /* Static branch prediction for l.bnf uses forward prediction */
|
152 |
|
|
int sbp_bf_fwd; /* Static branch prediction for l.bf uses forward prediction */
|
153 |
|
|
int btic; /* branch prediction target insn cache analysis */
|
154 |
|
|
int missdelay; /* How much cycles does the miss cost */
|
155 |
|
|
int hitdelay; /* How much cycles does the hit cost */
|
156 |
|
|
} bpb;
|
157 |
|
|
|
158 |
|
|
struct {
|
159 |
263 |
markom |
unsigned long upr; /* Unit present register */
|
160 |
|
|
unsigned long ver, rev; /* Version register */
|
161 |
|
|
int superscalar; /* superscalara analysis */
|
162 |
|
|
int hazards; /* dependency hazards analysis */
|
163 |
361 |
markom |
int dependstats; /* dependency statistics */
|
164 |
535 |
markom |
int raw_range; /* raw register usage over time stats; range in cycles, 0 = disabled */
|
165 |
263 |
markom |
} cpu;
|
166 |
264 |
markom |
|
167 |
|
|
struct {
|
168 |
|
|
int debug; /* Simulator debugging */
|
169 |
293 |
markom |
int verbose; /* Force verbose output */
|
170 |
361 |
markom |
|
171 |
264 |
markom |
int profile; /* Is profiler running */
|
172 |
|
|
char prof_fn[STR_SIZE]; /* Profiler filename */
|
173 |
547 |
markom |
|
174 |
|
|
int mprofile; /* Is memory profiler running */
|
175 |
|
|
char mprof_fn[STR_SIZE];/* Memory profiler filename */
|
176 |
394 |
markom |
|
177 |
|
|
int history; /* instruction stream history analysis */
|
178 |
361 |
markom |
int exe_log; /* Print out RTL states? */
|
179 |
294 |
markom |
char exe_log_fn[STR_SIZE]; /* RTL state comparison filename */
|
180 |
433 |
markom |
long clkcycle_ps; /* Clock duration in ps */
|
181 |
264 |
markom |
} sim;
|
182 |
294 |
markom |
|
183 |
269 |
markom |
struct {
|
184 |
|
|
int enabled; /* Whether is debug module enabled */
|
185 |
|
|
int gdb_enabled; /* Whether is debugging with gdb possible */
|
186 |
|
|
int server_port; /* A user specified port number for services */
|
187 |
439 |
erez |
unsigned long vapi_id; /* "Fake" vapi device id for JTAG proxy */
|
188 |
269 |
markom |
} debug;
|
189 |
|
|
|
190 |
293 |
markom |
struct { /* Verification API, part of Advanced Core Verification */
|
191 |
306 |
markom |
int enabled; /* Whether is VAPI module enabled */
|
192 |
|
|
int server_port; /* A user specified port number for services */
|
193 |
355 |
markom |
int log_enabled; /* Whether to log the vapi requests */
|
194 |
477 |
erez |
int hide_device_id; /* Whether to log device ID for each request */
|
195 |
355 |
markom |
char vapi_fn[STR_SIZE]; /* vapi log filename */
|
196 |
361 |
markom |
} vapi;
|
197 |
|
|
};
|
198 |
|
|
|
199 |
|
|
struct runtime {
|
200 |
|
|
struct {
|
201 |
|
|
FILE *fprof; /* Profiler file */
|
202 |
547 |
markom |
FILE *fmprof; /* Memory profiler file */
|
203 |
361 |
markom |
FILE *fexe_log; /* RTL state comparison file */
|
204 |
|
|
int init; /* Whether we are still initilizing sim */
|
205 |
|
|
int script_file_specified;/* Whether script file was already loaded */
|
206 |
549 |
markom |
char *filename; /* Original Command Simulator file (CZ) */
|
207 |
|
|
int output_cfg; /* Whether sim is to output cfg files */
|
208 |
|
|
char script_fn[STR_SIZE];/* Script file read */
|
209 |
551 |
markom |
int iprompt; /* Interactive prompt */
|
210 |
361 |
markom |
} sim;
|
211 |
424 |
markom |
|
212 |
479 |
markom |
struct {
|
213 |
|
|
unsigned long ifea; /* Instruction fetch effective address */
|
214 |
|
|
unsigned long lea; /* Load effective address */
|
215 |
|
|
unsigned long sea; /* Store effective address */
|
216 |
|
|
unsigned long ld; /* Load data */
|
217 |
|
|
unsigned long sd; /* Store data */
|
218 |
|
|
unsigned long lsea; /* Load/Store effective address */
|
219 |
|
|
} cpu;
|
220 |
|
|
|
221 |
551 |
markom |
struct {
|
222 |
|
|
int random_seed; /* Initialize the memory with random values, starting with seed */
|
223 |
|
|
} memory;
|
224 |
|
|
|
225 |
361 |
markom |
struct { /* Verification API, part of Advanced Core Verification */
|
226 |
551 |
markom |
int enabled; /* Whether is VAPI module enabled */
|
227 |
355 |
markom |
FILE *vapi_file; /* vapi file */
|
228 |
551 |
markom |
int server_port; /* A user specified port number for services */
|
229 |
293 |
markom |
} vapi;
|
230 |
7 |
jrydberg |
};
|
231 |
239 |
markom |
|
232 |
551 |
markom |
#if FAST_SIM
|
233 |
|
|
#include "fast_config.c"
|
234 |
|
|
#else
|
235 |
7 |
jrydberg |
extern struct config config;
|
236 |
551 |
markom |
#endif
|
237 |
|
|
|
238 |
361 |
markom |
extern struct runtime runtime;
|
239 |
239 |
markom |
|
240 |
|
|
/* Read environment from a script file. Does not fail - assumes defaukt configuration instead. */
|
241 |
|
|
void read_script_file (char *filename);
|
242 |
361 |
markom |
|
243 |
|
|
/* Executes set sim command. Returns nonzero if error. */
|
244 |
|
|
void set_config_command (char *s);
|
245 |
428 |
markom |
|
246 |
549 |
markom |
/* Outputs C structure of current config to file */
|
247 |
|
|
void output_cfg (FILE *f);
|
248 |
|
|
|
249 |
428 |
markom |
#endif
|