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 626

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 tagtype;
127
    int enabled;                      /* Whether instruction cache is enabled */
128
    int nways;                        /* Number of IC ways */
129
    int nsets;                        /* Number of IC sets */
130
    int blocksize;                    /* IC entry size */
131
    int ustates;                      /* number of IC usage states */
132 541 markom
    int missdelay;                    /* How much cycles does the miss cost */
133
    int hitdelay;                     /* How much cycles does the hit cost */
134 428 markom
  } ic;
135 424 markom
 
136 263 markom
  struct {
137 541 markom
    int enabled;                      /* Whether data cache is enabled */
138 428 markom
    int tagtype;
139
    int nways;                        /* Number of DC ways */
140
    int nsets;                        /* Number of DC sets */
141
    int blocksize;                    /* DC entry size */
142
    int ustates;                      /* number of DC usage states */
143 541 markom
    int store_missdelay;              /* How much cycles does the store miss cost */
144
    int store_hitdelay;               /* How much cycles does the store hit cost */
145
    int load_missdelay;               /* How much cycles does the load miss cost */
146
    int load_hitdelay;                /* How much cycles does the load hit cost */
147 428 markom
  } dc;
148
 
149
  struct {
150 541 markom
    int enabled;            /* branch prediction buffer analysis */
151
    int sbp_bnf_fwd;        /* Static branch prediction for l.bnf uses forward prediction */
152
    int sbp_bf_fwd;         /* Static branch prediction for l.bf uses forward prediction */
153
    int btic;               /* branch prediction target insn cache analysis */
154
    int missdelay;          /* How much cycles does the miss cost */
155
    int hitdelay;           /* How much cycles does the hit cost */
156
  } bpb;
157
 
158
  struct {
159 263 markom
    unsigned long upr;      /* Unit present register */
160
    unsigned long ver, rev; /* Version register */
161 556 markom
    int sr;                 /* Supervision register */
162 263 markom
    int superscalar;        /* superscalara analysis */
163
    int hazards;            /* dependency hazards analysis */
164 361 markom
    int dependstats;        /* dependency statistics */
165 535 markom
    int raw_range;          /* raw register usage over time stats; range in cycles, 0 = disabled */
166 626 markom
    int sbuf_len;           /* length of store buffer, zero if disabled */
167 263 markom
  } cpu;
168 264 markom
 
169
  struct {
170
    int debug;              /* Simulator debugging */
171 293 markom
    int verbose;            /* Force verbose output */
172 361 markom
 
173 264 markom
    int profile;            /* Is profiler running */
174
    char prof_fn[STR_SIZE]; /* Profiler filename */
175 547 markom
 
176
    int mprofile;           /* Is memory profiler running */
177
    char mprof_fn[STR_SIZE];/* Memory profiler filename */
178 394 markom
 
179
    int history;            /* instruction stream history analysis */
180 361 markom
    int exe_log;            /* Print out RTL states? */
181 294 markom
    char exe_log_fn[STR_SIZE]; /* RTL state comparison filename */
182 624 ivang
    int spr_log;            /* Print out SPR states */
183
    char spr_log_fn[STR_SIZE]; /* SPR state log filename */
184 433 markom
    long clkcycle_ps;       /* Clock duration in ps */
185 264 markom
  } sim;
186 294 markom
 
187 269 markom
  struct {
188
    int enabled;            /* Whether is debug module enabled */
189
    int gdb_enabled;        /* Whether is debugging with gdb possible */
190
    int server_port;        /* A user specified port number for services */
191 439 erez
    unsigned long vapi_id;  /* "Fake" vapi device id for JTAG proxy */
192 269 markom
  } debug;
193
 
194 293 markom
  struct {                  /* Verification API, part of Advanced Core Verification */
195 306 markom
    int enabled;            /* Whether is VAPI module enabled */
196
    int server_port;        /* A user specified port number for services */
197 355 markom
    int log_enabled;        /* Whether to log the vapi requests */
198 477 erez
    int hide_device_id;     /* Whether to log device ID for each request */
199 355 markom
    char vapi_fn[STR_SIZE]; /* vapi log filename */
200 361 markom
  } vapi;
201 557 markom
 
202
  struct {
203
    int enabled;            /* Whether power menagement is operational */
204
  } pm;
205 361 markom
};
206
 
207
struct runtime {
208
  struct {
209
    FILE *fprof;            /* Profiler file */
210 547 markom
    FILE *fmprof;           /* Memory profiler file */
211 361 markom
    FILE *fexe_log;         /* RTL state comparison file */
212 624 ivang
    FILE *fspr_log;         /* SPR state log file */
213 361 markom
    int init;               /* Whether we are still initilizing sim */
214
    int script_file_specified;/* Whether script file was already loaded */
215 549 markom
    char *filename;         /* Original Command Simulator file (CZ) */
216
    int output_cfg;         /* Whether sim is to output cfg files */
217
    char script_fn[STR_SIZE];/* Script file read */
218 551 markom
    int iprompt;            /* Interactive prompt */
219 361 markom
  } sim;
220 424 markom
 
221 479 markom
  struct {
222
    unsigned long ifea;     /* Instruction fetch effective address */
223
    unsigned long lea;      /* Load effective address */
224
    unsigned long sea;      /* Store effective address */
225
    unsigned long ld;       /* Load data */
226
    unsigned long sd;       /* Store data */
227
    unsigned long lsea;     /* Load/Store effective address */
228
  } cpu;
229
 
230 551 markom
  struct {
231
    int random_seed;                  /* Initialize the memory with random values, starting with seed */
232
  } memory;
233
 
234 361 markom
  struct {                  /* Verification API, part of Advanced Core Verification */
235 551 markom
    int enabled;            /* Whether is VAPI module enabled */
236 355 markom
    FILE *vapi_file;        /* vapi file */
237 551 markom
    int server_port;        /* A user specified port number for services */
238 293 markom
  } vapi;
239 7 jrydberg
};
240 239 markom
 
241 551 markom
#if FAST_SIM
242
#include "fast_config.c"
243 557 markom
#define IFF(x) if (x)
244 551 markom
#else
245 7 jrydberg
extern struct config config;
246 557 markom
#define IFF(x) if (1)
247 551 markom
#endif
248
 
249 361 markom
extern struct runtime runtime;
250 239 markom
 
251
/* Read environment from a script file. Does not fail - assumes defaukt configuration instead. */
252
void read_script_file (char *filename);
253 361 markom
 
254
/* Executes set sim command.  Returns nonzero if error.  */
255
void set_config_command (char *s);
256 428 markom
 
257 549 markom
/* Outputs C structure of current config to file */
258
void output_cfg (FILE *f);
259
 
260 428 markom
#endif

powered by: WebSVN 2.1.0

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