#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
AbstractBlock::AbstractBlock(const QString& _name) {\r
- name = normalizeName(_name);\r
+ name = Parameters::normalizeName(_name);\r
parent = NULL;\r
}\r
*/\r
}\r
\r
void AbstractBlock::setName(const QString& str) {\r
- name = normalizeName(str);\r
+ name = Parameters::normalizeName(str);\r
}\r
\r
void AbstractBlock::setParent(AbstractBlock* _parent) {\r
}\r
/* NB: a generator is a block that has no data inputs\r
* and has at least one data output.\r
+ * By the way, blokcs that have no data input/output\r
+ * (like clkrstgen) are not generators !\r
*/\r
bool AbstractBlock::isGeneratorBlock() {\r
if (getDataInputs().size() > 0) return false;\r
- \r
+ if (getDataOutputs().size() == 0) return false;\r
return true;\r
}\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
fromClk->connectTo(toClk);\r
fromRst->connectTo(toRst);\r
}\r
+}\r
\r
+void AbstractBlock::generateEntity(QTextStream& out, bool hasController) throw(Exception) {\r
\r
+ out << "entity " << name << " is" << endl;\r
+ try {\r
+ generateEntityOrComponentBody(out, 0, hasController);\r
+ }\r
+ catch(Exception e) {\r
+ throw(e);\r
+ }\r
+ out << "end entity " << name << ";" << endl << endl;\r
}\r
\r
+void AbstractBlock::generateComponent(QTextStream& out, bool hasController) throw(Exception) {\r
+\r
+ out << " component " << name << " is" << endl;\r
+ try {\r
+ generateEntityOrComponentBody(out, 2, hasController);\r
+ }\r
+ catch(Exception e) {\r
+ throw(e);\r
+ }\r
+ out << " end component " << endl << endl;\r
+}\r
\r
\r