diff --git a/src/ddtranslatorSoclib/toTopCell/Declaration.java b/src/ddtranslatorSoclib/toTopCell/Declaration.java index a979b49ca4cdc8effc6080b5a26f4085cda00d97..1534b23b8e37e2170aa7efccf2bf379b5401fca5 100755 --- a/src/ddtranslatorSoclib/toTopCell/Declaration.java +++ b/src/ddtranslatorSoclib/toTopCell/Declaration.java @@ -63,7 +63,8 @@ public class Declaration { //Is the platform clustered? - int nb_clusters=TopCellGenerator.avatardd.getAllCrossbar().size(); + int nb_clusters = TopCellGenerator.avatardd.getAllCrossbar().size(); + nb_clusters=2; boolean trace_caba=true; diff --git a/src/ddtranslatorSoclib/toTopCell/Loader.java b/src/ddtranslatorSoclib/toTopCell/Loader.java index de4198dfbabc94c423aebb26d6c74177d8638b92..e68e7547cdc56e87cd0d0cf1b792c073f3611c83 100755 --- a/src/ddtranslatorSoclib/toTopCell/Loader.java +++ b/src/ddtranslatorSoclib/toTopCell/Loader.java @@ -20,6 +20,8 @@ public class Loader { public static String getLoader() { int nb_clusters=TopCellGenerator.avatardd.getAllCrossbar().size(); + nb_clusters=2; + loader = CR2 + "//-------------------------Call Loader---------------------------------" + CR2 ; loader = loader + "std::cerr << \"caba-vgmn-mutekh_kernel_tutorial SoCLib simulator for MutekH\" << std::endl;" + CR2 ; diff --git a/src/ddtranslatorSoclib/toTopCell/MappingTable.java b/src/ddtranslatorSoclib/toTopCell/MappingTable.java index b6b919a8289dca852664436d6efd6a15c1689bd3..c7a2f1dae7dc85a96999a448f0d8c8d8e36a78c7 100755 --- a/src/ddtranslatorSoclib/toTopCell/MappingTable.java +++ b/src/ddtranslatorSoclib/toTopCell/MappingTable.java @@ -17,9 +17,9 @@ public class MappingTable { private static String mapping; public static String getMappingTable() { - int l=0; + int l=0; int nb_clusters=TopCellGenerator.avatardd.getAllCrossbar().size(); - + nb_clusters=2; if(nb_clusters == 0){ mapping = CR2 + "//-----------------------mapping table------------------------" + CR2; diff --git a/src/ddtranslatorSoclib/toTopCell/NetList.java b/src/ddtranslatorSoclib/toTopCell/NetList.java index 9d9c050197acde3f092e784ad7eed75b362db3b0..3af9505d9bf3198aa7eac55deaf839cc484dbb3d 100755 --- a/src/ddtranslatorSoclib/toTopCell/NetList.java +++ b/src/ddtranslatorSoclib/toTopCell/NetList.java @@ -14,6 +14,7 @@ public class NetList { public static String getNetlist(String icn, boolean _tracing) { int nb_clusters=TopCellGenerator.avatardd.getAllCrossbar().size(); + nb_clusters=2; boolean trace_caba=true; //tracing is enabled in cycle accurate mode tracing = _tracing; String netlist; diff --git a/src/ddtranslatorSoclib/toTopCell/Signal.java b/src/ddtranslatorSoclib/toTopCell/Signal.java index 392b30a995e1b2e865a5d40decf9576f13434095..5b1d640163e410357d40045a95a72c663c9c60b0 100755 --- a/src/ddtranslatorSoclib/toTopCell/Signal.java +++ b/src/ddtranslatorSoclib/toTopCell/Signal.java @@ -16,7 +16,7 @@ public class Signal { public static String getSignal() { int nb_clusters=TopCellGenerator.avatardd.getAllCrossbar().size(); - + nb_clusters=2; String signal = CR2 + "//-------------------------------signaux------------------------------------" + CR2; signal = signal + "caba::VciSignals<vci_param> signal_vci_m[cpus.size() + 1];"+ CR; diff --git a/src/tmltranslator/HwLink.java b/src/tmltranslator/HwLink.java index ae95def86adfa356fb0ec48cdb4bece96058d16a..7414693281ed243adb2c7f1e9d932175e9b4d11c 100755 --- a/src/tmltranslator/HwLink.java +++ b/src/tmltranslator/HwLink.java @@ -50,9 +50,11 @@ import java.util.*; public class HwLink implements Comparable<HwLink> { public HwBus bus; - public HwNode hwnode; - protected String name; - protected int priority; + public HwVGMN vgmn;//DG 10.08. + public HwCrossbar crossbar;//DG 10.08. + public HwNode hwnode; + protected String name; + protected int priority; public HwLink(String _name) { name = _name; diff --git a/src/ui/AvatarDeploymentPanelTranslator.java b/src/ui/AvatarDeploymentPanelTranslator.java index 1b01f44635fbcc301e87d2b2ca98c492eed94a4f..87272fa1d2583ecfaf779c1c755910d2425e04fe 100755 --- a/src/ui/AvatarDeploymentPanelTranslator.java +++ b/src/ui/AvatarDeploymentPanelTranslator.java @@ -119,7 +119,7 @@ public class AvatarDeploymentPanelTranslator{ int nbOfAttachedTargets = bus.getNbOfAttachedTargets(); int fifoDepth = bus.getFifoDepth(); int minLatency = bus.getMinLatency(); -System.out.println("$$$$$$$ vgsb read in"); +System.out.println("vgsb read in"); AvatarBus avbus = new AvatarBus(busName,nbOfAttachedInitiators,nbOfAttachedTargets,fifoDepth,minLatency); avatarComponents.add(avbus); @@ -133,7 +133,7 @@ System.out.println("$$$$$$$ vgsb read in"); int nbOfAttachedTargets = vgmn.getNbOfAttachedTargets(); int fifoDepth = vgmn.getFifoDepth(); int minLatency = vgmn.getMinLatency(); -System.out.println("$$$$$$$ vgmn read in"); +System.out.println("vgmn read in"); AvatarVgmn avvgmn = new AvatarVgmn(vgmnName,nbOfAttachedInitiators,nbOfAttachedTargets,fifoDepth,minLatency); avatarComponents.add(avvgmn); @@ -149,7 +149,8 @@ System.out.println("$$$$$$$ vgmn read in"); int cluster_address = crossbar.getClusterAddress(); AvatarCrossbar avcrossbar = new AvatarCrossbar(crossbarName,nbOfAttachedInitiators,nbOfAttachedTargets,cluster_index,cluster_address); - nb_clusters++;System.out.println("$$$$$$$nb crossbars read in"+nb_clusters); + nb_clusters++; + System.out.println("nb crossbars read in"+nb_clusters); avatarComponents.add(avcrossbar); } else if(dp instanceof ADDICUNode){ diff --git a/src/ui/GTMLModeling.java b/src/ui/GTMLModeling.java index da4d0c80965f3792faa2c72609c16b9dd6a967da..f6118021cb81efb7d7f3257c6efec53ab386d402 100755 --- a/src/ui/GTMLModeling.java +++ b/src/ui/GTMLModeling.java @@ -2281,12 +2281,16 @@ public class GTMLModeling { TMLArchiCPUNode node; TMLArchiHWANode hwanode; TMLArchiBUSNode busnode; + TMLArchiVGMNNode vgmnnode; + TMLArchiCrossbarNode crossbarnode; TMLArchiBridgeNode bridgenode; TMLArchiMemoryNode memorynode; TMLArchiDMANode dmanode; HwCPU cpu; - HwA hwa; - HwBus bus; + HwA hwa; + HwBus bus; + HwVGMN vgmn; + HwCrossbar crossbar; HwBridge bridge; HwMemory memory; HwDMA dma; @@ -2370,6 +2374,52 @@ public class GTMLModeling { } } +if (tgc instanceof TMLArchiVGMNNode) { + vgmnnode = (TMLArchiVGMNNode)tgc; + if (nameInUse(names, vgmnnode.getName())) { + // Node with the same name + CheckingError ce = new CheckingError(CheckingError.STRUCTURE_ERROR, "Two nodes have the same name: " + vgmnnode.getName()); + ce.setTDiagramPanel(tmlap.tmlap); + ce.setTGComponent(vgmnnode); + checkingErrors.add(ce); + } else { + names.add(vgmnnode.getName()); + vgmn = new HwVGMN(vgmnnode.getName()); + vgmn.byteDataSize = vgmnnode.getByteDataSize(); + /* vgmn.pipelineSize = vgmnnode.getPipelineSize(); + vgmn.arbitration = vgmnnode.getArbitrationPolicy(); + vgmn.clockRatio = vgmnnode.getClockRatio(); + vgmn.sliceTime = vgmnnode.getSliceTime(); + vgmn.privacy = vgmnnode.getPrivacy();*/ + listE.addCor(vgmn, vgmnnode); + archi.addHwNode(vgmn); + TraceManager.addDev("VGMN node added:" + vgmn.getName()); + } + } + +if (tgc instanceof TMLArchiCrossbarNode) { + crossbarnode = (TMLArchiCrossbarNode)tgc; + if (nameInUse(names, crossbarnode.getName())) { + // Node with the same name + CheckingError ce = new CheckingError(CheckingError.STRUCTURE_ERROR, "Two nodes have the same name: " + crossbarnode.getName()); + ce.setTDiagramPanel(tmlap.tmlap); + ce.setTGComponent(crossbarnode); + checkingErrors.add(ce); + } else { + names.add(crossbarnode.getName()); + crossbar = new HwCrossbar(crossbarnode.getName()); + crossbar.byteDataSize = crossbarnode.getByteDataSize(); + /*crossbar.pipelineSize = crossbarnode.getPipelineSize(); + crossbar.arbitration = crossbarnode.getArbitrationPolicy(); + crossbar.clockRatio = crossbarnode.getClockRatio(); + crossbar.sliceTime = crossbarnode.getSliceTime(); + crossbar.privacy = crossbarnode.getPrivacy();*/ + listE.addCor(crossbar, crossbarnode); + archi.addHwNode(crossbar); + TraceManager.addDev("Crossbar node added:" + crossbar.getName()); + } + } + if (tgc instanceof TMLArchiBridgeNode) { bridgenode = (TMLArchiBridgeNode)tgc; if (nameInUse(names, bridgenode.getName())) { @@ -2453,7 +2503,8 @@ public class GTMLModeling { //TraceManager.addDev("Not null"); if (components.contains(tgc1) && components.contains(tgc2)) { //TraceManager.addDev("Getting closer"); - if (tgc2 instanceof TMLArchiBUSNode) { + + if (tgc2 instanceof TMLArchiBUSNode) { originNode = listE.getHwNode(tgc1); bus = (HwBus)(listE.getHwNode(tgc2)); if ((originNode != null) && (bus != null)) { @@ -2465,7 +2516,38 @@ public class GTMLModeling { archi.addHwLink(hwlink); //TraceManager.addDev("Link added"); } + } + + // DG added VGMN and crossbar + if (tgc2 instanceof TMLArchiVGMNNode) { + originNode = listE.getHwNode(tgc1); + vgmn = (HwVGMN)(listE.getHwNode(tgc2)); + if ((originNode != null) && (vgmn != null)) { + hwlink = new HwLink("link_" +originNode.getName() + "_to_" + vgmn.getName()); + hwlink.setPriority(connector.getPriority()); + hwlink.vgmn = vgmn; + hwlink.hwnode = originNode; + listE.addCor(hwlink, connector); + archi.addHwLink(hwlink); + //TraceManager.addDev("Link added"); + } } + + if (tgc2 instanceof TMLArchiCrossbarNode) { + originNode = listE.getHwNode(tgc1); + crossbar = (HwCrossbar)(listE.getHwNode(tgc2)); + if ((originNode != null) && (crossbar != null)) { + hwlink = new HwLink("link_" +originNode.getName() + "_to_" + crossbar.getName()); + hwlink.setPriority(connector.getPriority()); + hwlink.crossbar = crossbar; + hwlink.hwnode = originNode; + listE.addCor(hwlink, connector); + archi.addHwLink(hwlink); + //TraceManager.addDev("Link added"); + } + } + + } } } @@ -3151,9 +3233,9 @@ public class GTMLModeling { } } - // Other nodes (memory, bridge, bus) + // Other nodes (memory, bridge, bus, VGMN, crossbar) //} - if ((tgc instanceof TMLArchiBUSNode) || (tgc instanceof TMLArchiBridgeNode) || (tgc instanceof TMLArchiMemoryNode)|| (tgc instanceof TMLArchiDMANode)) { + if ((tgc instanceof TMLArchiBUSNode) ||(tgc instanceof TMLArchiVGMNNode) || (tgc instanceof TMLArchiCrossbarNode) ||(tgc instanceof TMLArchiBridgeNode) || (tgc instanceof TMLArchiMemoryNode)|| (tgc instanceof TMLArchiDMANode)) { node = archi.getHwNodeByName(tgc.getName()); if ((node != null) && (node instanceof HwCommunicationNode)) { artifactscomm = ((TMLArchiCommunicationNode)(tgc)).getChannelArtifactList(); diff --git a/src/ui/MainGUI.java b/src/ui/MainGUI.java index b392a89d67709d5d514e093b04ec3c3d51ca357f..b6cf8d23df4da3639791af552f59778ea2003542 100755 --- a/src/ui/MainGUI.java +++ b/src/ui/MainGUI.java @@ -8447,6 +8447,9 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe else if (command.equals(actions[TGUIAction.ADD_VGMNNODE].getActionCommand())) { actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.ADD_VGMNNODE); } + else if (command.equals(actions[TGUIAction.ADD_CROSSBARNODE].getActionCommand())) { + actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.ADD_CROSSBARNODE); + } else if (command.equals(actions[TGUIAction.ADD_BRIDGENODE].getActionCommand())) { actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.ADD_BRIDGENODE); } else if (command.equals(actions[TGUIAction.ADD_TTYNODE].getActionCommand())) { diff --git a/src/ui/TGComponentManager.java b/src/ui/TGComponentManager.java index 43e802a3138ad691ff082fae8ee0dc983547e4e4..13c9a5654022a63663e30869ceba56ee73f4c89b 100755 --- a/src/ui/TGComponentManager.java +++ b/src/ui/TGComponentManager.java @@ -49,6 +49,7 @@ package ui; //import java.awt.*; import java.util.*; +import myutil.*; import ui.ad.*; import ui.cd.*; @@ -251,6 +252,8 @@ public class TGComponentManager { public static final int TMLARCHI_EVENT_ARTIFACT = 1109; public static final int TMLARCHI_PORT_ARTIFACT = 1110; public static final int TMLARCHI_KEY = 1111; + public static final int TMLARCHI_VGMNNODE = 1112; + public static final int TMLARCHI_CROSSBARNODE = 1113; public static final int TMLCTD_CCOMPONENT = 1200; public static final int TMLCTD_CPORT = 1201; @@ -402,26 +405,11 @@ public class TGComponentManager { public static final int APD_PROPERTY_CONNECTOR = 5312; public static final int APD_COMPOSITION_CONNECTOR = 5313; - // Avatar Deployment Diagrams at 5350 - /* public static final int ADD_CONNECTOR = 5350; - public static final int ADD_CPUNODE = 5351; - public static final int ADD_ARTIFACT = 5352; - public static final int ADD_BUSNODE = 5353; - public static final int ADD_TTYNODE = 5354; - public static final int ADD_RAMNODE = 5355; - public static final int ADD_ROMNODE = 5356; - public static final int ADD_BRIDGENODE = 5357; - public static final int ADD_DMANODE = 5358; - public static final int ADD_ICUNODE = 5359; - public static final int ADD_COPROMWMRNODE = 5360; - public static final int ADD_TIMERNODE = 5361; - public static final int ADD_CHANNELARTIFACT = 5362;*/ - // Avatar Deployment Diagrams at 5350 public static final int ADD_CONNECTOR = 5350; public static final int ADD_CPUNODE = 5351; public static final int ADD_ARTIFACT = 5352; - public static final int ADD_BUSNODE = 5363; + public static final int ADD_BUSNODE = 5353; public static final int ADD_TTYNODE = 5354; public static final int ADD_RAMNODE = 5355; public static final int ADD_ROMNODE = 5356; @@ -431,7 +419,7 @@ public class TGComponentManager { public static final int ADD_COPROMWMRNODE = 5360; public static final int ADD_TIMERNODE = 5361; public static final int ADD_CHANNELARTIFACT = 5362; - public static final int ADD_VGMNNODE = 5353; + public static final int ADD_VGMNNODE = 5363; public static final int ADD_CROSSBARNODE = 5364; // AVATAR CD -> starts at 5400 @@ -650,11 +638,17 @@ public class TGComponentManager { case ADD_BUSNODE: tgc = new ADDBusNode(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); break; - case ADD_VGMNNODE: - tgc = new ADDBusNode(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); + case ADD_VGMNNODE: + { + TraceManager.addDev("****vgmn"); + tgc = new ADDVgmnNode(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); + } break; case ADD_CROSSBARNODE: - tgc = new ADDBusNode(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); + { + TraceManager.addDev("****crossbar"); + tgc = new ADDCrossbarNode(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); + } break; case ADD_TTYNODE: tgc = new ADDTTYNode(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); @@ -1094,6 +1088,12 @@ public class TGComponentManager { case TMLARCHI_BUSNODE: tgc = new TMLArchiBUSNode(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); break; + case TMLARCHI_VGMNNODE: + tgc = new TMLArchiVGMNNode(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); + break; + case TMLARCHI_CROSSBARNODE: + tgc = new TMLArchiCrossbarNode(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); + break; case TMLARCHI_CPNODE: tgc = new TMLArchiCPNode(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); break; @@ -1327,6 +1327,10 @@ public class TGComponentManager { return ADD_CHANNELARTIFACT; } else if (tgc instanceof ADDBusNode) { return ADD_BUSNODE; + } else if (tgc instanceof ADDVgmnNode) { + return ADD_VGMNNODE; + } else if (tgc instanceof ADDCrossbarNode) { + return ADD_CROSSBARNODE; } else if (tgc instanceof ADDTTYNode) { return ADD_TTYNODE; } else if (tgc instanceof ADDRAMNode) { @@ -1763,8 +1767,12 @@ public class TGComponentManager { return CONNECTOR_NODE_TMLARCHI; } else if (tgc instanceof TMLArchiCPUNode) { return TMLARCHI_CPUNODE; - } else if (tgc instanceof TMLArchiBUSNode) { + } else if (tgc instanceof TMLArchiBUSNode) { return TMLARCHI_BUSNODE; + } else if (tgc instanceof TMLArchiVGMNNode) { + return TMLARCHI_VGMNNODE; + } else if (tgc instanceof TMLArchiCrossbarNode) { + return TMLARCHI_CROSSBARNODE; } else if (tgc instanceof TMLArchiCPNode) { return TMLARCHI_CPNODE; } else if (tgc instanceof TMLArchiBridgeNode) { diff --git a/src/ui/TGUIAction.java b/src/ui/TGUIAction.java index 2376860e7b9852ee656e6e1e81fba73662953d9b..b2af1100603e91952412014319a35deb073e42e2 100755 --- a/src/ui/TGUIAction.java +++ b/src/ui/TGUIAction.java @@ -395,8 +395,7 @@ public class TGUIAction extends AbstractAction { public static final int ADD_VGMNNODE = 401; public static final int ADD_CROSSBARNODE = 421; - // julien ------------------------------------------------------------- - + // ------------------------------------------------------------- public static final int DEPLOY_AVATAR_DIAGRAM = 418; public static final int EXTRAC_DEPLOY_PARAM_TO_FILE = 419; // -------------------------------------------------------------------- @@ -795,9 +794,11 @@ public class TGUIAction extends AbstractAction { actions[ADD_EDIT] = new TAction("edit-add-diagram", "Edit AVATAR deployment diagram", IconManager.imgic100, IconManager.imgic101, "Edit AVATAR deployment diagram", "Make it possible to edit the currently opened AVATAR deployment diagram", 0); actions[ADD_LINK] = new TAction("add-add-link", "Add a link", IconManager.imgic202, IconManager.imgic202, "Link", "Add a link between two nodes of the currently opened AVATAR deployment diagram", 0); actions[ADD_CPUNODE] = new TAction("add-add-cpunode", "Add a CPU", IconManager.imgic1100, IconManager.imgic1100, "CPU", "Add a cpu node to the currently opened AVATAR deployment diagram", 0); + actions[ADD_BUSNODE] = new TAction("add-add-busnode", "Add a Bus", IconManager.imgic1102, IconManager.imgic1102, "Bus", "Add a bus node to the currently opened AVATAR deployment diagram", 0); actions[ADD_VGMNNODE] = new TAction("add-add-vgmnnode", "Add a VGMN", IconManager.imgic1102, IconManager.imgic1102, "VGMN", "Add a VGMN node to the currently opened AVATAR deployment diagram", 0); actions[ADD_CROSSBARNODE] = new TAction("add-add-crossbarnode", "Add a CROSSBAR", IconManager.imgic1102, IconManager.imgic1102, "Crossbar", "Add a Crossbar node to the currently opened AVATAR deployment diagram", 0); + actions[ADD_TTYNODE] = new TAction("add-add-tty", "Add a TTY node", IconManager.imgic1108, IconManager.imgic1108, "TTY", "Add a tty node to the currently opened AVATAR deployment diagram", 0); actions[ADD_BLOCKARTIFACT] = new TAction("add-add-blockartifact", "Map an AVATAR block", IconManager.imgic702, IconManager.imgic702, "Map an AVATAR block", "Map an AVATAR block onto a node in the currently opened AVATAR deployment diagram", 0); // julien ---------------------------------------------------------------------------------- @@ -808,7 +809,7 @@ public class TGUIAction extends AbstractAction { actions[ADD_CHANNELARTIFACT] = new TAction("add-add-channelartifact", "Map an AVATAR Channel", IconManager.imgic702, IconManager.imgic702, "Map an AVATAR channel", "Map an AVATAR channel onto a memory in the currently opened AVATAR deployment diagram", 0); actions[ADD_BRIDGENODE] = new TAction("add-add-bridgenode", "Add a Bridge", IconManager.imgic1104, IconManager.imgic1104, "Bridge node", "Add a bridge node to the currently opened AVATAR deployment diagram", 0); - actions[ADD_RAMNODE] = new TAction("add-add-ramnode", "Add a RAM", IconManager.imgic1108, IconManager.imgic1108, "RAM", "Add a hardware accelerator node to the currently opened AVATAR deployment diagram", 0); + actions[ADD_RAMNODE] = new TAction("add-add-ramnode", "Add a RAM", IconManager.imgic1108, IconManager.imgic1108, "RAM", "Add a RAM node to the currently opened AVATAR deployment diagram", 0); actions[ADD_ROMNODE] = new TAction("add-add-romnode", "Add a ROM", IconManager.imgic1108, IconManager.imgic1108, "ROM", "Add a memory node to the currently opened AVATAR deployment diagram", 0); actions[ADD_DMANODE] = new TAction("add-add-dmanode", "Add a DMA", IconManager.imgic1110, IconManager.imgic1110, "DMA", "Add a DMA node to the currently opened AVATAR deployment diagram", 0); actions[ADD_ICUNODE] = new TAction("add-add-icunode", "Add an ICU", IconManager.imgic1112, IconManager.imgic1112, "ICU", "Add a ICU node to the currently opened AVATAR deployment diagram", 0); diff --git a/src/ui/avatardd/ADDCrossbarNode.java b/src/ui/avatardd/ADDCrossbarNode.java index f5d88f7acc650623e043d1627eab6f38835cb9a1..22fc24983bc95d2c2ee8b886290a251dd15bc97e 100755 --- a/src/ui/avatardd/ADDCrossbarNode.java +++ b/src/ui/avatardd/ADDCrossbarNode.java @@ -36,7 +36,7 @@ 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 ADDVgmnNode +* Class ADDCrossbarNode * Node. To be used in Avatar Deployment Diagram * Creation: 30/06/2014 * @version 1.0 30/06/2014 diff --git a/src/ui/tmldd/TMLArchiBUSNode.java b/src/ui/tmldd/TMLArchiBUSNode.java index 5c72cfa14e4c578e87a70c596efdf76fc0abc983..b6c933137df4b8df077e771ee6500ec46beca331 100755 --- a/src/ui/tmldd/TMLArchiBUSNode.java +++ b/src/ui/tmldd/TMLArchiBUSNode.java @@ -200,7 +200,7 @@ public class TMLArchiBUSNode extends TMLArchiCommunicationNode implements Swallo int tmp; String tmpName; - JDialogBUSNode dialog = new JDialogBUSNode(frame, "Setting BUS attributes", this); + JDialogBUSNode dialog = new JDialogBUSNode(frame, "Setting VGMN attributes", this); dialog.setSize(500, 450); GraphicLib.centerOnParent(dialog); dialog.show(); // blocked until dialog has been closed diff --git a/src/ui/tmldd/TMLArchiCrossbarNode.java b/src/ui/tmldd/TMLArchiCrossbarNode.java new file mode 100755 index 0000000000000000000000000000000000000000..915f1abfeb51bf5586d777b3f0d1cc1bb65506bc --- /dev/null +++ b/src/ui/tmldd/TMLArchiCrossbarNode.java @@ -0,0 +1,423 @@ +/**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. + + /** + * Class TMLArchiCrossbarNode + * Node. To be used in TML architecture diagrams. + * Creation: 31/10/2007 + * @version 1.0 31/10/2007 + * @author Ludovic APVRILLE, adapted for crossbar by Daniela Genius 10/08/2016 + * @see + */ + +package ui.tmldd; + +import java.awt.*; +import java.util.*; +import javax.swing.*; + +import org.w3c.dom.*; + +import myutil.*; +import ui.*; +import ui.window.*; + +import tmltranslator.*; + +public class TMLArchiCrossbarNode extends TMLArchiCommunicationNode implements SwallowTGComponent, WithAttributes { + private int textY1 = 15; + private int textY2 = 30; + private int derivationx = 2; + private int derivationy = 3; + private String stereotype = "Crossbar"; + + private int byteDataSize = HwBus.DEFAULT_BYTE_DATA_SIZE; + /* private int pipelineSize = HwBus.DEFAULT_PIPELINE_SIZE; + private int arbitrationPolicy = HwBus.DEFAULT_ARBITRATION; + private int sliceTime = HwBus.DEFAULT_SLICE_TIME; + private int privacy = HwBus.BUS_PUBLIC;*/ + public TMLArchiCrossbarNode(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { + super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); + + width = 250; + height = 50; + minWidth = 100; + minHeight = 50; + + nbConnectingPoint = 16; + connectingPoint = new TGConnectingPoint[16]; + + connectingPoint[0] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 0.0, 0.0); + connectingPoint[1] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 0.5, 0.0); + connectingPoint[2] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 1.0, 0.0); + connectingPoint[3] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 0.0, 0.5); + connectingPoint[4] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 1.0, 0.5); + connectingPoint[5] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 0.0, 1.0); + connectingPoint[6] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 0.5, 1.0); + connectingPoint[7] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 1.0, 1.0); + + connectingPoint[8] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 0.25, 0.0); + connectingPoint[9] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 0.75, 0.0); + connectingPoint[10] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 0.0, 0.25); + connectingPoint[11] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 1.0, 0.25); + connectingPoint[12] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 0.0, 0.75); + connectingPoint[13] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 1.0, 0.75); + connectingPoint[14] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 0.25, 1.0); + connectingPoint[15] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 0.75, 1.0); + + addTGConnectingPointsComment(); + + nbInternalTGComponent = 0; + + moveable = true; + editable = true; + removable = true; + userResizable = true; + + name = tdp.findNodeName("Bus"); + value = "name"; + + myImageIcon = IconManager.imgic700; + } + + public void internalDrawing(Graphics g) { + Color c = g.getColor(); + g.draw3DRect(x, y, width, height, true); + + + // Top lines + g.drawLine(x, y, x + derivationx, y - derivationy); + g.drawLine(x + width, y, x + width + derivationx, y - derivationy); + g.drawLine(x + derivationx, y - derivationy, x + width + derivationx, y - derivationy); + + // Right lines + g.drawLine(x + width, y + height, x + width + derivationx, y - derivationy + height); + g.drawLine(x + derivationx + width, y - derivationy, x + width + derivationx, y - derivationy + height); + + // Filling color + g.setColor(ColorManager.BUS_BOX); + g.fill3DRect(x+1, y+1, width-1, height-1, true); + g.setColor(c); + + // Strings + String ster = "<<" + stereotype + ">>"; + int w = g.getFontMetrics().stringWidth(ster); + Font f = g.getFont(); + g.setFont(f.deriveFont(Font.BOLD)); + g.drawString(ster, x + (width - w)/2, y + textY1); + g.setFont(f); + w = g.getFontMetrics().stringWidth(name); + g.drawString(name, x + (width - w)/2, y + textY2); + + // Icon + //g.drawImage(IconManager.imgic1102.getImage(), x + width - 20, y + 4, null); + g.drawImage(IconManager.imgic1102.getImage(), x + 4, y + 4, null); + g.drawImage(IconManager.img9, x + width - 20, y + 4, null); + + c = g.getColor(); + + //Draw bus privacy + /* if (privacy== HwBus.BUS_PUBLIC){ + + } + else { + int[] xps = new int[]{x+4, x+7, x+10, x+13, x+16, x+19, x+22, x+22, x+13, x+4}; + int[] yps = new int[]{y+18, y+22, y+22, y+18, y+22, y+22,y+18, y+35, y+43, y+35}; + g.setColor(Color.green); + g.fillPolygon(xps, yps,10); + + // g.drawOval(x+6, y+19, 12, 18); + + // g.fillRect(x+4, y+25, 18, 14); + g.setColor(c); + g.drawPolygon(xps, yps,10); + // g.drawRect(x+4, y+25, 18, 14); + }*/ + } + + public TGComponent isOnOnlyMe(int x1, int y1) { + + Polygon pol = new Polygon(); + pol.addPoint(x, y); + pol.addPoint(x + derivationx, y - derivationy); + pol.addPoint(x + derivationx + width, y - derivationy); + pol.addPoint(x + derivationx + width, y + height - derivationy); + pol.addPoint(x + width, y + height); + pol.addPoint(x, y + height); + if (pol.contains(x1, y1)) { + return this; + } + + return null; + } + + public String getStereotype() { + return stereotype; + + } + + public String getNodeName() { + return name; + } + + public boolean editOndoubleClick(JFrame frame) { + boolean error = false; + String errors = ""; + int tmp; + String tmpName; + + JDialogCrossbarNode dialog = new JDialogCrossbarNode(frame, "Setting Crossbar attributes", this); + dialog.setSize(500, 450); + GraphicLib.centerOnParent(dialog); + dialog.show(); // blocked until dialog has been closed + + if (!dialog.isRegularClose()) { + return false; + } + + if (dialog.getNodeName().length() != 0) { + tmpName = dialog.getNodeName(); + tmpName = tmpName.trim(); + if (!TAttribute.isAValidId(tmpName, false, false)) { + error = true; + errors += "Name of the node "; + } else { + name = tmpName; + } + } + + /* arbitrationPolicy = dialog.getArbitrationPolicy(); + privacy = dialog.getPrivacy(); + if (arbitrationPolicy == HwBus.BASIC_ROUND_ROBIN) { + stereotype = "BUS-RR"; + } + + if (arbitrationPolicy == HwBus.PRIORITY_BASED) { + stereotype = "BUS-PB"; + } + + if (arbitrationPolicy == HwBus.CAN) { + stereotype = "BUS-CAN"; + } + + if (arbitrationPolicy == HwBus.CROSSBAR) { + stereotype = "CROSSBAR"; + }*/ + + // DG we need only data size + + if (dialog.getByteDataSize().length() != 0) { + try { + tmp = byteDataSize; + byteDataSize = Integer.decode(dialog.getByteDataSize()).intValue(); + if (byteDataSize <= 0) { + byteDataSize = tmp; + error = true; + errors += "Data size "; + } + } catch (Exception e) { + error = true; + errors += "Data size "; + } + } + + /* if (dialog.getSliceTime().length() != 0) { + try { + tmp = sliceTime; + sliceTime = Integer.decode(dialog.getSliceTime()).intValue(); + if (sliceTime <= 0) { + sliceTime = tmp; + error = true; + errors += "Slice time "; + } + } catch (Exception e) { + error = true; + errors += "Slice time "; + } + } + + if (dialog.getPipelineSize().length() != 0) { + try { + tmp = pipelineSize; + pipelineSize = Integer.decode(dialog.getPipelineSize()).intValue(); + if (pipelineSize <= 0) { + pipelineSize = tmp; + error = true; + errors += "Pipeline size "; + } + } catch (Exception e) { + error = true; + errors += "Pipeline size "; + } + } + + if (dialog.getClockRatio().length() != 0) { + try { + tmp = clockRatio; + clockRatio = Integer.decode(dialog.getClockRatio()).intValue(); + if (clockRatio <= 0) { + clockRatio = tmp; + error = true; + errors += "Clock diviser "; + } + } catch (Exception e) { + error = true; + errors += "Clock diviser "; + } + }*/ + + if (error) { + JOptionPane.showMessageDialog(frame, + "Invalid value for the following attributes: " + errors, + "Error", + JOptionPane.INFORMATION_MESSAGE); + return false; + } + + return true; + } + + + public int getType() { + return TGComponentManager.TMLARCHI_CROSSBARNODE; + } + + protected String translateExtraParam() { + StringBuffer sb = new StringBuffer("<extraparam>\n"); + sb.append("<info stereotype=\"" + stereotype + "\" nodeName=\"" + name); + sb.append("\" />\n"); + sb.append("<attributes byteDataSize=\"" + byteDataSize + "\" "); + /* sb.append(" arbitrationPolicy=\"" + arbitrationPolicy + "\" "); + sb.append(" sliceTime=\"" + sliceTime + "\" "); + sb.append(" pipelineSize=\"" + pipelineSize + "\" "); + sb.append(" clockRatio=\"" + clockRatio + "\" "); + sb.append(" privacy=\"" + privacy + "\" ");*/ + sb.append("/>\n"); + sb.append("</extraparam>\n"); + return new String(sb); + } + + public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException{ + //System.out.println("*** load extra synchro ***"); + try { + NodeList nli; + Node n1, n2; + Element elt; + int t1id; + String sstereotype = null, snodeName = null; + for(int i=0; i<nl.getLength(); i++) { + n1 = nl.item(i); + //System.out.println(n1); + if (n1.getNodeType() == Node.ELEMENT_NODE) { + nli = n1.getChildNodes(); + for(int j=0; i<nli.getLength(); i++) { + n2 = nli.item(i); + //System.out.println(n2); + if (n2.getNodeType() == Node.ELEMENT_NODE) { + elt = (Element) n2; + if (elt.getTagName().equals("info")) { + sstereotype = elt.getAttribute("stereotype"); + snodeName = elt.getAttribute("nodeName"); + } + if (sstereotype != null) { + stereotype = sstereotype; + } + if (snodeName != null){ + name = snodeName; + } + if (elt.getTagName().equals("attributes")) { + byteDataSize = Integer.decode(elt.getAttribute("byteDataSize")).intValue(); + /* arbitrationPolicy =Integer.decode(elt.getAttribute("arbitrationPolicy")).intValue(); pipelineSize = Integer.decode(elt.getAttribute("pipelineSize")).intValue(); + if ((elt.getAttribute("clockRatio") != null) && (elt.getAttribute("clockRatio").length() > 0)){ + clockRatio = Integer.decode(elt.getAttribute("clockRatio")).intValue(); + } + if ((elt.getAttribute("sliceTime") != null) && (elt.getAttribute("sliceTime").length() > 0)){ + sliceTime = Integer.decode(elt.getAttribute("sliceTime")).intValue(); + } + if ((elt.getAttribute("privacy") != null) && (elt.getAttribute("privacy").length() > 0)){ + privacy = Integer.decode(elt.getAttribute("privacy")).intValue();*/ + } + } + } + } + } + } + + catch (Exception e) { + throw new MalformedModelingException(); + } + } + + + public int getByteDataSize(){ + return byteDataSize; + } + +/* public int getPipelineSize(){ + return pipelineSize; + } + + public int getSliceTime(){ + return sliceTime; + } + + public int getArbitrationPolicy(){ + return arbitrationPolicy; + } + public int getPrivacy(){ + return privacy; + }*/ + + public String getAttributes() { + String attr = ""; + attr += "Data size (in byte) = " + byteDataSize + "\n"; + /* attr += "Pipeline size = " + pipelineSize + "\n"; + if (arbitrationPolicy == HwBus.DEFAULT_ARBITRATION) { + attr += "Arbitration policy = basic Round Robin\n"; + } else if (arbitrationPolicy == HwBus.PRIORITY_BASED) { + attr += "Arbitration policy = priority based\n"; + } + attr += "Slice time (in microseconds) = " + sliceTime + "\n"; + attr += "Clock diviser = " + clockRatio + "\n";*/ + return attr; + } + + public int getComponentType() { + return TRANSFER; + } + +} diff --git a/src/ui/tmldd/TMLArchiVGMNNode.java b/src/ui/tmldd/TMLArchiVGMNNode.java new file mode 100755 index 0000000000000000000000000000000000000000..fe88239c2504f0c9039490bad5ec35166210d7da --- /dev/null +++ b/src/ui/tmldd/TMLArchiVGMNNode.java @@ -0,0 +1,420 @@ +/**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. + + /** + * Class TMLArchiVGMNNode + * Node. To be used in TML architecture diagrams. + * Creation: 31/10/2007 + * @version 1.0 31/10/2007 + * @author Ludovic APVRILLE + * @see + */ + +package ui.tmldd; + +import java.awt.*; +import java.util.*; +import javax.swing.*; + +import org.w3c.dom.*; + +import myutil.*; +import ui.*; +import ui.window.*; + +import tmltranslator.*; + +public class TMLArchiVGMNNode extends TMLArchiCommunicationNode implements SwallowTGComponent, WithAttributes { + private int textY1 = 15; + private int textY2 = 30; + private int derivationx = 2; + private int derivationy = 3; + private String stereotype = "VGMN"; + + private int byteDataSize = HwBus.DEFAULT_BYTE_DATA_SIZE; + /* private int pipelineSize = HwBus.DEFAULT_PIPELINE_SIZE; + private int arbitrationPolicy = HwBus.DEFAULT_ARBITRATION; + private int sliceTime = HwBus.DEFAULT_SLICE_TIME; + private int privacy = HwBus.BUS_PUBLIC;*/ + public TMLArchiVGMNNode(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { + super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); + + width = 250; + height = 50; + minWidth = 100; + minHeight = 50; + + nbConnectingPoint = 16; + connectingPoint = new TGConnectingPoint[16]; + + connectingPoint[0] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 0.0, 0.0); + connectingPoint[1] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 0.5, 0.0); + connectingPoint[2] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 1.0, 0.0); + connectingPoint[3] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 0.0, 0.5); + connectingPoint[4] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 1.0, 0.5); + connectingPoint[5] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 0.0, 1.0); + connectingPoint[6] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 0.5, 1.0); + connectingPoint[7] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 1.0, 1.0); + + connectingPoint[8] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 0.25, 0.0); + connectingPoint[9] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 0.75, 0.0); + connectingPoint[10] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 0.0, 0.25); + connectingPoint[11] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 1.0, 0.25); + connectingPoint[12] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 0.0, 0.75); + connectingPoint[13] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 1.0, 0.75); + connectingPoint[14] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 0.25, 1.0); + connectingPoint[15] = new TMLArchiConnectingPoint(this, 0, 0, true, false, 0.75, 1.0); + + addTGConnectingPointsComment(); + + nbInternalTGComponent = 0; + + moveable = true; + editable = true; + removable = true; + userResizable = true; + + name = tdp.findNodeName("Bus"); + value = "name"; + + myImageIcon = IconManager.imgic700; + } + + public void internalDrawing(Graphics g) { + Color c = g.getColor(); + g.draw3DRect(x, y, width, height, true); + + + // Top lines + g.drawLine(x, y, x + derivationx, y - derivationy); + g.drawLine(x + width, y, x + width + derivationx, y - derivationy); + g.drawLine(x + derivationx, y - derivationy, x + width + derivationx, y - derivationy); + + // Right lines + g.drawLine(x + width, y + height, x + width + derivationx, y - derivationy + height); + g.drawLine(x + derivationx + width, y - derivationy, x + width + derivationx, y - derivationy + height); + + // Filling color + g.setColor(ColorManager.BUS_BOX); + g.fill3DRect(x+1, y+1, width-1, height-1, true); + g.setColor(c); + + // Strings + String ster = "<<" + stereotype + ">>"; + int w = g.getFontMetrics().stringWidth(ster); + Font f = g.getFont(); + g.setFont(f.deriveFont(Font.BOLD)); + g.drawString(ster, x + (width - w)/2, y + textY1); + g.setFont(f); + w = g.getFontMetrics().stringWidth(name); + g.drawString(name, x + (width - w)/2, y + textY2); + + // Icon + //g.drawImage(IconManager.imgic1102.getImage(), x + width - 20, y + 4, null); + g.drawImage(IconManager.imgic1102.getImage(), x + 4, y + 4, null); + g.drawImage(IconManager.img9, x + width - 20, y + 4, null); + + c = g.getColor(); + + //Draw bus privacy + /* if (privacy== HwBus.BUS_PUBLIC){ + + } + else { + int[] xps = new int[]{x+4, x+7, x+10, x+13, x+16, x+19, x+22, x+22, x+13, x+4}; + int[] yps = new int[]{y+18, y+22, y+22, y+18, y+22, y+22,y+18, y+35, y+43, y+35}; + g.setColor(Color.green); + g.fillPolygon(xps, yps,10); + + // g.drawOval(x+6, y+19, 12, 18); + + // g.fillRect(x+4, y+25, 18, 14); + g.setColor(c); + g.drawPolygon(xps, yps,10); + // g.drawRect(x+4, y+25, 18, 14); + }*/ + } + + public TGComponent isOnOnlyMe(int x1, int y1) { + + Polygon pol = new Polygon(); + pol.addPoint(x, y); + pol.addPoint(x + derivationx, y - derivationy); + pol.addPoint(x + derivationx + width, y - derivationy); + pol.addPoint(x + derivationx + width, y + height - derivationy); + pol.addPoint(x + width, y + height); + pol.addPoint(x, y + height); + if (pol.contains(x1, y1)) { + return this; + } + + return null; + } + + public String getStereotype() { + return stereotype; + + } + + public String getNodeName() { + return name; + } + + public boolean editOndoubleClick(JFrame frame) { + boolean error = false; + String errors = ""; + int tmp; + String tmpName; + + JDialogVGMNNode dialog = new JDialogVGMNNode(frame, "Setting VGMN attributes", this); + dialog.setSize(500, 450); + GraphicLib.centerOnParent(dialog); + dialog.show(); // blocked until dialog has been closed + + if (!dialog.isRegularClose()) { + return false; + } + + if (dialog.getNodeName().length() != 0) { + tmpName = dialog.getNodeName(); + tmpName = tmpName.trim(); + if (!TAttribute.isAValidId(tmpName, false, false)) { + error = true; + errors += "Name of the node "; + } else { + name = tmpName; + } + } + + /* arbitrationPolicy = dialog.getArbitrationPolicy(); + privacy = dialog.getPrivacy(); + if (arbitrationPolicy == HwBus.BASIC_ROUND_ROBIN) { + stereotype = "BUS-RR"; + } + + if (arbitrationPolicy == HwBus.PRIORITY_BASED) { + stereotype = "BUS-PB"; + } + + if (arbitrationPolicy == HwBus.CAN) { + stereotype = "BUS-CAN"; + } + + if (arbitrationPolicy == HwBus.CROSSBAR) { + stereotype = "CROSSBAR"; + }*/ + //DG we need only data size + if (dialog.getByteDataSize().length() != 0) { + try { + tmp = byteDataSize; + byteDataSize = Integer.decode(dialog.getByteDataSize()).intValue(); + if (byteDataSize <= 0) { + byteDataSize = tmp; + error = true; + errors += "Data size "; + } + } catch (Exception e) { + error = true; + errors += "Data size "; + } + } + + /* if (dialog.getSliceTime().length() != 0) { + try { + tmp = sliceTime; + sliceTime = Integer.decode(dialog.getSliceTime()).intValue(); + if (sliceTime <= 0) { + sliceTime = tmp; + error = true; + errors += "Slice time "; + } + } catch (Exception e) { + error = true; + errors += "Slice time "; + } + } + + if (dialog.getPipelineSize().length() != 0) { + try { + tmp = pipelineSize; + pipelineSize = Integer.decode(dialog.getPipelineSize()).intValue(); + if (pipelineSize <= 0) { + pipelineSize = tmp; + error = true; + errors += "Pipeline size "; + } + } catch (Exception e) { + error = true; + errors += "Pipeline size "; + } + } + + if (dialog.getClockRatio().length() != 0) { + try { + tmp = clockRatio; + clockRatio = Integer.decode(dialog.getClockRatio()).intValue(); + if (clockRatio <= 0) { + clockRatio = tmp; + error = true; + errors += "Clock diviser "; + } + } catch (Exception e) { + error = true; + errors += "Clock diviser "; + } + }*/ + + if (error) { + JOptionPane.showMessageDialog(frame, + "Invalid value for the following attributes: " + errors, + "Error", + JOptionPane.INFORMATION_MESSAGE); + return false; + } + + return true; + } + + + public int getType() { + return TGComponentManager.TMLARCHI_VGMNNODE; + } + + protected String translateExtraParam() { + StringBuffer sb = new StringBuffer("<extraparam>\n"); + sb.append("<info stereotype=\"" + stereotype + "\" nodeName=\"" + name); + sb.append("\" />\n"); + sb.append("<attributes byteDataSize=\"" + byteDataSize + "\" "); + /* sb.append(" arbitrationPolicy=\"" + arbitrationPolicy + "\" "); + sb.append(" sliceTime=\"" + sliceTime + "\" "); + sb.append(" pipelineSize=\"" + pipelineSize + "\" "); + sb.append(" clockRatio=\"" + clockRatio + "\" "); + sb.append(" privacy=\"" + privacy + "\" ");*/ + sb.append("/>\n"); + sb.append("</extraparam>\n"); + return new String(sb); + } + + public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException{ + //System.out.println("*** load extra synchro ***"); + try { + NodeList nli; + Node n1, n2; + Element elt; + int t1id; + String sstereotype = null, snodeName = null; + for(int i=0; i<nl.getLength(); i++) { + n1 = nl.item(i); + //System.out.println(n1); + if (n1.getNodeType() == Node.ELEMENT_NODE) { + nli = n1.getChildNodes(); + for(int j=0; i<nli.getLength(); i++) { + n2 = nli.item(i); + //System.out.println(n2); + if (n2.getNodeType() == Node.ELEMENT_NODE) { + elt = (Element) n2; + if (elt.getTagName().equals("info")) { + sstereotype = elt.getAttribute("stereotype"); + snodeName = elt.getAttribute("nodeName"); + } + if (sstereotype != null) { + stereotype = sstereotype; + } + if (snodeName != null){ + name = snodeName; + } + if (elt.getTagName().equals("attributes")) { + byteDataSize = Integer.decode(elt.getAttribute("byteDataSize")).intValue(); + /* arbitrationPolicy =Integer.decode(elt.getAttribute("arbitrationPolicy")).intValue(); pipelineSize = Integer.decode(elt.getAttribute("pipelineSize")).intValue(); + if ((elt.getAttribute("clockRatio") != null) && (elt.getAttribute("clockRatio").length() > 0)){ + clockRatio = Integer.decode(elt.getAttribute("clockRatio")).intValue(); + } + if ((elt.getAttribute("sliceTime") != null) && (elt.getAttribute("sliceTime").length() > 0)){ + sliceTime = Integer.decode(elt.getAttribute("sliceTime")).intValue(); + } + if ((elt.getAttribute("privacy") != null) && (elt.getAttribute("privacy").length() > 0)){ + privacy = Integer.decode(elt.getAttribute("privacy")).intValue(); + }*/ + } + }}} + } + } + + catch (Exception e) { + throw new MalformedModelingException(); + } + } + + + public int getByteDataSize(){ + return byteDataSize; + } + + /* public int getPipelineSize(){ + return pipelineSize; + } + + public int getSliceTime(){ + return sliceTime; + } + + public int getArbitrationPolicy(){ + return arbitrationPolicy; + } + public int getPrivacy(){ + return privacy; + }*/ + + public String getAttributes() { + String attr = ""; + attr += "Data size (in byte) = " + byteDataSize + "\n"; + /*attr += "Pipeline size = " + pipelineSize + "\n"; + if (arbitrationPolicy == HwBus.DEFAULT_ARBITRATION) { + attr += "Arbitration policy = basic Round Robin\n"; + } else if (arbitrationPolicy == HwBus.PRIORITY_BASED) { + attr += "Arbitration policy = priority based\n"; + } + attr += "Slice time (in microseconds) = " + sliceTime + "\n"; + attr += "Clock diviser = " + clockRatio + "\n";*/ + return attr; + } + + public int getComponentType() { + return TRANSFER; + } + +} diff --git a/src/ui/window/JDialogCrossbarNode.java b/src/ui/window/JDialogCrossbarNode.java new file mode 100755 index 0000000000000000000000000000000000000000..d1475899248ca95c8f1464d065113601f267f6d8 --- /dev/null +++ b/src/ui/window/JDialogCrossbarNode.java @@ -0,0 +1,257 @@ +/**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. + * + * /** + * Class JDialogCrossbarNode + * Dialog for managing attributes of crossbar nodes + * Creation: 31/10/2007 + * @version 1.0 31/10/2007 + * @author Ludovic APVRILLE adapted by Daniela Genius 10.08.2016 + * @see + */ + +package ui.window; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +//import javax.swing.event.*; +//import java.util.*; + +import ui.*; + +import ui.tmldd.*; + + +public class JDialogCrossbarNode extends javax.swing.JDialog implements ActionListener { + + private boolean regularClose; + + private JPanel panel2; + private Frame frame; + private TMLArchiCrossbarNode node; + + + // Panel1 + protected JTextField nodeName; + + // Panel2 + protected JTextField byteDataSize, pipelineSize, clockRatio; + protected JComboBox arbitrationPolicy, privacy; + protected JTextField sliceTime; + + + // Main Panel + private JButton closeButton; + private JButton cancelButton; + + /** Creates new form */ + public JDialogCrossbarNode(Frame _frame, String _title, TMLArchiCrossbarNode _node) { + super(_frame, _title, true); + frame = _frame; + node = _node; + + initComponents(); + myInitComponents(); + pack(); + } + + private void myInitComponents() { + } + + private void initComponents() { + Container c = getContentPane(); + GridBagLayout gridbag0 = new GridBagLayout(); + GridBagLayout gridbag1 = new GridBagLayout(); + GridBagLayout gridbag2 = new GridBagLayout(); + GridBagConstraints c0 = new GridBagConstraints(); + GridBagConstraints c1 = new GridBagConstraints(); + GridBagConstraints c2 = new GridBagConstraints(); + + setFont(new Font("Helvetica", Font.PLAIN, 14)); + c.setLayout(gridbag0); + + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + + + panel2 = new JPanel(); + panel2.setLayout(gridbag2); + panel2.setBorder(new javax.swing.border.TitledBorder("Crossbar attributes")); + panel2.setPreferredSize(new Dimension(400, 200)); + + c1.gridwidth = 1; + c1.gridheight = 1; + c1.weighty = 1.0; + c1.weightx = 1.0; + c1.fill = GridBagConstraints.HORIZONTAL; + panel2.add(new JLabel("Crossbar name:"), c2); + c1.gridwidth = GridBagConstraints.REMAINDER; //end row + nodeName = new JTextField(node.getNodeName(), 30); + nodeName.setEditable(true); + nodeName.setFont(new Font("times", Font.PLAIN, 12)); + panel2.add(nodeName, c1); + + /* c2.gridwidth = 1; + c2.gridheight = 1; + c2.weighty = 1.0; + c2.weightx = 1.0; + c2.fill = GridBagConstraints.HORIZONTAL; + panel2.add(new JLabel("Arbitration policy:"), c2);*/ + + /* c2.gridwidth = GridBagConstraints.REMAINDER; //end row + arbitrationPolicy = new JComboBox(); + arbitrationPolicy.addItem("Round Robin"); + arbitrationPolicy.addItem("Priority Based"); + arbitrationPolicy.addItem("CAN"); + arbitrationPolicy.addItem("Crossbar"); + arbitrationPolicy.setSelectedIndex(node.getArbitrationPolicy()); + panel2.add(arbitrationPolicy, c2);*/ + + c2.gridwidth = 1; + panel2.add(new JLabel("Data size (in byte):"), c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + byteDataSize = new JTextField(""+node.getByteDataSize(), 15); + panel2.add(byteDataSize, c2); + + /* c2.gridwidth = 1; + panel2.add(new JLabel("Pipeline size (num. stages):"), c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + pipelineSize = new JTextField(""+node.getPipelineSize(), 15); + panel2.add(pipelineSize, c2); + + c2.gridwidth = 1; + panel2.add(new JLabel("Slice time (in microseconds):"), c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + sliceTime = new JTextField(""+node.getSliceTime(), 15); + panel2.add(sliceTime, c2); + + c2.gridwidth = 1; + panel2.add(new JLabel("Clock diviser:"), c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + clockRatio = new JTextField(""+node.getClockRatio(), 15); + panel2.add(clockRatio, c2); + + c2.gridwidth = 1; + panel2.add(new JLabel("Bus Privacy:"), c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + privacy = new JComboBox(); + privacy.addItem("Public"); + privacy.addItem("Private"); + privacy.setSelectedIndex(node.getPrivacy()); + panel2.add(privacy, c2);*/ + + // main panel; + c0.gridheight = 10; + c0.weighty = 1.0; + c0.weightx = 1.0; + c0.gridwidth = GridBagConstraints.REMAINDER; //end row + c.add(panel2, c0); + + c0.gridwidth = 1; + c0.gridheight = 1; + c0.fill = GridBagConstraints.HORIZONTAL; + closeButton = new JButton("Save and Close", IconManager.imgic25); + //closeButton.setPreferredSize(new Dimension(600, 50)); + closeButton.addActionListener(this); + c.add(closeButton, c0); + c0.gridwidth = GridBagConstraints.REMAINDER; //end row + cancelButton = new JButton("Cancel", IconManager.imgic27); + cancelButton.addActionListener(this); + c.add(cancelButton, c0); + } + + public void actionPerformed(ActionEvent evt) { + /* if (evt.getSource() == typeBox) { + boolean b = ((Boolean)(initValues.elementAt(typeBox.getSelectedIndex()))).booleanValue(); + initialValue.setEnabled(b); + return; + }*/ + + + String command = evt.getActionCommand(); + + // Compare the action command to the known actions. + if (command.equals("Save and Close")) { + closeDialog(); + } else if (command.equals("Cancel")) { + cancelDialog(); + } + } + + public void closeDialog() { + regularClose = true; + dispose(); + } + + public void cancelDialog() { + dispose(); + } + + public boolean isRegularClose() { + return regularClose; + } + + public String getNodeName() { + return nodeName.getText(); + } + + public String getByteDataSize() { + return byteDataSize.getText(); + } + + /* public String getPipelineSize(){ + return pipelineSize.getText(); + } + + public String getClockRatio(){ + return clockRatio.getText(); + } + + public int getArbitrationPolicy() { + return arbitrationPolicy.getSelectedIndex(); + } + + + public int getPrivacy(){ + return privacy.getSelectedIndex(); + } + public String getSliceTime() { + return sliceTime.getText(); + }*/ + + +} diff --git a/src/ui/window/JDialogVGMNNode.java b/src/ui/window/JDialogVGMNNode.java new file mode 100755 index 0000000000000000000000000000000000000000..8110728511795b8f428a78bd8bfa0914462dccec --- /dev/null +++ b/src/ui/window/JDialogVGMNNode.java @@ -0,0 +1,257 @@ +/**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. + * + * /** + * Class JDialogBUSNode + * Dialog for managing attributes of bus nodes + * Creation: 31/10/2007 + * @version 1.0 31/10/2007 + * @author Ludovic APVRILLE adapted by Daniela Genius 10.08.2016 + * @see + */ + +package ui.window; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +//import javax.swing.event.*; +//import java.util.*; + +import ui.*; + +import ui.tmldd.*; + + +public class JDialogVGMNNode extends javax.swing.JDialog implements ActionListener { + + private boolean regularClose; + + private JPanel panel2; + private Frame frame; + private TMLArchiVGMNNode node; + + + // Panel1 + protected JTextField nodeName; + + // Panel2 + protected JTextField byteDataSize, pipelineSize, clockRatio; + protected JComboBox arbitrationPolicy, privacy; + protected JTextField sliceTime; + + + // Main Panel + private JButton closeButton; + private JButton cancelButton; + + /** Creates new form */ + public JDialogVGMNNode(Frame _frame, String _title, TMLArchiVGMNNode _node) { + super(_frame, _title, true); + frame = _frame; + node = _node; + + initComponents(); + myInitComponents(); + pack(); + } + + private void myInitComponents() { + } + + private void initComponents() { + Container c = getContentPane(); + GridBagLayout gridbag0 = new GridBagLayout(); + GridBagLayout gridbag1 = new GridBagLayout(); + GridBagLayout gridbag2 = new GridBagLayout(); + GridBagConstraints c0 = new GridBagConstraints(); + GridBagConstraints c1 = new GridBagConstraints(); + GridBagConstraints c2 = new GridBagConstraints(); + + setFont(new Font("Helvetica", Font.PLAIN, 14)); + c.setLayout(gridbag0); + + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + + + panel2 = new JPanel(); + panel2.setLayout(gridbag2); + panel2.setBorder(new javax.swing.border.TitledBorder("VGMN attributes")); + panel2.setPreferredSize(new Dimension(400, 200)); + + c1.gridwidth = 1; + c1.gridheight = 1; + c1.weighty = 1.0; + c1.weightx = 1.0; + c1.fill = GridBagConstraints.HORIZONTAL; + panel2.add(new JLabel("VGMN name:"), c2); + c1.gridwidth = GridBagConstraints.REMAINDER; //end row + nodeName = new JTextField(node.getNodeName(), 30); + nodeName.setEditable(true); + nodeName.setFont(new Font("times", Font.PLAIN, 12)); + panel2.add(nodeName, c1); + + /* c2.gridwidth = 1; + c2.gridheight = 1; + c2.weighty = 1.0; + c2.weightx = 1.0; + c2.fill = GridBagConstraints.HORIZONTAL; + panel2.add(new JLabel("Arbitration policy:"), c2); + + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + arbitrationPolicy = new JComboBox(); + arbitrationPolicy.addItem("Round Robin"); + arbitrationPolicy.addItem("Priority Based"); + arbitrationPolicy.addItem("CAN"); + arbitrationPolicy.addItem("Crossbar"); + arbitrationPolicy.setSelectedIndex(node.getArbitrationPolicy()); + panel2.add(arbitrationPolicy, c2);*/ + + c2.gridwidth = 1; + panel2.add(new JLabel("Data size (in byte):"), c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + byteDataSize = new JTextField(""+node.getByteDataSize(), 15); + panel2.add(byteDataSize, c2); + + /* c2.gridwidth = 1; + panel2.add(new JLabel("Pipeline size (num. stages):"), c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + pipelineSize = new JTextField(""+node.getPipelineSize(), 15); + panel2.add(pipelineSize, c2); + + c2.gridwidth = 1; + panel2.add(new JLabel("Slice time (in microseconds):"), c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + sliceTime = new JTextField(""+node.getSliceTime(), 15); + panel2.add(sliceTime, c2); + + c2.gridwidth = 1; + panel2.add(new JLabel("Clock diviser:"), c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + clockRatio = new JTextField(""+node.getClockRatio(), 15); + panel2.add(clockRatio, c2); + + c2.gridwidth = 1; + panel2.add(new JLabel("Bus Privacy:"), c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + privacy = new JComboBox(); + privacy.addItem("Public"); + privacy.addItem("Private"); + privacy.setSelectedIndex(node.getPrivacy()); + panel2.add(privacy, c2);*/ + + // main panel; + c0.gridheight = 10; + c0.weighty = 1.0; + c0.weightx = 1.0; + c0.gridwidth = GridBagConstraints.REMAINDER; //end row + c.add(panel2, c0); + + c0.gridwidth = 1; + c0.gridheight = 1; + c0.fill = GridBagConstraints.HORIZONTAL; + closeButton = new JButton("Save and Close", IconManager.imgic25); + //closeButton.setPreferredSize(new Dimension(600, 50)); + closeButton.addActionListener(this); + c.add(closeButton, c0); + c0.gridwidth = GridBagConstraints.REMAINDER; //end row + cancelButton = new JButton("Cancel", IconManager.imgic27); + cancelButton.addActionListener(this); + c.add(cancelButton, c0); + } + + public void actionPerformed(ActionEvent evt) { + /* if (evt.getSource() == typeBox) { + boolean b = ((Boolean)(initValues.elementAt(typeBox.getSelectedIndex()))).booleanValue(); + initialValue.setEnabled(b); + return; + }*/ + + + String command = evt.getActionCommand(); + + // Compare the action command to the known actions. + if (command.equals("Save and Close")) { + closeDialog(); + } else if (command.equals("Cancel")) { + cancelDialog(); + } + } + + public void closeDialog() { + regularClose = true; + dispose(); + } + + public void cancelDialog() { + dispose(); + } + + public boolean isRegularClose() { + return regularClose; + } + + public String getNodeName() { + return nodeName.getText(); + } + + public String getByteDataSize() { + return byteDataSize.getText(); + } + + /* public String getPipelineSize(){ + return pipelineSize.getText(); + } + + public String getClockRatio(){ + return clockRatio.getText(); + } + + public int getArbitrationPolicy() { + return arbitrationPolicy.getSelectedIndex(); + } + + + public int getPrivacy(){ + return privacy.getSelectedIndex(); + } + public String getSliceTime() { + return sliceTime.getText(); + }*/ + + +}