diff --git a/src/tmltranslator/tomappingsystemc2/MappedSystemCTask.java b/src/tmltranslator/tomappingsystemc2/MappedSystemCTask.java index 33192cd433f3ac20456f023a67dc77f75e159cdc..ecb7530bc9c1e2c94225f8cb4f9cc69767c3f9a7 100755 --- a/src/tmltranslator/tomappingsystemc2/MappedSystemCTask.java +++ b/src/tmltranslator/tomappingsystemc2/MappedSystemCTask.java @@ -985,23 +985,23 @@ public class MappedSystemCTask { //Channels, Events, Requests, Variables, Choice, Random id=Math.abs(id); for (TMLChannel channel: channels){ - if (channel.getID()==id) return reference + ":" + channel.getName(); + if (channel.getID()==id) return channel.getName(); } for (TMLEvent event: events){ - if (event.getID()==id) return reference + ":" + event.getName(); + if (event.getID()==id) return event.getName(); int param = Integer.MAX_VALUE - 3 * event.getID() - id + 1; - if (param>0 && param<4) return reference + ":" + event.getName() + "_param " + param; + if (param>0 && param<4) return event.getName() + "_param" + param; } for (TMLRequest request: requests){ - if (request.getID()==id) return reference + ":" + request.getName(); + if (request.getID()==id) return request.getName(); int param = Integer.MAX_VALUE - 3 * request.getID() - id +1; - if (param>0 && param<4) return reference + ":" + request.getName() + "_param " + param; + if (param>0 && param<4) return request.getName() + "_param!" + param; } for(TMLAttribute att: task.getAttributes()){ if (att.getID()==id) return reference + ":" + att.getName(); } for(int i=0; i<task.getActivityDiagram().nElements();i++) - if (task.getActivityDiagram().get(i).getID()==id) return reference + ": Command " + id; + if (task.getActivityDiagram().get(i).getID()==id) return reference + ":Command " + id; return null; } @@ -1017,9 +1017,6 @@ public class MappedSystemCTask { } private int getVarIDByName(String attName){ - for(TMLAttribute att: task.getAttributes()) { - if (att.name.equals(attName)) return att.getID(); - } if (task.isRequested()) { if (attName.equals("arg1__req")){ return Integer.MAX_VALUE - 3*task.getRequest().getID(); @@ -1029,6 +1026,9 @@ public class MappedSystemCTask { return Integer.MAX_VALUE - 3*task.getRequest().getID()-2; } } + for(TMLAttribute att: task.getAttributes()) { + if (att.name.equals(attName)) return att.getID(); + } return -1; } diff --git a/src/tmltranslator/tomappingsystemc2/TML2MappingSystemC.java b/src/tmltranslator/tomappingsystemc2/TML2MappingSystemC.java index 9ef9fe650124fbcf0b9a14de1406b2578a9e757c..e7e001c197e2d3104e54510cf0450775e5ca9e90 100755 --- a/src/tmltranslator/tomappingsystemc2/TML2MappingSystemC.java +++ b/src/tmltranslator/tomappingsystemc2/TML2MappingSystemC.java @@ -111,7 +111,6 @@ public class TML2MappingSystemC { public void generateSystemC(boolean _debug, boolean _optimize) { debug = _debug; optimize = _optimize; - //visitedVars.clear(); dependencies.clear(); tmlmodeling = tmlmapping.getTMLModeling(); tasks = new ArrayList<MappedSystemCTask>(); @@ -119,17 +118,15 @@ public class TML2MappingSystemC { generateEBRDDs(); generateMainFile(); generateMakefileSrc(); - System.out.println("********** Before optimization **********"); - printDependencies(); + System.out.println("********** All identified objects and their dependencies: **********"); + printDependencies(false); HashSet<Integer> keys = new HashSet<Integer>(dependencies.keySet()); for(int elemID: keys){ - //HashSet<Integer> newSet = new HashSet<Integer>(); - //if (!visitedVars.contains(elemID)) visitedVars.clear(); eliminateStateVars(elemID, null); } - System.out.println("********** After optimization **********"); - printDependencies(); + System.out.println("********** System state variables and their dependency on indeterministic operators **********"); + printDependencies(true); } private void generateMainFile() { @@ -555,12 +552,14 @@ public class TML2MappingSystemC { return null; } - private void printDependencies(){ + private void printDependencies(boolean onlyState){ for(int elemID:dependencies.keySet()){ - System.out.println(getIdentifierNameByID(elemID) + " depends on:"); - HashSet<Integer> deps = dependencies.get(elemID); - for (int dep: deps){ - System.out.println(" " + getIdentifierNameByID(dep)); + if (!onlyState || elemID < Integer.MAX_VALUE/2){ + System.out.println(getIdentifierNameByID(elemID) + " depends on:"); + HashSet<Integer> deps = dependencies.get(elemID); + for (int dep: deps){ + System.out.println(" " + getIdentifierNameByID(dep)); + } } } System.out.println("");