}
sc_port_base::sc_port_base(const char *n, int max_size, sc_port_policy p) :
- sc_object(n), _gem5Port(new ::sc_gem5::Port(this, max_size))
+ sc_object(n), _gem5Port(nullptr)
{
if (sc_is_running()) {
reportError("(E110) insert port failed", "simulation running",
} else {
m->ports.push_back(this);
}
+ _gem5Port = new ::sc_gem5::Port(this, max_size);
}
sc_port_base::~sc_port_base()
if (sc_is_running()) {
SC_REPORT_ERROR("(E113) insert primitive channel failed",
"simulation running");
- } else if (::sc_gem5::scheduler.elaborationDone()) {
+ }
+ if (::sc_gem5::scheduler.elaborationDone()) {
SC_REPORT_ERROR("(E113) insert primitive channel failed",
"elaboration done");
- } else {
- _gem5_channel = new sc_gem5::Channel(this);
}
+ _gem5_channel = new sc_gem5::Channel(this);
}
sc_prim_channel::sc_prim_channel(const char *_name) :
if (sc_is_running()) {
SC_REPORT_ERROR("(E113) insert primitive channel failed",
"simulation running");
- } else if (::sc_gem5::scheduler.elaborationDone()) {
+ }
+ if (::sc_gem5::scheduler.elaborationDone()) {
SC_REPORT_ERROR("(E113) insert primitive channel failed",
"elaboration done");
- } else {
- _gem5_channel = new sc_gem5::Channel(this);
}
+ _gem5_channel = new sc_gem5::Channel(this);
}
sc_prim_channel::~sc_prim_channel() { delete _gem5_channel; }