summaryrefslogtreecommitdiff
path: root/src/systemc
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-10-03 17:08:15 -0700
committerGabe Black <gabeblack@google.com>2018-10-16 00:50:35 +0000
commitd371c9e0db60818ba829f5b80c9428f1e09b49df (patch)
tree361679b57e021f49d5e581d5a4c9f0ff94e73e4f /src/systemc
parent0686b8553381caf7ccd4ac7023ce1d419743ca54 (diff)
downloadgem5-d371c9e0db60818ba829f5b80c9428f1e09b49df.tar.xz
systemc: Add an sc_gen_unique_name namespace to processes as well.
The standard says that there are namespaces for each module, and one global namespace. Accellera also has namespaces for each process, which shows up in the test output. Change-Id: I4c8c5cecd5fb685d7bab521d9ae131aef23a6ab4 Reviewed-on: https://gem5-review.googlesource.com/c/13291 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc')
-rw-r--r--src/systemc/core/process.hh5
-rw-r--r--src/systemc/core/sc_module.cc8
2 files changed, 11 insertions, 2 deletions
diff --git a/src/systemc/core/process.hh b/src/systemc/core/process.hh
index 85a7a27a8..9bddbdd04 100644
--- a/src/systemc/core/process.hh
+++ b/src/systemc/core/process.hh
@@ -36,6 +36,7 @@
#include "base/fiber.hh"
#include "systemc/core/list.hh"
+#include "systemc/core/module.hh"
#include "systemc/core/object.hh"
#include "systemc/core/sched_event.hh"
#include "systemc/core/sensitivity.hh"
@@ -131,6 +132,8 @@ class Process : public ::sc_core::sc_process_b, public ListNode
void waitCount(int count) { _waitCount = count; }
+ const char *uniqueName(const char *seed) { return nameGen.gen(seed); }
+
protected:
void timeout();
@@ -191,6 +194,8 @@ class Process : public ::sc_core::sc_process_b, public ListNode
std::unique_ptr<::sc_core::sc_report> _lastReport;
std::vector<::sc_core::sc_join *> joinWaiters;
+
+ UniqueNameGen nameGen;
};
} // namespace sc_gem5
diff --git a/src/systemc/core/sc_module.cc b/src/systemc/core/sc_module.cc
index 1c3b54b98..fe4b5cdb6 100644
--- a/src/systemc/core/sc_module.cc
+++ b/src/systemc/core/sc_module.cc
@@ -799,8 +799,12 @@ const char *
sc_gen_unique_name(const char *seed)
{
auto mod = sc_gem5::pickParentModule();
- return mod ? mod->uniqueName(seed) :
- ::sc_gem5::nameGen.gen(seed);
+ if (mod)
+ return mod->uniqueName(seed);
+ sc_gem5::Process *p = sc_gem5::scheduler.current();
+ if (p)
+ return p->uniqueName(seed);
+ return ::sc_gem5::nameGen.gen(seed);
}
bool