+void Dispatcher::connectBoxItemClock(Context context, BoxItem *item, QString clkName, int idGen) throw(Exception) {
+
+ static QString fctName = "Dispatcher::connectBoxItemClock()";
+#ifdef DEBUG_FCTNAME
+ cout << "call to " << qPrintable(fctName) << endl;
+#endif
+ /* NB: only called in Design context */
+ if (context != Design) {
+ cout << "Abnormal case: call to " <<qPrintable(fctName) << " not in Design context" << endl;
+ return;
+ }
+
+ InterfaceItem* fromIfaceItemClk = NULL;
+ InterfaceItem* toIfaceItemClk = item->searchInterfaceItemByName(clkName);
+ GroupItem* parentGroup = item->getScene()->getGroupItem();
+ BoxItem* clkrstItem = NULL;
+
+ if (parentGroup->getRefBlock()->isTopGroupBlock()) {
+ QString genName = "clkrstgen_" + QString::number(idGen);
+ clkrstItem = item->getScene()->searchBoxItemByName(genName);
+ if (clkrstItem == NULL) {
+ throw(Exception(IFACE_TOP_NOCLKRSTGEN));
+ }
+ else {
+ fromIfaceItemClk = clkrstItem->searchInterfaceItemByName("clk");
+ }
+ cout << "connecting clock of " << qPrintable(item->getRefBlock()->getName()) << " to clk of " << qPrintable(genName) << endl;
+ }
+ else {
+ // searching for ext_clk_idGen
+ QString name = "ext_clk_"+QString::number(idGen);
+ fromIfaceItemClk = parentGroup->searchInterfaceItemByName(name);
+ cout << "connecting clock of " << qPrintable(item->getRefBlock()->getName()) << " to " << qPrintable(name) << " of parent group " << qPrintable(parentGroup->getRefBlock()->getName()) << endl;
+ }
+
+ if (fromIfaceItemClk == NULL) {
+ throw(Exception(IFACE_GROUP_NOCLKRST));
+ }
+ else {
+ createConnection(context, fromIfaceItemClk, toIfaceItemClk, false);
+ cout << "connection done." << endl;
+ }
+}
+
+void Dispatcher::connectBoxItemReset(Context context, BoxItem *item, QString rstName, int idGen) throw(Exception) {
+
+ static QString fctName = "Dispatcher::connectBoxItemReset()";
+#ifdef DEBUG_FCTNAME
+ cout << "call to " << qPrintable(fctName) << endl;
+#endif
+ /* NB: only called in Design context */
+ if (context != Design) {
+ cout << "Abnormal case: call to " <<qPrintable(fctName) << " not in Design context" << endl;
+ return;
+ }
+
+ InterfaceItem* fromIfaceItemRst = NULL;
+ InterfaceItem* toIfaceItemRst = item->searchInterfaceItemByName(rstName);
+ GroupItem* parentGroup = item->getScene()->getGroupItem();
+ BoxItem* clkrstItem = NULL;
+
+ if (parentGroup->getRefBlock()->isTopGroupBlock()) {
+ QString genName = "clkrstgen_" + QString::number(idGen);
+ clkrstItem = item->getScene()->searchBoxItemByName(genName);
+ if (clkrstItem == NULL) {
+ throw(Exception(IFACE_TOP_NOCLKRSTGEN));
+ }
+ else {
+ fromIfaceItemRst = clkrstItem->searchInterfaceItemByName("reset");
+ }
+ cout << "connecting reset of " << qPrintable(item->getRefBlock()->getName()) << " to reset of " << qPrintable(genName) << endl;
+ }
+ else {
+ // searching for ext_rst_idGen
+ QString name = "ext_rst_"+QString::number(idGen);
+ fromIfaceItemRst = parentGroup->searchInterfaceItemByName(name);
+ cout << "connecting reset of " << qPrintable(item->getRefBlock()->getName()) << " to " << qPrintable(name) << " of parent group " << qPrintable(parentGroup->getRefBlock()->getName()) << endl;
+ }
+
+ if (fromIfaceItemRst == NULL) {
+ throw(Exception(IFACE_GROUP_NOCLKRST));
+ }
+ else {
+ createConnection(context, fromIfaceItemRst, toIfaceItemRst, false);
+ cout << "connection done." << endl;
+ }
+}
+
+void Dispatcher::connectStimuliItemClock(Context context, StimuliItem *item, QString clkName, int idGen) throw(Exception) {
+
+ static QString fctName = "Dispatcher::connectStimuliItemClock()";
+#ifdef DEBUG_FCTNAME
+ cout << "call to " << qPrintable(fctName) << endl;
+#endif
+ /* NB: only called in Design context */
+ if (context != Design) {
+ cout << "Abnormal case: call to " <<qPrintable(fctName) << " not in Design context" << endl;
+ return;
+ }
+
+ InterfaceItem* fromIfaceItemClk = NULL;
+ InterfaceItem* toIfaceItemClk = item->searchInterfaceItemByName(clkName);
+ BoxItem* clkrstItem = NULL;
+
+ QString genName = "clkrstgen_" + QString::number(idGen);
+ clkrstItem = item->getScene()->searchBoxItemByName(genName);
+ if (clkrstItem == NULL) {
+ throw(Exception(IFACE_TOP_NOCLKRSTGEN));
+ }
+ else {
+ fromIfaceItemClk = clkrstItem->searchInterfaceItemByName("clk");
+ }
+ cout << "connecting clock of " << qPrintable(item->getRefBlock()->getName()) << " to clock of " << qPrintable(genName) << endl;
+
+ if (fromIfaceItemClk == NULL) {
+ throw(Exception(IFACE_GROUP_NOCLKRST));
+ }
+ else {
+ createConnection(context, fromIfaceItemClk, toIfaceItemClk, false);
+ cout << "connection done." << endl;
+ }
+}
+
+void Dispatcher::connectStimuliItemReset(Context context, StimuliItem *item, QString rstName, int idGen) throw(Exception) {
+ static QString fctName = "Dispatcher::connectStimuliItemReset()";
+#ifdef DEBUG_FCTNAME
+ cout << "call to " << qPrintable(fctName) << endl;
+#endif
+ /* NB: only called in Design context */
+ if (context != Design) {
+ cout << "Abnormal case: call to " <<qPrintable(fctName) << " not in Design context" << endl;
+ return;
+ }
+
+ InterfaceItem* fromIfaceItemRst = NULL;
+ InterfaceItem* toIfaceItemRst = item->searchInterfaceItemByName(rstName);
+ BoxItem* clkrstItem = NULL;
+
+ QString genName = "clkrstgen_" + QString::number(idGen);
+ clkrstItem = item->getScene()->searchBoxItemByName(genName);
+ if (clkrstItem == NULL) {
+ throw(Exception(IFACE_TOP_NOCLKRSTGEN));
+ }
+ else {
+ fromIfaceItemRst = clkrstItem->searchInterfaceItemByName("reset");
+ }
+ cout << "connecting reset of " << qPrintable(item->getRefBlock()->getName()) << " to reset of " << qPrintable(genName) << endl;
+
+ if (fromIfaceItemRst == NULL) {
+ throw(Exception(IFACE_GROUP_NOCLKRST));
+ }
+ else {
+ createConnection(context, fromIfaceItemRst, toIfaceItemRst, false);
+ cout << "connection done." << endl;
+ }
+}
+
+