}\r
\r
AbstractBlock::AbstractBlock(const QString& _name) {\r
- name = _name;\r
+ name = normalizeName(_name);\r
parent = NULL;\r
}\r
\r
}\r
\r
void AbstractBlock::setName(const QString& str) {\r
- name = str;\r
+ name = normalizeName(str);\r
}\r
\r
void AbstractBlock::setParent(AbstractBlock* _parent) {\r
return lst;\r
}\r
\r
+QString AbstractBlock::normalizeName(const QString &name) {\r
+ QString s = name;\r
+ s.replace(QRegularExpression("[^a-zA-Z0-9_]"),"_");\r
+ s.replace(QRegularExpression("[_]+"),"_");\r
+ return s;\r
+}\r
+\r
+\r
bool isWBConfigurable();\r
\r
// others\r
+ static QString normalizeName(const QString& name);\r
+\r
virtual void parametersValidation(QList<AbstractBlock*>* checkedBlocks, QList<AbstractBlock*>* blocksToConfigure) = 0; // ugly but usefull \r
\r
void addParameter(BlockParameter *param);\r
\r
// NB: only GroupBlock and FunctionalBlock have a real parent, except sources that have no parents\r
AbstractBlock* parent;\r
+\r
+\r
};\r
\r
#endif // __ABSTRACTBLOCK_H__\r
#include "AbstractInputModifier.h"\r
\r
-AbstractInputModifier::AbstractInputModifier() {\r
+AbstractInputModifier::AbstractInputModifier(ConnectedInterface *_associatedIface) {\r
\r
pattern = new QList<char>();\r
+ associatedIface = _associatedIface;\r
}\r
\r
AbstractInputModifier::~AbstractInputModifier() {\r
\r
#include <QtCore>\r
\r
+#include "Exception.h"\r
+\r
+class ConnectedInterface;\r
+\r
using namespace std;\r
using namespace Qt;\r
\r
class AbstractInputModifier {\r
\r
-public: \r
+public:\r
+\r
+ enum ModifierVHDLContext {AnyContext = 0, Entity = 1, Component = 2, Architecture = 3 };\r
+ enum ModifierVHDLFlags { NoComma = 1 };\r
\r
- AbstractInputModifier();\r
+ AbstractInputModifier(ConnectedInterface* _associatedIface);\r
virtual ~AbstractInputModifier();\r
\r
//getters\r
\r
// others\r
virtual QList<char>* getModifiedInput(QList<char>* input) = 0;\r
+ virtual QString toVHDL(int context, int flags) throw(Exception) = 0;\r
\r
protected:\r
QList<char>* pattern; // the pattern modified by this\r
+ ConnectedInterface* associatedIface;\r
};\r
\r
#endif // __ABSTRACTINPUTMODIFIER_H__\r
AbstractInterface::AbstractInterface(AbstractBlock* _owner, const QString& _name, int _direction, int _purpose, const QString& _type, const QString& _width, int _endianess) {
owner = _owner;
- name = _name;
+ name = AbstractBlock::normalizeName(_name);
width = _width;
direction = _direction;
purpose = _purpose;
AbstractInterface::AbstractInterface(AbstractInterface* other) {
owner = NULL;
- name = other->name;
+ name = AbstractBlock::normalizeName(other->name);
type = other->type;
width = other->width;
direction = other->direction;
associatedIface = NULL;
}
+void AbstractInterface::setName(const QString& _name) {
+ name = AbstractBlock::normalizeName(_name);
+}
+
AbstractInterface::~AbstractInterface() {
}
// setters
inline void setOwner(AbstractBlock* _owner) { owner = _owner; }
- inline void setName(const QString& _name) { name = _name; }
+ void setName(const QString& _name);
inline void setWidth(const QString& _width) { width = _width; }
inline void setType(int _type) { type = _type;}
inline void setEndianess(int _endianess) { endianess = _endianess;}
return childs;\r
}\r
\r
-ReferenceBlock *BlockCategory::getBlock(int index) {\r
+ReferenceBlock *BlockCategory::getBlockById(int index) {\r
if ((index >=0) && (index < blocks.size()) ) {\r
return blocks.at(index);\r
}\r
return NULL;\r
}\r
\r
+ReferenceBlock *BlockCategory::getBlockByName(QString name) {\r
+ foreach(ReferenceBlock* block, blocks) {\r
+ if (block->getName() == name) return block;\r
+ }\r
+ cout << "block null!" << endl;\r
+ return NULL;\r
+}\r
+\r
QDomElement BlockCategory::save(QDomDocument &doc) {\r
}\r
\r
BlockCategory* getChild(int index);\r
QList<BlockCategory *> getAllChilds();\r
inline QList<ReferenceBlock*> getBlocks() { return blocks; }\r
- ReferenceBlock *getBlock(int index);\r
+ ReferenceBlock *getBlockById(int index);\r
+ ReferenceBlock *getBlockByName(QString name);\r
\r
// setters\r
void addChild(BlockCategory* child);\r
if (reference->isWBConfigurable()) {\r
genController = true;\r
controllerFile = path;\r
+ controllerFile += "/";\r
controllerFile.append(block->getName());\r
controllerFile.append("_ctrl.vhd"); \r
}\r
controllerFile = "nofile.vhd"; \r
}\r
coreFile = path;\r
+ coreFile += "/";\r
coreFile.append(block->getName());\r
coreFile.append(".vhd");\r
\r
for(int i = 0; i < 50; i++) {\r
out << "--";\r
}\r
- out << "\n--\n";\r
+ out << "\n--" << endl;\r
QString fileName = coreFile;\r
- out << "-- File : " << fileName << "\n";\r
- out << "--\n";\r
+ out << "-- File : " << fileName << endl;\r
+ out << "--" << endl;\r
QDomElement eltAuthor = elt.firstChildElement("author");\r
QString firstName = eltAuthor.attribute("firstname","");\r
QString lastName = eltAuthor.attribute("lastname","");\r
QString mail = eltAuthor.attribute("mail","");\r
- out << "-- Author(s) : "<<firstName+" "<<lastName<<" ("<<mail<<")\n";\r
- out << "--\n";\r
+ out << "-- Author(s) : "<<firstName+" "<<lastName<<" ("<<mail<<")" << endl;\r
+ out << "--" << endl;\r
QDomElement eltDate = eltAuthor.nextSiblingElement("date");\r
QString crea = eltDate.attribute("creation","");\r
- out << "-- Creation Date : "<<crea<<"\n";\r
- out << "--\n";\r
+ out << "-- Creation Date : "<<crea<< endl;\r
+ out << "--" << endl;\r
QDomElement eltRelated = eltDate.nextSiblingElement("related_files");\r
QString relateds = eltRelated.attribute("list","");\r
- out << "-- Related files :\n"<<relateds<<"\n";\r
- out << "--\n";\r
+ out << "-- Related files :\n"<<relateds<<endl;\r
+ out << "--" << endl;\r
QDomElement eltDesc = eltRelated.nextSiblingElement("description");\r
QDomElement desc = eltDesc.firstChildElement();\r
QString descTxt = desc.text();\r
- out << "-- Decription :\n"<<descTxt<<"\n";\r
- out << "--\n";\r
+ out << "-- Decription :\n"<<descTxt<<endl;\r
+ out << "--" << endl;\r
QDomElement eltNote = eltDesc.nextSiblingElement("description");\r
QDomElement note = eltNote.firstChildElement();\r
QString noteTxt = note.text();\r
- out << "-- Note :\n"<<noteTxt<<"\n";\r
- out << "--\n";\r
+ out << "-- Note :\n"<<noteTxt<<endl;\r
+ out << "--" << endl;\r
for(int i = 0; i < 50; i++) {\r
out << "--";\r
}\r
- out << "\n\n";\r
+ out << endl << endl;\r
}\r
\r
// This function generates the library part of the VHDL document\r
QDomNode nodeLib = listLib.item(i);\r
QDomElement eltLib = nodeLib.toElement();\r
QString nameLib = eltLib.attribute("name","none");\r
- out << "library " << nameLib << ";\n";\r
+ out << "library " << nameLib << ";" << endl;\r
QDomNodeList listPack = eltLib.elementsByTagName("package");\r
for(int j = 0; j < listPack.length(); j++) {\r
QDomNode nodePack = listPack.item(j);\r
QList<AbstractInterface*> listBidirs = block->getBidirs();\r
QString typePort, namePort;\r
\r
- out << "entity " << nameEnt << " is\n";\r
+ out << "entity " << nameEnt << " is" << endl;\r
\r
\r
/* TODO : rewrite the generation to take into acocunt the new object hierarchy */\r
}
}
- if (iface->getInputModifier() != NULL) {
- removeModifier = menu.addAction("Remove input modifier");
- }
- if (iface->getInputModifier() != NULL) {
- showModifier = menu.addAction("Show input modifier parameters");
+ if (iface->getAssociatedIface() != NULL) {
+ ConnectedInterface* assoIface = AI_TO_CON(iface->getAssociatedIface());
+ if (assoIface->getInputModifier() != NULL) {
+ removeModifier = menu.addAction("Remove input modifier");
+ }
+ if (assoIface->getInputModifier() != NULL) {
+ showModifier = menu.addAction("Show input modifier parameters");
+ }
}
}
virtual bool canConnectFrom(AbstractInterface* iface) = 0;
// others
+ void resetOutputPattern() { outputPattern = NULL; }
void connectTo(ConnectedInterface* iface);
void disconnectTo(ConnectedInterface* iface);
//bool connectFrom(ConnectedInterface* iface);
#include "DelayInputModifier.h"\r
+#include "ConnectedInterface.h"\r
\r
-DelayInputModifier::DelayInputModifier(int _delayLength) : AbstractInputModifier() {\r
+DelayInputModifier::DelayInputModifier(ConnectedInterface *_associatedInterface, int _delayLength) : AbstractInputModifier(_associatedInterface) {\r
setDelayLength(_delayLength);\r
}\r
\r
return pattern;\r
}\r
\r
+QString DelayInputModifier::toVHDL(int context, int flags) throw(Exception) {\r
+\r
+}\r
+\r
QString DelayInputModifier::getTypeStr() {\r
return "delay";\r
}\r
#include <QtCore>\r
\r
#include "AbstractInputModifier.h"\r
+\r
using namespace std;\r
using namespace Qt;\r
\r
\r
public: \r
\r
- DelayInputModifier(int _delayLength = 1);\r
+ DelayInputModifier(ConnectedInterface* _associatedInterface, int _delayLength = 1);\r
// getters\r
inline int getDelayLength() { return delayLength; }\r
// setters\r
\r
// others\r
QList<char>* getModifiedInput(QList<char>* input);\r
+ QString toVHDL(int context, int flags) throw(Exception);\r
\r
QString getTypeStr();\r
QString getParametersStr();\r
sceneCounter = 0;
}
-bool Dispatcher::createConnection(InterfaceItem *iface1, InterfaceItem *iface2) {
+bool Dispatcher::createConnection(InterfaceItem *iface1, InterfaceItem *iface2, bool visible) {
ConnectedInterface* ref1 = iface1->refInter;
ConnectedInterface* ref2 = iface2->refInter;
}
if ((ok1 == true) || (ok2 == true)) {
- iface1->getOwner()->getScene()->createConnectionItem(iface1,iface2);
+ iface1->getOwner()->getScene()->createConnectionItem(iface1,iface2, visible);
unselectAllItems();
params->unsaveModif = true;
ReferenceBlock* ref = block->getReference();
BlockImplementation* impl = ref->getImplementations().at(0);
try {
- impl->generateVHDL(block,"/home/sdomas/");
+ impl->generateVHDL(block,params->projectPath);
}
catch(Exception e) {
cout << qPrintable(e.getMessage()) << endl;
msg += " owned by ";
msg += item->refInter->getOwner()->getName();
msg += " is:\n";
- ConnectedInterface* iface = AI_TO_CON(item->refInter->getAssociatedIface());
- ConnectedInterface* fromIface = iface->getConnectedFrom();
- if (fromIface->getOutputPattern() == NULL) return;
- foreach(char c, *(fromIface->getOutputPattern())) {
+ // get the precursor output pattern
+ ConnectedInterface* connIface = AI_TO_CON(item->refInter->getAssociatedIface());
+ QList<char>* out = connIface->getConnectedFrom()->getOutputPattern();
+ // get the modifier
+ AbstractInputModifier* modifier = connIface->getInputModifier();
+ // check if the input is modified
+ if (modifier != NULL) {
+
+ out = modifier->getModifiedInput(out);
+ }
+
+ foreach(char c, *out) {
msg += QString::number((int)c);
}
msg += "\n";
cout << "call to " << qPrintable(fctName) << endl;
#endif
QString msg = "";
- AbstractInputModifier* mod = item->refInter->getInputModifier();
+ ConnectedInterface* assoIface = AI_TO_CON(item->refInter->getAssociatedIface());
+ AbstractInputModifier* mod = assoIface->getInputModifier();
if (mod->isDelay()) {
DelayInputModifier* delay = (DelayInputModifier *)mod;
msg = "Pattern of iface ";
cout << "call to " << qPrintable(fctName) << endl;
#endif
- item->refInter->clearInputModifier();
+ ConnectedInterface* assoIface = AI_TO_CON(item->refInter->getAssociatedIface());
+ assoIface->clearInputModifier();
}
// creating the model part of the group
Graph* graph = params->createGraph();
- GroupBlock *refBlock = graph->getTopGroup();
+ GroupBlock *topBlock = graph->getTopGroup();
+ // creating the clkrstgen block
+ ReferenceBlock* ref = params->getHiddenReferenceBlock("clkrstgen");
+ FunctionalBlock* newOne = params->getGraph()->createFunctionalBlock(topBlock, ref);
+ ConnectedInterface* fromIface = AI_TO_CON(topBlock->getIfaceFromName("ext_clk"));
+ ConnectedInterface* toIface = AI_TO_CON(newOne->getIfaceFromName("ext_clk"));
+ fromIface->connectTo(toIface);
+ fromIface = AI_TO_CON(topBlock->getIfaceFromName("ext_reset"));
+ toIface = AI_TO_CON(newOne->getIfaceFromName("ext_reset"));
+ fromIface->connectTo(toIface);
// creating a fake and not connected interface
//AbstractInterface* iface = new GroupInterface(refBlock,"grp_iface",AbstractInterface::Input,AbstractInterface::Top);
params->setTopScene(scene);
params->setCurrentScene(scene);
// creating the view part of the group
- GroupItem *group = new GroupItem(NULL,refBlock,this,params);
+ GroupItem *group = new GroupItem(NULL,topBlock,this,params);
// adding the fake interface to the top group item
// creating/adding the group interface in the graph model
GroupInterface *groupInter = new GroupInterface(parentBlock,refInter->getName()+"_group",refInter->getDirection(),refInter->getPurpose());
parentItem->getRefBlock()->addInterface(groupInter);
- // creating/adding the group control interface in the graph model
- GroupInterface *groupCtlInter = new GroupInterface(parentBlock,refInter->getName()+"_group_enb",refInter->getDirection(),AbstractInterface::Control);
- groupCtlInter->setAssociatedIface(groupInter);
- parentItem->getRefBlock()->addInterface(groupCtlInter);
+ // creating/adding the group control interface in the graph model if the purpose is data
+ if (refInter->getPurpose() == AbstractInterface::Data) {
+ GroupInterface *groupCtlInter = new GroupInterface(parentBlock,refInter->getName()+"_group_enb",refInter->getDirection(),AbstractInterface::Control);
+ groupCtlInter->setAssociatedIface(groupInter);
+ parentItem->getRefBlock()->addInterface(groupCtlInter);
+ }
// creating/adding the group interface in the current scene model, and connection item
InterfaceItem *groupIfaceItem = new InterfaceItem(0,item->getOrientation(),groupInter,parentItem,params);
parentItem->addInterfaceItem(groupIfaceItem,true);
QList<int>* delay = iterD.value();
if (delay->at(0) > 0) {
// create delay and associate it to the connected input
- AbstractInputModifier* mod = new DelayInputModifier(delay->at(0));
- ConnectedInterface* toIface = AI_TO_CON(iterD.key()->getAssociatedIface());
+
+ ConnectedInterface* toIface = AI_TO_CON(iterD.key());
+ AbstractInputModifier* mod = new DelayInputModifier(toIface, delay->at(0));
cout << "modify input of " << qPrintable(toIface->getName()) << endl;
toIface->setInputModifier(mod);
// repaint
void removeModifier(InterfaceItem* item);
// connection ops
- bool createConnection(InterfaceItem *iface1, InterfaceItem *iface2);
+ bool createConnection(InterfaceItem *iface1, InterfaceItem *iface2, bool visible = true);
void removeAllBlockConnections(AbstractBoxItem *item);
void removeConnection(ConnectionItem *conn);
}\r
// get the precursor output pattern\r
QList<char>* out = connIface->getConnectedFrom()->getOutputPattern();\r
-\r
- ConnectedInterface* assoIface = AI_TO_CON(connIface->getAssociatedIface());\r
- AbstractInputModifier* modifier = assoIface->getInputModifier();\r
+ AbstractInputModifier* modifier = connIface->getInputModifier();\r
// check if the input is modified\r
if (modifier != NULL) {\r
\r
#ifdef DEBUG_FCTNAME\r
cout << "call to " << qPrintable(fctName) << endl;\r
#endif\r
- \r
+\r
+ clearOutputPattern();\r
+\r
/* case 1: the block is a generator for which output pattern\r
must be computed for a nbExec following executions\r
*/\r
- \r
- \r
+\r
if (nbExec > 0) {\r
cout << "computing output pattern of " << qPrintable(name) << " for " << nbExec << " executions" << endl;\r
foreach(AbstractInterface* iface, getControlOutputs()) {\r
lengthIP = -1;\r
}\r
\r
+void FunctionalBlock::clearOutputPattern() {\r
+\r
+ QMapIterator<AbstractInterface*,QList<char>* > iterO(outputPattern);\r
+ while (iterO.hasNext()) {\r
+ iterO.next();\r
+ ConnectedInterface* connIface = AI_TO_CON(iterO.key());\r
+ connIface->resetOutputPattern();\r
+ QList<char>* pattern = iterO.value();\r
+ if (pattern != NULL) delete pattern;\r
+ }\r
+ outputPattern.clear();\r
+ lengthOP = -1;\r
+}\r
+\r
void FunctionalBlock::clearAdmittanceDelays() {\r
QMapIterator<AbstractInterface*, QList<int>* > iterA(admittanceDelays);\r
while (iterA.hasNext()) {\r
void clearProductionPattern();\r
void createInputPattern() throw(Exception);\r
void clearInputPattern();\r
+ void clearOutputPattern();\r
void clearAdmittanceDelays();\r
int createTriggers(); // compute the clock cycle at which the block is triggered\r
\r
#include "BlockParameterGeneric.h"
#include "AbstractInterface.h"
#include "ConnectedInterface.h"
+#include "GroupInterface.h"
#include "string.h"
#include <sstream>
else {
topGroup = true;
name = QString("top_group");
+ // creating external clk/rst interfaces
+ GroupInterface* clk = new GroupInterface(this,"ext_clk", AbstractInterface::Input, AbstractInterface::Clock);
+ GroupInterface* rst = new GroupInterface(this,"ext_reset", AbstractInterface::Input, AbstractInterface::Reset);
+ addInterface(clk);
+ addInterface(rst);
+ // creating clkrstgen block : done in Dispatcher since this has no access to library
}
parent = _parent;
if (parent != NULL) {
}
setPatternComputed(true);
}
+}
+
+void GroupBlock::generateVHDL(const QString& path) throw(Exception) {
+
+ QString coreFile = "";
+
+ coreFile = path;
+ coreFile.append(normalizeName(name));
+ coreFile.append(".vhd");
+
+ QFile vhdlCore(coreFile);
+
+ if (!vhdlCore.open(QIODevice::WriteOnly)) {
+ throw(Exception(VHDLFILE_NOACCESS));
+ }
+
+ QTextStream outCore(&vhdlCore);
+
+ try {
+ generateComments(outCore);
+ generateLibraries(outCore);
+ generateEntity(outCore);
+ generateArchitecture(outCore);
+ }
+ catch(Exception err) {
+ throw(err);
+ }
+
+ vhdlCore.close();
+}
+
+
+void GroupBlock::generateComments(QTextStream& out) throw(Exception) {
+ out << " -- VHDL generated automatically for " << name << " --" << endl << endl;
+}
+
+void GroupBlock::generateLibraries(QTextStream& out) throw(Exception) {
+
+ out << "library IEEE;" << endl;
+ out << "use IEEE.STD_LOGIC_1164.all;" << endl;
+ out << "use IEEE.numeric_std.all;" << endl;
+
+}
+
+void GroupBlock::generateEntity(QTextStream& out) throw(Exception) {
+
+ int i;
+
+ out << "entity " << name << " is " << endl;
+
+ QList<BlockParameter*> listGenerics = getGenericParameters();
+ QList<AbstractInterface*> listInputs = getInputs();
+ QList<AbstractInterface*> listOutputs = getOutputs();
+ QList<AbstractInterface*> listBidirs = getBidirs();
+
+ if (!listGenerics.isEmpty()) {
+ out << " generic (" << endl;
+ for(i=0;i<listGenerics.size()-1;i++) {
+ out << " " << listGenerics.at(i)->toVHDL(BlockParameter::Entity, 0) << endl;
+ }
+ out << " " << listGenerics.at(i)->toVHDL(BlockParameter::Entity,BlockParameter::NoComma) << endl;
+ out << " );" << endl;
+ }
+
+ out << " port (" << endl;
+
+ // Generation of the clk & rst signals
+ out << " -- clk/rst" << endl;
+ foreach(AbstractInterface* iface, listInputs) {
+ if(iface->getPurpose() == AbstractInterface::Clock || iface->getPurpose() == AbstractInterface::Reset) {
+ out << " " << iface->getName() << " : in std_logic;" << endl;
+ }
+ }
+
+ int count = 0;
+ foreach(AbstractInterface* iface, getInterfaces()) {
+ if((iface->getPurpose() == AbstractInterface::Data)||(iface->getPurpose() == AbstractInterface::Control)) count++;
+ }
+ // Generation of the data/control signals
+
+ int flag = 0;
+ bool first = true;
+
+ foreach(AbstractInterface* iface, listInputs) {
+ if(iface->getPurpose() == AbstractInterface::Data) {
+ if (first) {
+ out << " -- input data ports" << endl;
+ first = false;
+ }
+ count--;
+ if (count == 0) flag = AbstractInterface::NoComma;
+ out << " " << iface->toVHDL(AbstractInterface::Entity, flag) << endl;
+ }
+ }
+ first = true;
+ foreach(AbstractInterface* iface, listInputs) {
+ if(iface->getPurpose() == AbstractInterface::Control) {
+ if (first) {
+ out << " -- input control ports" << endl;
+ first = false;
+ }
+ count--;
+ if (count == 0) flag = AbstractInterface::NoComma;
+ out << " " << iface->toVHDL(AbstractInterface::Entity, flag) << endl;
+ }
+ }
+ first = true;
+ foreach(AbstractInterface* iface, listOutputs) {
+ if(iface->getPurpose() == AbstractInterface::Data) {
+ if (first) {
+ out << " -- output data ports" << endl;
+ first = false;
+ }
+ count--;
+ if (count == 0) flag = AbstractInterface::NoComma;
+ out << " " << iface->toVHDL(AbstractInterface::Entity, flag) << endl;
+ }
+ }
+ first = true;
+ foreach(AbstractInterface* iface, listOutputs) {
+ if(iface->getPurpose() == AbstractInterface::Control) {
+ if (first) {
+ out << " -- output control ports" << endl;
+ first = false;
+ }
+ count--;
+ if (count == 0) flag = AbstractInterface::NoComma;
+ out << " " << iface->toVHDL(AbstractInterface::Entity, flag) << endl;
+ }
+ }
+ first = true;
+ foreach(AbstractInterface* iface, listBidirs) {
+ if(iface->getPurpose() == AbstractInterface::Data) {
+ if (first) {
+ out << " -- bidirs data ports" << endl;
+ first = false;
+ }
+ count--;
+ if (count == 0) flag = AbstractInterface::NoComma;
+ out << " " << iface->toVHDL(AbstractInterface::Entity, flag) << endl;
+ }
+ }
+ out << " );" << endl << endl;
+ out << "end " << name << ";" << endl << endl;
+
+}
+
+void GroupBlock::generateArchitecture(QTextStream& out) throw(Exception) {
}
+
void computeOutputPattern(int nbExec = -1) throw(Exception);
void computeAdmittanceDelays() throw(Exception);
+ void generateVHDL(const QString& path) throw(Exception); // main entry to generate the VHDL code
+
private:
// patterns
/* NB: in opposition to FunctionalBlock, the input pattern and output pattern of a block
* found by taking the output pattern of the connectedFrom interface.
*/
void createInputPattern();
-
+ void generateComments(QTextStream& out) throw(Exception);
+ void generateLibraries(QTextStream& out) throw(Exception);
+ void generateEntity(QTextStream& out) throw(Exception);
+ void generateArchitecture(QTextStream& out) throw(Exception);
+
bool topGroup;
QList<AbstractBlock*> blocks; // contains instances of FunctionalBlock or GroupBlock that are children of this group
sourceItems.removeAll(item);
}
-void GroupScene::createConnectionItem(InterfaceItem *iface1, InterfaceItem *iface2) {
+void GroupScene::createConnectionItem(InterfaceItem *iface1, InterfaceItem *iface2, bool visible) {
ConnectionItem* conn = NULL;
conn = new ConnectionItem(iface1,iface2, dispatcher, params);
+ conn->setVisible(visible);
addItem(conn);
addConnectionItem(conn);
}
void removeBoxItem(BoxItem* item);
// ConnectionItem related
- void createConnectionItem(InterfaceItem* iface1, InterfaceItem* iface2);
+ void createConnectionItem(InterfaceItem* iface1, InterfaceItem* iface2, bool visible = true);
ConnectionItem* searchConnectionItem(InterfaceItem* iface1, InterfaceItem* iface2);
void addConnectionItem(ConnectionItem* item);
void removeConnectionItem(ConnectionItem* item);
}
// draw arrows
- if(refInter->getDirection() == AbstractInterface::Input) {
- painter->drawPath(params->inArrow);
+ if ( (refInter->getPurpose() == AbstractInterface::Clock) || (refInter->getPurpose() == AbstractInterface::Reset)) {
+ painter->drawPath(params->clkrstArrow);
+ }
+ else if(refInter->getDirection() == AbstractInterface::Input) {
+ painter->drawPath(params->dataArrowIn);
}
else if(refInter->getDirection() == AbstractInterface::Output) {
- painter->drawPath(params->outArrow);
+ painter->drawPath(params->dataArrowOut);
} else if(refInter->getDirection() == AbstractInterface::InOut) {
- painter->drawPath(params->inArrow);
- painter->drawPath(params->outArrow);
+ painter->drawPath(params->dataArrowIn);
+ painter->drawPath(params->dataArrowOut);
}
// paint modifier box if needed
-
- if (refInter->getInputModifier() != NULL) {
+ ConnectedInterface* connIface = AI_TO_CON(refInter->getAssociatedIface());
+ if ((connIface != NULL) && (connIface->getInputModifier() != NULL)) {
painter->save();
painter->translate(params->arrowWidth+params->arrowLineLength,0);
painter->drawRect(0,-5,10,10);
BlockCategory* blockCat = categoryTree->searchCategory(idCategory);\r
\r
if (blockCat == NULL) return NULL;\r
- ReferenceBlock* ref = blockCat->getBlock(idBlock);\r
+ ReferenceBlock* ref = blockCat->getBlockById(idBlock);\r
+ return ref;\r
+}\r
+\r
+ReferenceBlock* Parameters::getHiddenReferenceBlock(QString blockName) {\r
+\r
+ BlockCategory* blockCat = categoryTree->searchCategory(100);\r
+ if (blockCat == NULL) return NULL;\r
+ ReferenceBlock* ref = blockCat->getBlockByName(blockName);\r
return ref;\r
}\r
\r
GroupBlock *groupBlock = NULL;\r
\r
GroupWidget* topGroup = NULL;\r
+\r
+ QString path = root.attribute("project_path","none");\r
+ if (path != "none") {\r
+ QDir dir(path);\r
+ if (dir.exists()) {\r
+ projectPath = path;\r
+\r
+ }\r
+ cout << "project path set to " << qPrintable(projectPath) << endl;\r
+ }\r
/**********************************************************\r
1 : getting scene and creating associated group widgets\r
***********************************************************/\r
QString paramsStr = currentModifierNode.attribute("params","none");\r
if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));\r
\r
- AbstractInputModifier* mod = NULL;\r
- if (typeStr == "delay") {\r
- int delay = paramsStr.toInt(&ok);\r
- if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));\r
- mod = new DelayInputModifier(delay);\r
- }\r
-\r
/* NB: just adding delays for now. To be cont'd */\r
InterfaceItem *iface = searchInterfaceItemById(id,topScene);\r
\r
- if(iface != NULL ) {\r
- iface->refInter->setInputModifier(mod);\r
+ if ((iface == NULL ) || (iface->refInter == NULL) || (iface->refInter->getAssociatedIface() == NULL)) {\r
+ cout << "modified interface not found, modifiers setup canceled!" << endl;\r
+ }\r
+ else {\r
+ ConnectedInterface* connIface = AI_TO_CON(iface->refInter->getAssociatedIface());\r
\r
- } else {\r
- cout << "interfaces not found, modifiers setup canceled!" << endl;\r
+ AbstractInputModifier* mod = NULL;\r
+ if (typeStr == "delay") {\r
+ int delay = paramsStr.toInt(&ok);\r
+ if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));\r
+ mod = new DelayInputModifier(connIface, delay);\r
+ connIface->setInputModifier(mod);\r
+ }\r
}\r
}\r
+\r
cout << "modifiers loaded and created succefully!" << endl;\r
\r
return topGroup;\r
_inArrow.lineTo(arrowLineLength+arrowWidth,-arrowHeight/2);\r
_inArrow.lineTo(arrowLineLength+arrowWidth,arrowHeight/2);\r
_inArrow.lineTo(arrowLineLength,0);\r
- _inArrow.closeSubpath();\r
- inArrow = _inArrow;\r
+ //_inArrow.closeSubpath();\r
+ dataArrowIn = _inArrow;\r
+\r
+ QPainterPath _inArrowC;\r
+ _inArrowC.lineTo(arrowLineLength,0);\r
+ _inArrowC.addEllipse(arrowLineLength,-arrowHeight/2,arrowHeight-1,arrowHeight-1);\r
+ clkrstArrow = _inArrowC;\r
\r
QPainterPath _outArrow;\r
_outArrow.lineTo(arrowLineLength,0);\r
_outArrow.lineTo(arrowLineLength+arrowWidth,0);\r
_outArrow.lineTo(arrowLineLength,arrowHeight/2);\r
_outArrow.lineTo(arrowLineLength,0);\r
- _outArrow.closeSubpath();\r
- outArrow = _outArrow;\r
+ //_outArrow.closeSubpath();\r
+ dataArrowOut = _outArrow;\r
\r
}\r
\r
QString defaultIfaceFontName;\r
int defaultIfaceFontSize;\r
int connGapLength;\r
- QPainterPath inArrow;\r
- QPainterPath outArrow;\r
+ QPainterPath dataArrowIn;\r
+ QPainterPath dataArrowOut;\r
+ QPainterPath clkrstArrow;\r
+\r
\r
/***************************************************\r
attributes that are specific for the current project\r
void destroyGraph();\r
inline Graph* getGraph() { return graph; } \r
ReferenceBlock* getReferenceBlock(int idCategory, int idBlock); // get the reference block from its category and index\r
+ ReferenceBlock* getHiddenReferenceBlock(QString blockName); // get a hidden block by name, i.e. in category 100\r
FunctionalBlock* duplicateFunctionalBlock(FunctionalBlock* block); // adding a copy of a functional block to current group\r
\r
\r
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 4.2.0, 2018-01-15T00:01:27. -->
+<!-- Written by QtCreator 4.2.0, 2018-01-24T13:25:48. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
@{pix_out} <= std_logic_vector(mult_result(24 downto 17));
@{pix_out_enb} <= do_out;
-
-end rtl;
</architecture>
<patterns>
<delta value="$img_width*$img_height"/>
end if;
end process check_process;
-
-end rtl;
</architecture>
<patterns>
<delta value="1"/>
--- /dev/null
+<!DOCTYPE checker>
+<block_impl ref_name="clkrstgen.xml" ref_md5="">
+ <comments>
+ <author lastname="Domas" mail="sdomas@univ-fcomte.fr" firstname="Stephane"/>
+ <date creation="2018-01-10"/>
+ <related_files list=""/>
+ <description>implementation of cljrstgen that does the connection between
+ external and internal clock and reset</description>
+ <notes>none</notes>
+ </comments>
+ <libraries>
+ <library name="ieee">
+ <package name="std_logic_1164" use="all"/>
+ <package name="numeric_std" use="all"/>
+ </library>
+ </libraries>
+ <architecture>
+signal dly : std_logic := '0';
+signal rst : std_logic := '0';
+
+begin
+
+ process(ext_clk)
+ begin
+ if(rising_edge(ext_clk)) then
+ dly <= (not(ext_reset) and dly and not(rst))
+ or (not(ext_reset) and not(dly) and rst);
+
+ rst <= (not(ext_reset) and not(dly) and not(rst));
+ end if;
+ end process;
+
+ clk <= ext_clk;
+ reset <= rst xor invert_reset;
+</architecture>
+</block_impl>
@{data1_out_enb} <= do_out;
@{data2_out_enb} <= do_out;
@{data3_out_enb} <= do_out;
-
-end rtl;
</architecture>
<patterns>
<delta value="3"/>
end if;
end process and_process;
-
-end rtl;
</architecture>
<patterns>
<delta value="1"/>
@{gs_out} <= std_logic_vector(result(dsp_in_width+7 downto dsp_in_width));
@{gs_out_enb} <= do_out;
-
-end rtl;
</architecture>
<patterns>
<delta value="3"/>
std_logic_vector(cr(7 downto 0)) when do_out_cr = '1' else
(others => '0');
@{ycbcr_out_enb} <= do_out_y or do_out_cb or do_out_cr;
-
-end rtl;
</architecture>
<patterns>
<delta value="3"/>
end if;
end if;
end process threshold_process;
-
-end rtl;
</architecture>
<patterns>
<delta value="1"/>
<block>
<informations>
<name>
- wishbone master for apf27
+ clkrstgen
</name>
- <category ids="5" />
+ <category ids="100" />
<description>
<brief>
This block is the wishbone master of the design, connected to the i.MX of APF27
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<block>
+ <informations>
+ <name>
+ clkrstgen
+ </name>
+ <category ids="100" />
+ <description>
+ <brief>
+ This block generate a reset signal synchronous to clock
+ </brief>
+ <detailed>
+ This block generate a reset signal synchronous to clock and is the entry point
+ of the external clock and asynchronous reset.
+ </detailed>
+ </description>
+ </informations>
+
+ <parameters>
+ <parameter value="0" type="boolean" context="generic" name="invert_reset"/>
+ </parameters>
+
+ <interfaces>
+ <inputs>
+ <input name="ext_clk" type="boolean" width="1" purpose="clock" />
+ <input name="ext_reset" type="boolean" width="1" purpose="reset" />
+ </inputs>
+ <outputs>
+ <output name="clk" type="boolean" width="1" purpose="clock" />
+ <output name="reset" type="boolean" width="1" purpose="reset" />
+ </outputs>
+ </interfaces>
+
+</block>
<xs:attribute name="ref_md5" type="xs:string"/>
<xs:attribute name="context" type="xs:string"/>
<xs:attribute name="type" type="xs:string"/>
- <xs:attribute name="params" type="xs:string"/>
+ <xs:attribute name="params" type="xs:string"/>
+ <xs:attribute name="project_path" type="xs:string"/>
<!-- déclaration des groupes d'éléments -->
<xs:element name="blast_project">
<xs:complexType>
<xs:group ref="rootElmtGroup"/>
+ <xs:attribute ref="project_path" />
</xs:complexType>
</xs:element>
+++ /dev/null
--------------------------------------------------------------------------------
---
--- File : threshold _extctl.vhd
--- Related files :
---
--- Author(s) : stephane Domas (sdomas@univ-fcomte.fr)
---
--- Creation Date : 2017/10/16
---
--- Description : This IP does a threshold based on a external signal
---
---
--- Note : input data is kept as is depending on the fact that
--- the keep_in signal is asserted to 1 or not. It it is not,
--- then input is replaced by the default_value given as a
--- generic. Note that keep_in_enb and data_in_enb must be
--- asserted to 1 at the same time so that the block gives an output
---
--------------------------------------------------------------------------------
-
-library IEEE;
-use IEEE.std_logic_1164.all;
-use IEEE.numeric_std.all;
-
-entity threshold_extctl is
- generic(
- in_width : natural := 8;
- default_value : natural := 0
- );
- port(
- clk : in std_logic;
- reset : in std_logic;
- data_in : in std_logic_vector(in_width-1 downto 0);
- data_in_enb : in std_logic;
- keep_in : in std_logic;
- keep_in_enb : in std_logic;
- data_out : out std_logic_vector(in_width-1 downto 0);
- data_out_enb : out std_logic
-
- );
-end threshold_extctl;
-
-
-architecture rtl of threshold_extctl is
-
- -- Signals
- signal def_val : unsigned(in_width-1 downto 0);
-
-begin
-
- def_val <= to_unsigned(default_value, in_width);
-
- threshold_process : process (clk, reset)
- begin
- if reset = '1' then
-
- data_out_enb <= '0';
- data_out <= (others => '0');
-
- elsif rising_edge(clk) then
-
- data_out_enb <= '0';
-
- if data_in_enb = '1' and keep_in_enb = '1' then
-
- if keep_in = '1' then
- data_out <= data_in;
- else
- data_out <= std_logic_vector(def_val);
- end if;
- data_out_enb <= '1';
- end if;
- end if;
- end process threshold_process;
-
-end rtl;
-