diff --git a/simulators/c++2/Makefile b/simulators/c++2/Makefile index 40dd02b9a0246ee4d4b50453d5be28c6d42b2a0e..5aa931576b3e6e370f64a0ab2d7b9ac69e792fa1 100755 --- a/simulators/c++2/Makefile +++ b/simulators/c++2/Makefile @@ -3,7 +3,7 @@ TARGET_ARCH = linux CC = g++ #CC = test2.sh #CC = /packages/gcc_3.2.2/bin/g++32 -OPT = -O1 -pthread +OPT = -O1 -pthread -rdynamic -ldl DEBUG = -g OTHER = -Wall TRY = -Wno-deprecated diff --git a/simulators/c++2/src_simulator/ListenersSimCmd.cpp b/simulators/c++2/src_simulator/ListenersSimCmd.cpp index eac106c58e3c7a629ae063bb5a6b7f3c2fe12c22..345cc9efc61f2d23010f9c3ad5b4fdb9e07e0199 100644 --- a/simulators/c++2/src_simulator/ListenersSimCmd.cpp +++ b/simulators/c++2/src_simulator/ListenersSimCmd.cpp @@ -43,6 +43,14 @@ Ludovic Apvrille, Renaud Pacalet #include <SchedulableDevice.h> #include <TMLCommand.h> #include <TMLChoiceCommand.h> +#include <TMLActionCommand.h> +#include <TMLNotifiedCommand.h> +#include <TMLWaitCommand.h> +#include <TMLTask.h> + +unsigned int CondBreakpoint::_freeID=0; +bool Breakpoint::_enabled=true; +bool CondBreakpoint::_enabled=true; RunXTransactions::RunXTransactions(SimComponents* iSimComp, unsigned int iTransToExecute):_simComp(iSimComp), _count(0), _transToExecute(iTransToExecute){ for(SchedulingList::const_iterator i=_simComp->getCPUList().begin(); i != _simComp->getCPUList().end(); ++i) @@ -83,9 +91,93 @@ void Breakpoint::setEnabled(bool iEnabled){ } +CondBreakpoint::CondBreakpoint(SimComponents* iSimComp, std::string iCond, TMLTask* iTask):_simComp(iSimComp), _condFunc(0), _dlHandle(0), _task(iTask){ + _ID=_freeID++; + FILE* in; + std::ofstream myfile ("newlib.c"); + char aExeName[256]; + int len = getexename(aExeName, sizeof(aExeName)); + if (len==-1) return; + aExeName[len-6]=0; + //strcat(aExeName, "/src_simulator"); + std::cout << "ExeName: " << aExeName << std::endl; + if (myfile.is_open()){ + std::ostringstream aCmd; + myfile << "#include <" << iTask->toString() << ".h>\n"; + for(VariableLookUpTableName::const_iterator i=iTask->getVariableIteratorName(false); i !=iTask->getVariableIteratorName(true); ++i){ + myfile << "#define " << *(i->first) << " _castTask_->" << *(i->first) << "\n"; + } + myfile << "class TMLTask;\n\n"; + myfile << "extern \"C\" bool condFunc(TMLTask* _ioTask_){\n"; + myfile << " " << iTask->toString() << "* _castTask_ = dynamic_cast<" << iTask->toString() << "*>(" << "_ioTask_" << ");\n"; + myfile << " return (" << iCond << ");\n"; + myfile << "}\n"; + myfile.close(); + aCmd << "g++ -c -fPIC -Wall newlib.c -I" << aExeName << " -I" << aExeName << "/src_simulator"; + //in = popen("g++ -c -fPIC -Wall newlib.c -I. -I./src_simulator", "r"); + in = popen(aCmd.str().c_str(), "r"); + if (pclose(in)!=0){ + std::cout << "Compiler error!\n"; + return; + } + aCmd.str(""); + aCmd << "g++ -shared -Wl,-soname," << "lib" << _ID << ".so.1" << " -o " << "lib" << _ID << ".so.1.0.1" << " newlib.o"; + //in = popen("g++ -shared -Wl,-soname,l.so.1 -o l.so.1.0.1 newlib.o", "r"); + in = popen(aCmd.str().c_str(), "r"); + if (pclose(in)!=0){ + std::cout << "Compiler error!\n"; + return; + } + }else{ + std::cout << "Error when creating C condition source file.\n"; + return; + } + std::ostringstream aCmd; + aCmd << "lib" << _ID << ".so.1.0.1"; + _dlHandle = dlopen(aCmd.str().c_str(), RTLD_LAZY); + if (!_dlHandle){ + std::cout << "Error " << dlerror() << " occurred when opening shared library.\n"; + return; + } + _condFunc = (BreakCondFunc) dlsym( _dlHandle, "condFunc"); + if (dlerror() != NULL) { + std::cout << "Error when getting function handle\n"; + return; + } + //Take task into account, to register at every command + TMLCommand::registerGlobalListenerForType<TMLChoiceCommand>(this, iTask); + TMLCommand::registerGlobalListenerForType<TMLActionCommand>(this, iTask); + TMLCommand::registerGlobalListenerForType<TMLNotifiedCommand>(this, iTask); + TMLCommand::registerGlobalListenerForType<TMLWaitCommand>(this, iTask); +} + +bool CondBreakpoint::commandEntered(TMLCommand* iComm){ + if (_enabled && _condFunc!=0){ + if ((*_condFunc)(_task)){ + _simComp->setStopFlag(true); + std::cout << "Stop simulation due to condition\n"; + return true; + } + } + return false; +} + +void CondBreakpoint::setEnabled(bool iEnabled){ + _enabled=iEnabled; +} + +bool CondBreakpoint::conditionValid(){ + return (_condFunc!=0); +} + +CondBreakpoint::~CondBreakpoint(){ + TMLCommand::removeGlobalListener(this); + if (_dlHandle!=0) dlclose(_dlHandle); +} + RunTillNextRandomChoice::RunTillNextRandomChoice(SimComponents* iSimComp):_simComp(iSimComp), _enabled(false){ - TMLCommand::registerGlobalListenerForType<TMLChoiceCommand>(this); + TMLCommand::registerGlobalListenerForType<TMLChoiceCommand>(this,0); } bool RunTillNextRandomChoice::commandEntered(TMLCommand* iComm){ diff --git a/simulators/c++2/src_simulator/ListenersSimCmd.h b/simulators/c++2/src_simulator/ListenersSimCmd.h index 69d9c06c537e7386d45f36a0ec6c4f49fb05a68b..9fd698aa9ffcdb2649e73eee938ae83c624102dc 100644 --- a/simulators/c++2/src_simulator/ListenersSimCmd.h +++ b/simulators/c++2/src_simulator/ListenersSimCmd.h @@ -70,6 +70,25 @@ protected: static bool _enabled; }; + +class CondBreakpoint: public CommandListener, public TransactionListener{ +public: + CondBreakpoint(SimComponents* iSimComp, std::string iCond, TMLTask* iTask); + ~CondBreakpoint(); + bool commandEntered(TMLCommand* iComm); + static void setEnabled(bool iEnabled); + bool conditionValid(); +protected: + SimComponents* _simComp; + static bool _enabled; + BreakCondFunc _condFunc; + void * _dlHandle; + unsigned int _ID; + TMLTask* _task; + static unsigned int _freeID; +}; + + class RunTillNextRandomChoice: public CommandListener, public TransactionListener{ public: RunTillNextRandomChoice(SimComponents* iSimComp); @@ -80,6 +99,7 @@ protected: bool _enabled; }; + class RunXCommands: public CommandListener, public TransactionListener{ public: RunXCommands(SimComponents* iSimComp, unsigned int iCommandsToExecute); @@ -92,6 +112,7 @@ protected: }; + class RunXTimeUnits: public TransactionListener{ public: RunXTimeUnits(SimComponents* iSimComp, TMLTime iEndTime); @@ -104,6 +125,7 @@ protected: }; + class RunTillTransOnDevice: public TransactionListener{ public: RunTillTransOnDevice(SimComponents* iSimComp, ListenerSubject<TransactionListener>* iSubject); diff --git a/simulators/c++2/src_simulator/SimComponents.h b/simulators/c++2/src_simulator/SimComponents.h index d440afa6ad6b35c9b3efa68e69c1cb077d697ea5..5959e69ad50181aecf055a35167c118afcbb3e6f 100644 --- a/simulators/c++2/src_simulator/SimComponents.h +++ b/simulators/c++2/src_simulator/SimComponents.h @@ -202,7 +202,6 @@ public: \return Pointer if choice command was found, null otherwise */ TMLChoiceCommand* getCurrentChoiceCmd(); - //void setBreakpointOnChoiceCmds(); ///Returns a hash value for the current application and architecture /** \return Hash value diff --git a/simulators/c++2/src_simulator/Simulator.cpp b/simulators/c++2/src_simulator/Simulator.cpp index 3c5fbffcf4f19febed4550239eadf6918aaba666..372689806b016b7fa493908349bab4fd0eb6b70d 100644 --- a/simulators/c++2/src_simulator/Simulator.cpp +++ b/simulators/c++2/src_simulator/Simulator.cpp @@ -573,6 +573,29 @@ void Simulator::decodeCommand(std::string iCmd){ std::cout << "Run to next random choice command." << std::endl; _simTerm=runToNextChoiceCommand(oLastTrans); std::cout << "End Run to next random choice command." << std::endl; + break; + } + case 14:{//Run until condition is satisfied + std::cout << "Run until condition is satisfied." << std::endl; + aInpStream >> aStrParam; + TMLTask* aTask=_simComp->getTaskByName(aStrParam); + if (aTask!=0){ + bool aSuccess, aTerminated; + aInpStream >> aStrParam; + aTerminated = runUntilCondition(aStrParam, aTask, oLastTrans, aSuccess); + if (aSuccess){ + _simTerm=aTerminated; + aGlobMsg << TAG_MSGo << "Created listeners for condition " << aStrParam << TAG_MSGc << std::endl; + }else{ + aGlobMsg << TAG_MSGo << MSG_CONDERR << TAG_MSGc << std::endl; + anErrorCode=5; + } + }else{ + aGlobMsg << TAG_MSGo << MSG_CMPNFOUND << TAG_MSGc << std::endl; + anErrorCode=2; + } + std::cout << "End Run until condition is satisfied." << std::endl; + break; } default: aGlobMsg << TAG_MSGo << MSG_CMDNFOUND<< TAG_MSGc << std::endl; @@ -633,7 +656,7 @@ void Simulator::decodeCommand(std::string iCmd){ break; } case 4:{//Print information about simulation element x - bool aFailure=false; + //bool aFailure=false; std::cout << "Print information about simulation element x." << std::endl; aInpStream >> aParam1; aInpStream >> aStrParam; @@ -932,9 +955,9 @@ void Simulator::decodeCommand(std::string iCmd){ } void Simulator::printVariablesOfTask(TMLTask* iTask, std::ostream& ioMessage){ - if (iTask->getVariableIterator(false)==iTask->getVariableIterator(true)) return; + if (iTask->getVariableIteratorID(false)==iTask->getVariableIteratorID(true)) return; ioMessage << TAG_TASKo << " id=\"" << iTask-> getID() << "\" name=\"" << iTask->toString() << "\">" << std::endl; - for(VariableLookUpTableID::const_iterator i=iTask->getVariableIterator(false); i !=iTask->getVariableIterator(true); ++i){ + for(VariableLookUpTableID::const_iterator i=iTask->getVariableIteratorID(false); i !=iTask->getVariableIteratorID(true); ++i){ ioMessage << TAG_VARo << " id=\"" << i->first << "\">" << *(i->second) << TAG_VARc << std::endl; } ioMessage << TAG_TASKc << std::endl; @@ -967,7 +990,7 @@ bool Simulator::runXTimeUnits(unsigned int iTime, TMLTransaction*& oLastTrans){ bool Simulator::runToBusTrans(SchedulableCommDevice* iBus, TMLTransaction*& oLastTrans){ ListenerSubject<TransactionListener>* aSubject= static_cast<ListenerSubject<TransactionListener>* > (iBus); RunTillTransOnDevice aListener(_simComp, aSubject); - return simulate(oLastTrans); + return simulate(oLastTrans); } bool Simulator::runToCPUTrans(SchedulableDevice* iCPU, TMLTransaction*& oLastTrans){ @@ -1001,6 +1024,14 @@ bool Simulator::runToNextChoiceCommand(TMLTransaction*& oLastTrans){ return aSimTerminated; } +bool Simulator::runUntilCondition(std::string& iCond, TMLTask* iTask, TMLTransaction*& oLastTrans, bool& oSuccess){ + CondBreakpoint aListener(_simComp, iCond, iTask); + oSuccess=aListener.conditionValid(); + //return simulate(oLastTrans); + //aListener.commandEntered(0); + if (oSuccess) return simulate(oLastTrans); else return false; +} + void Simulator::exploreTree(unsigned int iDepth, unsigned int iPrevID){ //std::ostringstream aFileName; //aFileName << "canc" << iDepth << "." << leafsForLevel[iDepth]++; diff --git a/simulators/c++2/src_simulator/Simulator.h b/simulators/c++2/src_simulator/Simulator.h index 8269230523dbb6a0d36ba2fec704d8a411c25d6a..0e8b882250109111172bd45ae66bdc8a4a11ccba 100644 --- a/simulators/c++2/src_simulator/Simulator.h +++ b/simulators/c++2/src_simulator/Simulator.h @@ -70,6 +70,7 @@ Ludovic Apvrille, Renaud Pacalet #define MSG_CMDNFOUND "Command not found" #define MSG_CMDNIMPL "Command currently not implemented" #define MSG_FILEERR "Cannot open file " +#define MSG_CONDERR "Condition cannot be compiled" #define SIM_READY "ready" #define SIM_BUSY "busy" #define SIM_TERM "term" @@ -180,10 +181,19 @@ public: \return Return value of simulate() function */ bool runToNextChoiceCommand(TMLTransaction*& oLastTrans); + ///Runs the simulation until a given condition is satisfied + /** + \param iCond Condition expressed in terms of task variables of a given task + \param iTask Task + \param oLastTrans Returns the last transaction executed during a simulation + \return Return value of simulate() function + */ + bool runUntilCondition(std::string& iCond, TMLTask* iTask, TMLTransaction*& oLastTrans, bool& oSuccess); ///Runs the automatic exploration of several branches of control flow. Choice commands to be explored must be marked with a breakpoint. /** \param iDepth Maximal recursion depth \param iPrevID ID of the parent leaf + \param oSuccess True is returned if the condition was compiled successfully */ void exploreTree(unsigned int iDepth, unsigned int iPrevID); ///Writes a HTML representation of the schedule of CPUs and buses to an output file diff --git a/simulators/c++2/src_simulator/TMLCommand.cpp b/simulators/c++2/src_simulator/TMLCommand.cpp index 4ce9b3f3f3c2a205a292320fc917187bb3bfae59..146dc15aeed0521c1a8a2699c374ee00ad6eae75 100644 --- a/simulators/c++2/src_simulator/TMLCommand.cpp +++ b/simulators/c++2/src_simulator/TMLCommand.cpp @@ -45,6 +45,13 @@ Ludovic Apvrille, Renaud Pacalet #include <CommandListener.h> #include <Parameter.h> #include <TMLChoiceCommand.h> +#include <TMLActionCommand.h> +#include <TMLNotifiedCommand.h> +#include <TMLWaitCommand.h> +#include <SimComponents.h> + +std::list<TMLCommand*> TMLCommand::_instanceList; +SimComponents* TMLCommand::_simComp=0; TMLCommand::TMLCommand(unsigned int iID, TMLTask* iTask, TMLLength iLength, ParamFuncPointer iParamFunc): _ID(iID), _length(iLength), _progress(0), _currTransaction(0), _task(iTask), _nextCommand(0), _paramFunc(iParamFunc), _breakpoint(0){ _instanceList.push_back(this); @@ -79,19 +86,21 @@ TMLCommand* TMLCommand::prepare(bool iInit){ } }else{ //std::cout << "Prepare next transaction beg " << _listeners.size() << std::endl; - //&& _simStopped - _simStopped=false; + //_simStopped=false; if (iInit){ //_simStopped=false; if (_currTransaction!=0) delete _currTransaction; }else{ //_simStopped=false; if (_progress==0) - FOR_EACH_CMDLISTENER _simStopped|= (*i)->commandEntered(this); + //FOR_EACH_CMDLISTENER _simStopped|= (*i)->commandEntered(this); + FOR_EACH_CMDLISTENER (*i)->commandEntered(this); else - FOR_EACH_CMDLISTENER _simStopped|= (*i)->commandExecuted(this); + //FOR_EACH_CMDLISTENER _simStopped|= (*i)->commandExecuted(this); + FOR_EACH_CMDLISTENER (*i)->commandExecuted(this); //std::cout << "Prepare next transaction" << std::endl; - if (_simStopped){ + //if (_simStopped){ + if (_simComp->getStopFlag()){ std::cout << "aSimStopped=true " << std::endl; _task->setCurrCommand(this); return this; //for command which generates transactions this is returned anyway by prepareTransaction @@ -192,10 +201,10 @@ void TMLCommand::registerGlobalListener(CommandListener* iListener){ } template<typename T> -void TMLCommand::registerGlobalListenerForType(CommandListener* iListener){ +void TMLCommand::registerGlobalListenerForType(CommandListener* iListener, TMLTask* aTask){ //std::cout << "Global cmd listener created \n"; for(std::list<TMLCommand*>::iterator i=_instanceList.begin(); i != _instanceList.end(); ++i){ - if (dynamic_cast<T*>(*i)!=0) (*i)->registerListener(iListener); + if (dynamic_cast<T*>(*i)!=0 && (aTask==0 || (*i)->getTask()==aTask)) (*i)->registerListener(iListener); } } @@ -213,5 +222,12 @@ TMLLength TMLCommand::getProgress() const{ return _progress; } -template void TMLCommand::registerGlobalListenerForType<TMLChoiceCommand>(CommandListener* iListener); +void TMLCommand::setSimComponents(SimComponents* iSimComp){ + _simComp=iSimComp; +} + +template void TMLCommand::registerGlobalListenerForType<TMLChoiceCommand>(CommandListener* iListener, TMLTask* aTask); +template void TMLCommand::registerGlobalListenerForType<TMLActionCommand>(CommandListener* iListener, TMLTask* aTask); +template void TMLCommand::registerGlobalListenerForType<TMLNotifiedCommand>(CommandListener* iListener, TMLTask* aTask); +template void TMLCommand::registerGlobalListenerForType<TMLWaitCommand>(CommandListener* iListener, TMLTask* aTask); diff --git a/simulators/c++2/src_simulator/TMLCommand.h b/simulators/c++2/src_simulator/TMLCommand.h index 7710881b12c519f1e4b112b5be50457aea9c8eba..d1eef0848b1fb4548e6e07ea349babb4d3ee2e8b 100644 --- a/simulators/c++2/src_simulator/TMLCommand.h +++ b/simulators/c++2/src_simulator/TMLCommand.h @@ -50,6 +50,7 @@ class TMLTask; class TMLChannel; class CommandListener; class Comment; +class SimComponents; ///This class defines the basic interfaces and functionalites of a TML command. All specific commands are derived from this base class. class TMLCommand: public Serializable, public ListenerSubject<CommandListener>{ @@ -140,7 +141,12 @@ public: \param iListener Pointer to the listener */ static void registerGlobalListener(CommandListener* iListener); - template<typename T> static void registerGlobalListenerForType(CommandListener* iListener); + ///Registers a listener at all TMLCommand instances of a specific type + /** + \param iListener Pointer to the listener + \param aTask Only commands of this task are taken into account, if set to 0 all tasks are considered + */ + template<typename T> static void registerGlobalListenerForType(CommandListener* iListener, TMLTask* aTask); ///Removes a listener at all TMLCommand instances /** \param iListener Pointer to the listener @@ -163,6 +169,11 @@ public: \return Progress of the command */ TMLLength getProgress() const; + ///Sets the internal pointer to the simulation components + /** + \param iSimComp Pointer to simulation components + */ + static void setSimComponents(SimComponents* iSimComp); protected: ///ID of the command unsigned int _ID; @@ -195,6 +206,8 @@ protected: virtual TMLCommand* prepareNextTransaction()=0; ///List of pointers to all TMLCommand instances static std::list<TMLCommand*> _instanceList; + ///Pointer to simulation components + static SimComponents* _simComp; }; #endif diff --git a/simulators/c++2/src_simulator/TMLTask.cpp b/simulators/c++2/src_simulator/TMLTask.cpp index 75f1cc4f7b162fb496761d1d5298b08f4e5428f5..26f307a8d3888245a7fcfdc7d607786b9d96e83a 100644 --- a/simulators/c++2/src_simulator/TMLTask.cpp +++ b/simulators/c++2/src_simulator/TMLTask.cpp @@ -278,6 +278,10 @@ void TMLTask::streamStateXML(std::ostream& s) const{ streamBenchmarks(s); } -VariableLookUpTableID::const_iterator TMLTask::getVariableIterator(bool iEnd) const{ +VariableLookUpTableID::const_iterator TMLTask::getVariableIteratorID(bool iEnd) const{ return (iEnd)?_varLookUpID.end():_varLookUpID.begin(); } + +VariableLookUpTableName::const_iterator TMLTask::getVariableIteratorName(bool iEnd) const{ + return (iEnd)?_varLookUpName.end():_varLookUpName.begin(); +} diff --git a/simulators/c++2/src_simulator/TMLTask.h b/simulators/c++2/src_simulator/TMLTask.h index 83c1219ecc07d08f7ba65d16d8ca54ce10410d9f..880a8ad57a8c7cbdc4d39c49448505dcdc458c73 100644 --- a/simulators/c++2/src_simulator/TMLTask.h +++ b/simulators/c++2/src_simulator/TMLTask.h @@ -167,7 +167,13 @@ public: \param iEnd true for iterator pointing to the end of the table, false for iterator pointing to the first element \return Const iterator for variable table */ - VariableLookUpTableID::const_iterator getVariableIterator(bool iEnd) const; + VariableLookUpTableID::const_iterator getVariableIteratorID(bool iEnd) const; + ///Returns an iterator for the internal variable Name hash table + /** + \param iEnd true for iterator pointing to the end of the table, false for iterator pointing to the first element + \return Const iterator for variable table + */ + VariableLookUpTableName::const_iterator getVariableIteratorName(bool iEnd) const; protected: ///ID of the task diff --git a/simulators/c++2/src_simulator/definitions.cpp b/simulators/c++2/src_simulator/definitions.cpp index b364cca288a554f484a569ff62acd08ca8407199..a735c5271e6b8e819f7afd6589139123a5066d83 100644 --- a/simulators/c++2/src_simulator/definitions.cpp +++ b/simulators/c++2/src_simulator/definitions.cpp @@ -48,8 +48,6 @@ Ludovic Apvrille, Renaud Pacalet #include <ListenersSimCmd.h> TMLTime SchedulableDevice::_simulatedTime=0; -std::list<TMLCommand*> TMLCommand::_instanceList; -bool Breakpoint::_enabled=true; int myrand(int n1, int n2){ static bool firstTime = true; @@ -100,3 +98,13 @@ std::string vcdValConvert(unsigned int iVal){ return iResult; } +int getexename(char* buf, size_t size){ + char linkname[64]; /* /proc/<pid>/exe */ + pid_t pid; + int ret; + pid = getpid(); + if (snprintf(linkname, sizeof(linkname), "/proc/%i/exe", pid) < 0) return -1; + ret = readlink(linkname, buf, size); + if (ret == -1 || ret>=size) return -1; + buf[ret] = 0; +} diff --git a/simulators/c++2/src_simulator/definitions.h b/simulators/c++2/src_simulator/definitions.h index 163ddf24dfdf1604a5dbb19bd7692551328d1664..d498d731d49123a1229d5f314a6b8fe70cde821b 100644 --- a/simulators/c++2/src_simulator/definitions.h +++ b/simulators/c++2/src_simulator/definitions.h @@ -62,6 +62,7 @@ Ludovic Apvrille, Renaud Pacalet #include <sys/socket.h> #include <netinet/in.h> #include <pthread.h> +#include <dlfcn.h> #define WRITE_STREAM(s,v) s.write((char*) &v,sizeof(v)); std::cout << sizeof(v) << " bytes written" << std::endl; #define READ_STREAM(s,v) s.read((char*) &v,sizeof(v)); std::cout << sizeof(v) << " bytes read" << std::endl; @@ -212,6 +213,8 @@ typedef unsigned int (TMLTask::*ActionFuncPointer) (); typedef unsigned int (TMLTask::*LengthFuncPointer) (); ///Type of member function pointer used to indicate a function encapsulating parameter manipulation (for TMLWaitCommand, TMLSendCommand) typedef unsigned int (TMLTask::*ParamFuncPointer) (Parameter<ParamType>& ioParam); +///Breakpoint condition function pointer (points to condition function in shared library) +typedef bool (*BreakCondFunc)(TMLTask*); ///Datatype holding references to TraceableDevices (for VCD output) typedef std::list<TraceableDevice*> TraceableDeviceList; ///Datatype used by the Simulator to keep track of all breakpoints @@ -366,4 +369,5 @@ long getTimeDiff(struct timeval& begin, struct timeval& end); */ void replaceAll(std::string& ioHTML, std::string iSearch, std::string iReplace); std::string vcdValConvert(unsigned int iVal); +int getexename(char* buf, size_t size); #endif diff --git a/simulators/c++2/src_simulator/main.h b/simulators/c++2/src_simulator/main.h index 9c86c451569eadaf3357c5e0fea4d376990235ec..1db0799a1b9537dbfead4d47f296f949d48bb090 100644 --- a/simulators/c++2/src_simulator/main.h +++ b/simulators/c++2/src_simulator/main.h @@ -60,6 +60,7 @@ int main(int len, char ** args) { SimServSyncInfo mySync; gettimeofday(&begin,NULL); mySync._simComponents = new CurrentComponents(); + TMLCommand::setSimComponents(mySync._simComponents); Simulator mySim(&mySync); gettimeofday(&end,NULL); std::cout << "The preparation took " << getTimeDiff(begin,end) << "usec.\n";