X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/3bbc311e444c1ef9ac66dd6861fb0acb13ddb72a..df84660fd98b39737692d57b68c8b2c2d34af0f1:/AbstractInterface.cpp?ds=inline diff --git a/AbstractInterface.cpp b/AbstractInterface.cpp index f57f780..76654ff 100644 --- a/AbstractInterface.cpp +++ b/AbstractInterface.cpp @@ -10,11 +10,12 @@ AbstractInterface::AbstractInterface(AbstractBlock* _owner) { direction = Input; 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) { +AbstractInterface::AbstractInterface(AbstractBlock* _owner, const QString& _name, int _direction, int _purpose, const QString& _type, const QString& _width, int _endianess) { owner = _owner; name = _name; @@ -22,6 +23,7 @@ AbstractInterface::AbstractInterface(AbstractBlock* _owner, const QString& _name direction = _direction; purpose = _purpose; type = typeFromString(_type); + endianess = _endianess; associatedIface = NULL; } @@ -32,6 +34,7 @@ AbstractInterface::AbstractInterface(AbstractInterface* other) { width = other->width; direction = other->direction; purpose = other->purpose; + endianess = LittleEndian; associatedIface = NULL; } @@ -51,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() { @@ -141,10 +163,17 @@ bool AbstractInterface::setAssociatedIface(AbstractInterface* iface) { 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() { @@ -162,7 +191,7 @@ QString AbstractInterface::getTypeString() { int AbstractInterface::typeFromString(const QString &_type) { - int ret; + int ret = Expression; // default type if (_type == "expression") { ret = Expression; }