X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/8fb3c55ee009a11db5e1c08a4cfb286979412745..4327c2b8817b627249d98d889835726217c81a4e:/AbstractBlock.cpp diff --git a/AbstractBlock.cpp b/AbstractBlock.cpp index b8ce5e5..218ea61 100644 --- a/AbstractBlock.cpp +++ b/AbstractBlock.cpp @@ -8,10 +8,11 @@ #include "ConnectedInterface.h" -AbstractBlock::AbstractBlock() { +AbstractBlock::AbstractBlock(Graph *_graph) { name = ""; parent = NULL; specialType = NotSpecial; + graph = _graph; } /* @@ -277,73 +278,6 @@ QList AbstractBlock::getWishboneParameters() { return lst; } -void AbstractBlock::connectClock(QString clkName, int idGen) throw(Exception) { - - GroupBlock* parentBlock = AB_TO_GRP(parent); - ConnectedInterface* fromClk = NULL; - ConnectedInterface* toClk = AI_TO_CON(getIfaceFromName(clkName)); - - if (parentBlock->isTop()) { - QString genName = "clkrstgen_" + QString::number(idGen); - AbstractBlock* clkrstgen = parentBlock->getFunctionalBlockByName(genName); - if (clkrstgen == NULL) { - throw(Exception(IFACE_TOP_NOCLKRSTGEN,this)); - } - else { - fromClk = AI_TO_CON(clkrstgen->getIfaceFromName("clk")); - } - cout << "connecting clock for " << qPrintable(name) << " to " << qPrintable(genName) << endl; - } - else { - // searching for ext_clk_idGen - QString name = "ext_clk_"+QString::number(idGen); - fromClk = AI_TO_CON(parentBlock->getIfaceFromName(name)); - cout << "connecting clk for child " << qPrintable(name) << " of " << qPrintable(parentBlock->getName()) << endl; - } - - if (fromClk == NULL) { - throw(Exception(IFACE_GROUP_NOCLKRST,parentBlock)); - } - else { - fromClk->connectTo(toClk); - cout << "connection done between " << qPrintable(toClk->getConnectedFrom()->getOwner()->getName()) << "/" << qPrintable(toClk->getConnectedFrom()->getName()); - cout << " and " << qPrintable(toClk->getOwner()->getName()) << "/" << qPrintable(toClk->getName()) << endl; - } -} - -void AbstractBlock::connectReset(QString rstName, int idGen) throw(Exception) { - - GroupBlock* parentBlock = AB_TO_GRP(parent); - ConnectedInterface* fromRst = NULL; - ConnectedInterface* toRst = AI_TO_CON(getIfaceFromName(rstName)); - - if (parentBlock->isTop()) { - QString genName = "clkrstgen_" + QString::number(idGen); - AbstractBlock* clkrstgen = parentBlock->getFunctionalBlockByName(genName); - if (clkrstgen == NULL) { - throw(Exception(IFACE_TOP_NOCLKRSTGEN,this)); - } - else { - fromRst = AI_TO_CON(clkrstgen->getIfaceFromName("reset")); - } - cout << "connecting reset for " << qPrintable(name) << " to " << qPrintable(genName) << endl; - } - else { - QString name = "ext_reset_"+QString::number(idGen); - fromRst = AI_TO_CON(parentBlock->getIfaceFromName(name)); - cout << "connecting reset for child " << qPrintable(name) << " of " << qPrintable(parentBlock->getName()) << endl; - } - - if (fromRst == NULL) { - throw(Exception(IFACE_GROUP_NOCLKRST,parentBlock)); - } - else { - fromRst->connectTo(toRst); - cout << "connection done between " << qPrintable(toRst->getConnectedFrom()->getOwner()->getName()) << "/" << qPrintable(toRst->getConnectedFrom()->getName()); - cout << " and " << qPrintable(toRst->getOwner()->getName()) << "/" << qPrintable(toRst->getName()) << endl; - } -} - void AbstractBlock::generateEntity(QTextStream& out, bool hasController) throw(Exception) { out << "entity " << name << " is" << endl;