diff options
author | Gabe Black <gabeblack@google.com> | 2018-08-22 21:59:47 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-09-25 23:59:50 +0000 |
commit | 92d1d2c87366c8e9246ad150ff7a71513da4d773 (patch) | |
tree | 2b80c804eebfea729873f4a0a522ec0461ae8b23 | |
parent | 5a4407b3b693ca22a80f4aa1359c6ccf3f27f694 (diff) | |
download | gem5-92d1d2c87366c8e9246ad150ff7a71513da4d773.tar.xz |
systemc: Handle null and omitted event names.
If the simulation isn't running, these should be replaced with versions
generated by sc_gen_unique_name().
Change-Id: Idd515e73ba17d3dfa866ee5509369e9c4e3fb2f5
Reviewed-on: https://gem5-review.googlesource.com/12258
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
-rw-r--r-- | src/systemc/core/event.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/systemc/core/event.cc b/src/systemc/core/event.cc index 77e47fba6..4f3d4f9c1 100644 --- a/src/systemc/core/event.cc +++ b/src/systemc/core/event.cc @@ -37,18 +37,23 @@ #include "sim/core.hh" #include "systemc/core/module.hh" #include "systemc/core/scheduler.hh" +#include "systemc/ext/core/sc_main.hh" +#include "systemc/ext/core/sc_module.hh" namespace sc_gem5 { -Event::Event(sc_core::sc_event *_sc_event) : Event(_sc_event, "") {} +Event::Event(sc_core::sc_event *_sc_event) : Event(_sc_event, nullptr) {} -Event::Event(sc_core::sc_event *_sc_event, const char *_basename) : - _sc_event(_sc_event), _basename(_basename), +Event::Event(sc_core::sc_event *_sc_event, const char *_basename_cstr) : + _sc_event(_sc_event), _basename(_basename_cstr ? _basename_cstr : ""), delayedNotify([this]() { this->notify(); }) { Module *p = currentModule(); + if (_basename == "" && ::sc_core::sc_is_running()) + _basename = ::sc_core::sc_gen_unique_name("event"); + if (p) parent = p->obj()->sc_obj(); else if (scheduler.current()) |