From f43c7d9448c969aa1e247274549ea51be6f4f08a Mon Sep 17 00:00:00 2001 From: Ludovic Apvrille <ludovic.apvrille@telecom-paristech.fr> Date: Fri, 9 Jan 2009 13:09:59 +0000 Subject: [PATCH] NC update with parameters; new simulator version (c++) --- simulators/c++2/src_simulator/Bridge.cpp | 145 ++++++++++++++++++ simulators/c++2/src_simulator/Bridge.h | 101 ++++++++++++ simulators/c++2/src_simulator/Master.h | 83 ++++++++++ simulators/c++2/src_simulator/Memory.cpp | 54 +++++++ simulators/c++2/src_simulator/Memory.h | 81 ++++++++++ .../src_simulator/SchedulableCommDevice.h | 62 ++++++++ simulators/c++2/src_simulator/Serializable.h | 61 ++++++++ simulators/c++2/src_simulator/Slave.h | 64 ++++++++ src/nc/NCPath.java | 11 ++ src/nc/NCStructure.java | 2 +- src/nc/NCTraffic.java | 5 +- src/ui/GNCModeling.java | 56 ++++++- src/ui/ncdd/NCConnectorNode.java | 8 +- src/ui/ncdd/NCRouteArtifact.java | 2 +- src/ui/window/JDialogNCRoute.java | 2 +- 15 files changed, 726 insertions(+), 11 deletions(-) create mode 100644 simulators/c++2/src_simulator/Bridge.cpp create mode 100644 simulators/c++2/src_simulator/Bridge.h create mode 100644 simulators/c++2/src_simulator/Master.h create mode 100644 simulators/c++2/src_simulator/Memory.cpp create mode 100644 simulators/c++2/src_simulator/Memory.h create mode 100644 simulators/c++2/src_simulator/SchedulableCommDevice.h create mode 100644 simulators/c++2/src_simulator/Serializable.h create mode 100644 simulators/c++2/src_simulator/Slave.h diff --git a/simulators/c++2/src_simulator/Bridge.cpp b/simulators/c++2/src_simulator/Bridge.cpp new file mode 100644 index 0000000000..9c583f26ab --- /dev/null +++ b/simulators/c++2/src_simulator/Bridge.cpp @@ -0,0 +1,145 @@ +/*Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Daniel Knorreck, +Ludovic Apvrille, Renaud Pacalet + * + * ludovic.apvrille AT telecom-paristech.fr + * + * This software is a computer program whose purpose is to allow the + * edition of TURTLE analysis, design and deployment diagrams, to + * allow the generation of RT-LOTOS or Java code from this diagram, + * and at last to allow the analysis of formal validation traces + * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP + * from INRIA Rhone-Alpes. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + * + */ + +#include <Bridge.h> +#include <SchedulableCommDevice.h> +#include <TMLChannel.h> +#include <TMLTransaction.h> +#include <TMLCommand.h> + +Bridge::Bridge(std::string iName, TMLTime iTimePerCycle, unsigned int iBufferSize):_name(iName), _timePerCycle(iTimePerCycle), _bufferSize(iBufferSize){ +} + +void Bridge::CalcTransactionLength(TMLTransaction* iTrans){ +} + +//TMLTransaction* Bridge::getNextBusTransaction(SchedulableCommDevice* iBus) const{ +// return 0; +//} + +Master* Bridge::getConnectedMaster(){ + return (Master*)this; +} + +Bridge::~Bridge(){ + //BridgeTransactionListHash::iterator i; + //for(i=_transListHash.begin(); i != _transListHash.end(); ++i){ + // delete i->second; + //} +} + +//void ForwardTransactionToMaster(TMLTransaction* iTrans){ + //registerTransaction(aNewTrans); +//} + +//Belongs to Master Interface +//TMLTransaction* Bridge::getNextBusTransaction(SchedulableCommDevice* iBus) const{ + //use hash table to find all transactions for the bus which is polling + //return transaction which is runnable first + /*if (_schedulingNeeded) schedule(); + FutureTransactionQueue* aTransQueue = _transListHash[iBus]; + if (aTransQueue==0) return 0; + return aTransQueue->top();*/ +//} + +//void Bridge::schedule(){ + //call getNextTransaction on all buses to which a transaction has been forwarded + //look up in transaction list of the given bus if returned transaction == transaction which finishes first + //select transaction which finishes first _nextTransaction + /*BridgeTransactionListHash::iterator i; + SchedulableCommDevice* aTempBus; + TMLTransaction* aTempTransaction; + TMLTime aRunnableTime=-1; + _nextBus=0; + for(i=_transListHash.begin(); i != _transListHash.end(); ++i){ + aTempBus = i->first; + aTempTransaction = i->second->top(); + if (aTempTransaction == aTempBus->getNextTransaction() && aTempTransaction->getRunnableTime() < aRunnableTime){ + aRunnableTime = aTempTransaction->getRunnableTime(); + _nextBus = aTempBus; + } + } + _schedulingNeeded=false;*/ +//} + +//void Bridge::addTransaction(){ + //delete transaction from hash table + //FutureTransactionQueue* aTransQueue = _transListHash[_nextBus]; + //if (aTransQueue!=0) aTransQueue->pop(); +//} + +//TMLTransaction* Bridge::getNextTransaction(){ + //return next transaction + //if (_schedulingNeeded) schedule(); + //FutureTransactionQueue* aTransQueue = _transListHash[_nextBus]; + //if (aTransQueue==0) return 0; + //return aTransQueue->top(); +//} + +//void Bridge::registerTransaction(TMLTransaction* iTrans){ +//void Bridge::registerTransaction(TMLTransaction* iTrans, Master* iSourceDevice){ + /*SchedulableCommDevice* aNextBus; + TMLChannel* aChannel = iTrans->getChannel(); + if (iTrans->getCommand()->getTask() == aChannel->getBlockedWriteTask()){ + //write transaction + aNextBus = aChannel->getBus(iTrans->getHop()); + + }else{ + //read transaction + aNextBus = aChannel->getBus(aChannel->getNumberOfHops()-iTrans->getHop()-1); + } + // add Transaction to HashTable (based on destination bus) + FutureTransactionQueue* aTransQueue = _transListHash[aNextBus]; + if (aTransQueue==0){ + aTransQueue = new FutureTransactionQueue(); + _transListHash[aNextBus] = aTransQueue; + } + + aTransQueue->push(aNewTrans); + aNextBus->registerTransaction(aNewTrans); + _schedulingNeeded=true; + }*/ +//} + +//void Bridge::schedule2HTML(std::ofstream& myfile){ +//} + +//void Bridge::schedule2TXT(std::ofstream& myfile){ +//} diff --git a/simulators/c++2/src_simulator/Bridge.h b/simulators/c++2/src_simulator/Bridge.h new file mode 100644 index 0000000000..32b8c752cf --- /dev/null +++ b/simulators/c++2/src_simulator/Bridge.h @@ -0,0 +1,101 @@ +/*Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Daniel Knorreck, +Ludovic Apvrille, Renaud Pacalet + * + * ludovic.apvrille AT telecom-paristech.fr + * + * This software is a computer program whose purpose is to allow the + * edition of TURTLE analysis, design and deployment diagrams, to + * allow the generation of RT-LOTOS or Java code from this diagram, + * and at last to allow the analysis of formal validation traces + * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP + * from INRIA Rhone-Alpes. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + * + */ + +#ifndef BridgeH +#define BridgeH + +#include <Slave.h> +#include <Master.h> +#include <SchedulableDevice.h> +#include <definitions.h> + +class TMLTransaction; + +///Bridge component +class Bridge: public Slave, public Master{ +public: + ///Constructor + /** + \param iName Name of the bridge + \param iTimePerCycle 1/Bridge frequency + \param iBufferSize Buffer size + */ + Bridge(std::string iName, TMLTime iTimePerCycle, unsigned int iBufferSize); + ///Accounts for the delay caused by the bridge + /** + \param iTrans Pointer to the transaction to be processed + */ + void CalcTransactionLength(TMLTransaction* iTrans); + ///Returns a pointer to the connected master device if any + /** + \return Pointer to the master device + */ + Master* getConnectedMaster(); + //void schedule(); + //void addTransaction(); + //TMLTransaction* getNextTransaction(); + /////Returns the current transaction if it needs to access the given bus + ////** + //\param iBus Pointer to the bus + //\return Pointer to the transaction + //*/ + //TMLTransaction* getNextBusTransaction(SchedulableCommDevice* iBus) const; + //TMLTransaction* getScheduleResult() const; + //void registerTransaction(TMLTransaction* iTrans); + //void registerTransaction(TMLTransaction* iTrans, Master* iSourceDevice); + //void ForwardTransactionToMaster(TMLTransaction* iTrans); + //void schedule2HTML(std::ofstream& myfile); + //void schedule2TXT(std::ofstream& myfile); + ///Destructor + ~Bridge(); +protected: + ///Name of the bridge + std::string _name; + ///1/Bridge frequency + TMLTime _timePerCycle; + ///Buffer size + unsigned int _bufferSize; + //mutable BridgeTransactionListHash _transListHash; + //SchedulableCommDevice* _nextBus; + ////Dirty flag of the current scheduling decision + //bool schedulingNeeded; +}; + +#endif diff --git a/simulators/c++2/src_simulator/Master.h b/simulators/c++2/src_simulator/Master.h new file mode 100644 index 0000000000..eb3451239a --- /dev/null +++ b/simulators/c++2/src_simulator/Master.h @@ -0,0 +1,83 @@ +/*Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Daniel Knorreck, +Ludovic Apvrille, Renaud Pacalet + * + * ludovic.apvrille AT telecom-paristech.fr + * + * This software is a computer program whose purpose is to allow the + * edition of TURTLE analysis, design and deployment diagrams, to + * allow the generation of RT-LOTOS or Java code from this diagram, + * and at last to allow the analysis of formal validation traces + * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP + * from INRIA Rhone-Alpes. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + * + */ + +#ifndef MasterH +#define MasterH + +#include <definitions.h> + +class TMLTransaction; +class SchedulableCommDevice; + +///Base class for Bus masters +class Master{ +public: + ///Constructor + Master(){} + ///Retrieves the priority of the master for the given bus + /** + \param iDevice + \return Bus priority + */ + unsigned int getBusPriority(SchedulableCommDevice* iDevice){ + return _masterPrioHashTab[iDevice]; + } + ///Sets the priority of the master for a given bus + /** + \param iDevice Pointer to the bus + \param iPrio Priority + */ + void addBusPriority(SchedulableCommDevice* iDevice, unsigned int iPrio){ + _masterPrioHashTab[iDevice]=iPrio; + } + /////Returns the current transaction if it needs to access the given bus + ////** + //\param iBus Pointer to the bus + //\return Pointer to the transaction + //*/ + //TMLTransaction* getNextBusTransaction(SchedulableCommDevice* iBus) const; + ///Destructor + virtual ~Master(){} +protected: + ///Map which associates the bus and the priority + MasterPriorityHashTab _masterPrioHashTab; +}; + +#endif diff --git a/simulators/c++2/src_simulator/Memory.cpp b/simulators/c++2/src_simulator/Memory.cpp new file mode 100644 index 0000000000..c0b45816b9 --- /dev/null +++ b/simulators/c++2/src_simulator/Memory.cpp @@ -0,0 +1,54 @@ +/*Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Daniel Knorreck, +Ludovic Apvrille, Renaud Pacalet + * + * ludovic.apvrille AT telecom-paristech.fr + * + * This software is a computer program whose purpose is to allow the + * edition of TURTLE analysis, design and deployment diagrams, to + * allow the generation of RT-LOTOS or Java code from this diagram, + * and at last to allow the analysis of formal validation traces + * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP + * from INRIA Rhone-Alpes. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + * + */ + +#include <Memory.h> + +Memory::Memory(std::string iName, TMLTime iTimePerCycle, unsigned int iDataSize): _name(iName), _timePerCycle(iTimePerCycle), _dataSize(iDataSize){ +} + +void Memory::CalcTransactionLength(TMLTransaction* iTrans){ +} + +Master* Memory::getConnectedMaster(){ + return 0; +} + +Memory::~Memory(){ +} diff --git a/simulators/c++2/src_simulator/Memory.h b/simulators/c++2/src_simulator/Memory.h new file mode 100644 index 0000000000..1468600a01 --- /dev/null +++ b/simulators/c++2/src_simulator/Memory.h @@ -0,0 +1,81 @@ +/*Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Daniel Knorreck, +Ludovic Apvrille, Renaud Pacalet + * + * ludovic.apvrille AT telecom-paristech.fr + * + * This software is a computer program whose purpose is to allow the + * edition of TURTLE analysis, design and deployment diagrams, to + * allow the generation of RT-LOTOS or Java code from this diagram, + * and at last to allow the analysis of formal validation traces + * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP + * from INRIA Rhone-Alpes. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + * + */ + +#ifndef MemoryH +#define MemoryH + +class TMLTransaction; + +#include <Slave.h> +#include <definitions.h> + +///Memory component +class Memory: public Slave{ +public: + ///Constructor + /** + \param iName Name of the Memory + \param iTimePerCycle 1/Memory frequency + \param iDataSize Width of a data word + */ + Memory(std::string iName, TMLTime iTimePerCycle, unsigned int iDataSize); + ///Accounts for the delay caused by the memory + /** + \param iTrans Pointer to the transaction to be processed + */ + void CalcTransactionLength(TMLTransaction* iTrans); + ///Returns a pointer to the connected master device if any + /** + \return Pointer to the master device + */ + Master* getConnectedMaster(); + ///Destructor + ~Memory(); + +protected: + ///Name of the memory + std::string _name; + ///1/Memory frequency + TMLTime _timePerCycle; + ///Width of a data word + unsigned int _dataSize; +}; + +#endif diff --git a/simulators/c++2/src_simulator/SchedulableCommDevice.h b/simulators/c++2/src_simulator/SchedulableCommDevice.h new file mode 100644 index 0000000000..9f9bbef044 --- /dev/null +++ b/simulators/c++2/src_simulator/SchedulableCommDevice.h @@ -0,0 +1,62 @@ +/*Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Daniel Knorreck, +Ludovic Apvrille, Renaud Pacalet + * + * ludovic.apvrille AT telecom-paristech.fr + * + * This software is a computer program whose purpose is to allow the + * edition of TURTLE analysis, design and deployment diagrams, to + * allow the generation of RT-LOTOS or Java code from this diagram, + * and at last to allow the analysis of formal validation traces + * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP + * from INRIA Rhone-Alpes. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + * + */ + +#ifndef SchedulableCommDeviceH +#define SchedulableCommDeviceH + +#include <SchedulableDevice.h> + +class TMLTransaction; + +///Base class for communication devices which perform a scheduling +class SchedulableCommDevice: public SchedulableDevice{ +public: + ///Returns the size of an atomic bus transaction + /** + \return Size of an atomic bus transaction + */ + 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; + ///Destructor + virtual ~SchedulableCommDevice(){} +}; + +#endif diff --git a/simulators/c++2/src_simulator/Serializable.h b/simulators/c++2/src_simulator/Serializable.h new file mode 100644 index 0000000000..c8a5413eef --- /dev/null +++ b/simulators/c++2/src_simulator/Serializable.h @@ -0,0 +1,61 @@ +/*Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Daniel Knorreck, +Ludovic Apvrille, Renaud Pacalet + * + * ludovic.apvrille AT telecom-paristech.fr + * + * This software is a computer program whose purpose is to allow the + * edition of TURTLE analysis, design and deployment diagrams, to + * allow the generation of RT-LOTOS or Java code from this diagram, + * and at last to allow the analysis of formal validation traces + * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP + * from INRIA Rhone-Alpes. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + * + */ + +#ifndef SerializableH +#define SerializableH +///Interface prividing the basic means to serialize and deserialize objects +class Serializable{ +public: + ///Serializes the object + /** + \param s Reference to an instance of an output stream + \return A reference to the same output stream + */ + virtual std::ostream& writeObject(std::ostream& s) = 0; + ///Deserializes the object + /** + \param s Reference to an instance of an input stream + \return A reference to the same input stream + */ + virtual std::istream& readObject(std::istream& s) = 0; + ///Destructor + virtual ~Serializable(){} +}; +#endif diff --git a/simulators/c++2/src_simulator/Slave.h b/simulators/c++2/src_simulator/Slave.h new file mode 100644 index 0000000000..79d2d3b12b --- /dev/null +++ b/simulators/c++2/src_simulator/Slave.h @@ -0,0 +1,64 @@ +/*Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Daniel Knorreck, +Ludovic Apvrille, Renaud Pacalet + * + * ludovic.apvrille AT telecom-paristech.fr + * + * This software is a computer program whose purpose is to allow the + * edition of TURTLE analysis, design and deployment diagrams, to + * allow the generation of RT-LOTOS or Java code from this diagram, + * and at last to allow the analysis of formal validation traces + * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP + * from INRIA Rhone-Alpes. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + * + */ + +#ifndef SlaveH +#define SlaveH + +class Master; +class TMLTransaction; + +///Base class for Bus slaves +class Slave{ +public: + ///Calculates the time it takes to process the transaction within the slave node + /** + \param iTrans Pointer to the transaction to process + */ + virtual void CalcTransactionLength(TMLTransaction* iTrans)=0; + ///Returns a pointer to the connected master device if any + /** + \return Pointer to the master device + */ + virtual Master* getConnectedMaster()=0; + ///Destructor + virtual ~Slave(){} +}; + +#endif diff --git a/src/nc/NCPath.java b/src/nc/NCPath.java index 49c4a6f5ec..70b7765c1f 100755 --- a/src/nc/NCPath.java +++ b/src/nc/NCPath.java @@ -56,4 +56,15 @@ public class NCPath extends NCElement { public NCPath() { switches = new ArrayList<NCSwitch>(); } + + public Object clone() { + NCPath path = new NCPath(); + path.origin = origin; + path.destination = destination; + path.traffic = traffic; + for(NCSwitch sw: switches) { + path.switches.add(sw); + } + return path; + } } \ No newline at end of file diff --git a/src/nc/NCStructure.java b/src/nc/NCStructure.java index 3d445eec9b..c98eb995ab 100755 --- a/src/nc/NCStructure.java +++ b/src/nc/NCStructure.java @@ -78,7 +78,7 @@ public class NCStructure extends NCElement { return null; } - public NCLinkedElement getNCEquipmentByName(String _name) { + public NCEquipment getNCEquipmentByName(String _name) { for(NCEquipment eq: equipments) { if (eq.getName().equals(_name)) { return eq; diff --git a/src/nc/NCTraffic.java b/src/nc/NCTraffic.java index d9cea2d4ff..3638532828 100755 --- a/src/nc/NCTraffic.java +++ b/src/nc/NCTraffic.java @@ -114,16 +114,17 @@ public class NCTraffic extends NCElement { return priority; } - public Object clone() { + public NCTraffic cloneTraffic() { NCTraffic traffic = new NCTraffic(); NCTimeUnit unit = new NCTimeUnit(); unit.setUnit(deadlineUnit.getStringUnit()); - traffic.setDeadlineUnit(unit); traffic.setPeriodicType(periodicType); traffic.setDeadline(deadline); traffic.setMinPacketSize(minPacketSize); traffic.setMaxPacketSize(maxPacketSize); traffic.setPriority(priority); + traffic.setDeadlineUnit(unit); + //System.out.println("Traffic unit=" + traffic.getDeadlineUnit().getStringUnit()); return traffic; } } \ No newline at end of file diff --git a/src/ui/GNCModeling.java b/src/ui/GNCModeling.java index d809e52549..7d4864368f 100755 --- a/src/ui/GNCModeling.java +++ b/src/ui/GNCModeling.java @@ -537,7 +537,7 @@ public class GNCModeling { ce = new CheckingError(CheckingError.STRUCTURE_ERROR, "No possible route for traffic " + arti.getValue() + " on switch " + sw.getNodeName() + " (ignoring trafic)"); ce.setTDiagramPanel(ncdp); ce.setTGComponent(sw); - checkingErrors.add(ce); + warnings.add(ce); return -1; } @@ -661,6 +661,7 @@ public class GNCModeling { NCTraffic tr1; NCPath path1; NCLink link1, link2, link11, link22; + //NCPath path1; //ArrayList<NCEquipment> newEquipments = new ArrayList<NCEquipment>(); ArrayList<NCTraffic> newTraffics = new ArrayList<NCTraffic>(); @@ -717,6 +718,7 @@ public class GNCModeling { } else { link11.setLinkedElement2(nceq1); } + link11.setName(link1.getName() + "__" + i); ncs.links.add(link11); } oldEquipments.add(path.origin); @@ -736,6 +738,7 @@ public class GNCModeling { } else { link22.setLinkedElement2(nceq2); } + link22.setName(link2.getName() + "__" + i); ncs.links.add(link22); } oldEquipments.add(path.destination); @@ -746,10 +749,30 @@ public class GNCModeling { oldPaths.add(path); oldTraffics.add(path.traffic); for(i=0; i<parameter1; i++) { - tr1 = (NCTraffic)(path.traffic.clone()); + tr1 = path.traffic.cloneTraffic(); tr1.setName(path.traffic.getName() + "__" + i); + //System.out.println("Traffic " + tr1.getName() + " unit after=" + tr1.getDeadlineUnit().getStringUnit()); ncs.traffics.add(tr1); } + + for(i=0; i<parameter1; i++) { + path1 = (NCPath)(path.clone()); + path1.setName("path" + PATH_INDEX); + PATH_INDEX++; + tr1 = ncs.getTrafficByName(path.traffic.getName() + "__" + i); + if (tr1 != null) { + path1.traffic = tr1; + nceq1 = ncs.getNCEquipmentByName(path.origin.getName() + "__" + i); + nceq2 = ncs.getNCEquipmentByName(path.destination.getName() + "__" + i); + if ((nceq1 != null) && (nceq2 != null)) { + path1.origin = nceq1; + path1.destination = nceq2; + newPaths.add(path1); + } else { + System.out.println("null"); + } + } + } } } } @@ -757,6 +780,35 @@ public class GNCModeling { } } } + + // Add new paths + for(NCPath path: newPaths) { + ncs.paths.add(path); + } + + // Remove all elements in oldTraffic , oldEquipments and oldLinks from ncs + for(NCTraffic tr: oldTraffics) { + ncs.traffics.remove(tr); + } + + for(NCEquipment eq: oldEquipments) { + ncs.equipments.remove(eq); + } + + for(NCPath pa: oldPaths) { + ncs.paths.remove(pa); + } + + for(NCLink li: oldLinks) { + ncs.links.remove(li); + } + + // Rename paths + int cpt=0; + for(NCPath pa: ncs.paths) { + pa.setName("path" + cpt); + cpt ++; + } } } diff --git a/src/ui/ncdd/NCConnectorNode.java b/src/ui/ncdd/NCConnectorNode.java index 0e4b34f206..d20f92c149 100755 --- a/src/ui/ncdd/NCConnectorNode.java +++ b/src/ui/ncdd/NCConnectorNode.java @@ -116,7 +116,7 @@ public class NCConnectorNode extends TGConnector implements WithAttributes { if (!tdp.isScaled()) { maxWidthValue = Math.max(maxWidthValue, widthValue); } - g.drawString(value, ((p1.getX() + p2.getX()) / 2)-widthValue/2, ((p1.getY() + p2.getY()) / 2) - (h/2)); + //g.drawString(value, ((p1.getX() + p2.getX()) / 2)-widthValue/2, ((p1.getY() + p2.getY()) / 2) - (h/2)); } public boolean editOndoubleClick(JFrame frame) { @@ -315,12 +315,12 @@ public class NCConnectorNode extends TGConnector implements WithAttributes { } public String getAttributes() { - String ret = ""; + String ret = interfaceName; if (hasCapacity) { - ret += "Capacity = " + capacity + " " + capacityUnit + "\n"; + ret += "\nCapacity = " + capacity + " " + capacityUnit; } if (hasParameter) { - ret +="Parameter = " + parameter + "\n"; + ret +="\nParameter = " + parameter; } return ret; } diff --git a/src/ui/ncdd/NCRouteArtifact.java b/src/ui/ncdd/NCRouteArtifact.java index 5323f26b1b..3b04f96b0d 100755 --- a/src/ui/ncdd/NCRouteArtifact.java +++ b/src/ui/ncdd/NCRouteArtifact.java @@ -149,7 +149,7 @@ public class NCRouteArtifact extends TGCWithoutInternalComponent implements Swal ArrayList<String> outputInterfaces = (ArrayList<String>)(inputInterfaces.clone()); JDialogNCRoute dialog = new JDialogNCRoute(frame, "Setting route attributes", value, vroutes, inputInterfaces, traffics, outputInterfaces); - dialog.setSize(700, 400); + dialog.setSize(900, 500); GraphicLib.centerOnParent(dialog); dialog.show(); // blocked until dialog has been closed diff --git a/src/ui/window/JDialogNCRoute.java b/src/ui/window/JDialogNCRoute.java index 33b82baa64..840553e1f7 100755 --- a/src/ui/window/JDialogNCRoute.java +++ b/src/ui/window/JDialogNCRoute.java @@ -126,7 +126,7 @@ public class JDialogNCRoute extends javax.swing.JDialog implements ActionListene panel1 = new JPanel(); panel1.setLayout(gridbag1); panel1.setBorder(new javax.swing.border.TitledBorder("Adding a route")); - panel1.setPreferredSize(new Dimension(300, 250)); + panel1.setPreferredSize(new Dimension(500, 350)); panel2 = new JPanel(); panel2.setLayout(gridbag2); -- GitLab