Commit 6fe33a38 authored by Ludovic Apvrille's avatar Ludovic Apvrille
Browse files

Revert "Merge branch 'latencyDetailedAnalysis' into 'master'"

This reverts merge request !260
parent ed201590
...@@ -26,10 +26,6 @@ dependencies { ...@@ -26,10 +26,6 @@ dependencies {
compile name:'jautomata-core' compile name:'jautomata-core'
compile name:'com.microsoft.z3' compile name:'com.microsoft.z3'
compileOnly name: 'jna-3.3.0' compileOnly name: 'jna-3.3.0'
compile name: 'jgrapht-core-1.3.0'
compile name: 'jgrapht-ext-1.3.0'
compile name: 'jgrapht-io-1.3.0'
compile name: 'jgraphx-3.4.1.3'
} }
jar { jar {
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
* knowledge of the CeCILL license and that you accept its terms. * knowledge of the CeCILL license and that you accept its terms.
*/ */
package tmltranslator; package tmltranslator;
import myutil.TraceManager; import myutil.TraceManager;
...@@ -43,7 +44,8 @@ import myutil.TraceManager; ...@@ -43,7 +44,8 @@ import myutil.TraceManager;
import java.util.*; import java.util.*;
/** /**
* Class TMLArchitecture Creation: 05/09/2007 * Class TMLArchitecture
* Creation: 05/09/2007
* *
* @author Ludovic APVRILLE * @author Ludovic APVRILLE
* @version 1.1 19/05/2008 * @version 1.1 19/05/2008
...@@ -57,6 +59,7 @@ public class TMLArchitecture { ...@@ -57,6 +59,7 @@ public class TMLArchitecture {
private int hashCode; private int hashCode;
private boolean hashCodeComputed = false; private boolean hashCodeComputed = false;
public TMLArchitecture() { public TMLArchitecture() {
init(); init();
} }
...@@ -67,10 +70,10 @@ public class TMLArchitecture { ...@@ -67,10 +70,10 @@ public class TMLArchitecture {
} }
private void computeHashCode() { private void computeHashCode() {
TMLArchiTextSpecification architxt = new TMLArchiTextSpecification(/* "spec.tarchi" */); TMLArchiTextSpecification architxt = new TMLArchiTextSpecification(/*"spec.tarchi"*/);
String s = architxt.toTextFormat(this); String s = architxt.toTextFormat(this);
hashCode = s.hashCode(); hashCode = s.hashCode();
// TraceManager.addDev("TARCHI hashcode = " + hashCode); //TraceManager.addDev("TARCHI hashcode = " + hashCode);
} }
public int getHashCode() { public int getHashCode() {
...@@ -90,6 +93,7 @@ public class TMLArchitecture { ...@@ -90,6 +93,7 @@ public class TMLArchitecture {
return masterClockFrequency; return masterClockFrequency;
} }
public void addHwNode(HwNode _node) { public void addHwNode(HwNode _node) {
hwnodes.add(_node); hwnodes.add(_node);
} }
...@@ -133,6 +137,7 @@ public class TMLArchitecture { ...@@ -133,6 +137,7 @@ public class TMLArchitecture {
addHwLink(link); addHwLink(link);
} }
public boolean hasCPU() { public boolean hasCPU() {
for (HwNode node : hwnodes) { for (HwNode node : hwnodes) {
if (node instanceof HwCPU) { if (node instanceof HwCPU) {
...@@ -144,7 +149,7 @@ public class TMLArchitecture { ...@@ -144,7 +149,7 @@ public class TMLArchitecture {
public boolean hasHwExecutionNode() { public boolean hasHwExecutionNode() {
for (HwNode node : hwnodes) { for (HwNode node : hwnodes) {
if ((node instanceof HwCPU) || (node instanceof HwA) || (node instanceof HwFPGA)) { if ((node instanceof HwCPU)|| (node instanceof HwA)|| (node instanceof HwFPGA)) {
return true; return true;
} }
} }
...@@ -253,6 +258,7 @@ public class TMLArchitecture { ...@@ -253,6 +258,7 @@ public class TMLArchitecture {
return list; return list;
} }
public int getNbOfCPU() { public int getNbOfCPU() {
int cpt = 0; int cpt = 0;
for (HwNode node : hwnodes) { for (HwNode node : hwnodes) {
...@@ -273,6 +279,7 @@ public class TMLArchitecture { ...@@ -273,6 +279,7 @@ public class TMLArchitecture {
return cpt; return cpt;
} }
public int getNbOfMem() { public int getNbOfMem() {
int cpt = 0; int cpt = 0;
for (HwNode node : hwnodes) { for (HwNode node : hwnodes) {
...@@ -293,9 +300,9 @@ public class TMLArchitecture { ...@@ -293,9 +300,9 @@ public class TMLArchitecture {
public HwNode getHwNodeByName(String _name) { public HwNode getHwNodeByName(String _name) {
for (HwNode node : hwnodes) { for (HwNode node : hwnodes) {
// TraceManager.addDev("Comparing >" + node.getName() + "< vs >" + _name + "<"); //TraceManager.addDev("Comparing >" + node.getName() + "< vs >" + _name + "<");
if (node.getName().compareTo(_name) == 0) { if (node.getName().compareTo(_name) == 0) {
// TraceManager.addDev("Returning node " + node.getName()); //TraceManager.addDev("Returning node " + node.getName());
return node; return node;
} }
} }
...@@ -382,8 +389,7 @@ public class TMLArchitecture { ...@@ -382,8 +389,7 @@ public class TMLArchitecture {
List<HwLink> tempList = new ArrayList<HwLink>(); List<HwLink> tempList = new ArrayList<HwLink>();
for (HwLink link : hwlinks) { for (HwLink link : hwlinks) {
if (link.hwnode == node) if (link.hwnode == node) tempList.add(link);
tempList.add(link);
} }
return tempList; return tempList;
...@@ -400,8 +406,7 @@ public class TMLArchitecture { ...@@ -400,8 +406,7 @@ public class TMLArchitecture {
public boolean isNodeConnectedToBus(HwNode node, HwBus bus) { public boolean isNodeConnectedToBus(HwNode node, HwBus bus) {
for (HwLink link : hwlinks) { for (HwLink link : hwlinks) {
if (node == link.hwnode && bus == link.bus) if (node == link.hwnode && bus == link.bus) return true;
return true;
} }
return false; return false;
} }
...@@ -410,8 +415,7 @@ public class TMLArchitecture { ...@@ -410,8 +415,7 @@ public class TMLArchitecture {
List<HwLink> tempList = new ArrayList<HwLink>(); List<HwLink> tempList = new ArrayList<HwLink>();
for (HwLink link : hwlinks) { for (HwLink link : hwlinks) {
if (link.bus == bus) if (link.bus == bus) tempList.add(link);
tempList.add(link);
} }
return tempList; return tempList;
...@@ -426,17 +430,17 @@ public class TMLArchitecture { ...@@ -426,17 +430,17 @@ public class TMLArchitecture {
if (node instanceof HwCPU) { if (node instanceof HwCPU) {
HwCPU cpu = (HwCPU) node; HwCPU cpu = (HwCPU) node;
complexity += cpu.nbOfCores * cpu.byteDataSize * cpu.pipelineSize; complexity += cpu.nbOfCores * cpu.byteDataSize * cpu.pipelineSize;
// TraceManager.addDev("complexity CPU= " + complexity); //TraceManager.addDev("complexity CPU= " + complexity);
} }
if (node instanceof HwBus) { if (node instanceof HwBus) {
HwBus bus = (HwBus) node; HwBus bus = (HwBus) node;
complexity += bus.byteDataSize * bus.pipelineSize; complexity += bus.byteDataSize * bus.pipelineSize;
// TraceManager.addDev("complexity bus= " + complexity); //TraceManager.addDev("complexity bus= " + complexity);
} }
} }
// TraceManager.addDev("Complexity = " + complexity); //TraceManager.addDev("Complexity = " + complexity);
return complexity; return complexity;
} }
...@@ -472,10 +476,11 @@ public class TMLArchitecture { ...@@ -472,10 +476,11 @@ public class TMLArchitecture {
return false; return false;
} }
// For NoC manipulation // For NoC manipulation
public void removeAllNonHwExecutionNodes() { public void removeAllNonHwExecutionNodes() {
List<HwNode> newList = new ArrayList<HwNode>(); List<HwNode> newList = new ArrayList<HwNode>();
for (HwNode node : hwnodes) { for(HwNode node: hwnodes) {
if (node instanceof HwExecutionNode) { if (node instanceof HwExecutionNode) {
newList.add(node); newList.add(node);
} }
...@@ -484,9 +489,9 @@ public class TMLArchitecture { ...@@ -484,9 +489,9 @@ public class TMLArchitecture {
} }
public HwNoC getHwNoC() { public HwNoC getHwNoC() {
for (HwNode node : hwnodes) { for(HwNode node: hwnodes) {
if (node instanceof HwNoC) { if (node instanceof HwNoC) {
return ((HwNoC) node); return ((HwNoC)node);
} }
} }
return null; return null;
...@@ -498,60 +503,17 @@ public class TMLArchitecture { ...@@ -498,60 +503,17 @@ public class TMLArchitecture {
} }
public boolean equalSpec(Object o) { public boolean equalSpec(Object o) {
if (this == o) if (this == o) return true;
return true; if (o == null || getClass() != o.getClass()) return false;
if (o == null || getClass() != o.getClass())
return false;
TMLArchitecture that = (TMLArchitecture) o; TMLArchitecture that = (TMLArchitecture) o;
TMLComparingMethod comp = new TMLComparingMethod(); TMLComparingMethod comp = new TMLComparingMethod();
if (!comp.isHwNodeListEquals(hwnodes, that.hwnodes)) if (!comp.isHwNodeListEquals(hwnodes, that.hwnodes)) return false;
return false;
if (!comp.isHwlinkListEquals(hwlinks, that.hwlinks)) if(!comp.isHwlinkListEquals(hwlinks, that.hwlinks)) return false;
return false;
return masterClockFrequency == that.masterClockFrequency; return masterClockFrequency == that.masterClockFrequency;
} }
public List<HwNode> getBUSs() {
List<HwNode> buss = new ArrayList<HwNode>();
for (HwNode node : hwnodes) {
if (node instanceof HwBus) {
buss.add(node);
}
}
return buss;
}
public List<HwMemory> getMemories() {
List<HwMemory> list = new ArrayList<HwMemory>();
for (HwNode node : hwnodes) {
if (node instanceof HwMemory) {
HwMemory memory = (HwMemory) node;
list.add(memory);
}
}
return list;
}
public List<HwBridge> getHwBridge() {
List<HwBridge> bridgeList = new ArrayList<HwBridge>();
for (HwNode node : hwnodes) {
if (node instanceof HwBridge) {
HwBridge bridge = (HwBridge) node;
bridgeList.add(bridge);
}
}
return bridgeList;
}
} }
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
* knowledge of the CeCILL license and that you accept its terms. * knowledge of the CeCILL license and that you accept its terms.
*/ */
package tmltranslator; package tmltranslator;
import graph.AUTGraph; import graph.AUTGraph;
...@@ -54,7 +55,8 @@ import java.util.*; ...@@ -54,7 +55,8 @@ import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* Class TMLMapping Creation: 05/09/2007 * Class TMLMapping
* Creation: 05/09/2007
* *
* @author Ludovic APVRILLE, Andrea ENRICI * @author Ludovic APVRILLE, Andrea ENRICI
* @version 1.1 10/06/2014 * @version 1.1 10/06/2014
...@@ -63,7 +65,7 @@ public class TMLMapping<E> { ...@@ -63,7 +65,7 @@ public class TMLMapping<E> {
private TMLModeling<E> tmlm; private TMLModeling<E> tmlm;
private TMLArchitecture tmla; private TMLArchitecture tmla;
// private TMLCP tmlcp; // private TMLCP tmlcp;
// Mapping of tasks // Mapping of tasks
private List<HwExecutionNode> onnodes; private List<HwExecutionNode> onnodes;
...@@ -96,9 +98,11 @@ public class TMLMapping<E> { ...@@ -96,9 +98,11 @@ public class TMLMapping<E> {
private HashMap<HwNode, AUTState> nodesToStates; private HashMap<HwNode, AUTState> nodesToStates;
private ArrayList<AUTState> commNodes; private ArrayList<AUTState> commNodes;
// REFERENCES TO BE REMOVED!!!! :( // REFERENCES TO BE REMOVED!!!! :(
// private TMLComponentDesignPanel tmldp; //private TMLComponentDesignPanel tmldp;
// public TMLArchiPanel tmlap; //public TMLArchiPanel tmlap;
public TMLMapping(TMLModeling<E> _tmlm, TMLArchitecture _tmla, boolean reset) { public TMLMapping(TMLModeling<E> _tmlm, TMLArchitecture _tmla, boolean reset) {
...@@ -168,6 +172,7 @@ public class TMLMapping<E> { ...@@ -168,6 +172,7 @@ public class TMLMapping<E> {
listE = cl; listE = cl;
} }
public void addCustomValue(String custom) { public void addCustomValue(String custom) {
customValues.add(custom); customValues.add(custom);
} }
...@@ -176,7 +181,7 @@ public class TMLMapping<E> { ...@@ -176,7 +181,7 @@ public class TMLMapping<E> {
HwCPU cpu; HwCPU cpu;
HwMemory mem; HwMemory mem;
HwBus bus; HwBus bus;
HwLink link0;// , link1; HwLink link0;//, link1;
TMLTask t; TMLTask t;
TMLChannel ch; TMLChannel ch;
Iterator<TMLTask> iterator; Iterator<TMLTask> iterator;
...@@ -234,6 +239,7 @@ public class TMLMapping<E> { ...@@ -234,6 +239,7 @@ public class TMLMapping<E> {
} }
} }
// Verify that all channels are mapped at least on one bus // Verify that all channels are mapped at least on one bus
// and on one memory. Create the necessary hardware elements // and on one memory. Create the necessary hardware elements
// if they do not exist on the path which is suggested by already // if they do not exist on the path which is suggested by already
...@@ -249,7 +255,7 @@ public class TMLMapping<E> { ...@@ -249,7 +255,7 @@ public class TMLMapping<E> {
if (mem == null) { if (mem == null) {
} }
// TraceManager.addDev("Memory of channel " + ch + " is " + mem); //TraceManager.addDev("Memory of channel " + ch + " is " + mem);
} }
// Is there a memory? // Is there a memory?
...@@ -348,8 +354,8 @@ public class TMLMapping<E> { ...@@ -348,8 +354,8 @@ public class TMLMapping<E> {
onnodes = new ArrayList<HwExecutionNode>(); onnodes = new ArrayList<HwExecutionNode>();
oncommnodes = new ArrayList<HwCommunicationNode>(); oncommnodes = new ArrayList<HwCommunicationNode>();
mappedcommelts = new ArrayList<TMLElement>(); mappedcommelts = new ArrayList<TMLElement>();
// mappedCPs = new ArrayList<TMLCP>(); // mappedCPs = new ArrayList<TMLCP>();
// commEltsMappedOnCPs = new ArrayList<TMLElement>(); // commEltsMappedOnCPs = new ArrayList<TMLElement>();
mappedCPLibs = new ArrayList<TMLCPLib>(); mappedCPLibs = new ArrayList<TMLCPLib>();
customValues = new ArrayList<String>(); customValues = new ArrayList<String>();
} }
...@@ -402,6 +408,7 @@ public class TMLMapping<E> { ...@@ -402,6 +408,7 @@ public class TMLMapping<E> {
return tmla.getCPUandHwAIDs(); return tmla.getCPUandHwAIDs();
} }
public String[] getBusIDs() { public String[] getBusIDs() {
if (tmla == null) { if (tmla == null) {
return null; return null;
...@@ -434,6 +441,7 @@ public class TMLMapping<E> { ...@@ -434,6 +441,7 @@ public class TMLMapping<E> {
return tmlm.makeVariableIDs(index); return tmlm.makeVariableIDs(index);
} }
public void addTMLCPLib(TMLCPLib _tmlcplib) { public void addTMLCPLib(TMLCPLib _tmlcplib) {
mappedCPLibs.add(_tmlcplib); mappedCPLibs.add(_tmlcplib);
} }
...@@ -469,6 +477,7 @@ public class TMLMapping<E> { ...@@ -469,6 +477,7 @@ public class TMLMapping<E> {
return ret; return ret;
} }
public void addTaskToHwExecutionNode(TMLTask _task, HwExecutionNode _hwnode) { public void addTaskToHwExecutionNode(TMLTask _task, HwExecutionNode _hwnode) {
onnodes.add(_hwnode); onnodes.add(_hwnode);
mappedtasks.add(_task); mappedtasks.add(_task);
...@@ -529,6 +538,7 @@ public class TMLMapping<E> { ...@@ -529,6 +538,7 @@ public class TMLMapping<E> {
return mappedcommelts; return mappedcommelts;
} }
public TMLTask getTaskByName(String _name) { public TMLTask getTaskByName(String _name) {
return tmlm.getTMLTaskByName(_name); return tmlm.getTMLTaskByName(_name);
} }
...@@ -593,10 +603,10 @@ public class TMLMapping<E> { ...@@ -593,10 +603,10 @@ public class TMLMapping<E> {
if (elt == _ch) { if (elt == _ch) {
HwCommunicationNode node = oncommnodes.get(cpt); HwCommunicationNode node = oncommnodes.get(cpt);
if (node instanceof HwMemory) { if (node instanceof HwMemory) {
ret += node.getName() + " ; "; ret += node.getName() + " ; ";
} }
} }
cpt++; cpt ++;
} }
return ret; return ret;
} }
...@@ -618,6 +628,7 @@ public class TMLMapping<E> { ...@@ -618,6 +628,7 @@ public class TMLMapping<E> {
return onnodes.get(index); return onnodes.get(index);
} }
public void removeTask(TMLTask _task) { public void removeTask(TMLTask _task) {
int index = mappedtasks.indexOf(_task); int index = mappedtasks.indexOf(_task);
if (index > -1) { if (index > -1) {
...@@ -643,8 +654,7 @@ public class TMLMapping<E> { ...@@ -643,8 +654,7 @@ public class TMLMapping<E> {
public boolean isCommNodeMappedOn(TMLElement _channel, HwCommunicationNode _node) { public boolean isCommNodeMappedOn(TMLElement _channel, HwCommunicationNode _node) {
for (int i = 0; i < oncommnodes.size(); i++) { for (int i = 0; i < oncommnodes.size(); i++) {
if ((_node == null || oncommnodes.get(i) == _node) && mappedcommelts.get(i) == _channel) if ((_node == null || oncommnodes.get(i) == _node) && mappedcommelts.get(i) == _channel) return true;
return true;
} }
return false; return false;
} }
...@@ -710,8 +720,7 @@ public class TMLMapping<E> { ...@@ -710,8 +720,7 @@ public class TMLMapping<E> {
LinkedList<HwCommunicationNode> list = new LinkedList<HwCommunicationNode>(); LinkedList<HwCommunicationNode> list = new LinkedList<HwCommunicationNode>();
int index = 0; int index = 0;
for (TMLElement tmlelem : mappedcommelts) { for (TMLElement tmlelem : mappedcommelts) {
if (tmlelem == _elementToFind) if (tmlelem == _elementToFind) list.add(oncommnodes.get(index));
list.add(oncommnodes.get(index));
index++; index++;
} }
return list; return list;
...@@ -720,10 +729,8 @@ public class TMLMapping<E> { ...@@ -720,10 +729,8 @@ public class TMLMapping<E> {
public HwNode getHwNodeByTask(TMLTask cmpTask) { public HwNode getHwNodeByTask(TMLTask cmpTask) {
int i = 0; int i = 0;
for (TMLTask task : mappedtasks) { for (TMLTask task : mappedtasks) {
if (task == cmpTask) if (task == cmpTask) break;
break; else i++;
else
i++;
} }
return onnodes.get(i); return onnodes.get(i);
} }
...@@ -812,6 +819,7 @@ public class TMLMapping<E> { ...@@ -812,6 +819,7 @@ public class TMLMapping<E> {
return list; return list;
} }