forked from s-kanev/XIOSim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzesto-config.h
152 lines (140 loc) · 5.1 KB
/
zesto-config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/* Read Zesto configuration file and store settings in the knobs structure.
*
* Cache, TLB, and prefetcher configurations are identical from an attributes
* perspective. However, they differ in their default values. Therefore, each
* such structure has its own specification.
*
* Author: Sam Xi
*/
#ifndef __ZESTO_CONFIG_H__
#define __ZESTO_CONFIG_H__
#include "machine.h" // Make sure this doesn't interfere with boost interprocess.
#include "confuse.h"
#include "zesto-structs.h"
// Global configuration variables. This might become unnecessary if I move all
// the functions into their original files.
extern int num_cores;
extern int heartbeat_frequency;
extern const char* ztrace_filename;
extern bool simulate_power;
extern int rand_seed;
#ifdef DEBUG
extern bool debugging;
#endif
extern const char* sim_simout;
extern const char * LLC_opt_str;
extern const char * LLC_PF_opt_str[MAX_PREFETCHERS];
extern const char * LLC_MSHR_cmd;
extern const char * LLC_controller_str;
extern const char * MC_opt_string;
// Static
extern float LLC_magic_hit_rate;
extern int LLC_num_PF;
extern int LLC_PFFsize;
extern int LLC_PFthresh;
extern int LLC_PFmax;
extern int LLC_PF_buffer_size;
extern int LLC_PF_filter_size;
extern int LLC_PF_filter_reset;
extern int LLC_WMinterval;
extern bool LLC_PF_on_miss;
extern double LLC_low_watermark;
extern double LLC_high_watermark;
extern int fsb_width;
extern bool fsb_DDR;
extern double fsb_speed;
extern double LLC_speed;
extern bool fsb_magic;
extern const char* dram_opt_string;
// Declaration of all configuration parameters.
extern cfg_t *all_opts;
extern cfg_opt_t system_cfg[];
extern cfg_opt_t iprefetch_cfg[];
extern cfg_opt_t itlb_cfg[];
extern cfg_opt_t icache_cfg[];
extern cfg_opt_t dprefetch_cfg[];
extern cfg_opt_t dtlb_cfg[];
extern cfg_opt_t d2tlb_cfg[];
extern cfg_opt_t dcache_cfg[];
extern cfg_opt_t l2prefetch_cfg[];
extern cfg_opt_t l2cache_cfg[];
extern cfg_opt_t llcprefetch_cfg[];
extern cfg_opt_t llccache_cfg[];
extern cfg_opt_t byte_queue_cfg[];
extern cfg_opt_t predecode_cfg[];
extern cfg_opt_t branch_pred_cfg[];
extern cfg_opt_t fetch_cfg[];
extern cfg_opt_t uop_fusion_cfg[];
extern cfg_opt_t decode_cfg[];
extern cfg_opt_t alloc_cfg[];
extern cfg_opt_t repeater_cfg[];
extern cfg_opt_t exeu_cfg[];
extern cfg_opt_t exec_cfg[];
extern cfg_opt_t commit_cfg[];
extern cfg_opt_t core_cfg[];
extern cfg_opt_t fsb_cfg[];
extern cfg_opt_t dram_cfg[];
extern cfg_opt_t dvfs_cfg[];
extern cfg_opt_t scheduler_cfg[];
extern cfg_opt_t uncore_cfg[];
extern cfg_opt_t top_level_cfg[];
/* Entry point for parsing Zesto configuration file. This function expects the
* Zesto configuration file path to be in the flag "-config". Options are
* stored in the knobs struct.
*/
int read_config_file(int argc, const char* argv[], core_knobs_t* knobs);
/* Primary pipeline configuration function declarations. */
void store_system_options(cfg_t *system_opt, core_knobs_t *knobs);
void store_core_options(cfg_t *core_opt, core_knobs_t *knobs);
void store_fetch_options(cfg_t *fetch_opt, core_knobs_t *knobs);
void store_decode_options(cfg_t *decode_opt, core_knobs_t *knobs);
void store_alloc_options(cfg_t *alloc_opt, core_knobs_t *knobs);
void store_exec_stage_options(cfg_t *exec_opt, core_knobs_t *knobs);
void store_commit_options(cfg_t *commit_opt, core_knobs_t* knobs);
void store_uncore_options(cfg_t *uncore_opt, core_knobs_t *knobs);
/* Execution units consist of an execution latency, issue rate, and a set of
* port bindings. This function parses the list of port bindings in the
* configuration and copies the values into the appropriate knob, as well as
* setting the other two parameters.
*
* Params:
* @exec_cfg: Execution stage config.
* @exeu_name: Execution unit name.
* @fu_type: Functional unit type, enumerated in md_fu_class.
* @knobs: Configuration knobs.
*/
void store_execution_unit_options(cfg_t *exec_cfg,
const char* exeu_name,
md_fu_class fu_type,
core_knobs_t *knobs);
/* Stores an int list config value into a preallocated array.
*
* Params:
* @cfg: cfg_t object holding the config value.
* @attr_name: Name of the configuration parameter.
* @target: Preallocated int array of size @max_entries.
* @num_entries: Pointer to an int where the number of values read will be
* stored.
* @max_entries: Maximum number of entries to store.
*/
void store_int_list(cfg_t* cfg,
const char* attr_name,
int* target,
int* num_entries,
int max_entries);
/* Stores an string list config value into a preallocated array.
*
* Params:
* @cfg: cfg_t object holding the config value.
* @attr_name: Name of the configuration parameter.
* @target: Preallocated string array of size @max_entries.
* @num_entries: Pointer to an int where the number of values read will be
* stored.
* @max_entries: Maximum number of entries to store.
*/
void store_str_list(cfg_t* cfg,
const char* attr_name,
const char* target[],
int* num_entries,
int max_entries);
#endif