]> AND Private Git Repository - blast.git/blobdiff - Dispatcher.cpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
adding link between ifaces and clk
[blast.git] / Dispatcher.cpp
index da4bae2b5ad8a3c4e0d0e4bb2bcebec0d565892c..8d1164964036eb4af1ede213cb1e7325ed9c9b0a 100644 (file)
@@ -111,7 +111,7 @@ bool Dispatcher::createConnection(Context context, InterfaceItem *iface1, Interf
     ref1->connectTo(ref2);    
     ok1 = true;
   }
     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;
   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);
     // 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);
   }
 
 
   }