diff --git a/src/tmltranslator/HwExecutionNode.java b/src/tmltranslator/HwExecutionNode.java index 7df8df5b042bb23e0b7bb5dc69310c46851a65b7..8224b0f43ac13dc2c8ed03b0dff8519e288619f7 100755 --- a/src/tmltranslator/HwExecutionNode.java +++ b/src/tmltranslator/HwExecutionNode.java @@ -57,11 +57,9 @@ public abstract class HwExecutionNode extends HwNode { public static final int DEFAULT_EXECC_TIME = 1; public int execcTime = DEFAULT_EXECC_TIME; - private TaskMEC mec; - - public HwExecutionNode(String _name) { + public HwExecutionNode(String _name) { super(_name); - } + } public abstract String getType(); @@ -72,9 +70,5 @@ public abstract class HwExecutionNode extends HwNode { public int getExeccTime() { return execcTime; } - - public void addMECToHwExecutionNode( TaskMEC _mec ) { - mec = _mec; - } } diff --git a/src/tmltranslator/HwNode.java b/src/tmltranslator/HwNode.java index f51bafaf93bad028371472edcb61d78bcbebebad..53dc9d7d74ae18f0e232d345319999bb1fe82a88 100755 --- a/src/tmltranslator/HwNode.java +++ b/src/tmltranslator/HwNode.java @@ -46,13 +46,15 @@ knowledge of the CeCILL license and that you accept its terms. package tmltranslator; import java.util.*; +import tmltranslator.ctranslator.*; public abstract class HwNode extends DIPLOElement { public static final int DEFAULT_CLOCK_RATIO = 1; - protected int maximumNbOfMappedElement; + protected int maximumNbOfMappedElement; protected String name; + protected TaskMEC mec; public int clockRatio = DEFAULT_CLOCK_RATIO; /* 2 means 1 cycle out of 2, etc. */ @@ -63,5 +65,13 @@ public abstract class HwNode extends DIPLOElement { public String getName() { return name; } + + public void addMECToHwExecutionNode( TaskMEC _mec ) { + mec = _mec; + } + + public TaskMEC getTaskMEC() { + return mec; + } -} \ No newline at end of file +} diff --git a/src/tmltranslator/ctranslator/CPUMEC.java b/src/tmltranslator/ctranslator/CPUMEC.java new file mode 100644 index 0000000000000000000000000000000000000000..acc01b4639c185e7ed8a647bc737636f96fb5534 --- /dev/null +++ b/src/tmltranslator/ctranslator/CPUMEC.java @@ -0,0 +1,66 @@ +/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille, Andrea Enrici + + ludovic.apvrille AT enst.fr + andrea.enrici AT enstr.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 CPUMEC, Model Extension Construct (MEC) class for Embb non-cachable CPU operation + * Creation: 05/02/2014 + * @version 1.0 05/02/2014 + * @author Andrea ENRICI + * @see + */ + +package tmltranslator.ctranslator;; + +import java.util.*; + +public class CPUMEC extends TaskMEC { + + protected String addr = ""; + + public CPUMEC() { + node_type = "CPU"; + inst_type = "CPUoperation"; + inst_decl = "VOID"; + buff_type = "MM_BUFF_TYPE"; + buff_init = "VOID"; + exec_code = "embb_mem_read_32( (uint32_t) /*USER TO DO: ADDRESS*/ );"; + init_code = "VOID"; + cleanup_code = "VOID"; + } + +} //End of class diff --git a/src/tmltranslator/ctranslator/Operation.java b/src/tmltranslator/ctranslator/Operation.java index df22b7993152d979c3a7bb85835f0e3b11654bf9..72d9c17882a4bbc83947cd8ebd486c238c1e135a 100755 --- a/src/tmltranslator/ctranslator/Operation.java +++ b/src/tmltranslator/ctranslator/Operation.java @@ -163,13 +163,33 @@ public class Operation { public String toString() { if( ( inSignal != null ) && ( outSignal != null ) ) { - return "OPERATION " + name + "\n\t" + inSignal.getName() + "\n\t" + outSignal.getName() + "\n\t" + xHwNode.getName() + "\n\t" + fHwNode.getName() + "\n\t" + inBuffer.toString() + "\n\t" + outBuffer.toString(); + return "OPERATION " + name + "\n\t" + + "inSignal: " + inSignal.getName() + "\n\t" + + "outSignal: " + outSignal.getName() + "\n\t" + + "X task HwExecutionNode: " + xHwNode.getName() + "\n\t" + + "X task MEC: " + xHwNode.getTaskMEC().toString() + "\n\t" + + "F task HwExecutionNode: " + fHwNode.getName() + "\n\t" + + "F task MEC: " + fHwNode.getTaskMEC().toString() + "\n\t" + + "inBuffer: " + inBuffer.toString() + "\n\t" + + "outBuffer: " + outBuffer.toString(); } else if( inSignal == null ) { - return "OPERATION " + name + "\n\t" + outSignal.getName() + "\n\t" + xHwNode.getName() + "\n\t" + fHwNode.getName() + "\n\t" + outBuffer.toString(); + return "OPERATION " + name + "\n\t" + + "outSignal: " + outSignal.getName() + "\n\t" + + "X task HwExecutionNode: " + xHwNode.getName() + "\n\t" + + "X task MEC: " + xHwNode.getTaskMEC().toString() + "\n\t" + + "F task HwExecutionNode: " + fHwNode.getName() + "\n\t" + + "F task MEC: " + fHwNode.getTaskMEC().toString() + "\n\t" + + "outBuffer: " + outBuffer.toString(); } else if( outSignal == null ) { - return "OPERATION " + name + "\n\t" + inSignal.getName() + "\n\t" + xHwNode.getName() + "\n\t" + fHwNode.getName() + "\n\t" + inBuffer.toString(); + return "OPERATION " + name + "\n\t" + + "inSignal: " + inSignal.getName() + "\n\t" + + "X task HwExecutionNode: " + xHwNode.getName() + "\n\t" + + "X task MEC: " + xHwNode.getTaskMEC().toString() + "\n\t" + + "F task HwExecutionNode: " + fHwNode.getName() + "\n\t" + + "F task MEC: " + fHwNode.getTaskMEC().toString() + "\n\t" + + "inBuffer: " + inBuffer.toString(); } return "void OPERATION"; } diff --git a/src/tmltranslator/ctranslator/TMLCCodeGeneration.java b/src/tmltranslator/ctranslator/TMLCCodeGeneration.java index d4444b0bbd62a8fef9d1c22cd21a90b879afd0a4..694feac0a545484dfd2fbfd1c2509b774b68a65f 100755 --- a/src/tmltranslator/ctranslator/TMLCCodeGeneration.java +++ b/src/tmltranslator/ctranslator/TMLCCodeGeneration.java @@ -47,6 +47,9 @@ package tmltranslator.ctranslator;; import java.util.*; +import java.io.PrintWriter; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; import java.nio.*; import javax.swing.*; import javax.swing.event.*; @@ -54,6 +57,7 @@ import myutil.*; import tmltranslator.*; import ui.tmlcompd.*; +import ui.ConfigurationTTool; public class TMLCCodeGeneration { @@ -91,6 +95,9 @@ public class TMLCCodeGeneration { private ArrayList<Buffer> buffersList = new ArrayList<Buffer>(); private ArrayList<Buffer> buffersList2 = new ArrayList<Buffer>(); + private String fileName = ConfigurationTTool.CcodeDirectory; + PrintWriter outputStream; + public JFrame frame; //Main Frame public TMLCCodeGeneration( String _title, String _applicationName, JFrame _frame ) { @@ -130,9 +137,13 @@ public class TMLCCodeGeneration { makeOperationsList( mappedTasks ); //make the list of operations based on the tasks in the app model - /*for( Operation op: operationsList ) { + openDebugFile(); + + for( Operation op: operationsList ) { TraceManager.addDev( op.toString() ); - }*/ + appendToDebugFile( op.toString() + CR ); + } + closeDebugFile(); makeBuffersList(); @@ -1321,4 +1332,24 @@ public class TMLCCodeGeneration { FileUtils.saveFile( path + filename + ".c", programString ); FileUtils.saveFile( path + filename + "_init.c", initString ); } + + private void openDebugFile() { + outputStream = null; + try { + outputStream = new PrintWriter( new FileOutputStream( fileName, true ) ); + } + catch( FileNotFoundException e ) { + System.out.println( "Error opening file " + fileName ); + System.exit(0); + } + } + + private void appendToDebugFile( String s ) { + outputStream.println( s ); + } + + private void closeDebugFile() { + outputStream.close(); + } + } //End of class diff --git a/src/tmltranslator/ctranslator/TaskMEC.java b/src/tmltranslator/ctranslator/TaskMEC.java index 971ea233898f9e0959d34d7ccec7d01b37af556c..2a82dbbb7d69edb0103ff2a0e175149b906d737a 100755 --- a/src/tmltranslator/ctranslator/TaskMEC.java +++ b/src/tmltranslator/ctranslator/TaskMEC.java @@ -81,7 +81,7 @@ public abstract class TaskMEC { } public String toString() { - return node_type + CR + inst_decl + CR + inst_type + CR + buff_type + CR + buff_init + CR + exec_code + CR + init_code + CR + cleanup_code; + return node_type;// + CR + inst_decl + CR + inst_type + CR + buff_type + CR + buff_init + CR + exec_code + CR + init_code + CR + cleanup_code; } public void saveFile( String path, String filename ) throws FileException { diff --git a/src/ui/GTMLModeling.java b/src/ui/GTMLModeling.java index ac89d3a16afaa3d535cf4e2801850a664901aa3e..48a964756378a4b4064b9cdfac21dbd5ede3fb42 100755 --- a/src/ui/GTMLModeling.java +++ b/src/ui/GTMLModeling.java @@ -2809,12 +2809,8 @@ public class GTMLModeling { for(TMLArchiArtifact artifact:artifacts) { s = artifact.getReferenceTaskName() + "__" + artifact.getTaskName(); TraceManager.addDev( "Exploring " + s ); - TaskMEC p = artifact.getMECofTask(); - String op = artifact.getOperation(); - /*if( p != null ) { - TraceManager.addDev( "MEC of task " + s + " is " + p.toString() ); - TraceManager.addDev( "Operation: " + op ); - }*/ + /*TaskMEC p = artifact.getMECofTask(); + String op = artifact.getOperation();*/ s = s.replaceAll("\\s", ""); //TraceManager.addDev("name=" + s); ttask = tmlm.getTMLTaskByName(s); @@ -2955,11 +2951,8 @@ public class GTMLModeling { //TraceManager.addDev("Exploring artifact " + artifact.getValue()); s = artifact.getReferenceTaskName(); TaskMEC mec = artifact.getMECofTask(); + TraceManager.addDev( "Artifact.getMECOfTask: " + mec ); String op = artifact.getOperation(); - /*if( mec != null ) { - TraceManager.addDev( "MEC of Task " + s + " is " + mec.toString() ); - TraceManager.addDev( "Operation: " + op ); - }*/ TraceManager.addDev("1) Trying to get task named:" + s); s = s.replaceAll("\\s", ""); TraceManager.addDev("2) Trying to get task named:" + s); @@ -2970,8 +2963,10 @@ public class GTMLModeling { if( op != null ) { task.addMappedOperation( op ); } - map.addTaskToHwExecutionNode(task, (HwExecutionNode)node); ((HwExecutionNode)node).addMECToHwExecutionNode( mec ); + map.addTaskToHwExecutionNode(task, (HwExecutionNode)node); + TraceManager.addDev( "TaskMEC from class: " + node.getTaskMEC() ); + TraceManager.addDev( "TaskMEC from DS: " + map.getHwNodeOf( task ).getTaskMEC() ); } else { TraceManager.addDev("Null task"); } diff --git a/src/ui/GTURTLEModeling.java b/src/ui/GTURTLEModeling.java index eff92b13ad3cdd1dd793817748659eaa9530654f..428e2947427c8678dfd0e0b6f3a5c7bd1211f9af 100755 --- a/src/ui/GTURTLEModeling.java +++ b/src/ui/GTURTLEModeling.java @@ -75,6 +75,7 @@ import ui.sd.*; import ui.ucd.*; import ui.tree.*; import ui.window.*; +import ui.ConfigurationTTool; // AVATAR import ui.avatardd.*; diff --git a/src/ui/tmldd/TMLArchiArtifact.java b/src/ui/tmldd/TMLArchiArtifact.java index 89e5f83f8ed86c663ecb2f1a1315a2ef9dbed51a..79a6cddee93511627140a25977623a88bb743d9b 100755 --- a/src/ui/tmldd/TMLArchiArtifact.java +++ b/src/ui/tmldd/TMLArchiArtifact.java @@ -339,13 +339,16 @@ public class TMLArchiArtifact extends TGCWithoutInternalComponent implements Swa } } else if( fatherMECType.equals( "MAPPER" ) ) { - return null; + return new MapperMEC( "", "", "", "" ); } else if( fatherMECType.equals( "INTL" ) ) { - return null; + return new InterleaverMEC( "", "", "", "" ); } else if( fatherMECType.equals( "ADAIF" ) ) { - return null; + return new AdaifMEC( "", "", "", "" ); + } + else if( fatherMECType.equals( "CPU" ) ) { + return new CPUMEC(); } return null; }