/*
- * Copyright (c) 2002-2004 The Regents of The University of Michigan
+ * Copyright (c) 2002-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include "sim/param.hh"
#include "sim/sim_events.hh"
#include "sim/sim_exit.hh"
-#include "sim/sim_init.hh"
+#include "sim/startup.hh"
#include "sim/stats.hh"
using namespace std;
return "check swap";
}
-
-///////////////////////////////////////////////////
-//
-// Simulation termination parameters
-//
-///////////////////////////////////////////////////
-
-class TermParamContext : public ParamContext
-{
- public:
- TermParamContext(const string &_iniSection)
- : ParamContext(_iniSection) {}
- void checkParams();
-};
-
-TermParamContext simTerminationParams("max");
-
-Param<Tick> max_cycle(&simTerminationParams, "cycle",
- "maximum number of cycles to execute");
-
-void
-TermParamContext::checkParams()
-{
- // if a max cycle count was specified, put a termination event on
- // the event queue at that point
- if (max_cycle.isValid())
- new SimExitEvent(max_cycle, "reached maximum cycle count");
-}
-
-//
-// Progress event: print out cycle every so often so we know we're
-// making forward progress.
-//
-class ProgressEvent : public Event
-{
- protected:
- Tick interval;
-
- public:
- ProgressEvent(EventQueue *q, Tick interval);
-
- void process(); // process event
- virtual const char *description();
-};
-
-//
-// constructor: schedule at specified time
-//
-ProgressEvent::ProgressEvent(EventQueue *q, Tick _interval)
- : Event(q), interval(_interval)
-{
- schedule(curTick + interval);
-}
-
//
// handle progress event: print message and reschedule
//
{
return "progress message";
}
-
-/////////
-//
-// Periodic progress message support: print out a message every n
-// cycles so we know we're making forward progress.
-//
-/////////
-
-// Parameter space for execution address tracing options. Derive
-// from ParamContext so we can override checkParams() function.
-class ProgressParamContext : public ParamContext
-{
- public:
- ProgressParamContext(const string &_iniSection)
- : ParamContext(_iniSection) {}
- void checkParams();
-};
-
-ProgressParamContext progessMessageParams("progress");
-
-Param<Tick> progress_interval(&progessMessageParams, "cycle",
- "cycle interval for progress messages");
-
-namespace {
- struct SetupProgress : public Callback
- {
- Tick interval;
- SetupProgress(Tick tick) : interval(tick) {}
-
- virtual void process()
- {
- new ProgressEvent(&mainEventQueue, interval);
- delete this;
- }
- };
-}
-
-/* check execute options */
-void
-ProgressParamContext::checkParams()
-{
- if (progress_interval.isValid())
- registerInitCallback(new SetupProgress(progress_interval));
-}