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

Change subject: systemc: Implement some simple accessor functions in sc_main.cc.
......................................................................

systemc: Implement some simple accessor functions in sc_main.cc.

These functions just read or write values with minimal amounts of
logic.

Change-Id: I22d5b49a2550a88a854d1619f08b0055c1312271
Reviewed-on: https://gem5-review.googlesource.com/10847
Reviewed-by: Jason Lowe-Power <[email protected]>
Maintainer: Gabe Black <[email protected]>
---
M src/systemc/core/sc_main.cc
1 file changed, 18 insertions(+), 11 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved
  Gabe Black: Looks good to me, approved



diff --git a/src/systemc/core/sc_main.cc b/src/systemc/core/sc_main.cc
index 3c4fdbb..a7a77a4 100644
--- a/src/systemc/core/sc_main.cc
+++ b/src/systemc/core/sc_main.cc
@@ -33,6 +33,7 @@
 #include "python/pybind11/pybind.hh"
 #include "sim/init.hh"
 #include "systemc/ext/core/sc_main.hh"
+#include "systemc/ext/utils/sc_report_handler.hh"

 // A default version of this function in case one isn't otherwise defined.
// This ensures everything will link properly whether or not the user defined
@@ -107,6 +108,11 @@
 }
 EmbeddedPyBind embed_("systemc", &systemc_pybind);

+sc_stop_mode _stop_mode = SC_STOP_FINISH_DELTA;
+sc_status _status = SC_ELABORATION;
+
+uint64_t _deltaCycles = 0;
+
 } // anonymous namespace

 int
@@ -142,14 +148,18 @@
 void
 sc_set_stop_mode(sc_stop_mode mode)
 {
-    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+    if (sc_is_running()) {
+        SC_REPORT_ERROR("attempt to set sc_stop mode "
+                        "after start will be ignored", "");
+        return;
+    }
+    _stop_mode = mode;
 }

 sc_stop_mode
 sc_get_stop_mode()
 {
-    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
-    return SC_STOP_FINISH_DELTA;
+    return _stop_mode;
 }

 void
@@ -168,15 +178,13 @@
 sc_dt::uint64
 sc_delta_count()
 {
-    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
-    return 0;
+    return _deltaCycles;
 }

 bool
 sc_is_running()
 {
-    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
-    return false;
+    return _status & (SC_RUNNING | SC_PAUSED);
 }

 bool
@@ -196,8 +204,8 @@
 bool
 sc_pending_activity()
 {
-    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
-    return false;
+    return sc_pending_activity_at_current_time() ||
+           sc_pending_activity_at_future_time();
 }

 sc_time
@@ -210,8 +218,7 @@
 sc_status
 sc_get_status()
 {
-    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
-    return SC_ELABORATION;
+    return _status;
 }

 } // namespace sc_core

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/10847
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: I22d5b49a2550a88a854d1619f08b0055c1312271
Gerrit-Change-Number: 10847
Gerrit-PatchSet: 8
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Gabe Black <[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