diff --git a/simulators/c++2/Makefile b/simulators/c++2/Makefile index 6522b5e00a6b1c7e454dd2ed92538ec2ff4c4080..e6fd6913b0a1b9c6403162ef70e9342f2c9faf85 100755 --- a/simulators/c++2/Makefile +++ b/simulators/c++2/Makefile @@ -13,7 +13,7 @@ DEBUG = -g PROFILE = -pg OTHER = -Wall TRY = -Wno-deprecated -#make = $(OPT) $(OTHER) $(TRY) +#make = $(OPT) $(OTHER) $(TRY) LFLAGS = $(LOPT) $(OTHER) $(TRY) CFLAGS = $(OTHER) OBJDIR = lib diff --git a/simulators/c++2/src_simulator/MemPoolNoDel.h b/simulators/c++2/src_simulator/MemPoolNoDel.h index fafdc85b496bb3fec61eb3b77f10916b682fc7c4..2872ac723f9f3c5cb81c13b484992f0f8f0d5772 100644 --- a/simulators/c++2/src_simulator/MemPoolNoDel.h +++ b/simulators/c++2/src_simulator/MemPoolNoDel.h @@ -49,7 +49,7 @@ class MemPoolNoDel { public: ///Constructor /** - \param iBlockSize Size of chunks to be allocated + \param iChunkSize Size of chunks to be allocated */ MemPoolNoDel(unsigned int iChunkSize): _currChunk(0), _currPos(0), _chunkSize(iChunkSize), _currPosInList(_chunkList.end()){} ///Allocation method diff --git a/simulators/c++2/src_simulator/TMLTransaction.cpp b/simulators/c++2/src_simulator/TMLTransaction.cpp index 1ac7be808adb899e19efe05cefe02828f82b8543..4050a0cec058dd2ff6472144de00ac87faa10be3 100755 --- a/simulators/c++2/src_simulator/TMLTransaction.cpp +++ b/simulators/c++2/src_simulator/TMLTransaction.cpp @@ -60,116 +60,6 @@ TMLTransaction::TMLTransaction(TMLCommand* iCommand, TMLLength iVirtualLength, T _channel(iChannel),_stateID(0) { } -//TMLTime TMLTransaction::getRunnableTime() const{ -// return _runnableTime; -//} - -//void TMLTransaction::setRunnableTime(TMLTime iRunnableTime){ -// _runnableTime = max(_runnableTime,iRunnableTime); -//} - -//TMLTime TMLTransaction::getStartTime() const{ -// return _startTime; -//} - -/*TMLTime TMLTransaction::getStartTimeOperation() const{ -#ifdef PENALTIES_ENABLED - return _startTime + _idlePenalty + _taskSwitchingPenalty; -#else - return _startTime; -#endif -}*/ - -//void TMLTransaction::setStartTime(TMLTime iStartTime){ -// _startTime=iStartTime; -//} - -//TMLTime TMLTransaction::getOperationLength() const{ -// return _length; -//} - -//void TMLTransaction::setLength(TMLTime iLength){ -// _length=iLength; -//} - -/*TMLTime TMLTransaction::getOverallLength() const{ -#ifdef PENALTIES_ENABLED - return _length + _idlePenalty + _taskSwitchingPenalty; -#else - return _length; -#endif -}*/ - -/*TMLTime TMLTransaction::getPenalties() const{ -#ifdef PENALTIES_ENABLED - return _idlePenalty + _taskSwitchingPenalty; -#else - return 0; -#endif -}*/ - -//TMLLength TMLTransaction::getVirtualLength() const{ -// return _virtualLength; -//} - -//void TMLTransaction::setVirtualLength(TMLLength iLength){ -// _virtualLength=iLength; -//} - -//TMLCommand* TMLTransaction::getCommand() const{ -// return _command; -//} - -/*TMLTime TMLTransaction::getEndTime() const{ -#ifdef PENALTIES_ENABLED - return _startTime + _length + _idlePenalty + _taskSwitchingPenalty; -#else - return _startTime + _length; -#endif -}*/ - -/*TMLTime TMLTransaction::getIdlePenalty() const{ -#ifdef PENALTIES_ENABLED - return _idlePenalty; -#else - return 0; -#endif -}*/ - -/*void TMLTransaction::setIdlePenalty(TMLTime iIdlePenalty){ -#ifdef PENALTIES_ENABLED - _idlePenalty=iIdlePenalty; -#endif -}*/ - -/*TMLTime TMLTransaction::getTaskSwitchingPenalty() const{ -#ifdef PENALTIES_ENABLED - return _taskSwitchingPenalty; -#else - return 0; -#endif -}*/ - -/*void TMLTransaction::setTaskSwitchingPenalty(TMLTime iTaskSwitchingPenalty){ -#ifdef PENALTIES_ENABLED - _taskSwitchingPenalty=iTaskSwitchingPenalty; -#endif -}*/ - -/*TMLTime TMLTransaction::getBranchingPenalty() const{ -#ifdef PENALTIES_ENABLED - return _branchingPenalty; -#else - return 0; -#endif -}*/ - -/*void TMLTransaction::setBranchingPenalty(TMLTime iBranchingPenalty){ -#ifdef PENALTIES_ENABLED - _branchingPenalty=iBranchingPenalty; -#endif -}*/ - std::string TMLTransaction::toString() const{ std::ostringstream outp; outp << _command->toString() << std::endl << "Transaction runnable:" << _runnableTime << " len:" << _length << " start:" << _startTime << " vLength:" << _virtualLength; @@ -188,42 +78,3 @@ std::string TMLTransaction::toShortString() const{ return outp.str(); } -//void TMLTransaction::setChannel(TMLChannel* iChannel){ -// _channel=iChannel; -//} - -//TMLChannel* TMLTransaction::getChannel() const{ -// return _channel; -//} - -//void * TMLTransaction::operator new(size_t size){ -// return memPool.pmalloc(size); -//} - -//void TMLTransaction::operator delete(void *p, size_t size){ -// memPool.pfree(p, size); -//} - -//void TMLTransaction::reset(){ -// memPool.reset(); -//} - -//void TMLTransaction::incID(){ -// _ID++; -//} - -//ID TMLTransaction::getID(){ -// return _ID; -//} - -//void TMLTransaction::resetID(){ -// _ID=1; -//} - -//void TMLTransaction::setStateID(ID iID){ -// _stateID=iID; -//} - -//ID TMLTransaction::getStateID(){ -// return _stateID; -//} diff --git a/simulators/c++2/src_simulator/app/IndeterminismSource.h b/simulators/c++2/src_simulator/app/IndeterminismSource.h index a9313369a73aec01fe283efd5e715b886c228554..0c579c398e48e5008f22031c36f9b450dabd9084 100644 --- a/simulators/c++2/src_simulator/app/IndeterminismSource.h +++ b/simulators/c++2/src_simulator/app/IndeterminismSource.h @@ -42,16 +42,28 @@ Ludovic Apvrille, Renaud Pacalet #define IndeterminismSourceH #include <definitions.h> +///This interface characterizes a non-deterministic behavior of a TML command class IndeterminismSource{ public: + ///Constructor IndeterminismSource(): _randomValue(-1) {} + ///Destructor virtual ~IndeterminismSource(){} + ///Returns the range of the random variable + /** + \return Range of random variable + */ virtual unsigned int getRandomRange()=0; + ///Sets the value of the random variable in exploration mode + /** + \param iValue Value of random variable + */ virtual void setRandomValue(unsigned int iValue){ _randomValue=iValue; //std::cout << "Random value by sim" << _randomValue << "\n"; } protected: + ///Value of random variable mutable unsigned int _randomValue; }; #endif diff --git a/simulators/c++2/src_simulator/app/TMLActionCommand.cpp b/simulators/c++2/src_simulator/app/TMLActionCommand.cpp index 27f9d4477c01b598d22f31e9392354fa938ac46c..803536a0cd171b30e1379c7f4e1ad99efff94f1b 100755 --- a/simulators/c++2/src_simulator/app/TMLActionCommand.cpp +++ b/simulators/c++2/src_simulator/app/TMLActionCommand.cpp @@ -47,9 +47,6 @@ TMLActionCommand::TMLActionCommand(ID iID, TMLTask* iTask, ActionFuncPointer iAc _type=ACT; } -//void TMLActionCommand::execute(){ -//} - TMLCommand* TMLActionCommand::prepareNextTransaction(){ if (_simComp->getStopFlag()){ _simComp->setStoppedOnAction(); @@ -74,20 +71,8 @@ TMLCommand* TMLActionCommand::prepareNextTransaction(){ return 0; } -/*TMLTask* TMLActionCommand::getDependentTask() const{ - return 0; -}*/ - std::string TMLActionCommand::toString() const{ std::ostringstream outp; outp << "Action in " << TMLCommand::toString(); return outp.str(); } - -//std::string TMLActionCommand::toShortString() const{ -// return "Action"; -//} - -//std::string TMLActionCommand::getCommandStr() const{ -// return "act"; -//} diff --git a/simulators/c++2/src_simulator/app/TMLActionCommand.h b/simulators/c++2/src_simulator/app/TMLActionCommand.h index 83b124359ca4381d641759d520549ac620023014..e4c7c1a92c5ca2c1ee5b6f6e06dd60fa96bbf46a 100755 --- a/simulators/c++2/src_simulator/app/TMLActionCommand.h +++ b/simulators/c++2/src_simulator/app/TMLActionCommand.h @@ -54,6 +54,8 @@ public: \param iID ID of the command \param iTask Pointer to the task the command belongs to \param iActionFunc Member function pointer to the action function + \param iLiveVarList Bitmap of live variables + \param iCheckpoint Checkpoint Flag */ TMLActionCommand(ID iID, TMLTask* iTask, ActionFuncPointer iActionFunc, const char* iLiveVarList, bool iCheckpoint); inline void execute() {} diff --git a/simulators/c++2/src_simulator/app/TMLChoiceCommand.cpp b/simulators/c++2/src_simulator/app/TMLChoiceCommand.cpp index 8633ca549e7948e827e7ff8e919a162e847ae10e..0836d6d18f597d3c5f1ac434f6c9ae9cb7240729 100755 --- a/simulators/c++2/src_simulator/app/TMLChoiceCommand.cpp +++ b/simulators/c++2/src_simulator/app/TMLChoiceCommand.cpp @@ -48,9 +48,6 @@ TMLChoiceCommand::TMLChoiceCommand(ID iID, TMLTask* iTask, RangeFuncPointer iRan _type=CHO; } -//void TMLChoiceCommand::execute(){ -//} - TMLCommand* TMLChoiceCommand::getNextCommand() const{ ParamType aMin, aMax; return _nextCommand[(_task->*_rangeFunc)(aMin, aMax)]; @@ -81,11 +78,3 @@ std::string TMLChoiceCommand::toString() const{ outp << "Choice in " << TMLCommand::toString(); return outp.str(); } - -//std::string TMLChoiceCommand::toShortString() const{ -// return "Choice"; -//} - -//std::string TMLChoiceCommand::getCommandStr() const{ -// return "cho"; -//} diff --git a/simulators/c++2/src_simulator/app/TMLChoiceCommand.h b/simulators/c++2/src_simulator/app/TMLChoiceCommand.h index 5e9c0415f4c1221964f54d95c231992f5ce863ce..21c133ba80aec5c4613353610fed026ea660ddb2 100755 --- a/simulators/c++2/src_simulator/app/TMLChoiceCommand.h +++ b/simulators/c++2/src_simulator/app/TMLChoiceCommand.h @@ -46,15 +46,16 @@ Ludovic Apvrille, Renaud Pacalet ///This class stands for a fork in the control flow of a TML task. -/**Depending on the condition, one item of the _nextCommand array is chosen to determine the following command. The conditions are located in TMLTask::evaluateCondition() and the return value of this method is evaluated here.*/ class TMLChoiceCommand:public TMLCommand{ public: ///Constructor /** \param iID ID of the command \param iTask Pointer to the task the command belongs to - \param iCondFunc Member function pointer to the condition function returning the index of the next command + \param iRangeFunc function returning the rage of enabled branches \param iNbOfBranches Number of branches of the choice + \param iLiveVarList Bitmap of live variables + \param iCheckpoint Checkpoint Flag */ TMLChoiceCommand(ID iID, TMLTask* iTask, RangeFuncPointer iRangeFunc, unsigned int iNbOfBranches, const char* iLiveVarList, bool iCheckpoint); inline void execute() {} diff --git a/simulators/c++2/src_simulator/app/TMLCommand.cpp b/simulators/c++2/src_simulator/app/TMLCommand.cpp index c63deee1b01e21f7b184eebdfe5dc52ddd79585e..837de65b591ca760ef99765d68b53e1f02fb22d0 100755 --- a/simulators/c++2/src_simulator/app/TMLCommand.cpp +++ b/simulators/c++2/src_simulator/app/TMLCommand.cpp @@ -134,8 +134,8 @@ TMLCommand* TMLCommand::prepare(bool iInit){ NOTIFY_CMD_ENTERED(this); #else #ifdef EXPLO_ENABLED - if (dynamic_cast<IndeterminismSource*>(this)!=0) NOTIFY_CMD_ENTERED(this); - //if (dynamic_cast<TMLRandomCommand*>(this)!=0) NOTIFY_CMD_ENTERED(this); + //if (dynamic_cast<IndeterminismSource*>(this)!=0) NOTIFY_CMD_ENTERED(this); + if (dynamic_cast<TMLRandomCommand*>(this)!=0) NOTIFY_CMD_ENTERED(this); #endif #endif _justStarted=true; @@ -166,59 +166,19 @@ TMLCommand* TMLCommand::prepare(bool iInit){ return 0; } -//TMLTask* TMLCommand::getTask() const{ -// return _task; -//} - -//void TMLCommand::setNextCommand(TMLCommand** iNextCommand){ -// _nextCommand=iNextCommand; -//} - -//TMLCommand* TMLCommand::getNextCommand() const{ - //std::cerr << "getNext Cmd of TMLCommand\n"; - //return (_nextCommand==0)?0:_nextCommand[0]; -//} - TMLCommand** TMLCommand::getNextCommands(unsigned int& oNbOfCmd) const{ //returned number is not correct for composite choice/choice commands and composite action/choice commands !!!! oNbOfCmd=_nbOfNextCmds; return _nextCommand; } -//TMLTransaction* TMLCommand::getCurrTransaction() const{ -// return _currTransaction; -//} - std::string TMLCommand::toString() const{ std::ostringstream outp; outp << _task->toString() << " len:" << _length << " progress:" << _progress << " ID:" << _ID; return outp.str(); } -//TMLChannel* TMLCommand::getChannel(unsigned int iIndex) const{ -// return 0; -//} - -//unsigned int TMLCommand::getNbOfChannels() const{ -// return 0; -//} - -//TMLTask* TMLCommand::getDependentTask(unsigned int iIndex)const{ -// return 0; -//} - -//Parameter* TMLCommand::setParams(Parameter* ioParam){ -// return 0; -//} - -//#ifdef ADD_COMMENTS -//std::string TMLCommand::getCommentString(Comment* iCom) const{ -// return "no comment available"; -//} -//#endif - void TMLCommand::setBreakpoint(GeneralListener* iBreakp){ -//void TMLCommand::setBreakpoint(CommandListener* iBreakp){ removeBreakpoint(); _breakpoint=iBreakp; registerListener(iBreakp); @@ -288,34 +248,6 @@ void TMLCommand::removeGlobalListener(GeneralListener* iListener){ } } -//ID TMLCommand::getID() const{ -// return _ID; -//} - -//TMLLength TMLCommand::getProgress() const{ -// return _progress; -//} - -//unsigned int TMLCommand::getProgressInPercent() const{ -// return (_length==0)? 0:_progress*100/_length; -//} - -//void TMLCommand::setSimComponents(SimComponents* iSimComp){ -// _simComp=iSimComp; -//} - -//unsigned long TMLCommand::getStateHash() const{ -// return _ID + _progress; -//} - -//TMLTime TMLCommand::getCommandStartTime() const{ -// return (_commandStartTime==((TMLTime)-1))? 0: _commandStartTime; -//} - -//TMLLength TMLCommand::getLength() const{ -// return _length; -//} - void TMLCommand::streamStateXML(std::ostream& s){ for(std::list<TMLCommand*>::iterator i=_instanceList.begin(); i != _instanceList.end(); ++i){ s << TAG_CMDo << " id=\"" << (*i)->_ID << "\">" << TAG_EXECTIMESo << (*i)->_execTimes << TAG_EXECTIMESc << TAG_CMDc << "\n"; @@ -329,10 +261,6 @@ TMLCommand* TMLCommand::getCommandByID(ID iID){ return 0; } -//unsigned int TMLCommand::getType(){ -// return _type; -//} - template void TMLCommand::registerGlobalListenerForType<IndeterminismSource>(GeneralListener* iListener, TMLTask* aTask); template void TMLCommand::registerGlobalListenerForType<TMLChoiceCommand>(GeneralListener* iListener, TMLTask* aTask); template void TMLCommand::registerGlobalListenerForType<TMLActionCommand>(GeneralListener* iListener, TMLTask* aTask); diff --git a/simulators/c++2/src_simulator/app/TMLCommand.h b/simulators/c++2/src_simulator/app/TMLCommand.h index 2adafdf7ccb02372bccab7a56e92877462902f51..e54726103b5f61b000fb6522aaf0b31ae98b1940 100755 --- a/simulators/c++2/src_simulator/app/TMLCommand.h +++ b/simulators/c++2/src_simulator/app/TMLCommand.h @@ -55,7 +55,6 @@ class HashAlgo; ///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 <GeneralListener>{ -//class TMLCommand: public Serializable, public ListenerSubject <CommandListener>, public ListenerSubject <TransactionListener> { public: ///Constructor /** @@ -66,7 +65,6 @@ public: \param iLiveVarList Bitmap of live variables \param iCheckpoint Checkpoint Flag */ - //TMLCommand(unsigned int iID, TMLTask* iTask, TMLLength iLength, ParamFuncPointer iParamFunc, unsigned int iNbOfNextCmds); TMLCommand(ID iID, TMLTask* iTask, TMLLength iLength, unsigned int iNbOfNextCmds, const char* iLiveVarList, bool iCheckpoint); ///Destructor virtual ~TMLCommand(); @@ -145,20 +143,17 @@ public: /** \param iListener Pointer to the listener */ - //static void registerGlobalListener(CommandListener* iListener); static void registerGlobalListener(GeneralListener* 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); template<typename T> static void registerGlobalListenerForType(GeneralListener* iListener, TMLTask* aTask); ///Removes a listener at all TMLCommand instances /** \param iListener Pointer to the listener */ - //static void removeGlobalListener(CommandListener* iListener); static void removeGlobalListener(GeneralListener* iListener); ///Returns the unique ID of the command /** @@ -169,7 +164,6 @@ public: /** \param iBreakp Pointer to breakpoint */ - //void setBreakpoint(CommandListener* iBreakp); void setBreakpoint(GeneralListener* iBreakp); ///Removes the breakpoint void removeBreakpoint(); @@ -265,8 +259,6 @@ protected: unsigned int _execTimes; ///Buffer for transaction to be proposed to kernel TMLTransaction transBuffer; - /////Hash Algorithm object - //HashAlgo* _hash; }; #endif diff --git a/simulators/c++2/src_simulator/app/TMLExeciCommand.cpp b/simulators/c++2/src_simulator/app/TMLExeciCommand.cpp index 1f789023d6ac1c3247ab872246097f975758bf68..b30c33159f53e92ec6918ca8f6e458c3ecc31ae2 100755 --- a/simulators/c++2/src_simulator/app/TMLExeciCommand.cpp +++ b/simulators/c++2/src_simulator/app/TMLExeciCommand.cpp @@ -86,6 +86,3 @@ std::string TMLExeciCommand::toShortString() const{ return outp.str(); } -//std::string TMLExeciCommand::getCommandStr() const{ -// return "exe"; -//} diff --git a/simulators/c++2/src_simulator/app/TMLExeciRangeCommand.cpp b/simulators/c++2/src_simulator/app/TMLExeciRangeCommand.cpp index df76ddfd8b7f5608b040a7ff82357e8b5681701d..7476aff21e4d5feb08967c30322aa127e257f191 100644 --- a/simulators/c++2/src_simulator/app/TMLExeciRangeCommand.cpp +++ b/simulators/c++2/src_simulator/app/TMLExeciRangeCommand.cpp @@ -83,10 +83,6 @@ std::string TMLExeciRangeCommand::toShortString() const{ return outp.str(); } -//std::string TMLExeciRangeCommand::getCommandStr() const{ -// return "exe"; -//} - unsigned int TMLExeciRangeCommand::getRandomRange(){ ParamType aMax, aMin; (_task->*_rangeFunc)(aMin, aMax); diff --git a/simulators/c++2/src_simulator/app/TMLExeciRangeCommand.h b/simulators/c++2/src_simulator/app/TMLExeciRangeCommand.h index f1be47a4d8f867c0fb3a813adafc19a320086e97..732af06f65243a5436c0ef50d6ac3dfd742cb586 100644 --- a/simulators/c++2/src_simulator/app/TMLExeciRangeCommand.h +++ b/simulators/c++2/src_simulator/app/TMLExeciRangeCommand.h @@ -59,7 +59,6 @@ public: */ TMLExeciRangeCommand(ID iID, TMLTask* iTask, RangeFuncPointer iRangeFunc, unsigned int iType, const char* iLiveVarList, bool iCheckpoint); void execute(); - //TMLTask* getDependentTask() const; std::string toString() const; std::string toShortString() const; inline std::string getCommandStr() const {return "exe";} diff --git a/simulators/c++2/src_simulator/app/TMLNotifiedCommand.cpp b/simulators/c++2/src_simulator/app/TMLNotifiedCommand.cpp index babe8cac2ff93b9f6d124ad5979ef1645f6a8de5..9e12f054188adc35a81c1a275ff0d858ef07f83a 100644 --- a/simulators/c++2/src_simulator/app/TMLNotifiedCommand.cpp +++ b/simulators/c++2/src_simulator/app/TMLNotifiedCommand.cpp @@ -67,14 +67,6 @@ TMLCommand* TMLNotifiedCommand::prepareNextTransaction(){ return this; } -/*TMLTask* TMLNotifiedCommand::getDependentTask() const{ - return 0; -}*/ - -//TMLChannel* TMLNotifiedCommand::getChannel() const{ -// return _channel; -//} - std::string TMLNotifiedCommand::toString() const{ std::ostringstream outp; outp << "Notified in " << TMLCommand::toString() << " " << _channel->toString(); @@ -87,10 +79,6 @@ std::string TMLNotifiedCommand::toShortString() const{ return outp.str(); } -//std::string TMLNotifiedCommand::getCommandStr() const{ -// return "notified"; -//} - #ifdef ADD_COMMENTS std::string TMLNotifiedCommand::getCommentString(Comment* iCom) const{ std::ostringstream comment; diff --git a/simulators/c++2/src_simulator/app/TMLNotifiedCommand.h b/simulators/c++2/src_simulator/app/TMLNotifiedCommand.h index 8b69c3081db25e70fc793a40bee4a209664cceff..5a602861e7e8dbc0c00649c8aeaffbc3af0eaaea 100644 --- a/simulators/c++2/src_simulator/app/TMLNotifiedCommand.h +++ b/simulators/c++2/src_simulator/app/TMLNotifiedCommand.h @@ -60,7 +60,6 @@ public: */ TMLNotifiedCommand(ID iID, TMLTask* iTask,TMLEventChannel* iChannel,ParamType* iResultVar,const std::string& iResultVarDescr, const char* iLiveVarList, bool iCheckpoint); void execute(); - //TMLTask* getDependentTask() const; inline TMLChannel* getChannel() const {return dynamic_cast<TMLChannel*>(_channel);} std::string toString() const; std::string toShortString() const; diff --git a/simulators/c++2/src_simulator/app/TMLRandomChoiceCommand.cpp b/simulators/c++2/src_simulator/app/TMLRandomChoiceCommand.cpp index 1f45f67745a665beac049f7507b1dbc191d4b0ca..2036349c729d05a72ac63c98b1fe8464d407e973 100644 --- a/simulators/c++2/src_simulator/app/TMLRandomChoiceCommand.cpp +++ b/simulators/c++2/src_simulator/app/TMLRandomChoiceCommand.cpp @@ -81,12 +81,3 @@ TMLCommand* TMLRandomChoiceCommand::prepareNextTransaction(){ //std::cout << "no next\n"; return 0; } - -//unsigned int TMLRandomChoiceCommand::getRandomRange(){ -// return _dynamicRange; -//} - -//TMLCommand* TMLRandomChoiceCommand::getNextCommand() const{ - //std::cout << "Here we go " << _randomValue << " .................\n"; -// return _nextCommand[_randomValue]; -//} diff --git a/simulators/c++2/src_simulator/app/TMLRandomChoiceCommand.h b/simulators/c++2/src_simulator/app/TMLRandomChoiceCommand.h index 7ad376dc95f0db71c702f0ff5f85957c4529fc8a..c989b8bc5f2d0b0cc85b968bb354ebca1b6c48e4 100644 --- a/simulators/c++2/src_simulator/app/TMLRandomChoiceCommand.h +++ b/simulators/c++2/src_simulator/app/TMLRandomChoiceCommand.h @@ -44,12 +44,23 @@ Ludovic Apvrille, Renaud Pacalet #include <TMLChoiceCommand.h> #include <IndeterminismSource.h> +///This class models a random fork in control flow within a TML Task class TMLRandomChoiceCommand: public TMLChoiceCommand, public IndeterminismSource{ public: + ///Constructor + /** + \param iID ID of the command + \param iTask Pointer to the task the command belongs to + \param iRangeFunc function returning the rage of enabled branches + \param iNbOfBranches Number of branches of the choice + \param iLiveVarList Bitmap of live variables + \param iCheckpoint Checkpoint Flag + */ TMLRandomChoiceCommand(ID iID, TMLTask* iTask, RangeFuncPointer iRangeFunc, unsigned int iNbOfBranches, const char* iLiveVarList, bool iCheckpoint); TMLCommand* prepareNextTransaction(); inline unsigned int getRandomRange() {return _dynamicRange;} protected: + ///A bitmap of enabled branches unsigned int _dynamicRange; inline TMLCommand* getNextCommand() const {return _nextCommand[_randomValue];} }; diff --git a/simulators/c++2/src_simulator/app/TMLRandomCommand.cpp b/simulators/c++2/src_simulator/app/TMLRandomCommand.cpp index ce676fc59be5855cb39a776475a9178ddd182201..b38ee6eb3ba165fdcb7a20dedc06bcde13b10820 100644 --- a/simulators/c++2/src_simulator/app/TMLRandomCommand.cpp +++ b/simulators/c++2/src_simulator/app/TMLRandomCommand.cpp @@ -46,9 +46,6 @@ TMLRandomCommand::TMLRandomCommand(ID iID, TMLTask* iTask, RangeFuncPointer iRan _type=RND; } -//void TMLRandomCommand::execute(){ -//} - unsigned int TMLRandomCommand::getRandomRange(){ ParamType aMax; (_task->*_rangeFunc)(_aMin, aMax); @@ -92,11 +89,3 @@ std::string TMLRandomCommand::TMLRandomCommand::toString() const{ outp << "Random in " << TMLCommand::toString(); return outp.str(); } - -//std::string TMLRandomCommand::toShortString() const{ -// return "Random"; -//} - -//std::string TMLRandomCommand::getCommandStr() const{ -// return "rnd"; -//} diff --git a/simulators/c++2/src_simulator/app/TMLRandomCommand.h b/simulators/c++2/src_simulator/app/TMLRandomCommand.h index a68bd525474a00eb00db3f374efc6979cc7d6b83..0b7a22dacf12030c203718c14784b2f2342dbb8e 100644 --- a/simulators/c++2/src_simulator/app/TMLRandomCommand.h +++ b/simulators/c++2/src_simulator/app/TMLRandomCommand.h @@ -44,10 +44,19 @@ Ludovic Apvrille, Renaud Pacalet #include <IndeterminismSource.h> #include <TMLCommand.h> +///Class modeling a random number generator within a TML Task class TMLRandomCommand: public TMLCommand, public IndeterminismSource{ public: + ///Constructor + /** + \param iID ID of the command + \param iTask Pointer to the task the command belongs to + \param iRangeFunc function returning the rage of enabled branches + \param iResultVar Pointer to the variable that is assigned the random value + \param iLiveVarList Bitmap of live variables + \param iCheckpoint Checkpoint Flag + */ TMLRandomCommand(ID iID, TMLTask* iTask, RangeFuncPointer iRangeFunc, ParamType* iResultVar, const char* iLiveVarList, bool iCheckpoint); - void execute() {} unsigned int getRandomRange(); TMLCommand* prepareNextTransaction(); @@ -55,8 +64,11 @@ public: inline std::string toShortString() const {return "Random";} inline std::string getCommandStr() const {return "rnd";} protected: + ///Function returning the rage of enabled branches RangeFuncPointer _rangeFunc; + ///Pointer to the variable that is assigned the random value ParamType* _resultVar; + ///Minimum value of the range of the random variable ParamType _aMin; }; diff --git a/simulators/c++2/src_simulator/app/TMLReadCommand.cpp b/simulators/c++2/src_simulator/app/TMLReadCommand.cpp index 20b979758296a731974f5e427edd1f6690e11e25..9611d47c3fae17baed5ec73366e67e722540a30c 100755 --- a/simulators/c++2/src_simulator/app/TMLReadCommand.cpp +++ b/simulators/c++2/src_simulator/app/TMLReadCommand.cpp @@ -39,7 +39,6 @@ Ludovic Apvrille, Renaud Pacalet */ #include <TMLReadCommand.h> -//#include <TMLChannel.h> #include <TMLTask.h> #include <TMLTransaction.h> #include <Bus.h> @@ -85,18 +84,6 @@ TMLCommand* TMLReadCommand::prepareNextTransaction(){ return this; } -//TMLChannel* TMLReadCommand::getChannel(unsigned int iIndex) const{ -// return _channel; -//} - -//unsigned int TMLReadCommand::getNbOfChannels() const{ -// return 1; -//} - -//TMLTask* TMLReadCommand::getDependentTask(unsigned int iIndex)const{ -// return _channel->getBlockedWriteTask(); -//} - std::string TMLReadCommand::toString() const{ std::ostringstream outp; outp << "Read in " << TMLCommand::toString() << " " <<_channel->toString(); @@ -108,7 +95,3 @@ std::string TMLReadCommand::toShortString() const{ outp << _task->toString() << ": Read " << _length << "," << _channel->toShortString(); return outp.str(); } - -//std::string TMLReadCommand::getCommandStr() const{ -// return "rd"; -//} diff --git a/simulators/c++2/src_simulator/app/TMLReadCommand.h b/simulators/c++2/src_simulator/app/TMLReadCommand.h index 9fb6ad490b3e0ab8da5af183da99a3b2eadeaa84..7efa052c27dd639c8a9ae6a91662294f207cce29 100755 --- a/simulators/c++2/src_simulator/app/TMLReadCommand.h +++ b/simulators/c++2/src_simulator/app/TMLReadCommand.h @@ -71,8 +71,6 @@ protected: LengthFuncPointer _lengthFunc; ///Channel which is read TMLChannel* _channel; - /////Bitmap of live variables - //const char* _liveVarList; TMLCommand* prepareNextTransaction(); }; diff --git a/simulators/c++2/src_simulator/app/TMLRequestCommand.cpp b/simulators/c++2/src_simulator/app/TMLRequestCommand.cpp index 0e77b1f40d56538c5d3ab2c6bd8e7195906fb2bf..59b3826601673ec6bff875a94fb5df2eb3cbae54 100644 --- a/simulators/c++2/src_simulator/app/TMLRequestCommand.cpp +++ b/simulators/c++2/src_simulator/app/TMLRequestCommand.cpp @@ -68,18 +68,6 @@ TMLCommand* TMLRequestCommand::prepareNextTransaction(){ return this; } -//TMLChannel* TMLRequestCommand::getChannel(unsigned int iIndex) const{ -// return dynamic_cast<TMLChannel*>(_channel); -//} - -//unsigned int TMLRequestCommand::getNbOfChannels() const{ -// return 1; -//} - -//TMLTask* TMLRequestCommand::getDependentTask(unsigned int iIndex)const{ -// return _channel->getBlockedReadTask(); -//} - std::string TMLRequestCommand::toString() const{ std::ostringstream outp; outp << "Request in " << TMLCommand::toString() << " " << _channel->toString(); @@ -91,26 +79,3 @@ std::string TMLRequestCommand::toShortString() const{ outp << _task->toString() << ": Request " << _channel->toShortString(); return outp.str(); } - -//std::string TMLRequestCommand::getCommandStr() const{ -// return "sendReq"; -//} - -/*ParamFuncPointer TMLRequestCommand::getParamFuncPointer() const{ - return _paramFunc; -}*/ - -/*void TMLRequestCommand::setParams(Parameter<ParamType>& ioParam){ - if (_paramFunc==0){ - ioParam=_statParam; - }else{ - (_task->*_paramFunc)(ioParam); - } - //std::cout << "Hello in setparams: "; - //ioParam.print(); - //std::cout << "\n"; -}*/ - -//Parameter* TMLRequestCommand::setParams(Parameter* ioParam){ - //return (_task->*_paramFunc)(ioParam); -//} diff --git a/simulators/c++2/src_simulator/app/TMLRequestCommand.h b/simulators/c++2/src_simulator/app/TMLRequestCommand.h index d7309a6e0d7b82017de08cb690ec292e9274f668..6613d86bf7ef39b66e598310574d54ce44b4991b 100644 --- a/simulators/c++2/src_simulator/app/TMLRequestCommand.h +++ b/simulators/c++2/src_simulator/app/TMLRequestCommand.h @@ -57,9 +57,8 @@ public: \param iParamFunc Pointer to a parameter function \param iLiveVarList Bitmap of live variables \param iCheckpoint Checkpoint Flag - \param iStatParam Static parameter if applicable */ - TMLRequestCommand(ID iID, TMLTask* iTask, TMLEventChannel* iChannel, ParamFuncPointer iParamFunc, const char* iLiveVarList, bool iCheckpoint/*, Parameter* iStatParam = 0*/); + TMLRequestCommand(ID iID, TMLTask* iTask, TMLEventChannel* iChannel, ParamFuncPointer iParamFunc, const char* iLiveVarList, bool iCheckpoint); void execute(); inline TMLChannel* getChannel(unsigned int iIndex) const {return dynamic_cast<TMLChannel*>(_channel);} inline unsigned int getNbOfChannels() const {return 1;} diff --git a/simulators/c++2/src_simulator/app/TMLSelectCommand.cpp b/simulators/c++2/src_simulator/app/TMLSelectCommand.cpp index 2aae249034701d6a44cfb25544ed6502e6d2c6c9..316836ec53b9137203fe52b4e862f4a7d9c4a2ea 100644 --- a/simulators/c++2/src_simulator/app/TMLSelectCommand.cpp +++ b/simulators/c++2/src_simulator/app/TMLSelectCommand.cpp @@ -143,23 +143,6 @@ TMLChannel* TMLSelectCommand::getChannel(unsigned int iIndex) const{ return _currTransaction->getChannel(); } -//unsigned int TMLSelectCommand::getNbOfChannels() const{ -// return _nbOfNextCmds; -//} - -//TMLTask* TMLSelectCommand::getDependentTask(unsigned int iIndex)const{ -// return _channel[iIndex]->getBlockedWriteTask(); -//} - -//TMLCommand* TMLSelectCommand::getNextCommand() const{ -// return _nextCommand[_indexNextCommand]; -//} - - -//ParamFuncPointer TMLSelectCommand::getParamFuncPointer() const{ -// return (_paramFuncs==0)?0:_paramFuncs[_indexNextCommand]; -//} - std::string TMLSelectCommand::toString() const{ std::ostringstream outp; outp << "SelectEvent in " << TMLCommand::toString() << " " << _channel[_indexNextCommand]->toString(); @@ -171,21 +154,3 @@ std::string TMLSelectCommand::toShortString() const{ outp << _task->toString() << ": SelectEvent"; return outp.str(); } - -//std::string TMLSelectCommand::getCommandStr() const{ -// return "sel"; -//} - -//#ifdef ADD_COMMENTS -//std::string TMLSelectCommand::getCommentString(Comment* iCom) const{ -// return "SelectEvent result: " + _channel[iCom->_actionCode]->toShortString(); -//} -//#endif - -//Parameter* TMLSelectCommand::setParams(Parameter* ioParam){ -// return (_task->*_paramFuncs[_indexNextCommand])(ioParam); -//} - -//unsigned int TMLSelectCommand::getRandomRange(){ -// return _nbOfPossSync ; -//} diff --git a/simulators/c++2/src_simulator/app/TMLSelectCommand.h b/simulators/c++2/src_simulator/app/TMLSelectCommand.h index 3b822ce6f5fcfb6ee282709fa2781acd15483495..f0a17c96211e80ee06f5b25041a622455b5e9b65 100644 --- a/simulators/c++2/src_simulator/app/TMLSelectCommand.h +++ b/simulators/c++2/src_simulator/app/TMLSelectCommand.h @@ -80,14 +80,10 @@ protected: TMLEventChannel** _channel; ///Pointer to an array of parameter function pointers ParamFuncPointer* _paramFuncs; - /////Number of channels in the array - //unsigned int _numbChannels; ///Index of the next command within the _nextCommand array unsigned int _indexNextCommand; ///Highest index of the channels on which the TMLChannel::testRead() method has been performed. unsigned int _maxChannelIndex; - /////Bitmap of live variables - //const char* _liveVarList; }; #endif diff --git a/simulators/c++2/src_simulator/app/TMLSendCommand.cpp b/simulators/c++2/src_simulator/app/TMLSendCommand.cpp index f166896caef4e40a8efe2ad22cc5481c3e64b917..00f263abb009cb98cfffaa8c34298d7010a2ebc3 100644 --- a/simulators/c++2/src_simulator/app/TMLSendCommand.cpp +++ b/simulators/c++2/src_simulator/app/TMLSendCommand.cpp @@ -70,18 +70,6 @@ TMLCommand* TMLSendCommand::prepareNextTransaction(){ return this; } -//TMLChannel* TMLSendCommand::getChannel(unsigned int iIndex) const{ -// return _channel; -//} - -//unsigned int TMLSendCommand::getNbOfChannels() const{ -// return 1; -//} - -//TMLTask* TMLSendCommand::getDependentTask(unsigned int iIndex)const{ -// return _channel->getBlockedReadTask(); -//} - std::string TMLSendCommand::toString() const{ std::ostringstream outp; outp << "Send in " << TMLCommand::toString() << " " << _channel->toString(); @@ -94,11 +82,3 @@ std::string TMLSendCommand::toShortString() const{ return outp.str(); } -//std::string TMLSendCommand::getCommandStr() const{ -// return "snd"; -//} - -//Parameter* TMLSendCommand::setParams(Parameter* ioParam){ -// return (_task->*_paramFunc)(ioParam); -//} - diff --git a/simulators/c++2/src_simulator/app/TMLSendCommand.h b/simulators/c++2/src_simulator/app/TMLSendCommand.h index 8e498d9cd95c170a7772a792289fb3dde3f32711..8f3452c3a0647bd2145152eb950a130caa62c2f4 100644 --- a/simulators/c++2/src_simulator/app/TMLSendCommand.h +++ b/simulators/c++2/src_simulator/app/TMLSendCommand.h @@ -57,9 +57,8 @@ public: \param iParamFunc Pointer to a parameter function \param iLiveVarList Bitmap of live variables \param iCheckpoint Checkpoint Flag - \param iStatParam Static parameter if applicable */ - TMLSendCommand(ID iID, TMLTask* iTask, TMLEventChannel* iChannel, ParamFuncPointer iParamFunc, const char* iLiveVarList, bool iCheckpoint/*, Parameter* iStatParam=0*/); + TMLSendCommand(ID iID, TMLTask* iTask, TMLEventChannel* iChannel, ParamFuncPointer iParamFunc, const char* iLiveVarList, bool iCheckpoint); void execute(); inline TMLChannel* getChannel(unsigned int iIndex) const {return dynamic_cast<TMLChannel*>(_channel);} inline unsigned int getNbOfChannels() const {return 1;} diff --git a/simulators/c++2/src_simulator/app/TMLStopCommand.cpp b/simulators/c++2/src_simulator/app/TMLStopCommand.cpp index 53eeb82f3cf7298b87431917ccaef85e9b51d4e1..0516f48d5488227d37c9cf3caf535958fd8044e7 100644 --- a/simulators/c++2/src_simulator/app/TMLStopCommand.cpp +++ b/simulators/c++2/src_simulator/app/TMLStopCommand.cpp @@ -39,34 +39,13 @@ Ludovic Apvrille, Renaud Pacalet */ #include <TMLStopCommand.h> -//#include <TMLTask.h> TMLStopCommand::TMLStopCommand(ID iID, TMLTask* iTask): TMLCommand(iID, iTask, 1, 0, 0, false){ _type=STP; } -//void TMLStopCommand::execute(){ -//} - -//TMLCommand* TMLStopCommand::prepareNextTransaction(){ -// _task->finished(); -// return 0; -//} - -/*TMLTask* TMLStopCommand::getDependentTask() const{ - return 0; -}*/ - std::string TMLStopCommand::toString() const{ std::ostringstream outp; outp << "Stop in " << TMLCommand::toString(); return outp.str(); } - -//std::string TMLStopCommand::toShortString() const{ -// return "stp"; -//} - -//std::string TMLStopCommand::getCommandStr() const{ -// return "stp"; -//} diff --git a/simulators/c++2/src_simulator/app/TMLStopCommand.h b/simulators/c++2/src_simulator/app/TMLStopCommand.h index 646436cd59c5b63308093fb3e62208f52a4fba92..c358976b4f2361194bb2572f7bad7b55d07d5886 100644 --- a/simulators/c++2/src_simulator/app/TMLStopCommand.h +++ b/simulators/c++2/src_simulator/app/TMLStopCommand.h @@ -56,7 +56,6 @@ public: */ TMLStopCommand(ID iID, TMLTask* iTask); inline void execute() {} - //TMLTask* getDependentTask() const; std::string toString() const; inline std::string toShortString() const {return "stp";} inline std::string getCommandStr() const {return "stp";} diff --git a/simulators/c++2/src_simulator/app/TMLTask.cpp b/simulators/c++2/src_simulator/app/TMLTask.cpp index 507d8feabfa540f275f551d2164e324f3b5d0dc3..7c2bec7c47b9b3414f597b30985246ee7a7b74ef 100755 --- a/simulators/c++2/src_simulator/app/TMLTask.cpp +++ b/simulators/c++2/src_simulator/app/TMLTask.cpp @@ -67,45 +67,13 @@ TMLTask::~TMLTask(){ if (_comment!=0) delete [] _comment; } -//Priority TMLTask::getPriority() const{ -// return _priority; -//} - -//TMLTime TMLTask::getEndLastTransaction() const{ -// return _endLastTransaction; -//} - -//TMLCommand* TMLTask::getCurrCommand() const{ -// return _currCommand; -//} - -//void TMLTask::setCurrCommand(TMLCommand* iCurrCommand){ -// _currCommand=iCurrCommand; -//} - -//CPU* TMLTask::getCPU() const{ -// return _currentCPU; -//} - -//std::string TMLTask::toString() const{ -// return _name; -//} - std::string TMLTask::toShortString() const{ std::ostringstream outp; outp << "ta" << _ID; return outp.str(); } -//ID TMLTask::getID() const{ -// return _ID; -//} - #ifdef ADD_COMMENTS -//void TMLTask::addComment(Comment* iComment){ -// _commentList.push_back(iComment); -//} - std::string TMLTask::getNextComment(bool iInit, Comment*& oComment){ if (iInit) _posCommentList=_commentList.begin(); if (_posCommentList == _commentList.end()){ @@ -140,7 +108,6 @@ void TMLTask::addTransaction(TMLTransaction* iTrans){ } } -//TMLTime TMLTask::getNextSignalChange(bool iInit, std::string& oSigChange, bool& oNoMoreTrans){ void TMLTask::getNextSignalChange(bool iInit, SignalChangeData* oSigData){ //std::ostringstream outp; if (iInit){ @@ -334,30 +301,6 @@ ParamType* TMLTask::getVariableByName(const std::string& iVarName ,bool& oIsId){ return _varLookUpName[iVarName.c_str()]; } -//ParamType* TMLTask::getVariableByID(ID iVarID){ -// return _varLookUpID[iVarID]; -//} - -//void TMLTask::addCommand(ID iID, TMLCommand* iCmd){ -// _commandHash[iID]=iCmd; -//} - -//TMLCommand* TMLTask::getCommandByID(ID iID){ -// return _commandHash[iID]; -//} - -//void TMLTask::streamStateXML(std::ostream& s) const{ -// streamBenchmarks(s); -//} - -/*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(); -}*/ - void TMLTask::finished(){ _justStarted=true; #ifdef LISTENERS_ENABLED @@ -391,16 +334,12 @@ TMLTransaction* TMLTask::getNextTransaction(TMLTime iEndSchedule) const{ //return (_currCommand==0 || _isScheduled)?0:_currCommand->getCurrTransaction(); } -//unsigned int TMLTask::getInstanceNo(){ -// return _myInstance; -//} - -//void TMLTask::transWasScheduled(SchedulableDevice* iCPU){ - //_isScheduled=true; - //if (_noOfCPUs>1) _currentCPU = dynamic_cast<CPU*>(iCPU); -//} +/*void TMLTask::transWasScheduled(SchedulableDevice* iCPU){ + _isScheduled=true; + if (_noOfCPUs>1) _currentCPU = dynamic_cast<CPU*>(iCPU); +} -/*void TMLTask::resetScheduledFlag(){ +void TMLTask::resetScheduledFlag(){ RESET_SCHEDULING; } diff --git a/simulators/c++2/src_simulator/app/TMLTask.h b/simulators/c++2/src_simulator/app/TMLTask.h index f09d82818079e411b6b35bf57cba9f034a9326a4..dc5e34bad9772b243290a6e27507d404787fe108 100755 --- a/simulators/c++2/src_simulator/app/TMLTask.h +++ b/simulators/c++2/src_simulator/app/TMLTask.h @@ -48,7 +48,6 @@ Ludovic Apvrille, Renaud Pacalet #include <Comment.h> #include <MemPool.h> #include <ListenerSubject.h> -//#include <TaskListener.h> #include <GeneralListener.h> #include <WorkloadSource.h> #include <HashAlgo.h> @@ -131,7 +130,6 @@ public: */ std::string getNextComment(bool iInit, Comment*& oComment); #endif - //TMLTime getNextSignalChange(bool iInit, std::string& oSigChange, bool& oNoMoreTrans); void getNextSignalChange(bool iInit, SignalChangeData* oSigData); ///Adds a given transaction to the internal transaction list /** @@ -170,17 +168,13 @@ public: inline void streamStateXML(std::ostream& s) const {streamBenchmarks(s);} ///Returns an iterator for the internal variable ID 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 */ - //VariableLookUpTableID::const_iterator getVariableIteratorID(bool iEnd) const; inline const VariableLookUpTableID& getVariableLookUpTableID() const{return _varLookUpID;} ///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; const VariableLookUpTableName& getVariableLookUpTableName() const{return _varLookUpName;} ///Is called when a stop command is encountered void finished(); @@ -201,14 +195,14 @@ public: \return Instance number */ inline unsigned int getInstanceNo() {return _myInstance;} - ///Notifies the Task of being scheduled by a CPU - /** - \param iCPU CPU that has scheduled the Task - */ + ////Notifies the Task of being scheduled by a CPU + ////** + //\param iCPU CPU that has scheduled the Task + //*/ //void transWasScheduled(SchedulableDevice* iCPU); - ///Resets the flag indicating that the Task has been scheduled + ////Resets the flag indicating that the Task has been scheduled //void resetScheduledFlag(); - ///Invalidates the schedule of all cores the task is mapped onto + ////Invalidates the schedule of all cores the task is mapped onto //void setRescheduleFlagForCores(); ///Returns the current state hash /** @@ -226,7 +220,6 @@ public: //*/ //void setCommonExecution(bool iCommonExecution); void refreshStateHash(const char* iLiveVarList); - //void addRawTransaction(TMLTransaction* iTrans); void schedule2TXT(std::ostream& myfile) const; int hasRunnableTrans(CPU* iCPU); protected: @@ -277,11 +270,11 @@ protected: ///Consecutive number of this task instance unsigned int _myInstance; ///Indicates whether this task has already been scheduled - //bool _isScheduled; - /////Last established state Hash - //HashValueType _lastStateHash; - /////Flag indicating whether the task state has been encoutered before - //bool _commonExecution; + /*bool _isScheduled; + ///Last established state Hash + HashValueType _lastStateHash; + ///Flag indicating whether the task state has been encoutered before + bool _commonExecution;*/ HashAlgo _stateHash; const char* _liveVarList; bool _hashInvalidated; diff --git a/simulators/c++2/src_simulator/app/TMLWaitCommand.cpp b/simulators/c++2/src_simulator/app/TMLWaitCommand.cpp index 75fa4a4422eb8de0c04c964a8d34984fd7b7ac51..f09894e557fb1bc00dadaa48c6619bf4df9342bc 100644 --- a/simulators/c++2/src_simulator/app/TMLWaitCommand.cpp +++ b/simulators/c++2/src_simulator/app/TMLWaitCommand.cpp @@ -69,18 +69,6 @@ TMLCommand* TMLWaitCommand::prepareNextTransaction(){ return this; } -//TMLChannel* TMLWaitCommand::getChannel(unsigned int iIndex) const{ -// return _channel; -//} - -//unsigned int TMLWaitCommand::getNbOfChannels() const{ -// return 1; -//} - -//TMLTask* TMLWaitCommand::getDependentTask(unsigned int iIndex)const{ -// return _channel->getBlockedWriteTask(); -//} - std::string TMLWaitCommand::toString() const{ std::ostringstream outp; outp << "Wait in " << TMLCommand::toString() << " " << _channel->toString(); @@ -92,11 +80,3 @@ std::string TMLWaitCommand::toShortString() const{ outp << _task->toString() << ": Wait " << _channel->toShortString(); return outp.str(); } - -//std::string TMLWaitCommand::getCommandStr() const{ -// if (_channel->getRequestChannel()) return "waitReq"; else return "wait"; -//} - -//Parameter* TMLWaitCommand::setParams(Parameter* ioParam){ -// return (_task->*_paramFunc)(ioParam); -//} diff --git a/simulators/c++2/src_simulator/app/TMLWaitCommand.h b/simulators/c++2/src_simulator/app/TMLWaitCommand.h index 3d0cf11968c27e5363cdc924fe21ec3d8dfb535a..4d42c69211f401bdb038c3e561f4a1c00d03a049 100644 --- a/simulators/c++2/src_simulator/app/TMLWaitCommand.h +++ b/simulators/c++2/src_simulator/app/TMLWaitCommand.h @@ -57,9 +57,8 @@ public: \param iParamFunc Pointer to a parameter function \param iLiveVarList Bitmap of live variables \param iCheckpoint Checkpoint Flag - \param iStatParam Static parameter if applicable */ - TMLWaitCommand(ID iID, TMLTask* iTask,TMLEventChannel* iChannel, ParamFuncPointer iParamFunc, const char* iLiveVarList, bool iCheckpoint/*, Parameter* iStatParam = 0*/); + TMLWaitCommand(ID iID, TMLTask* iTask,TMLEventChannel* iChannel, ParamFuncPointer iParamFunc, const char* iLiveVarList, bool iCheckpoint); void execute(); inline TMLChannel* getChannel(unsigned int iIndex) const {return dynamic_cast<TMLChannel*>(_channel);} inline unsigned int getNbOfChannels() const {return 1;} @@ -67,11 +66,6 @@ public: std::string toString() const; std::string toShortString() const; inline std::string getCommandStr() const {if (_channel->getRequestChannel()) return "waitReq"; else return "wait";} - /////Returns a pointer to the parameter data structure - ////** - //\return Pointer to parameter data structure - //*/ - //ParamFuncPointer getParamFuncPointer() const; ///Sets a parameter data structure according to the parameters of the command /** \param ioParam Parameter data structure @@ -83,8 +77,6 @@ protected: ///Pointer to the parameter function of the command ParamFuncPointer _paramFunc; TMLCommand* prepareNextTransaction(); - ////Bitmap of live variables - //const char* _liveVarList; }; #endif diff --git a/simulators/c++2/src_simulator/app/TMLWriteCommand.cpp b/simulators/c++2/src_simulator/app/TMLWriteCommand.cpp index 8e96b6b0f36d191a5710abf3c0d4e83eac633cea..e082e5e72170d5e907a828a2885f813b855e8361 100755 --- a/simulators/c++2/src_simulator/app/TMLWriteCommand.cpp +++ b/simulators/c++2/src_simulator/app/TMLWriteCommand.cpp @@ -87,18 +87,6 @@ TMLCommand* TMLWriteCommand::prepareNextTransaction(){ return this; } -//TMLChannel* TMLWriteCommand::getChannel(unsigned int iIndex) const{ -// return _channel; -//} - -//unsigned int TMLWriteCommand::getNbOfChannels() const{ -// return 1; -//} - -//TMLTask* TMLWriteCommand::getDependentTask(unsigned int iIndex)const{ -// return _channel->getBlockedReadTask(); -//} - std::string TMLWriteCommand::toString() const{ std::ostringstream outp; outp << "Write in " << TMLCommand::toString() << " " << _channel->toString(); @@ -110,7 +98,3 @@ std::string TMLWriteCommand::toShortString() const{ outp << _task->toString() << ": Write " << _length << "," << _channel->toShortString(); return outp.str(); } - -//std::string TMLWriteCommand::getCommandStr() const{ -// return "wr"; -//} diff --git a/simulators/c++2/src_simulator/app/TMLWriteCommand.h b/simulators/c++2/src_simulator/app/TMLWriteCommand.h index 05e8a6dbaf7d5012a1bb6e13d466f4dd8ae42f40..4de9c2bfda54e6c752928c4711d5234beed1a205 100755 --- a/simulators/c++2/src_simulator/app/TMLWriteCommand.h +++ b/simulators/c++2/src_simulator/app/TMLWriteCommand.h @@ -71,8 +71,6 @@ protected: LengthFuncPointer _lengthFunc; ///Channel to which is written TMLChannel* _channel; - ////Bitmap of live variables - //const char* _liveVarList; TMLCommand* prepareNextTransaction(); }; diff --git a/simulators/c++2/src_simulator/app/TMLWriteMultCommand.cpp b/simulators/c++2/src_simulator/app/TMLWriteMultCommand.cpp index 44f4f409d316be0c175a6fbde606a69203b00cee..144e3905f96ab49560fa980ff9bf81c811d0c1c4 100644 --- a/simulators/c++2/src_simulator/app/TMLWriteMultCommand.cpp +++ b/simulators/c++2/src_simulator/app/TMLWriteMultCommand.cpp @@ -39,7 +39,6 @@ Ludovic Apvrille, Renaud Pacalet */ #include <TMLWriteMultCommand.h> -//#include <TMLChannel.h> #include <TMLTask.h> #include <TMLTransaction.h> #include <Bus.h> @@ -86,18 +85,6 @@ TMLCommand* TMLWriteMultCommand::prepareNextTransaction(){ return this; } -//TMLChannel* TMLWriteMultCommand::getChannel(unsigned int iIndex) const{ -// return _channels[iIndex]; -//} - -//unsigned int TMLWriteMultCommand::getNbOfChannels() const{ -// return _nbOfChannels; -//} - -//TMLTask* TMLWriteMultCommand::getDependentTask(unsigned int iIndex)const{ -// return _channels[iIndex]->getBlockedReadTask(); -//} - std::string TMLWriteMultCommand::toString() const{ std::ostringstream outp; outp << "WriteMult in " << TMLCommand::toString() << " " << _channels[0]->toString(); @@ -109,7 +96,3 @@ std::string TMLWriteMultCommand::toShortString() const{ outp << _task->toString() << ": WriteMult" << _length << "," << _channels[0]->toShortString(); return outp.str(); } - -//std::string TMLWriteMultCommand::getCommandStr() const{ -// return "wr"; -//} diff --git a/simulators/c++2/src_simulator/arch/Bus.cpp b/simulators/c++2/src_simulator/arch/Bus.cpp index 502bcff1b1eb7a68800f83b5250471a47c1c7229..bb003b1f209521e248ff7887b465b9e7027710e8 100644 --- a/simulators/c++2/src_simulator/arch/Bus.cpp +++ b/simulators/c++2/src_simulator/arch/Bus.cpp @@ -47,7 +47,7 @@ Ludovic Apvrille, Renaud Pacalet //#include <TransactionListener.h> #include <WorkloadSource.h> -Bus::Bus(ID iID, std::string iName, WorkloadSource* iScheduler, TMLLength iBurstSize, unsigned int ibusWidth, TMLTime iTimePerSample, bool iChannelBasedPrio): SchedulableCommDevice(iID, iName, iScheduler, iChannelBasedPrio), _burstSize(iBurstSize), _schedulingNeeded(true), _timePerSample(iTimePerSample), _busWidth(ibusWidth) /*, _busyCycles(0)*/{} +Bus::Bus(ID iID, std::string iName, WorkloadSource* iScheduler, TMLLength iBurstSize, unsigned int ibusWidth, TMLTime iTimePerSample, bool iChannelBasedPrio): SchedulableCommDevice(iID, iName, iScheduler, iChannelBasedPrio), _burstSize(iBurstSize), _schedulingNeeded(true), _timePerSample(iTimePerSample), _busWidth(ibusWidth){} Bus::~Bus(){ //delete _scheduler; @@ -81,7 +81,9 @@ bool Bus::addTransaction(TMLTransaction* iTransToBeAdded){ _endSchedule = _nextTransaction->getEndTime(); //std::cout << "set end time to " << _endSchedule << "\n"; //_transactList.push_back(_nextTransaction); +#ifdef TRANSLIST_ENABLED _transactList.push_back(iTransToBeAdded); //NEW!!!!! +#endif _busyCycles += _nextTransaction->getOperationLength(); #ifdef DEBUG_BUS std::cout << "Bus::addTrans: add trans at bus " << _name << ": " << _nextTransaction->toString() << std::endl; @@ -112,23 +114,6 @@ void Bus::calcStartTimeLength(TMLTime iTimeSlice) const{ if (aSlave!=0) aSlave->CalcTransactionLength(_nextTransaction); } -//TMLTransaction* Bus::getNextTransaction(){ -// if (_schedulingNeeded) schedule(); -// return _nextTransaction; -//} - -//TMLLength Bus::getBurstSize() const{ -// return _burstSize; -//} - -//void Bus::truncateToBurst(TMLTransaction* iTrans) const{ -// iTrans->setVirtualLength(min(iTrans->getVirtualLength(), _burstSize)); -//} - -//std::string Bus::toString() const{ -// return _name; -//} - std::string Bus::toShortString() const{ std::ostringstream outp; outp << "bus" << _ID; @@ -174,7 +159,6 @@ void Bus::schedule2TXT(std::ofstream& myfile) const{ } } -//TMLTime Bus::getNextSignalChange(bool iInit, std::string& oSigChange, bool& oNoMoreTrans){ void Bus::getNextSignalChange(bool iInit, SignalChangeData* oSigData){ //std::ostringstream outp; if (iInit){ @@ -271,10 +255,6 @@ void Bus::streamBenchmarks(std::ostream& s) const{ s << TAG_BUSc; } -//void Bus::streamStateXML(std::ostream& s) const{ -// streamBenchmarks(s); -//} - std::istream& Bus::readObject(std::istream &is){ SchedulableDevice::readObject(is); _scheduler->readObject(is); diff --git a/simulators/c++2/src_simulator/arch/Bus.h b/simulators/c++2/src_simulator/arch/Bus.h index b1eac1a63c6fe599f9c023ac510f8e7bae9c7198..8229488911b07c94e18a4ead03b54c6393010f06 100644 --- a/simulators/c++2/src_simulator/arch/Bus.h +++ b/simulators/c++2/src_simulator/arch/Bus.h @@ -111,7 +111,6 @@ public: \param myfile Reference to the ofstream object representing the output file */ void schedule2TXT(std::ofstream& myfile) const; - //TMLTime getNextSignalChange(bool iInit, std::string& oSigChange, bool& oNoMoreTrans); void getNextSignalChange(bool iInit, SignalChangeData* oSigData); virtual void streamBenchmarks(std::ostream& s) const; virtual void reset(); @@ -132,8 +131,6 @@ protected: TMLTime _timePerSample; ///Bus width in bytes unsigned int _busWidth; - /////Busy cycles since simulation start - //TMLTime _busyCycles; ///State variable for the VCD output vcdBusVisState _vcdOutputState; }; diff --git a/simulators/c++2/src_simulator/arch/SchedulableDevice.h b/simulators/c++2/src_simulator/arch/SchedulableDevice.h index 01436b5353a1cc5535ecff9db739dc7c2f768ed3..1354ac3f99c04e311116e787f9254c1dbe628561 100644 --- a/simulators/c++2/src_simulator/arch/SchedulableDevice.h +++ b/simulators/c++2/src_simulator/arch/SchedulableDevice.h @@ -166,6 +166,14 @@ public: return _busyCycles; } + static TMLTime getOverallTransNo(){ + return _overallTransNo; + } + + static TMLTime getOverallTransSize(){ + return _overallTransSize; + } + protected: ///Unique ID of the device ID _ID; @@ -187,7 +195,8 @@ protected: bool _deleteScheduler; ///Busy cycles since simulation start TMLTime _busyCycles; - + static TMLTime _overallTransNo; + static TMLTime _overallTransSize; }; #endif diff --git a/simulators/c++2/src_simulator/arch/SingleCoreCPU.cpp b/simulators/c++2/src_simulator/arch/SingleCoreCPU.cpp index 34289d4e41d8385f62be7fbceede888a2ddde388..e1fb2fcb3cfd6ba5596f24e3756e334f70f53da9 100644 --- a/simulators/c++2/src_simulator/arch/SingleCoreCPU.cpp +++ b/simulators/c++2/src_simulator/arch/SingleCoreCPU.cpp @@ -74,11 +74,6 @@ SingleCoreCPU::~SingleCoreCPU(){ //delete _scheduler; } -/*void SingleCoreCPU::registerTask(TMLTask* iTask){ - _taskList.push_back(iTask); - if (_scheduler!=0) _scheduler->addWorkloadSource(iTask); -}*/ - TMLTransaction* SingleCoreCPU::getNextTransaction(){ #ifdef BUS_ENABLED if (_masterNextTransaction==0 || _nextTransaction==0){ @@ -265,10 +260,14 @@ bool SingleCoreCPU::addTransaction(TMLTransaction* iTransToBeAdded){ _endSchedule=_nextTransaction->getEndTime(); //std::cout << "set end schedule CPU: " << _endSchedule << "\n"; _simulatedTime=max(_simulatedTime,_endSchedule); + _overallTransNo++; //NEW!!!!!!!! + _overallTransSize+=_nextTransaction->getOperationLength(); //NEW!!!!!!!! //std::cout << "lets crash execute\n"; _nextTransaction->getCommand()->execute(); //NEW!!!! //std::cout << "not crashed\n"; +#ifdef TRANSLIST_ENABLED _transactList.push_back(_nextTransaction); +#endif _lastTransaction=_nextTransaction; _busyCycles+=_nextTransaction->getOverallLength(); #ifdef LISTENERS_ENABLED @@ -482,14 +481,6 @@ void SingleCoreCPU::streamBenchmarks(std::ostream& s) const{ s << TAG_CPUc; } -//void SingleCoreCPU::streamStateXML(std::ostream& s) const{ -// streamBenchmarks(s); -//} - -/*void SingleCoreCPU::addBusMaster(BusMaster* iMaster){ - _busMasterList.push_back(iMaster); -}*/ - BusMaster* SingleCoreCPU::getMasterForBus(BusMaster* iDummy){ if (iDummy!=0){ SchedulableCommDevice* aBus = iDummy->getBus(); diff --git a/simulators/c++2/src_simulator/arch/SingleCoreCPU.h b/simulators/c++2/src_simulator/arch/SingleCoreCPU.h index a02058492363f7c1b32a183ccea88a8a3589c8ed..ee6c40f3039d861919d4970231e6280515565903 100644 --- a/simulators/c++2/src_simulator/arch/SingleCoreCPU.h +++ b/simulators/c++2/src_simulator/arch/SingleCoreCPU.h @@ -82,11 +82,6 @@ public: virtual ~SingleCoreCPU(); ///Determines the next CPU transaction to be executed virtual void schedule(); - ////Stores a new task in the internal task list - //** - //\param iTask Pointer to the task to add - //*/ - //virtual void registerTask(TMLTask* iTask); ///Adds the transaction determined by the scheduling algorithm to the internal list of scheduled transactions virtual bool addTransaction(TMLTransaction* iTransToBeAdded); ///Returns a pointer to the transaction determined by the scheduling algorithm @@ -110,7 +105,6 @@ public: \param myfile Reference to the ofstream object representing the output file */ void schedule2HTML(std::ofstream& myfile) const; - //TMLTime getNextSignalChange(bool iInit, std::string& oSigChange, bool& oNoMoreTrans); void getNextSignalChange(bool iInit, SignalChangeData* oSigData); ///Writes a plain text representation of the schedule to an output file /** @@ -119,13 +113,7 @@ public: void schedule2TXT(std::ofstream& myfile) const; virtual void streamBenchmarks(std::ostream& s) const; virtual void reset(); - //void truncateAndRescheduleIfNecessary(TMLTime iTime); inline void streamStateXML(std::ostream& s) const {streamBenchmarks(s);} - /////Adds a new bus master to the internal list - //** - //\param iMaster Pointer to bus master - //*/ - //void addBusMaster(BusMaster* iMaster); std::istream& readObject(std::istream &is); std::ostream& writeObject(std::ostream &os); protected: @@ -144,16 +132,10 @@ protected: \param iDummy Dummy Bus Master */ BusMaster* getMasterForBus(BusMaster* iDummy); - /////List of all tasks running on the CPU - //TaskList _taskList; - /////Pointer to the last transaction which has been executed - //TMLTransaction* _lastTransaction; ///Pointer to the bus which will be accessed by the next transaction BusMaster* _masterNextTransaction; ///1/Processor frequency TMLTime _timePerCycle; - /////List of bus masters - //BusMasterList _busMasterList; #ifdef PENALTIES_ENABLED ///Pipeline size unsigned int _pipelineSize; @@ -168,10 +150,6 @@ protected: #endif ///Cycles needed to execute one execi unit unsigned int _cyclesPerExeci; - /////Busy cycles since simulation start - //TMLTime _busyCycles; - - //values deduced from CPU parameters ///Time needed to execute one execi unit float _timePerExeci; #ifdef PENALTIES_ENABLED @@ -181,15 +159,6 @@ protected: TMLTime _timeBeforeIdle; ///Time needed to switch into idle mode TMLTime _changeIdleModeTime; - ////_pipelineSize * _timePerExeci - //TMLTime _pipelineSizeTimesExeci; - ////_brachingMissrate * _pipelineSize - //unsigned int _missrateTimesPipelinesize; - //varibales for branch miss calculation - ////Indicates the number of commands executed since the last branch miss - //unsigned int _branchMissReminder; - ////Potentially new value of _branchMissReminder - //unsigned int _branchMissTempReminder; #endif ///State variable for the VCD output vcdCPUVisState _vcdOutputState; diff --git a/simulators/c++2/src_simulator/arch/TraceableDevice.h b/simulators/c++2/src_simulator/arch/TraceableDevice.h index 879fcaa0d136f9842b0589ec2f1307bb00fe9d1e..d43f039597562f003654f7bcd7daf16199e83a67 100644 --- a/simulators/c++2/src_simulator/arch/TraceableDevice.h +++ b/simulators/c++2/src_simulator/arch/TraceableDevice.h @@ -60,11 +60,9 @@ public: ///Returns the next signal change (for vcd output) /** \param iInit Indicates if the list iterator has to be reset to the beginning of the list - \param oSigChange String containing a description of the signal change is returned - \param oNoMoreTrans Is true if the last transaction of the schedule has been retrieved + \param oSigData Pointer to a SignalChangeData object characterizing the nature of the signal change \return Point in time when the signal changes */ - //virtual TMLTime getNextSignalChange(bool iInit, std::string& oSigChange, bool& oNoMoreTrans)=0; virtual void getNextSignalChange(bool iInit, SignalChangeData* oSigData)=0; ///Writes benchmarking data to a given stream /** diff --git a/simulators/c++2/src_simulator/definitions.cpp b/simulators/c++2/src_simulator/definitions.cpp index 22a52395b6cd4c6cc83ebe9088c1ac62d3e740be..30ae93c4ca6fe2fb635df6b43a5d52b0df480fda 100644 --- a/simulators/c++2/src_simulator/definitions.cpp +++ b/simulators/c++2/src_simulator/definitions.cpp @@ -53,7 +53,10 @@ Ludovic Apvrille, Renaud Pacalet //#include <Parameter.h> TMLTime SchedulableDevice::_simulatedTime=0; +TMLTime SchedulableDevice::_overallTransNo=0; +TMLTime SchedulableDevice::_overallTransSize=0; ID TMLTransaction::_ID=1; + const unsigned int SeqConstraint::_transTableSeq[12]={0,20,0,0,16,16,10,32,32,32,11,32}; const unsigned int LogConstraint::_transTableLog[20]={0, 20, 52, 0, 16, 16, 10, 32, 32, 32, 11, 32, 48, 10, 48, 64, 64, 11, 64, 64}; //template<class T,int size> MemPool<SizedParameter<T,size> > SizedParameter<T, size>::memPool(BLOCK_SIZE_PARAM); diff --git a/simulators/c++2/src_simulator/definitions.h b/simulators/c++2/src_simulator/definitions.h index 92ab23a57a39a5dd16de217f3e8f2f74e89fbb76..c96b37731f0c5cc995023082a6b7fbaffa2ad8a0 100644 --- a/simulators/c++2/src_simulator/definitions.h +++ b/simulators/c++2/src_simulator/definitions.h @@ -85,15 +85,16 @@ using std::max; #define BUS_ENABLED #define WAIT_SEND_VLEN 1 #undef PENALTIES_ENABLED -#define STATE_HASH_ENABLED -#define LISTENERS_ENABLED -#define EXPLO_ENABLED +#undef STATE_HASH_ENABLED +#undef LISTENERS_ENABLED +#undef EXPLO_ENABLED #undef EBRDD_ENABLED -#define EXPLOGRAPH_ENABLED +#undef EXPLOGRAPH_ENABLED +#undef TRANSLIST_ENABLED #define CLOCK_INC 20 #define BLOCK_SIZE_TRANS 8000000 -#define BLOCK_SIZE_PARAM 100 +#define BLOCK_SIZE_PARAM 5000 #define BLOCK_SIZE_COMMENT 100 #define PARAMETER_BLOCK_SIZE 1000 #undef ADD_COMMENTS diff --git a/simulators/c++2/src_simulator/evt/GeneralListener.h b/simulators/c++2/src_simulator/evt/GeneralListener.h index ef5eaa726d3a989559dbcccaa3f00720f41405ee..9f07cde6ca4bc306d5a78164839829d16d261540 100644 --- a/simulators/c++2/src_simulator/evt/GeneralListener.h +++ b/simulators/c++2/src_simulator/evt/GeneralListener.h @@ -101,8 +101,8 @@ public: \param iID ID of the event source */ virtual void commandEntered(TMLCommand* iComm, ID iID){} - ///Gets called when a transaction of the command is executed - /** + //Gets called when a transaction of the command is executed + /* \param iComm Pointer to the command \param iID ID of the event source */ @@ -113,29 +113,27 @@ public: \param iID ID of the event source */ virtual void commandFinished(TMLCommand* iComm, ID iID){} - //virtual void commandFinished(TMLTransaction* iTrans, ID iID){} ///Gets called when a the first transaction of the command is executed /** - \param iTrans Pointer to the transaction + \param iComm Pointer to the command \param iID ID of the event source */ virtual void commandStarted(TMLCommand* iComm, ID iID){} - //virtual void commandStarted(TMLTransaction* iTrans, ID iID){} - ///Gets called when a read transaction is executed - /** + //Gets called when a read transaction is executed + /* \param iTrans Pointer to the transaction \param iID ID of the event source */ //virtual void readTrans(TMLTransaction* iTrans, ID iID){} - ///Gets called when a write transaction is executed - /** + //Gets called when a write transaction is executed + /* \param iTrans Pointer to the transaction \param iID ID of the event source */ //virtual void writeTrans(TMLTransaction* iTrans, ID iID){} - + ///Event triggering the evaluation of TEPE constraints virtual void evaluate(){} ///Destructor virtual ~GeneralListener(){} diff --git a/simulators/c++2/src_simulator/evt/ListenersSimCmd.h b/simulators/c++2/src_simulator/evt/ListenersSimCmd.h index 7cc04c61338772e2fc4f2dd9282ca53960a76b4e..358233b804ee2958e7caf485dc4178c3a5b93c2a 100644 --- a/simulators/c++2/src_simulator/evt/ListenersSimCmd.h +++ b/simulators/c++2/src_simulator/evt/ListenersSimCmd.h @@ -70,7 +70,6 @@ class SimComponents; //************************************************************************ ///Listener which stops the simulation after a given number of transactions class RunXTransactions: public GeneralListener{ -//class RunXTransactions: public TransactionListener{ public: ///Constructor /** @@ -98,7 +97,6 @@ protected: //************************************************************************ ///Listener establishing a breakpoint class Breakpoint: public GeneralListener{ -//class Breakpoint: public CommandListener{ public: ///Constructor /** @@ -121,7 +119,6 @@ protected: //************************************************************************ ///Breakpoint based on a condition -//class CondBreakpoint: public CommandListener{ class CondBreakpoint: public GeneralListener{ public: ///Constructor @@ -134,7 +131,6 @@ public: ///Destructor ~CondBreakpoint(); void commandFinished(TMLCommand* iComm, ID iID); - //void commandFinished(TMLTransaction* iTrans, ID iID); ///Enable/disable all conditional breakpoints /** \param iEnabled true=enable, false=disable @@ -173,7 +169,6 @@ protected: //************************************************************************ ///Listener which stops the simulation as soon as a random choice command is encountered -//class RunTillNextRandomChoice: public CommandListener{ class RunTillNextRandomChoice: public GeneralListener{ public: ///Constructor @@ -197,7 +192,6 @@ protected: //************************************************************************ ///Listener which stops the simulation after a given number of commands -//class RunXCommands: public CommandListener{ class RunXCommands: public GeneralListener{ public: ///Constructor @@ -209,7 +203,6 @@ public: ///Destructor virtual ~RunXCommands(); void commandFinished(TMLCommand* iComm, ID iID); - //void commandFinished(TMLTransaction* iTrans, ID iID); ///Sets the number of commands to execute /** \param iCommandsToExecute Number of commands to execute @@ -228,7 +221,6 @@ protected: //************************************************************************ ///Listener which stops the simulation at a given time -//class RunXTimeUnits: public TransactionListener{ class RunXTimeUnits: public GeneralListener{ public: ///Constructor @@ -256,7 +248,6 @@ protected: //************************************************************************ ///Listener which stops the simulation as soon as a transaction is executed on a given device -//class RunTillTransOnDevice: public TransactionListener{ class RunTillTransOnDevice: public GeneralListener{ public: ///Constructor @@ -264,7 +255,6 @@ public: \param iSimComp Pointer to a SimComponents object \param iSubject Device to listen on */ - //RunTillTransOnDevice(SimComponents* iSimComp, ListenerSubject<TransactionListener>* iSubject); RunTillTransOnDevice(SimComponents* iSimComp, ListenerSubject<GeneralListener>* iSubject); ///Destructor virtual ~RunTillTransOnDevice(); @@ -273,14 +263,12 @@ protected: ///Pointer to a SimComponents object SimComponents* _simComp; ///Device to listen on - //ListenerSubject <TransactionListener> * _subject; ListenerSubject <GeneralListener> * _subject; }; //************************************************************************ ///Listener which stops the simulation as soon as a given task executes a transaction -//class RunTillTransOnTask: public TaskListener{ class RunTillTransOnTask: public GeneralListener{ public: ///Constructor @@ -288,7 +276,6 @@ public: \param iSimComp Pointer to a SimComponents object \param iSubject Task to listen on */ - //RunTillTransOnTask(SimComponents* iSimComp, ListenerSubject<TaskListener>* iSubject); RunTillTransOnTask(SimComponents* iSimComp, ListenerSubject<GeneralListener>* iSubject); ///Destructor virtual ~RunTillTransOnTask(); @@ -297,14 +284,12 @@ protected: ///Pointer to a SimComponents object SimComponents* _simComp; ///Task to listen on - //ListenerSubject <TaskListener> * _subject; ListenerSubject <GeneralListener> * _subject; }; //************************************************************************ ///Listener which stops the simulation as soon data is conveyed on a given channel -//class RunTillTransOnChannel: public ChannelListener{ class RunTillTransOnChannel: public GeneralListener{ public: ///Constructor @@ -312,7 +297,6 @@ public: \param iSimComp Pointer to a SimComponents object \param iSubject Channel to listen on */ - //RunTillTransOnChannel(SimComponents* iSimComp, ListenerSubject<ChannelListener>* iSubject); RunTillTransOnChannel(SimComponents* iSimComp, ListenerSubject<GeneralListener>* iSubject); ///Destructor virtual ~RunTillTransOnChannel(); @@ -321,7 +305,6 @@ protected: ///Pointer to a SimComponents object SimComponents* _simComp; ///Channel to listen on - //ListenerSubject <ChannelListener> * _subject; ListenerSubject <GeneralListener> * _subject; }; @@ -338,7 +321,6 @@ public: void transExecuted(TMLTransaction* iTrans, ID iID); void commandEntered(TMLCommand* iComm, ID iID); void commandFinished(TMLCommand* iComm, ID iID); - //void commandFinished(TMLTransaction* iTrans, ID iID); void commandStarted(TMLCommand* iComm, ID iID); void readTrans(TMLTransaction* iTrans, ID iID); void writeTrans(TMLTransaction* iTrans, ID iID); @@ -421,36 +403,4 @@ protected: SimComponents* _simComp; ListenerSubject<GeneralListener>* _simulator; }; - -//************************************************************************ -/*class TestListener: public TaskListener, public ChannelListener, public CommandListener{ -public: - //Constructor - //\param iSimComp Pointer to a SimComponents object - // - TestListener(SimComponents* iSimComp); - void taskStarted(TMLTransaction* iTrans); - void taskFinished(TMLTransaction* iTrans); - void readTrans(TMLTransaction* iTrans); - void writeTrans(TMLTransaction* iTrans); - void commandFinished(TMLCommand* iComm); - void commandStarted(TMLCommand* iComm); - ///Destructor - virtual ~TestListener(); - -protected: - ///Pointer to a SimComponents object - SimComponents* _simComp; -}; - - -************************************************************************ -class ConstraintBlock: public TransactionListener{ - ConstraintBlock(SimComponents* iSimComp); - ~ConstraintBlock(); - void transExecuted(TMLTransaction* iTrans); - virtual bool constraintFunc(TransactionAbstr iTrans, CommandAbstr iCmd, TaskAbstr iTask, CPUAbstr iCPU, ChannelAbstr iChan) =0; -private: - SimComponents* _simComp; -};*/ #endif diff --git a/simulators/c++2/src_simulator/sim/SimComponents.cpp b/simulators/c++2/src_simulator/sim/SimComponents.cpp index e42207d2c839025f71c646030f55f85ab9299c16..dbcd5bb065c7ba1e79fcb5e6185943615febf81f 100644 --- a/simulators/c++2/src_simulator/sim/SimComponents.cpp +++ b/simulators/c++2/src_simulator/sim/SimComponents.cpp @@ -357,32 +357,6 @@ ListenerSubject <GeneralListener>* SimComponents::getListenerByID(ID iID){ return getChannelByID(iID); } -//int SimComponents::getHashValue(){ -// return _hashValue; -//} - -/*TaskList::const_iterator SimComponents::getTaskIterator(bool iEnd) const{ - return (iEnd)? _taskList.end():_taskList.begin(); -} - -BusList::const_iterator SimComponents::getBusIterator(bool iEnd) const{ - return (iEnd)? _busList.end():_busList.begin(); -} - -TraceableDeviceList::const_iterator SimComponents::getVCDIterator(bool iEnd) const{ - return (iEnd)? _vcdList.end():_vcdList.begin(); -} - -#ifdef EBRDD_ENABLED -EBRDDList::const_iterator SimComponents::getEBRDDIterator(bool iEnd) const{ - return (iEnd)? _ebrddList.end():_ebrddList.begin(); -} -#endif - -CPUList::const_iterator SimComponents::getCPUIterator(bool iEnd) const{ - return (iEnd)? _cpuList.end():_cpuList.begin(); -}*/ - /*void SimComponents::setBreakpointOnChoiceCmds(){ TMLChoiceCommand* aResult; for(TaskList::const_iterator i=_taskList.begin(); i != _taskList.end(); ++i){ @@ -402,7 +376,6 @@ void SimComponents::setStopFlag(bool iStopFlag, const std::string& iStopReason){ } } -//void SimComponents::checkForRecurringSystemState(){ ID SimComponents::checkForRecurringSystemState(){ //std::cout << "Recurring Sys State\n"; _systemHash.init((HashValueType)0xabcd, _taskList.size()); @@ -449,15 +422,6 @@ ID SimComponents::checkForRecurringSystemState(){ return aRetVal; } -//ID SimComponents::wasKnownStateReached() const{ -// return _knownStateReached; -//} - -//bool SimComponents::getOnKnownPath(){ -// _knownStateReached=0; -// return _onKnownPath; -//} - void SimComponents::showTaskStates(){ static int iCount=0; static ParamType *aDatalen, *aStandard; diff --git a/simulators/c++2/src_simulator/sim/SimComponents.h b/simulators/c++2/src_simulator/sim/SimComponents.h index 6f15ff983d8795e9532657c4063aca67c5e13cb8..47c969b7e2e91b325c5c527973a9114450c62248 100644 --- a/simulators/c++2/src_simulator/sim/SimComponents.h +++ b/simulators/c++2/src_simulator/sim/SimComponents.h @@ -66,7 +66,7 @@ public: /** \param iHashValue Hash Value for application and architecture */ - SimComponents(int iHashValue /*, Simulator* iSimulator*/); + SimComponents(int iHashValue); ///Destructor virtual ~SimComponents(); ///Add a task @@ -116,11 +116,15 @@ public: */ void addEBRDD(EBRDD* iEBRDD); #endif - ///Add a TEPE constraint + ///Add a TEPE event listener /** - \param iPropConstr TEPE Constraint + \param iTEPEListener Pointer to TEPEListener */ void addTEPEListener(GeneralListener* iTEPEListener); + ///Sets the TEPE root constraint + /** + \param iTEPEEntryPoint Pointer to TEPEFloatingSigListener + */ void setTEPEEntryPoint(TEPEFloatingSigListener* iTEPEEntryPoint); ///Calls streamBenchmarks of all traceable devices contained in vcdList /** @@ -193,24 +197,18 @@ public: TMLChannel* getChannelByID(ID iID) const; ///Returns an iterator for the internal CPU list /** - \param iEnd true for iterator pointing to the end of the list, false for iterator pointing to the first element \return Const iterator for CPU list */ - //CPUList::const_iterator getCPUIterator(bool iEnd) const; inline const CPUList& getCPUList() const{return _cpuList;} ///Returns an iterator for the internal bus list /** - \param iEnd true for iterator pointing to the end of the list, false for iterator pointing to the first element \return Const iterator for bus list */ - //BusList::const_iterator getBusIterator(bool iEnd) const; inline const BusList& getBusList() const{return _busList;} ///Returns an iterator for the internal VCD list /** - \param iEnd true for iterator pointing to the end of the list, false for iterator pointing to the first element \return Const iterator for VCD list */ - //TraceableDeviceList::const_iterator getVCDIterator(bool iEnd) const; inline const TraceableDeviceList& getVCDList() const{return _vcdList;} ///Returns the state of the stop flag /** @@ -242,18 +240,14 @@ public: inline int getHashValue() {return _hashValue;} ///Returns an iterator for the internal task list /** - \param iEnd true for iterator pointing to the end of the list, false for iterator pointing to the first element \return Const iterator for task list */ - //TaskList::const_iterator getTaskIterator(bool iEnd) const; inline const TaskList& getTaskList() const{return _taskList;} #ifdef EBRDD_ENABLED ///Returns an iterator for the internal EBRDD list /** - \param iEnd true for iterator pointing to the end of the list, false for iterator pointing to the first element \return Const iterator for EBRDD list */ - //EBRDDList::const_iterator getEBRDDIterator(bool iEnd) const; inline const EBRDDList& getEBRDDList() const{return _ebrddList;} #endif ///Returns the reason why the simulation stopped @@ -280,19 +274,16 @@ public: ID checkForRecurringSystemState(); ///Checks if a known system state was reached /** - \param oSystemHash Current system hash \return Flag indicating whether a known state has been encountered */ - //ID wasKnownStateReached(HashValueType* oSystemHash) const; inline ID wasKnownStateReached() const {return _knownStateReached;} - //inline ID wasKnownStateReached() const {return false;} + //inline ID wasKnownStateReached() const {return 0;} ///Resets the global system hash void resetStateHash(); inline bool getOnKnownPath(){ _knownStateReached=0; return _onKnownPath; } - //ListenerSubject <TransactionListener>* getListenerByID(ID iID); ListenerSubject<GeneralListener>* getListenerByID(ID iID); virtual void generateTEPEs()=0; void showTaskStates(); @@ -335,8 +326,6 @@ protected: ///Flag indicating whether a known state has been encountered ID _knownStateReached; bool _onKnownPath; - - //std::ofstream _myfile; }; #endif diff --git a/simulators/c++2/src_simulator/sim/Simulator.cpp b/simulators/c++2/src_simulator/sim/Simulator.cpp index e7fb0ec8c469b36f881bfca2fecc6b7fd8ffb48e..9fa82ca8de1ebf93517ce9fe008b81d1debff81f 100644 --- a/simulators/c++2/src_simulator/sim/Simulator.cpp +++ b/simulators/c++2/src_simulator/sim/Simulator.cpp @@ -559,6 +559,10 @@ ServerIF* Simulator::run(int iLen, char ** iArgs){ rusage res; getrusage(RUSAGE_SELF, &res); std::cerr << res.ru_utime.tv_sec << "," << res.ru_utime.tv_usec << "," << res.ru_stime.tv_sec << "," << res.ru_stime.tv_usec << "\n"; + double aRunTime = ((double)((res.ru_utime.tv_sec + res.ru_stime.tv_sec) *1000000 + res.ru_utime.tv_usec + res.ru_stime.tv_usec))/1000000; + std::cerr << "trans/sec: " << ((double)SchedulableDevice::getOverallTransNo())/aRunTime << "\n"; + std::cerr << "cycles/trans: " << ((double)SchedulableDevice::getOverallTransSize())/((double)SchedulableDevice::getOverallTransNo()) << "\n"; + std::cerr << "Trans size: " << SchedulableDevice::getOverallTransSize() << " trans no: " << SchedulableDevice::getOverallTransNo() << "\n"; return 0; } diff --git a/simulators/c++2/src_simulator/sim/Simulator.h b/simulators/c++2/src_simulator/sim/Simulator.h index 3ee76feba1f351f24a44bed283492d59f95dfb94..472e58f941c8ed936e6916a1cb715be5b4e88634 100644 --- a/simulators/c++2/src_simulator/sim/Simulator.h +++ b/simulators/c++2/src_simulator/sim/Simulator.h @@ -208,7 +208,9 @@ public: /** \param iDepth Maximal recursion depth \param iPrevID ID of the parent leaf - \param iFile Reference to the output file + \param iDOTFile Handle of DOT file + \param iAUTFile Handle of AUT file + \param oTransCounter Reference to transaction counter */ void exploreTree(unsigned int iDepth, ID iPrevID, std::ofstream& iDOTFile, std::ofstream& iAUTFile, unsigned int& oTransCounter); ///Writes a HTML representation of the schedule of CPUs and buses to an output file @@ -223,7 +225,14 @@ public: \param iTraceFileName Name of the output trace file */ void schedule2Graph(std::string& iTraceFileName) const; - //ID schedule2Graph(std::ostream& iFile, ID iStartState) const; + ///Writes the simulation graph to a DOT and AUT file, for exploration mode + /** + \param iDOTFile Handle of DOT file + \param iAUTFile Handle of AUT file + \param iStartState ID of the state to begin with + \param oTransCounter Reference to a transation counter + \return ID of the last state writte to the files + */ ID schedule2GraphDOT(std::ostream& iDOTFile, std::ostream& iAUTFile, ID iStartState, unsigned int& oTransCounter) const; ///Writes a plain text representation of the schedule of CPUs to an output file /**