summaryrefslogtreecommitdiff
path: root/sim/root.cc
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2005-06-22 09:59:13 -0400
committerNathan Binkert <binkertn@umich.edu>2005-06-22 09:59:13 -0400
commit91f5736fd3fe989a7d5f3db10070fdedea36e1b4 (patch)
treefd62e362e7024addd0ec893d4fc9a6d19a12e2f8 /sim/root.cc
parent1331a723c3113497deb63d0503ab49709d64b0c2 (diff)
downloadgem5-91f5736fd3fe989a7d5f3db10070fdedea36e1b4.tar.xz
Move max_time and progress_interval parameters to the Root
object and get rid of the ParamContext that each used to have. python/m5/objects/Root.py: Add max_time and progress_interval to the Root object sim/root.cc: Add max_time and progress_interval to the Root object. These parameters used to be in their own contexts in sim_events.cc sim/sim_events.cc: Get rid of the ParamContext for max cycles and the progress event. Move the functionality to the Root object sim/sim_events.hh: Move ProgressEvent declaration to the header so that it can be used in other files. --HG-- extra : convert_revision : ff664b806855e8eb9201b8a25392aa53204464f0
Diffstat (limited to 'sim/root.cc')
-rw-r--r--sim/root.cc27
1 files changed, 25 insertions, 2 deletions
diff --git a/sim/root.cc b/sim/root.cc
index fcfde20d1..17438cf2c 100644
--- a/sim/root.cc
+++ b/sim/root.cc
@@ -36,6 +36,7 @@
#include "base/output.hh"
#include "sim/builder.hh"
#include "sim/host.hh"
+#include "sim/sim_events.hh"
#include "sim/sim_object.hh"
#include "sim/root.hh"
@@ -79,13 +80,33 @@ Tick ps;
// Dummy Object
class Root : public SimObject
{
+ private:
+ Tick max_time;
+ Tick progress_interval;
+
public:
- Root(const std::string &name) : SimObject(name) {}
+ Root(const std::string &name, Tick maxtime, Tick pi)
+ : SimObject(name), max_time(maxtime), progress_interval(pi)
+ {}
+
+ virtual void startup();
};
+void
+Root::startup()
+{
+ if (max_time != 0)
+ new SimExitEvent(curTick + max_time, "reached maximum cycle count");
+
+ if (progress_interval != 0)
+ new ProgressEvent(&mainEventQueue, progress_interval);
+}
+
BEGIN_DECLARE_SIM_OBJECT_PARAMS(Root)
Param<Tick> clock;
+ Param<Tick> max_time;
+ Param<Tick> progress_interval;
Param<string> output_file;
END_DECLARE_SIM_OBJECT_PARAMS(Root)
@@ -93,6 +114,8 @@ END_DECLARE_SIM_OBJECT_PARAMS(Root)
BEGIN_INIT_SIM_OBJECT_PARAMS(Root)
INIT_PARAM(clock, "tick frequency"),
+ INIT_PARAM(max_time, "maximum simulation time"),
+ INIT_PARAM(progress_interval, "print a progress message"),
INIT_PARAM(output_file, "file to dump simulator output to")
END_INIT_SIM_OBJECT_PARAMS(Root)
@@ -106,7 +129,7 @@ CREATE_SIM_OBJECT(Root)
created = true;
outputStream = simout.find(output_file);
- Root *root = new Root(getInstanceName());
+ Root *root = new Root(getInstanceName(), max_time, progress_interval);
using namespace Clock;
Frequency = clock;