From c70cc4f0ee322f65f29b92d7370341644dcbfbc2 Mon Sep 17 00:00:00 2001 From: Daniel Knorreck <daniel.knorreck@telecom-paristech.fr> Date: Thu, 5 Nov 2009 07:57:13 +0000 Subject: [PATCH] ebrdd save state feature + better doc --- simulators/c++2/src_simulator/Doxyfile | 2 +- .../c++2/src_simulator/TMLTransaction.cpp | 6 +- .../c++2/src_simulator/app/ChannelAbstr.h | 3 +- .../c++2/src_simulator/app/CommandAbstr.h | 1 + simulators/c++2/src_simulator/app/Parameter.h | 4 + .../c++2/src_simulator/app/TMLChannel.h | 4 +- .../c++2/src_simulator/app/TMLChoiceCommand.h | 1 + .../c++2/src_simulator/app/TMLCommand.cpp | 9 +- .../c++2/src_simulator/app/TMLCommand.h | 2 +- .../src_simulator/app/TMLEventBChannel.cpp | 4 + .../c++2/src_simulator/app/TMLEventBChannel.h | 4 +- .../c++2/src_simulator/app/TMLEventChannel.h | 4 +- .../src_simulator/app/TMLEventFBChannel.h | 4 +- .../c++2/src_simulator/app/TMLEventFChannel.h | 4 +- .../src_simulator/app/TMLExeciCommand.cpp | 2 +- .../src_simulator/app/TMLNotifiedCommand.cpp | 2 +- .../c++2/src_simulator/app/TMLReadCommand.cpp | 2 +- .../src_simulator/app/TMLRequestCommand.cpp | 2 +- .../src_simulator/app/TMLRequestCommand.h | 2 +- .../src_simulator/app/TMLSelectCommand.cpp | 2 +- .../c++2/src_simulator/app/TMLSelectCommand.h | 2 +- .../c++2/src_simulator/app/TMLSendCommand.cpp | 2 +- .../c++2/src_simulator/app/TMLSendCommand.h | 2 +- .../src_simulator/app/TMLStateChannel.cpp | 4 + .../c++2/src_simulator/app/TMLStateChannel.h | 4 +- simulators/c++2/src_simulator/app/TMLTask.cpp | 26 ++++- simulators/c++2/src_simulator/app/TMLTask.h | 1 + .../c++2/src_simulator/app/TMLWaitCommand.cpp | 2 +- .../c++2/src_simulator/app/TMLWaitCommand.h | 2 +- .../src_simulator/app/TMLWriteCommand.cpp | 2 +- .../c++2/src_simulator/app/TMLbrbwChannel.h | 4 +- .../c++2/src_simulator/app/TMLbrnbwChannel.h | 4 +- .../c++2/src_simulator/app/TMLnbrnbwChannel.h | 4 +- simulators/c++2/src_simulator/app/TaskAbstr.h | 1 + simulators/c++2/src_simulator/arch/Bus.cpp | 5 + simulators/c++2/src_simulator/arch/Bus.h | 6 +- simulators/c++2/src_simulator/arch/BusAbstr.h | 3 +- .../c++2/src_simulator/arch/BusMaster.h | 11 +- simulators/c++2/src_simulator/arch/CPU.cpp | 11 +- simulators/c++2/src_simulator/arch/CPU.h | 8 +- simulators/c++2/src_simulator/arch/CPUAbstr.h | 4 +- .../c++2/src_simulator/arch/PrioScheduler.cpp | 4 +- .../c++2/src_simulator/arch/PrioScheduler.h | 4 +- .../c++2/src_simulator/arch/RRScheduler.cpp | 8 ++ .../c++2/src_simulator/arch/RRScheduler.h | 4 +- .../arch/SchedulableCommDevice.h | 4 +- .../src_simulator/arch/SchedulableDevice.h | 14 +-- simulators/c++2/src_simulator/definitions.cpp | 1 + simulators/c++2/src_simulator/definitions.h | 9 +- simulators/c++2/src_simulator/ebrdd/EBRDD.cpp | 6 + simulators/c++2/src_simulator/ebrdd/EBRDD.h | 27 ++--- .../src_simulator/ebrdd/EBRDDChoiceCommand.h | 1 - .../c++2/src_simulator/ebrdd/EBRDDCommand.h | 4 +- .../src_simulator/ebrdd/EBRDDStopCommand.h | 3 +- simulators/c++2/src_simulator/ebrdd/ERB.cpp | 26 ++--- simulators/c++2/src_simulator/ebrdd/ERB.h | 37 ++++++- simulators/c++2/src_simulator/ebrdd/ERC.cpp | 11 ++ simulators/c++2/src_simulator/ebrdd/ERC.h | 21 +++- simulators/c++2/src_simulator/ebrdd/ESO.cpp | 26 +++++ simulators/c++2/src_simulator/ebrdd/ESO.h | 104 +++++++++++++++++- .../c++2/src_simulator/ebrdd/EventIF.cpp | 32 ++++++ simulators/c++2/src_simulator/ebrdd/EventIF.h | 44 +++++++- .../c++2/src_simulator/ebrdd/NotifyIF.cpp | 11 ++ .../c++2/src_simulator/ebrdd/NotifyIF.h | 26 ++++- .../c++2/src_simulator/evt/ChannelListener.h | 9 +- .../c++2/src_simulator/evt/CommandListener.h | 12 +- .../c++2/src_simulator/evt/ListenersSimCmd.h | 10 +- .../c++2/src_simulator/evt/TaskListener.h | 9 +- .../src_simulator/evt/TransactionListener.h | 3 +- simulators/c++2/src_simulator/sim/Server.cpp | 7 +- .../c++2/src_simulator/sim/ServerLocal.cpp | 1 + .../c++2/src_simulator/sim/SimComponents.cpp | 16 ++- .../c++2/src_simulator/sim/Simulator.cpp | 42 ++++--- simulators/c++2/src_simulator/sim/Simulator.h | 8 +- 74 files changed, 554 insertions(+), 162 deletions(-) diff --git a/simulators/c++2/src_simulator/Doxyfile b/simulators/c++2/src_simulator/Doxyfile index ceea234764..5d67fc5584 100644 --- a/simulators/c++2/src_simulator/Doxyfile +++ b/simulators/c++2/src_simulator/Doxyfile @@ -493,7 +493,7 @@ WARN_LOGFILE = # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = +INPUT = . ./app ./arch ./ebrdd ./evt ./sim # This tag can be used to specify the character encoding of the source files that # doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default diff --git a/simulators/c++2/src_simulator/TMLTransaction.cpp b/simulators/c++2/src_simulator/TMLTransaction.cpp index ee1560024e..81af72533b 100755 --- a/simulators/c++2/src_simulator/TMLTransaction.cpp +++ b/simulators/c++2/src_simulator/TMLTransaction.cpp @@ -62,9 +62,9 @@ void TMLTransaction::setRunnableTime(TMLTime iRunnableTime){ // std::cout << "ERROR: runnable time set twice\n"; //}else{ //_runnableTimeSet=true; -#ifdef REGISTER_TRANS_AT_CPU - _command->getTask()->getCPU()->registerTransaction(this,0); -#endif +//#ifdef REGISTER_TRANS_AT_CPU +// _command->getTask()->getCPU()->registerTransaction(this,0); +//#endif //} } diff --git a/simulators/c++2/src_simulator/app/ChannelAbstr.h b/simulators/c++2/src_simulator/app/ChannelAbstr.h index 31f842a2cd..2430cfc6b0 100644 --- a/simulators/c++2/src_simulator/app/ChannelAbstr.h +++ b/simulators/c++2/src_simulator/app/ChannelAbstr.h @@ -42,11 +42,12 @@ Ludovic Apvrille, Renaud Pacalet #define ChnanelAbstrH #include <TMLChannel.h> +///Abstraction of TML Channels class ChannelAbstr{ public: ///Constructor /** - \param iTask Pointer to CPU object which shall be encapsulated + \param iChannel Pointer to Channel object which shall be encapsulated */ ChannelAbstr(TMLChannel* iChannel):_channel(iChannel){ } diff --git a/simulators/c++2/src_simulator/app/CommandAbstr.h b/simulators/c++2/src_simulator/app/CommandAbstr.h index 9cd93f67d0..a497497c6b 100644 --- a/simulators/c++2/src_simulator/app/CommandAbstr.h +++ b/simulators/c++2/src_simulator/app/CommandAbstr.h @@ -42,6 +42,7 @@ Ludovic Apvrille, Renaud Pacalet #define CommandAbstrH #include <TMLCommand.h> +///Abstraction of TML commands class CommandAbstr{ public: ///Constructor diff --git a/simulators/c++2/src_simulator/app/Parameter.h b/simulators/c++2/src_simulator/app/Parameter.h index 38c5e3f430..36c493a120 100644 --- a/simulators/c++2/src_simulator/app/Parameter.h +++ b/simulators/c++2/src_simulator/app/Parameter.h @@ -63,7 +63,9 @@ public: READ_STREAM(s, _p1); READ_STREAM(s, _p2); READ_STREAM(s, _p3); +#ifdef DEBUG_SERIALIZE print(); +#endif } /////Assignement operator, copies all parameters /*const Parameter<T>& operator=(const Parameter<T>& rhs){ @@ -81,7 +83,9 @@ public: WRITE_STREAM(s, _p1); WRITE_STREAM(s, _p2); WRITE_STREAM(s, _p3); +#ifdef DEBUG_SERIALIZE print(); +#endif return s; } ///Stream operator >> diff --git a/simulators/c++2/src_simulator/app/TMLChannel.h b/simulators/c++2/src_simulator/app/TMLChannel.h index 6943399936..24417a69d7 100755 --- a/simulators/c++2/src_simulator/app/TMLChannel.h +++ b/simulators/c++2/src_simulator/app/TMLChannel.h @@ -61,8 +61,8 @@ public: \param iID ID of channel \param iName Name of the channel \param iNumberOfHops Number of buses on which the channel is mapped - \param iBuses Pointer to the buses on which the channel is mapped - \param iSlaves Pointer to the slaves on which the channel is mapped + \param iMasters Pointers to the masters which the channel is connected to + \param iSlaves Pointers to the slaves on which the channel is mapped */ TMLChannel(unsigned int iID, std::string iName, unsigned int iNumberOfHops, BusMaster** iMasters, Slave** iSlaves); ///Destructor diff --git a/simulators/c++2/src_simulator/app/TMLChoiceCommand.h b/simulators/c++2/src_simulator/app/TMLChoiceCommand.h index 68fa02afc3..ab704016cb 100755 --- a/simulators/c++2/src_simulator/app/TMLChoiceCommand.h +++ b/simulators/c++2/src_simulator/app/TMLChoiceCommand.h @@ -54,6 +54,7 @@ public: \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 iNbOfBranches Number of branches of the choice \param iNonDeterm Flag is true for non deterministic commands */ TMLChoiceCommand(unsigned int iID, TMLTask* iTask, CondFuncPointer iCondFunc, unsigned int iNbOfBranches, bool iNonDeterm); diff --git a/simulators/c++2/src_simulator/app/TMLCommand.cpp b/simulators/c++2/src_simulator/app/TMLCommand.cpp index 7a3ad9a2d0..fa44a73e50 100755 --- a/simulators/c++2/src_simulator/app/TMLCommand.cpp +++ b/simulators/c++2/src_simulator/app/TMLCommand.cpp @@ -126,12 +126,11 @@ TMLCommand* TMLCommand::prepare(bool iInit){ result = prepareNextTransaction(); //NEW!!!!!!!!!!!!!!!!!!!!!!!! } //TMLCommand* result = prepareNextTransaction(); NEW!!!!!!!!!!!!!!!!! - //if (_length==0) std::cout << "create trans with length 0: " << toString() << std::endl; -#ifdef REGISTER_TRANS_AT_CPU +/*#ifdef REGISTER_TRANS_AT_CPU if (_currTransaction!=0 && _currTransaction->getVirtualLength()!=0){ _task->getCPU()->registerTransaction(_currTransaction,0); } -#endif +#endif*/ return result; } return 0; @@ -203,13 +202,17 @@ void TMLCommand::removeBreakpoint(){ std::ostream& TMLCommand::writeObject(std::ostream& s){ WRITE_STREAM(s,_progress); +#ifdef DEBUG_SERIALIZE std::cout << "Write: TMLCommand " << _ID << " progress: " << _progress << std::endl; +#endif return s; } std::istream& TMLCommand::readObject(std::istream& s){ READ_STREAM(s,_progress); +#ifdef DEBUG_SERIALIZE std::cout << "Read: TMLCommand " << _ID << " progress: " << _progress << std::endl; +#endif //std::cout << "End Read Object TMLCommand " << _ID << std::endl; return s; } diff --git a/simulators/c++2/src_simulator/app/TMLCommand.h b/simulators/c++2/src_simulator/app/TMLCommand.h index d5d0b4ab82..0008211f98 100755 --- a/simulators/c++2/src_simulator/app/TMLCommand.h +++ b/simulators/c++2/src_simulator/app/TMLCommand.h @@ -60,7 +60,7 @@ public: \param iID ID of the command \param iTask Pointer to the task the command belongs to \param iLength Virtual length of the command - \param iParam Pointer to a parameter function + \param iParamFunc Pointer to a parameter function \param iNbOfNextCmds Number of next commands */ TMLCommand(unsigned int iID, TMLTask* iTask, TMLLength iLength, ParamFuncPointer iParamFunc, unsigned int iNbOfNextCmds); diff --git a/simulators/c++2/src_simulator/app/TMLEventBChannel.cpp b/simulators/c++2/src_simulator/app/TMLEventBChannel.cpp index 7827154cef..2eb017c5c5 100644 --- a/simulators/c++2/src_simulator/app/TMLEventBChannel.cpp +++ b/simulators/c++2/src_simulator/app/TMLEventBChannel.cpp @@ -160,7 +160,9 @@ std::ostream& TMLEventBChannel::writeObject(std::ostream& s){ if (_eventFile!=0){ std::istream::streampos aPos=_eventFile->tellg(); WRITE_STREAM(s,aPos); +#ifdef DEBUG_SERIALIZE std::cout << "Write: TMLEventBChannel " << _name << " posInFile: " << _eventFile->tellg() << std::endl; +#endif } return s; } @@ -172,7 +174,9 @@ std::istream& TMLEventBChannel::readObject(std::istream& s){ if (_eventFile!=0){ READ_STREAM(s,aPos); _eventFile->seekg(aPos); +#ifdef DEBUG_SERIALIZE std::cout << "Read: TMLEventBChannel " << _name << " posInFile: " << aPos << std::endl; +#endif } return s; diff --git a/simulators/c++2/src_simulator/app/TMLEventBChannel.h b/simulators/c++2/src_simulator/app/TMLEventBChannel.h index 1d06cc1b44..389af613db 100644 --- a/simulators/c++2/src_simulator/app/TMLEventBChannel.h +++ b/simulators/c++2/src_simulator/app/TMLEventBChannel.h @@ -55,8 +55,8 @@ public: \param iID ID of channel \param iName Name of the channel \param iNumberOfHops Number of buses on which the channel is mapped - \param iBuses Pointer to the buses on which the channel is mapped - \param iSlaves Pointer to the slaves on which the channel is mapped + \param iMasters Pointers to the masters which the channel is connected to + \param iSlaves Pointers to the slaves on which the channel is mapped \param iContent Initial content of the channel \param iRequestChannel Flag indicating if channel is used by a request \param iSourceIsFile Flag indicating if events are read from a file diff --git a/simulators/c++2/src_simulator/app/TMLEventChannel.h b/simulators/c++2/src_simulator/app/TMLEventChannel.h index 083bf66b9b..2e5755ecfa 100644 --- a/simulators/c++2/src_simulator/app/TMLEventChannel.h +++ b/simulators/c++2/src_simulator/app/TMLEventChannel.h @@ -55,8 +55,8 @@ public: \param iID ID of channel \param iName Name of the channel \param iNumberOfHops Number of buses on which the channel is mapped - \param iBuses Pointer to the buses on which the channel is mapped - \param iSlaves Pointer to the slaves on which the channel is mapped + \param iMasters Pointers to the masters which the channel is connected to + \param iSlaves Pointers to the slaves on which the channel is mapped \param iContent Initial content of the channel */ TMLEventChannel(unsigned int iID, std::string iName, unsigned int iNumberOfHops, BusMaster** iMasters, Slave** iSlaves, TMLLength iContent); diff --git a/simulators/c++2/src_simulator/app/TMLEventFBChannel.h b/simulators/c++2/src_simulator/app/TMLEventFBChannel.h index 51f322053c..7c398afd96 100644 --- a/simulators/c++2/src_simulator/app/TMLEventFBChannel.h +++ b/simulators/c++2/src_simulator/app/TMLEventFBChannel.h @@ -55,8 +55,8 @@ public: \param iID of channel \param iName Name of the channel \param iNumberOfHops Number of buses on which the channel is mapped - \param iBuses Pointer to the buses on which the channel is mapped - \param iSlaves Pointer to the slaves on which the channel is mapped + \param iMasters Pointers to the masters which the channel is connected to + \param iSlaves Pointers to the slaves on which the channel is mapped \param iLength Length of the channel \param iContent Initial content of the channel */ diff --git a/simulators/c++2/src_simulator/app/TMLEventFChannel.h b/simulators/c++2/src_simulator/app/TMLEventFChannel.h index 9c22bb4718..a16ffcbe7c 100644 --- a/simulators/c++2/src_simulator/app/TMLEventFChannel.h +++ b/simulators/c++2/src_simulator/app/TMLEventFChannel.h @@ -55,8 +55,8 @@ public: \param iID ID of channel \param iName Name of the channel \param iNumberOfHops Number of buses on which the channel is mapped - \param iBuses Pointer to the buses on which the channel is mapped - \param iSlaves Pointer to the slaves on which the channel is mapped + \param iMasters Pointers to the masters which the channel is connected to + \param iSlaves Pointers to the slaves on which the channel is mapped \param iLength Length of the channel \param iContent Initial content of the channel */ diff --git a/simulators/c++2/src_simulator/app/TMLExeciCommand.cpp b/simulators/c++2/src_simulator/app/TMLExeciCommand.cpp index e998252622..d9203a4e49 100755 --- a/simulators/c++2/src_simulator/app/TMLExeciCommand.cpp +++ b/simulators/c++2/src_simulator/app/TMLExeciCommand.cpp @@ -53,7 +53,7 @@ void TMLExeciCommand::execute(){ //_task->setEndLastTransaction(_currTransaction->getEndTime()); _task->addTransaction(_currTransaction); //std::cout << "Execi execute prepare" << std::endl; - TMLCommand* aNextCommand = prepare(false); + prepare(false); //if (aNextCommand==0) _currTransaction->setTerminatedFlag(); //if (_progress==0 && aNextCommand!=this) _currTransaction=0; } diff --git a/simulators/c++2/src_simulator/app/TMLNotifiedCommand.cpp b/simulators/c++2/src_simulator/app/TMLNotifiedCommand.cpp index b994e5c529..7c8bbf533a 100644 --- a/simulators/c++2/src_simulator/app/TMLNotifiedCommand.cpp +++ b/simulators/c++2/src_simulator/app/TMLNotifiedCommand.cpp @@ -55,7 +55,7 @@ void TMLNotifiedCommand::execute(){ #ifdef ADD_COMMENTS _task->addComment(new Comment(_task->getEndLastTransaction(), this, *_resultVar)); #endif - TMLCommand* aNextCommand = prepare(false); + prepare(false); //if (aNextCommand==0) _currTransaction->setTerminatedFlag(); //if (_progress==0 && aNextCommand!=this) _currTransaction=0; } diff --git a/simulators/c++2/src_simulator/app/TMLReadCommand.cpp b/simulators/c++2/src_simulator/app/TMLReadCommand.cpp index de5877393e..6b97d22879 100755 --- a/simulators/c++2/src_simulator/app/TMLReadCommand.cpp +++ b/simulators/c++2/src_simulator/app/TMLReadCommand.cpp @@ -53,7 +53,7 @@ void TMLReadCommand::execute(){ //_task->setEndLastTransaction(_currTransaction->getEndTime()); //std::cout << "ReadCommand progress: " << _progress << std::endl; _task->addTransaction(_currTransaction); - TMLCommand* aNextCommand = prepare(false); + prepare(false); //if (aNextCommand==0) _currTransaction->setTerminatedFlag(); //if (_progress==0 && aNextCommand!=this) _currTransaction=0; } diff --git a/simulators/c++2/src_simulator/app/TMLRequestCommand.cpp b/simulators/c++2/src_simulator/app/TMLRequestCommand.cpp index f1234e9f55..228123465a 100644 --- a/simulators/c++2/src_simulator/app/TMLRequestCommand.cpp +++ b/simulators/c++2/src_simulator/app/TMLRequestCommand.cpp @@ -54,7 +54,7 @@ void TMLRequestCommand::execute(){ //std::cout << "setEndLastTrans Virtual length " << std::endl; //_task->setEndLastTransaction(_currTransaction->getEndTime()); _task->addTransaction(_currTransaction); - TMLCommand* aNextCommand = prepare(false); + prepare(false); //if (aNextCommand==0) _currTransaction->setTerminatedFlag(); //if (_progress==0 && aNextCommand!=this) _currTransaction=0; } diff --git a/simulators/c++2/src_simulator/app/TMLRequestCommand.h b/simulators/c++2/src_simulator/app/TMLRequestCommand.h index 6fc735cc4a..cee71db9e1 100644 --- a/simulators/c++2/src_simulator/app/TMLRequestCommand.h +++ b/simulators/c++2/src_simulator/app/TMLRequestCommand.h @@ -54,7 +54,7 @@ public: \param iID ID of the command \param iTask Pointer to the task the command belongs to \param iChannel Pointer to the channel on which the event is conveyed - \param iParam Pointer to the parameter data structure + \param iParamFunc Pointer to a parameter function */ TMLRequestCommand(unsigned int iID, TMLTask* iTask, TMLEventBChannel* iChannel, ParamFuncPointer iParamFunc); void execute(); diff --git a/simulators/c++2/src_simulator/app/TMLSelectCommand.cpp b/simulators/c++2/src_simulator/app/TMLSelectCommand.cpp index 9659d05a3c..56e4d2364c 100644 --- a/simulators/c++2/src_simulator/app/TMLSelectCommand.cpp +++ b/simulators/c++2/src_simulator/app/TMLSelectCommand.cpp @@ -81,7 +81,7 @@ void TMLSelectCommand::execute(){ _task->addComment(new Comment(_task->getEndLastTransaction(), this, _indexNextCommand)); #endif _maxChannelIndex=0; - TMLCommand* aNextCommand = prepare(false); + prepare(false); //if (aNextCommand==0) _currTransaction->setTerminatedFlag(); //if (_progress==0 && aNextCommand!=this) _currTransaction=0; } diff --git a/simulators/c++2/src_simulator/app/TMLSelectCommand.h b/simulators/c++2/src_simulator/app/TMLSelectCommand.h index 71b268fa04..b000c60ce2 100644 --- a/simulators/c++2/src_simulator/app/TMLSelectCommand.h +++ b/simulators/c++2/src_simulator/app/TMLSelectCommand.h @@ -55,7 +55,7 @@ public: \param iTask Pointer to the task the command belongs to \param iChannel Pointer to an array of pointers to channels conveying the desired signals \param iNumbChannels Number of channels in the array - \param iParam Pointer to an array of parameter functions pointers + \param iParamFunc Pointer to an array of parameter functions pointers */ TMLSelectCommand(unsigned int iID, TMLTask* iTask,TMLEventChannel** iChannel, unsigned int iNumbChannels, ParamFuncPointer* iParamFunc); ///Destructor diff --git a/simulators/c++2/src_simulator/app/TMLSendCommand.cpp b/simulators/c++2/src_simulator/app/TMLSendCommand.cpp index 34b828d88a..6911f61e32 100644 --- a/simulators/c++2/src_simulator/app/TMLSendCommand.cpp +++ b/simulators/c++2/src_simulator/app/TMLSendCommand.cpp @@ -53,7 +53,7 @@ void TMLSendCommand::execute(){ _progress+=_currTransaction->getVirtualLength(); //_task->setEndLastTransaction(_currTransaction->getEndTime()); _task->addTransaction(_currTransaction); - TMLCommand* aNextCommand = prepare(false); + prepare(false); //if (aNextCommand==0) _currTransaction->setTerminatedFlag(); //if (_progress==0 && aNextCommand!=this) _currTransaction=0; } diff --git a/simulators/c++2/src_simulator/app/TMLSendCommand.h b/simulators/c++2/src_simulator/app/TMLSendCommand.h index a9954fb15a..5b5e377d42 100644 --- a/simulators/c++2/src_simulator/app/TMLSendCommand.h +++ b/simulators/c++2/src_simulator/app/TMLSendCommand.h @@ -54,7 +54,7 @@ public: \param iID ID of the command \param iTask Pointer to the task the command belongs to \param iChannel Pointer to the channel on which the event is conveyed - \param iParam Pointer to a parameter function + \param iParamFunc Pointer to a parameter function */ TMLSendCommand(unsigned int iID, TMLTask* iTask, TMLEventChannel* iChannel, ParamFuncPointer iParamFunc); void execute(); diff --git a/simulators/c++2/src_simulator/app/TMLStateChannel.cpp b/simulators/c++2/src_simulator/app/TMLStateChannel.cpp index 75c1fecf65..b8d6fb3db8 100644 --- a/simulators/c++2/src_simulator/app/TMLStateChannel.cpp +++ b/simulators/c++2/src_simulator/app/TMLStateChannel.cpp @@ -48,14 +48,18 @@ TMLStateChannel::~TMLStateChannel(){} std::ostream& TMLStateChannel::writeObject(std::ostream& s){ TMLChannel::writeObject(s); WRITE_STREAM(s,_content); +#ifdef DEBUG_SERIALIZE std::cout << "Write: TMLStateChannel " << _name << " content: " << _content << std::endl; +#endif return s; } std::istream& TMLStateChannel::readObject(std::istream& s){ TMLChannel::readObject(s); READ_STREAM(s,_content); +#ifdef DEBUG_SERIALIZE std::cout << "Read: TMLStateChannel " << _name << " content: " << _content << std::endl; +#endif return s; } diff --git a/simulators/c++2/src_simulator/app/TMLStateChannel.h b/simulators/c++2/src_simulator/app/TMLStateChannel.h index c193f170c6..fa1355bb73 100644 --- a/simulators/c++2/src_simulator/app/TMLStateChannel.h +++ b/simulators/c++2/src_simulator/app/TMLStateChannel.h @@ -54,8 +54,8 @@ public: \param iID ID of channel \param iName Name of the channel \param iNumberOfHops Number of buses on which the channel is mapped - \param iBuses Pointer to the buses on which the channel is mapped - \param iSlaves Pointer to the slaves on which the channel is mapped + \param iMasters Pointers to the masters which the channel is connected to + \param iSlaves Pointers to the slaves on which the channel is mapped \param iContent Initial content of the channel */ TMLStateChannel(unsigned int iID, std::string iName, unsigned int iNumberOfHops, BusMaster** iMasters, Slave** iSlaves ,TMLLength iContent); diff --git a/simulators/c++2/src_simulator/app/TMLTask.cpp b/simulators/c++2/src_simulator/app/TMLTask.cpp index 14f74bf34b..f26e308618 100755 --- a/simulators/c++2/src_simulator/app/TMLTask.cpp +++ b/simulators/c++2/src_simulator/app/TMLTask.cpp @@ -197,32 +197,42 @@ TMLTime TMLTask::getNextSignalChange(bool iInit, std::string& oSigChange, bool& break; } } + return 0; } std::ostream& TMLTask::writeObject(std::ostream& s){ unsigned int aCurrCmd; WRITE_STREAM(s,_endLastTransaction); +#ifdef DEBUG_SERIALIZE std::cout << "Write: TMLTask " << _name << " endLastTransaction: " << _endLastTransaction << std::endl; +#endif if (_currCommand==0){ aCurrCmd=0; WRITE_STREAM(s,aCurrCmd); +#ifdef DEBUG_SERIALIZE std::cout << "Write: TMLTask " << _name << " aCurrCmd: " << aCurrCmd << std::endl; +#endif }else{ aCurrCmd=_currCommand->getID(); - //if (aCurrCmd>1000 && aCurrCmd!=((unsigned int)-1)){ - // std::cout << "BIIIIIIIIIIIIIIIIIIIIIIIG number: " << aCurrCmd << std::endl; - //} WRITE_STREAM(s,aCurrCmd); +#ifdef DEBUG_SERIALIZE std::cout << "Write: TMLTask " << _name << " aCurrCmd: " << aCurrCmd << std::endl; +#endif _currCommand->writeObject(s); } #ifdef SAVE_BENCHMARK_VARS WRITE_STREAM(s, _busyCycles); +#ifdef DEBUG_SERIALIZE std::cout << "Write: TMLTask " << _name << " busyCycles: " << _busyCycles << std::endl; +#endif WRITE_STREAM(s, _CPUContentionDelay); +#ifdef DEBUG_SERIALIZE std::cout << "Write: TMLTask " << _name << " CPUContentionDelay: " << _CPUContentionDelay << std::endl; +#endif WRITE_STREAM(s, _noCPUTransactions); +#ifdef DEBUG_SERIALIZE std::cout << "Write: TMLTask " << _name << " noCPUTransactions: " << _noCPUTransactions << std::endl; +#endif #endif return s; } @@ -231,9 +241,13 @@ std::istream& TMLTask::readObject(std::istream& s){ unsigned int aCurrCmd; //_previousTransEndTime=0; _busyCycles=0; _CPUContentionDelay=0; _noCPUTransactions=0; READ_STREAM(s, _endLastTransaction); +#ifdef DEBUG_SERIALIZE std::cout << "Read: TMLTask " << _name << " endLastTransaction: " << _endLastTransaction << std::endl; +#endif READ_STREAM(s, aCurrCmd); +#ifdef DEBUG_SERIALIZE std::cout << "Read: TMLTask " << _name << " aCurrCmd: " << aCurrCmd << std::endl; +#endif if (aCurrCmd==0){ _currCommand=0; }else{ @@ -247,11 +261,17 @@ std::istream& TMLTask::readObject(std::istream& s){ //std::cout << "End Read Object TMLTask " << _name << std::endl; #ifdef SAVE_BENCHMARK_VARS READ_STREAM(s, _busyCycles); +#ifdef DEBUG_SERIALIZE std::cout << "Read: TMLTask " << _name << " busyCycles: " << _busyCycles << std::endl; +#endif READ_STREAM(s, _CPUContentionDelay); +#ifdef DEBUG_SERIALIZE std::cout << "Read: TMLTask " << _name << " CPUContentionDelay: " << _CPUContentionDelay << std::endl; +#endif READ_STREAM(s, _noCPUTransactions); +#ifdef DEBUG_SERIALIZE std::cout << "Read: TMLTask " << _name << " noCPUTransactions: " << _noCPUTransactions << std::endl; +#endif #endif _justStarted=false; return s; diff --git a/simulators/c++2/src_simulator/app/TMLTask.h b/simulators/c++2/src_simulator/app/TMLTask.h index ff8a530da8..b5a2dd58ff 100755 --- a/simulators/c++2/src_simulator/app/TMLTask.h +++ b/simulators/c++2/src_simulator/app/TMLTask.h @@ -153,6 +153,7 @@ public: TMLCommand* getCommandByID(unsigned int iID); ///Adds a new command to the internal list /** + \param iID ID of the command \param iCmd Pointer to the command */ void addCommand(unsigned int iID, TMLCommand* iCmd); diff --git a/simulators/c++2/src_simulator/app/TMLWaitCommand.cpp b/simulators/c++2/src_simulator/app/TMLWaitCommand.cpp index 30e33e603f..eb068ddd15 100644 --- a/simulators/c++2/src_simulator/app/TMLWaitCommand.cpp +++ b/simulators/c++2/src_simulator/app/TMLWaitCommand.cpp @@ -54,7 +54,7 @@ void TMLWaitCommand::execute(){ _progress+=_currTransaction->getVirtualLength(); //_task->setEndLastTransaction(_currTransaction->getEndTime()); _task->addTransaction(_currTransaction); - TMLCommand* aNextCommand = prepare(false); + prepare(false); //if (aNextCommand==0) _currTransaction->setTerminatedFlag(); //if (_progress==0 && aNextCommand!=this) _currTransaction=0; } diff --git a/simulators/c++2/src_simulator/app/TMLWaitCommand.h b/simulators/c++2/src_simulator/app/TMLWaitCommand.h index c75da64104..6efabad1cb 100644 --- a/simulators/c++2/src_simulator/app/TMLWaitCommand.h +++ b/simulators/c++2/src_simulator/app/TMLWaitCommand.h @@ -54,7 +54,7 @@ public: \param iID ID of the command \param iTask Pointer to the task the command belongs to \param iChannel Pointer to the channel on which the event is conveyed - \param iParam Pointer to a parameter function + \param iParamFunc Pointer to a parameter function */ TMLWaitCommand(unsigned int iID, TMLTask* iTask,TMLEventChannel* iChannel, ParamFuncPointer iParamFunc); void execute(); diff --git a/simulators/c++2/src_simulator/app/TMLWriteCommand.cpp b/simulators/c++2/src_simulator/app/TMLWriteCommand.cpp index 1466c35537..911b74a271 100755 --- a/simulators/c++2/src_simulator/app/TMLWriteCommand.cpp +++ b/simulators/c++2/src_simulator/app/TMLWriteCommand.cpp @@ -53,7 +53,7 @@ void TMLWriteCommand::execute(){ _progress+=_currTransaction->getVirtualLength(); //_task->setEndLastTransaction(_currTransaction->getEndTime()); _task->addTransaction(_currTransaction); - TMLCommand* aNextCommand = prepare(false); + prepare(false); //if (aNextCommand==0) _currTransaction->setTerminatedFlag(); //if (_progress==0 && aNextCommand!=this) _currTransaction=0; } diff --git a/simulators/c++2/src_simulator/app/TMLbrbwChannel.h b/simulators/c++2/src_simulator/app/TMLbrbwChannel.h index e9135eab3e..f6432530b5 100755 --- a/simulators/c++2/src_simulator/app/TMLbrbwChannel.h +++ b/simulators/c++2/src_simulator/app/TMLbrbwChannel.h @@ -55,8 +55,8 @@ public: \param iID ID of channel \param iName Name of the channel \param iNumberOfHops Number of buses on which the channel is mapped - \param iBuses Pointer to the buses on which the channel is mapped - \param iSlaves Pointer to the slaves on which the channel is mapped + \param iMasters Pointers to the masters which the channel is connected to + \param iSlaves Pointers to the slaves on which the channel is mapped \param iLength Length of the channel \param iContent Initial content of the channel */ diff --git a/simulators/c++2/src_simulator/app/TMLbrnbwChannel.h b/simulators/c++2/src_simulator/app/TMLbrnbwChannel.h index da232d8697..0c1ca3dda6 100644 --- a/simulators/c++2/src_simulator/app/TMLbrnbwChannel.h +++ b/simulators/c++2/src_simulator/app/TMLbrnbwChannel.h @@ -55,8 +55,8 @@ public: \param iID iID of channel \param iName Name of the channel \param iNumberOfHops Number of buses on which the channel is mapped - \param iBuses Pointer to the buses on which the channel is mapped - \param iSlaves Pointer to the slaves on which the channel is mapped + \param iMasters Pointers to the masters which the channel is connected to + \param iSlaves Pointers to the slaves on which the channel is mapped \param iContent Initial content of the channel */ TMLbrnbwChannel(unsigned int iID, std::string iName, unsigned int iNumberOfHops, BusMaster** iMasters, Slave** iSlaves, TMLLength iContent); diff --git a/simulators/c++2/src_simulator/app/TMLnbrnbwChannel.h b/simulators/c++2/src_simulator/app/TMLnbrnbwChannel.h index 282bbe618b..a41d406405 100644 --- a/simulators/c++2/src_simulator/app/TMLnbrnbwChannel.h +++ b/simulators/c++2/src_simulator/app/TMLnbrnbwChannel.h @@ -55,8 +55,8 @@ public: \param iID ID of channel \param iName Name of the channel \param iNumberOfHops Number of buses on which the channel is mapped - \param iBuses Pointer to the buses on which the channel is mapped - \param iSlaves Pointer to the slaves on which the channel is mapped + \param iMasters Pointers to the masters which the channel is connected to + \param iSlaves Pointers to the slaves on which the channel is mapped */ TMLnbrnbwChannel(unsigned int iID, std::string iName, unsigned int iNumberOfHops, BusMaster** iMasters, Slave** iSlaves); void testWrite(TMLTransaction* iCommand); diff --git a/simulators/c++2/src_simulator/app/TaskAbstr.h b/simulators/c++2/src_simulator/app/TaskAbstr.h index d0105132f2..4cb467e27b 100644 --- a/simulators/c++2/src_simulator/app/TaskAbstr.h +++ b/simulators/c++2/src_simulator/app/TaskAbstr.h @@ -42,6 +42,7 @@ Ludovic Apvrille, Renaud Pacalet #define TaskAbstrH #include <TMLTask.h> +///Abstraction of TML Tasks class TaskAbstr{ public: ///Constructor diff --git a/simulators/c++2/src_simulator/arch/Bus.cpp b/simulators/c++2/src_simulator/arch/Bus.cpp index 10f1eed222..be3a9e5f3f 100644 --- a/simulators/c++2/src_simulator/arch/Bus.cpp +++ b/simulators/c++2/src_simulator/arch/Bus.cpp @@ -236,6 +236,7 @@ TMLTime Bus::getNextSignalChange(bool iInit, std::string& oSigChange, bool& oNoM break; } } + return 0; } void Bus::reset(){ @@ -267,7 +268,9 @@ std::istream& Bus::readObject(std::istream &is){ _scheduler->readObject(is); #ifdef SAVE_BENCHMARK_VARS READ_STREAM(is,_busyCycles); +#ifdef DEBUG_SERIALIZE std::cout << "Read: Bus " << _name << " busyCycles: " << _busyCycles << std::endl; +#endif #endif return is; } @@ -277,7 +280,9 @@ std::ostream& Bus::writeObject(std::ostream &os){ _scheduler->writeObject(os); #ifdef SAVE_BENCHMARK_VARS WRITE_STREAM(os,_busyCycles); +#ifdef DEBUG_SERIALIZE std::cout << "Write: Bus " << _name << " busyCycles: " << _busyCycles << std::endl; +#endif #endif return os; } diff --git a/simulators/c++2/src_simulator/arch/Bus.h b/simulators/c++2/src_simulator/arch/Bus.h index 8fb0326044..bcbb362ec1 100644 --- a/simulators/c++2/src_simulator/arch/Bus.h +++ b/simulators/c++2/src_simulator/arch/Bus.h @@ -65,15 +65,13 @@ public: \param iName Name of the bus \param iScheduler Pointer to the scheduler object \param iBurstSize Size of an atomic bus transaction + \param ibusWidth Bus width + \param iTimePerSample Transfer time per sample */ Bus(unsigned int iID, std::string iName, WorkloadSource* iScheduler, TMLLength iBurstSize, unsigned int ibusWidth=1, TMLTime iTimePerSample=1); ///Destructor virtual ~Bus(); ///Add a transaction waiting for execution to the internal list - /** - \param iTrans Pointer to the transaction to add - \param iSourceDevice Source device - */ void registerTransaction(); ///Determines the next bus transaction to be executed void schedule(); diff --git a/simulators/c++2/src_simulator/arch/BusAbstr.h b/simulators/c++2/src_simulator/arch/BusAbstr.h index d81a422801..83a5eb0f7c 100644 --- a/simulators/c++2/src_simulator/arch/BusAbstr.h +++ b/simulators/c++2/src_simulator/arch/BusAbstr.h @@ -42,11 +42,12 @@ Ludovic Apvrille, Renaud Pacalet #define BusAbstrH #include <Bus.h> +///Abstraction of Bus component class BusAbstr{ public: ///Constructor /** - \param iID ID of the bus + \param iBus pointer to the bus */ BusAbstr(Bus* iBus):_bus(iBus){ } diff --git a/simulators/c++2/src_simulator/arch/BusMaster.h b/simulators/c++2/src_simulator/arch/BusMaster.h index 8b677cdc99..56ad80ce59 100644 --- a/simulators/c++2/src_simulator/arch/BusMaster.h +++ b/simulators/c++2/src_simulator/arch/BusMaster.h @@ -55,7 +55,8 @@ public: /** \param iName Name of the bus master \param iPriority Priority of the bus master - \param iBus Pointer to the bus the master is connected to + \param iNbOfBuses Number of buses(bus channels) the master is connected to + \param iBusArray Pointer to the buses(bus channels) the master is connected to */ BusMaster(const std::string& iName, unsigned int iPriority, unsigned int iNbOfBuses, SchedulableCommDevice** iBusArray): WorkloadSource(iPriority), _name(iName), _nbOfBuses(iNbOfBuses), _busArray(iBusArray), _busSortArray(0), _nextTransaction(0), _nextBus(iBusArray[0]), _lastSimTime(-1), _contentionDelay(0), _noTransactions(0){ _busSortArray=new SchedulableCommDevice*[_nbOfBuses]; @@ -174,9 +175,13 @@ public: WorkloadSource::readObject(is); #ifdef SAVE_BENCHMARK_VARS READ_STREAM(is,_contentionDelay); +#ifdef DEBUG_SERIALIZE std::cout << "Read: BusMaster " << _name << " contentionDelay: " << _contentionDelay << std::endl; +#endif READ_STREAM(is,_noTransactions); +#ifdef DEBUG_SERIALIZE std::cout << "Read: BusMaster " << _name << " noTransactions: " << _noTransactions << std::endl; +#endif #endif return is; } @@ -184,9 +189,13 @@ public: WorkloadSource::writeObject(os); #ifdef SAVE_BENCHMARK_VARS WRITE_STREAM(os,_contentionDelay); +#ifdef DEBUG_SERIALIZE std::cout << "Write: BusMaster " << _name << " contentionDelay: " << _contentionDelay << std::endl; +#endif WRITE_STREAM(os,_noTransactions); +#ifdef DEBUG_SERIALIZE std::cout << "Write: BusMaster " << _name << " noTransactions: " << _noTransactions << std::endl; +#endif #endif return os; } diff --git a/simulators/c++2/src_simulator/arch/CPU.cpp b/simulators/c++2/src_simulator/arch/CPU.cpp index 9ed3c56ad5..76d2107ba9 100755 --- a/simulators/c++2/src_simulator/arch/CPU.cpp +++ b/simulators/c++2/src_simulator/arch/CPU.cpp @@ -342,7 +342,7 @@ void CPU::schedule2HTML(std::ofstream& myfile) const{ } void CPU::schedule2TXT(std::ofstream& myfile) const{ - myfile << "========================================\nScheduling for device: "<< _name << "\n========================================\n" ; + myfile << "========= Scheduling for device: "<< _name << " =========\n" ; for(TransactionList::const_iterator i=_transactList.begin(); i != _transactList.end(); ++i){ myfile << (*i)->toShortString() << std::endl; } @@ -406,6 +406,7 @@ TMLTime CPU::getNextSignalChange(bool iInit, std::string& oSigChange, bool& oNoM break; } } + return 0; } TMLTransaction* CPU::getTransactions1By1(bool iInit){ @@ -442,8 +443,8 @@ void CPU::setScheduler(WorkloadSource* iScheduler){ _scheduler=iScheduler; } -void CPU::registerTransaction(){ -} +//void CPU::registerTransaction(){ +//} void CPU::addBusMaster(BusMaster* iMaster){ _busMasterList.push_back(iMaster); @@ -454,7 +455,9 @@ std::istream& CPU::readObject(std::istream &is){ _scheduler->readObject(is); #ifdef SAVE_BENCHMARK_VARS READ_STREAM(is,_busyCycles); +#ifdef DEBUG_SERIALIZE std::cout << "Read: CPU " << _name << " busy cycles: " << _busyCycles << std::endl; +#endif #endif return is; } @@ -463,7 +466,9 @@ std::ostream& CPU::writeObject(std::ostream &os){ _scheduler->writeObject(os); #ifdef SAVE_BENCHMARK_VARS WRITE_STREAM(os,_busyCycles); +#ifdef DEBUG_SERIALIZE std::cout << "Write: CPU " << _name << " busy cycles: " << _busyCycles << std::endl; +#endif #endif return os; } diff --git a/simulators/c++2/src_simulator/arch/CPU.h b/simulators/c++2/src_simulator/arch/CPU.h index 755915c94e..e9d38bc32a 100755 --- a/simulators/c++2/src_simulator/arch/CPU.h +++ b/simulators/c++2/src_simulator/arch/CPU.h @@ -86,12 +86,8 @@ public: \param iTask Pointer to the task to add */ virtual void registerTask(TMLTask* iTask); - ///Add a transaction waiting for execution to the internal list - /** - \param iTrans Pointer to the transaction to add - \param iSourceDevice Source device - */ - void registerTransaction(); + /////Add a transaction waiting for execution to the internal list + //void registerTransaction(); ///Adds the transaction determined by the scheduling algorithm to the internal list of scheduled transactions virtual bool addTransaction(); ///Returns a pointer to the transaction determined by the scheduling algorithm diff --git a/simulators/c++2/src_simulator/arch/CPUAbstr.h b/simulators/c++2/src_simulator/arch/CPUAbstr.h index 0ab0710008..605735855c 100644 --- a/simulators/c++2/src_simulator/arch/CPUAbstr.h +++ b/simulators/c++2/src_simulator/arch/CPUAbstr.h @@ -41,11 +41,13 @@ Ludovic Apvrille, Renaud Pacalet #ifndef CPUAbstrH #define CPUAbstrH #include <CPU.h> + +///Abstraction of CPU component class CPUAbstr{ public: ///Constructor /** - \param iTask Pointer to CPU object which shall be encapsulated + \param iCPU Pointer to CPU object which shall be encapsulated */ CPUAbstr(CPU* iCPU):_cpu(iCPU){ } diff --git a/simulators/c++2/src_simulator/arch/PrioScheduler.cpp b/simulators/c++2/src_simulator/arch/PrioScheduler.cpp index 9baf9e84b2..e3b669ad39 100644 --- a/simulators/c++2/src_simulator/arch/PrioScheduler.cpp +++ b/simulators/c++2/src_simulator/arch/PrioScheduler.cpp @@ -48,7 +48,7 @@ PrioScheduler::PrioScheduler(const std::string& iName, unsigned int iPrio, Workl TMLTime PrioScheduler::schedule(TMLTime iEndSchedule){ TaskList::iterator i; - TMLTransaction *aMarkerPast=0, *aMarkerFuture=0,*aTempTrans, *anOldTrans; + TMLTransaction *aMarkerPast=0, *aMarkerFuture=0,*aTempTrans; unsigned int aHighestPrioPast=-1; TMLTime aTransTimeFuture=-1,aRunnableTime; WorkloadSource *aSourcePast=0, *aSourceFuture=0; //NEW @@ -106,4 +106,4 @@ void PrioScheduler::reset(){ void PrioScheduler::transWasScheduled(){ if (_lastSource!=0) _lastSource->transWasScheduled(); -} \ No newline at end of file +} diff --git a/simulators/c++2/src_simulator/arch/PrioScheduler.h b/simulators/c++2/src_simulator/arch/PrioScheduler.h index 4b1279dff7..cf08c1ecde 100644 --- a/simulators/c++2/src_simulator/arch/PrioScheduler.h +++ b/simulators/c++2/src_simulator/arch/PrioScheduler.h @@ -49,13 +49,13 @@ public: ///Constructor /** \param iName Name of the scheduler - \param iPriority Priority of the scheduler + \param iPrio Priority of the scheduler */ PrioScheduler(const std::string& iName, unsigned int iPrio); ///Constructor /** \param iName Name of the scheduler - \param iPriority Priority of the scheduler + \param iPrio Priority of the scheduler \param aSourceArray Array of pointers to workload ressources from which transactions may be received \param iNbOfSources Length of the array */ diff --git a/simulators/c++2/src_simulator/arch/RRScheduler.cpp b/simulators/c++2/src_simulator/arch/RRScheduler.cpp index 6d73442adc..5142731243 100644 --- a/simulators/c++2/src_simulator/arch/RRScheduler.cpp +++ b/simulators/c++2/src_simulator/arch/RRScheduler.cpp @@ -145,10 +145,14 @@ RRScheduler::~RRScheduler(){ std::istream& RRScheduler::readObject(std::istream &is){ WorkloadSource::readObject(is); READ_STREAM(is,_elapsedTime); +#ifdef DEBUG_SERIALIZE std::cout << "Read: RRScheduler " << _name << " elapsedTime: " << _elapsedTime << std::endl; +#endif int aLastSourceIndex; READ_STREAM(is, aLastSourceIndex); +#ifdef DEBUG_SERIALIZE std::cout << "Read: RRScheduler " << _name << " lastSourceIndex: " << aLastSourceIndex << std::endl; +#endif if (aLastSourceIndex==-1){ _lastSource=0; }else{ @@ -162,7 +166,9 @@ std::istream& RRScheduler::readObject(std::istream &is){ std::ostream& RRScheduler::writeObject(std::ostream &os){ WorkloadSource::writeObject(os); WRITE_STREAM(os,_elapsedTime); +#ifdef DEBUG_SERIALIZE std::cout << "Write: RRScheduler " << _name << " elapsedTime: " << _elapsedTime << std::endl; +#endif int aLastSourceIndex; if (_lastSource==0){ aLastSourceIndex=-1; @@ -176,7 +182,9 @@ std::ostream& RRScheduler::writeObject(std::ostream &os){ } } WRITE_STREAM(os, aLastSourceIndex); +#ifdef DEBUG_SERIALIZE std::cout << "Write: RRScheduler " << _name << " lastSourceIndex: " << aLastSourceIndex << std::endl; +#endif return os; } diff --git a/simulators/c++2/src_simulator/arch/RRScheduler.h b/simulators/c++2/src_simulator/arch/RRScheduler.h index 5909c4a719..2fb03b0fbf 100644 --- a/simulators/c++2/src_simulator/arch/RRScheduler.h +++ b/simulators/c++2/src_simulator/arch/RRScheduler.h @@ -49,7 +49,7 @@ public: ///Constructor /** \param iName Name of the scheduler - \param iPriority Priority of the scheduler + \param iPrio Priority of the scheduler \param iTimeSlice Time slice which is granted to clients \param iMinSliceSize Minimum size of a time slice */ @@ -57,7 +57,7 @@ public: ///Constructor /** \param iName Name of the scheduler - \param iPriority Priority of the scheduler + \param iPrio Priority of the scheduler \param iTimeSlice Time slice which is granted to clients \param iMinSliceSize Minimum size of a time slice \param aSourceArray Array of pointers to workload ressources from which transactions may be received diff --git a/simulators/c++2/src_simulator/arch/SchedulableCommDevice.h b/simulators/c++2/src_simulator/arch/SchedulableCommDevice.h index 21b6459482..ec509e862d 100644 --- a/simulators/c++2/src_simulator/arch/SchedulableCommDevice.h +++ b/simulators/c++2/src_simulator/arch/SchedulableCommDevice.h @@ -53,7 +53,7 @@ public: \param iID ID of the device \param iName Name of the device */ - SchedulableCommDevice(unsigned int iID, std::string _iName): SchedulableDevice(iID, _iName){} + SchedulableCommDevice(unsigned int iID, std::string iName): SchedulableDevice(iID, iName){} ///Returns the size of an atomic bus transaction /** \return Size of an atomic bus transaction @@ -61,6 +61,8 @@ public: virtual TMLLength getBurstSize() const=0; /////Truncates a transaction so that it does not exceed the burst size of the communication device //virtual void truncateToBurst(TMLTransaction* iTrans) const=0; + ///Signals the component that a new transaction has become available and thus rescheduling is needed + virtual void registerTransaction()=0; ///Destructor virtual ~SchedulableCommDevice(){} }; diff --git a/simulators/c++2/src_simulator/arch/SchedulableDevice.h b/simulators/c++2/src_simulator/arch/SchedulableDevice.h index 1b8d7832f6..6044f9d121 100644 --- a/simulators/c++2/src_simulator/arch/SchedulableDevice.h +++ b/simulators/c++2/src_simulator/arch/SchedulableDevice.h @@ -72,16 +72,6 @@ public: /** \param myfile Reference to the ofstream object representing the output file */ - ///Add a transaction waiting for execution to the internal list - /** - \param iTrans Pointer to the transaction to add - \param iSourceDevice Source device - */ - virtual void registerTransaction()=0; - ///Writes a HTML representation of the schedule to an output file - /** - \param myfile Reference to the ofstream object representing the output file - */ virtual void schedule2HTML(std::ofstream& myfile) const =0; ///Writes a plain text representation of the schedule to an output file /** @@ -92,12 +82,16 @@ public: virtual std::istream& readObject(std::istream &is){ READ_STREAM(is,_endSchedule); //_simulatedTime=max(_simulatedTime,_endSchedule); ???????????? +#ifdef DEBUG_SERIALIZE std::cout << "Read: Schedulable Device " << _name << ": " << _endSchedule << std::endl; +#endif return is; } virtual std::ostream& writeObject(std::ostream &os){ WRITE_STREAM(os,_endSchedule); +#ifdef DEBUG_SERIALIZE std::cout << "Write: Schedulable Device " << _name << ": " << _endSchedule << std::endl; +#endif return os; } virtual void reset(){ diff --git a/simulators/c++2/src_simulator/definitions.cpp b/simulators/c++2/src_simulator/definitions.cpp index 3490d9eef1..25258739ae 100644 --- a/simulators/c++2/src_simulator/definitions.cpp +++ b/simulators/c++2/src_simulator/definitions.cpp @@ -108,4 +108,5 @@ int getexename(char* buf, size_t size){ ret = readlink(linkname, buf, size); if (ret == -1 || ret>=size) return -1; buf[ret] = 0; + return ret; } diff --git a/simulators/c++2/src_simulator/definitions.h b/simulators/c++2/src_simulator/definitions.h index d6ec48bfb6..b07a417a04 100644 --- a/simulators/c++2/src_simulator/definitions.h +++ b/simulators/c++2/src_simulator/definitions.h @@ -64,8 +64,10 @@ Ludovic Apvrille, Renaud Pacalet #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; +#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; using std::min; using std::max; @@ -73,6 +75,7 @@ using std::max; #undef DEBUG_KERNEL #undef DEBUG_CPU #undef DEBUG_BUS +#undef DEBUG_SERIALIZE #define BUS_ENABLED #define WAIT_SEND_VLEN 1 @@ -84,7 +87,7 @@ using std::max; #define PARAMETER_BLOCK_SIZE 1000 #define ADD_COMMENTS #define NO_EVENTS_TO_LOAD 10 -#undef REGISTER_TRANS_AT_CPU +//#undef REGISTER_TRANS_AT_CPU #define SAVE_BENCHMARK_VARS #define PORT "3490" #define BACKLOG 10 diff --git a/simulators/c++2/src_simulator/ebrdd/EBRDD.cpp b/simulators/c++2/src_simulator/ebrdd/EBRDD.cpp index ac5acec6e4..6edc1f8696 100755 --- a/simulators/c++2/src_simulator/ebrdd/EBRDD.cpp +++ b/simulators/c++2/src_simulator/ebrdd/EBRDD.cpp @@ -77,11 +77,15 @@ std::ostream& EBRDD::writeObject(std::ostream& s){ if (_currCommand==0){ aCurrCmd=0; WRITE_STREAM(s,aCurrCmd); +#ifdef DEBUG_SERIALIZE std::cout << "Write: EBRDD " << _name << " aCurrCmd: " << aCurrCmd << std::endl; +#endif }else{ aCurrCmd=_currCommand->getID(); WRITE_STREAM(s,aCurrCmd); +#ifdef DEBUG_SERIALIZE std::cout << "Write: EBRDD " << _name << " aCurrCmd: " << aCurrCmd << std::endl; +#endif _currCommand->writeObject(s); } return s; @@ -90,7 +94,9 @@ std::ostream& EBRDD::writeObject(std::ostream& s){ std::istream& EBRDD::readObject(std::istream& s){ unsigned int aCurrCmd; READ_STREAM(s, aCurrCmd); +#ifdef DEBUG_SERIALIZE std::cout << "Read: EBRDD " << _name << " aCurrCmd: " << aCurrCmd << std::endl; +#endif if (aCurrCmd==0){ _currCommand=0; }else{ diff --git a/simulators/c++2/src_simulator/ebrdd/EBRDD.h b/simulators/c++2/src_simulator/ebrdd/EBRDD.h index 4e09154a0b..d45434cddf 100755 --- a/simulators/c++2/src_simulator/ebrdd/EBRDD.h +++ b/simulators/c++2/src_simulator/ebrdd/EBRDD.h @@ -57,12 +57,12 @@ public: EBRDD(unsigned int iID, std::string iName); ///Destructor virtual ~EBRDD(); - ///Returns a pointer to the current command of the task + ///Returns a pointer to the current command of the EBRDD /** \return Pointer to the current command */ EBRDDCommand* getCurrCommand() const; - ///Sets the pointer to the current command of the task + ///Sets the pointer to the current command of the EBRDD /** \param iCurrCommand Pointer to the current command */ @@ -85,9 +85,9 @@ public: virtual std::ostream& writeObject(std::ostream& s); virtual std::istream& readObject(std::istream& s); virtual void reset(); - /////Returns a pointer to the task variable specified by its name + /////Returns a pointer to the EBRDD variable specified by its name ////** - //\param iVarName Name of the task variable + //\param iVarName Name of the EBRDD variable //\param oIsId Is set to true if an ID was passed to this function //\return Pointer to the variable //*/ @@ -100,12 +100,13 @@ public: EBRDDCommand* getCommandByID(unsigned int iID); ///Adds a new command to the internal list /** + \param iID ID of the command \param iCmd Pointer to the command */ void addCommand(unsigned int iID, EBRDDCommand* iCmd); - /////Returns a pointer to the task variable specified by its ID + /////Returns a pointer to the EBRDD variable specified by its ID ////** - //\param iVarID ID of the task variable + //\param iVarID ID of the EBRDD variable //\return Pointer to the variable //*/ //ParamType* getVariableByID(unsigned int iVarID); @@ -123,19 +124,19 @@ public: //VariableLookUpTableName::const_iterator getVariableIteratorName(bool iEnd) const; ///Is called when a stop command is encountered void finished(); - TMLTransaction* getNextTransaction() const; + //TMLTransaction* getNextTransaction() const; protected: - ///ID of the task + ///ID of the EBRDD unsigned int _ID; - ///Name of the task + ///Name of the EBRDD std::string _name; - ///Pointer to the current command of the task + ///Pointer to the current command of the EBRDD EBRDDCommand* _currCommand; - ///Pointer to the first command of the task + ///Pointer to the first command of the EBRDD EBRDDCommand* _firstCommand; - ///Look up table for task variables (by name) + ///Look up table for EBRDD variables (by name) VariableLookUpTableName _varLookUpName; - /////Look up table for task variables (by ID) + /////Look up table for EBRDD variables (by ID) //VariableLookUpTableID _varLookUpID; ///Hash table containing commands CommandHashTabEBRDD _commandHash; diff --git a/simulators/c++2/src_simulator/ebrdd/EBRDDChoiceCommand.h b/simulators/c++2/src_simulator/ebrdd/EBRDDChoiceCommand.h index 5cefb7f89e..ea4d6dcac8 100755 --- a/simulators/c++2/src_simulator/ebrdd/EBRDDChoiceCommand.h +++ b/simulators/c++2/src_simulator/ebrdd/EBRDDChoiceCommand.h @@ -53,7 +53,6 @@ public: \param iID ID of the command \param iEBRDD Pointer to the EBRDD the command belongs to \param iCondFunc Member function pointer to the condition function returning the index of the next command - \param iNbOfBranches Number of branches */ EBRDDChoiceCommand(unsigned int iID, EBRDD* iEBRDD, EBRDDFuncPointer iCondFunc); EBRDDCommand* prepare(); diff --git a/simulators/c++2/src_simulator/ebrdd/EBRDDCommand.h b/simulators/c++2/src_simulator/ebrdd/EBRDDCommand.h index 3b59d76a22..1a636aaa13 100755 --- a/simulators/c++2/src_simulator/ebrdd/EBRDDCommand.h +++ b/simulators/c++2/src_simulator/ebrdd/EBRDDCommand.h @@ -59,7 +59,7 @@ public: virtual ~EBRDDCommand(); ///Initializes the command and passes the control flow to the prepare() method of the next command if necessary /** - \return True if there was a transaction to prepare + \return The EBRDD command which is currently active */ virtual EBRDDCommand* prepare()=0; ///Assigns a value to the pointer referencing the array of next commands @@ -99,7 +99,7 @@ public: protected: ///ID of the command unsigned int _ID; - ///Pointer to the task the command belongs to + ///Pointer to the EBRDD the command belongs to EBRDD* _ebrdd; ///Pointer to an array of pointers to the next commands EBRDDCommand** _nextCommand; diff --git a/simulators/c++2/src_simulator/ebrdd/EBRDDStopCommand.h b/simulators/c++2/src_simulator/ebrdd/EBRDDStopCommand.h index 092a2b7111..77014a13a4 100644 --- a/simulators/c++2/src_simulator/ebrdd/EBRDDStopCommand.h +++ b/simulators/c++2/src_simulator/ebrdd/EBRDDStopCommand.h @@ -45,8 +45,7 @@ Ludovic Apvrille, Renaud Pacalet #include <EBRDDCommand.h> -///This class executes a C++ statement (probably a variable assignment or modification) defined in the scope of a TML action state. -/**The command itself is located in the corresponding TMLTask::executeStatement() method as it may access local task variables.*/ +///This command denotes the end of an EBRDD class EBRDDStopCommand:public EBRDDCommand{ public: ///Constructor diff --git a/simulators/c++2/src_simulator/ebrdd/ERB.cpp b/simulators/c++2/src_simulator/ebrdd/ERB.cpp index 6e579b2212..9e1d674aad 100644 --- a/simulators/c++2/src_simulator/ebrdd/ERB.cpp +++ b/simulators/c++2/src_simulator/ebrdd/ERB.cpp @@ -90,7 +90,7 @@ void ERB::notifyAncestor(unsigned int iEvtSourceID){ void ERB::activate(){ _active=true; - //std::cout << "activate event: " << _name << "\n"; + std::cout << "activate event: " << _name << "\n"; switch (_sourceClass){ //CPU case 0:{ @@ -266,17 +266,15 @@ void ERB::simulationStopped(){ void ERB::setSimComponents(SimComponents* iSimComp){ _simComp=iSimComp; } -/*void notify(){ - if (conditionFunction) - action; - else - abort; - NOTIFY_ANCESTOR; -}*/ -/*void abort(){ - if (_active){ - _aborted=true; - _ancestorNode->notifyAbort(_ID); - } -}*/ +std::ostream& ERB::writeObject(std::ostream& s){ + EventIF::writeObject(s); + return s; +} + +std::istream& ERB::readObject(std::istream& s){ + EventIF::readObject(s); + std::cout << "readObject " << _name << ": " << _active << "\n"; + if (_active) activate(); + return s; +} diff --git a/simulators/c++2/src_simulator/ebrdd/ERB.h b/simulators/c++2/src_simulator/ebrdd/ERB.h index 9bb037ad38..a0e6971fd0 100644 --- a/simulators/c++2/src_simulator/ebrdd/ERB.h +++ b/simulators/c++2/src_simulator/ebrdd/ERB.h @@ -53,14 +53,30 @@ Ludovic Apvrille, Renaud Pacalet class SimComponents; class ERC; +///Event Reaction Blocks are leaf nodes of an Event Tree within an ERC class ERB: public EventIF, public ChannelListener, public CommandListener, public KernelListener, public TaskListener, public TransactionListener{ public: + ///Constructor + /** + \param iContainer Pointer to subordinate ERC + \param iAncestorNode Pointer to ancestor node within the event tree + \param iNegated Event negated flag + \param iName Name of the ERB + \param iEvtID ID of event to be received + \param iSourceClass Category of then event source (CPU, Bus, Slave, ...) + \param iArrayOfSources Array of event sources + \param iNbOfSources Number of event sources + \param iEbrddFunc Member function pointer to EBRDD function + \param iCondString ERB Condition in string format + */ ERB(ERC* iContainer, NotifyIF* iAncestorNode, bool iNegated, const std::string& iName, unsigned int iEvtID, unsigned int iSourceClass, unsigned int* iArrayOfSources, unsigned int iNbOfSources, EBRDDFuncPointer iEbrddFunc, const std::string& iCondString); + ///Destructor virtual ~ERB(); void timeTick(TMLTime iNewTime); void activate(); void deactivate(); - //void transExecuted(TMLTransaction* iTrans); + virtual std::ostream& writeObject(std::ostream& s); + virtual std::istream& readObject(std::istream& s); void transExecuted(TMLTransaction* iTrans, unsigned int iID); void commandEntered(TMLCommand* iComm, unsigned int iID); void commandStarted(TMLCommand* iComm, unsigned int iID); @@ -72,23 +88,36 @@ public: void writeTrans(TMLTransaction* iTrans, unsigned int iID); void simulationStarted(); void simulationStopped(); - ///Sets the internal pointer to the simulation components + ///Sets the class variable pointing to the simulation objects /** - \param iSimComp Pointer to simulation components - */ + \param iSimComp Pointer to the simulation components + */ static void setSimComponents(SimComponents* iSimComp); protected: + ///Pointer to subordinate ERC ERC* _container; + ///Name of ERB std::string _name; + ///ID of event to be received unsigned int _evtID; + ///Category of then event source (CPU, Bus, Slave, ...) unsigned int _sourceClass; + ///Array of event sources unsigned int* _arrayOfSources; + ///Number of event sources unsigned int _nbOfSources; ///Pointer to simulation components static SimComponents* _simComp; + ///Class variable holding strinf representations of events static char* _evtString[]; + ///Member function pointer to EBRDD function EBRDDFuncPointer _ebrddFunc; + ///ERB Condition in string format std::string _condString; + ///Signals event to ancestor node + /** + \param iEvtSourceID ID of event source + */ void notifyAncestor(unsigned int iEvtSourceID); }; #endif diff --git a/simulators/c++2/src_simulator/ebrdd/ERC.cpp b/simulators/c++2/src_simulator/ebrdd/ERC.cpp index 669c2edd8a..0d45425119 100644 --- a/simulators/c++2/src_simulator/ebrdd/ERC.cpp +++ b/simulators/c++2/src_simulator/ebrdd/ERC.cpp @@ -107,3 +107,14 @@ std::string ERC::toString() const{ void ERC::setSimComponents(SimComponents* iSimComp){ _simComp=iSimComp; } + +std::ostream& ERC::writeObject(std::ostream& s){ + _eventArray[0]->writeObject(s); + return s; +} + +std::istream& ERC::readObject(std::istream& s){ + _wasPrepared=true; + _eventArray[0]->readObject(s); + return s; +} diff --git a/simulators/c++2/src_simulator/ebrdd/ERC.h b/simulators/c++2/src_simulator/ebrdd/ERC.h index 58daeb2b49..3418b00355 100644 --- a/simulators/c++2/src_simulator/ebrdd/ERC.h +++ b/simulators/c++2/src_simulator/ebrdd/ERC.h @@ -49,20 +49,39 @@ Ludovic Apvrille, Renaud Pacalet class SimComponents; +///EBRDD Command Event Reception Container class ERC: public NotifyIF, public EBRDDCommand, public KernelListener{ public: + ///Constructor + /** + \param iID ID of the ERC + \param iEBRDD Pointer to the subordinate EBRDD + */ ERC(unsigned int iID, EBRDD* iEBRDD); void notifyEvent(unsigned int iID); void notifyAbort(unsigned int iID); + ///Returns a pointer to the subordinate EBRDD + /** + \return Pointer to EBRDD + */ EBRDD* getEBRDD(); void timeAdvances(TMLTime iCurrTime); EBRDDCommand* prepare(); std::string toString() const; + ///Sets the class variable pointing to the simulation objects + /** + \param iSimComp Pointer to the simulation components + */ static void setSimComponents(SimComponents* iSimComp); - void reset(); + virtual std::ostream& writeObject(std::ostream& s); + virtual std::istream& readObject(std::istream& s); + virtual void reset(); protected: + ///Pointer to subordiate EBRDD EBRDD* _ebrdd; + ///Pointer to simulation components static SimComponents* _simComp; + ///Indicates whether the ERC has already been prepared bool _wasPrepared; }; #endif diff --git a/simulators/c++2/src_simulator/ebrdd/ESO.cpp b/simulators/c++2/src_simulator/ebrdd/ESO.cpp index 46f5bd5672..853cf12966 100644 --- a/simulators/c++2/src_simulator/ebrdd/ESO.cpp +++ b/simulators/c++2/src_simulator/ebrdd/ESO.cpp @@ -242,6 +242,32 @@ void ESOSequence::reset(){ _lastEvtToWaitFor=0; } +std::ostream& ESOSequence::writeObject(std::ostream& s){ + ESOIF::writeObject(s); + WRITE_STREAM(s, _nextEvtToWaitFor); +#ifdef DEBUG_SERIALIZE + std::cout << "Write: ESOSequence nextEvtToWaitFor: " << _nextEvtToWaitFor << std::endl; +#endif + WRITE_STREAM(s, _lastEvtToWaitFor); +#ifdef DEBUG_SERIALIZE + std::cout << "Write: ESOSequence lastEvtToWaitFor: " << _lastEvtToWaitFor << std::endl; +#endif + return s; +} + +std::istream& ESOSequence::readObject(std::istream& s){ + ESOIF::readObject(s); + READ_STREAM(s, _nextEvtToWaitFor); +#ifdef DEBUG_SERIALIZE + std::cout << "Read: ESOSequence nextEvtToWaitFor: " << _nextEvtToWaitFor << std::endl; +#endif + READ_STREAM(s, _lastEvtToWaitFor); +#ifdef DEBUG_SERIALIZE + std::cout << "Read: ESOSequence lastEvtToWaitFor: " << _lastEvtToWaitFor << std::endl; +#endif + return s; +} + void ESOSequence::deactivate(){ _active=false; //reset(); diff --git a/simulators/c++2/src_simulator/ebrdd/ESO.h b/simulators/c++2/src_simulator/ebrdd/ESO.h index 33f6739c9c..1f1146f6be 100644 --- a/simulators/c++2/src_simulator/ebrdd/ESO.h +++ b/simulators/c++2/src_simulator/ebrdd/ESO.h @@ -46,13 +46,47 @@ Ludovic Apvrille, Renaud Pacalet //************************************************************************ +///Base class for Event Sequencing operators class ESOIF: public EventIF, public NotifyIF{ public: + ///Constructor + /** + \param iAncestorNode Pointer to ancestor node within the event tree + \param iNegated Event negated flag + \param iNbOfEvents Number of descendant nodes within the event tree + \param iTimeOut ESO time out value + */ ESOIF(NotifyIF* iAncestorNode, bool iNegated, unsigned int iNbOfEvents, TMLTime iTimeOut): EventIF(iAncestorNode, iNegated), NotifyIF(iNbOfEvents), _timeOut(iTimeOut), _startTime(0){} virtual void reset(){ EventIF::reset(); NotifyIF::reset(); } + virtual std::ostream& writeObject(std::ostream& s){ + EventIF::writeObject(s); + WRITE_STREAM(s, _timeOut); +#ifdef DEBUG_SERIALIZE + std::cout << "Write: ESOIF timeOut: " << _timeOut << std::endl; +#endif + WRITE_STREAM(s, _startTime); +#ifdef DEBUG_SERIALIZE + std::cout << "Write: ESOIF startTime: " << _startTime << std::endl; +#endif + NotifyIF::writeObject(s); + return s; +} + virtual std::istream& readObject(std::istream& s){ + EventIF::readObject(s); + READ_STREAM(s, _timeOut); +#ifdef DEBUG_SERIALIZE + std::cout << "Read: ESOIF timeOut: " << _timeOut << std::endl; +#endif + READ_STREAM(s, _startTime); +#ifdef DEBUG_SERIALIZE + std::cout << "Read: ESOIF startTime: " << _startTime << std::endl; +#endif + NotifyIF::readObject(s); + return s; + } virtual void timeTick(TMLTime iNewTime){ //std::cout << "TimeTick ESO: " << iNewTime << std::endl; for (unsigned int i=0; i<_nbOfEvents; i++){ @@ -60,14 +94,25 @@ public: } } protected: + ///Time out value TMLTime _timeOut; + ///Time of operator activation TMLTime _startTime; }; //************************************************************************ +///Conjunction ESO class ESOConjunction: public ESOIF{ public: + ///Constructor + /** + \param iAncestorNode Pointer to ancestor node within the event tree + \param iNegated Event negated flag + \param iNbOfEvents Number of descendant nodes within the event tree + \param iTimeOut ESO time out value + \param iOncePerEvent Indicates whether each event should only be received once + */ ESOConjunction(NotifyIF* iAncestorNode, bool iNegated, unsigned int iNbOfEvents, TMLTime iTimeOut, bool iOncePerEvent); void notifyEvent(unsigned int iID); void notifyAbort(unsigned int iID); @@ -75,13 +120,22 @@ public: void activate(); void deactivate(); protected: + ///Indicates whether each event should only be received once bool _oncePerEvent; }; //************************************************************************ +///Disjunction ESO class ESODisjunction: public ESOIF{ public: + ///Constructor + /** + \param iAncestorNode Pointer to ancestor node within the event tree + \param iNegated Event negated flag + \param iNbOfEvents Number of descendant nodes within the event tree + \param iTimeOut ESO time out value + */ ESODisjunction(NotifyIF* iAncestorNode, bool iNegated, unsigned int iNbOfEvents, TMLTime iTimeOut); void notifyEvent(unsigned int iID); void notifyAbort(unsigned int iID); @@ -92,26 +146,46 @@ public: //************************************************************************ +///Sequence ESO class ESOSequence: public ESOIF{ public: + ///Constructor + /** + \param iAncestorNode Pointer to ancestor node within the event tree + \param iNegated Event negated flag + \param iNbOfEvents Number of descendant nodes within the event tree + \param iTimeOut ESO time out value + */ ESOSequence(NotifyIF* iAncestorNode, bool iNegated, unsigned int iNbOfEvents, TMLTime iTimeOut); void notifyEvent(unsigned int iID); void notifyAbort(unsigned int iID); void timeTick(TMLTime iNewTime); virtual void activate(); - void reset(); virtual void deactivate(); - + void reset(); + virtual std::ostream& writeObject(std::ostream& s); + virtual std::istream& readObject(std::istream& s); protected: + ///Next event in sequence to be received unsigned int _nextEvtToWaitFor; + ///Last event in sequence which was received unsigned int _lastEvtToWaitFor; + ///Determine next event to be received virtual int searchForNextEvt(); }; //************************************************************************ +///Strict sequence ESO class ESOSSequence: public ESOSequence{ public: + ///Constructor + /** + \param iAncestorNode Pointer to ancestor node within the event tree + \param iNegated Event negated flag + \param iNbOfEvents Number of descendant nodes within the event tree + \param iTimeOut ESO time out value + */ ESOSSequence(NotifyIF* iAncestorNode, bool iNegated, unsigned int iNbOfEvents, TMLTime iTimeOut); void activate(); void deactivate(); @@ -121,8 +195,18 @@ protected: //************************************************************************ +///At most ESO class ESOAtMost: public ESOIF{ public: + ///Constructor + /** + \param iAncestorNode Pointer to ancestor node within the event tree + \param iNegated Event negated flag + \param iNbOfEvents Number of descendant nodes within the event tree + \param iTimeOut ESO time out value + \param iOncePerEvent Indicates whether each event should only be received once + \param iN At most iN events should be received + */ ESOAtMost(NotifyIF* iAncestorNode, bool iNegated, unsigned int iNbOfEvents, TMLTime iTimeOut, bool iOncePerEvent, unsigned int iN); void notifyEvent(unsigned int iID); void notifyAbort(unsigned int iID); @@ -130,15 +214,28 @@ public: void activate(); void deactivate(); protected: + ///Indicates whether each event should only be received once bool _oncePerEvent; + ///At most n events should be received unsigned int _n; + ///Checks if operator is completed or if it should be aborted void checkEvents(); }; //************************************************************************ +///At least ESO class ESOAtLeast: public ESOIF{ public: + ///Constructor + /** + \param iAncestorNode Pointer to ancestor node within the event tree + \param iNegated Event negated flag + \param iNbOfEvents Number of descendant nodes within the event tree + \param iTimeOut ESO time out value + \param iOncePerEvent Indicates whether each event should only be received once + \param iN At least iN events should be received + */ ESOAtLeast(NotifyIF* iAncestorNode, bool iNegated, unsigned int iNbOfEvents, TMLTime iTimeOut, bool iOncePerEvent, unsigned int iN); void notifyEvent(unsigned int iID); void notifyAbort(unsigned int iID); @@ -146,8 +243,11 @@ public: void activate(); void deactivate(); protected: + ///Indicates whether each event should only be received once bool _oncePerEvent; + ///At least n events should be received unsigned int _n; + ///Checks if operator is completed or if it should be aborted void checkEvents(); }; diff --git a/simulators/c++2/src_simulator/ebrdd/EventIF.cpp b/simulators/c++2/src_simulator/ebrdd/EventIF.cpp index 9004f52029..73f84af768 100644 --- a/simulators/c++2/src_simulator/ebrdd/EventIF.cpp +++ b/simulators/c++2/src_simulator/ebrdd/EventIF.cpp @@ -73,6 +73,38 @@ void EventIF::reset(){ //std::cout << "End Reset leaf\n"; } +std::ostream& EventIF::writeObject(std::ostream& s){ + WRITE_STREAM(s, _nbOfNotific); +#ifdef DEBUG_SERIALIZE + std::cout << "Write: EventIF nbOfNotific: " << _nbOfNotific << std::endl; +#endif + WRITE_STREAM(s, _aborted); +#ifdef DEBUG_SERIALIZE + std::cout << "Write: EventIF aborted: " << _aborted << std::endl; +#endif + WRITE_STREAM(s, _active); +#ifdef DEBUG_SERIALIZE + std::cout << "Write: EventIF active: " << _active << std::endl; +#endif + return s; +} + +std::istream& EventIF::readObject(std::istream& s){ + READ_STREAM(s, _nbOfNotific); +#ifdef DEBUG_SERIALIZE + std::cout << "Read: EventIF nbOfNotific: " << _nbOfNotific << std::endl; +#endif + READ_STREAM(s, _aborted); +#ifdef DEBUG_SERIALIZE + std::cout << "Read: EventIF aborted: " << _aborted << std::endl; +#endif + READ_STREAM(s, _active); +#ifdef DEBUG_SERIALIZE + std::cout << "Read: EventIF active: " << _active << std::endl; +#endif + return s; +} + bool EventIF::getAborted(){ return _aborted; } diff --git a/simulators/c++2/src_simulator/ebrdd/EventIF.h b/simulators/c++2/src_simulator/ebrdd/EventIF.h index bbfac27d42..ae8b3b2aa2 100644 --- a/simulators/c++2/src_simulator/ebrdd/EventIF.h +++ b/simulators/c++2/src_simulator/ebrdd/EventIF.h @@ -42,28 +42,70 @@ Ludovic Apvrille, Renaud Pacalet #define EventIFH #include <definitions.h> +#include <Serializable.h> class NotifyIF; -class EventIF{ +///Interface class for top down node configuration within event trees of ERCs +class EventIF: public Serializable{ public: + ///Constructor + /** + \param iAncestorNode + \param iNegated + */ EventIF(NotifyIF* iAncestorNode, bool iNegated); + ///Set event ID of this event source + /** + \param iID ID of the node + */ void setEventID(unsigned int iID); + ///Returns whether the event source has already generated an event + /** + \return Returns true if event has already been notified + */ bool notified(); + ///Returns the number of notifications of this event source + /** + \return Number of notifications + */ unsigned int getNbOfNotific(); + ///Returns whether this event source is negated + /** + \return Returns true if this source is negated + */ bool getNegated(); virtual void reset(); + virtual std::ostream& writeObject(std::ostream& s); + virtual std::istream& readObject(std::istream& s); + ///Called to notify an advancement of simulation time + /** + \param iNewTime New simulation time + */ virtual void timeTick(TMLTime iNewTime)=0; + ///Activates the node virtual void activate()=0; + ///Deactivates the node virtual void deactivate()=0; + ///Returns whether this event cannot be raised any more + /** + \return true if even was aborted + */ bool getAborted(); + ///Destructor virtual ~EventIF(); protected: + ///Ancestor node to notify upon event reception NotifyIF* _ancestorNode; + ///Negated flag bool _negated; + ///ID of the node unsigned int _ID; + ///Number of event notifications unsigned int _nbOfNotific; + ///Aborted flag bool _aborted; + ///Active flag bool _active; }; #endif diff --git a/simulators/c++2/src_simulator/ebrdd/NotifyIF.cpp b/simulators/c++2/src_simulator/ebrdd/NotifyIF.cpp index b69cc493b4..b44a983239 100644 --- a/simulators/c++2/src_simulator/ebrdd/NotifyIF.cpp +++ b/simulators/c++2/src_simulator/ebrdd/NotifyIF.cpp @@ -56,6 +56,17 @@ void NotifyIF::reset(){ //std::cout << "after " << std::endl; } } + +std::ostream& NotifyIF::writeObject(std::ostream& s){ + for (unsigned int i=0; i<_nbOfEvents; i++) _eventArray[i]->writeObject(s); + return s; +} + +std::istream& NotifyIF::readObject(std::istream& s){ + for (unsigned int i=0; i<_nbOfEvents; i++) _eventArray[i]->readObject(s); + return s; +} + void NotifyIF::registerEvent(EventIF* iEvent){ _eventArray[_nextID]=iEvent; iEvent->setEventID(_nextID); diff --git a/simulators/c++2/src_simulator/ebrdd/NotifyIF.h b/simulators/c++2/src_simulator/ebrdd/NotifyIF.h index 1ff1a99143..f2cb875adf 100644 --- a/simulators/c++2/src_simulator/ebrdd/NotifyIF.h +++ b/simulators/c++2/src_simulator/ebrdd/NotifyIF.h @@ -42,20 +42,44 @@ Ludovic Apvrille, Renaud Pacalet #define NotifyIFH #include<definitions.h> +#include<Serializable.h> class EventIF; -class NotifyIF{ +///Interface class for bottom up event notification within event trees of ERCs +class NotifyIF: public Serializable{ public: + ///Constructor + /** + \param iNbOfEvents Number of descendants in the event tree + */ NotifyIF(unsigned int iNbOfEvents); + ///Called by event source to signal an event + /** + \param iID ID of the event + */ virtual void notifyEvent(unsigned int iID)=0; + ///Called by event source to signal that an event cannot be received any more + /** + \param iID ID of the event + */ virtual void notifyAbort(unsigned int iID)=0; virtual void reset(); + virtual std::ostream& writeObject(std::ostream& s); + virtual std::istream& readObject(std::istream& s); + ///Registers a new event source (descendant in the event tree) + /** + \param iEvent Pointer to the event source + */ void registerEvent(EventIF* iEvent); + ///Destructor virtual ~NotifyIF(); protected: + ///ID of the node unsigned int _nextID; + ///Number of descendants within the event tree unsigned int _nbOfEvents; + ///Array of descendants within the event tree EventIF** _eventArray; }; #endif diff --git a/simulators/c++2/src_simulator/evt/ChannelListener.h b/simulators/c++2/src_simulator/evt/ChannelListener.h index 8087dbfe19..d531c3ba71 100644 --- a/simulators/c++2/src_simulator/evt/ChannelListener.h +++ b/simulators/c++2/src_simulator/evt/ChannelListener.h @@ -49,17 +49,20 @@ class ChannelListener{ public: ///Gets called when a transaction is executed /** - \param iTrans Pointer to the transaction + \param iTrans Pointer to the transaction + \param iID ID of the event source */ virtual void transExecuted(TMLTransaction* iTrans, unsigned int iID){} ///Gets called when a read transaction is executed /** - \param iTrans Pointer to the transaction + \param iTrans Pointer to the transaction + \param iID ID of the event source */ virtual void readTrans(TMLTransaction* iTrans, unsigned int iID){} ///Gets called when a write transaction is executed /** - \param iTrans Pointer to the transaction + \param iTrans Pointer to the transaction + \param iID ID of the event source */ virtual void writeTrans(TMLTransaction* iTrans, unsigned int iID){} virtual ~ChannelListener(){} diff --git a/simulators/c++2/src_simulator/evt/CommandListener.h b/simulators/c++2/src_simulator/evt/CommandListener.h index 591e11e4e4..8928197727 100644 --- a/simulators/c++2/src_simulator/evt/CommandListener.h +++ b/simulators/c++2/src_simulator/evt/CommandListener.h @@ -52,22 +52,26 @@ class CommandListener{ public: ///Gets called when a command is entered the first time /** - \param iComm Pointer to the command + \param iComm Pointer to the command + \param iID ID of the event source */ virtual void commandEntered(TMLCommand* iComm, unsigned int iID){} ///Gets called when a transaction of the command is executed /** - \param iComm Pointer to the command + \param iComm Pointer to the command + \param iID ID of the event source */ virtual void commandExecuted(TMLCommand* iComm, unsigned int iID){} ///Gets called when a the last transaction of the command is executed /** - \param iComm Pointer to the command + \param iComm Pointer to the command + \param iID ID of the event source */ virtual void commandFinished(TMLCommand* iComm, unsigned int iID){} ///Gets called when a the first transaction of the command is executed /** - \param iComm Pointer to the command + \param iComm Pointer to the command + \param iID ID of the event source */ virtual void commandStarted(TMLCommand* iComm, unsigned int iID){} ///Destructor diff --git a/simulators/c++2/src_simulator/evt/ListenersSimCmd.h b/simulators/c++2/src_simulator/evt/ListenersSimCmd.h index 6a74a5fc3b..3b475e9a3e 100644 --- a/simulators/c++2/src_simulator/evt/ListenersSimCmd.h +++ b/simulators/c++2/src_simulator/evt/ListenersSimCmd.h @@ -76,7 +76,6 @@ public: RunXTransactions(SimComponents* iSimComp, unsigned int iTransToExecute); ///Destructor virtual ~RunXTransactions(); - //void transExecuted(TMLTransaction* iTrans); void transExecuted(TMLTransaction* iTrans, unsigned int iID); ///Sets the number of transactions to execute /** @@ -229,7 +228,6 @@ public: RunXTimeUnits(SimComponents* iSimComp, TMLTime iEndTime); ///Destructor virtual ~RunXTimeUnits(); - //void transExecuted(TMLTransaction* iTrans); void transExecuted(TMLTransaction* iTrans, unsigned int iID); ///Sets the end time of the simulation /** @@ -257,7 +255,6 @@ public: RunTillTransOnDevice(SimComponents* iSimComp, ListenerSubject<TransactionListener>* iSubject); ///Destructor virtual ~RunTillTransOnDevice(); - //void transExecuted(TMLTransaction* iTrans); void transExecuted(TMLTransaction* iTrans, unsigned int iID); protected: ///Pointer to a SimComponents object @@ -279,7 +276,6 @@ public: RunTillTransOnTask(SimComponents* iSimComp, ListenerSubject<TaskListener>* iSubject); ///Destructor virtual ~RunTillTransOnTask(); - //void transExecuted(TMLTransaction* iTrans); void transExecuted(TMLTransaction* iTrans, unsigned int iID); protected: ///Pointer to a SimComponents object @@ -301,7 +297,6 @@ public: RunTillTransOnChannel(SimComponents* iSimComp, ListenerSubject<ChannelListener>* iSubject); ///Destructor virtual ~RunTillTransOnChannel(); - //void transExecuted(TMLTransaction* iTrans); void transExecuted(TMLTransaction* iTrans, unsigned int iID); protected: ///Pointer to a SimComponents object @@ -314,8 +309,7 @@ protected: //************************************************************************ /*class TestListener: public TaskListener, public ChannelListener, public CommandListener{ public: - /////Constructor - ///** + //Constructor //\param iSimComp Pointer to a SimComponents object // TestListener(SimComponents* iSimComp); @@ -334,7 +328,7 @@ protected: }; -//************************************************************************ +************************************************************************ class ConstraintBlock: public TransactionListener{ ConstraintBlock(SimComponents* iSimComp); ~ConstraintBlock(); diff --git a/simulators/c++2/src_simulator/evt/TaskListener.h b/simulators/c++2/src_simulator/evt/TaskListener.h index 27faf3b76d..a9be3a5a04 100644 --- a/simulators/c++2/src_simulator/evt/TaskListener.h +++ b/simulators/c++2/src_simulator/evt/TaskListener.h @@ -51,18 +51,21 @@ class TaskListener{ public: ///Gets called when a task executes its first transaction /** - \param iTrans Pointer to the transaction + \param iTrans Pointer to the transaction + \param iID ID of the event source */ virtual void taskStarted(TMLTransaction* iTrans, unsigned int iID){} ///Gets called when a task executes its last transaction /** - \param iTrans Pointer to the transaction + \param iTrans Pointer to the transaction + \param iID ID of the event source */ virtual void taskFinished(TMLTransaction* iTrans, unsigned int iID){} ///Destructor ///Gets called when a transaction is executed /** - \param iTrans Pointer to the transaction + \param iTrans Pointer to the transaction + \param iID ID of the event source */ virtual void transExecuted(TMLTransaction* iTrans, unsigned int iID){} virtual ~TaskListener(){} diff --git a/simulators/c++2/src_simulator/evt/TransactionListener.h b/simulators/c++2/src_simulator/evt/TransactionListener.h index 6d05d77ec9..51066bc578 100644 --- a/simulators/c++2/src_simulator/evt/TransactionListener.h +++ b/simulators/c++2/src_simulator/evt/TransactionListener.h @@ -48,7 +48,8 @@ class TransactionListener{ public: ///Gets called when a transaction is executed /** - \param iTrans Pointer to the transaction + \param iTrans Pointer to the transaction + \param iID ID of the event source */ virtual void transExecuted(TMLTransaction* iTrans, unsigned int iID){} /////Gets called when a transaction is scheduled diff --git a/simulators/c++2/src_simulator/sim/Server.cpp b/simulators/c++2/src_simulator/sim/Server.cpp index 00d68c8d09..1828dfab6f 100644 --- a/simulators/c++2/src_simulator/sim/Server.cpp +++ b/simulators/c++2/src_simulator/sim/Server.cpp @@ -74,7 +74,7 @@ int Server::run(){ int yes=1; if (setsockopt(aSocketServer, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1) { perror("setsockopt"); - exit(1); + return 1; } //bind socket to a specific port of the server: bind(filedescriptor, address data structure, addresslen) if (bind(aSocketServer, p->ai_addr, p->ai_addrlen) == -1) { @@ -87,7 +87,7 @@ int Server::run(){ if (p == NULL){ std::cerr << "server: failed to bind\n"; - exit(1); + return 1; } freeaddrinfo(aServerInfo); @@ -96,7 +96,7 @@ int Server::run(){ //causes the socket to listen to incoming connections: listen(filedescriptor, number of connections) if (listen(aSocketServer, BACKLOG) == -1) { perror("listen"); - exit(1); + return 1; } std::cout << "server: waiting for connections...\n"; @@ -191,6 +191,7 @@ int Server::run(){ std::cout << "Socket client closed" << std::endl; close(aSocketServer); std::cout << "Socket server closed" << std::endl; + return 0; } int Server::getPositionOf(char* iBuffer, char searchCh, int iStart, int iLength){ diff --git a/simulators/c++2/src_simulator/sim/ServerLocal.cpp b/simulators/c++2/src_simulator/sim/ServerLocal.cpp index 0a52508742..b1bf9a6de0 100644 --- a/simulators/c++2/src_simulator/sim/ServerLocal.cpp +++ b/simulators/c++2/src_simulator/sim/ServerLocal.cpp @@ -66,6 +66,7 @@ int ServerLocal::run(){ std::cout << "Command file could not be opened" << std::endl; executeCmd(aEnd); } + return 0; } void ServerLocal::sendReply(std::string iReplyStr){ diff --git a/simulators/c++2/src_simulator/sim/SimComponents.cpp b/simulators/c++2/src_simulator/sim/SimComponents.cpp index ebb59f0398..beeb35ccfa 100644 --- a/simulators/c++2/src_simulator/sim/SimComponents.cpp +++ b/simulators/c++2/src_simulator/sim/SimComponents.cpp @@ -124,28 +124,42 @@ void SimComponents::streamBenchmarks(std::ostream& s) const{ } std::ostream& SimComponents::writeObject(std::ostream& s){ +#ifdef DEBUG_SERIALIZE std::cout << "WRITE ----------------------------------------------------\n"; +#endif for(SerializableList::const_iterator i=_serList.begin(); i != _serList.end(); ++i){ (*i)->writeObject(s); } + for(EBRDDList::const_iterator i=_ebrddList.begin(); i != _ebrddList.end(); ++i){ + (*i)->writeObject(s); + } TMLTime aSimulatedTime = SchedulableDevice::getSimulatedTime(); WRITE_STREAM(s, aSimulatedTime); +#ifdef DEBUG_SERIALIZE std::cout << "Write: SimComponents simulatedTime: " << aSimulatedTime << std::endl; std::cout << "----------------------------------------------------\n"; +#endif return s; } std::istream& SimComponents::readObject(std::istream& s){ +#ifdef DEBUG_SERIALIZE std::cout << "READ ----------------------------------------------------\n"; +#endif for(SerializableList::const_iterator i=_serList.begin(); i != _serList.end(); ++i){ //std::cout << "SimComponents --> next Device" << std::endl; (*i)->readObject(s); } + for(EBRDDList::const_iterator i=_ebrddList.begin(); i != _ebrddList.end(); ++i){ + (*i)->readObject(s); + } TMLTime aSimulatedTime; READ_STREAM(s, aSimulatedTime); SchedulableDevice::setSimulatedTime(aSimulatedTime); +#ifdef DEBUG_SERIALIZE std::cout << "Read: SimComponents simulatedTime: " << aSimulatedTime << std::endl; std::cout << "----------------------------------------------------\n"; +#endif return s; } @@ -303,4 +317,4 @@ void SimComponents::setStopFlag(bool iStopFlag, const std::string& iStopReason){ _stoppedOnAction=false; std::cout << "_stoppedOnAction=false\n"; } -} \ No newline at end of file +} diff --git a/simulators/c++2/src_simulator/sim/Simulator.cpp b/simulators/c++2/src_simulator/sim/Simulator.cpp index 8364598973..b297304975 100644 --- a/simulators/c++2/src_simulator/sim/Simulator.cpp +++ b/simulators/c++2/src_simulator/sim/Simulator.cpp @@ -182,7 +182,7 @@ void Simulator::schedule2VCD(std::string& iTraceFileName) const{ std::string aSigString; bool aNoMoreTrans; TraceableDevice* actDevice; - TMLTime aTime, aCurrTime=-1; + TMLTime aTime=0, aCurrTime=-1; SignalChangeData* aTopElement; unsigned int aNextClockEvent=0; myfile << "$date\n" << asctime(aTimeinfo) << "$end\n\n$version\nDaniels TML simulator\n$end\n\n"; @@ -499,17 +499,22 @@ void Simulator::decodeCommand(std::string iCmd){ _simTerm=runXTimeUnits(aParam2, oLastTrans); std::cout << "End Run for x time units." << std::endl; break; - case 7: //Explore Tree + case 7: {//Explore Tree //for (int i=0; i<RECUR_DEPTH; i++) leafsForLevel[i]=0; std::cout << "Explore tree." << std::endl; _leafsID=0; - exploreTree(0,0); + std::ofstream myfile ("tree"); + if (myfile.is_open()){ + exploreTree(0, 0, myfile); + myfile.close(); + } aGlobMsg << TAG_MSGo << "Tree was explored" << TAG_MSGc << std::endl; _simTerm=true; //aGlobMsg << TAG_MSGo << MSG_CMDNIMPL << TAG_MSGc << std::endl; //anErrorCode=1; std::cout << "End Explore tree." << std::endl; break; + } case 8:{//Run to next transfer on bus x std::cout << "Run to next transfer on bus x." << std::endl; aInpStream >> aStrParam; @@ -1067,11 +1072,13 @@ bool Simulator::runUntilCondition(std::string& iCond, TMLTask* iTask, TMLTransac 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]++; - //std::string aFileStr(aFileName.str()); - //schedule2TXT(aFileStr); +void Simulator::exploreTree(unsigned int iDepth, unsigned int iPrevID, std::ofstream& iFile){ +/*std::ofstream myfile (iTraceFileName.c_str()); + if (myfile.is_open()){ + for(SchedulingList::const_iterator i=_simComp->getCPUIterator(false); i != _simComp->getCPUIterator(true); ++i){ + (*i)->schedule2TXT(myfile); + } + myfile.close();*/ TMLTransaction* aLastTrans; if (iDepth<RECUR_DEPTH){ unsigned int aMyID= ++_leafsID; @@ -1081,16 +1088,21 @@ void Simulator::exploreTree(unsigned int iDepth, unsigned int iPrevID){ aSimTerminated=runToNextBreakpoint(aLastTrans); aChoiceCmd=_simComp->getCurrentChoiceCmd(); }while (!aSimTerminated && aChoiceCmd==0); - //std::ostringstream aFileName; - std::stringstream aStreamBuffer; //aStreamBuffer << "sched" << iDepth << "." << leafsForLevel[iDepth]++; - aStreamBuffer << "edge_" << iPrevID << "_" << aMyID; - std::string aStringBuffer(aStreamBuffer.str()); - schedule2TXT(aStringBuffer); - aStreamBuffer.str(""); + //aStreamBuffer << "edge_" << iPrevID << "_" << aMyID; + //std::string aStringBuffer(aStreamBuffer.str()); + //schedule2TXT(aStringBuffer); + iFile << "***** edge_" << iPrevID << "_" << aMyID << " *****\n"; + for(SchedulingList::const_iterator i=_simComp->getCPUIterator(false); i != _simComp->getCPUIterator(true); ++i){ + (*i)->schedule2TXT(iFile); + } + iFile << "\n"; + //aStreamBuffer.str(""); //if (!aSimTerminated){ if(aChoiceCmd!=0){ unsigned int aNbNextCmds; + std::stringstream aStreamBuffer; + std::string aStringBuffer; aChoiceCmd->getNextCommands(aNbNextCmds); std::cout << "Simulation " << iPrevID << "_" << aMyID << "continued " << aNbNextCmds << std::endl; _simComp->writeObject(aStreamBuffer); @@ -1100,7 +1112,7 @@ void Simulator::exploreTree(unsigned int iDepth, unsigned int iPrevID){ aStreamBuffer.str(aStringBuffer); _simComp->readObject(aStreamBuffer); aChoiceCmd->setPreferredBranch(aBranch); - exploreTree(iDepth+1,aMyID); + exploreTree(iDepth+1, aMyID, iFile); //_simComp->reset(); //_simComp->readObject(aBuffer); } diff --git a/simulators/c++2/src_simulator/sim/Simulator.h b/simulators/c++2/src_simulator/sim/Simulator.h index abd65db8d1..3a370c3118 100644 --- a/simulators/c++2/src_simulator/sim/Simulator.h +++ b/simulators/c++2/src_simulator/sim/Simulator.h @@ -192,6 +192,7 @@ public: \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 + \param oSuccess Indicates whether the condition could be compiled and is valid \return Return value of simulate() function */ bool runUntilCondition(std::string& iCond, TMLTask* iTask, TMLTransaction*& oLastTrans, bool& oSuccess); @@ -199,9 +200,9 @@ public: /** \param iDepth Maximal recursion depth \param iPrevID ID of the parent leaf - \param oSuccess True is returned if the condition was compiled successfully + \param iFile Reference to the output file */ - void exploreTree(unsigned int iDepth, unsigned int iPrevID); + void exploreTree(unsigned int iDepth, unsigned int iPrevID, std::ofstream& iFile); ///Writes a HTML representation of the schedule of CPUs and buses to an output file void schedule2HTML(std::string& iTraceFileName) const; ///Writes simulation traces in VCD format to an output file @@ -210,9 +211,6 @@ public: */ void schedule2VCD(std::string& iTraceFileName) const; ///Writes the simulation graph to an output file - /** - \param iTraceFileName Name of the output trace file - */ void schedule2Graph() const; ///Writes a plain text representation of the schedule of CPUs to an output file /** -- GitLab