systemc: Add an error check to sc_time.

Change-Id: Ie525a1624a6496a51277fb984cbfeec21eb79749
Reviewed-on: https://gem5-review.googlesource.com/c/12966
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
This commit is contained in:
Gabe Black
2018-09-22 06:12:16 -07:00
parent 648b45c830
commit 0f6961d200
2 changed files with 9 additions and 0 deletions

View File

@@ -494,6 +494,14 @@ sc_set_default_time_unit(double d, sc_time_unit tu)
// Normalize d to seconds.
defaultUnit = d * TimeUnitScale[tu];
specified = true;
double resolution = SimClock::Float::Hz;
if (resolution == 0.0)
resolution = TimeUnitScale[SC_PS];
if (defaultUnit < resolution) {
SC_REPORT_ERROR("(E515) set default time unit failed",
"value smaller than time resolution");
}
}
sc_time