/*
- * Copyright (c) 2003 The Regents of The University of Michigan
+ * Copyright (c) 2001-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include <iostream>
#include "sim/serialize.hh"
+#include "sim/startup.hh"
/*
* Abstract superclass for simulation objects. Represents things that
* correspond to physical components and can be specified via the
* config file (CPUs, caches, etc.).
*/
-class SimObject : public Serializable
+class SimObject : public Serializable, protected StartupCallback
{
+ public:
+ struct Params {
+ std::string name;
+ };
+
protected:
- std::string objName;
+ Params *_params;
+
+ public:
+ const Params *params() const { return _params; }
private:
friend class Serializer;
static SimObjectList simObjectList;
public:
+ SimObject(Params *_params);
SimObject(const std::string &_name);
virtual ~SimObject() {}
- virtual const std::string name() const { return objName; }
+ virtual const std::string name() const { return params()->name; }
- // initialization pass of all objects. Gets invoked by SimInit()
+ // initialization pass of all objects.
+ // Gets invoked after construction, before unserialize.
virtual void init();
static void initAll();
virtual void regFormulas();
virtual void resetStats();
- // print extra results for this object not covered by registered
- // statistics (called at end of simulation)
- virtual void printExtraOutput(std::ostream&);
-
// static: call reg_stats on all SimObjects
static void regAllStats();
// static: call resetStats on all SimObjects
static void resetAllStats();
- // static: call printExtraOutput on all SimObjects
- static void printAllExtraOutput(std::ostream&);
-
// static: call nameOut() & serialize() on all SimObjects
static void serializeAll(std::ostream &);
+
+#ifdef DEBUG
+ public:
+ bool doDebugBreak;
+ static void debugObjectBreak(const std::string &objs);
+#endif
+
+ public:
+ bool doRecordEvent;
+ void recordEvent(const std::string &stat);
};
#endif // __SIM_OBJECT_HH__