X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/6a0ffdb10d7344d99e04c5518fca2b8295df94be..e40a5399ec7887c2606f18575c809b0d05b09278:/GroupBlock.cpp diff --git a/GroupBlock.cpp b/GroupBlock.cpp index ea7f2f7..fda0546 100644 --- a/GroupBlock.cpp +++ b/GroupBlock.cpp @@ -12,41 +12,42 @@ int GroupBlock::counter = 1; GroupBlock::GroupBlock(GroupBlock *_parent, bool createIfaces) throw(Exception) : AbstractBlock() { + parent = _parent; GroupInterface* clk = NULL; GroupInterface* rst = NULL; // force topGroup to false if this group has a parent - if (_parent != NULL) { + if (parent != NULL) { topGroup = false; name = QString("sub_group")+"_"+QString::number(counter++); - // creating clk/rst interfaces - clk = new GroupInterface(this,"clk", AbstractInterface::Input, AbstractInterface::Clock); - rst = new GroupInterface(this,"reset", AbstractInterface::Input, AbstractInterface::Reset); - addInterface(clk); - addInterface(rst); - - try { - connectClkReset(); - } - catch(Exception e) { - AbstractBlock* source = (AbstractBlock *)(e.getSource()); - cerr << qPrintable(source->getName()) << ":" << qPrintable(e.getMessage()) << endl; - throw(e); - } } else { topGroup = true; name = QString("top_group"); // creating external clk/rst interfaces - clk = new GroupInterface(this,"ext_clk", AbstractInterface::Input, AbstractInterface::Clock); - rst = new GroupInterface(this,"ext_reset", AbstractInterface::Input, AbstractInterface::Reset); - addInterface(clk); - addInterface(rst); - // creating clkrstgen block and connecting it to this: done in Dispatcher since this has no access to library - cout << "created ext_clk and reset ifaces for top group" << endl; } - parent = _parent; + if (createIfaces) { + if (topGroup) { + clk = new GroupInterface(this,"ext_clk_0", AbstractInterface::Input, AbstractInterface::Clock); + rst = new GroupInterface(this,"ext_reset_0", AbstractInterface::Input, AbstractInterface::Reset); + addInterface(clk); + addInterface(rst); + } + else { + // get all clock and reset from parent + QList lstClk = parent->getInterfaces(AbstractInterface::Input, AbstractInterface::Clock); + QList lstRst = parent->getInterfaces(AbstractInterface::Input, AbstractInterface::Reset); + foreach(AbstractInterface* iface, lstClk) { + clk = new GroupInterface(this,iface->getName(),AbstractInterface::Input, AbstractInterface::Clock); + addInterface(clk); + } + foreach(AbstractInterface* iface, lstRst) { + rst = new GroupInterface(this,iface->getName(),AbstractInterface::Input, AbstractInterface::Reset); + addInterface(rst); + } + } + } } GroupBlock::~GroupBlock() {