summaryrefslogtreecommitdiff
path: root/util/systemc/main.cc
diff options
context:
space:
mode:
authorAbdul Mutaal Ahmad <abdul.mutaal@gmail.com>2015-12-04 17:20:07 -0600
committerAbdul Mutaal Ahmad <abdul.mutaal@gmail.com>2015-12-04 17:20:07 -0600
commit0707f4ee63688e7ed87726cd90f8f8f1ab370d10 (patch)
treeba7ff3d7916885ed972e6785eeda3b1c557c0d92 /util/systemc/main.cc
parent1a34e23603441cf123db0218308f136f44986e73 (diff)
downloadgem5-0707f4ee63688e7ed87726cd90f8f8f1ab370d10.tar.xz
util: DrainManager/Checkpoint changes in SystemC coupling
Due to changes in Drain Manager, the lastest systemc coupling doesn't work. The code for handling Checkpoint has been modified and it is now compatiable with new drain manager. Testing is being done on systemC coupling. It needs more testing to verify checkpointing feature. Committed by: Nilay Vaish <nilay@cs.wisc.edu>
Diffstat (limited to 'util/systemc/main.cc')
-rw-r--r--util/systemc/main.cc25
1 files changed, 16 insertions, 9 deletions
diff --git a/util/systemc/main.cc b/util/systemc/main.cc
index f4c7b6305..75a77853b 100644
--- a/util/systemc/main.cc
+++ b/util/systemc/main.cc
@@ -35,6 +35,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Authors: Andrew Bardsley
+ * Abdul Mutaal Ahmad
*/
/**
@@ -243,6 +244,11 @@ SimControl::SimControl(sc_core::sc_module_name name,
fatal("Config problem in sim object %s: %s", e.name, e.message);
}
+ if (checkpoint_save && checkpoint_restore) {
+ fatal("Don't try to save and restore a checkpoint in the same"
+ "run");
+ }
+
CxxConfig::statsEnable();
getEventQueue(0)->dump();
@@ -266,13 +272,17 @@ void SimControl::run()
if (checkpoint_restore) {
std::cerr << "Restoring checkpoint\n";
- Checkpoint *checkpoint = new Checkpoint(checkpoint_dir,
+ CheckpointIn *checkpoint = new CheckpointIn(checkpoint_dir,
config_manager->getSimObjectResolver());
/* Catch SystemC up with gem5 after checkpoint restore.
* Note that gem5 leading SystemC is always a violation of the
* required relationship between the two, hence this careful
* catchup */
+
+ DrainManager::instance().preCheckpointRestore();
+ Serializable::unserializeGlobals(*checkpoint);
+
Tick systemc_time = sc_core::sc_time_stamp().value();
if (curTick() > systemc_time) {
Tick wait_period = curTick() - systemc_time;
@@ -282,9 +292,11 @@ void SimControl::run()
wait(sc_core::sc_time(wait_period, sc_core::SC_PS));
}
- config_manager->loadState(checkpoint);
+ config_manager->loadState(*checkpoint);
config_manager->startup();
config_manager->drainResume();
+
+ std::cerr << "Restored from Checkpoint\n";
} else {
config_manager->initState();
config_manager->startup();
@@ -298,16 +310,13 @@ void SimControl::run()
if (checkpoint_save) {
exit_event = simulate(pre_run_time);
- DrainManager drain_manager;
-
unsigned int drain_count = 1;
do {
- drain_count = config_manager->drain(&drain_manager);
+ drain_count = config_manager->drain();
std::cerr << "Draining " << drain_count << '\n';
if (drain_count > 0) {
- drain_manager.setCount(drain_count);
exit_event = simulate();
}
} while (drain_count > 0);
@@ -337,15 +346,13 @@ void SimControl::run()
BaseCPU &old_cpu = config_manager->getObject<BaseCPU>(from_cpu);
BaseCPU &new_cpu = config_manager->getObject<BaseCPU>(to_cpu);
- DrainManager drain_manager;
unsigned int drain_count = 1;
do {
- drain_count = config_manager->drain(&drain_manager);
+ drain_count = config_manager->drain();
std::cerr << "Draining " << drain_count << '\n';
if (drain_count > 0) {
- drain_manager.setCount(drain_count);
exit_event = simulate();
}
} while (drain_count > 0);