From 015e6979cd7d336f6bbebfbdb7916af3ba23c096 Mon Sep 17 00:00:00 2001 From: domas stephane Date: Fri, 23 Mar 2018 16:06:38 +0100 Subject: [PATCH] started top group gen, added project subdirs --- AbstractBlock.cpp | 4 +- BlockImplementation.cpp | 14 ++- BlockImplementation.h | 6 ++ Dispatcher.cpp | 3 + FunctionalBlock.cpp | 2 + GroupBlock.cpp | 31 +++--- MainWindow.cpp | 25 ++++- Makefile-isim | 33 ++++++ Parameters.cpp | 63 ++++++----- SourceItem.cpp | 2 +- blast.creator.user | 6 +- blast.creator.user.1d077e4 | 193 +++++++++++++++++++++++++++++++++ blast.creator.user.9411247 | 198 ++++++++++++++++++++++++++++++++++ lib/implementations/impls.bmf | Bin 5790 -> 5807 bytes lib/references/csvreader.xml | 3 +- lib/references/references.bmf | Bin 21156 -> 21052 bytes top_group.vhd | 22 ++++ 17 files changed, 552 insertions(+), 53 deletions(-) create mode 100644 Makefile-isim create mode 100755 blast.creator.user.1d077e4 create mode 100644 blast.creator.user.9411247 create mode 100644 top_group.vhd diff --git a/AbstractBlock.cpp b/AbstractBlock.cpp index 336b677..b78a1e1 100644 --- a/AbstractBlock.cpp +++ b/AbstractBlock.cpp @@ -59,10 +59,12 @@ bool AbstractBlock::isSourceBlock() { } /* NB: a generator is a block that has no data inputs * and has at least one data output. + * By the way, blokcs that have no data input/output + * (like clkrstgen) are not generators ! */ bool AbstractBlock::isGeneratorBlock() { if (getDataInputs().size() > 0) return false; - + if (getDataOutputs().size() == 0) return false; return true; } diff --git a/BlockImplementation.cpp b/BlockImplementation.cpp index 5ae6eda..23ec8bc 100644 --- a/BlockImplementation.cpp +++ b/BlockImplementation.cpp @@ -15,6 +15,8 @@ BlockImplementation::BlockImplementation(const QString& _xmlFile) { evaluator = new ArithmeticEvaluator; evaluator->setVariableMarkers("@$"); + + noPatterns = true; } BlockImplementation::BlockImplementation(const QString& _xmlFile, const QString &_referenceXml, const QString &_referenceMd5) { @@ -23,6 +25,8 @@ BlockImplementation::BlockImplementation(const QString& _xmlFile, const QString delta = ""; referenceXml = _referenceXml; referenceMd5 = _referenceMd5; + + noPatterns = true; } void BlockImplementation::loadPatterns(QDomElement& root) throw(Exception) { @@ -38,7 +42,8 @@ void BlockImplementation::loadPatterns(QDomElement& root) throw(Exception) { QDomElement eltDelta = patternElt.firstChildElement("delta"); delta = eltDelta.attribute("value","none"); - + if (delta == "none") throw(Exception(IMPLFILE_CORRUPTED)); + QDomElement eltCons = eltDelta.nextSiblingElement("consumption"); QDomNodeList listNodeInput = eltCons.elementsByTagName("input"); @@ -47,7 +52,8 @@ void BlockImplementation::loadPatterns(QDomElement& root) throw(Exception) { QDomElement elt = node.toElement(); QString nameStr = elt.attribute("name","none"); if (nameStr == "none") throw(Exception(IMPLFILE_CORRUPTED)); - QString patternStr = elt.attribute("pattern","none"); + QString patternStr = elt.attribute("pattern","none"); + if (patternStr == "none") throw(Exception(IMPLFILE_CORRUPTED)); consumptionPattern.insert(nameStr,patternStr); } @@ -61,6 +67,7 @@ void BlockImplementation::loadPatterns(QDomElement& root) throw(Exception) { QString nameStr = elt.attribute("name","none"); if (nameStr == "none") throw(Exception(IMPLFILE_CORRUPTED)); QString patternStr = elt.attribute("pattern","none"); + if (patternStr == "none") throw(Exception(IMPLFILE_CORRUPTED)); productionPattern.insert(nameStr,patternStr); } cout << "patterns summary:" << endl; @@ -70,6 +77,7 @@ void BlockImplementation::loadPatterns(QDomElement& root) throw(Exception) { cout << qPrintable(iterP.key()) << " -> " << qPrintable(iterP.value()) << endl; } cout << "impls patterns read correctly" << endl; + noPatterns = false; } bool BlockImplementation::checkPatterns() { @@ -324,6 +332,7 @@ QDataStream& operator<<(QDataStream &out, const BlockImplementation &impl) { toWrite << impl.referenceXml; toWrite << impl.referenceMd5; // saving patterns + toWrite << impl.noPatterns; toWrite << impl.delta; toWrite << impl.consumptionPattern; toWrite << impl.productionPattern; @@ -346,6 +355,7 @@ QDataStream& operator>>(QDataStream &in, BlockImplementation &impl) { in >> impl.referenceXml; in >> impl.referenceMd5; // loading patterns + in >> impl.noPatterns; in >> impl.delta; in >> impl.consumptionPattern; in >> impl.productionPattern; diff --git a/BlockImplementation.h b/BlockImplementation.h index aa08ed9..72776e3 100644 --- a/BlockImplementation.h +++ b/BlockImplementation.h @@ -35,12 +35,17 @@ public: inline QHash getConsumptionPattern() { return consumptionPattern; } inline QHash getProductionPattern() { return productionPattern; } inline QString getProductionCounter() { return productionCounter; } + // setters inline void setDelta(QString _delta) { delta = _delta; } inline void setConsumptionPattern(QHash pattern) { consumptionPattern = pattern; } inline void setProductionPattern(QHash pattern) { productionPattern = pattern; } inline void setProductionCounter(QString pattern) { productionCounter = pattern; } + // testers + + inline bool hasNoPatterns() { return noPatterns; } + QString eval(QString line, QTextStream& out); QString evalComplex(QString line, int num); QString evalString(QString s); @@ -65,6 +70,7 @@ private: ArithmeticEvaluator* evaluator; ReferenceBlock* reference; FunctionalBlock* block; // the current functional block for which this implementation is used. + bool noPatterns; QString delta; QHash consumptionPattern; // key = reference interface name, value = pattern expression QHash productionPattern; // key = reference interface name, value = pattern expression diff --git a/Dispatcher.cpp b/Dispatcher.cpp index 946f5ec..c3ff33f 100644 --- a/Dispatcher.cpp +++ b/Dispatcher.cpp @@ -69,6 +69,9 @@ GroupWidget *Dispatcher::loadProject(const QString& filename) { return NULL; } + QFileInfo info(filename); + params->projectPath = info.absolutePath(); + cout << "project path = " << qPrintable(params->projectPath) << endl; groupList.append(topGroup); return topGroup; } diff --git a/FunctionalBlock.cpp b/FunctionalBlock.cpp index 2d455db..1ec0c11 100644 --- a/FunctionalBlock.cpp +++ b/FunctionalBlock.cpp @@ -149,6 +149,8 @@ void FunctionalBlock::createPatterns() throw(Exception) { #ifdef DEBUG_FCTNAME cout << "call to " << qPrintable(fctName) << endl; #endif + + if (implementation->hasNoPatterns()) return; cout << "create patterns for block " << qPrintable(name) << endl; if (evaluator == NULL) evaluator = new ArithmeticEvaluator(); diff --git a/GroupBlock.cpp b/GroupBlock.cpp index 17b7bba..f618789 100644 --- a/GroupBlock.cpp +++ b/GroupBlock.cpp @@ -170,20 +170,22 @@ void GroupBlock::computeOutputPattern(int nbExec) throw(Exception) { if (block->getControlOutputs().size() > 0) addIt = true; } else { - // if the block has all its connected inputs that are connected to an intput of the group, add it too - addIt = true; - foreach(AbstractInterface* iface, block->getControlInputs()) { - //cout << qPrintable(iface->getName()) << " of " << qPrintable(iface->getOwner()->getName()) << " connected to " << endl; - ConnectedInterface* connFrom = ((ConnectedInterface*)iface)->getConnectedFrom(); - //cout << qPrintable(connFrom->getName()) << " of " << qPrintable(connFrom->getOwner()->getName()) << endl; - - if (connFrom == NULL) { - addIt = false; - break; - } - else if (connFrom->getOwner() != this) { - addIt = false; - break; + // if the block has all its connected control inputs that are connected to an intput of the group, add it too + if (block->getControlInputs().size() > 0) { + addIt = true; + foreach(AbstractInterface* iface, block->getControlInputs()) { + //cout << qPrintable(iface->getName()) << " of " << qPrintable(iface->getOwner()->getName()) << " connected to " << endl; + ConnectedInterface* connFrom = ((ConnectedInterface*)iface)->getConnectedFrom(); + //cout << qPrintable(connFrom->getName()) << " of " << qPrintable(connFrom->getOwner()->getName()) << endl; + + if (connFrom == NULL) { + addIt = false; + break; + } + else if (connFrom->getOwner() != this) { + addIt = false; + break; + } } } } @@ -279,6 +281,7 @@ void GroupBlock::generateVHDL(const QString& path) throw(Exception) { throw(Exception(VHDLFILE_NOACCESS)); } + cout << "generate VHDL of block " << qPrintable(name) << " in " << qPrintable(coreFile) << endl; QTextStream outCore(&vhdlCore); QDomElement dummyElt; diff --git a/MainWindow.cpp b/MainWindow.cpp index ad36484..212e54d 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -322,7 +322,7 @@ void MainWindow::slotLoadProject(){ library->updateComboScene(); params->isCurrentProject = true; enableProjectActions(true, PROJECT_CLOSE | PROJECT_SAVE | PROJECT_SAVEAS | PROJECT_LIB, OP_RAZ); - enableAnalysisActions(true, ANALYSIS_ANALYZE, OP_RAZ); + enableAnalysisActions(true, ANALYSIS_ANALYZE | ANALYSIS_GENERATE, OP_RAZ); } else { QMessageBox msgBox; @@ -450,8 +450,29 @@ void MainWindow::slotGraphAnalysis() { } void MainWindow::slotGenerateVHDL() { + + QDir baseDir(params->projectPath); + if (!baseDir.exists()) { + cerr << "Project path " << qPrintable(params->projectPath) << " no longer exists. First, recreate it and put the project file within. Then retry to generate." << endl; + return; + } + if (! baseDir.exists("src")) { + baseDir.mkdir("src"); + } + if (! baseDir.exists("testbench")) { + baseDir.mkdir("testbench"); + } + if (! baseDir.exists("Makefile")) { + QFile make("/home/sdomas/Projet/Blast/code/blast/Makefile-isim"); + QString dest = params->projectPath; + dest += "/Makefile"; + make.copy(dest); + } + + QString dest = params->projectPath; + dest += "/src/"; try { - params->getGraph()->generateVHDL(params->projectPath); + params->getGraph()->generateVHDL(dest); } catch(Exception e) { cerr << qPrintable(e.getMessage()) << endl; diff --git a/Makefile-isim b/Makefile-isim new file mode 100644 index 0000000..c10eb1d --- /dev/null +++ b/Makefile-isim @@ -0,0 +1,33 @@ +OPT := params-isim.txt + +include $(OPT) + +ISIM_DIR := isim + +ISIM_LIB := work + +all : project compile + +project : $(PROJECT).prj + +compile : $(PROJECT).prj $(VHDL_SRC) + tb_name=$$( echo $(TB_SRC) | sed 's,.*/,,' | sed 's,[.].*,,'); \ + fuse $(ISIM_LIB).$$tb_name $(ISIM_LIB).glbl -prj $(PROJECT).prj -L unisim -L secureip -timeprecision_vhdl ps -o $(SIMU_EXE) + +view : + $(SIMU_EXE) -gui -wdb $(SIMU_EXE).wdb + +$(PROJECT).prj : + if [ -f $@ ]; then rm $@; fi + echo "### VHDL sources" + for fich in $(VHDL_SRC); do echo vhdl $(ISIM_LIB) $$fich >> $@; done + echo "### verilog sources" + for fich in $(VL_SRC); do echo verilog $(ISIM_LIB) $$fich >> $@; done + echo "### test bench sources" + for fich in $(TB_SRC); do echo vhdl $(ISIM_LIB) $$fich >> $@; done + +clean : + rm -f *~ + rm -f $(PROJECT).prj + cd $(SRC_DIR); rm -f *~ + cd $(TB_DIR); rm -f *~ diff --git a/Parameters.cpp b/Parameters.cpp index c903f5d..32bec53 100644 --- a/Parameters.cpp +++ b/Parameters.cpp @@ -949,45 +949,52 @@ void Parameters::loadSources() throw(Exception) { cout << "analyzing " << qPrintable(sourcePathes.at(i)) << endl; QDir dir(sourcePathes.at(i)); QStringList filter; - filter << "*.vhd"; + filter << "*.vhd" << "*.ngc"; dir.setNameFilters(filter); QStringList list = dir.entryList(); for(int j=0;j - + EnvironmentId - {94112477-caab-4897-8f75-5f412f2c883a} + {eddbf04f-e5ee-4f36-bc65-6ab7f2b6d4ec} ProjectExplorer.Project.ActiveTarget @@ -61,7 +61,7 @@ Desktop Desktop - {c934e180-ebc6-41ed-be82-502cc94f41f6} + {72d0832a-d73b-473a-b29c-d1c0737451fe} 0 0 0 diff --git a/blast.creator.user.1d077e4 b/blast.creator.user.1d077e4 new file mode 100755 index 0000000..9bc7661 --- /dev/null +++ b/blast.creator.user.1d077e4 @@ -0,0 +1,193 @@ + + + + + + EnvironmentId + {1d077e47-e3a1-47fd-8b12-4de650e39df5} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + qt2 + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 2 + false + 80 + true + true + 1 + true + false + 0 + true + 0 + 4 + false + 1 + true + true + false + false + + + + ProjectExplorer.Project.PluginSettings + + + + ProjectExplorer.Project.Target.0 + + Desktop + Desktop + {451ee8a3-56ff-4aba-8a8e-3da882cc142e} + 0 + 0 + 0 + + /localhome/sdomas/Projet/Blast/code/blast + + + + all + + false + + + true + Make + + GenericProjectManager.GenericMakeStep + + 1 + Compiler + + ProjectExplorer.BuildSteps.Build + + + + + clean + + true + + + true + Make + + GenericProjectManager.GenericMakeStep + + 1 + Nettoyer + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Défaut + Défaut + GenericProjectManager.GenericBuildConfiguration + + 1 + + + 0 + Déploiement + + ProjectExplorer.BuildSteps.Deploy + + 1 + Déployer localement + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + + + false + %{buildDir} + Exécutable personnalisé + + ProjectExplorer.CustomExecutableRunConfiguration + 3768 + false + true + false + false + true + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 16 + + + Version + 16 + + diff --git a/blast.creator.user.9411247 b/blast.creator.user.9411247 new file mode 100644 index 0000000..8441c31 --- /dev/null +++ b/blast.creator.user.9411247 @@ -0,0 +1,198 @@ + + + + + + EnvironmentId + {94112477-caab-4897-8f75-5f412f2c883a} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + + ProjectExplorer.Project.Target.0 + + Desktop + Desktop + {c934e180-ebc6-41ed-be82-502cc94f41f6} + 0 + 0 + 0 + + /home/sdomas/Projet/Blast/code/blast + + + + all + + false + + + true + Make + + GenericProjectManager.GenericMakeStep + + 1 + Compiler + + ProjectExplorer.BuildSteps.Build + + + + + clean + + true + + + true + Make + + GenericProjectManager.GenericMakeStep + + 1 + Nettoyer + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Défaut + Défaut + GenericProjectManager.GenericBuildConfiguration + + 1 + + + 0 + Déploiement + + ProjectExplorer.BuildSteps.Deploy + + 1 + Déployer localement + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + + + %{buildDir} + Custom Executable + + ProjectExplorer.CustomExecutableRunConfiguration + 3768 + false + true + false + false + true + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 18 + + + Version + 18 + + diff --git a/lib/implementations/impls.bmf b/lib/implementations/impls.bmf index 26cb30254bf85e13c2c49c733f624827b959ee0d..ead4014d0bbac1682467b4395f642f8329110335 100644 GIT binary patch delta 389 zcmbQIyIz-vfkA9F0|SE~5I>#Bb48L7$Up;(jX;4}69q~q=Q8?D-o?0=v2pS}?()g+ znIbm3F>hsLG@krHpnP&MtHb0?to5vCfvTrXVlAD#n#~!jak?-C)$DGQ53m=qhJ(zX zJb|-(@>&j`$v-$IGwz+-!?{Kjn_K!P`-zrMKFpOeS&ch=@^)^8$!oc}CiikHuro0j zGcYiE0-bh#@*196#!w)ud-7IZ7ZwH=293#fEaIDm`SKVUv%!x4$saK}KtOczN&$(< z^98sjw+kpuP6e`y#k5&~&N&M7(iW@^&;)DO7mAqNCKSsW3sk#qqCoLveIc>Qg~CZd uLBq++A`Xn~;4s-O;xPG_NHAj{(ABp&7?>Cgf$Eti2Z$+8HWpI=Sq1#T6VGNkOmvIkc!{lE6 z^2r~WA{cchJFc|WhqW){8i)`1;jBP2GtUN{LTYA{(y#DS3wtm%}9 d!(?vJAYe$uiQa} - - + diff --git a/lib/references/references.bmf b/lib/references/references.bmf index a34f5925c214b924674d852699a77d62c20aedb5..512f787b632b03f17d70a777cb980dfc46a60670 100644 GIT binary patch delta 127 zcmZ3olyT1zMivH!Ad8JG0kTZYdp3v3+A=yDFqkqJFc>o=GNb`nX$)ozmJH@VoXC&@ z=A{7TQh_{UpsGX$Lxv;<6EHgstipnUfq`{$fr#kl*K!<;lN}Wd7>y0;l)n N^MPKQUn>L}0s#MlEs6jD diff --git a/top_group.vhd b/top_group.vhd new file mode 100644 index 0000000..60ae10f --- /dev/null +++ b/top_group.vhd @@ -0,0 +1,22 @@ + -- VHDL generated automatically for top_group -- + +library IEEE; +use IEEE.STD_LOGIC_1164.all; +use IEEE.numeric_std.all; +entity top_group is + port ( + -- clk/rst + ext_clk : in std_logic; + ext_reset : in std_logic; + -- input data ports + + -- input control ports + + -- output data ports + + -- output control ports + + ); + +end top_group; + -- 2.39.5