Skip to content
Snippets Groups Projects
Commit 05cfd225 authored by Daniela Genius's avatar Daniela Genius
Browse files

adding sensitivity for clock in DE blocks

parent 02c3902d
No related branches found
No related tags found
2 merge requests!255New lip6,!253New lip6
......@@ -166,7 +166,7 @@ public class ClusterCode {
corpsCluster = corpsCluster + CR + "\t// Instantiate clocks." + CR;
for (SysCAMSTClock t : clock) {
System.out.println("@@@@@@@@@@@@@@@@@@@@@ "+t.getName());
corpsCluster = corpsCluster + "\t sc_clock " + t.getName() + " (\"" + t.getName() + "\"," + t.getFrequency()+","+ t.getUnit()+","+ t.getDutyCycle()+","+ t.getStartTime()+","+ t.getUnitStartTime()+","+ t.getPosFirst()+");" + CR;
}
......
......@@ -468,6 +468,10 @@ public class PrimitiveCode {
corpsPrimitiveDE = corpsPrimitiveDE + "\t};" + CR2;
}
//DG 17.10.
if(de.getClockName()!="")
corpsPrimitiveDE = corpsPrimitiveDE + "\tsc_core::sc_in <bool>" + de.getClockName() + ";" + CR;
//DG modified, was sca:core
//System.out.println("@@@@@@@@@DE ports empty?");
if (!deports.isEmpty()) {
......@@ -557,7 +561,7 @@ if (t.getOrigin() == 0) {
method = true;
}
for (SysCAMSTPortDE t : deports) {
/* for (SysCAMSTPortDE t : deports) {
if (t.getSensitive() == true) {
if (method == false) {
corpsPrimitiveDE = corpsPrimitiveDE + "\t{" + CR;
......@@ -570,7 +574,35 @@ if (t.getOrigin() == 0) {
}
sensitive = true;
}
}*/
//DG 17.10.
if(de.getClockName()!=""){
corpsPrimitiveDE = corpsPrimitiveDE + "\t\tsensitive << " + de.getClockName() + ".";
if (de.getClockSensitiveMethod().equals("positive")) {
corpsPrimitiveDE = corpsPrimitiveDE + "pos();" + CR;
} else if (de.getClockSensitiveMethod().equals("negative")) {
corpsPrimitiveDE = corpsPrimitiveDE + "neg();" + CR;
}
}
//fin ajoute DG
for (SysCAMSTPortDE t : deports) {
if (t.getSensitive() == true) {
if (method == false) {
corpsPrimitiveDE = corpsPrimitiveDE + "\t{" + CR;
}
corpsPrimitiveDE = corpsPrimitiveDE + "\t\tsensitive << " + t.getName() + ";";
if (t.getSensitiveMethod().equals("positive")) {
corpsPrimitiveDE = corpsPrimitiveDE + "pos();" + CR;
} else if (t.getSensitiveMethod().equals("negative")) {
corpsPrimitiveDE = corpsPrimitiveDE + "neg();" + CR;
}
sensitive = true;
}
}
if (sensitive == true || method == true) {
corpsPrimitiveDE = corpsPrimitiveDE + "\t}" + CR2;
} else {
......@@ -583,6 +615,7 @@ if (t.getOrigin() == 0) {
// corpsPrimitiveDE = corpsPrimitiveDE +"sc_in<bool> "+de.getClockName()+";"+CR;
// }
if (de.getListStruct().getSize() != 0) {
String identifier, type, constant;
for (int i = 0; i < de.getListStruct().size(); i++) {
......
......@@ -123,6 +123,7 @@ System.out.println("@@@ Panel Translator ");
String blockDEName = blockDE.getValue();
String clockName = blockDE.getClockName();
String clockSensitivityMethod = blockDE.getClockSensitivityMethod();
// int periodBlock = blockDE.getPeriod();
// String time = blockDE.getTime();
// String nameFn = blockDE.getNameFn();
......@@ -132,7 +133,7 @@ System.out.println("@@@ Panel Translator ");
// String typeTemplate = blockDE.getTypeTemplate();
// DefaultListModel<String> listTypedef = blockDE.getListTypedef();
SysCAMSTBlockDE syscamsBlockDE = new SysCAMSTBlockDE(blockDEName, clockName, "", "", null, "", "", "", null, null);
SysCAMSTBlockDE syscamsBlockDE = new SysCAMSTBlockDE(blockDEName, clockName, clockSensitivityMethod, "", "", null, "", "", "", null, null);
List<SysCAMSPortDE> portsDE = blockDE.getAllInternalPortsDE();
for (int i = 0; i < portsDE.size(); i++) {
......@@ -272,6 +273,7 @@ System.out.println("@@@ Panel Translator ");
SysCAMSBlockDE blockDE = blocksDE.get(i);
String blockDEName = blockDE.getValue(); String clockName = blockDE.getClockName();
String clockSensitivityMethod = blockDE.getClockSensitivityMethod();
String nameFn = blockDE.getNameFn();
String code = blockDE.getCode();
DefaultListModel<String> listStruct = blockDE.getListStruct();
......@@ -280,7 +282,7 @@ System.out.println("@@@ Panel Translator ");
String valueTemplate = blockDE.getValueTemplate();
DefaultListModel<String> listTypedef = blockDE.getListTypedef();
SysCAMSTBlockDE syscamsBlockDE = new SysCAMSTBlockDE(blockDEName, clockName, nameFn, code, listStruct, nameTemplate, typeTemplate, valueTemplate, listTypedef, syscamsCluster);
SysCAMSTBlockDE syscamsBlockDE = new SysCAMSTBlockDE(blockDEName, clockName, clockSensitivityMethod, nameFn, code, listStruct, nameTemplate, typeTemplate, valueTemplate, listTypedef, syscamsCluster);
List<SysCAMSPortDE> portsDE = blockDE.getAllInternalPortsDE();
for (int j = 0; j < portsDE.size(); j++) {
......
......@@ -65,6 +65,8 @@ public class SysCAMSBlockDE extends TGCScalableWithInternalComponent implements
private String code;
private String clock;
private String clockName;
private String clockSensitivityMethod;
private boolean sensitive;
private DefaultListModel<String> listStruct;
private String nameTemplate;
private String typeTemplate;
......@@ -305,6 +307,7 @@ public class SysCAMSBlockDE extends TGCScalableWithInternalComponent implements
// sb.append(getPeriod());
// sb.append("\" time=\"" + getTime());
sb.append("\" clockName=\"" + getClockName());
sb.append("\" clockSensitivityMethod\"" + getClockSensitivityMethod());
sb.append("\" code=\"" + encode(getCode()));
sb.append("\" listStruct=\"" + splitParameters(getListStruct()));
sb.append("\" nameTemplate=\"" + getNameTemplate());
......@@ -449,6 +452,7 @@ public class SysCAMSBlockDE extends TGCScalableWithInternalComponent implements
// period = Integer.decode(elt.getAttribute("period")).intValue();
// time = elt.getAttribute("time");
clockName = elt.getAttribute("clockName");
clockSensitivityMethod = elt.getAttribute("clockSensitivityMethod");
code = elt.getAttribute("code");
nameFn = elt.getAttribute("name_function");
listStruct = elt.getAttribute("listStruct");
......@@ -535,6 +539,23 @@ public class SysCAMSBlockDE extends TGCScalableWithInternalComponent implements
public String getClockName() {
return clock;
}
public boolean getSensitive() {
return sensitive;
}
public void setSensitive(boolean _sensitive) {
sensitive = _sensitive;
}
public String getClockSensitivityMethod() {
return clockSensitivityMethod;
}
public void setClockSensitivityMethod(String _clockSensitivityMethod) {
clockSensitivityMethod = _clockSensitivityMethod;
}
public void setNameFn(String nameFn) {
this.nameFn = nameFn;
......
......@@ -61,6 +61,7 @@ public class JDialogSysCAMSBlockDE extends JDialog implements ActionListener, Li
private JTextField nameTextField;
private JTextField clockTextField;
// private JTextField periodTextField;
// private String listPeriodString[];
// private JComboBox<String> periodComboBoxString;
......@@ -82,7 +83,8 @@ public class JDialogSysCAMSBlockDE extends JDialog implements ActionListener, Li
private JTextField nameTypedefTextField;
private String listTypeTypedefString[];
private JComboBox<String> typeTypedefComboBoxString;
private JButton addModifyTypedefButton;
private JButton addModifyTypedefButton;
private ArrayList<String> listTmpTypedef;
private JList<String> typedefList;
private DefaultListModel<String> typedefListModel;
......@@ -95,7 +97,11 @@ public class JDialogSysCAMSBlockDE extends JDialog implements ActionListener, Li
private JButton nameFnButton;
private JTextArea codeTextArea;
private String finalString;
private JRadioButton sensitiveRadioButton;
private String listSensitiveString[];
private JComboBox<String> sensitiveComboBoxString;
private SysCAMSBlockDE block;
public JDialogSysCAMSBlockDE(SysCAMSBlockDE block) {
......@@ -292,6 +298,27 @@ public class JDialogSysCAMSBlockDE extends JDialog implements ActionListener, Li
gridBag.setConstraints(clockTextField, constraints);
attributesBoxPanel.add(clockTextField);
listSensitiveString = new String[3];
listSensitiveString[0] = "";
listSensitiveString[1] = "positive";
listSensitiveString[2] = "negative";
sensitiveComboBoxString = new JComboBox<String>(listSensitiveString);
if (block.getClockSensitivityMethod().equals("")) {
sensitiveComboBoxString.setSelectedIndex(0);
} else if (block.getClockSensitivityMethod().equals("positive")) {
sensitiveComboBoxString.setSelectedIndex(1);
} else if (block.getClockSensitivityMethod().equals("negative")) {
sensitiveComboBoxString.setSelectedIndex(2);
}
sensitiveComboBoxString.setActionCommand("Sensitive_method");
sensitiveComboBoxString.setEnabled(block.getSensitive());
sensitiveComboBoxString.addActionListener(this);
constraints = new GridBagConstraints(1, 2, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(15, 10, 5, 10), 0, 0);
gridBag.setConstraints(sensitiveComboBoxString, constraints);
//boxPanel.add(sensitiveComboBoxString);
attributesBoxPanel.add(sensitiveComboBoxString);
attributesBox.add(attributesBoxPanel);
attributesMainPanel.add(attributesBox, BorderLayout.NORTH);
......@@ -714,6 +741,13 @@ public class JDialogSysCAMSBlockDE extends JDialog implements ActionListener, Li
}
public void actionPerformed(ActionEvent e) {
if ("Sensitive".equals(e.getActionCommand())) {
if (sensitiveRadioButton.isSelected() == true) {
sensitiveComboBoxString.setEnabled(true);
} else {
sensitiveComboBoxString.setEnabled(false);
}
}
if ("Name_OK".equals(e.getActionCommand())) {
if (!nameFnTextField.getText().equals("")) {
codeTextArea.setText("void " + nameFnTextField.getText() + "() {\n\n}");
......@@ -1062,6 +1096,9 @@ public class JDialogSysCAMSBlockDE extends JDialog implements ActionListener, Li
block.setCode(codeTextArea.getText());
}
block.setSensitive(sensitiveRadioButton.isSelected());
block.setClockSensitivityMethod((String) sensitiveComboBoxString.getSelectedItem());
this.dispose();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment