cpu: Support exit when any one Trace CPU completes replay
This change adds a Trace CPU param to exit simulation early, i.e. when the first (any one) trace execution is complete. With this change the user gets a choice to configure exit as either when the last CPU finishes (default) or first CPU finishes replay. Configuring an early exit enables simulating and measuring stats strictly when memory-system resources are being stressed by all Trace CPUs. Change-Id: I3998045fdcc5cd343e1ca92d18dd7f7ecdba8f1d Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
This commit is contained in:
parent
d067327fc0
commit
1fe5f63137
3 changed files with 32 additions and 6 deletions
|
@ -75,3 +75,8 @@ class TraceCPU(BaseCPU):
|
||||||
# frequency as was used for generating the traces.
|
# frequency as was used for generating the traces.
|
||||||
freqMultiplier = Param.Float(1.0, "Multiplier scale the Trace CPU "\
|
freqMultiplier = Param.Float(1.0, "Multiplier scale the Trace CPU "\
|
||||||
"frequency up or down")
|
"frequency up or down")
|
||||||
|
|
||||||
|
# Enable exiting when any one Trace CPU completes execution which is set to
|
||||||
|
# false by default
|
||||||
|
enableEarlyExit = Param.Bool(False, "Exit when any one Trace CPU "\
|
||||||
|
"completes execution")
|
||||||
|
|
|
@ -61,7 +61,8 @@ TraceCPU::TraceCPU(TraceCPUParams *params)
|
||||||
dcacheNextEvent(this),
|
dcacheNextEvent(this),
|
||||||
oneTraceComplete(false),
|
oneTraceComplete(false),
|
||||||
traceOffset(0),
|
traceOffset(0),
|
||||||
execCompleteEvent(nullptr)
|
execCompleteEvent(nullptr),
|
||||||
|
enableEarlyExit(params->enableEarlyExit)
|
||||||
{
|
{
|
||||||
// Increment static counter for number of Trace CPUs.
|
// Increment static counter for number of Trace CPUs.
|
||||||
++TraceCPU::numTraceCPUs;
|
++TraceCPU::numTraceCPUs;
|
||||||
|
@ -137,10 +138,16 @@ TraceCPU::init()
|
||||||
// events using a relative tick delta
|
// events using a relative tick delta
|
||||||
dcacheGen.adjustInitTraceOffset(traceOffset);
|
dcacheGen.adjustInitTraceOffset(traceOffset);
|
||||||
|
|
||||||
// The static counter for number of Trace CPUs is correctly set at this
|
// If the Trace CPU simulation is configured to exit on any one trace
|
||||||
// point so create an event and pass it.
|
// completion then we don't need a counted event to count down all Trace
|
||||||
execCompleteEvent = new CountedExitEvent("end of all traces reached.",
|
// CPUs in the system. If not then instantiate a counted event.
|
||||||
numTraceCPUs);
|
if (!enableEarlyExit) {
|
||||||
|
// The static counter for number of Trace CPUs is correctly set at
|
||||||
|
// this point so create an event and pass it.
|
||||||
|
execCompleteEvent = new CountedExitEvent("end of all traces reached.",
|
||||||
|
numTraceCPUs);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -191,7 +198,15 @@ TraceCPU::checkAndSchedExitEvent()
|
||||||
// Schedule event to indicate execution is complete as both
|
// Schedule event to indicate execution is complete as both
|
||||||
// instruction and data access traces have been played back.
|
// instruction and data access traces have been played back.
|
||||||
inform("%s: Execution complete.\n", name());
|
inform("%s: Execution complete.\n", name());
|
||||||
schedule(*execCompleteEvent, curTick());
|
// If the replay is configured to exit early, that is when any one
|
||||||
|
// execution is complete then exit immediately and return. Otherwise,
|
||||||
|
// schedule the counted exit that counts down completion of each Trace
|
||||||
|
// CPU.
|
||||||
|
if (enableEarlyExit) {
|
||||||
|
exitSimLoop("End of trace reached");
|
||||||
|
} else {
|
||||||
|
schedule(*execCompleteEvent, curTick());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1116,6 +1116,12 @@ class TraceCPU : public BaseCPU
|
||||||
*/
|
*/
|
||||||
CountedExitEvent *execCompleteEvent;
|
CountedExitEvent *execCompleteEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exit when any one Trace CPU completes its execution. If this is
|
||||||
|
* configured true then the execCompleteEvent is not scheduled.
|
||||||
|
*/
|
||||||
|
const bool enableEarlyExit;
|
||||||
|
|
||||||
Stats::Scalar numSchedDcacheEvent;
|
Stats::Scalar numSchedDcacheEvent;
|
||||||
Stats::Scalar numSchedIcacheEvent;
|
Stats::Scalar numSchedIcacheEvent;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue