From: stephane Domas Date: Thu, 3 May 2018 19:15:04 +0000 (+0200) Subject: moved clocks list to graph X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/commitdiff_plain/3fb762e7042d9b4a1cf78556ad9ed7f117cc53ba?ds=inline moved clocks list to graph --- diff --git a/AbstractInterface.cpp b/AbstractInterface.cpp index 3295dc8..d040598 100644 --- a/AbstractInterface.cpp +++ b/AbstractInterface.cpp @@ -5,7 +5,7 @@ AbstractInterface::AbstractInterface(AbstractBlock* _owner) { - owner = _owner; + owner = _owner; name = ""; width = "1"; direction = Input; diff --git a/AbstractInterface.h b/AbstractInterface.h index 8a509fb..1e208bf 100644 --- a/AbstractInterface.h +++ b/AbstractInterface.h @@ -91,8 +91,7 @@ protected: int direction; int type; QString width; - int endianess; - + int endianess; AbstractBlock* owner; /*! diff --git a/BlockLibraryWidget.cpp b/BlockLibraryWidget.cpp index d80a78e..32012c5 100644 --- a/BlockLibraryWidget.cpp +++ b/BlockLibraryWidget.cpp @@ -1,5 +1,6 @@ #include "BlockLibraryWidget.h" #include "BlockLibraryTree.h" +#include "Graph.h" BlockLibraryWidget::BlockLibraryWidget(Dispatcher* _dispatcher, Parameters* _params, @@ -31,7 +32,7 @@ BlockLibraryWidget::BlockLibraryWidget(Dispatcher* _dispatcher, 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"); @@ -198,7 +199,7 @@ void BlockLibraryWidget::updateBoxConn() { //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); } @@ -243,7 +244,7 @@ void BlockLibraryWidget::updateClkRst(int idCat, int idBlock) { 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); @@ -255,7 +256,7 @@ void BlockLibraryWidget::updateClkRst(int idCat, int idBlock) { for(int i=0;iclocks.size();j++) { + for(int j=0;jgetGraph()->getClocks().size();j++) { name = "ext_rst_"+QString::number(j); comboRstGen[i]->addItem(name); } diff --git a/Dispatcher.cpp b/Dispatcher.cpp index c50270c..b162559 100644 --- a/Dispatcher.cpp +++ b/Dispatcher.cpp @@ -684,7 +684,7 @@ void Dispatcher::addClkRstGenBlock(Context context, double frequency) { if (context == Design) { - params->clocks.append(frequency); + params->getGraph()->addClock(frequency); // get the top group GroupBlock *group = params->getGraph()->getTopGroup(); @@ -695,7 +695,7 @@ void Dispatcher::addClkRstGenBlock(Context context, double frequency) { 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 @@ -704,8 +704,8 @@ void Dispatcher::addClkRstGenBlock(Context context, double frequency) { 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); @@ -737,7 +737,7 @@ void Dispatcher::addClkRstGenBlock(Context context, double frequency) { -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; @@ -748,7 +748,8 @@ GroupWidget *Dispatcher::createTopScene(Context context){ 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 @@ -771,8 +772,8 @@ GroupWidget *Dispatcher::createTopScene(Context context){ 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); } diff --git a/Dispatcher.h b/Dispatcher.h index cf14b6a..46db9b5 100644 --- a/Dispatcher.h +++ b/Dispatcher.h @@ -75,7 +75,7 @@ public: 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); diff --git a/Graph.cpp b/Graph.cpp index 4b22691..8e55077 100644 --- a/Graph.cpp +++ b/Graph.cpp @@ -4,10 +4,8 @@ #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() { @@ -15,6 +13,12 @@ Graph::~Graph() { delete topGroup; } +void Graph::createTopGroup(bool createTopGroupIfaces) { + topGroup = new GroupBlock(NULL, createTopGroupIfaces); + topGroup->setName("top group"); + groups.append(topGroup); +} + QList Graph::getOutsideInterfaces() { return topGroup->getInterfaces(); } diff --git a/Graph.h b/Graph.h index 58690c9..d5b15a9 100644 --- a/Graph.h +++ b/Graph.h @@ -19,13 +19,18 @@ using namespace Qt; class Graph { public: - Graph(bool createTopGroupIface = true); + Graph(); ~Graph(); // getters inline GroupBlock* getTopGroup() { return topGroup; } inline QList getAllGroups() { return groups; } + inline double getClock(int id) { return clocks.at(id); } + inline QList& getClocks() { return clocks; } + //setters + inline void resetClocks() { clocks.clear(); } + // methods for group blocks GroupBlock* createChildGroupBlock(GroupBlock* parent, bool createGroupIface = true); void removeGroupBlock(GroupBlock *group); @@ -44,6 +49,8 @@ public: bool removeStimuliBlock(FunctionalBlock* block); // others + void createTopGroup(bool createTopGroupIfaces = true); + inline void addClock(double freq) { clocks.append(freq); } QList getOutsideInterfaces(); QList getExternalResources(); // returns the list of all external files needed for VHDL generation @@ -63,6 +70,7 @@ private: GroupBlock* topGroup; QList groups; //! usefull to avoid recursive methods to find a particular group. QList stimulis; //! source for the top group + QList clocks; // clocks[0] is the main clock. }; diff --git a/MainWindow.cpp b/MainWindow.cpp index 8169dd0..99f13bb 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -345,7 +345,7 @@ void MainWindow::slotNewProject(){ 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(); diff --git a/NewProjectDialog.cpp b/NewProjectDialog.cpp index beed427..d8e72f6 100644 --- a/NewProjectDialog.cpp +++ b/NewProjectDialog.cpp @@ -71,7 +71,7 @@ void NewProjectDialog::checkBeforeAccept() { //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; } diff --git a/Parameters.cpp b/Parameters.cpp index 1195f51..d7621d2 100644 --- a/Parameters.cpp +++ b/Parameters.cpp @@ -52,6 +52,8 @@ Parameters::Parameters() { projectPath = ""; projectName = ""; projectFile = ""; + + graph = new Graph(); } Parameters::~Parameters() { @@ -69,8 +71,8 @@ void Parameters::clear() { refPathes.clear(); } -Graph* Parameters::createGraph(bool createTopGroupIfaces) { - graph = new Graph(createTopGroupIfaces); +Graph* Parameters::initGraph(bool createTopGroupIfaces) { + graph->createTopGroup(createTopGroupIfaces); return graph; } @@ -158,7 +160,7 @@ double Parameters::getFeedingClockFrequency(AbstractInterface *iface) { } } } - return clocks.at(idClock); + return graph->getClock(idClock); } void Parameters::createDelayBlock() { @@ -346,6 +348,11 @@ GroupWidget *Parameters::loadProject(QDomElement root) throw(Exception) { else { cout << "trying to create scene n°" << idScene << " with upper scene n°" <addNewEmptyGroup(Dispatcher::Load, upperScene,false); groupWidget->getScene()->setId(idScene); groupItem = groupWidget->getScene()->getGroupItem(); diff --git a/Parameters.h b/Parameters.h index bf679fc..e14b3fe 100644 --- a/Parameters.h +++ b/Parameters.h @@ -138,10 +138,10 @@ public : QString projectPath; QString projectName; QString projectFile; // equals to projectPath/projectName.xml - bool autoConnMainClk; // true if auto-connection to main clock (i.e. ext_clk) - QList clocks; // clocks[0] is the main clock. + bool autoConnMainClk; // true if auto-connection to main clock (i.e. ext_clk) + double mainClock; // main clock freq (reported in graph->clocks(0)) - Graph* createGraph(bool createTopGroupIfaces = true); + Graph* initGraph(bool createTopGroupIfaces = true); void destroyGraph(); inline Graph* getGraph() { return graph; } ReferenceBlock* getReferenceBlock(int idCategory, int idBlock); // get the reference block from its category and index diff --git a/SpecialBlock.cpp b/SpecialBlock.cpp index 8f2271d..fdec328 100644 --- a/SpecialBlock.cpp +++ b/SpecialBlock.cpp @@ -104,7 +104,7 @@ void SpecialBlock::computeOutputPatternClockConvert(int nbExec) throw(Exception) */ AbstractInterface* clkIn = getIfaceFromName("clk_in"); AbstractInterface* clkOut = getIfaceFromName("clk_out"); - cout << "freq clk_in = " << clkIn- + //cout << "freq clk_in = " << clkIn- // in case of inputPattern not created, do it if (lengthIP <= 0) { diff --git a/blast.creator.user b/blast.creator.user index b2e76dd..7270400 100644 --- a/blast.creator.user +++ b/blast.creator.user @@ -1,10 +1,10 @@ - + EnvironmentId - {3701e197-5b6c-48ea-9e98-a6cf6de18672} + {c8006d66-d34f-42be-ad10-d0207752286d} ProjectExplorer.Project.ActiveTarget @@ -61,7 +61,7 @@ Desktop Desktop - {ed04208c-8774-456b-99b9-4a02094ca7a4} + {2c9bf876-3476-44eb-8065-1f0844704dda} 0 0 0 diff --git a/lib/implementations/impls.bmf b/lib/implementations/impls.bmf index 31ec0a1..3fc15fe 100644 Binary files a/lib/implementations/impls.bmf and b/lib/implementations/impls.bmf differ diff --git a/lib/references/references.bmf b/lib/references/references.bmf index b7a6ef6..ffc13f1 100644 Binary files a/lib/references/references.bmf and b/lib/references/references.bmf differ