Commit 9c2b9ea8 authored by apvrille's avatar apvrille

Adding operation types for HWA and FPGAs

parent 706441ee
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -41,6 +41,8 @@
package tmltranslator;
import java.util.Vector;
/**
* Class HwExecutionNode
* Creation: 23/11/2007
......@@ -56,8 +58,12 @@ public abstract class HwExecutionNode extends HwNode {
public static final int DEFAULT_EXECC_TIME = 1;
public int execcTime = DEFAULT_EXECC_TIME;
protected Vector<String> operationTypes;
public HwExecutionNode(String _name) {
super(_name);
operationTypes = new Vector<>();
}
public abstract String getType();
......@@ -70,4 +76,28 @@ public abstract class HwExecutionNode extends HwNode {
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 {
code += set + "reconfigurationTime " + fpga.reconfigurationTime + CR;
code += set + "execiTime " + fpga.execiTime + CR;
code += set + "execcTime " + fpga.execcTime + CR;
for(String op: fpga.getOperationTypes()) {
code += set + "operationType " + op + CR;
}
}
//HWA
......@@ -197,6 +200,9 @@ public class TMLArchiTextSpecification {
code += set + "byteDataSize " + hwa.byteDataSize + CR;
code += set + "execiTime " + hwa.execiTime + CR;
code += set + "execcTime " + hwa.execcTime + CR;
for(String op: hwa.getOperationTypes()) {
code += set + "operationType " + op + CR;
}
}
// BUS
......@@ -632,6 +638,10 @@ public class TMLArchiTextSpecification {
if (_split[2].toUpperCase().equals("EXECCTIME")) {
fpga.execcTime = Integer.decode(_split[3]).intValue();
}
if (_split[2].toUpperCase().equals("OPERATIONTYPE")) {
fpga.addOperationType(_split[3]);
}
}
if (node instanceof HwA) {
......@@ -652,6 +662,10 @@ public class TMLArchiTextSpecification {
if (_split[2].toUpperCase().equals("EXECITIME")) {
hwa.execiTime = Integer.decode(_split[3]).intValue();
}
if (_split[2].toUpperCase().equals("OPERATIONTYPE")) {
hwa.addOperationType(_split[3]);
}
}
if (node instanceof HwBus) {
......
......@@ -2892,6 +2892,14 @@ public class GTMLModeling {
fpga.execcTime = fpgaNode.getExeccTime();
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);
archi.addHwNode(fpga);
//TraceManager.addDev("FPGA node added: " + fpgaNode.getName());
......@@ -2912,6 +2920,14 @@ public class GTMLModeling {
hwa.byteDataSize = hwanode.getByteDataSize();
hwa.execiTime = hwanode.getExeciTime();
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);
archi.addHwNode(hwa);
//TraceManager.addDev("HWA node added: " + hwa.getName());
......
......@@ -2650,7 +2650,6 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per
.INFORMATION_MESSAGE);
return;
}
try {
FileInputStream fis = new FileInputStream(tmpFile);
int nb = fis.available();
......@@ -2667,6 +2666,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per
return;
}
if (FileUtils.getExtension(_f).equals("ttool")) {
File tmpDir = _f;
config = new File(tmpDir.getAbsolutePath() + "/project_config.xml");
......
......@@ -78,6 +78,8 @@ public class TMLArchiFPGANode extends TMLArchiNode implements SwallowTGComponent
private int mappingPenalty = HwFPGA.DEFAULT_MAPPING_PENALTY;
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) {
super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp);
......@@ -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) {
JOptionPane.showMessageDialog(frame,
"Invalid value for the following attributes: " + errors,
......@@ -412,6 +421,7 @@ public class TMLArchiFPGANode extends TMLArchiNode implements SwallowTGComponent
sb.append(" execiTime=\"" + execiTime + "\"");
sb.append(" execcTime=\"" + execcTime + "\"");
sb.append(" clockRatio=\"" + clockRatio + "\"");
sb.append(" operationTypes=\"" + operationTypes + "\" ");
sb.append("/>\n");
sb.append("</extraparam>\n");
return new String(sb);
......@@ -427,6 +437,7 @@ public class TMLArchiFPGANode extends TMLArchiNode implements SwallowTGComponent
Element elt;
// int t1id;
String sstereotype = null, snodeName = null;
String operationTypesTmp;
for(int i=0; i<nl.getLength(); i++) {
n1 = nl.item(i);
......@@ -483,6 +494,10 @@ public class TMLArchiFPGANode extends TMLArchiNode implements SwallowTGComponent
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
return mappingPenalty;
}
public String getOperationTypes() {
return operationTypes;
}
public String getAttributes() {
String attr = "";
......@@ -542,6 +561,7 @@ public class TMLArchiFPGANode extends TMLArchiNode implements SwallowTGComponent
attr += "Idle cycles to go idle = " + maxConsecutiveIdleCycles + "\n";
attr += "EXECI exec. time (in cycle) = " + execiTime + "\n";
attr += "EXECC exec. time (in cycle) = " + execcTime + "\n";
attr += "Operation types = " + operationTypes + "\n";
attr += "Clock divider = " + clockRatio + "\n";
return attr;
......
......@@ -71,6 +71,8 @@ public class TMLArchiHWANode extends TMLArchiNode implements SwallowTGComponent,
private int byteDataSize = HwCPU.DEFAULT_BYTE_DATA_SIZE;
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) {
super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp);
......@@ -167,7 +169,6 @@ public class TMLArchiHWANode extends TMLArchiNode implements SwallowTGComponent,
public String getStereotype() {
return stereotype;
}
public String getNodeName() {
......@@ -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) {
JOptionPane.showMessageDialog(frame,
"Invalid value for the following attributes: " + errors,
......@@ -310,6 +318,7 @@ public class TMLArchiHWANode extends TMLArchiNode implements SwallowTGComponent,
sb.append("<attributes byteDataSize=\"" + byteDataSize + "\" ");
sb.append(" execiTime=\"" + execiTime + "\" ");
sb.append(" clockRatio=\"" + clockRatio + "\" ");
sb.append(" operationTypes=\"" + operationTypes + "\" ");
sb.append("/>\n");
sb.append("</extraparam>\n");
return new String(sb);
......@@ -325,6 +334,7 @@ public class TMLArchiHWANode extends TMLArchiNode implements SwallowTGComponent,
Element elt;
// int t1id;
String sstereotype = null, snodeName = null;
String operationTypesTmp;
for(int i=0; i<nl.getLength(); i++) {
n1 = nl.item(i);
......@@ -353,6 +363,10 @@ public class TMLArchiHWANode extends TMLArchiNode implements SwallowTGComponent,
if ((elt.getAttribute("clockRatio") != null) && (elt.getAttribute("clockRatio").length() > 0)){
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,
return execiTime;
}
public String getOperationTypes() {
return operationTypes;
}
public String getAttributes() {
String attr = "";
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";
return attr;
}
......
......@@ -72,7 +72,7 @@ public class JDialogFPGANode extends JDialogBase implements ActionListener {
// Panel2
protected JTextField byteDataSize, goIdleTime, maxConsecutiveIdleCycles, clockRatio, execiTime, execcTime,
capacity, mappingPenalty, reconfigurationTime;
capacity, mappingPenalty, reconfigurationTime, operationTypes;
// Tabbed pane for panel1 and panel2
private JTabbedPane tabbedPane;
......@@ -111,7 +111,7 @@ public class JDialogFPGANode extends JDialogBase implements ActionListener {
panel2 = new JPanel();
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));
// Issue #41 Ordering of tabbed panes
......@@ -179,6 +179,12 @@ public class JDialogFPGANode extends JDialogBase implements ActionListener {
execcTime = new JTextField("" + node.getExeccTime(), 15);
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;
panel2.add(new JLabel("Clock divider:"), c2);
c2.gridwidth = GridBagConstraints.REMAINDER; //end row
......@@ -297,6 +303,10 @@ public class JDialogFPGANode extends JDialogBase implements ActionListener {
return execcTime.getText();
}
public String getOperationTypes() {
return operationTypes.getText();
}
public String getClockRatio() {
return clockRatio.getText();
......
......@@ -73,7 +73,7 @@ public class JDialogHwANode extends JDialogBase implements ActionListener {
protected JTextField nodeName;
// Panel2
protected JTextField byteDataSize, execiTime, clockRatio;
protected JTextField byteDataSize, execiTime, clockRatio, operationTypes;
/* Creates new form */
public JDialogHwANode(Frame _frame, String _title, TMLArchiHWANode _node) {
......@@ -106,7 +106,7 @@ public class JDialogHwANode extends JDialogBase implements ActionListener {
panel2 = new JPanel();
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));
c1.gridwidth = 1;
......@@ -145,6 +145,12 @@ public class JDialogHwANode extends JDialogBase implements ActionListener {
clockRatio = new JTextField(""+node.getClockRatio(), 15);
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;
c0.gridheight = 10;
c0.weighty = 1.0;
......@@ -206,4 +212,10 @@ public class JDialogHwANode extends JDialogBase implements ActionListener {
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