Gabe Black has submitted this change and it was merged. (
https://gem5-review.googlesource.com/c/public/gem5/+/12975 )
Change subject: systemc: Change how the default timescale is set.
......................................................................
systemc: Change how the default timescale is set.
The spec says that the default timescale should be 1 PS, but the
Accellera implementation uses the time resolution.
Change-Id: I7b307a33ef0856e9c19d81e401b15691275d4978
Reviewed-on: https://gem5-review.googlesource.com/c/12975
Reviewed-by: Gabe Black <[email protected]>
Maintainer: Gabe Black <[email protected]>
---
M src/systemc/utils/tracefile.cc
1 file changed, 10 insertions(+), 2 deletions(-)
Approvals:
Gabe Black: Looks good to me, approved; Looks good to me, approved
diff --git a/src/systemc/utils/tracefile.cc b/src/systemc/utils/tracefile.cc
index 25d7ea6..cf77146 100644
--- a/src/systemc/utils/tracefile.cc
+++ b/src/systemc/utils/tracefile.cc
@@ -37,6 +37,7 @@
#include "sim/core.hh"
#include "systemc/core/time.hh"
#include "systemc/ext/core/sc_main.hh"
+#include "systemc/ext/core/sc_time.hh"
#include "systemc/ext/utils/functions.hh"
namespace sc_gem5
@@ -44,7 +45,7 @@
TraceFile::TraceFile(const std::string &name) :
_os(simout.create(name, true, true)), timeUnitTicks(0),
- timeUnitValue(1.0), timeUnitUnit(::sc_core::SC_PS), _traceDeltas(false)
+ timeUnitValue(0.0), timeUnitUnit(::sc_core::SC_PS), _traceDeltas(false)
{}
TraceFile::~TraceFile()
@@ -76,7 +77,14 @@
void
TraceFile::finalizeTime()
{
- timeUnitTicks = ::sc_core::sc_time(timeUnitValue,
timeUnitUnit).value();
+ ::sc_core::sc_time time;
+ if (timeUnitValue == 0.0) {
+ // The time scale was never set. Use the global time resolution.
+ time = ::sc_core::sc_get_time_resolution();
+ } else {
+ time = ::sc_core::sc_time(timeUnitValue, timeUnitUnit);
+ }
+ timeUnitTicks = time.value();
}
} // namespace sc_gem5
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12975
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: I7b307a33ef0856e9c19d81e401b15691275d4978
Gerrit-Change-Number: 12975
Gerrit-PatchSet: 6
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