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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_52/] [or1ksim/] [sim-config.h] - Blame information for rev 645

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

powered by: WebSVN 2.1.0

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