From b331c1a7969efe1835c37ebca7fe138cd5dcc9bf Mon Sep 17 00:00:00 2001 From: Svilen Kanev Date: Sun, 7 Apr 2013 13:31:12 -0400 Subject: [PATCH] Actually create dvfs controller. --- sim-slave.cpp | 4 ++++ zesto-core.cpp | 7 ++++--- zesto-core.h | 2 ++ zesto-opts.cpp | 4 ++++ zesto-structs.h | 1 + zesto-uncore.cpp | 3 ++- 6 files changed, 17 insertions(+), 4 deletions(-) diff --git a/sim-slave.cpp b/sim-slave.cpp index 7650a15..420f84a 100644 --- a/sim-slave.cpp +++ b/sim-slave.cpp @@ -108,6 +108,7 @@ #include "zesto-uncore.h" #include "zesto-MC.h" #include "zesto-power.h" +#include "zesto-dvfs.h" #include "interface.h" #include "synchronization.h" @@ -339,6 +340,7 @@ sim_post_init(void) cores[i]->decode = decode_create(knobs.model,cores[i]); cores[i]->fetch = fetch_create(knobs.model,cores[i]); cores[i]->power = power_create(knobs.model,cores[i]); + cores[i]->vf_controller = vf_controller_create(knobs.dvfs_opt_str,cores[i]); } min_coreID = 0; @@ -432,6 +434,8 @@ void sim_main_slave_pre_pin(int coreID) cores[coreID]->sim_cycle++; cores[coreID]->ns_passed += 1e-3 / cores[coreID]->cpu_speed; + + fprintf(stderr, "%.3f %.3f\n", cores[coreID]->ns_passed * 1e9, (1e6 / LLC_speed)); } /* Time to sync with uncore */ diff --git a/zesto-core.cpp b/zesto-core.cpp index 618acb2..6e9cb0c 100644 --- a/zesto-core.cpp +++ b/zesto-core.cpp @@ -82,11 +82,12 @@ seq_t core_t::global_seq = 0; /* CONSTRUCTOR */ core_t::core_t(const int core_id): - knobs(NULL), current_thread(NULL), id(core_id), + knobs(NULL), current_thread(NULL), id(core_id), ns_passed(0.0), num_emergency_recoveries(0), last_emergency_recovery_count(0), oracle(NULL), fetch(NULL), decode(NULL), alloc(NULL), - exec(NULL), commit(NULL), global_action_id(0), - num_signals_in_pipe(0) + exec(NULL), commit(NULL), num_signals_in_pipe(0), + global_action_id(0) + { memzero(&memory,sizeof(memory)); memzero(&stat,sizeof(stat)); diff --git a/zesto-core.h b/zesto-core.h index f121a2d..8596bfc 100644 --- a/zesto-core.h +++ b/zesto-core.h @@ -211,6 +211,8 @@ class core_t { class repeater_t * mem_repeater; } memory; + class vf_controller_t * vf_controller; + /**********************/ /* VARIOUS STATISTICS */ /**********************/ diff --git a/zesto-opts.cpp b/zesto-opts.cpp index 9c5be9b..b4fe9ca 100644 --- a/zesto-opts.cpp +++ b/zesto-opts.cpp @@ -178,6 +178,10 @@ sim_reg_options(struct opt_odb_t *odb) uncore_reg_options(odb); dram_reg_options(odb); repeater_reg_options(odb); + + opt_reg_string(odb, "-dvfs", "dvfs controller configuration string", + &knobs.dvfs_opt_str, /* default */"none", /* print */true, /* format */NULL); + } /* check simulator-specific option values */ diff --git a/zesto-structs.h b/zesto-structs.h index 6ed6876..4e15312 100644 --- a/zesto-structs.h +++ b/zesto-structs.h @@ -325,6 +325,7 @@ struct core_knobs_t { const char * model; double default_cpu_speed; /* in MHz */ + const char * dvfs_opt_str; struct { int byteQ_size; diff --git a/zesto-uncore.cpp b/zesto-uncore.cpp index b158691..2614ad8 100644 --- a/zesto-uncore.cpp +++ b/zesto-uncore.cpp @@ -132,7 +132,6 @@ uncore_t::uncore_t( const char * MC_opt_string) : fsb_speed(arg_fsb_speed), fsb_DDR(arg_fsb_DDR), - sim_cycle(0), total_sim_time(0.0) { /* temp variables for option-string parsing */ @@ -274,6 +273,8 @@ uncore_reg_options(struct opt_odb_t * const odb) void uncore_reg_stats(struct stat_sdb_t * const sdb) { stat_reg_note(sdb,"\n#### LAST-LEVEL CACHE STATS ####"); + stat_reg_counter(sdb, true, "uncore.sim_cycle", "number of uncore cycles simulated", &uncore->sim_cycle, 0, TRUE, NULL); + LLC_reg_stats(sdb, uncore->LLC); bus_reg_stats(sdb, NULL, uncore->LLC_bus);