name = "";
width = "1";
direction = Input;
- purpose = Data;
- level = Basic;
+ purpose = Data;
type = Boolean;
}
-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, const QString& _type, const QString& _width, int _direction, int _purpose) {
owner = _owner;
name = _name;
width = _width;
direction = _direction;
purpose = _purpose;
- level = _level;
- if (direction == InOut) {
- level = Top;
- }
type = typeFromString(_type);
}
width = other->width;
direction = other->direction;
purpose = other->purpose;
- level = other->level;
}
AbstractInterface::~AbstractInterface() {
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()";
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;
- }
}
-
-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;
return -1;
}
-int AbstractInterface::getIntLevel(QString str)
-{
- if(str == "basic") return Basic;
- if(str == "top") return Top;
- return -1;
-}
QString AbstractInterface::getTypeString() {
enum IfaceWidthType { Expression = 1, Boolean, Natural};
enum IfacePurpose { Data = 1, Clock = 2, Reset = 3, Wishbone = 4 };
- enum IfaceDirection { Input = 1, Output = 2, InOut = 3 };
- enum IfaceLevel { Basic = 1, Top = 2 };
+ enum IfaceDirection { Input = 1, Output = 2, InOut = 3 };
enum IfaceVHDLContext { Entity = 1, Component = 2, Architecture = 3 }; // NB : 3 is when creating an instance of the block that owns this iface
enum IfaceVHDLFlags { NoComma = 1 };
- static int getIntDirection(QString str);
- static int getIntLevel(QString str);
+ static int getIntDirection(QString str);
AbstractInterface(AbstractBlock* _owner);
- AbstractInterface(AbstractBlock* _owner, const QString& _name, const QString& _type, const QString& _width, int _direction, int _purpose, int _level);
+ AbstractInterface(AbstractBlock* _owner, const QString& _name, const QString& _type, const QString& _width, int _direction, int _purpose);
AbstractInterface(AbstractInterface* other);
virtual ~AbstractInterface();
inline int getPurpose() { return purpose;}
QString getPurposeString();
inline int getDirection() { return direction;}
- QString getDirectionString();
- inline int getLevel() { return level;}
- QString getLevelString();
+ QString getDirectionString();
inline AbstractBlock *getOwner() { return owner;}
double getDoubleWidth() throw(QException);
inline void setType(int _type) { type = _type;}
inline void setType(const QString& _type) { type = typeFromString(_type);}
void setPurpose(int _purpose);
- void setDirection(int _direction);
- void setLevel(int _level);
+ void setDirection(int _direction);
// testers
virtual bool isReferenceInterface();
QString width;
int purpose;
int direction;
- int level;
AbstractBlock* owner;
};
connectedFrom = NULL;\r
}\r
\r
-ConnectedInterface::ConnectedInterface(AbstractBlock* _owner, const QString& _name, const QString& _type, const QString& _width, int _direction, int _purpose, int _level) : AbstractInterface(_owner, _name, _type, _width, _direction, _purpose, _level) {\r
+ConnectedInterface::ConnectedInterface(AbstractBlock* _owner, const QString& _name, const QString& _type, const QString& _width, int _direction, int _purpose) : AbstractInterface(_owner, _name, _type, _width, _direction, _purpose) {\r
connectedFrom = NULL;\r
}\r
\r
public :
ConnectedInterface(AbstractBlock* _owner);
- ConnectedInterface(AbstractBlock* _owner, const QString& _name, const QString& _type, const QString& _width, int _direction, int _purpose, int _level);
+ ConnectedInterface(AbstractBlock* _owner, const QString& _name, const QString& _type, const QString& _width, int _direction, int _purpose);
// getters
inline QList<ConnectedInterface*> getConnectedTo() { return connectedTo;}
inline ConnectedInterface* getConnectedFrom() { return connectedFrom;}
GroupItem *parentItem = item->getOwner()->getScene()->getGroupItem();
// creating/adding the group interface in the graph model
- GroupInterface *groupInter = new GroupInterface(parentBlock,refInter->getName()+"_group",refInter->getDirection(),refInter->getLevel());
+ GroupInterface *groupInter = new GroupInterface(parentBlock,refInter->getName()+"_group",refInter->getDirection());
groupInter->setType(refInter->getType());
groupInter->setWidth(refInter->getWidth());
groupInter->setPurpose(refInter->getPurpose());
name = reference->getName();\r
width = reference->getWidth();\r
direction = reference->getDirection();\r
- purpose = reference->getPurpose();\r
- level = reference->getLevel(); \r
+ purpose = reference->getPurpose(); \r
connectedFrom = NULL;\r
}\r
\r
FunctionalInterface *inter = new FunctionalInterface(owner, reference);\r
inter->setWidth(width);\r
inter->setDirection(direction);\r
- inter->setPurpose(purpose);\r
- inter->setLevel(level); \r
+ inter->setPurpose(purpose); \r
inter->connectFrom(NULL);\r
inter->setName(reference->getName()+"_"+QString::number(id+1));\r
return inter;\r
#include "FunctionalInterface.h"
#include "GroupBlock.h"
-GroupInterface::GroupInterface(AbstractBlock* _owner, const QString& _name, int _direction, int _level) throw(Exception) : ConnectedInterface(_owner,_name,"expression","",_direction,AbstractInterface::Data,_level) {
+GroupInterface::GroupInterface(AbstractBlock* _owner, const QString& _name, int _direction) throw(Exception) : ConnectedInterface(_owner,_name,"expression","",_direction,AbstractInterface::Data) {
if (! _owner->isGroupBlock()) throw(Exception(BLOCK_INVALID_TYPE));
- /* If the owner group is the top group, then all its interfaces are at top level => force them to be top.
- If not, force them to be basic
- */
- if (((GroupBlock*)_owner)->isTop()) {
- level = AbstractInterface::Top;
- }
- else {
- level = AbstractInterface::Basic;
- }
connectedFrom = NULL;
}
}
AbstractInterface *GroupInterface::clone() {
- GroupInterface *inter = new GroupInterface(owner,name,direction,level);
+ GroupInterface *inter = new GroupInterface(owner,name,direction);
inter->setWidth(width);
inter->setDirection(direction);
- inter->setPurpose(purpose);
- inter->setLevel(level);
+ inter->setPurpose(purpose);
inter->connectFrom(NULL);
return inter;
class GroupInterface : public ConnectedInterface {
public :
- GroupInterface(AbstractBlock* _owner, const QString& _name, int _direction, int _level = AbstractInterface::Basic) throw (Exception);
+ GroupInterface(AbstractBlock* _owner, const QString& _name, int _direction) throw (Exception);
// getters
QString name = currentInterfaceNode.attribute("name","none");
if(name == "none") throw(Exception(PROJECTFILE_CORRUPTED));
- QString levelStr = currentInterfaceNode.attribute("level","none");
- int level = AbstractInterface::getIntLevel(levelStr);
- if(level == -1) throw(Exception(PROJECTFILE_CORRUPTED));
-
QString directionStr = currentInterfaceNode.attribute("direction","none");
int direction = AbstractInterface::getIntDirection(directionStr);
if(direction == -1) throw(Exception(PROJECTFILE_CORRUPTED));
double position = currentInterfaceNode.attribute("position","none").toDouble(&ok);
if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));
- GroupInterface *groupInterface = new GroupInterface(groupBlock,name,direction,level);
+ GroupInterface *groupInterface = new GroupInterface(groupBlock,name,direction);
InterfaceItem *interfaceItem = new InterfaceItem(position,orientation,groupInterface,this,params);
interfaceItem->setId(id);
writer.writeStartElement("group_iface");
writer.writeAttribute("id",QString::number(item->getId()));
- writer.writeAttribute("name",item->getName());
- writer.writeAttribute("level",QString(item->refInter->getLevelString()));
+ writer.writeAttribute("name",item->getName());
writer.writeAttribute("direction",QString(item->refInter->getDirectionString()));
writer.writeAttribute("orientation",item->getStrOrientation());
writer.writeAttribute("position",QString::number(item->getPositionRatio()));
if(selected) {
painter->setPen(QPen(Qt::red,2));
- }
- else if(refInter->getLevel() == AbstractInterface::Basic) {
- painter->setPen(QPen(Qt::darkCyan,1));
- }
- else if(refInter->getLevel() == AbstractInterface::Top) {
+ }
+ else {
painter->setPen(QPen(Qt::black,1));
}
layout->addWidget(new QLabel("Direction :"), 4, 0);
layout->addWidget(new QLabel(inter->refInter->getDirectionString()), 4, 1);
layout->addWidget(new QLabel("Purpose :"), 5, 0);
- layout->addWidget(new QLabel(inter->refInter->getPurposeString()), 5, 1);
- layout->addWidget(new QLabel("Level :"), 6, 0);
- layout->addWidget(new QLabel(inter->refInter->getLevelString()), 6, 1);
-
+ layout->addWidget(new QLabel(inter->refInter->getPurposeString()), 5, 1);
this->setLayout(layout);
show();
QString widthStr;
QString purposeStr;
int purpose;
- QString levelStr;
- int level;
QString multStr;
int mult;
AbstractInterface* inter;
cout << "purpose for " << nameStr.toStdString() << " : " << purposeStr.toStdString() << endl;
purpose = ReferenceInterface::translatePurpose(purposeStr);
cout << "translated purpose : " << purpose << endl;
- levelStr = eltInput.attribute("level","none");
- level = ReferenceInterface::translateLevel(levelStr);
multStr = eltInput.attribute("multiplicity","none");
mult = ReferenceInterface::translateMultiplicity(multStr);
- inter = new ReferenceInterface(this,nameStr,typeStr,widthStr,AbstractInterface::Input, purpose, level, mult);
+ inter = new ReferenceInterface(this,nameStr,typeStr,widthStr,AbstractInterface::Input, purpose, mult);
inputs.append(inter);
}
widthStr = eltOutput.attribute("width","none");
purposeStr = eltOutput.attribute("type","none");
purpose = ReferenceInterface::translatePurpose(purposeStr);
- levelStr = eltOutput.attribute("level","none");
- level = ReferenceInterface::translateLevel(levelStr);
multStr = eltOutput.attribute("multiplicity","none");
mult = ReferenceInterface::translateMultiplicity(multStr);
- inter = new ReferenceInterface(this,nameStr,typeStr,widthStr,AbstractInterface::Output, purpose, level, mult);
+ inter = new ReferenceInterface(this,nameStr,typeStr,widthStr,AbstractInterface::Output, purpose, mult);
outputs.append(inter);
}
widthStr = eltBidir.attribute("width","none");
purposeStr = eltBidir.attribute("type","none");
purpose = ReferenceInterface::translatePurpose(purposeStr);
- levelStr = eltBidir.attribute("level","none");
- level = ReferenceInterface::translateLevel(levelStr);
multStr = eltBidir.attribute("multiplicity","none");
mult = ReferenceInterface::translateMultiplicity(multStr);
- inter = new ReferenceInterface(this,nameStr,typeStr,widthStr,AbstractInterface::InOut, purpose, level, mult);
+ inter = new ReferenceInterface(this,nameStr,typeStr,widthStr,AbstractInterface::InOut, purpose, mult);
bidirs.append(inter);
}
}
toWrite << iface->getName();
toWrite << iface->getWidth();
toWrite << iface->getPurpose();
- toWrite << iface->getDirection();
- toWrite << iface->getLevel();
+ toWrite << iface->getDirection();
toWrite << iface->getMultiplicity();
}
toWrite << b.outputs.size();
toWrite << iface->getName();
toWrite << iface->getWidth();
toWrite << iface->getPurpose();
- toWrite << iface->getDirection();
- toWrite << iface->getLevel();
+ toWrite << iface->getDirection();
toWrite << iface->getMultiplicity();
}
toWrite << b.bidirs.size();
toWrite << iface->getName();
toWrite << iface->getWidth();
toWrite << iface->getPurpose();
- toWrite << iface->getDirection();
- toWrite << iface->getLevel();
+ toWrite << iface->getDirection();
toWrite << iface->getMultiplicity();
}
in >> val;
iface->setPurpose(val);
in >> val;
- iface->setDirection(val);
- in >> val;
- iface->setLevel(val);
+ iface->setDirection(val);
in >> val;
iface->setMultiplicity(val);
b.inputs.append(iface);
iface->setPurpose(val);
in >> val;
iface->setDirection(val);
- in >> val;
- iface->setLevel(val);
- in >> val;
+ in >> val;
iface->setMultiplicity(val);
b.outputs.append(iface);
}
iface->setPurpose(val);
in >> val;
iface->setDirection(val);
- in >> val;
- iface->setLevel(val);
- in >> val;
+ in >> val;
iface->setMultiplicity(val);
b.bidirs.append(iface);
}
const QString& _width,
int _direction,
int _purpose,
- int _level,
int _multiplicity)
-throw (Exception) : AbstractInterface(_owner, _name, _type, _width, _direction, _purpose, _level) {
+throw (Exception) : AbstractInterface(_owner, _name, _type, _width, _direction, _purpose) {
if (_owner->isReferenceBlock()) throw(Exception(BLOCK_INVALID_TYPE));
return Data;
}
-int ReferenceInterface::translateLevel(const QString& txt) {
-
- if (txt == "top") {
- return Top;
- }
- return Basic;
-}
-
int ReferenceInterface::translateMultiplicity(const QString& txt) {
bool ok;
int mult;
public :
ReferenceInterface(AbstractBlock *_owner) throw(Exception);
- ReferenceInterface(AbstractBlock* _owner, const QString& _name, const QString& _type, const QString& _width, int _direction, int _purpose, int _level, int _multiplicity=1) throw (Exception);
+ ReferenceInterface(AbstractBlock* _owner, const QString& _name, const QString& _type, const QString& _width, int _direction, int _purpose, int _multiplicity=1) throw (Exception);
// getters
inline int getMultiplicity() { return multiplicity; }
// others
- static int translatePurpose(const QString& txt);
- static int translateLevel(const QString& txt);
+ static int translatePurpose(const QString& txt);
static int translateMultiplicity(const QString& txt);
inline AbstractInterface *clone(){ return NULL; }
<category name="user" id="5" parent="0"/>
</categories>
- <references nb="2" lib_file="/home/sdomas/Projet/Blast/code/v0.2/lib/references/references.bmf" >
- <reference_lib path="/home/sdomas/Projet/Blast/code/v0.2/" />
- <reference_lib path="/home/sdomas/Projet/Blast/code/v0.2/lib/references" />
+ <references nb="2" lib_file="/home/sdomas/Projet/Blast/code/blast/lib/references/references.bmf" >
+ <reference_lib path="/home/sdomas/Projet/Blast/code/blast/" />
+ <reference_lib path="/home/sdomas/Projet/Blast/code/blast/lib/references" />
</references>
- <implementations nb="1" lib_file="/home/sdomas/Projet/Blast/code/v0.2/lib/implementations/impls.bmf" >
- <impl_lib path="/home/sdomas/Projet/Blast/code/v0.2/lib/implementations" />
+ <implementations nb="1" lib_file="/home/sdomas/Projet/Blast/code/blast/lib/implementations/impls.bmf" >
+ <impl_lib path="/home/sdomas/Projet/Blast/code/blast/lib/implementations" />
</implementations>
<defaults>
<xs:attribute ref="name" use="required"/>
<xs:attribute ref="width" use="required"/>
<xs:attribute ref="type"/>
- <xs:attribute ref="level"/>
<xs:attribute ref="purpose"/>
<xs:attribute ref="multiplicity"/>
</xs:attributeGroup>
<xs:attribute name="core" type="xs:string"/>
<xs:attribute name="wishbone" type="xs:string"/>
<xs:attribute name="context" type="xs:string" />
- <xs:attribute name="level" type="xs:string" />
<xs:attribute name="multiplicity" type="xs:string" />
<xs:attribute name="width" type="xs:string"/>
<xs:attribute name="purpose" type="xs:string"/>
- name : required
- width : required
- purpose : optional. Possible values : clock, reset, wb, data, ... Default value is data
- - level : optional. Possible values : basic, top, ... Default value is basic
- multiplicity : optional. Possible values : *, a number. Default value is 1.
<bidirs> attributes :
- name : required
- width : required
- purpose : optional but forced to data
- - level : optional but forced to top
- multiplicity : optional. Possible values : *, a number. Default value is 1.
If an interface has a multiplicity > 1, the user will be able to create several
instances of that interface. Their default name will be the reference name
<input name="clk" type="boolean" width="1" purpose="clock" />
<input name="rst" type="boolean" width="1" purpose="reset" />
- <input name="imx_addr" type="expression" width="$wb_addr_width" level="top"/>
- <input name="imx_cs_n" type="boolean" width="1" level="top"/>
- <input name="imx_oe_n" type="boolean" width="1" level="top"/>
- <input name="imx_eb3_n" type="boolean" width="1" level="top"/>
+ <input name="imx_addr" type="expression" width="$wb_addr_width" />
+ <input name="imx_cs_n" type="boolean" width="1" />
+ <input name="imx_oe_n" type="boolean" width="1" />
+ <input name="imx_eb3_n" type="boolean" width="1" />
<input name="ack_i" type="boolean" width="1" purpose="wb" />
<input name="dat_i" width="$wb_data_width" purpose="wb" />
<output name="we_o" type="boolean" width="1" purpose="wb" />
</outputs>
<bidirs>
- <bidir name="imx_data" width="$wb_data_width" level="top"/>
+ <bidir name="imx_data" width="$wb_data_width"/>
</bidirs>
</interfaces>
<input name="clk" type="boolean" width="1" purpose="clock" />\r
<input name="rst" type="boolean" width="1" purpose="reset" />\r
\r
- <input name="val_i" type="expression" width="$val_width" level="top"/>\r
+ <input name="val_i" type="expression" width="$val_width" />\r
<input name="sel_i" type="expression" width="$sel_width" />\r
</inputs>\r
<outputs>\r
<xs:attributeGroup name="group_ifaceAttrGroup">
<xs:attribute ref="id"/>
<xs:attribute ref="name"/>
- <xs:attribute ref="level"/>
<xs:attribute ref="direction"/>
<xs:attribute ref="orientation"/>
<xs:attribute ref="position"/>
<xs:attribute name="position" type="xs:string"/>
<xs:attribute name="dimension" type="xs:string"/>
- <xs:attribute name="level" type="xs:string"/>
<xs:attribute name="direction" type="xs:string"/>
<xs:attribute name="orientation" type="xs:string"/>
<xs:attribute name="name" type="xs:string"/>
\r
<group_item id="1" name="top" upper_group="-1" upper_item="-1" position="20,30" dimension="800,600">\r
<group_ifaces count="4">\r
- <group_iface id="1" name="in_1" level="top" direction="input" orientation="west" position="0.3" />\r
- <group_iface id="2" name="in_2" level="top" direction="input" orientation="west" position="0.6" />\r
- <group_iface id="3" name="out_1" level="top" direction="output" orientation="south" position="0.5" />\r
- <group_iface id="4" name="out_2" level="top" direction="output" orientation="east" position="0.5" />\r
+ <group_iface id="1" name="in_1" direction="input" orientation="west" position="0.3" />\r
+ <group_iface id="2" name="in_2" direction="input" orientation="west" position="0.6" />\r
+ <group_iface id="3" name="out_1" direction="output" orientation="south" position="0.5" />\r
+ <group_iface id="4" name="out_2" direction="output" orientation="east" position="0.5" />\r
</group_ifaces>\r
</group_item>\r
\r
\r
<group_item id="4" upper_group="1" upper_item="3" name="subgroup_1" position="20,30" dimension="400,400">\r
<group_ifaces count="4">\r
- <group_iface id="11" name="in_1" level="basic" direction="input" orientation="west" position="0.3" />\r
- <group_iface id="12" name="in_2" level="basic" direction="input" orientation="west" position="0.6" />\r
- <group_iface id="13" name="out_1" level="basic" direction="output" orientation="east" position="0.3" />\r
- <group_iface id="14" name="out_2" level="basic" direction="output" orientation="east" position="0.6" />\r
+ <group_iface id="11" name="in_1" direction="input" orientation="west" position="0.3" />\r
+ <group_iface id="12" name="in_2" direction="input" orientation="west" position="0.6" />\r
+ <group_iface id="13" name="out_1" direction="output" orientation="east" position="0.3" />\r
+ <group_iface id="14" name="out_2" direction="output" orientation="east" position="0.6" />\r
</group_ifaces>\r
</group_item>\r
\r