X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/43fd94117de66d533ef9e58b2de85daa244da309..2019e5afdaf7fd0ad21607848710348bbc3be256:/AbstractInterface.cpp diff --git a/AbstractInterface.cpp b/AbstractInterface.cpp index e651f58..49a937c 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() { @@ -161,6 +179,9 @@ int AbstractInterface::typeFromString(const QString &_type) { else if (_type == "natural") { ret = Natural; } + else if (_type == "inherited") { + ret = Inherited; + } return ret; }