AbstractInterface::AbstractInterface(AbstractBlock* _owner) {
- owner = _owner;
+ owner = _owner;
name = "";
width = "1";
direction = Input;
int direction;
int type;
QString width;
- int endianess;
-
+ int endianess;
AbstractBlock* owner;
/*!
#include "BlockLibraryWidget.h"
#include "BlockLibraryTree.h"
+#include "Graph.h"
BlockLibraryWidget::BlockLibraryWidget(Dispatcher* _dispatcher,
Parameters* _params,
QString msg = "Connect to main clock/rst ext_clk/reset_0 (";
- msg += QString::number(params->clocks.at(0));
+ msg += QString::number(params->getGraph()->getClock(0));
msg += ")";
radAutoClk = new QRadioButton(msg);
radChooseClk = new QRadioButton("Choose among available clk/rst");
//enableAvailableClocks(true);
}
QString msg = "Auto-connect to main clk/rst (ext_clk_0 at ";
- msg += QString::number(params->clocks.at(0));
+ msg += QString::number(params->getGraph()->getClock(0));
msg += " MHz)";
radAutoClk->setText(msg);
}
comboClkGen[i] = new QComboBox();
QString name = "";
int id = 0;
- foreach(double d, params->clocks) {
+ foreach(double d, params->getGraph()->getClocks()) {
name = "ext_clk_"+QString::number(id)+" (";
name += QString::number(d) + " MHz)";
comboClkGen[i]->addItem(name);
for(int i=0;i<lstRst.size();i++) {
comboRstGen[i] = new QComboBox();
QString name = "";
- for(int j=0;j<params->clocks.size();j++) {
+ for(int j=0;j<params->getGraph()->getClocks().size();j++) {
name = "ext_rst_"+QString::number(j);
comboRstGen[i]->addItem(name);
}
if (context == Design) {
- params->clocks.append(frequency);
+ params->getGraph()->addClock(frequency);
// get the top group
GroupBlock *group = params->getGraph()->getTopGroup();
FunctionalBlock* newOne = params->getGraph()->createFunctionalBlock(group, ref, true);
QString name = "clkrstgen_";
- name += QString::number(params->clocks.size()-1);
+ name += QString::number(params->getGraph()->getClocks().size()-1);
newOne->setName(name);
// creating the box item
ConnectedInterface* fromIfaceClk = NULL;
ConnectedInterface* fromIfaceReset = NULL;
- QString clkName = "ext_clk_"+QString::number(params->clocks.size()-1);
- QString rstName = "ext_reset_"+QString::number(params->clocks.size()-1);
+ QString clkName = "ext_clk_"+QString::number(params->getGraph()->getClocks().size()-1);
+ QString rstName = "ext_reset_"+QString::number(params->getGraph()->getClocks().size()-1);
fromIfaceClk = new GroupInterface(group,clkName, AbstractInterface::Input, AbstractInterface::Clock);
fromIfaceReset = new GroupInterface(group,rstName, AbstractInterface::Input, AbstractInterface::Reset);
group->addInterface(fromIfaceClk);
-GroupWidget *Dispatcher::createTopScene(Context context){
+GroupWidget *Dispatcher::createTopScene(Context context, double mainClock){
static QString fctName = "Dispatcher::createTopScene()";
#ifdef DEBUG_FCTNAME
cout << "call to " << qPrintable(fctName) << endl;
createIfaces = false;
}
// creating the graph and thus, the topgroup
- Graph* graph = params->createGraph(createIfaces);
+ Graph* graph = params->initGraph(createIfaces);
+ graph->addClock(mainClock);
// get the top group
GroupBlock *topBlock = graph->getTopGroup();
// creating the top group widget
if (context == Design) {
// create clkrstgen
- double freq = params->clocks.at(0);
- params->clocks.clear();
+ double freq = params->getGraph()->getClock(0);
+ params->getGraph()->resetClocks();
addClkRstGenBlock(context,freq);
}
void setSceneCounter(Context context, int value);
// testers
// others
- GroupWidget* createTopScene(Context context);
+ GroupWidget* createTopScene(Context context, double mainClock = 0.0);
GroupWidget* createChildScene(Context context, GroupWidget* parentWidget, BoxItem* upperItemOfGroupItem = NULL);
void destroyScene(Context context, GroupScene* scene);
GroupWidget *addNewEmptyGroup(Context context, GroupScene *scene, bool show = true);
#include "FunctionalBlock.h"
#include "SpecialBlock.h"
-Graph::Graph(bool createTopGroupIface) {
- topGroup = new GroupBlock(NULL, createTopGroupIface);
- topGroup->setName("top group");
- groups.append(topGroup);
+Graph::Graph() {
+ topGroup = NULL;
}
Graph::~Graph() {
delete topGroup;
}
+void Graph::createTopGroup(bool createTopGroupIfaces) {
+ topGroup = new GroupBlock(NULL, createTopGroupIfaces);
+ topGroup->setName("top group");
+ groups.append(topGroup);
+}
+
QList<AbstractInterface *> Graph::getOutsideInterfaces() {
return topGroup->getInterfaces();
}
class Graph {
public:
- Graph(bool createTopGroupIface = true);
+ Graph();
~Graph();
// getters
inline GroupBlock* getTopGroup() { return topGroup; }
inline QList<GroupBlock*> getAllGroups() { return groups; }
+ inline double getClock(int id) { return clocks.at(id); }
+ inline QList<double>& getClocks() { return clocks; }
+ //setters
+ inline void resetClocks() { clocks.clear(); }
+
// methods for group blocks
GroupBlock* createChildGroupBlock(GroupBlock* parent, bool createGroupIface = true);
void removeGroupBlock(GroupBlock *group);
bool removeStimuliBlock(FunctionalBlock* block);
// others
+ void createTopGroup(bool createTopGroupIfaces = true);
+ inline void addClock(double freq) { clocks.append(freq); }
QList<AbstractInterface *> getOutsideInterfaces();
QList<QString> getExternalResources(); // returns the list of all external files needed for VHDL generation
GroupBlock* topGroup;
QList<GroupBlock *> groups; //! usefull to avoid recursive methods to find a particular group.
QList<FunctionalBlock*> stimulis; //! source for the top group
+ QList<double> clocks; // clocks[0] is the main clock.
};
if (ret == 1) {
enableProjectActions(true, PROJECT_CLOSE | PROJECT_SAVE | PROJECT_SAVEAS | PROJECT_LIB, OP_RAZ);
enableAnalysisActions(true, ANALYSIS_ANALYZE | ANALYSIS_GENERATE, OP_RAZ);
- GroupWidget* topGroup = dispatcher->createTopScene(Dispatcher::Design);
+ GroupWidget* topGroup = dispatcher->createTopScene(Dispatcher::Design, params->mainClock);
addTopGroup(topGroup);
library->updateComboScene();
library->updateBoxConn();
//cout << "all ok" << endl;
params->projectPath = dirProjEdit->text();
params->projectFile = params->projectPath + "/" + params->projectName + ".xml";
- params->clocks.append(freq);
+ params->mainClock = freq;
if (autoConnClkCheck->isChecked()) {
params->autoConnMainClk = true;
}
projectPath = "";\r
projectName = "";\r
projectFile = "";\r
+\r
+ graph = new Graph();\r
}\r
\r
Parameters::~Parameters() {\r
refPathes.clear();\r
}\r
\r
-Graph* Parameters::createGraph(bool createTopGroupIfaces) {\r
- graph = new Graph(createTopGroupIfaces);\r
+Graph* Parameters::initGraph(bool createTopGroupIfaces) {\r
+ graph->createTopGroup(createTopGroupIfaces);\r
return graph;\r
}\r
\r
}\r
}\r
}\r
- return clocks.at(idClock);\r
+ return graph->getClock(idClock);\r
}\r
\r
void Parameters::createDelayBlock() {\r
else {\r
cout << "trying to create scene n°" << idScene << " with upper scene n°" <<idUpperScene << endl;\r
GroupScene* upperScene = searchSceneById(idUpperScene, topScene);\r
+ /* IMPORTANT: calling addNewEmptyGroup() leads to create a new GroupWidget\r
+ * AND a BoxItem in upperScene that represents the GroupItem in the\r
+ * newly created child scene. Thus, it has not to be created when\r
+ * reading bi_group tags in the following but just searched\r
+ */\r
groupWidget = dispatcher->addNewEmptyGroup(Dispatcher::Load, upperScene,false);\r
groupWidget->getScene()->setId(idScene);\r
groupItem = groupWidget->getScene()->getGroupItem(); \r
QString projectPath;\r
QString projectName;\r
QString projectFile; // equals to projectPath/projectName.xml\r
- bool autoConnMainClk; // true if auto-connection to main clock (i.e. ext_clk)\r
- QList<double> clocks; // clocks[0] is the main clock.\r
+ bool autoConnMainClk; // true if auto-connection to main clock (i.e. ext_clk) \r
+ double mainClock; // main clock freq (reported in graph->clocks(0))\r
\r
- Graph* createGraph(bool createTopGroupIfaces = true);\r
+ Graph* initGraph(bool createTopGroupIfaces = true);\r
void destroyGraph();\r
inline Graph* getGraph() { return graph; } \r
ReferenceBlock* getReferenceBlock(int idCategory, int idBlock); // get the reference block from its category and index\r
*/\r
AbstractInterface* clkIn = getIfaceFromName("clk_in");\r
AbstractInterface* clkOut = getIfaceFromName("clk_out");\r
- cout << "freq clk_in = " << clkIn-\r
+ //cout << "freq clk_in = " << clkIn-\r
\r
// in case of inputPattern not created, do it\r
if (lengthIP <= 0) {\r
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 4.2.0, 2018-05-03T17:24:00. -->
+<!-- Written by QtCreator 4.2.0, 2018-05-03T21:14:33. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
- <value type="QByteArray">{3701e197-5b6c-48ea-9e98-a6cf6de18672}</value>
+ <value type="QByteArray">{c8006d66-d34f-42be-ad10-d0207752286d}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{ed04208c-8774-456b-99b9-4a02094ca7a4}</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{2c9bf876-3476-44eb-8065-1f0844704dda}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>