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

Subversion Repositories or1k

[/] [or1k/] [tags/] [rel-0-3-0-rc1/] [or1ksim/] [sim-config.h] - Blame information for rev 1749

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1446 nogj
/* sim-config.h -- Simulator configuration header file
2 1743 jeremybenn
 
3 7 jrydberg
   Copyright (C) 1999 Damjan Lampret, lampret@opencores.org
4 1743 jeremybenn
   Copyright (C) 2008 Embecosm Limited
5
 
6
   Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
7
 
8 7 jrydberg
   This file is part of OpenRISC 1000 Architectural Simulator.
9 1743 jeremybenn
 
10
   This program is free software; you can redistribute it and/or modify it
11
   under the terms of the GNU General Public License as published by the Free
12
   Software Foundation; either version 3 of the License, or (at your option)
13
   any later version.
14
 
15
   This program is distributed in the hope that it will be useful, but WITHOUT
16
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
18
   more details.
19
 
20
   You should have received a copy of the GNU General Public License along
21
   with this program.  If not, see <http://www.gnu.org/licenses/>. */
22 428 markom
 
23 1748 jeremybenn
/* This program is commented throughout in a fashion suitable for processing
24
   with Doxygen. */
25 1743 jeremybenn
 
26 428 markom
 
27 1748 jeremybenn
#ifndef SIM_CONFIG_H
28
#define SIM_CONFIG_H
29
 
30
/* System includes */
31 173 markom
#include <stdio.h>
32
 
33 1748 jeremybenn
/* Package includes */
34
#include "arch.h"
35
 
36 7 jrydberg
/* Simulator configuration macros. Eventually this one will be a lot bigger. */
37 30 lampret
 
38 1748 jeremybenn
#define MAX_SBUF_LEN     256    /* Max. length of store buffer */
39 424 markom
 
40 1748 jeremybenn
#define EXE_LOG_HARDWARE   0    /* Print out RTL states */
41
#define EXE_LOG_SIMPLE     1    /* Executed log prints out dissasembly */
42
#define EXE_LOG_SOFTWARE   2    /* Simple with some register output */
43 672 markom
 
44 1748 jeremybenn
#define STR_SIZE         256
45 239 markom
 
46 1748 jeremybenn
/* Number of cycles between checks to runtime.sim.iprompt */
47
#define CHECK_INT_TIME 100000
48 1745 jeremybenn
 
49 1748 jeremybenn
#define PRINTF(x...) fprintf (runtime.sim.fout, x)
50 1718 nogj
 
51 1748 jeremybenn
#define CONFIG_ERROR(s) {fprintf (stderr, "ERROR: config.%s:%s\n", cur_section->name, s); if (runtime.sim.init) exit (1);}
52 424 markom
 
53 1748 jeremybenn
/*! Data structure for configuration data */
54
struct config
55
{
56
  struct
57
  {                             /* External linkage for SystemC */
58
    void *class_ptr;
59
    unsigned long int (*read_up) (void *class_ptr,
60
                                  unsigned long int addr,
61
                                  unsigned long int mask);
62
    void (*write_up) (void *class_ptr,
63
                      unsigned long int addr,
64
                      unsigned long int mask, unsigned long int wdata);
65
  } ext;
66 897 markom
 
67 1748 jeremybenn
  struct
68
  {
69
    int debug;                  /* Simulator debugging */
70
    int verbose;                /* Force verbose output */
71 884 markom
 
72 1748 jeremybenn
    int profile;                /* Is profiler running */
73
    char *prof_fn;              /* Profiler filename */
74 1320 phoenix
 
75 1748 jeremybenn
    int mprofile;               /* Is memory profiler running */
76
    char *mprof_fn;             /* Memory profiler filename */
77 1353 nogj
 
78 1748 jeremybenn
    int history;                /* instruction stream history analysis */
79
    int exe_log;                /* Print out RTL states? */
80
    int exe_log_type;           /* Type of log */
81
    long long int exe_log_start;        /* First instruction to log */
82
    long long int exe_log_end;  /* Last instr to log, -1 if continuous */
83
    int exe_log_marker;         /* If nonzero, place markers before */
84
    /* each exe_log_marker instructions */
85
    char *exe_log_fn;           /* RTL state comparison filename */
86
    long clkcycle_ps;           /* Clock duration in ps */
87 264 markom
  } sim;
88 883 markom
 
89 1748 jeremybenn
  struct
90
  {                             /* Verification API */
91
    int enabled;                /* Whether is VAPI module enabled */
92
    int server_port;            /* user specified port for services */
93
    int log_enabled;            /* Whether to log the vapi requests */
94
    int hide_device_id;         /* Whether to log dev ID each request */
95
    char *vapi_fn;              /* vapi log filename */
96 293 markom
  } vapi;
97 1748 jeremybenn
 
98
  struct
99
  {
100
    char *timings_fn;           /* Filename of the timing table */
101
    int memory_order;           /* Memory access stricness */
102
    int calling_convention;     /* Do funcs follow std calling conv? */
103
    int enable_bursts;          /* Whether burst are enabled */
104
    int no_multicycle;          /* Generate no multicycle paths */
105 897 markom
  } cuc;
106 239 markom
 
107 1748 jeremybenn
  struct
108
  {
109
    int superscalar;            /* superscalara analysis */
110
    int hazards;                /* dependency hazards analysis */
111
    int dependstats;            /* dependency statistics */
112
    int sbuf_len;               /* length of store buffer, 0=disabled */
113
  } cpu;
114 551 markom
 
115 1748 jeremybenn
  struct
116
  {
117
    int enabled;                /* Whether data cache is enabled */
118
    int nways;                  /* Number of DC ways */
119
    int nsets;                  /* Number of DC sets */
120
    int blocksize;              /* DC entry size */
121
    int ustates;                /* number of DC usage states */
122
    int store_missdelay;        /* cycles a store miss costs */
123
    int store_hitdelay;         /* cycles a store hit costs */
124
    int load_missdelay;         /* cycles a load miss costs */
125
    int load_hitdelay;          /* cycles a load hit costs */
126
  } dc;
127 997 markom
 
128 1748 jeremybenn
  struct pic
129
  {
130
    int enabled;                /* Is interrupt controller enabled? */
131
    int edge_trigger;           /* Are interrupts edge triggered? */
132
  } pic;
133 239 markom
 
134 1748 jeremybenn
  struct
135
  {
136
    int enabled;                /* Is power management operational? */
137
  } pm;
138 361 markom
 
139 1748 jeremybenn
  struct
140
  {
141
    int enabled;                /* branch prediction buffer analysis */
142
    int sbp_bnf_fwd;            /* Static BP for l.bnf uses fwd predn */
143
    int sbp_bf_fwd;             /* Static BP for l.bf uses fwd predn */
144
    int btic;                   /* BP target insn cache analysis */
145
    int missdelay;              /* How much cycles does the miss cost */
146
    int hitdelay;               /* How much cycles does the hit cost */
147
  } bpb;
148 428 markom
 
149 1748 jeremybenn
  struct
150
  {
151
    int enabled;                /* Is debug module enabled */
152
    int gdb_enabled;            /* Is debugging with gdb possible */
153
    int server_port;            /* A user specified port for services */
154
    unsigned long vapi_id;      /* "Fake" vapi dev id for JTAG proxy */
155
  } debug;
156
};
157 549 markom
 
158 1748 jeremybenn
/*! Data structure for run time data */
159
struct runtime
160
{
161
  struct
162
  {
163
    FILE *fprof;                /* Profiler file */
164
    FILE *fmprof;               /* Memory profiler file */
165
    FILE *fexe_log;             /* RTL state comparison file */
166
    FILE *fout;                 /* file for standard output */
167
    int init;                   /* Whether we are still initilizing sim */
168
    char *filename;             /* Original Command Simulator file (CZ) */
169
    int iprompt;                /* Interactive prompt */
170
    int iprompt_run;            /* Interactive prompt is running */
171
    long long cycles;           /* Cycles counts fetch stages */
172
    long long int end_cycles;   /* JPB. Cycles to end of quantum */
173
    double time_point;          /* JPB. Time point in the simulation */
174
    unsigned long int ext_int;  /* JPB. External interrupt flags */
175 1308 phoenix
 
176 1748 jeremybenn
    int mem_cycles;             /* Each cycle has counter of mem_cycles;
177
                                   this value is joined with cycles
178
                                   at the end of the cycle; no sim
179
                                   originated memory accesses should be
180
                                   performed inbetween. */
181
    int loadcycles;             /* Load and store stalls */
182
    int storecycles;
183 1308 phoenix
 
184 1748 jeremybenn
    long long reset_cycles;
185 1353 nogj
 
186 1748 jeremybenn
    int hush;                   /* Is simulator to do reg dumps */
187
  } sim;
188 1471 nogj
 
189 1748 jeremybenn
  struct
190
  {
191
    long long instructions;     /* Instructions executed */
192
    long long reset_instructions;
193 1471 nogj
 
194 1748 jeremybenn
    int stalled;
195
    int hazardwait;             /* how many cycles were wasted because of hazards */
196
    int supercycles;            /* Superscalar cycles */
197
  } cpu;
198 1353 nogj
 
199 1748 jeremybenn
  struct
200
  {                             /* Verification API, part of Advanced Core Verification */
201
    int enabled;                /* Whether is VAPI module enabled */
202
    FILE *vapi_file;            /* vapi file */
203
    int server_port;            /* A user specified port number for services */
204
  } vapi;
205 1358 nogj
 
206 1748 jeremybenn
/* CUC configuration parameters */
207
  struct
208
  {
209
    int mdelay[4];              /* average memory delays in cycles
210
                                   {read single, read burst, write single, write burst} */
211
    double cycle_duration;      /* in ns */
212
  } cuc;
213
};
214 1360 nogj
 
215 1748 jeremybenn
/*! Union of all possible paramter values */
216
union param_val
217
{
218
  char          *str_val;
219
  int            int_val;
220
  long long int  longlong_val;
221
  oraddr_t       addr_val;
222 1358 nogj
};
223
 
224 1748 jeremybenn
/*! Enum of all possible paramter types */
225
enum param_t
226
{
227
  paramt_none = 0,               /* No parameter */
228
  paramt_str,                   /* String parm enclosed in double quotes (") */
229
  paramt_word,                  /* String parm NOT enclosed in double quotes */
230
  paramt_int,                   /* Integer parameter */
231
  paramt_longlong,              /* Long long int parameter */
232
  paramt_addr                   /* Address parameter */
233 1358 nogj
};
234
 
235 1748 jeremybenn
/* Generic structure for a configuration section */
236
struct config_section
237
{
238 1358 nogj
  char *name;
239 1748 jeremybenn
  void *(*sec_start) (void);
240
  void (*sec_end) (void *);
241 1358 nogj
  void *dat;
242
  struct config_param *params;
243
  struct config_section *next;
244
};
245
 
246 1748 jeremybenn
/* Externally visible data structures*/
247
extern struct config          config;
248
extern struct runtime         runtime;
249
extern struct config_section *cur_section;
250
extern int                    do_stats;
251 1358 nogj
 
252 1748 jeremybenn
/* Prototypes for external use */
253
extern void  set_config_command (int argc, char **argv);
254
extern void  init_defconfig (void);
255
extern int   parse_args (int argc, char *argv[]);
256
extern void  print_config (void);
257
extern void  reg_config_param (struct config_section *sec,
258
                               const char            *param,
259
                               enum param_t           type,
260
                               void (*param_cb)  (union param_val,
261
                                                  void *));
262
extern struct config_section *reg_config_sec (const char *section,
263
                                              void *(*sec_start) (void),
264
                                              void  (*sec_end) (void *));
265 1358 nogj
 
266 1748 jeremybenn
extern void  reg_config_secs ();
267 1358 nogj
 
268 1748 jeremybenn
#endif /* SIM_CONFIG_H */

powered by: WebSVN 2.1.0

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