ext: change McPAT to not force compile in 32-bit mode.
[gem5.git] / ext / mcpat / XML_Parse.h
1 /*****************************************************************************
2 * McPAT
3 * SOFTWARE LICENSE AGREEMENT
4 * Copyright 2012 Hewlett-Packard Development Company, L.P.
5 * All Rights Reserved
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are
9 * met: redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer;
11 * redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution;
14 * neither the name of the copyright holders nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.”
29 *
30 ***************************************************************************/
31
32 #ifndef XML_PARSE_H_
33 #define XML_PARSE_H_
34
35
36 //#ifdef WIN32
37 //#define _CRT_SECURE_NO_DEPRECATE
38 //#endif
39
40 #include <stdio.h>
41 #include <string.h>
42
43 #include <iostream>
44
45 #include "xmlParser.h"
46 using namespace std;
47
48 /*
49 void myfree(char *t); // {free(t);}
50 ToXMLStringTool tx,tx2;
51 */
52 //all subnodes at the level of system.core(0-n)
53 //cache_policy is added into cache property arrays;//0 no write or write-though with non-write allocate;1 write-back with write-allocate
54
55 typedef struct{
56 int prediction_width;
57 char prediction_scheme[20];
58 int predictor_size;
59 int predictor_entries;
60 int local_predictor_size[20];
61 int local_predictor_entries;
62 int global_predictor_entries;
63 int global_predictor_bits;
64 int chooser_predictor_entries;
65 int chooser_predictor_bits;
66 double predictor_accesses;
67 } predictor_systemcore;
68 typedef struct{
69 int number_entries;
70 int cache_policy;//0 no write or write-though with non-write allocate;1 write-back with write-allocate
71 double total_hits;
72 double total_accesses;
73 double total_misses;
74 double conflicts;
75 } itlb_systemcore;
76 typedef struct{
77 //params
78 double icache_config[20];
79 int buffer_sizes[20];
80 int cache_policy;//0 no write or write-though with non-write allocate;1 write-back with write-allocate
81 //stats
82 double total_accesses;
83 double read_accesses;
84 double read_misses;
85 double replacements;
86 double read_hits;
87 double total_hits;
88 double total_misses;
89 double miss_buffer_access;
90 double fill_buffer_accesses;
91 double prefetch_buffer_accesses;
92 double prefetch_buffer_writes;
93 double prefetch_buffer_reads;
94 double prefetch_buffer_hits;
95 double conflicts;
96 } icache_systemcore;
97 typedef struct{
98 //params
99 int number_entries;
100 int cache_policy;//0 no write or write-though with non-write allocate;1 write-back with write-allocate
101 //stats
102 double total_accesses;
103 double read_accesses;
104 double write_accesses;
105 double write_hits;
106 double read_hits;
107 double read_misses;
108 double write_misses;
109 double total_hits;
110 double total_misses;
111 double conflicts;
112 } dtlb_systemcore;
113 typedef struct{
114 //params
115 double dcache_config[20];
116 int buffer_sizes[20];
117 int cache_policy;//0 no write or write-though with non-write allocate;1 write-back with write-allocate
118 //stats
119 double total_accesses;
120 double read_accesses;
121 double write_accesses;
122 double total_hits;
123 double total_misses;
124 double read_hits;
125 double write_hits;
126 double read_misses;
127 double write_misses;
128 double replacements;
129 double write_backs;
130 double miss_buffer_access;
131 double fill_buffer_accesses;
132 double prefetch_buffer_accesses;
133 double prefetch_buffer_writes;
134 double prefetch_buffer_reads;
135 double prefetch_buffer_hits;
136 double wbb_writes;
137 double wbb_reads;
138 double conflicts;
139 } dcache_systemcore;
140 typedef struct{
141 //params
142 int BTB_config[20];
143 //stats
144 double total_accesses;
145 double read_accesses;
146 double write_accesses;
147 double total_hits;
148 double total_misses;
149 double read_hits;
150 double write_hits;
151 double read_misses;
152 double write_misses;
153 double replacements;
154 } BTB_systemcore;
155 typedef struct{
156 //all params at the level of system.core(0-n)
157 int clock_rate;
158 bool opt_local;
159 bool x86;
160 int machine_bits;
161 int virtual_address_width;
162 int physical_address_width;
163 int opcode_width;
164 int micro_opcode_width;
165 int instruction_length;
166 int machine_type;
167 int internal_datapath_width;
168 int number_hardware_threads;
169 int fetch_width;
170 int number_instruction_fetch_ports;
171 int decode_width;
172 int issue_width;
173 int peak_issue_width;
174 int commit_width;
175 int pipelines_per_core[20];
176 int pipeline_depth[20];
177 char FPU[20];
178 char divider_multiplier[20];
179 int ALU_per_core;
180 double FPU_per_core;
181 int MUL_per_core;
182 int instruction_buffer_size;
183 int decoded_stream_buffer_size;
184 int instruction_window_scheme;
185 int instruction_window_size;
186 int fp_instruction_window_size;
187 int ROB_size;
188 int archi_Regs_IRF_size;
189 int archi_Regs_FRF_size;
190 int phy_Regs_IRF_size;
191 int phy_Regs_FRF_size;
192 int rename_scheme;
193 int register_windows_size;
194 char LSU_order[20];
195 int store_buffer_size;
196 int load_buffer_size;
197 int memory_ports;
198 char Dcache_dual_pump[20];
199 int RAS_size;
200 int fp_issue_width;
201 int prediction_width;
202 int number_of_BTB;
203 int number_of_BPT;
204
205 //all stats at the level of system.core(0-n)
206 double total_instructions;
207 double int_instructions;
208 double fp_instructions;
209 double branch_instructions;
210 double branch_mispredictions;
211 double committed_instructions;
212 double committed_int_instructions;
213 double committed_fp_instructions;
214 double load_instructions;
215 double store_instructions;
216 double total_cycles;
217 double idle_cycles;
218 double busy_cycles;
219 double instruction_buffer_reads;
220 double instruction_buffer_write;
221 double ROB_reads;
222 double ROB_writes;
223 double rename_accesses;
224 double fp_rename_accesses;
225 double rename_reads;
226 double rename_writes;
227 double fp_rename_reads;
228 double fp_rename_writes;
229 double inst_window_reads;
230 double inst_window_writes;
231 double inst_window_wakeup_accesses;
232 double inst_window_selections;
233 double fp_inst_window_reads;
234 double fp_inst_window_writes;
235 double fp_inst_window_wakeup_accesses;
236 double fp_inst_window_selections;
237 double archi_int_regfile_reads;
238 double archi_float_regfile_reads;
239 double phy_int_regfile_reads;
240 double phy_float_regfile_reads;
241 double phy_int_regfile_writes;
242 double phy_float_regfile_writes;
243 double archi_int_regfile_writes;
244 double archi_float_regfile_writes;
245 double int_regfile_reads;
246 double float_regfile_reads;
247 double int_regfile_writes;
248 double float_regfile_writes;
249 double windowed_reg_accesses;
250 double windowed_reg_transports;
251 double function_calls;
252 double context_switches;
253 double ialu_accesses;
254 double fpu_accesses;
255 double mul_accesses;
256 double cdb_alu_accesses;
257 double cdb_mul_accesses;
258 double cdb_fpu_accesses;
259 double load_buffer_reads;
260 double load_buffer_writes;
261 double load_buffer_cams;
262 double store_buffer_reads;
263 double store_buffer_writes;
264 double store_buffer_cams;
265 double store_buffer_forwards;
266 double main_memory_access;
267 double main_memory_read;
268 double main_memory_write;
269 double pipeline_duty_cycle;
270
271 double IFU_duty_cycle ;
272 double BR_duty_cycle ;
273 double LSU_duty_cycle ;
274 double MemManU_I_duty_cycle;
275 double MemManU_D_duty_cycle ;
276 double ALU_duty_cycle ;
277 double MUL_duty_cycle ;
278 double FPU_duty_cycle ;
279 double ALU_cdb_duty_cycle ;
280 double MUL_cdb_duty_cycle ;
281 double FPU_cdb_duty_cycle ;
282
283 //all subnodes at the level of system.core(0-n)
284 predictor_systemcore predictor;
285 itlb_systemcore itlb;
286 icache_systemcore icache;
287 dtlb_systemcore dtlb;
288 dcache_systemcore dcache;
289 BTB_systemcore BTB;
290
291 } system_core;
292 typedef struct{
293 //params
294 int Directory_type;
295 double Dir_config[20];
296 int buffer_sizes[20];
297 int clockrate;
298 int ports[20];
299 int device_type;
300 int cache_policy;//0 no write or write-though with non-write allocate;1 write-back with write-allocate
301 char threeD_stack[20];
302 //stats
303 double total_accesses;
304 double read_accesses;
305 double write_accesses;
306 double read_misses;
307 double write_misses;
308 double conflicts;
309 double duty_cycle;
310 } system_L1Directory;
311 typedef struct{
312 //params
313 int Directory_type;
314 double Dir_config[20];
315 int buffer_sizes[20];
316 int clockrate;
317 int ports[20];
318 int device_type;
319 int cache_policy;//0 no write or write-though with non-write allocate;1 write-back with write-allocate
320 char threeD_stack[20];
321 //stats
322 double total_accesses;
323 double read_accesses;
324 double write_accesses;
325 double read_misses;
326 double write_misses;
327 double conflicts;
328 double duty_cycle;
329 } system_L2Directory;
330 typedef struct{
331 //params
332 double L2_config[20];
333 int clockrate;
334 int ports[20];
335 int device_type;
336 int cache_policy;//0 no write or write-though with non-write allocate;1 write-back with write-allocate
337 char threeD_stack[20];
338 int buffer_sizes[20];
339 //stats
340 double total_accesses;
341 double read_accesses;
342 double write_accesses;
343 double total_hits;
344 double total_misses;
345 double read_hits;
346 double write_hits;
347 double read_misses;
348 double write_misses;
349 double replacements;
350 double write_backs;
351 double miss_buffer_accesses;
352 double fill_buffer_accesses;
353 double prefetch_buffer_accesses;
354 double prefetch_buffer_writes;
355 double prefetch_buffer_reads;
356 double prefetch_buffer_hits;
357 double wbb_writes;
358 double wbb_reads;
359 double conflicts;
360 double duty_cycle;
361
362 bool merged_dir;
363 double homenode_read_accesses;
364 double homenode_write_accesses;
365 double homenode_read_hits;
366 double homenode_write_hits;
367 double homenode_read_misses;
368 double homenode_write_misses;
369 double dir_duty_cycle;
370 } system_L2;
371 typedef struct{
372 //params
373 double L3_config[20];
374 int clockrate;
375 int ports[20];
376 int device_type;
377 int cache_policy;//0 no write or write-though with non-write allocate;1 write-back with write-allocate
378 char threeD_stack[20];
379 int buffer_sizes[20];
380 //stats
381 double total_accesses;
382 double read_accesses;
383 double write_accesses;
384 double total_hits;
385 double total_misses;
386 double read_hits;
387 double write_hits;
388 double read_misses;
389 double write_misses;
390 double replacements;
391 double write_backs;
392 double miss_buffer_accesses;
393 double fill_buffer_accesses;
394 double prefetch_buffer_accesses;
395 double prefetch_buffer_writes;
396 double prefetch_buffer_reads;
397 double prefetch_buffer_hits;
398 double wbb_writes;
399 double wbb_reads;
400 double conflicts;
401 double duty_cycle;
402
403 bool merged_dir;
404 double homenode_read_accesses;
405 double homenode_write_accesses;
406 double homenode_read_hits;
407 double homenode_write_hits;
408 double homenode_read_misses;
409 double homenode_write_misses;
410 double dir_duty_cycle;
411 } system_L3;
412 typedef struct{
413 //params
414 int number_of_inputs_of_crossbars;
415 int number_of_outputs_of_crossbars;
416 int flit_bits;
417 int input_buffer_entries_per_port;
418 int ports_of_input_buffer[20];
419 //stats
420 double crossbar_accesses;
421 } xbar0_systemNoC;
422 typedef struct{
423 //params
424 int clockrate;
425 bool type;
426 bool has_global_link;
427 char topology[20];
428 int horizontal_nodes;
429 int vertical_nodes;
430 int link_throughput;
431 int link_latency;
432 int input_ports;
433 int output_ports;
434 int virtual_channel_per_port;
435 int flit_bits;
436 int input_buffer_entries_per_vc;
437 int ports_of_input_buffer[20];
438 int dual_pump;
439 int number_of_crossbars;
440 char crossbar_type[20];
441 char crosspoint_type[20];
442 xbar0_systemNoC xbar0;
443 int arbiter_type;
444 double chip_coverage;
445 //stats
446 double total_accesses;
447 double duty_cycle;
448 double route_over_perc;
449 } system_NoC;
450 typedef struct{
451 //params
452 int mem_tech_node;
453 int device_clock;
454 int peak_transfer_rate;
455 int internal_prefetch_of_DRAM_chip;
456 int capacity_per_channel;
457 int number_ranks;
458 int num_banks_of_DRAM_chip;
459 int Block_width_of_DRAM_chip;
460 int output_width_of_DRAM_chip;
461 int page_size_of_DRAM_chip;
462 int burstlength_of_DRAM_chip;
463 //stats
464 double memory_accesses;
465 double memory_reads;
466 double memory_writes;
467 } system_mem;
468 typedef struct{
469 //params
470 //Common Param for mc and fc
471 double peak_transfer_rate;
472 int number_mcs;
473 bool withPHY;
474 int type;
475
476 //FCParam
477 //stats
478 double duty_cycle;
479 double total_load_perc;
480
481 //McParam
482 int mc_clock;
483 int llc_line_length;
484 int memory_channels_per_mc;
485 int number_ranks;
486 int req_window_size_per_channel;
487 int IO_buffer_size_per_channel;
488 int databus_width;
489 int addressbus_width;
490 bool LVDS;
491
492 //stats
493 double memory_accesses;
494 double memory_reads;
495 double memory_writes;
496 } system_mc;
497
498 typedef struct{
499 //params
500 int clockrate;
501 int number_units;
502 int type;
503 //stats
504 double duty_cycle;
505 double total_load_perc;
506 } system_niu;
507
508 typedef struct{
509 //params
510 int clockrate;
511 int number_units;
512 int num_channels;
513 int type;
514 bool withPHY;
515 //stats
516 double duty_cycle;
517 double total_load_perc;
518 } system_pcie;
519
520 typedef struct{
521 //All number_of_* at the level of 'system' Ying 03/21/2009
522 int number_of_cores;
523 int number_of_L1Directories;
524 int number_of_L2Directories;
525 int number_of_L2s;
526 bool Private_L2;
527 int number_of_L3s;
528 int number_of_NoCs;
529 int number_of_dir_levels;
530 int domain_size;
531 int first_level_dir;
532 // All params at the level of 'system'
533 int homogeneous_cores;
534 int homogeneous_L1Directories;
535 int homogeneous_L2Directories;
536 double core_tech_node;
537 int target_core_clockrate;
538 int target_chip_area;
539 int temperature;
540 int number_cache_levels;
541 int L1_property;
542 int L2_property;
543 int homogeneous_L2s;
544 int L3_property;
545 int homogeneous_L3s;
546 int homogeneous_NoCs;
547 int homogeneous_ccs;
548 int Max_area_deviation;
549 int Max_power_deviation;
550 int device_type;
551 bool longer_channel_device;
552 bool Embedded;
553 bool opt_dynamic_power;
554 bool opt_lakage_power;
555 bool opt_clockrate;
556 bool opt_area;
557 int interconnect_projection_type;
558 int machine_bits;
559 int virtual_address_width;
560 int physical_address_width;
561 int virtual_memory_page_size;
562 double total_cycles;
563 //system.core(0-n):3rd level
564 system_core core[64];
565 system_L1Directory L1Directory[64];
566 system_L2Directory L2Directory[64];
567 system_L2 L2[64];
568 system_L3 L3[64];
569 system_NoC NoC[64];
570 system_mem mem;
571 system_mc mc;
572 system_mc flashc;
573 system_niu niu;
574 system_pcie pcie;
575 } root_system;
576
577 class ParseXML
578 {
579 public:
580 void parse(char* filepath);
581 void initialize();
582 public:
583 root_system sys;
584 };
585
586
587 #endif /* XML_PARSE_H_ */
588
589
590
591