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 632

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

powered by: WebSVN 2.1.0

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