Commit 43defb3a authored by Come Demarigny [l3]'s avatar Come Demarigny [l3]
Browse files

ajout system C-AMS

parent 0c616996
/* 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.
*/
package heterogeneoustranslator.systemCAMStranslator;
import javax.swing.*;
import java.awt.*;
import java.util.LinkedList;
import java.util.Vector;
import ui.*;
/**
* Class CAMSBlocks
* Simulation Block for SystemC-AMS Diagrams
* Creation: 28/08/2017
* @version 1.0 28/08/2017
* @author Côme DEMARIGNY
*/
public class CAMSBlocks{
private String name;
private int nbOfIn;
private int nbOfOut;
private int nbOfHybridIn;
private int nbOfHybridOut;
private LinkedList<TAttribute> myAttributes;
private LinkedList<CAMSSignal> mySignals;
private String [] processCode;
public CAMSBlocks(String _name, int _nbOfIn, int _nbOfOut, int _nbOfHybridIn, int _nbOfHybridOut, LinkedList<TAttribute> _myAttributes, LinkedList<CAMSSignal> _mySignals, String [] _processCode){
name=_name;
nbOfIn=_nbOfIn;
nbOfOut=_nbOfOut;
nbOfHybridIn=_nbOfHybridIn;
nbOfHybridOut=_nbOfHybridOut;
myAttributes=_myAttributes;
mySignals=_mySignals;
processCode=_processCode;
}
public void setBlockName(String newName){
name = newName;
}
public void setNbOfIn(int newIn){
nbOfIn = newIn;
}
public void setNbOfOut(int newOut){
nbOfOut = newOut;
}
public void setNbOfHybridIn(int newIn){
nbOfHybridIn = newIn;
}
public void setNbOfHybridOut(int newOut){
nbOfHybridOut = newOut;
}
public void setMyAttributes(LinkedList<TAttribute> newMyAttributes){
myAttributes = newMyAttributes;
}
public void setMySignals(LinkedList<CAMSSignal> newMySignals){
mySignals = newMySignals;
}
public void setProcessCode(String[] newProcessCode){
processCode = newProcessCode;
}
public String getBlockName(){
return name;
}
public int getNbOfIn() {
return nbOfIn;
}
public int getNbOfOut() {
return nbOfOut;
}
public int getNbOfHybridIn() {
return nbOfHybridIn;
}
public int getNbOfHybridOut() {
return nbOfHybridOut;
}
public int getTotalIn() {
return nbOfIn + nbOfHybridIn;
}
public int getTotalOut() {
return nbOfOut + nbOfHybridOut;
}
public LinkedList<TAttribute> getMyAttributes(){
return myAttributes;
}
public LinkedList<CAMSSignal> getMySignals(){
return mySignals;
}
public String[] getProcessCode(){
return processCode;
}
}
\ No newline at end of file
/* 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.
*/
package heterogeneoustranslator.systemCAMStranslator;
import javax.swing.*;
import java.awt.*;
import java.util.LinkedList;
import java.util.Vector;
import ui.*;
/**
* Class CAMSConnection
* Connection beetwen blocks for SystemC-AMS Diagrams
* Creation: 30/08/2017
* @version 1.0 30/08/2017
* @author Côme DEMARIGNY
*/
public class CAMSConnection{
public String name;
public CAMSBlocks inputBlock, outputBlock;
public int rate;
public int type;
public CAMSConnection(CAMSBlocks _inputBlock, CAMSBlock _outputBlock){
inputBlock = _inputBlock;
outputBlock = _outputBlock;
}
public CAMSBlock getInputBlock(){
return inputBlock;
}
public CAMSBlock getOutputBlock(){
return outputBlock;
}
}
\ No newline at end of file
/* 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.
*/
package heterogeneoustranslator.systemCAMStranslator;
import myutil.GraphicLib;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import ui.*;
import ui.het.*;
import ui.util.IconManager;
import ui.window.JDialogCAMSBlocks;
import javax.swing.*;
import java.awt.*;
import java.util.LinkedList;
import java.util.Vector;
/**
* Class CAMSSignal
* Signals for SystemC-AMS Diagrams
* Creation: 27/06/2017
* @version 1.0 27/06/2017
* @author Côme DEMARIGNY
*/
public class CAMSSignal {
public final static int IN = 0;
public final static int OUT= 1;
public final static int HYBRID_IN = 2;
public final static int HYBRID_OUT= 3;
public final static int INCORRECT=-1;
private static int i=0;
private String name;
public int inout;
public CAMSSignal (String _name, int _inout) {
inout = _inout;
}
public CAMSSignal makeclone(){
return this;
}
public static CAMSSignal isAValidSignal(String _name, int _inout) {
if (_inout==INCORRECT) {
return null;
}
String s = signalName(_name);
CAMSSignal cs = new CAMSSignal(s, _inout);
return cs;
}
public int getInout(){
return inout;
}
public static String signalName(String _n){
String s="";
s+= _n + ": " + signalID();
return s;
}
public static int signalID(){i++;return i;}
}
\ No newline at end of file
/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
* Daniela Genius, Lip6, UMR 7606
*
* ludovic.apvrille AT enst.fr
* daniela.genius@lip6.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.
*/
/* * @version 1.0 04/09/2017
* @author Côme Demarigny */
package heterogeneoustranslator.systemCAMStranslator;
import java.util.LinkedList;
import java.util.List;
public class CAMSSpecification{
private List<CAMSBlocks> blocks;
private List<CAMSSignal> signals;
private List<CAMSConnection> connections;
public CAMSSpecification( List<CAMSBlocks> _blocks, List<CAMSSignal> _signals, List<CAMSConnection> _connections, int _nb_target, int _nb_init){
blocks = _blocks ;
signals = _signals ;
connections = _connections ;
nb_target = _nb_target;
nb_init = _nb_init;
}
public List<CAMSBlock> getBlock(){
return blocks;
}
public List<CAMSSignals> getSignals(){
return signals;
}
public List<CAMSConnection> getConnection(){
return connections;
}
public List<CAMSBlocks> getUnconnectedBlocks(){
List<CAMSBlocks> unconnectedBlocks;
for(CAMSBlocks block : blocks){
for(CAMSConnections connection : connections){
if (block == connection.getInputBlock() || block == connection.getOutputBlock()){
break;
}
else {
unconnectedBlocks.add(block);
}
}
}
return unconnectedBlocks;
}
public list<CAMSSignals> getunconnectedSignals(){
list<CAMSSignals> unconnectedSignals;
return unconnectedSignals;
}
}
......@@ -839,8 +839,8 @@ public class ActionPerformer {
mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.TMLARCHI_BRIDGENODE);
} else if (command.equals(mgui.actions[TGUIAction.TMLARCHI_HWANODE].getActionCommand())) {
mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.TMLARCHI_HWANODE);
//} else if (command.equals(mgui.actions[TGUIAction.TMLARCHI_CAMSNODE].getActionCommand())) {
//mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.TMLARCHI_CAMSNODE);
} else if (command.equals(mgui.actions[TGUIAction.TMLARCHI_CAMSNODE].getActionCommand())) {
mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.TMLARCHI_CAMSNODE);
} else if (command.equals(mgui.actions[TGUIAction.TMLARCHI_MEMORYNODE].getActionCommand())) {
mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.TMLARCHI_MEMORYNODE);
} else if (command.equals(mgui.actions[TGUIAction.TMLARCHI_DMANODE].getActionCommand())) {
......@@ -895,12 +895,12 @@ public class ActionPerformer {
mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.TMLSD_ACTION_STATE);
//SystemC AMS
/*} else if (command.equals(mgui.actions[TGUIAction.CAMS_EDIT].getActionCommand())) {
} else if (command.equals(mgui.actions[TGUIAction.CAMS_EDIT].getActionCommand())) {
mgui.actionOnButton(TGComponentManager.EDIT, -1);
} else if (command.equals(mgui.actions[TGUIAction.CAMS_BLOCK].getActionCommand())) {
mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.CAMS_BLOCK);
} else if (command.equals(mgui.actions[TGUIAction.CAMS_CONNECTOR].getActionCommand())) {
mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.CAMS_CONNECTOR);*/
mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.CAMS_CONNECTOR);
// Attack Tree Diagrams
} else if (command.equals(mgui.actions[TGUIAction.ATD_BLOCK].getActionCommand())) {
......
......@@ -120,7 +120,7 @@ import ui.tmlcompd.*;
import ui.tmlcp.TMLCPPanel;
import ui.tmldd.*;
import ui.tmlsd.TMLSDPanel;
//import ui.het.*;
import ui.het.*;
import ui.tree.GraphTree;
import ui.tree.InvariantDataTree;
import ui.tree.SearchTree;
......@@ -6053,7 +6053,7 @@ public class GTURTLEModeling {
}
}
/*} else if (tdp instanceof CAMSBlockDiagramPanel) { //ajout CD 24.07----mark
} else if (tdp instanceof CAMSBlockDiagramPanel) { //ajout CD 24.07----mark
nl = doc.getElementsByTagName("CAMSBlockDiagramPanelCopy");
if (nl == null) {
......@@ -6081,7 +6081,7 @@ public class GTURTLEModeling {
camsp.structureChanged();
makePostLoading(camsp, beginIndex);
}
}*/
}
} else if (tdp instanceof AvatarADPanel) {
nl = doc.getElementsByTagName("AvatarADPanelCopy");
......@@ -6283,8 +6283,8 @@ public class GTURTLEModeling {
loadAvatarMethodology(node);
} else if (type.compareTo("Sysmlsec Methodology") == 0) {
loadSysmlsecMethodology(node);
/*} else if (type.compareTo("SystemC-AMS") == 0) {
loadSystemCAMS(node);*/
} else if (type.compareTo("SystemC-AMS") == 0) {
loadSystemCAMS(node);
} else if (type.compareTo("TML Design") == 0) {
loadTMLDesign(node);
} else if (type.compareTo("TML Component Design") == 0) {
......@@ -6789,7 +6789,7 @@ public class GTURTLEModeling {
}
}
/*public void loadSystemCAMS(Node node) throws MalformedModelingException, SAXException {
public void loadSystemCAMS(Node node) throws MalformedModelingException, SAXException {
Element elt = (Element) node;
String nameTab;
NodeList diagramNl;
......@@ -6815,7 +6815,7 @@ public class GTURTLEModeling {
}
}
}
}*/
}
public void loadTMLDesign(Node node) throws MalformedModelingException, SAXException {
Element elt = (Element) node;
......@@ -7086,10 +7086,10 @@ public class GTURTLEModeling {
((AvatarADPanel)tdp).setConnectorsToFront();
}
/*if (tdp instanceof CAMSBlockDiagramPanel) {
if (tdp instanceof CAMSBlockDiagramPanel) {
//TraceManager.addDev("Connectors...");
((CAMSBlockDiagramPanel)tdp).setConnectorsToFront();
}*/
}
}
// AVATAR
......@@ -8994,7 +8994,7 @@ public class GTURTLEModeling {
}
}
//public boolean checkSyntaxSystemCAMS(Vector<TGComponent> blocksToTakeIntoAccount, SystemCAMSPanel scp, boolean optimize) { //ajout CD 04/07 FIXME
public boolean checkSyntaxSystemCAMS(Vector<TGComponent> blocksToTakeIntoAccount, SystemCAMSPanel scp, boolean optimize) { //ajout CD 04/07 FIXME
// List<TMLError> warningsOptimize = new ArrayList<TMLError>();
// warnings = new LinkedList<CheckingError> ();
// mgui.setMode(MainGUI.VIEW_SUGG_DESIGN_KO);
......@@ -9023,9 +9023,9 @@ public class GTURTLEModeling {
// mgui.resetAllDIPLOIDs();
// listE.useDIPLOIDs();
// mgui.setMode(MainGUI.GEN_DESIGN_OK);
//return true;
return true;
// }
//}
}
public boolean checkSyntaxTMLMapping(Vector<TGComponent> nodesToTakeIntoAccount, TMLArchiPanel tmlap, boolean optimize) {
List<TMLError> warningsOptimize = new ArrayList<TMLError>();
......
......@@ -83,8 +83,9 @@ import ui.tmlcompd.TMLCCompositeComponent;
import ui.tmlcompd.TMLComponentTaskDiagramPanel;
import ui.tmlcp.TMLCPPanel;
import ui.tmldd.TMLArchiDiagramPanel;
import ui.tmldd.TMLArchiCAMSNode;
import ui.tmlsd.TMLSDPanel;
//import ui.het.*;
import ui.het.*;
import ui.tree.DiagramTreeModel;
import ui.tree.DiagramTreeRenderer;
import ui.tree.JDiagramTree;
......@@ -989,8 +990,8 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe
//ystem.out.println("Design added");
return index;
}
/*public int addSystemCAMSPanel(String name, int index) { //ajout CD -----Mark
public int addSystemCAMSPanel(String name, int index) { //ajout CD -----Mark
if (index == -1) {
index = tabs.size();
}
......@@ -1018,7 +1019,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe
mainTabbedPane.setIconAt(index, IconManager.imgic60);
scp.init();
return scp.getCAMSBlockDiagramPanel();
}*/
}
//Return the list of all the TMLArchiDiagramPanels
public Vector<TMLArchiPanel> getTMLArchiDiagramPanels() {
......@@ -1395,11 +1396,11 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe
return index;
}
/*public int createSystemCAMS(String name) { //ajout CD
public int createSystemCAMS(String name) { //ajout CD
int index = addSystemCAMSPane