#include <QMessageBox>\r
#include "AbstractInterface.h"\r
#include "BlockParameter.h"\r
+#include "Parameters.h"\r
+ #include "GroupBlock.h"\r
+ #include "ConnectedInterface.h"\r
+ \r
+\r
AbstractBlock::AbstractBlock() {\r
name = "";\r
parent = NULL;\r
}\r
\r
+ /*\r
AbstractBlock::AbstractBlock(const QString& _name) {\r
- name = normalizeName(_name);\r
+ name = Parameters::normalizeName(_name);\r
parent = NULL;\r
}\r
+ */\r
\r
AbstractBlock::~AbstractBlock() {\r
\r
return lst;\r
}\r
\r
-QString AbstractBlock::normalizeName(const QString &name) {\r
- QString s = name;\r
- s.replace(QRegularExpression("[^a-zA-Z0-9_]"),"_");\r
- s.replace(QRegularExpression("[_]+"),"_");\r
- return s;\r
-}\r
+\r
\r
+ void AbstractBlock::connectClkReset() throw(Exception) {\r
+ \r
+ GroupBlock* parentBlock = AB_TO_GRP(parent);\r
+ \r
+ cout << "connecting clk/rst for child " << qPrintable(name) << " of " << qPrintable(parentBlock->getName()) << endl;\r
+ \r
+ QList<AbstractInterface* > lstClk = getInterfaces(AbstractInterface::Input,AbstractInterface::Clock);\r
+ QList<AbstractInterface* > lstRst = getInterfaces(AbstractInterface::Input,AbstractInterface::Reset);\r
+ \r
+ if ((lstClk.isEmpty()) || (lstRst.isEmpty())) {\r
+ throw(Exception(IFACE_GROUP_NOCLKRST,this));\r
+ }\r
+ \r
+ ConnectedInterface* toClk = AI_TO_CON(lstClk.at(0));\r
+ ConnectedInterface* toRst = AI_TO_CON(lstRst.at(0));\r
+ \r
+ ConnectedInterface* fromClk = NULL;\r
+ ConnectedInterface* fromRst = NULL;\r
+ \r
+ if (parentBlock->isTop()) {\r
+ AbstractBlock* clkrstgen = parentBlock->getFunctionalBlockByName("clkrstgen");\r
+ if (clkrstgen == NULL) {\r
+ throw(Exception(IFACE_TOP_NOCLKRSTGEN,this));\r
+ }\r
+ else {\r
+ fromClk = AI_TO_CON(clkrstgen->getIfaceFromName("clk"));\r
+ fromRst = AI_TO_CON(clkrstgen->getIfaceFromName("reset"));\r
+ }\r
+ }\r
+ else {\r
+ fromClk = AI_TO_CON(parentBlock->getIfaceFromName("clk"));\r
+ fromRst = AI_TO_CON(parentBlock->getIfaceFromName("reset"));\r
+ }\r
+ if ((fromClk == NULL) || (fromRst == NULL)) {\r
+ throw(Exception(IFACE_GROUP_NOCLKRST,parentBlock));\r
+ }\r
+ else {\r
+ fromClk->connectTo(toClk);\r
+ fromRst->connectTo(toRst);\r
+ }\r
+ \r
+ \r
+ }\r
+ \r
+ \r
\r
+++ /dev/null
--<?xml version="1.0" encoding="UTF-8"?>
--<!DOCTYPE QtCreatorProject>
- <!-- Written by QtCreator 4.2.0, 2018-02-12T16:51:17. -->
-<!-- Written by QtCreator 4.2.0, 2018-01-24T21:11:11. -->
--<qtcreator>
-- <data>
-- <variable>EnvironmentId</variable>
- <value type="QByteArray">{94112477-caab-4897-8f75-5f412f2c883a}</value>
- <value type="QByteArray">{c8006d66-d34f-42be-ad10-d0207752286d}</value>
-- </data>
-- <data>
-- <variable>ProjectExplorer.Project.ActiveTarget</variable>
-- <value type="int">0</value>
-- </data>
-- <data>
-- <variable>ProjectExplorer.Project.EditorSettings</variable>
-- <valuemap type="QVariantMap">
-- <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
-- <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
-- <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
-- <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
-- <value type="QString" key="language">Cpp</value>
-- <valuemap type="QVariantMap" key="value">
-- <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
-- </valuemap>
-- </valuemap>
-- <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
-- <value type="QString" key="language">QmlJS</value>
-- <valuemap type="QVariantMap" key="value">
-- <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
-- </valuemap>
-- </valuemap>
-- <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
-- <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
-- <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
-- <value type="int" key="EditorConfiguration.IndentSize">4</value>
-- <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
-- <value type="int" key="EditorConfiguration.MarginColumn">80</value>
-- <value type="bool" key="EditorConfiguration.MouseHiding">true</value>
-- <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
-- <value type="int" key="EditorConfiguration.PaddingMode">1</value>
-- <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
-- <value type="bool" key="EditorConfiguration.ShowMargin">false</value>
-- <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
-- <value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
-- <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
-- <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
-- <value type="int" key="EditorConfiguration.TabSize">8</value>
-- <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
-- <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
-- <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
-- <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
-- <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
-- <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
-- </valuemap>
-- </data>
-- <data>
-- <variable>ProjectExplorer.Project.PluginSettings</variable>
-- <valuemap type="QVariantMap"/>
-- </data>
-- <data>
-- <variable>ProjectExplorer.Project.Target.0</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">{c934e180-ebc6-41ed-be82-502cc94f41f6}</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>
-- <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
-- <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/sdomas/Projet/Blast/code/blast</value>
-- <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
-- <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
-- <valuelist type="QVariantList" key="GenericProjectManager.GenericMakeStep.BuildTargets">
-- <value type="QString">all</value>
-- </valuelist>
-- <value type="bool" key="GenericProjectManager.GenericMakeStep.Clean">false</value>
-- <value type="QString" key="GenericProjectManager.GenericMakeStep.MakeArguments"></value>
-- <value type="QString" key="GenericProjectManager.GenericMakeStep.MakeCommand"></value>
-- <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
-- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
-- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
-- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericMakeStep</value>
-- </valuemap>
-- <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
-- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Compiler</value>
-- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
-- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
-- </valuemap>
-- <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
-- <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
-- <valuelist type="QVariantList" key="GenericProjectManager.GenericMakeStep.BuildTargets">
-- <value type="QString">clean</value>
-- </valuelist>
-- <value type="bool" key="GenericProjectManager.GenericMakeStep.Clean">true</value>
-- <value type="QString" key="GenericProjectManager.GenericMakeStep.MakeArguments"></value>
-- <value type="QString" key="GenericProjectManager.GenericMakeStep.MakeCommand"></value>
-- <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
-- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
-- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
-- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericMakeStep</value>
-- </valuemap>
-- <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
-- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Nettoyer</value>
-- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
-- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
-- </valuemap>
-- <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
-- <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
-- <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
-- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Défaut</value>
-- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Défaut</value>
-- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericBuildConfiguration</value>
-- </valuemap>
-- <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
-- <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
-- <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
-- <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
-- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Déploiement</value>
-- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
-- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
-- </valuemap>
-- <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
-- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Déployer localement</value>
-- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
-- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
-- </valuemap>
-- <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
-- <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
-- <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
-- <value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
-- <value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
-- <value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
-- <value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
-- <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
-- <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
-- <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
-- <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
-- <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
-- <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
-- <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
-- <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
-- <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
-- <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
-- <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
-- <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
-- <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
-- <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
-- <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
-- <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
-- <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
-- <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
-- <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
-- <value type="int">0</value>
-- <value type="int">1</value>
-- <value type="int">2</value>
-- <value type="int">3</value>
-- <value type="int">4</value>
-- <value type="int">5</value>
-- <value type="int">6</value>
-- <value type="int">7</value>
-- <value type="int">8</value>
-- <value type="int">9</value>
-- <value type="int">10</value>
-- <value type="int">11</value>
-- <value type="int">12</value>
-- <value type="int">13</value>
-- <value type="int">14</value>
-- </valuelist>
-- <value type="int" key="PE.EnvironmentAspect.Base">2</value>
-- <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
-- <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
-- <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value>
-- <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value>
-- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Executable</value>
-- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
-- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
-- <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
-- <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
-- <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
-- <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
-- <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
-- <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
-- </valuemap>
-- <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
-- </valuemap>
-- </data>
-- <data>
-- <variable>ProjectExplorer.Project.TargetCount</variable>
-- <value type="int">1</value>
-- </data>
-- <data>
-- <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
-- <value type="int">18</value>
-- </data>
-- <data>
-- <variable>Version</variable>
-- <value type="int">18</value>
-- </data>
--</qtcreator>