{
if (sc_is_running()) {
reportError("(E121) insert sc_export failed", "simulation running",
- n, kind());
+ name(), kind());
}
if (::sc_gem5::scheduler.elaborationDone()) {
reportError("(E121) insert sc_export failed", "elaboration done",
- n, kind());
+ name(), kind());
}
::sc_gem5::Module *m = ::sc_gem5::currentModule();
if (!m) {
reportError("(E122) sc_export specified outside of module",
- nullptr, n, kind());
+ nullptr, name(), kind());
} else {
m->exports.push_back(this);
}
#include "base/logging.hh"
#include "systemc/core/module.hh"
+#include "systemc/core/scheduler.hh"
+#include "systemc/ext/core/sc_main.hh"
#include "systemc/ext/core/sc_module_name.hh"
+#include "systemc/ext/utils/sc_report_handler.hh"
namespace sc_core
{
sc_module_name::sc_module_name(const char *name) :
- _name(name), _gem5_module(new sc_gem5::Module(name)), _on_the_stack(true)
-{}
+ _name(name), _gem5_module(nullptr), _on_the_stack(true)
+{
+ if (sc_is_running())
+ SC_REPORT_ERROR("(E529) insert module failed", "simulation running");
+ else if (::sc_gem5::scheduler.elaborationDone())
+ SC_REPORT_ERROR("(E529) insert module failed", "elaboration done");
+ else
+ _gem5_module = new sc_gem5::Module(name);
+}
sc_module_name::sc_module_name(const sc_module_name &other) :
_name(other._name), _gem5_module(other._gem5_module), _on_the_stack(false)
}
-sc_port_base::sc_port_base(const char *name, int n, sc_port_policy p) :
- sc_object(name), _gem5Port(new ::sc_gem5::Port(this, n))
+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))
{
if (sc_is_running()) {
reportError("(E110) insert port failed", "simulation running",
- name, kind());
+ name(), kind());
}
if (::sc_gem5::scheduler.elaborationDone()) {
reportError("(E110) insert port failed", "elaboration done",
- name, kind());
+ name(), kind());
}
::sc_gem5::Module *m = ::sc_gem5::currentModule();
if (!m) {
reportError("(E100) port specified outside of module",
- nullptr, name, kind());
+ nullptr, name(), kind());
} else {
m->ports.push_back(this);
}
#include "base/logging.hh"
#include "systemc/core/channel.hh"
#include "systemc/core/scheduler.hh"
+#include "systemc/ext/core/sc_main.hh"
#include "systemc/ext/core/sc_prim.hh"
namespace sc_gem5
namespace sc_core
{
-sc_prim_channel::sc_prim_channel() :
- _gem5_channel(new sc_gem5::Channel(this))
-{}
+sc_prim_channel::sc_prim_channel() : _gem5_channel(nullptr)
+{
+ if (sc_is_running()) {
+ SC_REPORT_ERROR("(E113) insert primitive channel failed",
+ "simulation running");
+ } else if (::sc_gem5::scheduler.elaborationDone()) {
+ SC_REPORT_ERROR("(E113) insert primitive channel failed",
+ "elaboration done");
+ } else {
+ _gem5_channel = new sc_gem5::Channel(this);
+ }
+}
sc_prim_channel::sc_prim_channel(const char *_name) :
- sc_object(_name), _gem5_channel(new sc_gem5::Channel(this))
-{}
+ sc_object(_name), _gem5_channel(nullptr)
+{
+ if (sc_is_running()) {
+ SC_REPORT_ERROR("(E113) insert primitive channel failed",
+ "simulation running");
+ } else if (::sc_gem5::scheduler.elaborationDone()) {
+ SC_REPORT_ERROR("(E113) insert primitive channel failed",
+ "elaboration done");
+ } else {
+ _gem5_channel = new sc_gem5::Channel(this);
+ }
+}
sc_prim_channel::~sc_prim_channel() { delete _gem5_channel; }