diff --git a/src/tmltranslator/HwCPU.java b/src/tmltranslator/HwCPU.java index 13ccaff109beb8c02fe3ec80c577260245d9c222..0300a6cf101f0d517c77c53b7b761e18ced8df83 100755 --- a/src/tmltranslator/HwCPU.java +++ b/src/tmltranslator/HwCPU.java @@ -53,6 +53,7 @@ public class HwCPU extends HwExecutionNode { public static final int BASIC_ROUND_ROBIN = 0; public static final int ROUND_ROBIN_PRIORITY_BASED = 1; + public static final int DEFAULT_NB_OF_CORES = 1; public static final int DEFAULT_BYTE_DATA_SIZE = 4; public static final int DEFAULT_PIPELINE_SIZE = 5; public static final int DEFAULT_GO_IDLE_TIME = 10; @@ -62,6 +63,7 @@ public class HwCPU extends HwExecutionNode { public static final int DEFAULT_CACHE_MISS = 5; public static final int DEFAULT_SCHEDULING = BASIC_ROUND_ROBIN; + public int nbOfCores = DEFAULT_NB_OF_CORES; // Should be equal or greater than 1 public int byteDataSize = DEFAULT_BYTE_DATA_SIZE; // Should be greater than 0 public int pipelineSize = DEFAULT_PIPELINE_SIZE; // Should be greater than 0 public int goIdleTime = DEFAULT_GO_IDLE_TIME; // Should be greater or equal to 0 diff --git a/src/ui/GCTMLModeling.java b/src/ui/GCTMLModeling.java index d01dd857ae47d6b25dfda7a5ee386d5e65e5d951..6d27c7393bc1835b44bbba1ef476edbda935e431 100755 --- a/src/ui/GCTMLModeling.java +++ b/src/ui/GCTMLModeling.java @@ -1014,6 +1014,7 @@ public class GCTMLModeling { if (tgc instanceof TMLArchiCPUNode) { node = (TMLArchiCPUNode)tgc; cpu = new HwCPU(node.getName()); + cpu.nbOfCores = node.getnbOfCores(); cpu.byteDataSize = node.getByteDataSize(); cpu.pipelineSize = node.getPipelineSize(); cpu.goIdleTime = node.getGoIdleTime(); diff --git a/src/ui/GTMLModeling.java b/src/ui/GTMLModeling.java index c2c9a80b2b08dcee4513cfccb32fa44b075c56a8..74e87cbc418c899a33df7760aad4a779b8acd034 100755 --- a/src/ui/GTMLModeling.java +++ b/src/ui/GTMLModeling.java @@ -1497,6 +1497,7 @@ public class GTMLModeling { } else { names.add(node.getName()); cpu = new HwCPU(node.getName()); + cpu.nbOfCores = node.getNbOfCores(); cpu.byteDataSize = node.getByteDataSize(); cpu.pipelineSize = node.getPipelineSize(); cpu.goIdleTime = node.getGoIdleTime(); diff --git a/src/ui/tmldd/TMLArchiCPUNode.java b/src/ui/tmldd/TMLArchiCPUNode.java index 0ba0836f9ce6ede862df692870fb3f7067998580..181d729133baff9d24f863687747c794cbd7bedf 100755 --- a/src/ui/tmldd/TMLArchiCPUNode.java +++ b/src/ui/tmldd/TMLArchiCPUNode.java @@ -65,6 +65,7 @@ public class TMLArchiCPUNode extends TMLArchiNode implements SwallowTGComponent, private int derivationy = 3; private String stereotype = "CPU"; + private int nbOfCores = HwCPU.DEFAULT_NB_OF_CORES; private int byteDataSize = HwCPU.DEFAULT_BYTE_DATA_SIZE; private int pipelineSize = HwCPU.DEFAULT_PIPELINE_SIZE; private int goIdleTime = HwCPU.DEFAULT_GO_IDLE_TIME; @@ -214,6 +215,21 @@ public class TMLArchiCPUNode extends TMLArchiNode implements SwallowTGComponent, stereotype = "CPURRPB"; } + if (dialog.getNbOfCores().length() != 0) { + try { + tmp = nbOfCores; + nbOfCores = Integer.decode(dialog.getNbOfCores()).intValue(); + if (nbOfCores <= 0) { + nbOfCores = tmp; + error = true; + errors += "Data size "; + } + } catch (Exception e) { + error = true; + errors += "Data size "; + } + } + if (dialog.getByteDataSize().length() != 0) { try { tmp = byteDataSize; @@ -432,7 +448,7 @@ public class TMLArchiCPUNode extends TMLArchiNode implements SwallowTGComponent, StringBuffer sb = new StringBuffer("<extraparam>\n"); sb.append("<info stereotype=\"" + stereotype + "\" nodeName=\"" + name); sb.append("\" />\n"); - sb.append("<attributes byteDataSize=\"" + byteDataSize + "\" "); + sb.append("<attributes nbOfCores=\"" + nbOfCores + "\" byteDataSize=\"" + byteDataSize + "\" "); sb.append(" schedulingPolicy=\"" + schedulingPolicy + "\" "); sb.append(" goIdleTime=\"" + goIdleTime + "\" "); sb.append(" maxConsecutiveIdleCycles=\"" + maxConsecutiveIdleCycles + "\" "); @@ -480,6 +496,11 @@ public class TMLArchiCPUNode extends TMLArchiNode implements SwallowTGComponent, } if (elt.getTagName().equals("attributes")) { + try { + // the "try" statement is for retro compatibility + nbOfCores = Integer.decode(elt.getAttribute("nbOfCores")).intValue(); + } catch (Exception e) { + } byteDataSize = Integer.decode(elt.getAttribute("byteDataSize")).intValue(); schedulingPolicy =Integer.decode(elt.getAttribute("schedulingPolicy")).intValue(); goIdleTime = Integer.decode(elt.getAttribute("goIdleTime")).intValue(); @@ -516,6 +537,10 @@ public class TMLArchiCPUNode extends TMLArchiNode implements SwallowTGComponent, return TGComponentManager.CONNECTOR_NODE_TMLARCHI; } + public int getNbOfCores(){ + return nbOfCores; + } + public int getByteDataSize(){ return byteDataSize; } @@ -558,6 +583,7 @@ public class TMLArchiCPUNode extends TMLArchiNode implements SwallowTGComponent, public String getAttributes() { String attr = ""; + attr += "Nb of cores = " + nbOfCores + "\n"; attr += "Data size (in byte) = " + byteDataSize + "\n"; attr += "Pipeline size = " + pipelineSize + "\n"; if (schedulingPolicy == HwCPU.DEFAULT_SCHEDULING) { diff --git a/src/ui/window/JDialogCPUNode.java b/src/ui/window/JDialogCPUNode.java index dc2fa23b9c59796584015bfe771a01a8b49f5c83..21ed45e8a42dcea1ab786f2997dd62204b877957 100755 --- a/src/ui/window/JDialogCPUNode.java +++ b/src/ui/window/JDialogCPUNode.java @@ -70,7 +70,7 @@ public class JDialogCPUNode extends javax.swing.JDialog implements ActionListene protected JTextField nodeName; // Panel2 - protected JTextField byteDataSize, pipelineSize, goIdleTime, maxConsecutiveIdleCycles, taskSwitchingTime, branchingPredictionPenalty, cacheMiss, clockRatio, execiTime, execcTime; + protected JTextField nbOfCores, byteDataSize, pipelineSize, goIdleTime, maxConsecutiveIdleCycles, taskSwitchingTime, branchingPredictionPenalty, cacheMiss, clockRatio, execiTime, execcTime; protected JComboBox schedulingPolicy; @@ -138,6 +138,12 @@ public class JDialogCPUNode extends javax.swing.JDialog implements ActionListene schedulingPolicy.setSelectedIndex(node.getSchedulingPolicy()); panel2.add(schedulingPolicy, c2); + c2.gridwidth = 1; + panel2.add(new JLabel("Nb of cores:"), c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + nbOfCores = new JTextField(""+node.getNbOfCores(), 15); + panel2.add(nbOfCores, c2); + c2.gridwidth = 1; panel2.add(new JLabel("Data size (in byte):"), c2); c2.gridwidth = GridBagConstraints.REMAINDER; //end row @@ -252,6 +258,10 @@ public class JDialogCPUNode extends javax.swing.JDialog implements ActionListene public String getNodeName() { return nodeName.getText(); } + + public String getNbOfCores() { + return nbOfCores.getText(); + } public String getByteDataSize() { return byteDataSize.getText();