Commit 9c2b9ea8 authored by apvrille's avatar apvrille

Adding operation types for HWA and FPGAs

parent 706441ee
This diff is collapsed.
...@@ -41,6 +41,8 @@ ...@@ -41,6 +41,8 @@
package tmltranslator; package tmltranslator;
import java.util.Vector;
/** /**
* Class HwExecutionNode * Class HwExecutionNode
* Creation: 23/11/2007 * Creation: 23/11/2007
...@@ -56,8 +58,12 @@ public abstract class HwExecutionNode extends HwNode { ...@@ -56,8 +58,12 @@ public abstract class HwExecutionNode extends HwNode {
public static final int DEFAULT_EXECC_TIME = 1; public static final int DEFAULT_EXECC_TIME = 1;
public int execcTime = DEFAULT_EXECC_TIME; public int execcTime = DEFAULT_EXECC_TIME;
protected Vector<String> operationTypes;
public HwExecutionNode(String _name) { public HwExecutionNode(String _name) {
super(_name); super(_name);
operationTypes = new Vector<>();
} }
public abstract String getType(); public abstract String getType();
...@@ -70,4 +76,28 @@ public abstract class HwExecutionNode extends HwNode { ...@@ -70,4 +76,28 @@ public abstract class HwExecutionNode extends HwNode {
return execcTime; return execcTime;
} }
public void addOperationType(String opType) {
operationTypes.add(opType.toLowerCase().trim());
}
public Vector<String> getOperationTypes() {
return operationTypes;
}
public boolean supportAllOperations() {
return (operationTypes.size() == 0) || (containsOperationType("all"));
}
public boolean containsOperationType(String opType) {
if(supportAllOperations()) {
return true;
}
for(String s: operationTypes) {
if (s.compareTo(opType) == 0) {
return true;
}
}
return false;
}
} }
...@@ -186,6 +186,9 @@ public class TMLArchiTextSpecification { ...@@ -186,6 +186,9 @@ public class TMLArchiTextSpecification {
code += set + "reconfigurationTime " + fpga.reconfigurationTime + CR; code += set + "reconfigurationTime " + fpga.reconfigurationTime + CR;
code += set + "execiTime " + fpga.execiTime + CR; code += set + "execiTime " + fpga.execiTime + CR;
code += set + "execcTime " + fpga.execcTime + CR; code += set + "execcTime " + fpga.execcTime + CR;
for(String op: fpga.getOperationTypes()) {
code += set + "operationType " + op + CR;
}
} }
//HWA //HWA
...@@ -197,6 +200,9 @@ public class TMLArchiTextSpecification { ...@@ -197,6 +200,9 @@ public class TMLArchiTextSpecification {
code += set + "byteDataSize " + hwa.byteDataSize + CR; code += set + "byteDataSize " + hwa.byteDataSize + CR;
code += set + "execiTime " + hwa.execiTime + CR; code += set + "execiTime " + hwa.execiTime + CR;
code += set + "execcTime " + hwa.execcTime + CR; code += set + "execcTime " + hwa.execcTime + CR;
for(String op: hwa.getOperationTypes()) {
code += set + "operationType " + op + CR;
}
} }
// BUS // BUS
...@@ -632,6 +638,10 @@ public class TMLArchiTextSpecification { ...@@ -632,6 +638,10 @@ public class TMLArchiTextSpecification {
if (_split[2].toUpperCase().equals("EXECCTIME")) { if (_split[2].toUpperCase().equals("EXECCTIME")) {
fpga.execcTime = Integer.decode(_split[3]).intValue(); fpga.execcTime = Integer.decode(_split[3]).intValue();
} }
if (_split[2].toUpperCase().equals("OPERATIONTYPE")) {
fpga.addOperationType(_split[3]);
}
} }
if (node instanceof HwA) { if (node instanceof HwA) {
...@@ -652,6 +662,10 @@ public class TMLArchiTextSpecification { ...@@ -652,6 +662,10 @@ public class TMLArchiTextSpecification {
if (_split[2].toUpperCase().equals("EXECITIME")) { if (_split[2].toUpperCase().equals("EXECITIME")) {
hwa.execiTime = Integer.decode(_split[3]).intValue(); hwa.execiTime = Integer.decode(_split[3]).intValue();
} }
if (_split[2].toUpperCase().equals("OPERATIONTYPE")) {
hwa.addOperationType(_split[3]);
}
} }
if (node instanceof HwBus) { if (node instanceof HwBus) {
......
...@@ -2892,6 +2892,14 @@ public class GTMLModeling { ...@@ -2892,6 +2892,14 @@ public class GTMLModeling {
fpga.execcTime = fpgaNode.getExeccTime(); fpga.execcTime = fpgaNode.getExeccTime();
fpga.clockRatio = fpgaNode.getClockRatio(); fpga.clockRatio = fpgaNode.getClockRatio();
String opTypes = fpgaNode.getOperationTypes().trim().toLowerCase();
if (opTypes.compareTo("all") != 0) {
String[] operations = opTypes.split(" ");
for (String op : operations) {
fpga.addOperationType(op);
}
}
listE.addCor(fpga, fpgaNode); listE.addCor(fpga, fpgaNode);
archi.addHwNode(fpga); archi.addHwNode(fpga);
//TraceManager.addDev("FPGA node added: " + fpgaNode.getName()); //TraceManager.addDev("FPGA node added: " + fpgaNode.getName());
...@@ -2912,6 +2920,14 @@ public class GTMLModeling { ...@@ -2912,6 +2920,14 @@ public class GTMLModeling {
hwa.byteDataSize = hwanode.getByteDataSize(); hwa.byteDataSize = hwanode.getByteDataSize();
hwa.execiTime = hwanode.getExeciTime(); hwa.execiTime = hwanode.getExeciTime();
hwa.clockRatio = hwanode.getClockRatio(); hwa.clockRatio = hwanode.getClockRatio();
String opTypes = hwanode.getOperationTypes().trim().toLowerCase();
if (opTypes.compareTo("all") != 0) {
String[] operations = opTypes.split(" ");
for (String op : operations) {
hwa.addOperationType(op);
}
}
listE.addCor(hwa, hwanode); listE.addCor(hwa, hwanode);
archi.addHwNode(hwa); archi.addHwNode(hwa);
//TraceManager.addDev("HWA node added: " + hwa.getName()); //TraceManager.addDev("HWA node added: " + hwa.getName());
......
...@@ -2650,7 +2650,6 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per ...@@ -2650,7 +2650,6 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per
.INFORMATION_MESSAGE); .INFORMATION_MESSAGE);
return; return;
} }
try { try {
FileInputStream fis = new FileInputStream(tmpFile); FileInputStream fis = new FileInputStream(tmpFile);
int nb = fis.available(); int nb = fis.available();
...@@ -2667,6 +2666,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per ...@@ -2667,6 +2666,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per
return; return;
} }
if (FileUtils.getExtension(_f).equals("ttool")) { if (FileUtils.getExtension(_f).equals("ttool")) {
File tmpDir = _f; File tmpDir = _f;
config = new File(tmpDir.getAbsolutePath() + "/project_config.xml"); config = new File(tmpDir.getAbsolutePath() + "/project_config.xml");
......
...@@ -78,6 +78,8 @@ public class TMLArchiFPGANode extends TMLArchiNode implements SwallowTGComponent ...@@ -78,6 +78,8 @@ public class TMLArchiFPGANode extends TMLArchiNode implements SwallowTGComponent
private int mappingPenalty = HwFPGA.DEFAULT_MAPPING_PENALTY; private int mappingPenalty = HwFPGA.DEFAULT_MAPPING_PENALTY;
private int reconfigurationTime = HwFPGA.DEFAULT_RECONFIGURATION_TIME; private int reconfigurationTime = HwFPGA.DEFAULT_RECONFIGURATION_TIME;
private String operationTypes = "all";
public TMLArchiFPGANode(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { public TMLArchiFPGANode(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); super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp);
...@@ -342,6 +344,13 @@ public class TMLArchiFPGANode extends TMLArchiNode implements SwallowTGComponent ...@@ -342,6 +344,13 @@ public class TMLArchiFPGANode extends TMLArchiNode implements SwallowTGComponent
} }
} }
String tmpOp = dialog.getOperationTypes().trim().toLowerCase();
if (tmpOp.length() < 1) {
operationTypes = "all";
} else {
operationTypes = tmpOp;
}
if (error) { if (error) {
JOptionPane.showMessageDialog(frame, JOptionPane.showMessageDialog(frame,
"Invalid value for the following attributes: " + errors, "Invalid value for the following attributes: " + errors,
...@@ -412,6 +421,7 @@ public class TMLArchiFPGANode extends TMLArchiNode implements SwallowTGComponent ...@@ -412,6 +421,7 @@ public class TMLArchiFPGANode extends TMLArchiNode implements SwallowTGComponent
sb.append(" execiTime=\"" + execiTime + "\""); sb.append(" execiTime=\"" + execiTime + "\"");
sb.append(" execcTime=\"" + execcTime + "\""); sb.append(" execcTime=\"" + execcTime + "\"");
sb.append(" clockRatio=\"" + clockRatio + "\""); sb.append(" clockRatio=\"" + clockRatio + "\"");
sb.append(" operationTypes=\"" + operationTypes + "\" ");
sb.append("/>\n"); sb.append("/>\n");
sb.append("</extraparam>\n"); sb.append("</extraparam>\n");
return new String(sb); return new String(sb);
...@@ -427,6 +437,7 @@ public class TMLArchiFPGANode extends TMLArchiNode implements SwallowTGComponent ...@@ -427,6 +437,7 @@ public class TMLArchiFPGANode extends TMLArchiNode implements SwallowTGComponent
Element elt; Element elt;
// int t1id; // int t1id;
String sstereotype = null, snodeName = null; String sstereotype = null, snodeName = null;
String operationTypesTmp;
for(int i=0; i<nl.getLength(); i++) { for(int i=0; i<nl.getLength(); i++) {
n1 = nl.item(i); n1 = nl.item(i);
...@@ -483,6 +494,10 @@ public class TMLArchiFPGANode extends TMLArchiNode implements SwallowTGComponent ...@@ -483,6 +494,10 @@ public class TMLArchiFPGANode extends TMLArchiNode implements SwallowTGComponent
MECType = ArchUnitMEC.Types.get( Integer.valueOf( elt.getAttribute("MECType") ) ); MECType = ArchUnitMEC.Types.get( Integer.valueOf( elt.getAttribute("MECType") ) );
} }
} }
operationTypesTmp = elt.getAttribute("operationTypes");
if (operationTypesTmp != null) {
operationTypes = operationTypesTmp;
}
} }
} }
...@@ -531,6 +546,10 @@ public class TMLArchiFPGANode extends TMLArchiNode implements SwallowTGComponent ...@@ -531,6 +546,10 @@ public class TMLArchiFPGANode extends TMLArchiNode implements SwallowTGComponent
return mappingPenalty; return mappingPenalty;
} }
public String getOperationTypes() {
return operationTypes;
}
public String getAttributes() { public String getAttributes() {
String attr = ""; String attr = "";
...@@ -542,6 +561,7 @@ public class TMLArchiFPGANode extends TMLArchiNode implements SwallowTGComponent ...@@ -542,6 +561,7 @@ public class TMLArchiFPGANode extends TMLArchiNode implements SwallowTGComponent
attr += "Idle cycles to go idle = " + maxConsecutiveIdleCycles + "\n"; attr += "Idle cycles to go idle = " + maxConsecutiveIdleCycles + "\n";
attr += "EXECI exec. time (in cycle) = " + execiTime + "\n"; attr += "EXECI exec. time (in cycle) = " + execiTime + "\n";
attr += "EXECC exec. time (in cycle) = " + execcTime + "\n"; attr += "EXECC exec. time (in cycle) = " + execcTime + "\n";
attr += "Operation types = " + operationTypes + "\n";
attr += "Clock divider = " + clockRatio + "\n"; attr += "Clock divider = " + clockRatio + "\n";
return attr; return attr;
......
...@@ -71,6 +71,8 @@ public class TMLArchiHWANode extends TMLArchiNode implements SwallowTGComponent, ...@@ -71,6 +71,8 @@ public class TMLArchiHWANode extends TMLArchiNode implements SwallowTGComponent,
private int byteDataSize = HwCPU.DEFAULT_BYTE_DATA_SIZE; private int byteDataSize = HwCPU.DEFAULT_BYTE_DATA_SIZE;
private int execiTime = HwCPU.DEFAULT_EXECI_TIME; private int execiTime = HwCPU.DEFAULT_EXECI_TIME;
private String operationTypes = "all";
public TMLArchiHWANode(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { public TMLArchiHWANode(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); super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp);
...@@ -167,7 +169,6 @@ public class TMLArchiHWANode extends TMLArchiNode implements SwallowTGComponent, ...@@ -167,7 +169,6 @@ public class TMLArchiHWANode extends TMLArchiNode implements SwallowTGComponent,
public String getStereotype() { public String getStereotype() {
return stereotype; return stereotype;
} }
public String getNodeName() { public String getNodeName() {
...@@ -245,6 +246,13 @@ public class TMLArchiHWANode extends TMLArchiNode implements SwallowTGComponent, ...@@ -245,6 +246,13 @@ public class TMLArchiHWANode extends TMLArchiNode implements SwallowTGComponent,
} }
} }
String tmpOp = dialog.getOperationTypes().trim().toLowerCase();
if (tmpOp.length() < 1) {
operationTypes = "all";
} else {
operationTypes = tmpOp;
}
if (error) { if (error) {
JOptionPane.showMessageDialog(frame, JOptionPane.showMessageDialog(frame,
"Invalid value for the following attributes: " + errors, "Invalid value for the following attributes: " + errors,
...@@ -310,6 +318,7 @@ public class TMLArchiHWANode extends TMLArchiNode implements SwallowTGComponent, ...@@ -310,6 +318,7 @@ public class TMLArchiHWANode extends TMLArchiNode implements SwallowTGComponent,
sb.append("<attributes byteDataSize=\"" + byteDataSize + "\" "); sb.append("<attributes byteDataSize=\"" + byteDataSize + "\" ");
sb.append(" execiTime=\"" + execiTime + "\" "); sb.append(" execiTime=\"" + execiTime + "\" ");
sb.append(" clockRatio=\"" + clockRatio + "\" "); sb.append(" clockRatio=\"" + clockRatio + "\" ");
sb.append(" operationTypes=\"" + operationTypes + "\" ");
sb.append("/>\n"); sb.append("/>\n");
sb.append("</extraparam>\n"); sb.append("</extraparam>\n");
return new String(sb); return new String(sb);
...@@ -325,6 +334,7 @@ public class TMLArchiHWANode extends TMLArchiNode implements SwallowTGComponent, ...@@ -325,6 +334,7 @@ public class TMLArchiHWANode extends TMLArchiNode implements SwallowTGComponent,
Element elt; Element elt;
// int t1id; // int t1id;
String sstereotype = null, snodeName = null; String sstereotype = null, snodeName = null;
String operationTypesTmp;
for(int i=0; i<nl.getLength(); i++) { for(int i=0; i<nl.getLength(); i++) {
n1 = nl.item(i); n1 = nl.item(i);
...@@ -353,6 +363,10 @@ public class TMLArchiHWANode extends TMLArchiNode implements SwallowTGComponent, ...@@ -353,6 +363,10 @@ public class TMLArchiHWANode extends TMLArchiNode implements SwallowTGComponent,
if ((elt.getAttribute("clockRatio") != null) && (elt.getAttribute("clockRatio").length() > 0)){ if ((elt.getAttribute("clockRatio") != null) && (elt.getAttribute("clockRatio").length() > 0)){
clockRatio = Integer.decode(elt.getAttribute("clockRatio")).intValue(); clockRatio = Integer.decode(elt.getAttribute("clockRatio")).intValue();
} }
operationTypesTmp = elt.getAttribute("operationTypes");
if (operationTypesTmp != null) {
operationTypes = operationTypesTmp;
}
} }
} }
} }
...@@ -376,11 +390,16 @@ public class TMLArchiHWANode extends TMLArchiNode implements SwallowTGComponent, ...@@ -376,11 +390,16 @@ public class TMLArchiHWANode extends TMLArchiNode implements SwallowTGComponent,
return execiTime; return execiTime;
} }
public String getOperationTypes() {
return operationTypes;
}
public String getAttributes() { public String getAttributes() {
String attr = ""; String attr = "";
attr += "Data size (in byte) = " + byteDataSize + "\n"; attr += "Data size (in byte) = " + byteDataSize + "\n";
attr += "Execi execution time (in cycle) = " + execiTime + "\n"; attr += "EXECI execution time (in cycle) = " + execiTime + "\n";
attr += "Operation types = " + operationTypes + "\n";
attr += "Clock divider = " + clockRatio + "\n"; attr += "Clock divider = " + clockRatio + "\n";
return attr; return attr;
} }
......
...@@ -72,7 +72,7 @@ public class JDialogFPGANode extends JDialogBase implements ActionListener { ...@@ -72,7 +72,7 @@ public class JDialogFPGANode extends JDialogBase implements ActionListener {
// Panel2 // Panel2
protected JTextField byteDataSize, goIdleTime, maxConsecutiveIdleCycles, clockRatio, execiTime, execcTime, protected JTextField byteDataSize, goIdleTime, maxConsecutiveIdleCycles, clockRatio, execiTime, execcTime,
capacity, mappingPenalty, reconfigurationTime; capacity, mappingPenalty, reconfigurationTime, operationTypes;
// Tabbed pane for panel1 and panel2 // Tabbed pane for panel1 and panel2
private JTabbedPane tabbedPane; private JTabbedPane tabbedPane;
...@@ -111,7 +111,7 @@ public class JDialogFPGANode extends JDialogBase implements ActionListener { ...@@ -111,7 +111,7 @@ public class JDialogFPGANode extends JDialogBase implements ActionListener {
panel2 = new JPanel(); panel2 = new JPanel();
panel2.setLayout(gridbag2); panel2.setLayout(gridbag2);
panel2.setBorder(new javax.swing.border.TitledBorder("CPU attributes")); panel2.setBorder(new javax.swing.border.TitledBorder("FPGA attributes"));
panel2.setPreferredSize(new Dimension(400, 300)); panel2.setPreferredSize(new Dimension(400, 300));
// Issue #41 Ordering of tabbed panes // Issue #41 Ordering of tabbed panes
...@@ -179,6 +179,12 @@ public class JDialogFPGANode extends JDialogBase implements ActionListener { ...@@ -179,6 +179,12 @@ public class JDialogFPGANode extends JDialogBase implements ActionListener {
execcTime = new JTextField("" + node.getExeccTime(), 15); execcTime = new JTextField("" + node.getExeccTime(), 15);
panel2.add(execcTime, c2); panel2.add(execcTime, c2);
c2.gridwidth = 1;
panel2.add(new JLabel("Operating types:"), c2);
c2.gridwidth = GridBagConstraints.REMAINDER; //end row
operationTypes = new JTextField(""+node.getOperationTypes(), 15);
panel2.add(operationTypes, c2);
c2.gridwidth = 1; c2.gridwidth = 1;
panel2.add(new JLabel("Clock divider:"), c2); panel2.add(new JLabel("Clock divider:"), c2);
c2.gridwidth = GridBagConstraints.REMAINDER; //end row c2.gridwidth = GridBagConstraints.REMAINDER; //end row
...@@ -297,6 +303,10 @@ public class JDialogFPGANode extends JDialogBase implements ActionListener { ...@@ -297,6 +303,10 @@ public class JDialogFPGANode extends JDialogBase implements ActionListener {
return execcTime.getText(); return execcTime.getText();
} }
public String getOperationTypes() {
return operationTypes.getText();
}
public String getClockRatio() { public String getClockRatio() {
return clockRatio.getText(); return clockRatio.getText();
......
...@@ -73,7 +73,7 @@ public class JDialogHwANode extends JDialogBase implements ActionListener { ...@@ -73,7 +73,7 @@ public class JDialogHwANode extends JDialogBase implements ActionListener {
protected JTextField nodeName; protected JTextField nodeName;
// Panel2 // Panel2
protected JTextField byteDataSize, execiTime, clockRatio; protected JTextField byteDataSize, execiTime, clockRatio, operationTypes;
/* Creates new form */ /* Creates new form */
public JDialogHwANode(Frame _frame, String _title, TMLArchiHWANode _node) { public JDialogHwANode(Frame _frame, String _title, TMLArchiHWANode _node) {
...@@ -106,7 +106,7 @@ public class JDialogHwANode extends JDialogBase implements ActionListener { ...@@ -106,7 +106,7 @@ public class JDialogHwANode extends JDialogBase implements ActionListener {
panel2 = new JPanel(); panel2 = new JPanel();
panel2.setLayout(gridbag2); panel2.setLayout(gridbag2);
panel2.setBorder(new javax.swing.border.TitledBorder("CPU attributes")); panel2.setBorder(new javax.swing.border.TitledBorder("HwA attributes"));
panel2.setPreferredSize(new Dimension(400, 300)); panel2.setPreferredSize(new Dimension(400, 300));
c1.gridwidth = 1; c1.gridwidth = 1;
...@@ -145,6 +145,12 @@ public class JDialogHwANode extends JDialogBase implements ActionListener { ...@@ -145,6 +145,12 @@ public class JDialogHwANode extends JDialogBase implements ActionListener {
clockRatio = new JTextField(""+node.getClockRatio(), 15); clockRatio = new JTextField(""+node.getClockRatio(), 15);
panel2.add(clockRatio, c2); panel2.add(clockRatio, c2);
c2.gridwidth = 1;
panel2.add(new JLabel("Operating types:"), c2);
c2.gridwidth = GridBagConstraints.REMAINDER; //end row
operationTypes = new JTextField(""+node.getOperationTypes(), 15);
panel2.add(operationTypes, c2);
// main panel; // main panel;
c0.gridheight = 10; c0.gridheight = 10;
c0.weighty = 1.0; c0.weighty = 1.0;
...@@ -206,4 +212,10 @@ public class JDialogHwANode extends JDialogBase implements ActionListener { ...@@ -206,4 +212,10 @@ public class JDialogHwANode extends JDialogBase implements ActionListener {
return clockRatio.getText(); return clockRatio.getText();
} }
public String getOperationTypes(){
return operationTypes.getText();
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment