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 672

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

powered by: WebSVN 2.1.0

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