/*
* Copyright (c) 2001-2005 The Regents of The University of Michigan
+ * Copyright (c) 2010 Advanced Micro Devices, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include "base/misc.hh"
#include "base/trace.hh"
#include "base/types.hh"
+#include "debug/Checkpoint.hh"
+#include "sim/probe/probe.hh"
#include "sim/sim_object.hh"
#include "sim/stats.hh"
// SimObject constructor: used to maintain static simObjectList
//
SimObject::SimObject(const Params *p)
- : EventManager(p->eventq), _params(p)
+ : EventManager(getEventQueue(p->eventq_index)), _params(p)
{
#ifdef DEBUG
doDebugBreak = false;
#endif
-
simObjectList.push_back(this);
- state = Running;
+ probeManager = new ProbeManager(this);
}
void
void
SimObject::loadState(Checkpoint *cp)
{
- if (cp->sectionExists(name()))
+ if (cp->sectionExists(name())) {
+ DPRINTF(Checkpoint, "unserializing\n");
unserialize(cp, name());
+ } else {
+ DPRINTF(Checkpoint, "no checkpoint section found\n");
+ }
}
void
}
void
-SimObject::regFormulas()
+SimObject::resetStats()
{
}
+/**
+ * No probe points by default, so do nothing in base.
+ */
void
-SimObject::resetStats()
+SimObject::regProbePoints()
{
}
-//
-// static function: serialize all SimObjects.
-//
+/**
+ * No probe listeners by default, so do nothing in base.
+ */
void
-SimObject::serializeAll(ostream &os)
+SimObject::regProbeListeners()
{
- SimObjectList::reverse_iterator ri = simObjectList.rbegin();
- SimObjectList::reverse_iterator rend = simObjectList.rend();
+}
- for (; ri != rend; ++ri) {
- SimObject *obj = *ri;
- obj->nameOut(os);
- obj->serialize(os);
- }
+ProbeManager *
+SimObject::getProbeManager()
+{
+ return probeManager;
}
+//
+// static function: serialize all SimObjects.
+//
void
-SimObject::unserializeAll(Checkpoint *cp)
+SimObject::serializeAll(std::ostream &os)
{
SimObjectList::reverse_iterator ri = simObjectList.rbegin();
SimObjectList::reverse_iterator rend = simObjectList.rend();
for (; ri != rend; ++ri) {
SimObject *obj = *ri;
- DPRINTFR(Config, "Unserializing '%s'\n",
- obj->name());
- if(cp->sectionExists(obj->name()))
- obj->unserialize(cp, obj->name());
- else
- warn("Not unserializing '%s': no section found in checkpoint.\n",
- obj->name());
+ obj->nameOut(os);
+ obj->serialize(os);
}
}
-
#ifdef DEBUG
//
// static function: flag which objects should have the debugger break
#endif
unsigned int
-SimObject::drain(Event *drain_event)
+SimObject::drain(DrainManager *drain_manager)
{
- state = Drained;
+ setDrainState(Drained);
return 0;
}
-void
-SimObject::resume()
-{
- state = Running;
-}
-
-void
-SimObject::setMemoryMode(State new_mode)
-{
- panic("setMemoryMode() should only be called on systems");
-}
-
-void
-SimObject::switchOut()
-{
- panic("Unimplemented!");
-}
-
-void
-SimObject::takeOverFrom(BaseCPU *cpu)
-{
- panic("Unimplemented!");
-}
-
SimObject *
SimObject::find(const char *name)