Gabe Black has submitted this change and it was merged. (
https://gem5-review.googlesource.com/c/public/gem5/+/11712 )
Change subject: systemc: Hook up sc_time_stamp sc_delta_count.
......................................................................
systemc: Hook up sc_time_stamp sc_delta_count.
sc_time_stamp reports the current simulation time. sc_delta_count was
hooked up to a dummy value. This change hooks it up to the scheduler so
that it returns the real value.
Change-Id: I354c4be32161eabeea86af653f5cb0a5d384645b
Reviewed-on: https://gem5-review.googlesource.com/11712
Reviewed-by: Gabe Black <[email protected]>
Maintainer: Gabe Black <[email protected]>
---
M src/systemc/core/sc_main.cc
1 file changed, 8 insertions(+), 5 deletions(-)
Approvals:
Gabe Black: Looks good to me, approved; Looks good to me, approved
diff --git a/src/systemc/core/sc_main.cc b/src/systemc/core/sc_main.cc
index fec3fae..0b385e9 100644
--- a/src/systemc/core/sc_main.cc
+++ b/src/systemc/core/sc_main.cc
@@ -33,8 +33,10 @@
#include "base/logging.hh"
#include "base/types.hh"
#include "python/pybind11/pybind.hh"
+#include "sim/core.hh"
#include "sim/eventq.hh"
#include "sim/init.hh"
+#include "systemc/core/scheduler.hh"
#include "systemc/ext/core/sc_main.hh"
#include "systemc/ext/utils/sc_report_handler.hh"
@@ -124,8 +126,6 @@
Tick _max_tick = MaxTick;
sc_starvation_policy _starvation = SC_EXIT_ON_STARVATION;
-uint64_t _deltaCycles = 0;
-
} // anonymous namespace
int
@@ -193,14 +193,17 @@
const sc_time &
sc_time_stamp()
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
- return *(sc_time *)nullptr;
+ static sc_time tstamp;
+ Tick tick = sc_gem5::scheduler.eventQueue().getCurTick();
+ //XXX We're assuming the systemc time resolution is in ps.
+ tstamp = sc_time::from_value(tick / SimClock::Int::ps);
+ return tstamp;
}
sc_dt::uint64
sc_delta_count()
{
- return _deltaCycles;
+ return sc_gem5::scheduler.numCycles();
}
bool
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/11712
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: I354c4be32161eabeea86af653f5cb0a5d384645b
Gerrit-Change-Number: 11712
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