X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/43fd94117de66d533ef9e58b2de85daa244da309..fc9f5b8b77edda9e49a35d8ef75c4d71caf1c832:/AbstractInterface.cpp diff --git a/AbstractInterface.cpp b/AbstractInterface.cpp index e651f58..bdf342d 100644 --- a/AbstractInterface.cpp +++ b/AbstractInterface.cpp @@ -10,6 +10,7 @@ AbstractInterface::AbstractInterface(AbstractBlock* _owner) { direction = Input; purpose = Data; type = Boolean; + associatedIface = NULL; } @@ -21,6 +22,7 @@ AbstractInterface::AbstractInterface(AbstractBlock* _owner, const QString& _name direction = _direction; purpose = _purpose; type = typeFromString(_type); + associatedIface = NULL; } AbstractInterface::AbstractInterface(AbstractInterface* other) { @@ -30,6 +32,7 @@ AbstractInterface::AbstractInterface(AbstractInterface* other) { width = other->width; direction = other->direction; purpose = other->purpose; + associatedIface = NULL; } AbstractInterface::~AbstractInterface() { @@ -126,14 +129,29 @@ void AbstractInterface::setDirection(int _direction) { } } +bool AbstractInterface::setAssociatedIface(AbstractInterface* iface) { + if (purpose != Control) return false; + if (iface->purpose != Data) return false; + associatedIface = iface; + iface->associatedIface = this; + return true; +} + int AbstractInterface::getIntDirection(QString str) { if(str == "input") return Input; if(str == "output") return Output; - if(str == "inOut") return InOut; + if(str == "inout") return InOut; return -1; } +int AbstractInterface::getIntPurpose(QString str) { + if(str == "data") return Data; + else if(str == "clock") return Clock; + else if(str == "reset") return Reset; + else if(str == "wishbone") return Wishbone; + return -1; +} QString AbstractInterface::getTypeString() { @@ -151,7 +169,7 @@ QString AbstractInterface::getTypeString() { int AbstractInterface::typeFromString(const QString &_type) { - int ret; + int ret = Expression; // default type if (_type == "expression") { ret = Expression; } @@ -161,6 +179,9 @@ int AbstractInterface::typeFromString(const QString &_type) { else if (_type == "natural") { ret = Natural; } + else if (_type == "inherited") { + ret = Inherited; + } return ret; }