systemc: Init some values in the scheduler for running without sc_main.

When running without sc_main, sc_start won't be called, and therefore
runToTime and maxTick won't be initialized. To avoid the scheduler
getting confused and behaving erratically, those values should be
initialized to something that makes sense in situations where there's
no sc_main.

Change-Id: I6ddd7db9ecb36d716eb5ef75e1c38bb99a386092
Reviewed-by: Andreas Sandberg <>
Maintainer: Gabe Black <>
diff --git a/src/systemc/core/ b/src/systemc/core/
index 4b566ca..da1dd2d 100644
--- a/src/systemc/core/
+++ b/src/systemc/core/
@@ -50,9 +50,11 @@
     stopEvent(this, false, StopPriority), _throwUp(nullptr),
     starvationEvent(this, false, StarvationPriority),
     _elaborationDone(false), _started(false), _stopNow(false),
-    _status(StatusOther), maxTickEvent(this, false, MaxTickPriority),
+    _status(StatusOther), maxTick(::MaxTick),
+    maxTickEvent(this, false, MaxTickPriority),
     timeAdvancesEvent(this, false, TimeAdvancesPriority), _numCycles(0),
-    _changeStamp(0), _current(nullptr), initDone(false), runOnce(false)
+    _changeStamp(0), _current(nullptr), initDone(false), runToTime(true),
+    runOnce(false)