-\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(QDomElement &elt, QString coreFile, QTextStream& out) throw(Exception) {\r
-\r
- for(int i = 0; i < 50; i++) {\r
- out << "--";\r
- }\r
- out << "\n--\n";\r
- QString fileName = coreFile;\r
- out << "-- File : " << fileName << "\n";\r
- out << "--\n";\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
- QDomElement eltDate = eltAuthor.nextSiblingElement("date");\r
- QString crea = eltDate.attribute("creation","");\r
- out << "-- Creation Date : "<<crea<<"\n";\r
- out << "--\n";\r
- QDomElement eltRelated = eltDate.nextSiblingElement("related_files");\r
- QString relateds = eltRelated.attribute("list","");\r
- out << "-- Related files :\n"<<relateds<<"\n";\r
- out << "--\n";\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
- 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
- for(int i = 0; i < 50; i++) {\r
- out << "--";\r
- }\r
- out << "\n\n";\r
-}\r
-\r
-// This function generates the library part of the VHDL document\r
-void BlockImplementation::generateLibraries(QDomElement &elt, QTextStream& out) 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", "");\r
- out << "library " << nameLib << ";\n";\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", "");\r
- QString usePack = elt.attribute("use","");\r
- out << "use " << nameLib << "." << namePack << "." << usePack << ";\n";\r
- }\r
- out << "\n";\r