sim,systemc: Use slightly non-standard constructors for custom create()
Rather than rely on the default create() method being a weak symbol, we can just not have a compliant constructor signature which means we need to (and therefore can) define our own custom create(). Change-Id: I6009d72db0c103b5724d1ba7e20c0bd4a2b761e5 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/42588 Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Earl Ou <shunhsingou@google.com>
This commit is contained in:
@@ -166,7 +166,7 @@ Root::timeSyncSpinThreshold(Time newThreshold)
|
||||
timeSyncEnable(en);
|
||||
}
|
||||
|
||||
Root::Root(const RootParams &p)
|
||||
Root::Root(const RootParams &p, int)
|
||||
: SimObject(p), _enabled(false), _periodTick(p.time_sync_period),
|
||||
syncEvent([this]{ timeSync(); }, name())
|
||||
{
|
||||
@@ -216,5 +216,5 @@ RootParams::create() const
|
||||
FullSystem = full_system;
|
||||
FullSystemInt = full_system ? 1 : 0;
|
||||
|
||||
return new Root(*this);
|
||||
return new Root(*this, 0);
|
||||
}
|
||||
|
||||
@@ -134,7 +134,9 @@ class Root : public SimObject
|
||||
|
||||
PARAMS(Root);
|
||||
|
||||
Root(const Params &p);
|
||||
// The int parameter is ignored, it's just so we can define a custom
|
||||
// create() method.
|
||||
Root(const Params &p, int);
|
||||
|
||||
/** Schedule the timesync event at startup().
|
||||
*/
|
||||
|
||||
@@ -54,7 +54,7 @@ bool Kernel::endOfSimulationComplete() { return endComplete; }
|
||||
sc_core::sc_status Kernel::status() { return _status; }
|
||||
void Kernel::status(sc_core::sc_status s) { _status = s; }
|
||||
|
||||
Kernel::Kernel(const Params ¶ms) :
|
||||
Kernel::Kernel(const Params ¶ms, int) :
|
||||
SimObject(params), t0Event(this, false, EventBase::Default_Pri - 1)
|
||||
{
|
||||
// Install ourselves as the scheduler's event manager.
|
||||
@@ -187,6 +187,6 @@ SystemC_KernelParams::create() const
|
||||
{
|
||||
panic_if(sc_gem5::kernel,
|
||||
"Only one systemc kernel object may be defined.\n");
|
||||
sc_gem5::kernel = new sc_gem5::Kernel(*this);
|
||||
sc_gem5::kernel = new sc_gem5::Kernel(*this, 0);
|
||||
return sc_gem5::kernel;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class Kernel : public SimObject
|
||||
{
|
||||
public:
|
||||
typedef SystemC_KernelParams Params;
|
||||
Kernel(const Params ¶ms);
|
||||
Kernel(const Params ¶ms, int);
|
||||
|
||||
void init() override;
|
||||
void regStats() override;
|
||||
|
||||
Reference in New Issue
Block a user