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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [or1ksim/] [sim-config.h] - Blame information for rev 149

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

Line No. Rev Author Line
1 19 jeremybenn
/* sim-config.h -- Simulator configuration header file
2
 
3
   Copyright (C) 1999 Damjan Lampret, lampret@opencores.org
4
   Copyright (C) 2008 Embecosm Limited
5
 
6
   Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
7
 
8
   This file is part of OpenRISC 1000 Architectural Simulator.
9
 
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
 
23
/* This program is commented throughout in a fashion suitable for processing
24
   with Doxygen. */
25
 
26
 
27
#ifndef SIM_CONFIG_H
28
#define SIM_CONFIG_H
29
 
30
/* System includes */
31
#include <stdio.h>
32
 
33
/* Package includes */
34
#include "arch.h"
35
 
36
/* Simulator configuration macros. Eventually this one will be a lot bigger. */
37
 
38
#define MAX_SBUF_LEN     256    /* Max. length of store buffer */
39
 
40
#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
 
44
#define STR_SIZE         256
45
 
46
/* Number of cycles between checks to runtime.sim.iprompt */
47
#define CHECK_INT_TIME 100000
48
 
49
#define PRINTF(x...) fprintf (runtime.sim.fout, x)
50
 
51
/*! Data structure for configuration data */
52
struct config
53
{
54
  struct
55
  {                             /* External linkage for SystemC */
56 93 jeremybenn
    void  *class_ptr;
57
    int  (*read_up) (void              *class_ptr,
58
                     unsigned long int  addr,
59
                     unsigned char      mask[],
60
                     unsigned char      rdata[],
61
                     int                data_len);
62
    int  (*write_up) (void              *class_ptr,
63
                      unsigned long int  addr,
64
                      unsigned char      mask[],
65
                      unsigned char      wdata[],
66
                      int                data_len);
67 19 jeremybenn
  } ext;
68
 
69
  struct
70
  {
71 143 jeremybenn
    int is_library;             /* Library operation */
72 19 jeremybenn
    int debug;                  /* Simulator debugging */
73
    int verbose;                /* Force verbose output */
74
 
75
    int profile;                /* Is profiler running */
76
    char *prof_fn;              /* Profiler filename */
77
 
78
    int mprofile;               /* Is memory profiler running */
79
    char *mprof_fn;             /* Memory profiler filename */
80
 
81
    int history;                /* instruction stream history analysis */
82
    int exe_log;                /* Print out RTL states? */
83
    int exe_log_type;           /* Type of log */
84
    long long int exe_log_start;        /* First instruction to log */
85
    long long int exe_log_end;  /* Last instr to log, -1 if continuous */
86
    int exe_log_marker;         /* If nonzero, place markers before */
87
    /* each exe_log_marker instructions */
88
    char *exe_log_fn;           /* RTL state comparison filename */
89
    long clkcycle_ps;           /* Clock duration in ps */
90
    int strict_npc;             /* JPB. NPC flushes pipeline when changed */
91
  } sim;
92
 
93
  struct
94
  {                             /* Verification API */
95
    int enabled;                /* Whether is VAPI module enabled */
96
    int server_port;            /* user specified port for services */
97
    int log_enabled;            /* Whether to log the vapi requests */
98
    int hide_device_id;         /* Whether to log dev ID each request */
99
    char *vapi_fn;              /* vapi log filename */
100
  } vapi;
101
 
102
  struct
103
  {
104
    char *timings_fn;           /* Filename of the timing table */
105
    int memory_order;           /* Memory access stricness */
106
    int calling_convention;     /* Do funcs follow std calling conv? */
107
    int enable_bursts;          /* Whether burst are enabled */
108
    int no_multicycle;          /* Generate no multicycle paths */
109
  } cuc;
110
 
111
  struct
112
  {
113
    int superscalar;            /* superscalara analysis */
114
    int hazards;                /* dependency hazards analysis */
115
    int dependstats;            /* dependency statistics */
116
    int sbuf_len;               /* length of store buffer, 0=disabled */
117 100 julius
    int hardfloat;      /* whether hardfloat is enabled */
118 19 jeremybenn
  } cpu;
119
 
120
  struct
121
  {
122
    int enabled;                /* Whether data cache is enabled */
123
    int nways;                  /* Number of DC ways */
124
    int nsets;                  /* Number of DC sets */
125
    int blocksize;              /* DC entry size */
126
    int ustates;                /* number of DC usage states */
127
    int store_missdelay;        /* cycles a store miss costs */
128
    int store_hitdelay;         /* cycles a store hit costs */
129
    int load_missdelay;         /* cycles a load miss costs */
130
    int load_hitdelay;          /* cycles a load hit costs */
131
  } dc;
132
 
133
  struct pic
134
  {
135
    int enabled;                /* Is interrupt controller enabled? */
136
    int edge_trigger;           /* Are interrupts edge triggered? */
137
  } pic;
138
 
139
  struct
140
  {
141
    int enabled;                /* Is power management operational? */
142
  } pm;
143
 
144
  struct
145
  {
146
    int enabled;                /* branch prediction buffer analysis */
147
    int sbp_bnf_fwd;            /* Static BP for l.bnf uses fwd predn */
148
    int sbp_bf_fwd;             /* Static BP for l.bf uses fwd predn */
149
    int btic;                   /* BP target insn cache analysis */
150
    int missdelay;              /* How much cycles does the miss cost */
151
    int hitdelay;               /* How much cycles does the hit cost */
152
  } bpb;
153
 
154
  struct
155
  {
156
    int enabled;                /* Is debug module enabled */
157
    int gdb_enabled;            /* Is legacy debugging with GDB possible */
158
    int rsp_enabled;            /* Is RSP debugging with GDB possible */
159
    int server_port;            /* Port for legacy GDB connection */
160
    int rsp_port;               /* Port for RSP GDB connection */
161
    unsigned long vapi_id;      /* "Fake" vapi dev id for JTAG proxy */
162 82 jeremybenn
    long int  jtagcycle_ps;     /* JTAG clock duration in ps */
163 19 jeremybenn
  } debug;
164
};
165
 
166
/*! Data structure for run time data */
167
struct runtime
168
{
169
  struct
170
  {
171
    FILE *fprof;                /* Profiler file */
172
    FILE *fmprof;               /* Memory profiler file */
173
    FILE *fexe_log;             /* RTL state comparison file */
174
    FILE *fout;                 /* file for standard output */
175
    char *filename;             /* Original Command Simulator file (CZ) */
176
    int iprompt;                /* Interactive prompt */
177
    int iprompt_run;            /* Interactive prompt is running */
178
    long long cycles;           /* Cycles counts fetch stages */
179
    long long int end_cycles;   /* JPB. Cycles to end of quantum */
180
    double time_point;          /* JPB. Time point in the simulation */
181
    unsigned long int ext_int_set;      /* JPB. External interrupts to set */
182
    unsigned long int ext_int_clr;      /* DXL. External interrupts ti clear */
183
 
184
    int mem_cycles;             /* Each cycle has counter of mem_cycles;
185
                                   this value is joined with cycles
186
                                   at the end of the cycle; no sim
187
                                   originated memory accesses should be
188
                                   performed inbetween. */
189
    int loadcycles;             /* Load and store stalls */
190
    int storecycles;
191
 
192
    long long reset_cycles;
193
 
194
    int  hush;                  /* Is simulator to do reg dumps */
195
  } sim;
196
 
197
  struct
198
  {
199 82 jeremybenn
    unsigned int  instr;        /* Current JTAG instruction */
200
    unsigned long int  mod_id;  /* Currently selected module */
201
    int  write_defined_p;       /* WRITE_COMMAND has set details for GO */
202
    unsigned char  acc_type;    /* Access type for GO */
203
    unsigned long int  addr;    /* Address to read/write for GO */
204 98 jeremybenn
    unsigned long int  size;    /* Num bytes to read/write (up to 2^16) */
205 82 jeremybenn
  } debug;
206
 
207
  struct
208
  {
209 19 jeremybenn
    long long instructions;     /* Instructions executed */
210
    long long reset_instructions;
211
 
212
    int stalled;
213 143 jeremybenn
    int halted;                 /* When library hits exit. */
214 19 jeremybenn
    int hazardwait;             /* how many cycles were wasted because of hazards */
215
    int supercycles;            /* Superscalar cycles */
216
  } cpu;
217
 
218
  struct
219
  {                             /* Verification API, part of Advanced Core Verification */
220
    int enabled;                /* Whether is VAPI module enabled */
221
    FILE *vapi_file;            /* vapi file */
222
    int server_port;            /* A user specified port number for services */
223
  } vapi;
224
 
225
/* CUC configuration parameters */
226
  struct
227
  {
228
    int mdelay[4];              /* average memory delays in cycles
229
                                   {read single, read burst, write single, write burst} */
230
    double cycle_duration;      /* in ns */
231
  } cuc;
232
};
233
 
234
/*! Union of all possible paramter values */
235
union param_val
236
{
237
  char          *str_val;
238
  int            int_val;
239
  long long int  longlong_val;
240
  oraddr_t       addr_val;
241
};
242
 
243
/*! Enum of all possible paramter types */
244
enum param_t
245
{
246
  paramt_none = 0,               /* No parameter */
247
  paramt_str,                   /* String parm enclosed in double quotes (") */
248
  paramt_word,                  /* String parm NOT enclosed in double quotes */
249
  paramt_int,                   /* Integer parameter */
250
  paramt_longlong,              /* Long long int parameter */
251
  paramt_addr                   /* Address parameter */
252
};
253
 
254
/* Generic structure for a configuration section */
255
struct config_section
256
{
257
  char *name;
258
  void *(*sec_start) (void);
259
  void (*sec_end) (void *);
260
  void *dat;
261
  struct config_param *params;
262
  struct config_section *next;
263
};
264
 
265
/* Externally visible data structures*/
266
extern struct config          config;
267
extern struct runtime         runtime;
268
extern struct config_section *cur_section;
269
extern int                    do_stats;
270
 
271
/* Prototypes for external use */
272
extern void  set_config_command (int argc, char **argv);
273
extern void  init_defconfig (void);
274
extern int   parse_args (int argc, char *argv[]);
275
extern void  print_config (void);
276
extern void  reg_config_param (struct config_section *sec,
277
                               const char            *param,
278
                               enum param_t           type,
279
                               void (*param_cb)  (union param_val,
280
                                                  void *));
281
extern struct config_section *reg_config_sec (const char *section,
282
                                              void *(*sec_start) (void),
283
                                              void  (*sec_end) (void *));
284
 
285
extern void  reg_config_secs ();
286
 
287
#endif /* SIM_CONFIG_H */

powered by: WebSVN 2.1.0

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