diff --git a/src/main/java/syscamstranslator/toSysCAMS/TopCellGenerator.java b/src/main/java/syscamstranslator/toSysCAMS/TopCellGenerator.java index 07a99113fb6b29e7dc8cb43712af7a6969b8e326..ad82e10c6bffab4b538958bd8d16c7a2f2a8fae3 100644 --- a/src/main/java/syscamstranslator/toSysCAMS/TopCellGenerator.java +++ b/src/main/java/syscamstranslator/toSysCAMS/TopCellGenerator.java @@ -61,9 +61,12 @@ import java.util.LinkedList; public class TopCellGenerator { public static SysCAMSSpecification syscams; - private final static String GENERATED_PATH1 = "generated_CPP" + File.separator; - private final static String GENERATED_PATH2 = "generated_H" + File.separator; - + //private final static String GENERATED_PATH1 = "generated_CPP" + File.separator; + //private final static String GENERATED_PATH2 = "generated_H" + File.separator; + + private String GENERATED_PATH1 = "generated_CPP" + File.separator; + private String GENERATED_PATH2 = "generated_H" + File.separator; + public TopCellGenerator(SysCAMSSpecification sys) { syscams = sys; } @@ -94,12 +97,19 @@ public class TopCellGenerator { return (top); } - public void saveFile(String path) { + public void saveFile(String path, Boolean standalone) { SysCAMSTCluster cluster = TopCellGenerator.syscams.getCluster(); LinkedList<SysCAMSTConnector> connectors = TopCellGenerator.syscams.getAllConnectorCluster(); String top; + if(standalone){ + + GENERATED_PATH1 = ""; + GENERATED_PATH2 = ""; + } + + try { // Save file .cpp System.err.println(path + GENERATED_PATH1 + cluster.getClusterName() + ".cpp"); @@ -111,13 +121,19 @@ public class TopCellGenerator { ex.printStackTrace(); } // Save files .h - saveFileBlock(path, cluster); + saveFileBlock(path, cluster, standalone); } - public void saveFileBlock(String path, SysCAMSTCluster c) { + public void saveFileBlock(String path, SysCAMSTCluster c, Boolean standalone) { String headerTDF, headerDE, codeTDF, codeDE; LinkedList<SysCAMSTBlockTDF> tdf = c.getBlockTDF(); LinkedList<SysCAMSTBlockDE> de = c.getBlockDE(); + + if(standalone){ + + GENERATED_PATH1 = ""; + GENERATED_PATH2 = ""; + } for (SysCAMSTBlockTDF t : tdf) { try { diff --git a/src/main/java/syscamstranslator/toSysCAMSCluster/TopCellGeneratorCluster.java b/src/main/java/syscamstranslator/toSysCAMSCluster/TopCellGeneratorCluster.java index ccdc017d7be379f32c1fb7009b54b10c84c975f0..7f6a6282c93e5cad6f1d2bf345970cebf0a055e0 100644 --- a/src/main/java/syscamstranslator/toSysCAMSCluster/TopCellGeneratorCluster.java +++ b/src/main/java/syscamstranslator/toSysCAMSCluster/TopCellGeneratorCluster.java @@ -63,9 +63,10 @@ import java.util.LinkedList; public class TopCellGeneratorCluster { public static SysCAMSSpecification syscams; - private final static String GENERATED_PATH1 = "generated_CPP" + File.separator; - private final static String GENERATED_PATH2 = "generated_H" + File.separator; - + private String GENERATED_PATH1 = "generated_CPP" + File.separator; + private String GENERATED_PATH2 = "generated_H" + File.separator; + + public TopCellGeneratorCluster(SysCAMSSpecification sys) { syscams = sys; } @@ -96,12 +97,17 @@ public class TopCellGeneratorCluster { return (top); } - public void saveFile(String path) { + public void saveFile(String path, Boolean standalone) { SysCAMSTCluster cluster = TopCellGeneratorCluster.syscams.getCluster(); LinkedList<SysCAMSTConnector> connectors = TopCellGeneratorCluster.syscams.getAllConnectorsCluster4Soclib(); String top; + if(standalone){ + GENERATED_PATH1 = ""; + GENERATED_PATH2 = ""; + } + try { // Save file .cpp System.err.println(path + GENERATED_PATH1 + cluster.getClusterName() + "_tdf.h"); @@ -113,13 +119,18 @@ public class TopCellGeneratorCluster { ex.printStackTrace(); } // Save files .h - saveFileBlock(path, cluster); + saveFileBlock(path, cluster, standalone); } - public void saveFileBlock(String path, SysCAMSTCluster c) { + public void saveFileBlock(String path, SysCAMSTCluster c, Boolean standalone) { String headerTDF, headerDE, codeTDF, codeDE; LinkedList<SysCAMSTBlockTDF> tdf = c.getBlockTDF(); LinkedList<SysCAMSTBlockDE> de = c.getBlockDE(); + + if(standalone){ + GENERATED_PATH1 = ""; + GENERATED_PATH2 = ""; + } for (SysCAMSTBlockTDF t : tdf) { try { diff --git a/src/main/java/syscamstranslator/toSysCAMS_soclib/ClusterCodeSoclib.java b/src/main/java/syscamstranslator/toSysCAMSSoclib/ClusterCodeSoclib.java similarity index 100% rename from src/main/java/syscamstranslator/toSysCAMS_soclib/ClusterCodeSoclib.java rename to src/main/java/syscamstranslator/toSysCAMSSoclib/ClusterCodeSoclib.java diff --git a/src/main/java/syscamstranslator/toSysCAMS_soclib/HeaderSoclib.java b/src/main/java/syscamstranslator/toSysCAMSSoclib/HeaderSoclib.java similarity index 100% rename from src/main/java/syscamstranslator/toSysCAMS_soclib/HeaderSoclib.java rename to src/main/java/syscamstranslator/toSysCAMSSoclib/HeaderSoclib.java diff --git a/src/main/java/syscamstranslator/toSysCAMS_soclib/MakefileCodeSoclib.java b/src/main/java/syscamstranslator/toSysCAMSSoclib/MakefileCodeSoclib.java similarity index 100% rename from src/main/java/syscamstranslator/toSysCAMS_soclib/MakefileCodeSoclib.java rename to src/main/java/syscamstranslator/toSysCAMSSoclib/MakefileCodeSoclib.java diff --git a/src/main/java/syscamstranslator/toSysCAMS_soclib/PrimitiveCodeSoclib.java b/src/main/java/syscamstranslator/toSysCAMSSoclib/PrimitiveCodeSoclib.java similarity index 100% rename from src/main/java/syscamstranslator/toSysCAMS_soclib/PrimitiveCodeSoclib.java rename to src/main/java/syscamstranslator/toSysCAMSSoclib/PrimitiveCodeSoclib.java diff --git a/src/main/java/syscamstranslator/toSysCAMS_soclib/TopCellGeneratorSoclib.java b/src/main/java/syscamstranslator/toSysCAMSSoclib/TopCellGeneratorSoclib.java similarity index 90% rename from src/main/java/syscamstranslator/toSysCAMS_soclib/TopCellGeneratorSoclib.java rename to src/main/java/syscamstranslator/toSysCAMSSoclib/TopCellGeneratorSoclib.java index 292785e9c9aa1533221fd8bc174875b36958e25c..3a203848ca159fb1ac1bed4764910594cddb1e78 100644 --- a/src/main/java/syscamstranslator/toSysCAMS_soclib/TopCellGeneratorSoclib.java +++ b/src/main/java/syscamstranslator/toSysCAMSSoclib/TopCellGeneratorSoclib.java @@ -61,9 +61,11 @@ import java.util.LinkedList; public class TopCellGeneratorSoclib { public static SysCAMSSpecification syscams; - private final static String GENERATED_PATH1 = "generated_CPP" + File.separator; - private final static String GENERATED_PATH2 = "generated_H" + File.separator; - + + private String GENERATED_PATH1 = "generated_CPP" + File.separator; + private String GENERATED_PATH2 = "generated_H" + File.separator; + + public TopCellGeneratorSoclib(SysCAMSSpecification sys) { syscams = sys; } @@ -94,15 +96,21 @@ public class TopCellGeneratorSoclib { return (top); } - public void saveFile(String path) { + public void saveFile(String path, Boolean standalone) { SysCAMSTCluster cluster = TopCellGeneratorSoclib.syscams.getCluster(); LinkedList<SysCAMSTConnector> connectors = TopCellGeneratorSoclib.syscams.getAllConnectorCluster(); String top; + if(standalone){ + GENERATED_PATH1 = ""; + GENERATED_PATH2 = ""; + } + try { // Save file .cpp - System.err.println(path + GENERATED_PATH1 + cluster.getClusterName() + "_tdf.h"); + + System.err.println(path + GENERATED_PATH1 + cluster.getClusterName() + "_tdf.h"); FileWriter fw = new FileWriter(path + GENERATED_PATH1 + "/" + cluster.getClusterName() + "_tdf.h"); top = generateTopCell(cluster, connectors); fw.write(top); @@ -114,10 +122,15 @@ public class TopCellGeneratorSoclib { saveFileBlock(path, cluster); } - public void saveFileBlock(String path, SysCAMSTCluster c) { + public void saveFileBlock(String path, SysCAMSTCluster c, Boolean standalone) { String headerTDF, headerDE, codeTDF, codeDE; LinkedList<SysCAMSTBlockTDF> tdf = c.getBlockTDF(); LinkedList<SysCAMSTBlockDE> de = c.getBlockDE(); + + if(standalone){ + GENERATED_PATH1 = ""; + GENERATED_PATH2 = ""; + } for (SysCAMSTBlockTDF t : tdf) { try { diff --git a/src/main/java/ui/window/JDialogSysCAMSExecutableCodeGeneration.java b/src/main/java/ui/window/JDialogSysCAMSExecutableCodeGeneration.java index c5c80dd0739270ae2bfee31a50ececaca37d6352..8fc324ade520c32f01175912aac7a5f8ba4d955b 100644 --- a/src/main/java/ui/window/JDialogSysCAMSExecutableCodeGeneration.java +++ b/src/main/java/ui/window/JDialogSysCAMSExecutableCodeGeneration.java @@ -509,6 +509,8 @@ public class JDialogSysCAMSExecutableCodeGeneration extends javax.swing.JFrame i // String list;//, data; hasError = false; + Boolean standalone = true; //are there any GPIO blocks? + try { if (jp1.getSelectedIndex() == 0) { Vector<SysCAMSComponentTaskDiagramPanel> syscamsDiagramPanels = mgui.getListSysCAMSPanel(); @@ -540,6 +542,9 @@ public class JDialogSysCAMSExecutableCodeGeneration extends javax.swing.JFrame i } for(SysCAMSTBlockGPIO2VCI gpioBlock : gpioBlocks) { nbPorts += gpioBlock.getPortDE().size(); + standalone=false; + + } if(nbPorts != (allConnectors.size()*2)) { jta.append("Error: There are unconnected ports.\n"); @@ -676,8 +681,8 @@ public class JDialogSysCAMSExecutableCodeGeneration extends javax.swing.JFrame i pathCode = code2.getText(); System.err.println("SYSCAMS TOPCELL : " + syscalsspec.getCluster().getClusterName() + "saved in " + code2.getText()); - topCellGenerator.saveFile(pathCode); - topCellGeneratorCluster.saveFile(pathCode); + topCellGenerator.saveFile(pathCode,standalone); + topCellGeneratorCluster.saveFile(pathCode,standalone); jta.append("Code saved\n"); } catch (Exception e) {