X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/3bbc311e444c1ef9ac66dd6861fb0acb13ddb72a..3bcfe4df6fdde086eb1b59f7a0173358170174a1:/FunctionalInterface.cpp diff --git a/FunctionalInterface.cpp b/FunctionalInterface.cpp index 495d60e..eec7ea8 100644 --- a/FunctionalInterface.cpp +++ b/FunctionalInterface.cpp @@ -17,7 +17,9 @@ FunctionalInterface::FunctionalInterface(AbstractBlock* _owner, ReferenceInterfa reference = _reference; name = reference->getName(); - width = reference->getWidth(); + type = reference->getType(); + endianess = reference->getEndianess(); + width = reference->getWidthString(); direction = reference->getDirection(); purpose = reference->getPurpose(); connectedFrom = NULL; @@ -101,20 +103,21 @@ bool FunctionalInterface::canConnectTo(AbstractInterface *iface) { */ if (direction == Input) return false; if (iface->isReferenceInterface()) return false; - if (iface->getConnectedFrom() != NULL) return false; + ConnectedInterface* connIface = AI_TO_CON(iface); + if (connIface->getConnectedFrom() != NULL) return false; // first case: interface of blocks within the same group if (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; } // second case: iface = interface of the group that contains owner of this else if (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; } else if ((getOwner()->isSourceBlock()) && (iface->getOwner()->isTopGroupBlock())) { - if ((direction == Output) && (iface->getDirection() == Input)) return true; + if ((direction == Output) && (iface->getDirection() == Input) && (purpose == iface->getPurpose())) return true; } return false; @@ -143,12 +146,12 @@ bool FunctionalInterface::canConnectFrom(AbstractInterface *iface) { if (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 (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; } return false;