Commit 7176df35 authored by Daniela Genius's avatar Daniela Genius
Browse files

Merge branch 'master' of gitlab.enst.fr:mbe-tools/TTool

parents 89b60b1c 76f0cf36
12305
\ No newline at end of file
12307
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
......@@ -818,13 +818,10 @@ void Simulator::decodeCommand(std::string iCmd, std::ostream& iXmlOutStream){
aInpStream >> _commandCoverage;
aInpStream >> _branchCoverage;
aInpStream >> aStrParam;
std::stringstream aPath;
//aPath << _graphOutPath << aStrParam << ".dot";
//std::ofstream myDOTfile (aPath.str().c_str());
std::stringstream aPathAutFile;
aPathAutFile << _graphOutPath << aStrParam << ".aut.tmp";
std::ofstream myAUTfile(aPathAutFile.str().c_str());
//aPath.str("");
aPath << _graphOutPath << aStrParam << ".aut.tmp";
std::ofstream myAUTfile (aPath.str().c_str());
aPath.str("");
//std::ofstream myfile2 ("tree.txt");
//if (myDOTfile.is_open() && myAUTfile.is_open()){
if (myAUTfile.is_open()){
......@@ -833,8 +830,8 @@ void Simulator::decodeCommand(std::string iCmd, std::ostream& iXmlOutStream){
//#endif
unsigned int aTransCounter=0;
_terminateExplore=false;
_nbOfBranchesToExplore = 1;
_nbOfBranchesExplored = 0;
_nbOfBranchesToExplore = 1;
_nbOfBranchesExplored = 0;
exploreTree(0, 0, myAUTfile, aTransCounter);
//#ifdef DOT_GRAPH_ENABLED
//myDOTfile << "}\n";
......@@ -842,26 +839,40 @@ void Simulator::decodeCommand(std::string iCmd, std::ostream& iXmlOutStream){
//myDOTfile.close();
//#else
myAUTfile.close();
aPath.str("");
aPath << _graphOutPath << "header";
std::ofstream myTMPfile (aPath.str().c_str());
if (myTMPfile.is_open()){
// aPath.str("");
std::stringstream aPathTreeFile;
aPathTreeFile << _graphOutPath << "header";
std::ofstream myTMPfile( aPathTreeFile.str().c_str() );
if (myTMPfile.is_open()) {
//des (0, 29, 27)
myTMPfile << "des(0," << aTransCounter << "," << TMLTransaction::getID() << ")\n";
myTMPfile.close();
//system ("cat header tree.aut.tmp > tree.aut");
//system ("rm header tree.aut.tmp");
aPath.str("");
aPath << "cat " << _graphOutPath << "header " << _graphOutPath << aStrParam << ".aut.tmp > " << _graphOutPath << aStrParam << ".aut";
system(aPath.str().c_str());
aPath.str("");
aPath << "rm " << _graphOutPath << "header " << _graphOutPath << aStrParam << ".aut.tmp";
system(aPath.str().c_str());
std::stringstream treeFileContent;
treeFileContent << "cat " << _graphOutPath << "header " << _graphOutPath << aStrParam << ".aut.tmp > " << _graphOutPath << aStrParam << ".aut";
system( treeFileContent.str().c_str() );
treeFileContent.str("");
treeFileContent << "rm " << _graphOutPath << "header " << _graphOutPath << aStrParam << ".aut.tmp";
system( treeFileContent.str().c_str() );
aGlobMsg << TAG_MSGo << "Tree was explored" << TAG_MSGc << std::endl;
}
// Issue #56: Output error message when could not open the file
else {
aGlobMsg << TAG_MSGo << MSG_FILEERR << aPathTreeFile.str() << TAG_MSGc << std::endl;
anErrorCode = 4;
}
//#endif
//myfile2.close();
}
aGlobMsg << TAG_MSGo << "Tree was explored" << TAG_MSGc << std::endl;
// Issue #56: Output error message when could not open the file
else {
aGlobMsg << TAG_MSGo << MSG_FILEERR << aPathAutFile.str() << TAG_MSGc << std::endl;
anErrorCode = 4;
}
_simTerm=true;
//aGlobMsg << TAG_MSGo << MSG_CMDNIMPL << TAG_MSGc << std::endl;
//anErrorCode=1;
......@@ -1382,11 +1393,12 @@ void Simulator::decodeCommand(std::string iCmd, std::ostream& iXmlOutStream){
anErrorCode=3;
}
aGlobMsg << TAG_ERRNOo << anErrorCode << TAG_ERRNOc << std::endl;
//if (aSimTerminated) aGlobMsg << SIM_TERM; else aGlobMsg << SIM_READY;
writeSimState(aGlobMsg);
aGlobMsg << std::endl << TAG_GLOBALc << std::endl << anEntityMsg.str() << TAG_STARTc << std::endl;
//std::cout << "Before reply." << std::endl;
if (_replyToServer) {
if (_syncInfo->_server != NULL) {
_syncInfo->_server->sendReply(aGlobMsg.str());
......
......@@ -82,7 +82,7 @@ public class TMLMapping<E> {
private List<TMLCPLib> mappedCPLibs;
// For plugins
private ArrayList<String> customValues;
private List<String> customValues;
private boolean optimized = false;
private int hashCode;
......
......@@ -1010,7 +1010,7 @@ public class AvatarDesignPanelTranslator {
this.listE.addCor (aaos, asmdss);
asmdss.setAVATARID (aaos.getID());
if (asmdss.getCheckLatency()){
_as.checkedIDs.add(asmdss.getName()+":"+aaos.getID());
_as.checkedIDs.add(asmdss.getName()+"-"+ asmdss.getSignalName()+":"+aaos.getID());
}
asm.addElement (aaos);
}
......@@ -1289,7 +1289,7 @@ public class AvatarDesignPanelTranslator {
asmdrs.setAVATARID (aaos.getID());
asm.addElement (aaos);
if (asmdrs.getCheckLatency()){
_as.checkedIDs.add(asmdrs.getName()+":"+aaos.getID());
_as.checkedIDs.add(asmdrs.getName()+"-"+asmdrs.getSignalName()+":"+aaos.getID());
}
}
......@@ -1312,7 +1312,7 @@ public class AvatarDesignPanelTranslator {
astate.addReferenceObject (tgc);
tgc.setAVATARID (astate.getID());
if (tgc.getCheckLatency()){
_as.checkedIDs.add(tgc.getName()+":"+astate.getID());
_as.checkedIDs.add(tgc.getName()+"-"+tgc.getValue()+":"+astate.getID());
}
}
......
......@@ -4175,7 +4175,8 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe
public void interactiveSimulationSystemC(String executePath) {
TraceManager.addDev("MainGUI / Execute path=" + executePath);
ArrayList<Point> points = getListOfBreakPoints();
List<Point> points = getListOfBreakPoints();
if (gtm == null) {
jfis = new JFrameInteractiveSimulation(frame, this, "Interactive simulation", ConfigurationTTool.SystemCHost, executePath, null, points);
} else {
......@@ -4192,11 +4193,11 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe
}
}
}
jfis.setIconImage(IconManager.img9);
//jfis.setSize(1024, 900);
GraphicLib.centerOnParent( jfis, 1024, 900 );
jfis.setVisible(true);
}
public void addBreakPoint(int commandId) {
......@@ -6596,7 +6597,6 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe
}
}
public void alignPartitions() {
//TraceManager.addDev("Align instances");
if (getCurrentTDiagramPanel() instanceof AvatarADPanel) {
......
......@@ -1441,12 +1441,20 @@ public class JFrameAvatarInteractiveSimulation extends JFrame implements Avatar
if (ass.getAllTransactions()!=null){
for (AvatarSimulationTransaction trans: ass.getAllTransactions()){
if ((trans.executedElement != null) && (trans.executedElement.getReferenceObject() != null)) {
String id = ((TGComponent)trans.executedElement.getReferenceObject()).getName() + ":"+Integer.toString(trans.executedElement.getID());
// String id = ((TGComponent)trans.executedElement.getReferenceObject()).getName() + ":"+Integer.toString(trans.executedElement.getID());
String id = Integer.toString(trans.executedElement.getID());
// System.out.println(id + " " + transTimes.keySet());
// System.out.println("transaction " + trans.executedElement.getID() + " " + trans.initialClockValue);
if (transTimes.containsKey(id)){
if (!transTimes.get(id).contains(Long.toString(trans.initialClockValue))){
transTimes.get(id).add(Long.toString(trans.initialClockValue));
String key="";
for (String s: transTimes.keySet()){
String tmpid = s.split(":")[1];
if (id.equals(tmpid)){
key=s;
}
}
if (transTimes.containsKey(key)){
if (!transTimes.get(key).contains(Long.toString(trans.initialClockValue))){
transTimes.get(key).add(Long.toString(trans.initialClockValue));
}
}
}
......
......@@ -36,9 +36,6 @@
* knowledge of the CeCILL license and that you accept its terms.
*/
package ui.interactivesimulation;
import tmltranslator.HwBus;
......@@ -47,7 +44,8 @@ import tmltranslator.TMLMapping;
import javax.swing.table.AbstractTableModel;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
/**
* Class BusTableModel
......@@ -57,15 +55,16 @@ import java.util.Hashtable;
* @author Ludovic APVRILLE
*/
public class BusTableModel extends AbstractTableModel {
private TMLMapping tmap;
ArrayList<HwBus> bus;
private Hashtable <Integer, String> valueTable;
private Hashtable <Integer, Integer> rowTable;
private TMLMapping<?> tmap;
private List<HwBus> bus;
private Map<Integer, String> valueTable;
private Map<Integer, Integer> rowTable;
private int nbOfRows;
//private String [] names;
public BusTableModel(TMLMapping _tmap, Hashtable<Integer, String> _valueTable, Hashtable <Integer, Integer> _rowTable) {
public BusTableModel(TMLMapping<?> _tmap, Map<Integer, String> _valueTable, Map<Integer, Integer> _rowTable) {
tmap = _tmap;
valueTable = _valueTable;
rowTable = _rowTable;
......
......@@ -36,16 +36,14 @@
* knowledge of the CeCILL license and that you accept its terms.
*/
package ui.interactivesimulation;
import tmltranslator.*;
import javax.swing.table.AbstractTableModel;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
/**
* Class CPUTableModel
......@@ -55,15 +53,16 @@ import java.util.Hashtable;
* @author Ludovic APVRILLE
*/
public class CPUTableModel extends AbstractTableModel {
private TMLMapping tmap;
ArrayList<HwExecutionNode> cpus;
private Hashtable <Integer, String> valueTable;
private Hashtable <Integer, Integer> rowTable;
private TMLMapping<?> tmap;
private List<HwExecutionNode> cpus;
private Map<Integer, String> valueTable;
private Map<Integer, Integer> rowTable;
private int nbOfRows;
//private String [] names;
public CPUTableModel(TMLMapping _tmap, Hashtable<Integer, String> _valueTable, Hashtable <Integer, Integer> _rowTable) {
public CPUTableModel(TMLMapping<?> _tmap, Map<Integer, String> _valueTable, Map<Integer, Integer> _rowTable) {
tmap = _tmap;
valueTable = _valueTable;
rowTable = _rowTable;
......
......@@ -36,18 +36,13 @@
* knowledge of the CeCILL license and that you accept its terms.
*/
package ui.interactivesimulation;
//import java.io.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Hashtable;
import java.util.Map;
/**
......@@ -56,13 +51,10 @@ import java.util.Hashtable;
* version 1.0 11/06/2009
* @author Ludovic APVRILLE
*/
public class JPanelSetVariables extends JPanel implements ActionListener {
public class JPanelSetVariables extends JPanel implements ActionListener {
private JFrameInteractiveSimulation jfis;
private JComboBox<String> tasks;
private JComboBox<String> variables;
private JTextField currentValue, newValue;
......@@ -70,10 +62,9 @@ public class JPanelSetVariables extends JPanel implements ActionListener {
private String[] taskIDs, variableIDs;
private Hashtable <Integer, String> valueTable;
private Map<Integer, String> valueTable;
public JPanelSetVariables(JFrameInteractiveSimulation _jfis, Hashtable <Integer, String> _valueTable) {
public JPanelSetVariables(JFrameInteractiveSimulation _jfis, Map<Integer, String> _valueTable) {
super();
jfis = _jfis;
......@@ -85,7 +76,7 @@ public class JPanelSetVariables extends JPanel implements ActionListener {
setComponents();
}
public void makeComponents() {
private void makeComponents() {
GridBagLayout gridbag2 = new GridBagLayout();
GridBagConstraints c2 = new GridBagConstraints();
setLayout(gridbag2);
......@@ -140,7 +131,7 @@ public class JPanelSetVariables extends JPanel implements ActionListener {
add(setButton, c2);
}
public void setComponents() {
private void setComponents() {
if ((variableIDs != null) && (variableIDs.length > 0)){
setButton.setEnabled(true);
newValue.setEditable(true);
......@@ -150,6 +141,7 @@ public class JPanelSetVariables extends JPanel implements ActionListener {
}
}
@Override
public void actionPerformed(ActionEvent evt) {
// Compare the action command to the known actions.
......@@ -167,8 +159,7 @@ public class JPanelSetVariables extends JPanel implements ActionListener {
}
}
public void setValue() {
private void setValue() {
int idTask = getID((String)(tasks.getSelectedItem()));
int idVariable = getID((String)(variables.getSelectedItem()));
String val = newValue.getText().trim();
......@@ -180,7 +171,7 @@ public class JPanelSetVariables extends JPanel implements ActionListener {
jfis.setVariables(idTask, idVariable, val);
}
public int getID(String s) {
private int getID(String s) {
if (s == null) {
return -1;
}
......@@ -201,7 +192,7 @@ public class JPanelSetVariables extends JPanel implements ActionListener {
return -1;
}
protected String getCurrentVariableValue() {
private String getCurrentVariableValue() {
int id = getID((String)(variables.getSelectedItem()));
if (id == -1) {
return " - ";
......@@ -237,8 +228,4 @@ public class JPanelSetVariables extends JPanel implements ActionListener {
protected void setVariableButton(boolean b) {
setButton.setEnabled(b);
}
} // Class
\ No newline at end of file
......@@ -47,7 +47,8 @@ import tmltranslator.TMLMapping;
import javax.swing.table.AbstractTableModel;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
/**
* Class MemTableModel
......@@ -57,15 +58,16 @@ import java.util.Hashtable;
* @author Ludovic APVRILLE
*/
public class MemTableModel extends AbstractTableModel {
private TMLMapping tmap;
ArrayList<HwMemory> mems;
private Hashtable <Integer, String> valueTable;
private Hashtable <Integer, Integer> rowTable;
private TMLMapping<?> tmap;
private List<HwMemory> mems;
private Map<Integer, String> valueTable;
private Map<Integer, Integer> rowTable;
private int nbOfRows;
//private String [] names;
public MemTableModel(TMLMapping _tmap, Hashtable<Integer, String> _valueTable, Hashtable <Integer, Integer> _rowTable) {
public MemTableModel(TMLMapping<?> _tmap, Map<Integer, String> _valueTable, Map<Integer, Integer> _rowTable) {
tmap = _tmap;
valueTable = _valueTable;
rowTable = _rowTable;
......@@ -124,7 +126,6 @@ public class MemTableModel extends AbstractTableModel {
}
private void computeData() {
if (tmap == null) {
nbOfRows = 0;
......@@ -146,5 +147,4 @@ public class MemTableModel extends AbstractTableModel {
}
return;
}
}
\ No newline at end of file
......@@ -36,17 +36,13 @@
* knowledge of the CeCILL license and that you accept its terms.
*/
package ui.interactivesimulation;
import tmltranslator.TMLModeling;
import tmltranslator.TMLTask;
import ui.TGComponent;
import javax.swing.table.AbstractTableModel;
import java.util.Hashtable;
import java.util.Map;
/**
* Class TaskTableModel
......@@ -56,14 +52,15 @@ import java.util.Hashtable;
* @author Ludovic APVRILLE
*/
public class TaskTableModel extends AbstractTableModel {
private TMLModeling<TGComponent> tmlm;
private Hashtable <Integer, String> valueTable;
private Hashtable <Integer, Integer> rowTable;
private Map<Integer, String> valueTable;
private Map<Integer, Integer> rowTable;
private int nbOfRows;
//private String [] names;
public TaskTableModel(TMLModeling<TGComponent> _tmlm, Hashtable<Integer, String> _valueTable, Hashtable <Integer, Integer> _rowTable) {
public TaskTableModel(TMLModeling<TGComponent> _tmlm, Map<Integer, String> _valueTable, Map<Integer, Integer> _rowTable) {
tmlm = _tmlm;
valueTable = _valueTable;
rowTable = _rowTable;
......@@ -119,20 +116,20 @@ public class TaskTableModel extends AbstractTableModel {
private String getTaskID(int row) {
return ""+tmlm.getTasks().get(row).getID();
}
private String getVariableName(int row) {
int cpt = 0;
int size;
for(TMLTask task: tmlm.getTasks()) {
size = task.getAttributes().size();
cpt += size;
if (row < cpt) {
return "" + task.getAttributes().get(row+size-cpt).getName();
}
}
return "unknown name";
}
//
// private String getVariableName(int row) {
// int cpt = 0;
// int size;
// for(TMLTask task: tmlm.getTasks()) {
// size = task.getAttributes().size();
// cpt += size;
// if (row < cpt) {
// return "" + task.getAttributes().get(row+size-cpt).getName();
// }
// }
//
// return "unknown name";
// }
public String getCycles(String _s) {
if (_s == null) {
......@@ -156,8 +153,6 @@ public class TaskTableModel extends AbstractTableModel {
return _s.substring(0, index);
}
private String getTaskCycles(int row) {
int ID = tmlm.getTasks().get(row).getID();
String s = getCycles(valueTable.get(new Integer(ID)));
......@@ -199,5 +194,4 @@ public class TaskTableModel extends AbstractTableModel {
}
return;
}
}
......@@ -36,9 +36,6 @@
* knowledge of the CeCILL license and that you accept its terms.
*/
package ui.interactivesimulation;
import tmltranslator.TMLModeling;
......@@ -46,7 +43,7 @@ import tmltranslator.TMLTask;
import ui.TGComponent;
import javax.swing.table.AbstractTableModel;
import java.util.Hashtable;
import java.util.Map;
/**
* Class TaskVariableTableModel
......@@ -56,14 +53,15 @@ import java.util.Hashtable;
* @author Ludovic APVRILLE
*/
public class TaskVariableTableModel extends AbstractTableModel {
private TMLModeling<TGComponent> tmlm;
private Hashtable <Integer, String> valueTable;
private Hashtable <Integer, Integer> rowTable;
private TMLModeling<TGComponent> tmlm;
private Map<Integer, String> valueTable;
private Map<Integer, Integer> rowTable;
private int nbOfRows;
//private String [] names;
public TaskVariableTableModel(TMLModeling<TGComponent> _tmlm, Hashtable<Integer, String> _valueTable, Hashtable <Integer, Integer> _rowTable) {
public TaskVariableTableModel(TMLModeling<TGComponent> _tmlm, Map<Integer, String> _valueTable, Map<Integer, Integer> _rowTable) {
tmlm = _tmlm;
valueTable = _valueTable;
rowTable = _rowTable;
......@@ -231,5 +229,4 @@ public class TaskVariableTableModel extends AbstractTableModel {
}
return;
}
}
......@@ -51,8 +51,8 @@ package ui.util;
*/
public class DefaultText {
public static String BUILD = "12304";
public static String DATE = "2017/07/18 02:01:26 CET";
public static String BUILD = "12306";
public static String DATE = "2017/07/20 02:01:26 CET";
public static StringBuffer sbAbout = makeAbout();
......
......@@ -37,9 +37,6 @@
* knowledge of the CeCILL license and that you accept its terms.
*/
package ui.window;
import launcher.LauncherException;
......@@ -50,8 +47,6 @@ import ui.*;
import tmltranslator.*;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
......@@ -69,7 +64,7 @@ import java.util.*;
* @version 1.2 27/04/2015