From 1693ac7f6749086ddf1e16ba423ee5bb645fb573 Mon Sep 17 00:00:00 2001 From: Ludovic Apvrille <ludovic.apvrille@telecom-paristech.fr> Date: Wed, 25 Feb 2015 17:20:46 +0000 Subject: [PATCH] Update on CP DMA_transfer --- src/tmltranslator/TMLActivity.java | 33 ++ src/tmltranslator/TMLActivityElement.java | 154 +++++----- .../TMLActivityElementEvent.java | 58 ++-- src/tmltranslator/TMLCPLib.java | 11 + src/tmltranslator/TMLChannel.java | 37 +++ src/tmltranslator/TMLEvent.java | 284 +++++++++--------- src/tmltranslator/TMLMapping.java | 141 +++++++++ src/tmltranslator/TMLModeling.java | 15 + src/tmltranslator/TMLPort.java | 114 +++---- src/tmltranslator/TMLSendEvent.java | 10 +- src/tmltranslator/TMLTask.java | 4 + src/tmltranslator/TMLWaitEvent.java | 10 +- .../tomappingsystemc2/TML2MappingSystemC.java | 10 +- 13 files changed, 564 insertions(+), 317 deletions(-) diff --git a/src/tmltranslator/TMLActivity.java b/src/tmltranslator/TMLActivity.java index 1ed6b6a92c..e24c8bbf8f 100755 --- a/src/tmltranslator/TMLActivity.java +++ b/src/tmltranslator/TMLActivity.java @@ -428,5 +428,38 @@ public class TMLActivity extends TMLElement { } } + public void addSendEventAfterWriteIn(TMLChannel chan, TMLEvent evt, String action) { + TMLActivityElement ae; + TMLWriteChannel twc; + int cpt = 0; + + Vector<TMLSendEvent> newElements = new Vector<TMLSendEvent>(); + + for(int i=0; i<elements.size(); i++) { + ae = (TMLActivityElement)(elements.elementAt(i)); + if (ae instanceof TMLWriteChannel) { + twc = (TMLWriteChannel)ae; + for (int j = 0; j<twc.getNbOfChannels(); j++) { + if (twc.getChannel(j) == chan) { + TMLSendEvent send = new TMLSendEvent("SendEvt" + cpt, ae.getReferenceObject()); + send.setEvent(evt); + Vector nexts = ae.getNexts(); + for (Object o: nexts) { + send.addNext((TMLActivityElement)o); + } + newElements.add(send); + send.addParam(action); + ae.clearNexts(); + ae.addNext(send); + } + } + } + } + + for(TMLSendEvent s: newElements) { + elements.add(s); + } + } + } diff --git a/src/tmltranslator/TMLActivityElement.java b/src/tmltranslator/TMLActivityElement.java index 295d30cb8b..79e6df5d5f 100755 --- a/src/tmltranslator/TMLActivityElement.java +++ b/src/tmltranslator/TMLActivityElement.java @@ -1,47 +1,47 @@ /**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille -ludovic.apvrille AT enst.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. - -/** - * Class TMLActivityElement - * Creation: 23/11/2005 - * @version 1.0 23/11/2005 - * @author Ludovic APVRILLE - * @see - */ + ludovic.apvrille AT enst.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. + + /** + * Class TMLActivityElement + * Creation: 23/11/2005 + * @version 1.0 23/11/2005 + * @author Ludovic APVRILLE + * @see + */ package tmltranslator; @@ -50,17 +50,17 @@ import java.util.*; public class TMLActivityElement extends TMLElement{ protected Vector nexts; - + public TMLActivityElement(String _name, Object _referenceObject) { - super(_name, _referenceObject); - nexts = new Vector(); - + super(_name, _referenceObject); + nexts = new Vector(); + } - + public int getNbNext() { return nexts.size(); } - + public TMLActivityElement getNextElement(int _i) { if (_i < getNbNext() ) { return (TMLActivityElement)(nexts.elementAt(_i)); @@ -68,41 +68,41 @@ public class TMLActivityElement extends TMLElement{ return null; } } - + public void addNext(TMLActivityElement _tmlae) { nexts.add(_tmlae); } - - public void addNext(int _index, TMLActivityElement _tmlae) { + + public void addNext(int _index, TMLActivityElement _tmlae) { nexts.add(_index, _tmlae); } - + public void removeNext(int index) { nexts.removeElementAt(index); } - - public Vector getNexts() { - return nexts; - } - - public void setNexts(Vector _nexts) { - nexts = _nexts; - } - - public void clearNexts() { - nexts.clear(); - } - - public void setNewNext(TMLActivityElement oldE, TMLActivityElement newE) { - TMLActivityElement elt; - for(int i=0; i<getNbNext(); i++) { - elt = getNextElement(i); - if (elt == oldE) { - nexts.setElementAt(newE, i); - } - } - } - - - + + public Vector getNexts() { + return nexts; + } + + public void setNexts(Vector _nexts) { + nexts = _nexts; + } + + public void clearNexts() { + nexts.clear(); + } + + public void setNewNext(TMLActivityElement oldE, TMLActivityElement newE) { + TMLActivityElement elt; + for(int i=0; i<getNbNext(); i++) { + elt = getNextElement(i); + if (elt == oldE) { + nexts.setElementAt(newE, i); + } + } + } + + + } diff --git a/src/tmltranslator/TMLActivityElementEvent.java b/src/tmltranslator/TMLActivityElementEvent.java index b02f68afd9..5cd779fa33 100755 --- a/src/tmltranslator/TMLActivityElementEvent.java +++ b/src/tmltranslator/TMLActivityElementEvent.java @@ -67,23 +67,23 @@ public abstract class TMLActivityElementEvent extends TMLActivityElement { public TMLEvent getEvent() { return event; } - + public void setVariable(String _variable) { - variable = _variable; + variable = _variable; } - + public String getVariable() { - return variable; + return variable; } - + public void addParam(String _param) { datas.add(_param); } - + public int getNbOfParams() { return datas.size(); } - + public String getParam(int _index) { if (_index < getNbOfParams()) { return (String)(datas.elementAt(_index)); @@ -91,25 +91,25 @@ public abstract class TMLActivityElementEvent extends TMLActivityElement { return null; } } - - public void setParam(String _param, int _index) { - datas.setElementAt(_param, _index); - } - - public String getAllParams() { - return getAllParams(","); - } - - public String getAllParams(String separator) { - String s = ""; - for(int i=0; i<getNbOfParams(); i++) { - if (i != 0) { - s+= separator; - } - s += TMLTextSpecification.modifyString(getParam(i)); - } - return s; - } - - -} \ No newline at end of file + + public void setParam(String _param, int _index) { + datas.setElementAt(_param, _index); + } + + public String getAllParams() { + return getAllParams(","); + } + + public String getAllParams(String separator) { + String s = ""; + for(int i=0; i<getNbOfParams(); i++) { + if (i != 0) { + s+= separator; + } + s += TMLTextSpecification.modifyString(getParam(i)); + } + return s; + } + + +} diff --git a/src/tmltranslator/TMLCPLib.java b/src/tmltranslator/TMLCPLib.java index 169902094a..4df4eebcee 100755 --- a/src/tmltranslator/TMLCPLib.java +++ b/src/tmltranslator/TMLCPLib.java @@ -96,6 +96,17 @@ public class TMLCPLib extends TMLElement { return typeName.compareTo("DMA_transfer") == 0; } + public String getUnitByName(String id) { + id = "." + id + " : "; + for(String s: mappedUnits) { + if (s.indexOf(id) > -1) { + return s.substring(s.indexOf(":")+1, s.length()).trim(); + } + } + return null; + + } + } //End of the class diff --git a/src/tmltranslator/TMLChannel.java b/src/tmltranslator/TMLChannel.java index 4ed1b70185..e3718cd07e 100755 --- a/src/tmltranslator/TMLChannel.java +++ b/src/tmltranslator/TMLChannel.java @@ -140,6 +140,43 @@ public class TMLChannel extends TMLCommunicationElement { return ret.trim(); } + public int getNbOfDestinationPorts() { + if (isBasicChannel()) { + if (destinationPort != null) { + return 1; + } else { + return 0; + } + } + + if (destinationPorts == null) { + return 0; + } + + return destinationPorts.size(); + } + + public TMLPort hasDestinationPort(String name) { + if (destinationPort != null) { + if (destinationPort.getName().compareTo(name) ==0) { + return destinationPort; + } + } + + if (destinationPorts == null) { + return null; + } + + for (TMLPort port: destinationPorts) { + if (port.getName().compareTo(name) ==0) { + return destinationPort; + } + } + + return null; + + } + // Complex channels public boolean isBasicChannel() { return (originTasks.size() == 0); diff --git a/src/tmltranslator/TMLEvent.java b/src/tmltranslator/TMLEvent.java index fbc11ecf66..c76654b565 100755 --- a/src/tmltranslator/TMLEvent.java +++ b/src/tmltranslator/TMLEvent.java @@ -1,47 +1,47 @@ /**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille -ludovic.apvrille AT enst.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. - -/** - * Class TMLEvent - * Creation: 22/11/2005 - * @version 1.0 22/11/2005 - * @author Ludovic APVRILLE - * @see - */ + ludovic.apvrille AT enst.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. + + /** + * Class TMLEvent + * Creation: 22/11/2005 + * @version 1.0 22/11/2005 + * @author Ludovic APVRILLE + * @see + */ package tmltranslator; @@ -54,99 +54,99 @@ public class TMLEvent extends TMLCommunicationElement { protected boolean isBlocking = false; // By default, latest events is removed when the FIFO is full protected boolean canBeNotified = false; protected TMLTask origin, destination; - + /*public TMLEvent(String name, Object reference) { - super(name, reference); - params = new Vector(); - }*/ - + super(name, reference); + params = new Vector(); + }*/ + public TMLEvent(String name, Object reference, int _maxEvt, boolean _isBlocking) { super(name, reference); params = new Vector(); maxEvt = _maxEvt; isBlocking = _isBlocking; checkMaxEvt(); - - //System.out.println("New event: " + name + " max=" + _maxEvt + " blocking=" + isBlocking); + + //System.out.println("New event: " + name + " max=" + _maxEvt + " blocking=" + isBlocking); } - + public int getNbOfParams() { - return params.size(); + return params.size(); } - + public void setSizeFIFO(int _max) { - maxEvt = _max; - checkMaxEvt(); + maxEvt = _max; + checkMaxEvt(); } - + public void setBlocking(boolean _isBlocking) { - isBlocking = _isBlocking; + isBlocking = _isBlocking; } - + public void setTasks(TMLTask _origin, TMLTask _destination) { - origin = _origin; - destination = _destination; + origin = _origin; + destination = _destination; } - + public TMLTask getOriginTask() { - return origin; + return origin; } - + public TMLTask getDestinationTask() { - return destination; + return destination; } public void checkMaxEvt() { - if (maxEvt < -1) { - maxEvt = -1; - } - - if (maxEvt == 0) { - maxEvt = -1; - } + if (maxEvt < -1) { + maxEvt = -1; + } + + if (maxEvt == 0) { + maxEvt = -1; + } } - + public void setNotified(boolean b) { - canBeNotified = b; + canBeNotified = b; } - + public boolean canBeNotified() { - return canBeNotified; + return canBeNotified; } - + public boolean isInfinite() { - return (maxEvt == -1); + return (maxEvt == -1); } - + public boolean isBlocking() { - return isBlocking; + return isBlocking; } - + public int getMaxSize() { - return maxEvt; + return maxEvt; } - + public void addParam(TMLType _type) { - params.add(_type); - } - - public boolean isBlockingAtOrigin() { - if (isInfinite()) { - return false; - } - - if (isBlocking()) { - return true; - } - - return false; - } - - public boolean isBlockingAtDestination() { - return true; - } - + params.add(_type); + } + + public boolean isBlockingAtOrigin() { + if (isInfinite()) { + return false; + } + + if (isBlocking()) { + return true; + } + + return false; + } + + public boolean isBlockingAtDestination() { + return true; + } + public TMLType getType(int i) { if (i<getNbOfParams()) { return (TMLType)(params.elementAt(i)); @@ -154,45 +154,45 @@ public class TMLEvent extends TMLCommunicationElement { return null; } } - - public String getNameExtension() { - return "event__"; - } - - public String getTypeTextFormat() { - if (isInfinite()) { - return "INF"; - } else { - if (isBlocking()) { - return "NIB"; - } else { - return "NINB"; - } - } - } - - public static boolean isAValidListOfParams(String _list) { - if (_list.length() == 0) { - return true; - } - String []split = _list.split(","); - for(int i=0; i<split.length; i++) { - if (!TMLType.isAValidType(split[i])) { - return false; - } - } - return true; - } - - public void addParam(String _list) { - String []split = _list.split(","); - TMLType type; - for(int i=0; i<split.length; i++) { - if (TMLType.isAValidType(split[i])) { - type = new TMLType(TMLType.getType(split[i])); - addParam(type); - } - } - } - -} \ No newline at end of file + + public String getNameExtension() { + return "event__"; + } + + public String getTypeTextFormat() { + if (isInfinite()) { + return "INF"; + } else { + if (isBlocking()) { + return "NIB"; + } else { + return "NINB"; + } + } + } + + public static boolean isAValidListOfParams(String _list) { + if (_list.length() == 0) { + return true; + } + String []split = _list.split(","); + for(int i=0; i<split.length; i++) { + if (!TMLType.isAValidType(split[i])) { + return false; + } + } + return true; + } + + public void addParam(String _list) { + String []split = _list.split(","); + TMLType type; + for(int i=0; i<split.length; i++) { + if (TMLType.isAValidType(split[i])) { + type = new TMLType(TMLType.getType(split[i])); + addParam(type); + } + } + } + +} diff --git a/src/tmltranslator/TMLMapping.java b/src/tmltranslator/TMLMapping.java index 551fed8ef5..a7471edaea 100755 --- a/src/tmltranslator/TMLMapping.java +++ b/src/tmltranslator/TMLMapping.java @@ -605,11 +605,25 @@ public class TMLMapping { } + + public void removeForksAndJoins() { + if (tmlm != null) { + tmlm.removeForksAndJoins(); + } + + // We map the forked tasks to their origin node,and the join to their destination node + } + public void handleCPs() { // Remove the CPLib with new tasks, channels, HW components handleCPDMA(); + + // Handle ports of forks / joins not mapped on local memories + // + + mappedCPLibs = new ArrayList<TMLCPLib>(); } @@ -633,7 +647,134 @@ public class TMLMapping { } private void handleCPDMAArtifact(TMLCPLib _cp, TMLCPLibArtifact _arti) { + // Find all the channel with the artifact + TMLChannel chan = tmlm.getChannelByDestinationPortName(_arti.portName); + if (chan == null) { + TraceManager.addDev("DMA_transfer/ Unknown channel with in port=" + _arti.portName); + return; + } + + TraceManager.addDev("DMA_transfer/ Found channel=" + chan); + + if (chan.getNbOfDestinationPorts() > 1) { + TraceManager.addDev("DMA_transfer/ Channel has too many ports (must have only one)"); + } + + if (!(chan.isBasicChannel())) { + TraceManager.addDev("DMA_transfer/ Only basic channel is accepted"); + } + + String DMAController = _cp.getUnitByName("DMA_Controller_1"); + + if (DMAController == null) { + TraceManager.addDev("DMA_transfer/ Unknown DMA controller in CP"); + } + + TraceManager.addDev("DMA controller=|" + DMAController + "|"); + HwExecutionNode node = getHwExecutionNodeByName(DMAController); + if (node == null) { + TraceManager.addDev("DMA_transfer/ Unknown Hw Execution Node: " + DMAController); + } + + // At each origin: We write in a new local channel in a NBRNBW fashion + // This new channel is mapped on Src_Storage_Instance_1 + // Then, we send an event to a new DMA task mapped + // The DMa task read elements from the src mem and writes on the destination mem. + + // -> The old channel is thus transformed into two new channels + + + // New DMATask + TMLTask dmaTask = new TMLTask("DMATask__" + chan.getName(), chan, null); + tmlm.addTask(dmaTask); + TMLChannel fromOriginToDMA = new TMLChannel("toDMATask__" + chan.getName(), chan); + tmlm.addChannel(fromOriginToDMA); + TMLPort portInDMA = new TMLPort("portToDMATask__" + chan.getName(), chan); + TMLPort portOutDMA = new TMLPort("portfromDMATask__" + chan.getName(), chan); + + TMLTask origin = chan.getOriginTask(); + TMLTask destination = chan.getDestinationTask(); + fromOriginToDMA.setTasks(origin, dmaTask); + fromOriginToDMA.setPorts(chan.getOriginPort(), portInDMA); + + chan.setPorts(portOutDMA, chan.getDestinationPort()); + + // In the origin task, we change all writing to "chan" to "fromOriginToDMA" + origin.replaceWriteChannelWith(chan, fromOriginToDMA); + TMLEvent toDMA = new TMLEvent("toDMA" + chan.getName(), chan, 1, false); + tmlm.addEvent(toDMA); + toDMA.addParam(new TMLType(TMLType.NATURAL)); + toDMA.setTasks(origin, dmaTask); + origin.addSendEventAfterWriteIn(fromOriginToDMA, toDMA, "size"); + + + // We need to create the activity diagram of DMATask + // We wait for the wait event. Then, we read/write one by one until we have read size + TMLActivity activity = dmaTask.getActivityDiagram(); + TMLStartState start = new TMLStartState("startOfDMA", null); + activity.setFirst(start); + TMLStopState mainStop = new TMLStopState("mainStopOfDMA", null); + activity.addElement(mainStop); + TMLStopState stop = new TMLStopState("stopOfDMA", null); + activity.addElement(stop); + TMLStopState stopWrite = new TMLStopState("stopOfWrite", null); + activity.addElement(stopWrite); + TMLWaitEvent wait = new TMLWaitEvent("waitEvtInDMA", null); + wait.setEvent(toDMA); + wait.addParam("size"); + TMLForLoop mainLoop = new TMLForLoop("mainLoopOfDMA", null); + mainLoop.setInit("i=0"); + mainLoop.setCondition("i==1"); + mainLoop.setIncrement("i=i"); + activity.addElement(mainLoop); + TMLForLoop loop = new TMLForLoop("loopOfDMA", null); + loop.setInit("j=size"); + loop.setCondition("j==0"); + loop.setIncrement("j = j-1"); + activity.addElement(loop); + TMLAttribute attri = new TMLAttribute("i", "i", new TMLType(TMLType.NATURAL), "0"); + dmaTask.addAttribute(attri); + TMLAttribute attrj = new TMLAttribute("j", "j", new TMLType(TMLType.NATURAL), "0"); + dmaTask.addAttribute(attrj); + TMLAttribute attrsize = new TMLAttribute("size", "size", new TMLType(TMLType.NATURAL), "0"); + dmaTask.addAttribute(attrsize); + + TMLWriteChannel write = new TMLWriteChannel("WriteOfDMA", null); + activity.addElement(write); + write.addChannel(chan); + write.setNbOfSamples("1"); + TMLReadChannel read = new TMLReadChannel("ReadOfDMA", null); + read.addChannel(fromOriginToDMA); + read.setNbOfSamples("1"); + activity.addElement(read); + + activity.setFirst(start); + start.addNext(mainLoop); + mainLoop.addNext(wait); + mainLoop.addNext(mainStop); + wait.addNext(loop); + loop.addNext(read); + loop.addNext(stop); + read.addNext(write); + write.addNext(stopWrite); + + // All mapping to be done + // Map DMA task to the DMA nod eof the CPLib + addTaskToHwExecutionNode(dmaTask, node); + + + + + + } + + public String getMappedTasksString() { + String tasks = ""; + for(TMLTask task: mappedtasks) { + tasks += task.getName() + " "; + } + return tasks; } } diff --git a/src/tmltranslator/TMLModeling.java b/src/tmltranslator/TMLModeling.java index 931484b4b8..4d3f38f655 100755 --- a/src/tmltranslator/TMLModeling.java +++ b/src/tmltranslator/TMLModeling.java @@ -494,6 +494,18 @@ public class TMLModeling { return null; } + public TMLChannel getChannelByDestinationPortName(String _portName) { + TMLChannel ch; + ListIterator iterator = channels.listIterator(); + while(iterator.hasNext()) { + ch = (TMLChannel)(iterator.next()); + if (ch.hasDestinationPort(_portName) != null) { + return ch; + } + } + return null; + } + public TMLEvent getEventByName(String _name) { TMLEvent evt; ListIterator iterator = events.listIterator(); @@ -1390,6 +1402,9 @@ public class TMLModeling { public void removeForksAndJoins() { + TraceManager.addDev("\n\n**** Remove forks and joins\n"); + //Exception e = new Exception(); e.printStackTrace(); + removeForks(); removeJoins(); } diff --git a/src/tmltranslator/TMLPort.java b/src/tmltranslator/TMLPort.java index 2eb2e00618..5695122713 100755 --- a/src/tmltranslator/TMLPort.java +++ b/src/tmltranslator/TMLPort.java @@ -1,74 +1,74 @@ /**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille -ludovic.apvrille AT enst.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. - -/** - * Class TMLPort - * Creation: 16/02/2015 - * @version 1.0 16/02/2015 - * @author Ludovic APVRILLE - * @see - */ + ludovic.apvrille AT enst.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. + + /** + * Class TMLPort + * Creation: 16/02/2015 + * @version 1.0 16/02/2015 + * @author Ludovic APVRILLE + * @see + */ package tmltranslator; import ui.tmlcompd.*; public class TMLPort extends TMLElement { - - boolean prex; - boolean postex; + + boolean prex; + boolean postex; public TMLPort(String _name, Object _referenceObject) { super(_name, _referenceObject); } - public void setPrex( boolean _prex ) { - prex = _prex; - } + public void setPrex( boolean _prex ) { + prex = _prex; + } - public boolean isPrex() { - return prex; - } + public boolean isPrex() { + return prex; + } - public void setPostex( boolean _postex ) { - postex = _postex; - } + public void setPostex( boolean _postex ) { + postex = _postex; + } - public boolean isPostex() { - return postex; - } + public boolean isPostex() { + return postex; + } } diff --git a/src/tmltranslator/TMLSendEvent.java b/src/tmltranslator/TMLSendEvent.java index b3411efcf0..f897b96659 100755 --- a/src/tmltranslator/TMLSendEvent.java +++ b/src/tmltranslator/TMLSendEvent.java @@ -53,9 +53,9 @@ public class TMLSendEvent extends TMLActivityElementEvent { public TMLSendEvent(String _name, Object _referenceObject) { super(_name, _referenceObject); } - - public String toString() { - return "Send event:" + event.getName() + "(" + getAllParams() +")"; - } -} \ No newline at end of file + public String toString() { + return "Send event:" + event.getName() + "(" + getAllParams() +")"; + } + +} diff --git a/src/tmltranslator/TMLTask.java b/src/tmltranslator/TMLTask.java index ed4f2d4e7e..32523beeba 100755 --- a/src/tmltranslator/TMLTask.java +++ b/src/tmltranslator/TMLTask.java @@ -283,4 +283,8 @@ public class TMLTask extends TMLElement { activity.replaceWriteChannelWith(oldChan, newChan); } + public void addSendEventAfterWriteIn(TMLChannel chan, TMLEvent evt, String action) { + activity.addSendEventAfterWriteIn(chan, evt, action); + } + } diff --git a/src/tmltranslator/TMLWaitEvent.java b/src/tmltranslator/TMLWaitEvent.java index 7d5bd23908..83f2efd0a6 100755 --- a/src/tmltranslator/TMLWaitEvent.java +++ b/src/tmltranslator/TMLWaitEvent.java @@ -53,9 +53,9 @@ public class TMLWaitEvent extends TMLActivityElementEvent { public TMLWaitEvent(String _name, Object _referenceObject) { super(_name, _referenceObject); } - - public String toString() { - return "Wait event: " + event.getName() + "(" + getAllParams() +")"; - } -} \ No newline at end of file + public String toString() { + return "Wait event: " + event.getName() + "(" + getAllParams() +")"; + } + +} diff --git a/src/tmltranslator/tomappingsystemc2/TML2MappingSystemC.java b/src/tmltranslator/tomappingsystemc2/TML2MappingSystemC.java index 53889dbce9..db9b0becc2 100755 --- a/src/tmltranslator/tomappingsystemc2/TML2MappingSystemC.java +++ b/src/tmltranslator/tomappingsystemc2/TML2MappingSystemC.java @@ -85,6 +85,8 @@ public class TML2MappingSystemC { public TML2MappingSystemC(TMLMapping _tmlmapping) { tmlmapping = _tmlmapping; + tmlmapping.handleCPs(); + tmlmapping.removeForksAndJoins(); tmlmapping.makeMinimumMapping(); tepeTranslator = new SystemCTEPE(new ArrayList<TEPE>(), this); } @@ -99,6 +101,8 @@ public class TML2MappingSystemC { public TML2MappingSystemC(TMLMapping _tmlmapping, ArrayList<EBRDD> _ebrdds, ArrayList<TEPE> _tepes) { tmlmapping = _tmlmapping; + tmlmapping.handleCPs(); + tmlmapping.removeForksAndJoins(); //ebrdds = _ebrdds; tmlmapping.makeMinimumMapping(); tepeTranslator = new SystemCTEPE(_tepes, this); @@ -121,6 +125,7 @@ public class TML2MappingSystemC { debug = _debug; optimize = _optimize; tmlmapping.removeAllRandomSequences(); + tmlmapping.handleCPs(); tmlmodeling = tmlmapping.getTMLModeling(); tasks = new ArrayList<MappedSystemCTask>(); //generateSystemCTasks(); @@ -302,8 +307,8 @@ public class TML2MappingSystemC { } declaration += tmp + "* " + channel.getExtendedName() + " = new " + tmp +"(" + channel.getID() + ",\"" + channel.getName() + "\"," + channel.getSize() + ","; TraceManager.addDev("Channel: " + channel.getName()); - //TraceManager.addDev("Channel origin node: " + channel.getOriginTask().getName() + " dest node: " + channel.getDestinationTask().getName()); - TraceManager.addDev( "the list of mapped tasks: " + tmlmapping.getMappedTasks().toString() ); + TraceManager.addDev("Channel origin node: " + channel.getOriginTask().getName() + " dest node: " + channel.getDestinationTask().getName()); + TraceManager.addDev( "the list of mapped tasks: " + tmlmapping.getMappedTasksString()); declaration+= determineRouting(tmlmapping.getHwNodeOf(channel.getOriginTask()), tmlmapping.getHwNodeOf(channel.getDestinationTask()), elem) + param + "," + channel.getPriority(); if (channel.isLossy() && channel.getType()!=TMLChannel.NBRNBW) declaration += "," + channel.getLossPercentage() + "," + channel.getMaxNbOfLoss(); declaration += ")"+ SCCR; @@ -604,6 +609,7 @@ public class TML2MappingSystemC { //first called with Maping:getCommunicationNodes LinkedList<HwCommunicationNode> nodesToExplore; TraceManager.addDev("No of comm nodes " + commNodes.size()); + TraceManager.addDev("startNode=" + startNode); boolean busExploreMode = ((depth & 1) == 0); //if (depth % 2 == 0){ if(busExploreMode){ -- GitLab