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 1718

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 7 jrydberg
   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 672 markom
#define MAX_SBUF_LEN     256          /* Max. length of store buffer */
28 424 markom
 
29 672 markom
#define EXE_LOG_HARDWARE 0            /* Print out RTL states */
30 675 markom
#define EXE_LOG_SIMPLE   1            /* Executed log prints out dissasembly */
31
#define EXE_LOG_SOFTWARE 2            /* Simple with some register output*/
32 672 markom
 
33 239 markom
#define STR_SIZE        (256)
34
 
35 7 jrydberg
struct config {
36 239 markom
  struct {
37 332 markom
    int enabled;                      /* Is tick timer enabled?  */
38
  } tick;
39 1718 nogj
 
40 261 markom
  struct {
41 428 markom
    int enabled;                      /* Whether instruction cache is enabled */
42
    int nways;                        /* Number of IC ways */
43
    int nsets;                        /* Number of IC sets */
44
    int blocksize;                    /* IC entry size */
45
    int ustates;                      /* number of IC usage states */
46 541 markom
    int missdelay;                    /* How much cycles does the miss cost */
47
    int hitdelay;                     /* How much cycles does the hit cost */
48 428 markom
  } ic;
49 424 markom
 
50 263 markom
  struct {
51 541 markom
    int enabled;                      /* Whether data cache is enabled */
52 428 markom
    int nways;                        /* Number of DC ways */
53
    int nsets;                        /* Number of DC sets */
54
    int blocksize;                    /* DC entry size */
55
    int ustates;                      /* number of DC usage states */
56 541 markom
    int store_missdelay;              /* How much cycles does the store miss cost */
57
    int store_hitdelay;               /* How much cycles does the store hit cost */
58
    int load_missdelay;               /* How much cycles does the load miss cost */
59
    int load_hitdelay;                /* How much cycles does the load hit cost */
60 428 markom
  } dc;
61
 
62
  struct {
63 672 markom
    int enabled;                      /* branch prediction buffer analysis */
64
    int sbp_bnf_fwd;                  /* Static branch prediction for l.bnf uses forward prediction */
65
    int sbp_bf_fwd;                   /* Static branch prediction for l.bf uses forward prediction */
66
    int btic;                         /* branch prediction target insn cache analysis */
67
    int missdelay;                    /* How much cycles does the miss cost */
68
    int hitdelay;                     /* How much cycles does the hit cost */
69
#if 0                                 
70
    int nways;                        /* Number of BP ways */
71
    int nsets;                        /* Number of BP sets */
72
    int blocksize;                    /* BP entry size */
73
    int ustates;                      /* number of BP usage states */
74
    int pstates;                      /* number of BP predict states */
75
#endif                                
76
  } bpb;
77
 
78
  struct {
79
    unsigned long upr;                /* Unit present register */
80
    unsigned long ver, rev;           /* Version register */
81
    int sr;                           /* Supervision register */
82
    int superscalar;                  /* superscalara analysis */
83
    int hazards;                      /* dependency hazards analysis */
84
    int dependstats;                  /* dependency statistics */
85
    int sbuf_len;                     /* length of store buffer, zero if disabled */
86
  } cpu;
87
 
88
  struct {
89
    int debug;                        /* Simulator debugging */
90
    int verbose;                      /* Force verbose output */
91
 
92
    int profile;                      /* Is profiler running */
93
    char prof_fn[STR_SIZE];           /* Profiler filename */
94
 
95
    int mprofile;                     /* Is memory profiler running */
96
    char mprof_fn[STR_SIZE];          /* Memory profiler filename */
97
 
98
    int history;                      /* instruction stream history analysis */
99
    int exe_log;                      /* Print out RTL states? */
100
    int exe_log_type;                 /* Type of log */
101 1580 nogj
    long long int exe_log_start;      /* First instruction to log */
102
    long long int exe_log_end;        /* Last instruction to log, -1 if continuous */
103 672 markom
    int exe_log_marker;               /* If nonzero, place markers before each exe_log_marker instructions */
104
    char exe_log_fn[STR_SIZE];        /* RTL state comparison filename */
105 823 ivang
    char fstdout[STR_SIZE];           /* stdout filename */
106 672 markom
    long clkcycle_ps;                 /* Clock duration in ps */
107 805 markom
    long system_kfreq;                /* System frequency in kHz*/
108 672 markom
  } sim;
109
 
110
  struct {
111
    int enabled;                      /* Whether is debug module enabled */
112
    int gdb_enabled;                  /* Whether is debugging with gdb possible */
113
    int server_port;                  /* A user specified port number for services */
114
    unsigned long vapi_id;            /* "Fake" vapi device id for JTAG proxy */
115
  } debug;
116
 
117
  struct {                            /* Verification API, part of Advanced Core Verification */
118
    int enabled;                      /* Whether is VAPI module enabled */
119
    int server_port;                  /* A user specified port number for services */
120
    int log_enabled;                  /* Whether to log the vapi requests */
121
    int hide_device_id;               /* Whether to log device ID for each request */
122
    char vapi_fn[STR_SIZE];           /* vapi log filename */
123
  } vapi;
124
 
125
  struct {
126
    int enabled;                      /* Whether power menagement is operational */
127
  } pm;
128 897 markom
 
129
  struct {
130
    char timings_fn[STR_SIZE];        /* Filename of the timing table */
131
    int memory_order;                 /* Memory access stricness */
132
    int calling_convention;           /* Whether functions follow standard calling convention */
133
    int enable_bursts;                /* Whether burst are enabled */
134
    int no_multicycle;                /* When enabled no multicycle paths are generated */
135
  } cuc;
136 672 markom
};
137
 
138
struct runtime {
139
  struct {
140
    FILE *fprof;                      /* Profiler file */
141
    FILE *fmprof;                     /* Memory profiler file */
142
    FILE *fexe_log;                   /* RTL state comparison file */
143 997 markom
    FILE *fout;                       /* file for standard output */
144 672 markom
    int init;                         /* Whether we are still initilizing sim */
145
    int script_file_specified;        /* Whether script file was already loaded */
146
    char *filename;                   /* Original Command Simulator file (CZ) */
147
    char script_fn[STR_SIZE];         /* Script file read */
148
    int iprompt;                      /* Interactive prompt */
149 1593 nogj
    int iprompt_run;                  /* Interactive prompt is running */
150 1320 phoenix
    long long cycles;                 /* Cycles counts fetch stages */
151 884 markom
 
152
    int mem_cycles;                   /* Each cycle has counter of mem_cycles;
153
                                         this value is joined with cycles
154
                                         at the end of the cycle; no sim
155
                                         originated memory accesses should be
156
                                         performed inbetween. */
157
    int loadcycles;                   /* Load and store stalls */
158
    int storecycles;
159 1320 phoenix
 
160
    long long reset_cycles;
161 1353 nogj
 
162
    int hush;                         /* Is simulator to do reg dumps */
163 264 markom
  } sim;
164 883 markom
 
165
  /* Command line parameters */
166
  struct {
167
    int profile;                      /* Whether profiling was enabled */
168
    int mprofile;                     /* Whether memory profiling was enabled */
169
  } simcmd;
170 557 markom
 
171
  struct {
172 1320 phoenix
    long long instructions;           /* Instructions executed */
173
    long long reset_instructions;
174
 
175 884 markom
    int stalled;
176
    int hazardwait;                   /* how many cycles were wasted because of hazards */
177
    int supercycles;                  /* Superscalar cycles */
178 672 markom
  } cpu;
179
 
180
  struct {                            /* Verification API, part of Advanced Core Verification */
181
    int enabled;                      /* Whether is VAPI module enabled */
182
    FILE *vapi_file;                  /* vapi file */
183
    int server_port;                  /* A user specified port number for services */
184 293 markom
  } vapi;
185 897 markom
 
186
/* CUC configuration parameters */
187
  struct {
188
    int mdelay[4];                  /* average memory delays in cycles
189
                                     {read single, read burst, write single, write burst} */
190
    double cycle_duration;          /* in ns */
191
  } cuc;
192 7 jrydberg
};
193 239 markom
 
194 7 jrydberg
extern struct config config;
195 551 markom
 
196 997 markom
#define PRINTF(x...) fprintf (runtime.sim.fout, x)
197
 
198 361 markom
extern struct runtime runtime;
199 239 markom
 
200
/* Read environment from a script file. Does not fail - assumes defaukt configuration instead. */
201
void read_script_file (char *filename);
202 361 markom
 
203
/* Executes set sim command.  Returns nonzero if error.  */
204 1353 nogj
void set_config_command (int argc, char **argv);
205 428 markom
 
206 1550 nogj
void init_defconfig(void);
207 549 markom
 
208 1308 phoenix
int parse_args(int argc, char *argv[]);
209
 
210 1550 nogj
void print_config(void);
211 1308 phoenix
 
212 1353 nogj
void sim_done(void);
213
 
214 1471 nogj
/* Periodically checks runtime.sim.iprompt to see if ctrl_c has been pressed */
215
void check_int(void *dat);
216
 
217
/* Number of cycles between checks to runtime.sim.iprompt */
218
#define CHECK_INT_TIME 100000
219
 
220 1353 nogj
/* Resets all subunits */
221
void sim_reset(void);
222
 
223
/* Handle the sim commandline */
224
void handle_sim_command(void);
225 1358 nogj
 
226 1360 nogj
/* Registers a new reset hook, called when sim_reset below is called */
227
void reg_sim_reset(void (*reset_hook)(void *), void *dat);
228
 
229 1363 nogj
/* Registers a status printing callback */
230
void reg_sim_stat(void (*stat_func)(void *dat), void *dat);
231
 
232 1358 nogj
union param_val {
233
  char *str_val;
234
  int int_val;
235 1580 nogj
  long long int longlong_val;
236 1358 nogj
  oraddr_t addr_val;
237
};
238
 
239
enum param_t {
240
  paramt_none = 0, /* No parameter */
241
  paramt_str, /* String parameter enclosed in double quotes (") */
242
  paramt_word, /* String parameter NOT enclosed in double quotes */
243
  paramt_int, /* Integer parameter */
244 1580 nogj
  paramt_longlong, /* Long long int parameter */
245 1358 nogj
  paramt_addr /* Address parameter */
246
};
247
 
248
struct config_section {
249
  char *name;
250
  void *(*sec_start)(void);
251
  void (*sec_end)(void *);
252
  void *dat;
253
  struct config_param *params;
254
  struct config_section *next;
255
};
256
 
257
/* Register a parameter in a section of the config file */
258
void reg_config_param(struct config_section *sec, const char *param,
259
                      enum param_t type,
260
                      void (*param_cb)(union param_val, void*));
261
 
262
/* Register a section in the config file */
263
struct config_section *reg_config_sec(const char *section,
264
                                      void *(*sec_start)(void),
265
                                      void (*sec_end)(void *));
266
 
267
extern struct config_section *cur_section;
268
#define CONFIG_ERROR(s) {fprintf (stderr, "ERROR: config.%s:%s\n", cur_section->name, s); if (runtime.sim.init) exit (1);}
269
 
270 1446 nogj
/* FIXME: These will disapeer one day... */
271 1715 nogj
void reg_pic_sec(void);
272 1358 nogj
void reg_mc_sec(void);
273
void reg_uart_sec(void);
274
void reg_dma_sec(void);
275
void reg_memory_sec(void);
276
void reg_debug_sec(void);
277
void reg_vapi_sec(void);
278
void reg_ethernet_sec(void);
279
void reg_immu_sec(void);
280
void reg_dmmu_sec(void);
281
void reg_ic_sec(void);
282
void reg_dc_sec(void);
283
void reg_gpio_sec(void);
284
void reg_bpb_sec(void);
285
void reg_pm_sec(void);
286
void reg_vga_sec(void);
287
void reg_fb_sec(void);
288
void reg_kbd_sec(void);
289
void reg_ata_sec(void);
290
void reg_cuc_sec(void);
291 1557 nogj
void reg_config_secs(void);
292 428 markom
#endif

powered by: WebSVN 2.1.0

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