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

Subversion Repositories or1k

[/] [or1k/] [tags/] [stable_0_1_0/] [or1ksim/] [sim-config.h] - Blame information for rev 1765

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 672 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
#define MAX_GPIOS        4            /* Max. number of GPIO modules    */
31
#define MAX_MEMORIES     16           /* Max. number of memory devices attached */
32
#define MAX_VGAS         4            /* Max. number of VGAs */
33 876 rherveille
#define MAX_ATAS         4            /* Max. number of ATAS */
34 672 markom
#define MAX_SBUF_LEN     256          /* Max. length of store buffer */
35 424 markom
 
36 672 markom
#define EXE_LOG_HARDWARE 0            /* Print out RTL states */
37 675 markom
#define EXE_LOG_SIMPLE   1            /* Executed log prints out dissasembly */
38
#define EXE_LOG_SOFTWARE 2            /* Simple with some register output*/
39 672 markom
 
40 239 markom
#define STR_SIZE        (256)
41
 
42 7 jrydberg
struct config {
43 239 markom
  struct {
44 332 markom
    int enabled;                      /* Is tick timer enabled?  */
45
  } tick;
46
 
47 261 markom
  int nuarts;
48 239 markom
  struct {
49 310 markom
    int jitter;                       /* CZ 250801 - in msecs...time to block */
50
    unsigned long baseaddr;           /* Naturally aligned base address */
51 332 markom
    int irq;                          /* IRQ of this device */
52 313 markom
    unsigned long vapi_id;            /* VAPI id for this instance */
53 341 markom
    int uart16550;                    /* Whether this device is uart 16450 or 16550 */
54 1076 rprescott
    char channel[STR_SIZE];           /* How to communicate with host */
55 424 markom
  } uarts[MAX_UARTS];
56 239 markom
 
57 261 markom
  int ndmas;
58 239 markom
  struct {
59
    unsigned long baseaddr;
60 332 markom
    int irq;                          /* IRQ of this device */
61 313 markom
    unsigned long vapi_id;            /* VAPI id for this instance */
62 424 markom
  } dmas[MAX_DMAS];
63 239 markom
 
64 304 markom
  int nethernets;
65 361 markom
  struct {
66
    unsigned long baseaddr;
67 723 ivang
    int irq;                          /* IRQ of this device */
68 361 markom
    unsigned dma;                     /* Which controller is this ethernet "connected" to */
69 725 ivang
    unsigned rtx_type;                /* use file or socket interface */
70 361 markom
    unsigned tx_channel;              /* DMA channel used for TX */
71
    unsigned rx_channel;              /* DMA channel used for RX */
72
    char rxfile[STR_SIZE];            /* Filename for RX */
73
    char txfile[STR_SIZE];            /* File for TX */
74 723 ivang
    char sockif[STR_SIZE];            /* Socket Interface name ('lo', 'eth1',...) */
75 889 ivang
    unsigned long base_vapi_id;       /* VAPI id for this instance */
76 424 markom
  } ethernets[MAX_ETHERNETS];
77 444 erez
 
78
  int ngpios;
79 261 markom
  struct {
80 444 erez
    unsigned long baseaddr;           /* Base address */
81
    int irq;                          /* IRQ of this device */
82 477 erez
    unsigned long base_vapi_id;       /* First VAPI ID.  GPIO uses 8 consecutive IDs */
83 444 erez
  } gpios[MAX_GPIOS];
84 645 markom
 
85
  int nvgas;
86
  struct {
87
    unsigned long baseaddr;           /* Base address */
88
    int irq;                          /* IRQ of this device */
89
    int refresh_rate;                 /* Number of clocks per refresh */
90
    char filename[STR_SIZE];          /* Base file name; suffix of ####.bmp is added */
91
  } vgas[MAX_VGAS];
92 444 erez
 
93
  struct {
94 645 markom
    int enabled;                      /* Whether frame buffer is enabled */
95 647 markom
    unsigned long baseaddr;           /* Base address of frame buffer register */
96 645 markom
    int refresh_rate;                 /* Number of clocks per refresh */
97
    char filename[STR_SIZE];          /* Base file name; suffix of ####.bmp is added */
98
  } fb;
99 664 markom
 
100
  struct {
101
    int enabled;                      /* Is keyboard enabled?  */
102
    unsigned long baseaddr;           /* Base address of frame buffer register */
103
    int irq;                          /* Irq number of this device */
104
    char rxfile[STR_SIZE];            /* Filename for RX */
105
  } kbd;
106 645 markom
 
107
  struct {
108 261 markom
    int enabled;                      /* is MC enabled? */
109
    unsigned long baseaddr;           /* Naturally aligned base address */
110 239 markom
    unsigned POC;                     /* power on reset configuration register */
111
  } mc;
112 645 markom
 
113 876 rherveille
  int natas;
114 262 markom
  struct {
115 876 rherveille
    unsigned long baseaddr;           /* Naturally aligned base address */
116
    int  irq;                         /* Irq number of this device */
117
 
118
    int  dev_type0;                   /* ATA-device0 type: 0=none, 1=simulated hd, 2=local system hd */
119
    char dev_file0[STR_SIZE];         /* Filename for simulating HardDisk (device 0) */
120
    unsigned long dev_size0;          /* Size of simulated harddisk (device 0), in MBytes */
121
    int  dev_packet0;                 /* Device0 implements PACKET command set */
122
 
123
    int  dev_type1;                   /* ATA-device1 type: 0=none, 1=simulated hd, 2=local system hd */
124
    char dev_file1[STR_SIZE];         /* Filename for simulating HardDisk (device 1) */
125
    unsigned long dev_size1;          /* Size of simulated harddisk (device 1), in MBytes */
126
    int  dev_packet1;                 /* Device1 implements PACKET command set */
127
  } atas[MAX_ATAS];
128
 
129
  struct {
130 394 markom
    int pattern;                      /* A user specified memory initialization pattern */
131
    int random_seed;                  /* Initialize the memory with random values, starting with seed */
132 262 markom
    enum {
133 269 markom
      MT_UNKNOWN,
134 262 markom
      MT_PATTERN,
135
      MT_RANDOM
136
    } type;
137 424 markom
    int nmemories;                    /* Number of attached memories */
138
    struct {
139
      int ce;                         /* Which ce this memory is associated with */
140
      unsigned long baseaddr;         /* Start address of the memory */
141
      unsigned long size;             /* Memory size */
142
      char name[STR_SIZE];            /* Memory type string */
143
      char log[STR_SIZE];             /* Memory log filename */
144
      int delayr;                     /* Read cycles */
145
      int delayw;                     /* Write cycles */
146
    } table[MAX_MEMORIES];
147 262 markom
  } memory;
148 425 markom
 
149
  struct {
150
    int enabled;                      /* Whether IMMU is enabled */
151
    int nways;                        /* Number of ITLB ways */
152
    int nsets;                        /* Number of ITLB sets */
153
    int pagesize;                     /* ITLB page size */
154
    int entrysize;                    /* ITLB entry size */
155
    int ustates;                      /* number of ITLB usage states */
156 541 markom
    int missdelay;                    /* How much cycles does the miss cost */
157
    int hitdelay;                     /* How much cycles does the hit cost */
158 425 markom
  } immu;
159
 
160
  struct {
161
    int enabled;                      /* Whether DMMU is enabled */
162
    int nways;                        /* Number of DTLB ways */
163
    int nsets;                        /* Number of DTLB sets */
164
    int pagesize;                     /* DTLB page size */
165
    int entrysize;                    /* DTLB entry size */
166
    int ustates;                      /* number of DTLB usage states */
167 541 markom
    int missdelay;                    /* How much cycles does the miss cost */
168
    int hitdelay;                     /* How much cycles does the hit cost */
169 425 markom
  } dmmu;
170 428 markom
 
171
  struct {
172
    int enabled;                      /* Whether instruction cache is enabled */
173
    int nways;                        /* Number of IC ways */
174
    int nsets;                        /* Number of IC sets */
175
    int blocksize;                    /* IC entry size */
176
    int ustates;                      /* number of IC usage states */
177 541 markom
    int missdelay;                    /* How much cycles does the miss cost */
178
    int hitdelay;                     /* How much cycles does the hit cost */
179 428 markom
  } ic;
180 424 markom
 
181 263 markom
  struct {
182 541 markom
    int enabled;                      /* Whether data cache is enabled */
183 428 markom
    int nways;                        /* Number of DC ways */
184
    int nsets;                        /* Number of DC sets */
185
    int blocksize;                    /* DC entry size */
186
    int ustates;                      /* number of DC usage states */
187 541 markom
    int store_missdelay;              /* How much cycles does the store miss cost */
188
    int store_hitdelay;               /* How much cycles does the store hit cost */
189
    int load_missdelay;               /* How much cycles does the load miss cost */
190
    int load_hitdelay;                /* How much cycles does the load hit cost */
191 428 markom
  } dc;
192
 
193
  struct {
194 672 markom
    int enabled;                      /* branch prediction buffer analysis */
195
    int sbp_bnf_fwd;                  /* Static branch prediction for l.bnf uses forward prediction */
196
    int sbp_bf_fwd;                   /* Static branch prediction for l.bf uses forward prediction */
197
    int btic;                         /* branch prediction target insn cache analysis */
198
    int missdelay;                    /* How much cycles does the miss cost */
199
    int hitdelay;                     /* How much cycles does the hit cost */
200
#if 0                                 
201
    int nways;                        /* Number of BP ways */
202
    int nsets;                        /* Number of BP sets */
203
    int blocksize;                    /* BP entry size */
204
    int ustates;                      /* number of BP usage states */
205
    int pstates;                      /* number of BP predict states */
206
#endif                                
207
  } bpb;
208
 
209
  struct {
210
    unsigned long upr;                /* Unit present register */
211
    unsigned long ver, rev;           /* Version register */
212
    int sr;                           /* Supervision register */
213
    int superscalar;                  /* superscalara analysis */
214
    int hazards;                      /* dependency hazards analysis */
215
    int dependstats;                  /* dependency statistics */
216
    int sbuf_len;                     /* length of store buffer, zero if disabled */
217
  } cpu;
218
 
219
  struct {
220
    int debug;                        /* Simulator debugging */
221
    int verbose;                      /* Force verbose output */
222
 
223
    int profile;                      /* Is profiler running */
224
    char prof_fn[STR_SIZE];           /* Profiler filename */
225
 
226
    int mprofile;                     /* Is memory profiler running */
227
    char mprof_fn[STR_SIZE];          /* Memory profiler filename */
228
 
229
    int history;                      /* instruction stream history analysis */
230
    int exe_log;                      /* Print out RTL states? */
231
    int exe_log_type;                 /* Type of log */
232
    int exe_log_start;                /* First instruction to log */
233
    int exe_log_end;                  /* Last instruction to log, -1 if continuous */
234
    int exe_log_marker;               /* If nonzero, place markers before each exe_log_marker instructions */
235
    char exe_log_fn[STR_SIZE];        /* RTL state comparison filename */
236
    int spr_log;                      /* Print out SPR states */
237
    char spr_log_fn[STR_SIZE];        /* SPR state log filename */
238 823 ivang
    char fstdout[STR_SIZE];           /* stdout filename */
239 672 markom
    long clkcycle_ps;                 /* Clock duration in ps */
240 805 markom
    long system_kfreq;                /* System frequency in kHz*/
241 672 markom
  } sim;
242
 
243
  struct {
244
    int enabled;                      /* Whether is debug module enabled */
245
    int gdb_enabled;                  /* Whether is debugging with gdb possible */
246
    int server_port;                  /* A user specified port number for services */
247
    unsigned long vapi_id;            /* "Fake" vapi device id for JTAG proxy */
248
  } debug;
249
 
250
  struct {                            /* Verification API, part of Advanced Core Verification */
251
    int enabled;                      /* Whether is VAPI module enabled */
252
    int server_port;                  /* A user specified port number for services */
253
    int log_enabled;                  /* Whether to log the vapi requests */
254
    int hide_device_id;               /* Whether to log device ID for each request */
255
    char vapi_fn[STR_SIZE];           /* vapi log filename */
256
  } vapi;
257
 
258
  struct {
259
    int enabled;                      /* Whether power menagement is operational */
260
  } pm;
261 897 markom
 
262
  struct {
263
    char timings_fn[STR_SIZE];        /* Filename of the timing table */
264
    int memory_order;                 /* Memory access stricness */
265
    int calling_convention;           /* Whether functions follow standard calling convention */
266
    int enable_bursts;                /* Whether burst are enabled */
267
    int no_multicycle;                /* When enabled no multicycle paths are generated */
268
  } cuc;
269 970 simons
 
270
  struct {
271
    int enabled;                      /* Whether is test module enabled */
272
    unsigned long baseaddr;           /* Base address */
273
  } test;
274
 
275
 
276 672 markom
};
277
 
278
struct runtime {
279
  struct {
280
    FILE *fprof;                      /* Profiler file */
281
    FILE *fmprof;                     /* Memory profiler file */
282
    FILE *fexe_log;                   /* RTL state comparison file */
283
    FILE *fspr_log;                   /* SPR state log file */
284 997 markom
    FILE *fout;                       /* file for standard output */
285 672 markom
    int init;                         /* Whether we are still initilizing sim */
286
    int script_file_specified;        /* Whether script file was already loaded */
287
    char *filename;                   /* Original Command Simulator file (CZ) */
288
    int output_cfg;                   /* Whether sim is to output cfg files */
289
    char script_fn[STR_SIZE];         /* Script file read */
290
    int iprompt;                      /* Interactive prompt */
291 884 markom
    int cont_run;                     /* Continuos run versus single
292
                                         step tracing switch. */
293 1320 phoenix
    long long cycles;                 /* Cycles counts fetch stages */
294 884 markom
 
295
    int mem_cycles;                   /* Each cycle has counter of mem_cycles;
296
                                         this value is joined with cycles
297
                                         at the end of the cycle; no sim
298
                                         originated memory accesses should be
299
                                         performed inbetween. */
300
    int loadcycles;                   /* Load and store stalls */
301
    int storecycles;
302 1320 phoenix
 
303
    long long reset_cycles;
304 1353 nogj
 
305
    int hush;                         /* Is simulator to do reg dumps */
306 264 markom
  } sim;
307 883 markom
 
308
  /* Command line parameters */
309
  struct {
310
    int profile;                      /* Whether profiling was enabled */
311
    int mprofile;                     /* Whether memory profiling was enabled */
312
  } simcmd;
313 557 markom
 
314
  struct {
315 672 markom
    unsigned long ifea;               /* Instruction fetch effective address */
316
    unsigned long lea;                /* Load effective address */
317
    unsigned long sea;                /* Store effective address */
318
    unsigned long ld;                 /* Load data */
319
    unsigned long sd;                 /* Store data */
320
    unsigned long lsea;               /* Load/Store effective address */
321 1320 phoenix
    long long instructions;           /* Instructions executed */
322
    long long reset_instructions;
323
 
324 884 markom
    int stalled;
325
    int hazardwait;                   /* how many cycles were wasted because of hazards */
326
    int supercycles;                  /* Superscalar cycles */
327 672 markom
  } cpu;
328
 
329
  struct {
330 551 markom
    int random_seed;                  /* Initialize the memory with random values, starting with seed */
331 672 markom
  } memory;
332
 
333
  struct {                            /* Verification API, part of Advanced Core Verification */
334
    int enabled;                      /* Whether is VAPI module enabled */
335
    FILE *vapi_file;                  /* vapi file */
336
    int server_port;                  /* A user specified port number for services */
337 293 markom
  } vapi;
338 897 markom
 
339
/* CUC configuration parameters */
340
  struct {
341
    int mdelay[4];                  /* average memory delays in cycles
342
                                     {read single, read burst, write single, write burst} */
343
    double cycle_duration;          /* in ns */
344
  } cuc;
345 7 jrydberg
};
346 239 markom
 
347 551 markom
#if FAST_SIM
348
#include "fast_config.c"
349 557 markom
#define IFF(x) if (x)
350 551 markom
#else
351 7 jrydberg
extern struct config config;
352 557 markom
#define IFF(x) if (1)
353 551 markom
#endif
354
 
355 997 markom
#define PRINTF(x...) fprintf (runtime.sim.fout, x)
356
 
357 361 markom
extern struct runtime runtime;
358 239 markom
 
359
/* Read environment from a script file. Does not fail - assumes defaukt configuration instead. */
360
void read_script_file (char *filename);
361 361 markom
 
362
/* Executes set sim command.  Returns nonzero if error.  */
363 1353 nogj
void set_config_command (int argc, char **argv);
364 428 markom
 
365 549 markom
/* Outputs C structure of current config to file */
366
void output_cfg (FILE *f);
367
 
368 1308 phoenix
void init_defconfig();
369
 
370
int parse_args(int argc, char *argv[]);
371
 
372
void print_config();
373
 
374 1353 nogj
void sim_done(void);
375
 
376
/* Resets all subunits */
377
void sim_reset(void);
378
 
379
/* Handle the sim commandline */
380
void handle_sim_command(void);
381 428 markom
#endif

powered by: WebSVN 2.1.0

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