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 86

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

powered by: WebSVN 2.1.0

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