diff options
author | Gabe Black <gabeblack@google.com> | 2018-08-22 21:35:44 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-09-25 23:58:50 +0000 |
commit | fb8ce429b339016188996d624608c91bb0afda68 (patch) | |
tree | 625493ba579b26e480251ab4a2ec4dd91ceba82f /src/systemc/core | |
parent | 432dcf7b6207007ccf31a47d85b002fef35a7c7b (diff) | |
download | gem5-fb8ce429b339016188996d624608c91bb0afda68.tar.xz |
systemc: Handle sc_time_stamp before any sc_time is constructed.
The time resolution won't yet be fixed, so the scaling factor will
still be set to zero.
Change-Id: I1d1e58316ee05cc477a31ce90e2bbf56dcbc65c3
Reviewed-on: https://gem5-review.googlesource.com/12255
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_main.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/systemc/core/sc_main.cc b/src/systemc/core/sc_main.cc index 47ca2e354..39f6e174b 100644 --- a/src/systemc/core/sc_main.cc +++ b/src/systemc/core/sc_main.cc @@ -235,7 +235,9 @@ sc_time_stamp() static sc_time tstamp; Tick tick = ::sc_gem5::scheduler.getCurTick(); //XXX We're assuming the systemc time resolution is in ps. - tstamp = sc_time::from_value(tick / SimClock::Int::ps); + // If tick is zero, the time scale may not be fixed yet, and + // SimClock::Int::ps may be zero. + tstamp = sc_time::from_value(tick ? tick / SimClock::Int::ps : 0); return tstamp; } |