diff options
author | Gabe Black <gabeblack@google.com> | 2018-07-20 17:36:04 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-09-11 21:44:01 +0000 |
commit | 81b6ef4478c014a77bd0253d316ab3d349ad8ac8 (patch) | |
tree | 8c67ba541789c81716057fb317997e11f1dc10ea /src/systemc/core | |
parent | be38309891b4adb91e9a6b56923f1f9e82487e61 (diff) | |
download | gem5-81b6ef4478c014a77bd0253d316ab3d349ad8ac8.tar.xz |
systemc: Implement + and - for sc_time, and sc_max_time.
Change-Id: I294b63840e42e2afdef198229adc60ddbb60b9a1
Reviewed-on: https://gem5-review.googlesource.com/12040
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc/core')
-rw-r--r-- | src/systemc/core/sc_time.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/systemc/core/sc_time.cc b/src/systemc/core/sc_time.cc index f51b1581c..43d39008d 100644 --- a/src/systemc/core/sc_time.cc +++ b/src/systemc/core/sc_time.cc @@ -28,6 +28,7 @@ */ #include "base/logging.hh" +#include "base/types.hh" #include "python/pybind11/pybind.hh" #include "systemc/ext/core/sc_time.hh" @@ -239,17 +240,15 @@ sc_time::from_string(const char *str) } const sc_time -operator + (const sc_time &, const sc_time &) +operator + (const sc_time &a, const sc_time &b) { - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return sc_time(); + return sc_time::from_value(a.value() + b.value()); } const sc_time -operator - (const sc_time &, const sc_time &) +operator - (const sc_time &a, const sc_time &b) { - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return sc_time(); + return sc_time::from_value(a.value() - b.value()); } const sc_time @@ -305,8 +304,8 @@ sc_get_time_resolution() const sc_time & sc_max_time() { - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *(const sc_time *)nullptr; + static const sc_time MaxScTime = sc_time::from_value(MaxTick); + return MaxScTime; } void |