summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-06-15 21:30:16 -0700
committerGabe Black <gabeblack@google.com>2018-08-28 21:19:19 +0000
commit40eb6f9f14bd3dce68d832ea572f2629aef4150d (patch)
treed146241bd37da8cf72bade946308cc0034b559f2 /src
parent47c2918a1fe045abec19a9e61a24b262bfc2f830 (diff)
downloadgem5-40eb6f9f14bd3dce68d832ea572f2629aef4150d.tar.xz
systemc: Add the non-standard sc_time_tuple class.
Change-Id: Ia3d6a6a4ea3383c82605653faac570ced7bebb70 Reviewed-on: https://gem5-review.googlesource.com/11277 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/systemc/core/sc_time.cc40
-rw-r--r--src/systemc/ext/core/_using.hh1
-rw-r--r--src/systemc/ext/core/sc_time.hh25
3 files changed, 66 insertions, 0 deletions
diff --git a/src/systemc/core/sc_time.cc b/src/systemc/core/sc_time.cc
index ebc637baf..167b37494 100644
--- a/src/systemc/core/sc_time.cc
+++ b/src/systemc/core/sc_time.cc
@@ -273,4 +273,44 @@ sc_get_default_time_unit()
return *(sc_time *)nullptr;
}
+sc_time_tuple::sc_time_tuple(const sc_time &)
+{
+ warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+}
+
+bool
+sc_time_tuple::has_value() const
+{
+ warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ return false;
+}
+
+sc_dt::uint64
+sc_time_tuple::value() const
+{
+ warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ return 0;
+}
+
+const char *
+sc_time_tuple::unit_symbol() const
+{
+ warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ return "";
+}
+
+double
+sc_time_tuple::to_double() const
+{
+ warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ return 0.0;
+}
+
+std::string
+sc_time_tuple::to_string() const
+{
+ warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+ return "";
+}
+
} // namespace sc_core
diff --git a/src/systemc/ext/core/_using.hh b/src/systemc/ext/core/_using.hh
index da8270021..8f00949b2 100644
--- a/src/systemc/ext/core/_using.hh
+++ b/src/systemc/ext/core/_using.hh
@@ -140,6 +140,7 @@ using sc_core::SC_US;
using sc_core::SC_MS;
using sc_core::SC_SEC;
using sc_core::sc_time;
+using sc_core::sc_time_tuple;
using sc_core::SC_ZERO_TIME;
using sc_core::sc_set_time_resolution;
using sc_core::sc_get_time_resolution;
diff --git a/src/systemc/ext/core/sc_time.hh b/src/systemc/ext/core/sc_time.hh
index ff71d7055..362834cce 100644
--- a/src/systemc/ext/core/sc_time.hh
+++ b/src/systemc/ext/core/sc_time.hh
@@ -106,6 +106,31 @@ const sc_time &sc_max_time();
void sc_set_default_time_unit(double, sc_time_unit);
sc_time sc_get_default_time_unit();
+// Nonstandard
+class sc_time_tuple
+{
+ public:
+ sc_time_tuple() : _value(), _unit(SC_SEC), _offset(1) {}
+ sc_time_tuple(const sc_time &);
+
+ bool has_value() const;
+ sc_dt::uint64 value() const;
+ // Normalized unit.
+ sc_time_unit unit() const { return _unit; }
+ // Normalized unit symbol.
+ const char *unit_symbol() const;
+
+ operator sc_time() const { return sc_time(to_double(), _unit); }
+
+ double to_double() const; // Relative to the normalized unit.
+ std::string to_string() const;
+
+ private:
+ sc_dt::uint64 _value;
+ sc_time_unit _unit;
+ unsigned _offset;
+};
+
} // namespace sc_core
#endif //__SYSTEMC_EXT_CORE_SC_TIME_HH__