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

Change subject: systemc: Use the stage of simulation and not port size in add_trace.
......................................................................

systemc: Use the stage of simulation and not port size in add_trace.

The assumption was that a port wouldn't have any interfaces until
after elaboration, and that if it would be traced, it would have
interfaces. Checking if the simulation has started (and hence
elaboration has finished) is a more accurate and direct way to check
the same thing.

Change-Id: I7fe9ecea469997d1a257dd3e4a0db31889aff722
Reviewed-on: https://gem5-review.googlesource.com/c/13195
Reviewed-by: Gabe Black <[email protected]>
Maintainer: Gabe Black <[email protected]>
---
M src/systemc/ext/channel/sc_in.hh
M src/systemc/ext/channel/sc_inout.hh
2 files changed, 20 insertions(+), 18 deletions(-)

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



diff --git a/src/systemc/ext/channel/sc_in.hh b/src/systemc/ext/channel/sc_in.hh
index a768401..3fea8a8 100644
--- a/src/systemc/ext/channel/sc_in.hh
+++ b/src/systemc/ext/channel/sc_in.hh
@@ -33,6 +33,7 @@
 #include <string>

 #include "../core/sc_event.hh"
+#include "../core/sc_main.hh"
 #include "../core/sc_port.hh"
 #include "../utils/sc_trace_file.hh"
 #include "sc_signal_in_if.hh"
@@ -155,10 +156,10 @@
 inline void
 sc_trace(sc_trace_file *tf, const sc_in<T> &i, const std::string &name)
 {
-    if (i.size())
-        sc_trace(tf, i->read(), name);
-    else
+    if (::sc_core::sc_get_status() < ::sc_core::SC_START_OF_SIMULATION)
         i.add_trace(tf, name);
+    else
+        sc_trace(tf, i->read(), name);
 }

 template <>
@@ -316,10 +317,10 @@
 sc_trace<bool>(sc_trace_file *tf, const sc_in<bool> &i,
         const std::string &name)
 {
-    if (i.size())
-        sc_trace(tf, i->read(), name);
-    else
+    if (::sc_core::sc_get_status() < ::sc_core::SC_START_OF_SIMULATION)
         i.add_trace(tf, name);
+    else
+        sc_trace(tf, i->read(), name);
 }

 template <>
@@ -475,10 +476,10 @@
sc_trace<sc_dt::sc_logic>(sc_trace_file *tf, const sc_in<sc_dt::sc_logic> &i,
         const std::string &name)
 {
-    if (i.size())
-        sc_trace(tf, i->read(), name);
-    else
+    if (::sc_core::sc_get_status() < ::sc_core::SC_START_OF_SIMULATION)
         i.add_trace(tf, name);
+    else
+        sc_trace(tf, i->read(), name);
 }

 } // namespace sc_core
diff --git a/src/systemc/ext/channel/sc_inout.hh b/src/systemc/ext/channel/sc_inout.hh
index 7f19443..2973a54 100644
--- a/src/systemc/ext/channel/sc_inout.hh
+++ b/src/systemc/ext/channel/sc_inout.hh
@@ -33,6 +33,7 @@
 #include <string>

 #include "../core/sc_event.hh"
+#include "../core/sc_main.hh"
 #include "../core/sc_port.hh"
 #include "../dt/bit/sc_logic.hh"
 #include "../utils/sc_trace_file.hh"
@@ -184,10 +185,10 @@
 inline void
 sc_trace(sc_trace_file *tf, const sc_inout<T> &i, const std::string &name)
 {
-    if (i.size())
-        sc_trace(tf, i->read(), name);
-    else
+    if (::sc_core::sc_get_status() < ::sc_core::SC_START_OF_SIMULATION)
         i.add_trace(tf, name);
+    else
+        sc_trace(tf, i->read(), name);
 }

 template <>
@@ -357,10 +358,10 @@
 inline void sc_trace<bool>(
sc_trace_file *tf, const sc_inout<bool> &i, const std::string &name)
 {
-    if (i.size())
-        sc_trace(tf, i->read(), name);
-    else
+    if (::sc_core::sc_get_status() < ::sc_core::SC_START_OF_SIMULATION)
         i.add_trace(tf, name);
+    else
+        sc_trace(tf, i->read(), name);
 }

 template <>
@@ -549,10 +550,10 @@
 sc_trace<sc_dt::sc_logic>(sc_trace_file *tf,
         const sc_inout<sc_dt::sc_logic> &i, const std::string &name)
 {
-    if (i.size())
-        sc_trace(tf, i->read(), name);
-    else
+    if (::sc_core::sc_get_status() < ::sc_core::SC_START_OF_SIMULATION)
         i.add_trace(tf, name);
+    else
+        sc_trace(tf, i->read(), name);
 }

 } // namespace sc_core

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/13195
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: I7fe9ecea469997d1a257dd3e4a0db31889aff722
Gerrit-Change-Number: 13195
Gerrit-PatchSet: 5
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