diff --git a/src/ui/ADDPanel.java b/src/ui/ADDPanel.java index ed25a12c2eeec6bb5b9aa86b8587e5bb871809fa..12c69fdd043b268e3dbaae58bc6b00793fe21f60 100755 --- a/src/ui/ADDPanel.java +++ b/src/ui/ADDPanel.java @@ -69,7 +69,7 @@ public class ADDPanel extends TURTLEPanel { } public void init() { - addDeploymentPanelDiagram("Avatar deployment diagram"); + addDeploymentPanelDiagram("Avatar Deployment Diagram"); } @@ -82,7 +82,7 @@ public class ADDPanel extends TURTLEPanel { //Class diagram tmladd = new ADDDiagramPanel(mgui, toolBar); - tmladd.setName("Avatar deployment diagram"); + tmladd.setName("Avatar Deployment Diagram"); tmladd.tp = this; tdp = tmladd; panels.add(tmladd); // Always first in list diff --git a/src/ui/AvatarDesignPanel.java b/src/ui/AvatarDesignPanel.java index 77502b6fb50cca6b56f5470f8d7c61c5f0c4fe01..f52f11ff7bbe434f2c071b5294f0b4ed85bba1b0 100644 --- a/src/ui/AvatarDesignPanel.java +++ b/src/ui/AvatarDesignPanel.java @@ -51,6 +51,7 @@ import javax.swing.*; import javax.swing.event.*; import java.util.*; import ui.avatarbd.*; +import ui.avatardd.*; import ui.avatarsmd.*; @@ -418,7 +419,10 @@ public class AvatarDesignPanel extends TURTLEPanel { } } - + + public ArrayList<String> getAllNonMappedAvatarBlockNames(String _name, ADDDiagramPanel _tadp, boolean ref, String name) { + return abdp.getAllNonMappedAvatarBlockNames(_name, _tadp, ref, name); + } } \ No newline at end of file diff --git a/src/ui/GTURTLEModeling.java b/src/ui/GTURTLEModeling.java index 82df6a0e1ad3ac2e649e5ad259fc0ac2ff38b226..f235286c4d97d99eda65295e332b34b826d15e37 100755 --- a/src/ui/GTURTLEModeling.java +++ b/src/ui/GTURTLEModeling.java @@ -3848,6 +3848,7 @@ public class GTURTLEModeling { int indexReq; int cpt_req = 0; + TraceManager.addDev("Loading ADD 0"); nameTab = elt.getAttribute("nameTab"); @@ -3861,6 +3862,7 @@ public class GTURTLEModeling { if (node.getNodeType() == Node.ELEMENT_NODE) { elt = (Element)node; if (elt.getTagName().compareTo("ADDDiagramPanel") == 0) { + TraceManager.addDev("Loading ADD 1"); loadADDDiagram(elt, indexReq, cpt_req); cpt_req ++; } @@ -4558,16 +4560,24 @@ public class GTURTLEModeling { String name; name = elt.getAttribute("name"); + + TraceManager.addDev("ADD 2"); mgui.createAvatarPD(indexAnalysis, name); + TraceManager.addDev("ADD 3"); TDiagramPanel tdp = mgui.getAvatarADDPanel(indexAnalysis, indexTab, name); + + TraceManager.addDev("ADD 3.1"); if (tdp == null) { + TraceManager.addDev("ADD 3.2"); throw new MalformedModelingException(); } tdp.removeAll(); + TraceManager.addDev("ADD 4"); loadDiagram(elt, tdp); + TraceManager.addDev("ADD 5"); } public void loadAvatarPD(Element elt, int indexAnalysis, int indexTab) throws MalformedModelingException, SAXException { diff --git a/src/ui/MainGUI.java b/src/ui/MainGUI.java index f7cf0f908ba2357873e05d0b1518b4470b8f782a..17e94c9dc9acf91c7c9720ddd8ea7d32f45085c7 100755 --- a/src/ui/MainGUI.java +++ b/src/ui/MainGUI.java @@ -1283,6 +1283,22 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe return list; } + + public Vector<String> getAllNonMappedAvatarBlockNames(ADDDiagramPanel tadp, String ref, String name) { + TURTLEPanel tp; + Vector<String> list = new Vector<String>(); + boolean b; + + for(int i=0; i<tabs.size(); i++) { + tp = (TURTLEPanel)(tabs.elementAt(i)); + if (tp instanceof AvatarDesignPanel) { + b = (mainTabbedPane.getTitleAt(i).compareTo(ref) == 0); + list.addAll(((AvatarDesignPanel)tp).getAllNonMappedAvatarBlockNames(mainTabbedPane.getTitleAt(i), tadp, b, name)); + } + } + + return list; + } public Vector<String> getAllCompositeComponent(TMLComponentTaskDiagramPanel tcdp) { TURTLEPanel tp; @@ -5898,6 +5914,8 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe } public ADDDiagramPanel getAvatarADDPanel(TURTLEPanel tp, int indexTab, String s) { + TraceManager.addDev("index=" + indexTab + " s=" + s + "title=" +tp.tabbedPane.getTitleAt(indexTab)); + if(tp.tabbedPane.getTitleAt(indexTab).equals(s)) { return (ADDDiagramPanel)(tp.panelAt(indexTab)); } diff --git a/src/ui/TGComponentManager.java b/src/ui/TGComponentManager.java index 9f5cb7a7847043db118b11047195c87f2cb3aa11..eb47635846a2080de1b17a64d497dc58026eb14c 100755 --- a/src/ui/TGComponentManager.java +++ b/src/ui/TGComponentManager.java @@ -1713,6 +1713,11 @@ public class TGComponentManager { // AVATAR AD case AAD_ASSOCIATION_CONNECTOR: tgc = new AvatarADAssociationConnector(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp, p1, p2, listPoint); + break; + + // AVATAR DD + case ADD_CONNECTOR: + tgc = new ADDConnector(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp, p1, p2, listPoint); break; // AVATAR PD diff --git a/src/ui/TGUIAction.java b/src/ui/TGUIAction.java index e3a1fbf44a77f39ce57e5bae92502e8e554068e2..84f5f8e40ad918b5133e2a7f99126404e43d957b 100755 --- a/src/ui/TGUIAction.java +++ b/src/ui/TGUIAction.java @@ -748,10 +748,10 @@ public class TGUIAction extends AbstractAction { 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_TTYNODE] = new TAction("add-add-tty", "Add a tty node", IconManager.imgic1102, IconManager.imgic1102, "TTY", "Add a tty 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); actions[ADD_BRIDGENODE] = new TAction("add-tmlarchi-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.imgic1106, IconManager.imgic1106, "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 hardware accelerator 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); diff --git a/src/ui/avatarbd/AvatarBDPanel.java b/src/ui/avatarbd/AvatarBDPanel.java index e24bd45f74d39da9986e3dbfad19fdd1c58b1068..83a429a4766e6d2cd8e205cbe8f47301b25e110c 100644 --- a/src/ui/avatarbd/AvatarBDPanel.java +++ b/src/ui/avatarbd/AvatarBDPanel.java @@ -50,7 +50,7 @@ package ui.avatarbd; import org.w3c.dom.*; import ui.*; -import ui.tmldd.*; +import ui.avatardd.*; import java.util.*; import myutil.*; @@ -579,4 +579,29 @@ public class AvatarBDPanel extends TDiagramPanel { ign = null; } + public ArrayList<String> getAllNonMappedAvatarBlockNames(String _topName, ADDDiagramPanel _tadp, boolean ref, String _name) { + + Iterator iterator = componentList.listIterator(); + ArrayList<String> list = new ArrayList<String>(); + String name; + + + for(AvatarBDBlock block: getFullBlockList()) { + + name = block.getBlockName(); + if (ref && name.equals(_name)) { + list.add(_topName + "::" + name); + } else { + if (!_tadp.isMapped(_topName, name)) { + list.add(_topName + "::" + name); + } + } + + } + + return list; + } + + + } diff --git a/src/ui/avatardd/ADDBlockArtifact.java b/src/ui/avatardd/ADDBlockArtifact.java index 51e22bdfb24c265b50e1725fdf5c13203b8967a0..25e49ebaa94b69d3b1b1ef33e1575d924ddd71f9 100755 --- a/src/ui/avatardd/ADDBlockArtifact.java +++ b/src/ui/avatardd/ADDBlockArtifact.java @@ -68,7 +68,7 @@ public class ADDBlockArtifact extends TGCWithoutInternalComponent implements Swa protected String oldValue = ""; protected String referenceTaskName = "referenceToBlock"; - protected String taskName = "name"; + protected String taskName = "blockName"; public ADDBlockArtifact(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); @@ -85,8 +85,8 @@ public class ADDBlockArtifact extends TGCWithoutInternalComponent implements Swa removable = true; value = "AvatarDesign::block"; - taskName = "name"; - referenceTaskName = "AvatarBlock"; + taskName = "Blockname"; + referenceTaskName = "AvatarDesign"; makeFullValue(); @@ -148,7 +148,7 @@ public class ADDBlockArtifact extends TGCWithoutInternalComponent implements Swa String tmp; boolean error = false; - /*JDialogTMLTaskArtifact dialog = new JDialogTMLTaskArtifact(frame, "Setting artifact attributes", this); + JDialogAvatarBlockArtifact dialog = new JDialogAvatarBlockArtifact(frame, "Setting artifact attributes", this); dialog.setSize(400, 350); GraphicLib.centerOnParent(dialog); dialog.show(); // blocked until dialog has been closed @@ -178,7 +178,6 @@ public class ADDBlockArtifact extends TGCWithoutInternalComponent implements Swa } } - priority = dialog.getPriority(); if (error) { JOptionPane.showMessageDialog(frame, @@ -188,7 +187,7 @@ public class ADDBlockArtifact extends TGCWithoutInternalComponent implements Swa } makeFullValue(); - */ + return !error; diff --git a/src/ui/avatardd/ADDBusNode.java b/src/ui/avatardd/ADDBusNode.java index 9358370f199b66c69e476a7ad0c971dd13400dee..8b564a0e2b58e11dde7c5b52d29318a0c170d663 100755 --- a/src/ui/avatardd/ADDBusNode.java +++ b/src/ui/avatardd/ADDBusNode.java @@ -71,6 +71,8 @@ public class ADDBusNode extends ADDCommunicationNode implements WithAttributes { private int fifoDepth = 0; private int minLatency = 0; + + public ADDBusNode(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); @@ -181,7 +183,7 @@ public class ADDBusNode extends ADDCommunicationNode implements WithAttributes { int tmp; String tmpName; - /*JDialogBUSNode dialog = new JDialogBUSNode(frame, "Setting bus attributes", this); + JDialogADDBusNode dialog = new JDialogADDBusNode(frame, "Setting bus attributes", this); dialog.setSize(500, 450); GraphicLib.centerOnParent(dialog); dialog.show(); // blocked until dialog has been closed @@ -203,65 +205,82 @@ public class ADDBusNode extends ADDCommunicationNode implements WithAttributes { - if (dialog.getByteDataSize().length() != 0) { + if (dialog.getIndex().length() != 0) { try { - tmp = byteDataSize; - byteDataSize = Integer.decode(dialog.getByteDataSize()).intValue(); - if (byteDataSize <= 0) { - byteDataSize = tmp; + tmp = index; + index = Integer.decode(dialog.getIndex()).intValue(); + if (index < 0) { + index = tmp; error = true; - errors += "Data size "; + errors += "index "; } } catch (Exception e) { error = true; - errors += "Data size "; + errors += "index "; } } - if (dialog.getSliceTime().length() != 0) { + if (dialog.getNbAttachedInitiat().length() != 0) { try { - tmp = sliceTime; - sliceTime = Integer.decode(dialog.getSliceTime()).intValue(); - if (sliceTime <= 0) { - sliceTime = tmp; + tmp = nbAttachedInitiat; + nbAttachedInitiat = Integer.decode(dialog.getNbAttachedInitiat()).intValue(); + if (nbAttachedInitiat < 0) { + nbAttachedInitiat = tmp; error = true; - errors += "Slice time "; + errors += "nbAttachedInitiat "; } } catch (Exception e) { error = true; - errors += "Slice time "; + errors += "nbAttachedInitiat "; } } - if (dialog.getPipelineSize().length() != 0) { + + if (dialog.getNbAttachedTarget().length() != 0) { try { - tmp = pipelineSize; - pipelineSize = Integer.decode(dialog.getPipelineSize()).intValue(); - if (pipelineSize <= 0) { - pipelineSize = tmp; + tmp = nbAttachedTarget; + nbAttachedTarget = Integer.decode(dialog.getNbAttachedTarget()).intValue(); + if (nbAttachedTarget < 0) { + nbAttachedTarget = tmp; error = true; - errors += "Pipeline size "; + errors += "nbAttachedTarget "; } } catch (Exception e) { error = true; - errors += "Pipeline size "; + errors += "nbAttachedTarget "; + } + } + + if (dialog.getFifoDepth().length() != 0) { + try { + tmp = fifoDepth; + fifoDepth = Integer.decode(dialog.getFifoDepth()).intValue(); + if (fifoDepth < 0) { + fifoDepth = tmp; + error = true; + errors += "fifoDepth "; + } + } catch (Exception e) { + error = true; + errors += "fifoDepth "; } } - if (dialog.getClockRatio().length() != 0) { + if (dialog.getMinLatency().length() != 0) { try { - tmp = clockRatio; - clockRatio = Integer.decode(dialog.getClockRatio()).intValue(); - if (clockRatio <= 0) { - clockRatio = tmp; + tmp = minLatency; + minLatency = Integer.decode(dialog.getMinLatency()).intValue(); + if (minLatency < 0) { + minLatency = tmp; error = true; - errors += "Clock ratio "; + errors += "minLatency "; } } catch (Exception e) { error = true; - errors += "Clock ratio "; + errors += "minLatency "; } } + if (error) { JOptionPane.showMessageDialog(frame, @@ -269,7 +288,7 @@ public class ADDBusNode extends ADDCommunicationNode implements WithAttributes { "Error", JOptionPane.INFORMATION_MESSAGE); return false; - }*/ + } return true; } @@ -355,5 +374,11 @@ public class ADDBusNode extends ADDCommunicationNode implements WithAttributes { return attr; } + public int getIndex() { return index;} + public int getNbAttachedInitiat() { return nbAttachedInitiat;} + public int getNbAttachedTarget() { return nbAttachedTarget;} + public int getFifoDepth() { return fifoDepth;} + public int getMinLatency() { return minLatency;} + } diff --git a/src/ui/avatardd/ADDCPUNode.java b/src/ui/avatardd/ADDCPUNode.java index d7d1e6bfe909d2e97d313324e1ad26e11b3ee0d7..8c13238015c0e307a77ecded6e4db18b27229baf 100755 --- a/src/ui/avatardd/ADDCPUNode.java +++ b/src/ui/avatardd/ADDCPUNode.java @@ -59,487 +59,453 @@ import ui.window.*; import tmltranslator.*; public class ADDCPUNode extends ADDNode implements SwallowTGComponent, WithAttributes { - private int textY1 = 15; - private int textY2 = 30; - private int derivationx = 2; - private int derivationy = 3; - private String stereotype = "CPU"; - - private int nbOfIrq = 6; - private int iCacheWays = 0; - private int iCacheSets = 0; - private int iCacheWords = 0; - private int dCacheWays = 0; - private int dCacheSets = 0; - private int dCacheWords = 0; - - - public ADDCPUNode(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 = 200; - minWidth = 150; - minHeight = 100; - - nbConnectingPoint = 16; - connectingPoint = new TGConnectingPoint[16]; - - connectingPoint[0] = new ADDConnectingPoint(this, 0, 0, false, true, 0.0, 0.0); - connectingPoint[1] = new ADDConnectingPoint(this, 0, 0, false, true, 0.5, 0.0); - connectingPoint[2] = new ADDConnectingPoint(this, 0, 0, false, true, 1.0, 0.0); - connectingPoint[3] = new ADDConnectingPoint(this, 0, 0, false, true, 0.0, 0.5); - connectingPoint[4] = new ADDConnectingPoint(this, 0, 0, false, true, 1.0, 0.5); - connectingPoint[5] = new ADDConnectingPoint(this, 0, 0, false, true, 0.0, 1.0); - connectingPoint[6] = new ADDConnectingPoint(this, 0, 0, false, true, 0.5, 1.0); - connectingPoint[7] = new ADDConnectingPoint(this, 0, 0, false, true, 1.0, 1.0); - - connectingPoint[8] = new ADDConnectingPoint(this, 0, 0, false, true, 0.25, 0.0); - connectingPoint[9] = new ADDConnectingPoint(this, 0, 0, false, true, 0.75, 0.0); - connectingPoint[10] = new ADDConnectingPoint(this, 0, 0, false, true, 0.0, 0.25); - connectingPoint[11] = new ADDConnectingPoint(this, 0, 0, false, true, 1.0, 0.25); - connectingPoint[12] = new ADDConnectingPoint(this, 0, 0, false, true, 0.0, 0.75); - connectingPoint[13] = new ADDConnectingPoint(this, 0, 0, false, true, 1.0, 0.75); - connectingPoint[14] = new ADDConnectingPoint(this, 0, 0, false, true, 0.25, 1.0); - connectingPoint[15] = new ADDConnectingPoint(this, 0, 0, false, true, 0.75, 1.0); - - addTGConnectingPointsComment(); - - nbInternalTGComponent = 0; - - moveable = true; - editable = true; - removable = true; - userResizable = true; - - name = tdp.findNodeName("CPU"); - 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.CPU_BOX_1); - 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.imgic1100.getImage(), x + 4, y + 4, null); - g.drawImage(IconManager.img9, x + width - 20, y + 4, null); - } - - 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; + private int textY1 = 15; + private int textY2 = 30; + private int derivationx = 2; + private int derivationy = 3; + private String stereotype = "CPU"; + + private int nbOfIrq = 6; + private int iCacheWays = 0; + private int iCacheSets = 0; + private int iCacheWords = 0; + private int dCacheWays = 0; + private int dCacheSets = 0; + private int dCacheWords = 0; + + + + public ADDCPUNode(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 = 200; + minWidth = 150; + minHeight = 100; + + nbConnectingPoint = 16; + connectingPoint = new TGConnectingPoint[16]; + + connectingPoint[0] = new ADDConnectingPoint(this, 0, 0, false, true, 0.0, 0.0); + connectingPoint[1] = new ADDConnectingPoint(this, 0, 0, false, true, 0.5, 0.0); + connectingPoint[2] = new ADDConnectingPoint(this, 0, 0, false, true, 1.0, 0.0); + connectingPoint[3] = new ADDConnectingPoint(this, 0, 0, false, true, 0.0, 0.5); + connectingPoint[4] = new ADDConnectingPoint(this, 0, 0, false, true, 1.0, 0.5); + connectingPoint[5] = new ADDConnectingPoint(this, 0, 0, false, true, 0.0, 1.0); + connectingPoint[6] = new ADDConnectingPoint(this, 0, 0, false, true, 0.5, 1.0); + connectingPoint[7] = new ADDConnectingPoint(this, 0, 0, false, true, 1.0, 1.0); + + connectingPoint[8] = new ADDConnectingPoint(this, 0, 0, false, true, 0.25, 0.0); + connectingPoint[9] = new ADDConnectingPoint(this, 0, 0, false, true, 0.75, 0.0); + connectingPoint[10] = new ADDConnectingPoint(this, 0, 0, false, true, 0.0, 0.25); + connectingPoint[11] = new ADDConnectingPoint(this, 0, 0, false, true, 1.0, 0.25); + connectingPoint[12] = new ADDConnectingPoint(this, 0, 0, false, true, 0.0, 0.75); + connectingPoint[13] = new ADDConnectingPoint(this, 0, 0, false, true, 1.0, 0.75); + connectingPoint[14] = new ADDConnectingPoint(this, 0, 0, false, true, 0.25, 1.0); + connectingPoint[15] = new ADDConnectingPoint(this, 0, 0, false, true, 0.75, 1.0); + + addTGConnectingPointsComment(); + + nbInternalTGComponent = 0; + + moveable = true; + editable = true; + removable = true; + userResizable = true; + + name = tdp.findNodeName("CPU"); + value = "name"; + + myImageIcon = IconManager.imgic700; } - 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; - - /*JDialogCPUNode dialog = new JDialogCPUNode(frame, "Setting CPU attributes", this); - dialog.setSize(500, 450); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed - - if (!dialog.isRegularClose()) { - return false; + 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.CPU_BOX_1); + 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.imgic1100.getImage(), x + 4, y + 4, null); + g.drawImage(IconManager.img9, x + width - 20, y + 4, null); } - 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; - } + 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; } - schedulingPolicy = dialog.getSchedulingPolicy(); - if (schedulingPolicy == HwCPU.BASIC_ROUND_ROBIN) { - stereotype = "CPURR"; + public String getStereotype() { + return stereotype; + } - if (schedulingPolicy == HwCPU.ROUND_ROBIN_PRIORITY_BASED) { - stereotype = "CPURRPB"; + public String getNodeName() { + return name; } - if (dialog.getSliceTime().length() != 0) { - try { - tmp = sliceTime; - sliceTime = Integer.decode(dialog.getSliceTime()).intValue(); - if (sliceTime <= 0) { - sliceTime = tmp; - error = true; - errors += "Slice time "; + public boolean editOndoubleClick(JFrame frame) { + boolean error = false; + String errors = ""; + int tmp; + String tmpName; + + JDialogADDCPUNode dialog = new JDialogADDCPUNode(frame, "Setting CPU attributes", this); + dialog.setSize(500, 450); + GraphicLib.centerOnParent(dialog); + dialog.show(); // blocked until dialog has been closed + + if (!dialog.isRegularClose()) { + return false; } - } catch (Exception e) { - error = true; - errors += "Slice time "; - } - } - - if (dialog.getNbOfCores().length() != 0) { - try { - tmp = nbOfCores; - nbOfCores = Integer.decode(dialog.getNbOfCores()).intValue(); - if (nbOfCores <= 0) { - nbOfCores = tmp; - error = true; - errors += "Data size "; + + 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; + } + } + + + if (dialog.getNbOFIRQ().length() != 0) { + try { + tmp = nbOfIrq; + nbOfIrq = Integer.decode(dialog.getNbOFIRQ()).intValue(); + if (nbOfIrq < 0) { + nbOfIrq = tmp; + error = true; + errors += "IRQ "; + } + } catch (Exception e) { + error = true; + errors += "IRQ "; + } + } + + if (dialog.getICacheWays().length() != 0) { + try { + tmp = iCacheWays; + iCacheWays = Integer.decode(dialog.getICacheWays()).intValue(); + if (iCacheWays < 0) { + iCacheWays = tmp; + error = true; + errors += "iCacheWays "; + } + } catch (Exception e) { + error = true; + errors += "iCacheWays "; + } } - } catch (Exception e) { + + if (dialog.getICacheSets().length() != 0) { + try { + tmp = iCacheSets; + iCacheSets = Integer.decode(dialog.getICacheSets()).intValue(); + if (iCacheSets < 0) { + iCacheSets = tmp; + error = true; + errors += "iCacheSets "; + } + } catch (Exception e) { + error = true; + errors += "iCacheSets "; + } + } + + if (dialog.getICacheWords().length() != 0) { + try { + tmp = iCacheWords; + iCacheWords = Integer.decode(dialog.getICacheWords()).intValue(); + if (iCacheWords < 0) { + iCacheWords = tmp; + error = true; + errors += "iCacheWords "; + } + } catch (Exception e) { + error = true; + errors += "iCacheWords "; + } + } + + if (dialog.getDCacheWays().length() != 0) { + try { + tmp = dCacheWays; + dCacheWays = Integer.decode(dialog.getDCacheWays()).intValue(); + if (dCacheWays < 0) { + dCacheWays = tmp; + error = true; + errors += "dCacheWays "; + } + } catch (Exception e) { + error = true; + errors += "dCacheWays "; + } + } + + if (dialog.getDCacheSets().length() != 0) { + try { + tmp = dCacheSets; + dCacheSets = Integer.decode(dialog.getDCacheSets()).intValue(); + if (dCacheSets < 0) { + dCacheSets = tmp; + error = true; + errors += "dCacheSets "; + } + } catch (Exception e) { + error = true; + errors += "dCacheSets "; + } + } + + if (dialog.getDCacheWords().length() != 0) { + try { + tmp = dCacheWords; + dCacheWords = Integer.decode(dialog.getDCacheWords()).intValue(); + if (dCacheWords < 0) { + dCacheWords = tmp; + error = true; + errors += "dCacheWords "; + } + } catch (Exception e) { + error = true; + errors += "dCacheWords "; + } + } + + + + /*if (dialog.getClockRatio().length() != 0) { + try { + tmp = clockRatio; + clockRatio = Integer.decode(dialog.getClockRatio()).intValue(); + if (clockRatio < 1) { + clockRatio = tmp; error = true; - errors += "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 "; + errors += "Clock ratio "; } - } catch (Exception e) { + } catch (Exception e) { error = true; - errors += "Data size "; - } + errors += "Clock ratio "; + } + }*/ + + if (error) { + JOptionPane.showMessageDialog(frame, + "Invalid value for the following attributes: " + errors, + "Error", + JOptionPane.INFORMATION_MESSAGE); + return false; + } + + return true; } - 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 "; - } + + public int getType() { + return TGComponentManager.ADD_CPUNODE; } - if (dialog.getGoIdleTime().length() != 0) { - try { - tmp = goIdleTime; - goIdleTime = Integer.decode(dialog.getGoIdleTime()).intValue(); - if (goIdleTime < 0) { - goIdleTime = tmp; - error = true; - errors += "Go idle time "; + public boolean acceptSwallowedTGComponent(TGComponent tgc) { + //TraceManager.addDev("Accept swallowed?"); + if (tgc instanceof ADDBlockArtifact) { + return true; } - } catch (Exception e) { - error = true; - errors += "Go idle time "; - } + + return false; } - if (dialog.getMaxConsecutiveIdleCycles().length() != 0) { - try { - tmp = goIdleTime; - maxConsecutiveIdleCycles = Integer.decode(dialog.getMaxConsecutiveIdleCycles()).intValue(); - if (maxConsecutiveIdleCycles < 0) { - maxConsecutiveIdleCycles = tmp; - error = true; - errors += "Max consecutive idle cycles "; + public boolean addSwallowedTGComponent(TGComponent tgc, int x, int y) { + //TraceManager.addDev("Add swallowed?"); + //Set its coordinates + if (tgc instanceof ADDBlockArtifact) { + tgc.setFather(this); + tgc.setDrawingZone(true); + ((ADDBlockArtifact)tgc).resizeWithFather(); + //TraceManager.addDev("Add swallowed!!!"); + addInternalComponent(tgc, 0); + return true; } - } catch (Exception e) { - error = true; - errors += "Max consecutive idle cycles "; - } + + return false; + } - if (dialog.getExeciTime().length() != 0) { - try { - tmp = execiTime; - execiTime = Integer.decode(dialog.getExeciTime()).intValue(); - if (execiTime < 0) { - execiTime = tmp; - error = true; - errors += "execi time "; - } - } catch (Exception e) { - error = true; - errors += "execi time "; - } + public void removeSwallowedTGComponent(TGComponent tgc) { + removeInternalComponent(tgc); } - if (dialog.getExeccTime().length() != 0) { - try { - tmp = execcTime; - execcTime = Integer.decode(dialog.getExeccTime()).intValue(); - if (execcTime < 0) { - execcTime = tmp; - error = true; - errors += "execc time "; + + public Vector getArtifactList() { + Vector v = new Vector(); + for(int i=0; i<nbInternalTGComponent; i++) { + if (tgcomponent[i] instanceof ADDBlockArtifact) { + v.add(tgcomponent[i]); + } } - } catch (Exception e) { - error = true; - errors += "execc time "; - } + return v; } - if (dialog.getTaskSwitchingTime().length() != 0) { - try { - tmp = taskSwitchingTime; - taskSwitchingTime = Integer.decode(dialog.getTaskSwitchingTime()).intValue(); - if (taskSwitchingTime <= 0) { - taskSwitchingTime = tmp; - error = true; - errors += "Task switching time "; + public void hasBeenResized() { + for(int i=0; i<nbInternalTGComponent; i++) { + if (tgcomponent[i] instanceof ADDBlockArtifact) { + ((ADDBlockArtifact)tgcomponent[i]).resizeWithFather(); + } } - } catch (Exception e) { - error = true; - errors += "Task switching time "; - } + } - if (dialog.getBranchingPredictionPenalty().length() != 0) { - try { - tmp = branchingPredictionPenalty; - branchingPredictionPenalty = Integer.decode(dialog.getBranchingPredictionPenalty()).intValue(); - if ((branchingPredictionPenalty < 0) || (branchingPredictionPenalty > 100)) { - branchingPredictionPenalty = tmp; - error = true; - errors += "Mis-branching prediction "; - } - } catch (Exception e) { - error = true; - errors += "Mis-branching prediction "; - } + protected String translateExtraParam() { + StringBuffer sb = new StringBuffer("<extraparam>\n"); + sb.append("<info stereotype=\"" + stereotype + "\" nodeName=\"" + name); + sb.append("\" />\n"); + sb.append("<attributes nbOfIrq=\"" + nbOfIrq + "\" "); + sb.append(" iCacheWays=\"" + iCacheWays + "\" "); + sb.append(" iCacheSets=\"" + iCacheSets + "\" "); + sb.append(" iCacheWords=\"" + iCacheWords + "\" "); + sb.append(" dCacheWays=\"" + dCacheWays + "\" "); + sb.append(" dCacheSets=\"" + dCacheSets + "\" "); + sb.append(" dCacheWords=\"" + dCacheWords + "\" "); + //sb.append(" clockRatio=\"" + clockRatio + "\""); + sb.append("/>\n"); + sb.append("</extraparam>\n"); + return new String(sb); } - if (dialog.getCacheMiss().length() != 0) { - try { - tmp = cacheMiss; - cacheMiss = Integer.decode(dialog.getCacheMiss()).intValue(); - if ((cacheMiss < 0) || (cacheMiss > 100)) { - cacheMiss = tmp; - error = true; - errors += "Cache-miss "; + 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")) { + + nbOfIrq = Integer.decode(elt.getAttribute("nbOfIrq")).intValue(); + iCacheWays =Integer.decode(elt.getAttribute("iCacheWays")).intValue(); + iCacheSets = Integer.decode(elt.getAttribute("iCacheSets")).intValue(); + iCacheWords = Integer.decode(elt.getAttribute("iCacheWords")).intValue(); + dCacheWays =Integer.decode(elt.getAttribute("dCacheWays")).intValue(); + dCacheSets = Integer.decode(elt.getAttribute("dCacheSets")).intValue(); + dCacheWords = Integer.decode(elt.getAttribute("dCacheWords")).intValue(); + + } + } + } + } + } + + } catch (Exception e) { + throw new MalformedModelingException(); } - } catch (Exception e) { - error = true; - errors += "Cache-miss "; - } } - if (dialog.getClockRatio().length() != 0) { - try { - tmp = clockRatio; - clockRatio = Integer.decode(dialog.getClockRatio()).intValue(); - if (clockRatio < 1) { - clockRatio = tmp; - error = true; - errors += "Clock ratio "; - } - } catch (Exception e) { - error = true; - errors += "Clock ratio "; - } + public int getDefaultConnector() { + return TGComponentManager.ADD_CONNECTOR; } - 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.ADD_CPUNODE; - } - - public boolean acceptSwallowedTGComponent(TGComponent tgc) { - if (tgc instanceof ADDArtifact) { - return true; + public String getAttributes() { + String attr = ""; + attr += "Nb of irq = " + nbOfIrq + "\n"; + attr += "iCacheWays = " + iCacheWays + "\n"; + attr += "iCacheSets = " + iCacheSets + "\n"; + attr += "iCacheWords = " + iCacheWords + "\n"; + attr += "dCacheWays = " + dCacheWays + "\n"; + attr += "dCacheSets = " + dCacheSets + "\n"; + attr += "dCacheWords = " + dCacheWords + "\n"; + + return attr; } - return false; - } - - public boolean addSwallowedTGComponent(TGComponent tgc, int x, int y) { - - //Set its coordinates - if (tgc instanceof ADDArtifact) { - tgc.setFather(this); - tgc.setDrawingZone(true); - ((ADDArtifact)tgc).resizeWithFather(); - addInternalComponent(tgc, 0); - return true; + public int getNbOfIRQs() { + return nbOfIrq; } - return false; + public int getICacheWays() { + return iCacheWays; + } - } - - public void removeSwallowedTGComponent(TGComponent tgc) { - removeInternalComponent(tgc); - } - - - public Vector getArtifactList() { - Vector v = new Vector(); - for(int i=0; i<nbInternalTGComponent; i++) { - if (tgcomponent[i] instanceof ADDArtifact) { - v.add(tgcomponent[i]); - } + public int getICacheSets() { + return iCacheSets; } - return v; - } - - public void hasBeenResized() { - for(int i=0; i<nbInternalTGComponent; i++) { - if (tgcomponent[i] instanceof ADDArtifact) { - ((ADDArtifact)tgcomponent[i]).resizeWithFather(); - } + + public int getICacheWords() { + return iCacheWords; } - } - - protected String translateExtraParam() { - StringBuffer sb = new StringBuffer("<extraparam>\n"); - sb.append("<info stereotype=\"" + stereotype + "\" nodeName=\"" + name); - sb.append("\" />\n"); - sb.append("<attributes nbOfIrq=\"" + nbOfIrq + "\" "); - sb.append(" iCacheWays=\"" + iCacheWays + "\" "); - sb.append(" iCacheSets=\"" + iCacheSets + "\" "); - sb.append(" iCacheWords=\"" + iCacheWords + "\" "); - sb.append(" dCacheWays=\"" + iCacheWays + "\" "); - sb.append(" dCacheSets=\"" + iCacheSets + "\" "); - sb.append(" dCacheWords=\"" + iCacheWords + "\" "); - //sb.append(" clockRatio=\"" + clockRatio + "\""); - 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")) { - - nbOfIrq = Integer.decode(elt.getAttribute("nbOfIrq")).intValue(); - iCacheWays =Integer.decode(elt.getAttribute("iCacheWays")).intValue(); - iCacheSets = Integer.decode(elt.getAttribute("iCacheSets")).intValue(); - iCacheWords = Integer.decode(elt.getAttribute("iCacheWords")).intValue(); - dCacheWays =Integer.decode(elt.getAttribute("dCacheWays")).intValue(); - dCacheSets = Integer.decode(elt.getAttribute("dCacheSets")).intValue(); - dCacheWords = Integer.decode(elt.getAttribute("dCacheWords")).intValue(); - - } - } - } - } - } - - } catch (Exception e) { - throw new MalformedModelingException(); + public int getDCacheWays() { + return dCacheWays; + } + + public int getDCacheSets() { + return dCacheSets; + } + + public int getDCacheWords() { + return dCacheWords; } - } - - public int getDefaultConnector() { - return TGComponentManager.ADD_CONNECTOR; - } - - - public String getAttributes() { - String attr = ""; - attr += "Nb of irq = " + nbOfIrq + "\n"; - attr += "iCacheWays = " + iCacheWays + "\n"; - attr += "iCacheSets = " + iCacheSets + "\n"; - attr += "iCacheWords = " + iCacheWords + "\n"; - attr += "dCacheWays = " + dCacheWays + "\n"; - attr += "dCacheSets = " + dCacheSets + "\n"; - attr += "dCacheWords = " + dCacheWords + "\n"; - return attr; - } - + } diff --git a/src/ui/avatardd/ADDDiagramPanel.java b/src/ui/avatardd/ADDDiagramPanel.java index 1d80858a5e4935b35f84fe10b1b2b583cbbbbfd9..b66df628c0fa01bd2c75fd30df8e14f6288c4611 100755 --- a/src/ui/avatardd/ADDDiagramPanel.java +++ b/src/ui/avatardd/ADDDiagramPanel.java @@ -235,22 +235,23 @@ public class ADDDiagramPanel extends TDiagramPanel implements TDPWithAttributes } return ll; - } + }*/ public boolean isMapped(String _ref, String _name) { - ListIterator iterator = getListOfNodes().listIterator(); - TMLArchiNode node; + ListIterator iterator = componentList.listIterator(); + TGComponent tgc; + ADDCPUNode node; Vector v; - TMLArchiArtifact artifact; + ADDBlockArtifact artifact; int i; String name = _ref + "::" + _name; while(iterator.hasNext()) { - node = (TMLArchiNode)(iterator.next()); - if (node instanceof TMLArchiCPUNode) { - v = ((TMLArchiCPUNode)(node)).getArtifactList(); + tgc = (TGComponent)(iterator.next()); + if (tgc instanceof ADDCPUNode) { + v = ((ADDCPUNode)(tgc)).getArtifactList(); for(i=0; i<v.size(); i++) { - artifact = (TMLArchiArtifact)(v.get(i)); + artifact = (ADDBlockArtifact)(v.get(i)); if (artifact.getValue().equals(name)) { return true; } @@ -261,7 +262,7 @@ public class ADDDiagramPanel extends TDiagramPanel implements TDPWithAttributes return false; } - public void renameMapping(String oldName, String newName) { + /*public void renameMapping(String oldName, String newName) { ListIterator iterator = getListOfNodes().listIterator(); TMLArchiNode node; Vector v; diff --git a/src/ui/avatardd/ADDDiagramToolBar.java b/src/ui/avatardd/ADDDiagramToolBar.java index 6543212188ddc581d74e5bc1f0dc4297e565fd92..411a3d6d13abe605291e71e97e52ef0906f54ba6 100755 --- a/src/ui/avatardd/ADDDiagramToolBar.java +++ b/src/ui/avatardd/ADDDiagramToolBar.java @@ -69,6 +69,7 @@ public class ADDDiagramToolBar extends TToolBar { mgui.actions[TGUIAction.ADD_BUSNODE].setEnabled(b); mgui.actions[TGUIAction.ADD_BRIDGENODE].setEnabled(b); mgui.actions[TGUIAction.ADD_BLOCKARTIFACT].setEnabled(b); + mgui.actions[TGUIAction.ADD_TTYNODE].setEnabled(b); mgui.actions[TGUIAction.ADD_RAMNODE].setEnabled(b); mgui.actions[TGUIAction.ADD_ROMNODE].setEnabled(b); mgui.actions[TGUIAction.ADD_DMANODE].setEnabled(b); @@ -112,6 +113,11 @@ public class ADDDiagramToolBar extends TToolBar { this.addSeparator(); button = this.add(mgui.actions[TGUIAction.ADD_DMANODE]); + button.addMouseListener(mgui.mouseHandler); + + this.addSeparator(); + + button = this.add(mgui.actions[TGUIAction.ADD_TTYNODE]); button.addMouseListener(mgui.mouseHandler); this.addSeparator(); diff --git a/src/ui/avatardd/ADDROMNode.java b/src/ui/avatardd/ADDROMNode.java index d698bac8e414d18469e86340dcf960d408e94703..5bb7324f155fd016fb1bd9ccc0864fb756cd83d3 100755 --- a/src/ui/avatardd/ADDROMNode.java +++ b/src/ui/avatardd/ADDROMNode.java @@ -63,7 +63,7 @@ public class ADDROMNode extends ADDCommunicationNode implements WithAttributes private int textY2 = 30; private int derivationx = 2; private int derivationy = 3; - private String stereotype = "RAM"; + private String stereotype = "ROM"; private int index = 0; private int byteDataSize = HwMemory.DEFAULT_BYTE_DATA_SIZE; diff --git a/src/ui/window/JDialogADDBusNode.java b/src/ui/window/JDialogADDBusNode.java new file mode 100755 index 0000000000000000000000000000000000000000..a7959efd3a1768e5c9a6b339f938eb9d06d3f035 --- /dev/null +++ b/src/ui/window/JDialogADDBusNode.java @@ -0,0 +1,241 @@ +/**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 JDialogADDBusNode + * Dialog for managing attributes of bus nodes + * Creation: 02/07/2014 + * @version 1.0 02/07/2014 + * @author Ludovic APVRILLE + * @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.avatardd.*; + + +public class JDialogADDBusNode extends javax.swing.JDialog implements ActionListener { + + private boolean regularClose; + + private JPanel panel2; + private Frame frame; + private ADDBusNode node; + + + // Panel1 + protected JTextField nodeName; + + // Panel2 + protected JTextField index, nbAttachedInitiat, nbAttachedTarget, fifoDepth, minLatency; + + + // Main Panel + private JButton closeButton; + private JButton cancelButton; + + /** Creates new form */ + public JDialogADDBusNode(Frame _frame, String _title, ADDBusNode _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("BUS 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("Bus 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; + + + c2.gridwidth = 1; + panel2.add(new JLabel("Index:"), c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + index = new JTextField(""+node.getIndex(), 15); + panel2.add(index, c2); + + c2.gridwidth = 1; + panel2.add(new JLabel("Nb of attached initators:"), c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + nbAttachedInitiat = new JTextField(""+node.getNbAttachedInitiat(), 15); + panel2.add(nbAttachedInitiat, c2); + + c2.gridwidth = 1; + panel2.add(new JLabel("Nb of attached target:"), c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + nbAttachedTarget = new JTextField(""+node.getNbAttachedTarget(), 15); + panel2.add(nbAttachedTarget, c2); + + c2.gridwidth = 1; + panel2.add(new JLabel("Fifo depth:"), c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + fifoDepth = new JTextField(""+node.getFifoDepth(), 15); + panel2.add(fifoDepth, c2); + + c2.gridwidth = 1; + panel2.add(new JLabel("Min latency:"), c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + minLatency = new JTextField(""+node.getMinLatency(), 15); + panel2.add(minLatency, 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 getIndex() { + return index.getText(); + } + + public String getNbAttachedInitiat() { + return nbAttachedInitiat.getText(); + } + + public String getNbAttachedTarget(){ + return nbAttachedTarget.getText(); + } + + public String getFifoDepth(){ + return fifoDepth.getText(); + } + + public String getMinLatency(){ + return minLatency.getText(); + } + + +} diff --git a/src/ui/window/JDialogADDCPUNode.java b/src/ui/window/JDialogADDCPUNode.java new file mode 100755 index 0000000000000000000000000000000000000000..74c97065a03ccb95b874bee1ef44048882c41c87 --- /dev/null +++ b/src/ui/window/JDialogADDCPUNode.java @@ -0,0 +1,272 @@ +/**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 JDialogADDCPUNode +* Dialog for managing attributes of cpu nodes in ADD +* Creation: 02/07/2014 +* @version 1.0 02/07/2014 +* @author Ludovic APVRILLE +* @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.avatardd.*; + + +public class JDialogADDCPUNode extends javax.swing.JDialog implements ActionListener { + + private boolean regularClose; + + private JPanel panel2; + private Frame frame; + private ADDCPUNode node; + + + // Panel1 + protected JTextField nodeName; + + // Panel2 + protected JTextField nbOfIrq, iCacheWays, iCacheSets, iCacheWords, dCacheWays, dCacheSets, dCacheWords; + + + // Main Panel + private JButton closeButton; + private JButton cancelButton; + + /** Creates new form */ + public JDialogADDCPUNode(Frame _frame, String _title, ADDCPUNode _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("CPU attributes")); + panel2.setPreferredSize(new Dimension(400, 300)); + + c2.gridwidth = 1; + c2.gridheight = 1; + c2.weighty = 1.0; + c2.weightx = 1.0; + c2.fill = GridBagConstraints.HORIZONTAL; + panel2.add(new JLabel("CPU name:"), c2); + c2.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, c2); + + c2.gridwidth = 1; + c2.gridheight = 1; + c2.weighty = 1.0; + c2.weightx = 1.0; + c2.fill = GridBagConstraints.HORIZONTAL; + + + c2.gridwidth = 1; + panel2.add(new JLabel("Nb Of IRQs :"), c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + nbOfIrq = new JTextField(""+node.getNbOfIRQs(), 15); + panel2.add(nbOfIrq, c2); + + c2.gridwidth = 1; + panel2.add(new JLabel("Nb of inst. cache ways:"), c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + iCacheWays = new JTextField(""+node.getICacheWays(), 15); + panel2.add(iCacheWays, c2); + + c2.gridwidth = 1; + panel2.add(new JLabel("Nb of inst. cache sets:"), c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + iCacheSets = new JTextField(""+node.getICacheSets(), 15); + panel2.add(iCacheSets, c2); + + c2.gridwidth = 1; + panel2.add(new JLabel("Nb of inst. cache words:"), c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + iCacheWords = new JTextField(""+node.getICacheWords(), 15); + panel2.add(iCacheWords, c2); + + c2.gridwidth = 1; + panel2.add(new JLabel("Nb of data cache ways:"), c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + dCacheWays = new JTextField(""+node.getDCacheWays(), 15); + panel2.add(dCacheWays, c2); + + c2.gridwidth = 1; + panel2.add(new JLabel("Nb of data cache sets:"), c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + dCacheSets = new JTextField(""+node.getDCacheSets(), 15); + panel2.add(dCacheSets, c2); + + c2.gridwidth = 1; + panel2.add(new JLabel("Nb of data cache words:"), c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + dCacheWords = new JTextField(""+node.getDCacheWords(), 15); + panel2.add(dCacheWords, c2); + + + + /*c2.gridwidth = 1; + panel2.add(new JLabel("Clock ratio:"), c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + clockRatio = new JTextField(""+node.getClockRatio(), 15); + panel2.add(clockRatio, 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 getNbOFIRQ() { + return nbOfIrq.getText(); + } + + public String getICacheWays() { + return iCacheWays.getText(); + } + + public String getICacheSets() { + return iCacheSets.getText(); + } + + public String getICacheWords() { + return iCacheWords.getText(); + } + + public String getDCacheWays() { + return dCacheWays.getText(); + } + + public String getDCacheSets() { + return dCacheSets.getText(); + } + + public String getDCacheWords() { + return dCacheWords.getText(); + } + + + /*public String getClockRatio(){ + return clockRatio.getText(); + } */ + + +} diff --git a/src/ui/window/JDialogAvatarBlockArtifact.java b/src/ui/window/JDialogAvatarBlockArtifact.java new file mode 100755 index 0000000000000000000000000000000000000000..48de272178150c84b6925134539a5a967e0700bb --- /dev/null +++ b/src/ui/window/JDialogAvatarBlockArtifact.java @@ -0,0 +1,228 @@ +/**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 JDialogAvatarBlockArtifact + * Dialog for managing artifacts on hw nodes + * Creation: 02/07/2014 + * @version 1.0 02/07/2014 + * @author Ludovic APVRILLE + * @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.avatardd.*; + + +public class JDialogAvatarBlockArtifact extends javax.swing.JDialog implements ActionListener { + + private boolean regularClose; + private boolean emptyList = false; + + private JPanel panel2; + private Frame frame; + private ADDBlockArtifact artifact; + + //protected JTextField taskName; + protected JComboBox referenceTaskName; + + // Main Panel + private JButton closeButton; + private JButton cancelButton; + + /** Creates new form */ + public JDialogAvatarBlockArtifact(Frame _frame, String _title, ADDBlockArtifact _artifact) { + super(_frame, _title, true); + frame = _frame; + artifact = _artifact; + + 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("Artifact attributes")); + panel2.setPreferredSize(new Dimension(350, 250)); + + c1.gridwidth = 1; + c1.gridheight = 1; + c1.weighty = 1.0; + c1.weightx = 1.0; + c1.fill = GridBagConstraints.HORIZONTAL; + panel2.add(new JLabel("Task:"), c2); + c1.gridwidth = GridBagConstraints.REMAINDER; //end row + Vector<String> list = artifact.getTDiagramPanel().getMGUI().getAllNonMappedAvatarBlockNames((ADDDiagramPanel)(artifact.getTDiagramPanel()), artifact.getReferenceTaskName(), artifact.getTaskName()); + int index = 0; + if (list.size() == 0) { + list.add("No more task to map"); + emptyList = true; + } else { + index = indexOf(list, artifact.getValue()); + } + referenceTaskName = new JComboBox(list); + referenceTaskName.setSelectedIndex(index); + //referenceTaskName.setEditable(true); + //referenceTaskName.setFont(new Font("times", Font.PLAIN, 12)); + panel2.add(referenceTaskName, c1); + + + /*c1.gridwidth = 1; + c1.gridheight = 1; + c1.weighty = 1.0; + c1.weightx = 1.0; + c1.fill = GridBagConstraints.HORIZONTAL; + panel2.add(new JLabel("Name:"), c2); + c1.gridwidth = GridBagConstraints.REMAINDER; //end row + taskName = new JTextField(artifact.getTaskName(), 30); + taskName.setEditable(true); + taskName.setFont(new Font("times", Font.PLAIN, 12)); + panel2.add(taskName, c1);*/ + + // 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 getReferenceTaskName() { + if (emptyList) { + return null; + } + String tmp = (String)(referenceTaskName.getSelectedItem()); + int index = tmp.indexOf("::"); + if (index == -1) { + return tmp; + } + return tmp.substring(0, index); + } + + public String getTaskName() { + String tmp = (String)(referenceTaskName.getSelectedItem()); + int index = tmp.indexOf("::"); + if (index == -1) { + return tmp; + } + return tmp.substring(index+2, tmp.length()); + } + + + public int indexOf(Vector<String> _list, String name) { + int i = 0; + for(String s : _list) { + if (s.equals(name)) { + return i; + } + i++; + } + return 0; + } + +}