+int FunctionalInterface::getClockDomain() throw(Exception) {\r
+\r
+ int idClock = -1;\r
+\r
+ FunctionalInterface* iface = NULL;\r
+ if (clkIfaceType == ClockName) {\r
+ iface = AI_TO_FUN(getClockIface());\r
+ }\r
+ else if ((direction == Input) && (purpose == Clock)) {\r
+ iface = this;\r
+ }\r
+\r
+ if ( iface != NULL) {\r
+\r
+ // if iface is a functional interface, it is connected to clkrstgen_X (in top group) or to ext_clk_X (in subgroup)\r
+ ConnectedInterface* connFrom = iface->getConnectedFrom();\r
+ if (connFrom == NULL) throw(Exception(IFACE_INVALID_CLKFREQ,this));\r
+\r
+ if (connFrom->getOwner()->isFunctionalBlock()) {\r
+ QString domName = connFrom->getOwner()->getName();\r
+ domName.remove(0,10);\r
+ cout << "conn from clkrstgen: searching for clkdomain in " << qPrintable(domName) << endl;\r
+\r
+ bool ok = true;\r
+ idClock = domName.toInt(&ok);\r
+ cout << "id clock = " << idClock << endl;\r
+ if (!ok) throw(Exception(IFACE_INVALID_CLKFREQ,this));\r
+ }\r
+ else if (connFrom->getOwner()->isGroupBlock()) {\r
+ QString domName = connFrom->getName();\r
+ domName.remove(0,8);\r
+ cout << "conn from group: searching for clkdomain in " << qPrintable(domName) << endl;\r
+\r
+ bool ok = true;\r
+ idClock = domName.toInt(&ok);\r
+ if (!ok) throw(Exception(IFACE_INVALID_CLKFREQ,this));\r
+ }\r
+ else {\r
+ cout << "abnormal case while searching for clkdomain" << endl;\r
+ }\r
+ }\r
+\r
+ return idClock;\r
+}\r
+\r