Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/12609 )

Change subject: systemc: Change how sc_clock creates processes to match the tests.
......................................................................

systemc: Change how sc_clock creates processes to match the tests.

Accellera sets up the mechanism which toggles sc_clock differently
than it's set up in gem5. This change moves things around a little to
more closely match the order things are done by Accellera so that the
test output matches.

Change-Id: Ia6d327f4cd5d689f6969398f02a66278a3dc010c
Reviewed-on: https://gem5-review.googlesource.com/c/12609
Reviewed-by: Gabe Black <[email protected]>
Maintainer: Gabe Black <[email protected]>
---
M src/systemc/channel/sc_clock.cc
1 file changed, 14 insertions(+), 7 deletions(-)

Approvals:
  Gabe Black: Looks good to me, approved; Looks good to me, approved



diff --git a/src/systemc/channel/sc_clock.cc b/src/systemc/channel/sc_clock.cc
index 25c07b3..2a41235 100644
--- a/src/systemc/channel/sc_clock.cc
+++ b/src/systemc/channel/sc_clock.cc
@@ -46,22 +46,26 @@
   private:
     ::sc_core::sc_clock *clock;
     ::sc_core::sc_time _period;
-    std::string _name;
+    std::string name;
     Process *p;
     ProcessMemberFuncWrapper<::sc_core::sc_clock> funcWrapper;
-    std::string _procName;

   public:
     ClockTick(::sc_core::sc_clock *clock, bool to,
             ::sc_core::sc_time _period) :
         ScEvent([this]() { tick(); }),
-        clock(clock), _period(_period), _name(clock->name()),
+ clock(clock), _period(_period), name(clock->basename()), p(nullptr),
         funcWrapper(clock, to ? &::sc_core::sc_clock::tickUp :
                                 &::sc_core::sc_clock::tickDown)
     {
-        _name += (to ? ".up_tick" : ".down_tick");
-        _procName = _name + ".p";
-        p = new Method(_procName.c_str(), &funcWrapper, true);
+        name += std::string(to ? "_posedge_action" : "_negedge_action");
+        name = ::sc_core::sc_gen_unique_name(name.c_str());
+    }
+
+    void
+    createProcess()
+    {
+        p = new Method(name.c_str(), &funcWrapper, true);
         scheduler.reg(p);
         scheduler.dontInitialize(p);
     }
@@ -70,7 +74,8 @@
     {
         if (scheduled())
             scheduler.deschedule(this);
-        p->popListNode();
+        if (p)
+            p->popListNode();
     }

     void
@@ -156,6 +161,8 @@
 void
 sc_clock::before_end_of_elaboration()
 {
+    _gem5UpEdge->createProcess();
+    _gem5DownEdge->createProcess();
     if (_posedgeFirst) {
         ::sc_gem5::scheduler.schedule(_gem5UpEdge, _startTime);
         ::sc_gem5::scheduler.schedule(_gem5DownEdge,

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12609
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: Ia6d327f4cd5d689f6969398f02a66278a3dc010c
Gerrit-Change-Number: 12609
Gerrit-PatchSet: 8
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Matthias Jung <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to