tlm: Don't set SystemC time resolution
authorMatthias Jung <jungma@eit.uni-kl.de>
Thu, 17 Aug 2017 13:44:49 +0000 (15:44 +0200)
committerMatthias Jung <jungma@eit.uni-kl.de>
Mon, 11 Sep 2017 08:21:11 +0000 (08:21 +0000)
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 <prosenfeld@micron.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

util/tlm/src/sim_control.cc

index a96daf2c808ce839613a0dcca4ac7dbde817780e..fae8db0a4b56fdb5880973ac83eb70378de232ce 100644 (file)
@@ -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();