From 7fc5d4c36a090fc62c78ad427e8d9a1115121ee4 Mon Sep 17 00:00:00 2001 From: Matthias Jung Date: Thu, 17 Aug 2017 15:44:49 +0200 Subject: [PATCH] tlm: Don't set SystemC time resolution Some simulators already set the time resolution of SystemC. By coupling gem5 by means of SystemC with an other tool this can lead to problems: When the resolution is set twice the simulation will not work. Therefore, the line is changed to an assertion that checks if the time resolution of the SystemC simulation is set to gem5's value of 1ps. Change-Id: I8aafab9dd593eb4697a3c7f69ce181fd9cdd05c4 Reviewed-on: https://gem5-review.googlesource.com/4520 Reviewed-by: Paul Rosenfeld Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power --- util/tlm/src/sim_control.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/tlm/src/sim_control.cc b/util/tlm/src/sim_control.cc index a96daf2c8..fae8db0a4 100644 --- a/util/tlm/src/sim_control.cc +++ b/util/tlm/src/sim_control.cc @@ -86,7 +86,8 @@ Gem5SimControl::Gem5SimControl(sc_core::sc_module_name name, Trace::setDebugLogger(&logger); Gem5SystemC::setTickFrequency(); - sc_core::sc_set_time_resolution(1, sc_core::SC_PS); + assert(sc_core::sc_get_time_resolution() + == sc_core::sc_time(1,sc_core::SC_PS)); Gem5SystemC::Module::setupEventQueues(*this); initSignals(); -- 2.30.2