32a33,34
> #include "systemc/core/scheduler.hh"
> #include "systemc/ext/core/sc_main.hh"
37a40,57
> namespace
> {
>
> void
> reportError(const char *id, const char *add_msg,
> const char *name, const char *kind)
> {
> std::string msg;
> if (add_msg)
> msg = csprintf("%s: port '%s' (%s)", add_msg, name, kind);
> else
> msg = csprintf("port '%s' (%s)", name, kind);
>
> SC_REPORT_ERROR(id, msg.c_str());
> }
>
> }
>
40a61,69
> if (sc_is_running()) {
> reportError("(E110) insert port failed", "simulation running",
> name, kind());
> }
> if (::sc_gem5::scheduler.elaborationDone()) {
> reportError("(E110) insert port failed", "elaboration done",
> name, kind());
> }
>
42c71,76
< m->ports.push_back(this);
---
> if (!m) {
> reportError("(E100) port specified outside of module",
> nullptr, name, kind());
> } else {
> m->ports.push_back(this);
> }