X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/6e2b3026c6a496e81642c373796bd39dad33d2a6..a13795fc34cd1e74f94695d35253c3d00abec9bc:/GroupInterface.cpp?ds=inline diff --git a/GroupInterface.cpp b/GroupInterface.cpp index c611ecf..bfeb1ff 100644 --- a/GroupInterface.cpp +++ b/GroupInterface.cpp @@ -70,17 +70,17 @@ bool GroupInterface::canConnectTo(AbstractInterface *iface) { if (connIface->getConnectedFrom() != NULL) return false; if (this->getOwner() == iface->getOwner()->getParent()) { - if ((direction == Input) && (iface->getDirection() == Input)) return true; - if ((direction == InOut) && (iface->getDirection() == InOut)) return true; + if ((direction == Input) && (iface->getDirection() == Input) && (purpose == iface->getPurpose())) return true; + if ((direction == InOut) && (iface->getDirection() == InOut) && (purpose == iface->getPurpose())) return true; } else if (this->getOwner()->getParent() == iface->getOwner()->getParent()) { - if ((direction == Output) && (iface->getDirection() == Input)) return true; - if ((direction == InOut) && (iface->getDirection() == InOut)) return true; + if ((direction == Output) && (iface->getDirection() == Input) && (purpose == iface->getPurpose())) return true; + if ((direction == InOut) && (iface->getDirection() == InOut) && (purpose == iface->getPurpose())) return true; } else if (this->getOwner()->getParent() == iface->getOwner()) { - if ((direction == Output) && (iface->getDirection() == Output)) return true; - if ((direction == InOut) && (iface->getDirection() == InOut)) return true; + if ((direction == Output) && (iface->getDirection() == Output) && (purpose == iface->getPurpose())) return true; + if ((direction == InOut) && (iface->getDirection() == InOut) && (purpose == iface->getPurpose())) return true; } @@ -110,25 +110,51 @@ bool GroupInterface::canConnectFrom(AbstractInterface *iface) { if (getConnectedFrom() != NULL) return false; if (this->getOwner() == iface->getOwner()->getParent()) { - if ((direction == Output) && (iface->getDirection() == Output)) return true; - if ((direction == InOut) && (iface->getDirection() == InOut)) return true; + if ((direction == Output) && (iface->getDirection() == Output) && (purpose == iface->getPurpose())) return true; + if ((direction == InOut) && (iface->getDirection() == InOut) && (purpose == iface->getPurpose())) return true; } else if (this->getOwner()->getParent() == iface->getOwner()->getParent()) { - if ((direction == Input) && (iface->getDirection() == Output)) return true; - if ((direction == InOut) && (iface->getDirection() == InOut)) return true; + if ((direction == Input) && (iface->getDirection() == Output) && (purpose == iface->getPurpose())) return true; + if ((direction == InOut) && (iface->getDirection() == InOut) && (purpose == iface->getPurpose())) return true; } else if (this->getOwner()->getParent() == iface->getOwner()) { - if ((direction == Input) && (iface->getDirection() == Input)) return true; - if ((direction == InOut) && (iface->getDirection() == InOut)) return true; + if ((direction == Input) && (iface->getDirection() == Input) && (purpose == iface->getPurpose())) return true; + if ((direction == InOut) && (iface->getDirection() == InOut) && (purpose == iface->getPurpose())) return true; } - else if ((getOwner()->isTopGroupBlock()) && (iface->getOwner()->isSourceBlock())) { - if ((direction == Input) && (iface->getDirection() == Output)) return true; + else if ((getOwner()->isTopGroupBlock()) && (iface->getOwner()->isStimuliBlock())) { + if ((direction == Input) && (iface->getDirection() == Output) && (purpose == iface->getPurpose())) return true; } return false; } +int GroupInterface::getClockDomain() throw(Exception) { + + int idClock = -1; + + GroupInterface* iface = NULL; + if (clkIfaceType == ClockName) { + iface = AI_TO_GRP(getClockIface()); + } + else if ((direction == Input) && (purpose == Clock)) { + iface = this; + } + + if ( iface != NULL) { + + QString name = iface->getName(); + name.remove(0,8); + bool ok; + idClock = name.toInt(&ok); + if (!ok) throw(Exception(IFACE_INVALID_CLKFREQ,this)); + + } + + return idClock; +} + + void GroupInterface::connectionsValidation(QStack *interfacetoValidate, QList *validatedInterfaces) throw(Exception) { cout << "group interface connection validation" << endl; }