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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [or1ksim/] [sim-config.h] - Blame information for rev 1782

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
/*! 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 897 markom
 
65 1748 jeremybenn
  struct
66
  {
67
    int debug;                  /* Simulator debugging */
68
    int verbose;                /* Force verbose output */
69 884 markom
 
70 1748 jeremybenn
    int profile;                /* Is profiler running */
71
    char *prof_fn;              /* Profiler filename */
72 1320 phoenix
 
73 1748 jeremybenn
    int mprofile;               /* Is memory profiler running */
74
    char *mprof_fn;             /* Memory profiler filename */
75 1353 nogj
 
76 1748 jeremybenn
    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 1756 jeremybenn
    int strict_npc;             /* JPB. NPC flushes pipeline when changed */
86 264 markom
  } sim;
87 883 markom
 
88 1748 jeremybenn
  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 293 markom
  } vapi;
96 1748 jeremybenn
 
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 897 markom
  } cuc;
105 239 markom
 
106 1748 jeremybenn
  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 551 markom
 
114 1748 jeremybenn
  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 997 markom
 
127 1748 jeremybenn
  struct pic
128
  {
129
    int enabled;                /* Is interrupt controller enabled? */
130
    int edge_trigger;           /* Are interrupts edge triggered? */
131
  } pic;
132 239 markom
 
133 1748 jeremybenn
  struct
134
  {
135
    int enabled;                /* Is power management operational? */
136
  } pm;
137 361 markom
 
138 1748 jeremybenn
  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 428 markom
 
148 1748 jeremybenn
  struct
149
  {
150
    int enabled;                /* Is debug module enabled */
151 1751 jeremybenn
    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 1748 jeremybenn
    unsigned long vapi_id;      /* "Fake" vapi dev id for JTAG proxy */
156
  } debug;
157
};
158 549 markom
 
159 1748 jeremybenn
/*! Data structure for run time data */
160
struct runtime
161
{
162
  struct
163
  {
164
    FILE *fprof;                /* Profiler file */
165
    FILE *fmprof;               /* Memory profiler file */
166
    FILE *fexe_log;             /* RTL state comparison file */
167
    FILE *fout;                 /* file for standard output */
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 1756 jeremybenn
    unsigned long int ext_int_set;      /* JPB. External interrupts to set */
175
    unsigned long int ext_int_clr;      /* DXL. External interrupts ti clear */
176 1308 phoenix
 
177 1748 jeremybenn
    int mem_cycles;             /* Each cycle has counter of mem_cycles;
178
                                   this value is joined with cycles
179
                                   at the end of the cycle; no sim
180
                                   originated memory accesses should be
181
                                   performed inbetween. */
182
    int loadcycles;             /* Load and store stalls */
183
    int storecycles;
184 1308 phoenix
 
185 1748 jeremybenn
    long long reset_cycles;
186 1353 nogj
 
187 1751 jeremybenn
    int  hush;                  /* Is simulator to do reg dumps */
188 1748 jeremybenn
  } sim;
189 1471 nogj
 
190 1748 jeremybenn
  struct
191
  {
192
    long long instructions;     /* Instructions executed */
193
    long long reset_instructions;
194 1471 nogj
 
195 1748 jeremybenn
    int stalled;
196
    int hazardwait;             /* how many cycles were wasted because of hazards */
197
    int supercycles;            /* Superscalar cycles */
198
  } cpu;
199 1353 nogj
 
200 1748 jeremybenn
  struct
201
  {                             /* Verification API, part of Advanced Core Verification */
202
    int enabled;                /* Whether is VAPI module enabled */
203
    FILE *vapi_file;            /* vapi file */
204
    int server_port;            /* A user specified port number for services */
205
  } vapi;
206 1358 nogj
 
207 1748 jeremybenn
/* CUC configuration parameters */
208
  struct
209
  {
210
    int mdelay[4];              /* average memory delays in cycles
211
                                   {read single, read burst, write single, write burst} */
212
    double cycle_duration;      /* in ns */
213
  } cuc;
214
};
215 1360 nogj
 
216 1748 jeremybenn
/*! Union of all possible paramter values */
217
union param_val
218
{
219
  char          *str_val;
220
  int            int_val;
221
  long long int  longlong_val;
222
  oraddr_t       addr_val;
223 1358 nogj
};
224
 
225 1748 jeremybenn
/*! Enum of all possible paramter types */
226
enum param_t
227
{
228
  paramt_none = 0,               /* No parameter */
229
  paramt_str,                   /* String parm enclosed in double quotes (") */
230
  paramt_word,                  /* String parm NOT enclosed in double quotes */
231
  paramt_int,                   /* Integer parameter */
232
  paramt_longlong,              /* Long long int parameter */
233
  paramt_addr                   /* Address parameter */
234 1358 nogj
};
235
 
236 1748 jeremybenn
/* Generic structure for a configuration section */
237
struct config_section
238
{
239 1358 nogj
  char *name;
240 1748 jeremybenn
  void *(*sec_start) (void);
241
  void (*sec_end) (void *);
242 1358 nogj
  void *dat;
243
  struct config_param *params;
244
  struct config_section *next;
245
};
246
 
247 1748 jeremybenn
/* Externally visible data structures*/
248
extern struct config          config;
249
extern struct runtime         runtime;
250
extern struct config_section *cur_section;
251
extern int                    do_stats;
252 1358 nogj
 
253 1748 jeremybenn
/* Prototypes for external use */
254
extern void  set_config_command (int argc, char **argv);
255
extern void  init_defconfig (void);
256
extern int   parse_args (int argc, char *argv[]);
257
extern void  print_config (void);
258
extern void  reg_config_param (struct config_section *sec,
259
                               const char            *param,
260
                               enum param_t           type,
261
                               void (*param_cb)  (union param_val,
262
                                                  void *));
263
extern struct config_section *reg_config_sec (const char *section,
264
                                              void *(*sec_start) (void),
265
                                              void  (*sec_end) (void *));
266 1358 nogj
 
267 1748 jeremybenn
extern void  reg_config_secs ();
268 1358 nogj
 
269 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.