X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/3fb762e7042d9b4a1cf78556ad9ed7f117cc53ba..a13795fc34cd1e74f94695d35253c3d00abec9bc:/FunctionalInterface.cpp?ds=inline diff --git a/FunctionalInterface.cpp b/FunctionalInterface.cpp index c0b63af..7d1217a 100644 --- a/FunctionalInterface.cpp +++ b/FunctionalInterface.cpp @@ -5,7 +5,6 @@ #include "FunctionalBlock.h" #include "GroupBlock.h" - FunctionalInterface::FunctionalInterface(AbstractBlock* _owner, ReferenceInterface *_reference) throw(Exception) : ConnectedInterface(_owner) { if (_owner == NULL) throw(Exception(BLOCK_NULL)); @@ -157,6 +156,45 @@ bool FunctionalInterface::canConnectFrom(AbstractInterface *iface) { return false; } +int FunctionalInterface::getClockDomain() throw(Exception) { + + int idClock = -1; + + FunctionalInterface* iface = NULL; + if (clkIfaceType == ClockName) { + iface = AI_TO_FUN(getClockIface()); + } + else if ((direction == Input) && (purpose == Clock)) { + iface = this; + } + + if ( iface != NULL) { + + // if iface is a functional interface, it is connected to clkrstgen_X (in top group) or to ext_clk_X (in subgroup) + ConnectedInterface* connFrom = iface->getConnectedFrom(); + if (connFrom == NULL) throw(Exception(IFACE_INVALID_CLKFREQ,this)); + + if (connFrom->getOwner()->isFunctionalBlock()) { + QString name = connFrom->getOwner()->getName(); + cout << "conn from clkrstgen: searching for clkdomain in " << qPrintable(name) << endl; + name.remove(0,10); + bool ok; + idClock = name.toInt(&ok); + if (!ok) throw(Exception(IFACE_INVALID_CLKFREQ,this)); + } + else { + QString name = connFrom->getName(); + cout << "conn from group: searching for clkdomain in " << qPrintable(name) << endl; + name.remove(0,8); + bool ok; + idClock = name.toInt(&ok); + if (!ok) throw(Exception(IFACE_INVALID_CLKFREQ,this)); + } + } + + return idClock; +} + void FunctionalInterface::connectionsValidation(QStack *interfacetoValidate, QList *validatedInterfaces) throw(Exception) {