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 723

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

powered by: WebSVN 2.1.0

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