X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/abbc64cf04a35ab3549d5c516f44c7c5921baa63..df84660fd98b39737692d57b68c8b2c2d34af0f1:/FunctionalInterface.cpp diff --git a/FunctionalInterface.cpp b/FunctionalInterface.cpp index cc9f765..2fc093e 100644 --- a/FunctionalInterface.cpp +++ b/FunctionalInterface.cpp @@ -17,11 +17,11 @@ FunctionalInterface::FunctionalInterface(AbstractBlock* _owner, ReferenceInterfa reference = _reference; name = reference->getName(); + endianess = reference->getEndianess(); width = reference->getWidth(); direction = reference->getDirection(); - purpose = reference->getPurpose(); - level = reference->getLevel(); - connectedFrom = NULL; + purpose = reference->getPurpose(); + connectedFrom = NULL; } bool FunctionalInterface::isFunctionalInterface() { @@ -65,10 +65,10 @@ int FunctionalInterface::getInterfaceMultiplicity() { return -1; } else if ( reference->getMultiplicity() == -1) { - return ifaceCount+1; + return ifaceCount; } - else if ( reference->getMultiplicity() > ifaceCount) { - return ifaceCount+1; + else if ( ifaceCount < reference->getMultiplicity()) { + return ifaceCount; } return -1; } @@ -77,12 +77,8 @@ AbstractInterface *FunctionalInterface::clone() { int id = getInterfaceMultiplicity(); if (id < 0) return NULL; FunctionalInterface *inter = new FunctionalInterface(owner, reference); - inter->setWidth(width); - inter->setDirection(direction); - inter->setPurpose(purpose); - inter->setLevel(level); - inter->connectFrom(NULL); - inter->setName(reference->getName()+"_"+QString::number(id)); + inter->setWidth(width); + inter->setName(reference->getName()+"_"+QString::number(id+1)); return inter; } @@ -101,21 +97,27 @@ bool FunctionalInterface::canConnectTo(AbstractInterface *iface) { 2 - iface is owned by the parent group of the block that owns this 2.1 - this is an output, iface is an output of the group 2.2 - both are inout + 3 - this is owned by a source block and iface is owned by the top group */ 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; } + // 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; } + else if ((getOwner()->isSourceBlock()) && (iface->getOwner()->isTopGroupBlock())) { + if ((direction == Output) && (iface->getDirection() == Input)) return true; + } return false;