X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/bc5d59217a24b25c1b913bec4a41dd026d02720c..HEAD:/AbstractInterface.cpp diff --git a/AbstractInterface.cpp b/AbstractInterface.cpp index 3fdd87a..83aa4c3 100644 --- a/AbstractInterface.cpp +++ b/AbstractInterface.cpp @@ -14,8 +14,8 @@ AbstractInterface::AbstractInterface(AbstractBlock* _owner) { type = Boolean; endianess = LittleEndian; associatedIface = NULL; - clkIface = ""; - clkIfaceType = 0; + clkIfaceName = ""; + clkIfaceType = NoName; } @@ -29,8 +29,8 @@ AbstractInterface::AbstractInterface(AbstractBlock* _owner, const QString& _name type = typeFromString(_type); endianess = _endianess; associatedIface = NULL; - clkIface = ""; - clkIfaceType = 0; + clkIfaceName = ""; + clkIfaceType = NoName; } AbstractInterface::AbstractInterface(AbstractInterface* other) { @@ -42,7 +42,7 @@ AbstractInterface::AbstractInterface(AbstractInterface* other) { purpose = other->purpose; endianess = LittleEndian; associatedIface = NULL; - clkIface = other->clkIface; + clkIfaceName = other->clkIfaceName; clkIfaceType = other->clkIfaceType; } @@ -216,7 +216,7 @@ bool AbstractInterface::setAssociatedIface(AbstractInterface* iface) { AbstractInterface* AbstractInterface::getClockIface() { if (clkIfaceType == ClockName) { - return owner->getIfaceFromName(clkIface); + return owner->getIfaceFromName(clkIfaceName); } return NULL; } @@ -227,7 +227,7 @@ double AbstractInterface::getClockFrequency() throw(Exception) { int idClock = -1; if (clkIfaceType == ParameterName) { - BlockParameter* param = owner->getParameterFromName(clkIface); + BlockParameter* param = owner->getParameterFromName(clkIfaceName); if (!param->isUserParameter()) throw(Exception(IFACE_INVALID_CLKFREQ,this)); bool ok; double freq = param->getDoubleValue(&ok); @@ -247,46 +247,6 @@ double AbstractInterface::getClockFrequency() throw(Exception) { } -bool AbstractInterface::setClockIface(QString name) { - /* 2 cases : - * - this is a Data interface - * - this is a Clock output (from a clkrstgen) - * - * iface must correspond to an existing clock interface name - * or a user parameter prepend with a $. - */ - if ((purpose == Data) || ((purpose == Clock) && (direction == Output))) { - if (name.at(0) == '$') { - name.remove(0,1); - QList params = owner->getUserParameters(); - foreach(BlockParameter* p, params) { - if (p->getName() == name) { - clkIface = name; - clkIfaceType = ParameterName; - return true; - } - } - // error case: cannot found the input clock - return false; - } - else { - QList clocks = owner->getInterfaces(Input, Clock); - foreach(AbstractInterface* iface, clocks) { - if (iface->getName() == name) { - clkIface = name; - clkIfaceType = ClockName; - return true; - } - } - // error case: cannot found the user paramter - return false; - } - } - clkIface = ""; - clkIfaceType = NoName; - return true; -} - int AbstractInterface::getIntDirection(QString str) { if(str == "input") return Input; @@ -351,7 +311,10 @@ QString AbstractInterface::toVHDL(IfaceVHDLContext context, int flags) throw(Exc //cout << "iface " << qPrintable(name) << " must be evaluated to vhdl :" << qPrintable(width) << " with type = " << qPrintable(getTypeString()) << endl; if (context == Instance) { - if (direction == Output) { + if (direction == Input) { + ret = owner->getName()+"_"+name; + } + else if (direction == Output) { ret = "from_"+owner->getName()+"_"+name; } else if (direction == InOut) {