X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/abbc64cf04a35ab3549d5c516f44c7c5921baa63..df84660fd98b39737692d57b68c8b2c2d34af0f1:/AbstractInterface.cpp?ds=sidebyside diff --git a/AbstractInterface.cpp b/AbstractInterface.cpp index 25cd2d3..76654ff 100644 --- a/AbstractInterface.cpp +++ b/AbstractInterface.cpp @@ -8,24 +8,23 @@ AbstractInterface::AbstractInterface(AbstractBlock* _owner) { name = ""; width = "1"; direction = Input; - purpose = Data; - level = Basic; + purpose = Data; type = Boolean; + endianess = LittleEndian; + associatedIface = NULL; } -AbstractInterface::AbstractInterface(AbstractBlock* _owner, const QString& _name, const QString& _type, const QString& _width, int _direction, int _purpose, int _level) { +AbstractInterface::AbstractInterface(AbstractBlock* _owner, const QString& _name, int _direction, int _purpose, const QString& _type, const QString& _width, int _endianess) { owner = _owner; name = _name; width = _width; direction = _direction; purpose = _purpose; - level = _level; - if (direction == InOut) { - level = Top; - } type = typeFromString(_type); + endianess = _endianess; + associatedIface = NULL; } AbstractInterface::AbstractInterface(AbstractInterface* other) { @@ -35,7 +34,8 @@ AbstractInterface::AbstractInterface(AbstractInterface* other) { width = other->width; direction = other->direction; purpose = other->purpose; - level = other->level; + endianess = LittleEndian; + associatedIface = NULL; } AbstractInterface::~AbstractInterface() { @@ -54,23 +54,42 @@ bool AbstractInterface::isGroupInterface() { return false; } +QString AbstractInterface::getEndianessString() { + QString str="unknown"; + switch(endianess){ + case AbstractInterface::LittleEndian: + str = QString("little"); + break; + case AbstractInterface::BigEndian: + str = QString("big"); + break; + } + return str; +} + QString AbstractInterface::getPurposeString() { - QString str; - switch(purpose){ - case AbstractInterface::Data: - str = QString("data"); - break; - case AbstractInterface::Clock: - str = QString("clock"); - break; - case AbstractInterface::Reset: - str = QString("reset"); - break; - case AbstractInterface::Wishbone: - str = QString("wishbone"); - break; - } - return str; + QString str; + switch(purpose){ + case AbstractInterface::AnyPurpose: + str = QString("any"); + break; + case AbstractInterface::Data: + str = QString("data"); + break; + case AbstractInterface::Control: + str = QString("control"); + break; + case AbstractInterface::Clock: + str = QString("clock"); + break; + case AbstractInterface::Reset: + str = QString("reset"); + break; + case AbstractInterface::Wishbone: + str = QString("wishbone"); + break; + } + return str; } QString AbstractInterface::getDirectionString() { @@ -89,19 +108,6 @@ QString AbstractInterface::getDirectionString() { return str; } -QString AbstractInterface::getLevelString() { - QString str; - switch(level){ - case AbstractInterface::Basic: - str = QString("basic"); - break; - case AbstractInterface::Top: - str = QString("top"); - break; - } - return str; -} - double AbstractInterface::getDoubleWidth() throw(QException) { static QString fctName = "AbstractInterface::getDoubleWidth()"; @@ -143,34 +149,29 @@ void AbstractInterface::setDirection(int _direction) { if ((_direction > Input) && (_direction <= InOut)) { direction = _direction; } - if (direction == InOut) { - level = Top; - } } -void AbstractInterface::setLevel(int _level) { - if ((_level >= Basic) << (_level < Top)) { - level = _level; - } - if (direction == InOut) { - level = Top; - } +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) -{ +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::getIntLevel(QString str) -{ - if(str == "basic") return Basic; - if(str == "top") return Top; +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; } @@ -190,7 +191,7 @@ QString AbstractInterface::getTypeString() { int AbstractInterface::typeFromString(const QString &_type) { - int ret; + int ret = Expression; // default type if (_type == "expression") { ret = Expression; } @@ -200,6 +201,9 @@ int AbstractInterface::typeFromString(const QString &_type) { else if (_type == "natural") { ret = Natural; } + else if (_type == "inherited") { + ret = Inherited; + } return ret; }