diff --git a/simulator/sim_lib/cray_mainframe.cpp b/simulator/sim_lib/cray_mainframe.cpp index ae4084b..34a4852 100644 --- a/simulator/sim_lib/cray_mainframe.cpp +++ b/simulator/sim_lib/cray_mainframe.cpp @@ -140,13 +140,15 @@ Mainframe_c::Mainframe_c(const Configuration_c &aConfig, CLogger_c &aLogger, boo mLogger(aConfig), mOsType(OsTypes_e::None), mUseHostRealTimeClock(aConfig.get("UseHostRealTimeClock", true)), + mRealTimeClockIncrement(aConfig.get("RealTimeClockIncrement", 10)), + mRealTimeClockChunkLimit(aConfig.get("RealTimeClockChunkLimit", 5000)), + mDeltaClockIncrement(aConfig.get("DeltaClockIncrement", 1)), mDisableAutoTerminal(aDisableAutoTerminal) { mLogger.SetParent(aLogger); mChannels.resize(aConfig.get("ChannelCount", 8)); mOwnedChannels.resize(mChannels.size()); try { - mRealTimeClockIncrement = aConfig.get("RealTimeClockIncrement", 10); std::string MachineType = aConfig.get("MachineType", "J90"); if (MachineType == "J90") { mMachineType = MachineTypes_e::J90; @@ -768,11 +770,15 @@ CInt_t Mainframe_c::GetRealTimeClock() const { if (mUseHostRealTimeClock) { boost::timer::nanosecond_type DeltaTime = mRealTimeTimer.elapsed().wall - mRealTimeStart; CInt_t DeltaClocks = CInt_t(double(DeltaTime) / mSystemClockPeriod); - if (DeltaClocks == mLastRealTimeReading) { - DeltaClocks += 1; + CInt_t NewRTC = mRealTimeClock + DeltaClocks; + if (NewRTC > mLastRealTimeReading + mRealTimeClockChunkLimit) { + mLastRealTimeReading = NewRTC; + return NewRTC; + } else { + NewRTC = mLastRealTimeReading + mRealTimeClockIncrement; + mLastRealTimeReading = NewRTC; + return NewRTC; } - mLastRealTimeReading = DeltaClocks; - return mRealTimeClock + DeltaClocks; } else { return mRealTimeClock; } diff --git a/simulator/sim_lib/cray_mainframe.h b/simulator/sim_lib/cray_mainframe.h index 10d490e..899833d 100644 --- a/simulator/sim_lib/cray_mainframe.h +++ b/simulator/sim_lib/cray_mainframe.h @@ -341,7 +341,7 @@ public: void Dump(size_t aIdent=0) const; void DumpMemories() const; void DumpHistory(); - CLogger_c &GetLogger() { return mLogger; } + CLogger_c &GetLogger() const { return mLogger; } virtual uint64_t GetTimeStamp() const override { return mEnableTimeStamp ? mTickCnt : 0ULL; } virtual uint64_t GetResolution() const override { return 105000000ULL; } // TODO: make this configurable @@ -367,6 +367,7 @@ protected: bool mMultiThreaded; bool mDisableAutoTerminal; mutable CInt_t mLastRealTimeReading; + CInt_t mDeltaClockIncrement; class MainFrameEventDispatcher_c: public DebugEventDispatcher_c { public: @@ -409,6 +410,7 @@ protected: double mSystemClockPeriod; CInt_t mRealTimeClock; CInt_t mRealTimeClockIncrement; + CInt_t mRealTimeClockChunkLimit; bool mUseHostRealTimeClock; struct WatchPoint_c { diff --git a/simulator/sim_lib/sys_task_req.cpp b/simulator/sim_lib/sys_task_req.cpp index 1a3c819..8f18145 100644 --- a/simulator/sim_lib/sys_task_req.cpp +++ b/simulator/sim_lib/sys_task_req.cpp @@ -206,12 +206,15 @@ void PrintIntArg(std::ostream &aLogger, size_t aArg, const ExchangePacket_c &aEx void ParseUnicosExchangePacket(const ExchangePacket_c &aCurrentEP, const ExchangePacket_c &aNewEP, std::ostream &aLogger, const Cpu_c &aCpu) { static size_t LastSysCall = SIZE_MAX; const Mainframe_c &Mainframe = aCpu.GetMainframe(); + if (aCurrentEP.GetMode().IsMonitorMode()) { CInt_t S[8]; for (size_t Idx = 0; Idx