OpenASIP  2.0
Functions
SimulatorFrontend.cc File Reference
#include <string>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <ctime>
#include <iostream>
#include "CompilerWarnings.hh"
#include <boost/regex.hpp>
#include <boost/thread.hpp>
#include <boost/bind.hpp>
#include <boost/version.hpp>
#include "Binary.hh"
#include "BinaryReader.hh"
#include "BinaryStream.hh"
#include "ADFSerializer.hh"
#include "SimulatorFrontend.hh"
#include "FileSystem.hh"
#include "Application.hh"
#include "Conversion.hh"
#include "SimulatorToolbox.hh"
#include "SimulatorTextGenerator.hh"
#include "ProcessorConfigurationFile.hh"
#include "SimulationController.hh"
#include "OTASimulationController.hh"
#include "UniversalMachine.hh"
#include "UniversalFunctionUnit.hh"
#include "HWOperation.hh"
#include "RegisterFileState.hh"
#include "StringTools.hh"
#include "MachineState.hh"
#include "UnboundedRegisterFile.hh"
#include "ControlUnit.hh"
#include "FUPort.hh"
#include "GCUState.hh"
#include "NullMachine.hh"
#include "SpecialRegisterPort.hh"
#include "TPEFProgramFactory.hh"
#include "POMDisassembler.hh"
#include "DisassemblyInstruction.hh"
#include "MemorySystem.hh"
#include "TPEFBaseType.hh"
#include "Program.hh"
#include "NullProgram.hh"
#include "Procedure.hh"
#include "Instruction.hh"
#include "ExecutionTracker.hh"
#include "ExecutionTrace.hh"
#include "SimulatorConstants.hh"
#include "StopPointManager.hh"
#include "TPEFTools.hh"
#include "UtilizationStats.hh"
#include "SimulationStatistics.hh"
#include "RFAccessTracker.hh"
#include "BusTracker.hh"
#include "InstructionMemory.hh"
#include "ExecutableInstruction.hh"
#include "ProcedureTransferTracker.hh"
#include "POMValidator.hh"
#include "POMValidatorResults.hh"
#include "Exception.hh"
#include "DataMemory.hh"
#include "DataDefinition.hh"
#include "CompiledSimController.hh"
#include "TCEDBGController.hh"
#include "CustomDBGController.hh"
#include "CompiledSimUtilizationStats.hh"
#include "SimulationEventHandler.hh"
#include "MachineInfo.hh"
#include "DirectAccessMemory.hh"
#include "IdealSRAM.hh"
#include "RemoteMemory.hh"
#include "MemoryProxy.hh"
#include "DisassemblyFUPort.hh"

Go to the source code of this file.

Functions

void timeoutThread (unsigned int timeout, SimulatorFrontend *simFE)
 

Detailed Description

Implementation of SimulatorFrontend class

Author
Pekka Jääskeläinen 2005,2010-2012 (pjaaskel-no.spam-cs.tut.fi)
Note
rating: red

Definition in file SimulatorFrontend.cc.

Function Documentation

◆ timeoutThread()

void timeoutThread ( unsigned int  timeout,
SimulatorFrontend simFE 
)

A thread function for handling simulation timeout

Parameters
timeouttimeout in seconds

Definition at line 951 of file SimulatorFrontend.cc.

951  {
952  if (timeout == 0) {
953  return;
954  }
955 
956  TTASimulationController* simCon = simFE->simCon_;
957  boost::xtime xt;
958  boost::xtime xtPoll;
959 #if BOOST_VERSION < 105000
960  boost::xtime_get(&xt, boost::TIME_UTC);
961 #else
962  /* TIME_UTC was replaced by TIME_UTC_ in boost 1.50, to avoid
963  * clashing with a similarly named C11 macro. */
964  boost::xtime_get(&xt, boost::TIME_UTC_);
965 #endif
966  unsigned int pollTime = 5; // poll time in seconds
967  xtPoll = xt;
968  xt.sec += timeout;
969 
970  xtPoll.sec += pollTime;
971  while (xt.sec > xtPoll.sec) {
972  boost::thread::sleep(xtPoll);
973  xtPoll.sec += pollTime;
974  if (simCon != simFE->simCon_) {
975  return;
976  }
977  }
978  boost::thread::sleep(xt);
979 
980  if (simCon != simFE->simCon_) {
981  return;
982  }
983 
984  if (!simFE->hasSimulationEnded()) {
986  }
987 }

References SimulatorFrontend::hasSimulationEnded(), SimulatorFrontend::prepareToStop(), SimulatorFrontend::simCon_, and SRE_AFTER_TIMEOUT.

Here is the call graph for this function:
SimulatorFrontend::simCon_
TTASimulationController * simCon_
If simulation is initialized, this contains a pointer to the simulation controller.
Definition: SimulatorFrontend.hh:296
SRE_AFTER_TIMEOUT
@ SRE_AFTER_TIMEOUT
Stopped after simulation timeout instruction.
Definition: SimulatorConstants.hh:63
TTASimulationController
Definition: TTASimulationController.hh:69
SimulatorFrontend::hasSimulationEnded
bool hasSimulationEnded() const
Definition: SimulatorFrontend.cc:1283
SimulatorFrontend::prepareToStop
void prepareToStop(StopReason reason)
Definition: SimulatorFrontend.cc:1331