return true; \r
}\r
\r
-void BlockImplementation::generateVHDL(FunctionalBlock* _block, const QString &path) throw(Exception) {\r
-\r
- block = _block;\r
-\r
- QFile implFile(xmlFile);\r
-\r
- // reading in into QDomDocument\r
- QDomDocument document("implFile");\r
-\r
- if (!implFile.open(QIODevice::ReadOnly)) {\r
- throw(Exception(IMPLFILE_NOACCESS));\r
- }\r
- if (!document.setContent(&implFile)) {\r
- implFile.close();\r
- throw(Exception(IMPLFILE_NOACCESS));\r
- }\r
- implFile.close();\r
-\r
- bool genController = false;\r
- QString coreFile = "";\r
- QString controllerFile = "";\r
-\r
- if (reference->isWBConfigurable()) {\r
- genController = true;\r
- controllerFile = path;\r
- controllerFile += "/";\r
- controllerFile.append(block->getName());\r
- controllerFile.append("_ctrl.vhd"); \r
- }\r
- else {\r
- controllerFile = "nofile.vhd"; \r
- }\r
- coreFile = path;\r
- coreFile += "/";\r
- coreFile.append(block->getName());\r
- coreFile.append(".vhd");\r
-\r
- QFile vhdlCore(coreFile);\r
- QFile vhdlController(controllerFile);\r
-\r
- if (!vhdlCore.open(QIODevice::WriteOnly)) {\r
- throw(Exception(VHDLFILE_NOACCESS));\r
- }\r
-\r
- if (genController) {\r
- if (!vhdlController.open(QIODevice::WriteOnly)) {\r
- throw(Exception(VHDLFILE_NOACCESS));\r
- }\r
- }\r
- QTextStream outCore(&vhdlCore);\r
- QTextStream outController;\r
- if (genController) {\r
- outController.setDevice(&vhdlController);\r
- }\r
-\r
- try {\r
-\r
-\r
- //Get the root element\r
- QDomElement impl = document.documentElement();\r
- QDomElement eltComments = impl.firstChildElement("comments");\r
- generateComments(eltComments, coreFile, outCore);\r
- QDomElement eltLibs = eltComments.nextSiblingElement("libraries");\r
- generateLibraries(eltLibs, outCore);\r
- generateEntity(outCore, genController);\r
- QDomElement eltArch = eltLibs.nextSiblingElement("architecture");\r
- generateArchitecture(eltArch, outCore);\r
- if (genController) {\r
- generateController(outController);\r
- }\r
- }\r
- catch(Exception err) {\r
- throw(err);\r
- }\r
-\r
- vhdlCore.close();\r
- vhdlController.close();\r
-}\r
-\r
-// This function generates the comments part of the VHDL document\r
-void BlockImplementation::generateComments(QTextStream& out, QDomElement &elt, QString coreFile) throw(Exception) {\r
-\r
- for(int i = 0; i < 50; i++) {\r
- out << "--";\r
- }\r
- out << "\n--" << endl;\r
- QString fileName = coreFile;\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<<")" << endl;\r
- out << "--" << endl;\r
- QDomElement eltDate = eltAuthor.nextSiblingElement("date");\r
- QString crea = eltDate.attribute("creation","");\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<<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<<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<<endl;\r
- out << "--" << endl;\r
- for(int i = 0; i < 50; i++) {\r
- out << "--";\r
- }\r
- out << endl << endl;\r
-}\r
-\r
-// This function generates the library part of the VHDL document\r
-void BlockImplementation::generateLibraries(QTextStream& out, QDomElement &elt) throw(Exception) {\r
-\r
- QDomNodeList listLib = elt.elementsByTagName("library");\r
- for(int i = 0; i < listLib.length(); i++) {\r
- QDomNode nodeLib = listLib.item(i);\r
- QDomElement eltLib = nodeLib.toElement();\r
- QString nameLib = eltLib.attribute("name","none");\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
- QDomElement eltPack = nodePack.toElement();\r
- QString namePack = eltPack.attribute("name","none");\r
- QString usePack = eltPack.attribute("use","none");\r
- out << "use " << nameLib << "." << namePack << "." << usePack << endl;\r
- }\r
- out << endl;\r
- }\r
-}\r
-\r
-// This function generates the entity part of the VHDL document\r
-void BlockImplementation::generateEntity(QTextStream& out, bool hasController) throw(Exception) {\r
-\r
- int i=0;\r
- nameEnt = block->getName();\r
- //QList<BlockParameter*> listParams = reference->getParameters();\r
- QList<AbstractInterface*> listInputs = block->getInputs();\r
- QList<AbstractInterface*> listOutputs = block->getOutputs();\r
- QList<AbstractInterface*> listBidirs = block->getBidirs();\r
- QString typePort, namePort;\r
-\r
- out << "entity " << nameEnt << " is" << endl;\r
-\r
-\r
- /* TODO : rewrite the generation to take into acocunt the new object hierarchy */\r
-\r
- // Generation of the generics\r
- QList<BlockParameter*> listGenerics = block->getGenericParameters();\r
- if ((!listGenerics.isEmpty()) || (hasController)) {\r
- out << " generic (" << endl;\r
- if (hasController) {\r
- out << " wb_data_width : integer = 16;" << endl;\r
- out << " wb_addr_width : integer = 12";\r
- if (!listGenerics.isEmpty()) out << ";";\r
- out << endl;\r
- }\r
- for(i=0;i<listGenerics.size()-1;i++) {\r
- out << " " << listGenerics.at(i)->toVHDL(BlockParameter::Entity, 0) << endl;\r
- }\r
- out << " " << listGenerics.at(i)->toVHDL(BlockParameter::Entity,BlockParameter::NoComma) << endl;\r
-\r
- out << " );" << endl;\r
- }\r
-\r
- out << " port (" << endl;\r
-\r
- // Generation of the clk & rst signals\r
- out << " -- clk/rst" << endl;\r
- foreach(AbstractInterface* iface, listInputs) {\r
- if(iface->getPurpose() == AbstractInterface::Clock || iface->getPurpose() == AbstractInterface::Reset) {\r
- out << " " << iface->getName() << " : in std_logic;" << endl;\r
- }\r
- }\r
-\r
- if (hasController) {\r
- // Generation of the wishbone signals\r
- out << " -- registers r/w via wishbone" << endl;\r
- QList<BlockParameter*> listWB = reference->getWishboneParameters();\r
- for(i=0;i<listWB.size()-1;i++) {\r
- out << " " << listWB.at(i)->toVHDL(BlockParameter::Entity, 0) << endl;\r
- }\r
- out << " " << listWB.at(i)->toVHDL(BlockParameter::Entity,BlockParameter::NoComma) << endl;\r
- }\r
-\r
-\r
- int count = 0;\r
- foreach(AbstractInterface* iface, block->getInterfaces()) {\r
- if((iface->getPurpose() == AbstractInterface::Data)||(iface->getPurpose() == AbstractInterface::Control)) count++;\r
- }\r
- // Generation of the data/control signals\r
-\r
- int flag = 0;\r
- bool first = true;\r
-\r
- foreach(AbstractInterface* iface, listInputs) {\r
- if(iface->getPurpose() == AbstractInterface::Data) {\r
- if (first) {\r
- out << " -- input data ports" << endl;\r
- first = false;\r
- }\r
- count--;\r
- if (count == 0) flag = AbstractInterface::NoComma;\r
- out << " " << iface->toVHDL(AbstractInterface::Entity, flag) << endl;\r
- }\r
- }\r
- first = true;\r
- foreach(AbstractInterface* iface, listInputs) {\r
- if(iface->getPurpose() == AbstractInterface::Control) {\r
- if (first) {\r
- out << " -- input control ports" << endl;\r
- first = false;\r
- }\r
- count--;\r
- if (count == 0) flag = AbstractInterface::NoComma;\r
- out << " " << iface->toVHDL(AbstractInterface::Entity, flag) << endl;\r
- }\r
- }\r
- first = true;\r
- foreach(AbstractInterface* iface, listOutputs) {\r
- if(iface->getPurpose() == AbstractInterface::Data) {\r
- if (first) {\r
- out << " -- output data ports" << endl;\r
- first = false;\r
- }\r
- count--;\r
- if (count == 0) flag = AbstractInterface::NoComma;\r
- out << " " << iface->toVHDL(AbstractInterface::Entity, flag) << endl;\r
- }\r
- }\r
- first = true;\r
- foreach(AbstractInterface* iface, listOutputs) {\r
- if(iface->getPurpose() == AbstractInterface::Control) {\r
- if (first) {\r
- out << " -- output control ports" << endl;\r
- first = false;\r
- }\r
- count--;\r
- if (count == 0) flag = AbstractInterface::NoComma;\r
- out << " " << iface->toVHDL(AbstractInterface::Entity, flag) << endl;\r
- }\r
- }\r
- first = true;\r
- foreach(AbstractInterface* iface, listBidirs) {\r
- if(iface->getPurpose() == AbstractInterface::Data) {\r
- if (first) {\r
- out << " -- bidirs data ports" << endl;\r
- first = false;\r
- }\r
- count--;\r
- if (count == 0) flag = AbstractInterface::NoComma;\r
- out << " " << iface->toVHDL(AbstractInterface::Entity, flag) << endl;\r
- }\r
- }\r
- out << " );" << endl << endl;\r
- out << "end " << nameEnt << ";" << endl << endl;\r
-}\r
-\r
-// This function generates the architecture part of the VHDL document\r
-void BlockImplementation::generateArchitecture(QTextStream& out, QDomElement &elt) throw(Exception) {\r
-\r
- QString expr;\r
- QString code = elt.text();\r
- cout << qPrintable(code) << endl;\r
- out << "architecture rtl of " << nameEnt << " is" << endl;\r
-\r
- QStringList listLine = code.split("\n");\r
- for(int i =0; i < listLine.size(); i++) {\r
- QString line = listLine.at(i).simplified();\r
-\r
- /*\r
- if(listLine.at(i).contains(QRegularExpression("@foreach{"))) {\r
- while(listLine.at(i).compare("@endforeach") != -1) {\r
- expr = expr + listLine.at(i) + '\n';\r
- i++;\r
- }\r
- expr = expr + listLine.at(i);\r
- out << evalComplex(expr, 1) << '\n';\r
- }\r
- if(listLine.at(i).contains(QRegularExpression("@caseeach{"))) {\r
- while(listLine.at(i).compare("@endcaseeach") != -1) {\r
- expr = expr + listLine.at(i) + '\n';\r
- i++;\r
- }\r
- expr = expr + listLine.at(i);\r
- out << evalComplex(expr, 2) << '\n';\r
- }\r
-*/\r
- if(line.contains("@{")) {\r
- out << line << endl;\r
- }\r
- }\r
-}\r
-\r
-void BlockImplementation::generateController(QTextStream &out) throw(Exception) {\r
-}\r
-\r
QString BlockImplementation::eval(QString line, QTextStream& out) {\r
QString res, s, begLine, endLine, expr;\r
evaluator->setExpression(line);\r
inline void setReference(ReferenceBlock* _reference) { reference = _reference; }\r
\r
void loadPatterns(QDomElement &root) throw(Exception);\r
- bool checkPatterns();\r
- void generateVHDL(FunctionalBlock* _block, const QString& path) throw(Exception); // main entry to generate the VHDL code\r
+ bool checkPatterns(); \r
\r
\r
private: \r
QHash<QString,QString> productionPattern; // key = reference interface name, value = pattern expression\r
QString productionCounter;\r
\r
- void generateComments(QTextStream& out, QDomElement &elt, QString coreFile) throw(Exception); // generates comments from <comments> element\r
- void generateLibraries(QTextStream& out, QDomElement &elt) throw(Exception); // generates libraries from <libraries> element\r
- void generateEntity(QTextStream& out, bool hasController=false) throw(Exception); // generate the entity using reference\r
- void generateArchitecture(QTextStream& out, QDomElement &elt ) throw(Exception); // generate the architecture using <architecture> element\r
- void generateController(QTextStream& out) throw(Exception); // generate the wishbone controller of the block\r
-\r
QString getIfaceUserName(AbstractInterface* refIface); // get the name of an interface given by the user, from the reference interface\r
\r
friend QDataStream &operator<<(QDataStream &out, const BlockImplementation &impl);\r
if (item->getRefBlock()->isFunctionalBlock()) {
FunctionalBlock* block = AB_TO_FUN(item->getRefBlock());
- ReferenceBlock* ref = block->getReference();
- BlockImplementation* impl = ref->getImplementations().at(0);
try {
- impl->generateVHDL(block,params->projectPath);
+ block->generateVHDL(params->projectPath);
}
catch(Exception e) {
cout << qPrintable(e.getMessage()) << endl;
}\r
\r
void FunctionalBlock::generateVHDL(const QString& path) throw(Exception){\r
+ \r
+ BlockImplementation* impl = reference->getImplementations().at(0); // for now only take first impl available\r
+ QFile implFile(impl->getXmlFile());\r
+\r
+ // reading in into QDomDocument\r
+ QDomDocument document("implFile");\r
+\r
+ if (!implFile.open(QIODevice::ReadOnly)) {\r
+ throw(Exception(IMPLFILE_NOACCESS));\r
+ }\r
+ if (!document.setContent(&implFile)) {\r
+ implFile.close();\r
+ throw(Exception(IMPLFILE_NOACCESS));\r
+ }\r
+ implFile.close();\r
+\r
+ bool genController = false;\r
+ QString coreFile = "";\r
+ QString controllerFile = "";\r
+\r
+ if (reference->isWBConfigurable()) {\r
+ genController = true;\r
+ controllerFile = path;\r
+ controllerFile += "/";\r
+ controllerFile.append(name);\r
+ controllerFile.append("_ctrl.vhd"); \r
+ }\r
+ else {\r
+ controllerFile = "nofile.vhd"; \r
+ }\r
+ coreFile = path;\r
+ coreFile += "/";\r
+ coreFile.append(name);\r
+ coreFile.append(".vhd");\r
+\r
+ QFile vhdlCore(coreFile);\r
+ QFile vhdlController(controllerFile);\r
+\r
+ if (!vhdlCore.open(QIODevice::WriteOnly)) {\r
+ throw(Exception(VHDLFILE_NOACCESS));\r
+ }\r
+\r
+ if (genController) {\r
+ if (!vhdlController.open(QIODevice::WriteOnly)) {\r
+ throw(Exception(VHDLFILE_NOACCESS));\r
+ }\r
+ }\r
+ QTextStream outCore(&vhdlCore);\r
+ QTextStream outController;\r
+ if (genController) {\r
+ outController.setDevice(&vhdlController);\r
+ }\r
+\r
+ try {\r
+ //Get the root element\r
+ QDomElement impl = document.documentElement();\r
+ QDomElement eltComments = impl.firstChildElement("comments");\r
+ generateComments(outCore,eltComments, coreFile);\r
+ QDomElement eltLibs = eltComments.nextSiblingElement("libraries");\r
+ generateLibraries(outCore, eltLibs);\r
+ generateEntity(outCore, genController);\r
+ QDomElement eltArch = eltLibs.nextSiblingElement("architecture");\r
+ generateArchitecture(outCore, eltArch );\r
+ if (genController) {\r
+ generateController(outController);\r
+ }\r
+ }\r
+ catch(Exception err) {\r
+ throw(err);\r
+ }\r
+\r
+ vhdlCore.close();\r
+ vhdlController.close();\r
+ \r
}\r
\r
void FunctionalBlock::generateComments(QTextStream& out, QDomElement &elt, QString coreFile) throw(Exception) {\r
\r
+ for(int i = 0; i < 50; i++) {\r
+ out << "--";\r
+ }\r
+ out << "\n--" << endl;\r
+ QString fileName = coreFile;\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<<")" << endl;\r
+ out << "--" << endl;\r
+ QDomElement eltDate = eltAuthor.nextSiblingElement("date");\r
+ QString crea = eltDate.attribute("creation","");\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<<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<<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<<endl;\r
+ out << "--" << endl;\r
+ for(int i = 0; i < 50; i++) {\r
+ out << "--";\r
+ }\r
+ out << endl << endl;\r
}\r
\r
void FunctionalBlock::generateLibraries(QTextStream& out, QDomElement &elt) throw(Exception) {\r
-\r
+ \r
+ QDomNodeList listLib = elt.elementsByTagName("library");\r
+ for(int i = 0; i < listLib.length(); i++) {\r
+ QDomNode nodeLib = listLib.item(i);\r
+ QDomElement eltLib = nodeLib.toElement();\r
+ QString nameLib = eltLib.attribute("name","none");\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
+ QDomElement eltPack = nodePack.toElement();\r
+ QString namePack = eltPack.attribute("name","none");\r
+ QString usePack = eltPack.attribute("use","none");\r
+ out << "use " << nameLib << "." << namePack << "." << usePack << endl;\r
+ }\r
+ out << endl;\r
+ }\r
}\r
\r
-void FunctionalBlock::generateEntity(QTextStream& out, bool hasController=false) throw(Exception) {\r
+void FunctionalBlock::generateEntity(QTextStream& out, bool hasController) throw(Exception) {\r
+\r
+ int i=0;\r
+ \r
+ //QList<BlockParameter*> listParams = reference->getParameters();\r
+ QList<AbstractInterface*> listInputs = getInputs();\r
+ QList<AbstractInterface*> listOutputs = getOutputs();\r
+ QList<AbstractInterface*> listBidirs = getBidirs();\r
+ QString typePort, namePort;\r
+\r
+ out << "entity " << name << " is" << endl;\r
+\r
+\r
+ /* TODO : rewrite the generation to take into acocunt the new object hierarchy */\r
+\r
+ // Generation of the generics\r
+ QList<BlockParameter*> listGenerics = getGenericParameters();\r
+ if ((!listGenerics.isEmpty()) || (hasController)) {\r
+ out << " generic (" << endl;\r
+ if (hasController) {\r
+ out << " wb_data_width : integer = 16;" << endl;\r
+ out << " wb_addr_width : integer = 12";\r
+ if (!listGenerics.isEmpty()) out << ";";\r
+ out << endl;\r
+ }\r
+ for(i=0;i<listGenerics.size()-1;i++) {\r
+ out << " " << listGenerics.at(i)->toVHDL(BlockParameter::Entity, 0) << endl;\r
+ }\r
+ out << " " << listGenerics.at(i)->toVHDL(BlockParameter::Entity,BlockParameter::NoComma) << endl;\r
+\r
+ out << " );" << endl;\r
+ }\r
+\r
+ out << " port (" << endl;\r
\r
+ // Generation of the clk & rst signals\r
+ out << " -- clk/rst" << endl;\r
+ foreach(AbstractInterface* iface, listInputs) {\r
+ if(iface->getPurpose() == AbstractInterface::Clock || iface->getPurpose() == AbstractInterface::Reset) {\r
+ out << " " << iface->getName() << " : in std_logic;" << endl;\r
+ }\r
+ }\r
+\r
+ if (hasController) {\r
+ // Generation of the wishbone signals\r
+ out << " -- registers r/w via wishbone" << endl;\r
+ QList<BlockParameter*> listWB = reference->getWishboneParameters();\r
+ for(i=0;i<listWB.size()-1;i++) {\r
+ out << " " << listWB.at(i)->toVHDL(BlockParameter::Entity, 0) << endl;\r
+ }\r
+ out << " " << listWB.at(i)->toVHDL(BlockParameter::Entity,BlockParameter::NoComma) << endl;\r
+ }\r
+\r
+\r
+ int count = 0;\r
+ foreach(AbstractInterface* iface, getInterfaces()) {\r
+ if((iface->getPurpose() == AbstractInterface::Data)||(iface->getPurpose() == AbstractInterface::Control)) count++;\r
+ }\r
+ // Generation of the data/control signals\r
+\r
+ int flag = 0;\r
+ bool first = true;\r
+\r
+ foreach(AbstractInterface* iface, listInputs) {\r
+ if(iface->getPurpose() == AbstractInterface::Data) {\r
+ if (first) {\r
+ out << " -- input data ports" << endl;\r
+ first = false;\r
+ }\r
+ count--;\r
+ if (count == 0) flag = AbstractInterface::NoComma;\r
+ out << " " << iface->toVHDL(AbstractInterface::Entity, flag) << endl;\r
+ }\r
+ }\r
+ first = true;\r
+ foreach(AbstractInterface* iface, listInputs) {\r
+ if(iface->getPurpose() == AbstractInterface::Control) {\r
+ if (first) {\r
+ out << " -- input control ports" << endl;\r
+ first = false;\r
+ }\r
+ count--;\r
+ if (count == 0) flag = AbstractInterface::NoComma;\r
+ out << " " << iface->toVHDL(AbstractInterface::Entity, flag) << endl;\r
+ }\r
+ }\r
+ first = true;\r
+ foreach(AbstractInterface* iface, listOutputs) {\r
+ if(iface->getPurpose() == AbstractInterface::Data) {\r
+ if (first) {\r
+ out << " -- output data ports" << endl;\r
+ first = false;\r
+ }\r
+ count--;\r
+ if (count == 0) flag = AbstractInterface::NoComma;\r
+ out << " " << iface->toVHDL(AbstractInterface::Entity, flag) << endl;\r
+ }\r
+ }\r
+ first = true;\r
+ foreach(AbstractInterface* iface, listOutputs) {\r
+ if(iface->getPurpose() == AbstractInterface::Control) {\r
+ if (first) {\r
+ out << " -- output control ports" << endl;\r
+ first = false;\r
+ }\r
+ count--;\r
+ if (count == 0) flag = AbstractInterface::NoComma;\r
+ out << " " << iface->toVHDL(AbstractInterface::Entity, flag) << endl;\r
+ }\r
+ }\r
+ first = true;\r
+ foreach(AbstractInterface* iface, listBidirs) {\r
+ if(iface->getPurpose() == AbstractInterface::Data) {\r
+ if (first) {\r
+ out << " -- bidirs data ports" << endl;\r
+ first = false;\r
+ }\r
+ count--;\r
+ if (count == 0) flag = AbstractInterface::NoComma;\r
+ out << " " << iface->toVHDL(AbstractInterface::Entity, flag) << endl;\r
+ }\r
+ }\r
+ out << " );" << endl << endl;\r
+ out << "end " << name << ";" << endl << endl;\r
}\r
\r
void FunctionalBlock::generateArchitecture(QTextStream& out, QDomElement &elt ) throw(Exception) {\r
+ QString expr;\r
+ QString code = elt.text();\r
+ cout << qPrintable(code) << endl;\r
+ out << "architecture rtl of " << name << " is" << endl;\r
+\r
+ QStringList listLine = code.split("\n");\r
+ for(int i =0; i < listLine.size(); i++) {\r
+ QString line = listLine.at(i).simplified();\r
\r
+ /*\r
+ if(listLine.at(i).contains(QRegularExpression("@foreach{"))) {\r
+ while(listLine.at(i).compare("@endforeach") != -1) {\r
+ expr = expr + listLine.at(i) + '\n';\r
+ i++;\r
+ }\r
+ expr = expr + listLine.at(i);\r
+ out << evalComplex(expr, 1) << '\n';\r
+ }\r
+ if(listLine.at(i).contains(QRegularExpression("@caseeach{"))) {\r
+ while(listLine.at(i).compare("@endcaseeach") != -1) {\r
+ expr = expr + listLine.at(i) + '\n';\r
+ i++;\r
+ }\r
+ expr = expr + listLine.at(i);\r
+ out << evalComplex(expr, 2) << '\n';\r
+ }\r
+*/\r
+ if(line.contains("@{")) {\r
+ out << line << endl;\r
+ }\r
+ }\r
}\r
+\r
+void FunctionalBlock::generateController(QTextStream &out) throw(Exception) {\r
+ \r
+}\r
+\r
QTextStream outCore(&vhdlCore);
+ QDomElement dummyElt;
try {
- generateComments(outCore);
- generateLibraries(outCore);
+ generateComments(outCore,dummyElt,"");
+ generateLibraries(outCore,dummyElt);
generateEntity(outCore);
- generateArchitecture(outCore);
+ generateArchitecture(outCore,dummyElt);
}
catch(Exception err) {
throw(err);
}
-void GroupBlock::generateEntity(QTextStream& out) throw(Exception) {
+void GroupBlock::generateEntity(QTextStream& out, bool hasController) throw(Exception) {
int i;
}
+void GroupBlock::generateController(QTextStream &out) throw(Exception) {
+
+}
+
throw(Exception(INVALID_REFBLOCK_USE));
}
-void ReferenceBlock::generateEntity(QTextStream& out, bool hasController=false) throw(Exception) {
+void ReferenceBlock::generateEntity(QTextStream& out, bool hasController) throw(Exception) {
throw(Exception(INVALID_REFBLOCK_USE));
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 4.2.0, 2018-03-05T12:13:31. -->
+<!-- Written by QtCreator 4.2.0, 2018-03-21T17:45:46. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
- <value type="QByteArray">{94112477-caab-4897-8f75-5f412f2c883a}</value>
+ <value type="QByteArray">{3701e197-5b6c-48ea-9e98-a6cf6de18672}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
- <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
+ <value type="QByteArray" key="CurrentPreferences">qt2</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
- <value type="int" key="EditorConfiguration.IndentSize">4</value>
+ <value type="int" key="EditorConfiguration.IndentSize">2</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
- <value type="int" key="EditorConfiguration.TabSize">8</value>
- <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
+ <value type="int" key="EditorConfiguration.TabSize">4</value>
+ <value type="bool" key="EditorConfiguration.UseGlobal">false</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
- <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
+ <value type="bool" key="EditorConfiguration.cleanWhitespace">false</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{c934e180-ebc6-41ed-be82-502cc94f41f6}</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{ed04208c-8774-456b-99b9-4a02094ca7a4}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
- <value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
+ <value type="uint" key="Analyzer.QmlProfiler.FlushInterval">0</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value>
+ <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">false</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Executable</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Exécutable personnalisé</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>