X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/1b7818e18ed7bcf3464e307b97c6e0e6d72cc69b..6a0ffdb10d7344d99e04c5518fca2b8295df94be:/Dispatcher.cpp?ds=sidebyside diff --git a/Dispatcher.cpp b/Dispatcher.cpp index da4bae2..8d11649 100644 --- a/Dispatcher.cpp +++ b/Dispatcher.cpp @@ -111,7 +111,7 @@ bool Dispatcher::createConnection(Context context, InterfaceItem *iface1, Interf ref1->connectTo(ref2); ok1 = true; } - // if the frist one did not work, test ref2->ref1 + // if the first one did not work, test ref2->ref1 if ((ok1 == false) && (ref2->canConnectTo(ref1)) && (ref1->canConnectFrom(ref2))) { ref2->connectTo(ref1); ok2 = true; @@ -693,15 +693,29 @@ GroupWidget *Dispatcher::createTopScene(Context context){ // creating the clkrstgen block ReferenceBlock* ref = params->getHiddenReferenceBlock("clkrstgen"); FunctionalBlock* newOne = params->getGraph()->createFunctionalBlock(topBlock, ref, true); - ConnectedInterface* fromIface = AI_TO_CON(topBlock->getIfaceFromName("ext_clk")); - ConnectedInterface* toIface = AI_TO_CON(newOne->getIfaceFromName("ext_clk")); - fromIface->connectTo(toIface); - fromIface = AI_TO_CON(topBlock->getIfaceFromName("ext_reset")); - toIface = AI_TO_CON(newOne->getIfaceFromName("ext_reset")); - fromIface->connectTo(toIface); - // create the clkrstgen boxitem - BoxItem* item = scene->createBoxItem(newOne, GroupScene::Left, GroupScene::Top, AbstractBoxItem::Position, BoxItem::HSpan); - params->blockToItem.insert(newOne,item); + // creating the clkrstgen item + BoxItem* clkResetItem = scene->createBoxItem(newOne, BoxItem::TopLeft, AbstractBoxItem::Position | AbstractBoxItem::Dimension, BoxItem::NoSpan); + params->blockToItem.insert(newOne,clkResetItem); + // creating top group ext_clk iface item + ConnectedInterface* fromIfaceClk = AI_TO_CON(topBlock->getIfaceFromName("ext_clk")); + InterfaceItem* fromIfaceItemClk = new InterfaceItem(0.5 , Parameters::West, fromIfaceClk, group, params, true); + group->addInterfaceItem(fromIfaceItemClk,true); + // creating top group ext_reset iface item + ConnectedInterface* fromIfaceReset = AI_TO_CON(topBlock->getIfaceFromName("ext_reset")); + InterfaceItem* fromIfaceItemReset = new InterfaceItem(0.5 , Parameters::West, fromIfaceReset, group, params, false); + group->addInterfaceItem(fromIfaceItemReset,true); + // connecting ext_clk iface items + InterfaceItem* toIfaceItemClk = clkResetItem->searchInterfaceItemByName("ext_clk"); + if (toIfaceItemClk == NULL) { + cerr << "Abnormal case while connecting top group ext_clk to clkrstgen" << endl; + } + createConnection(context,fromIfaceItemClk, toIfaceItemClk, false); + // connecting ext_reset iface items + InterfaceItem* toIfaceItemReset = clkResetItem->searchInterfaceItemByName("ext_reset"); + if (toIfaceItemReset == NULL) { + cerr << "Abnormal case while connecting top group ext_reset to clkrstgen" << endl; + } + createConnection(context,fromIfaceItemReset, toIfaceItemReset, false); }