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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_61/] [or1ksim/] [sim-config.h] - Blame information for rev 664

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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