-}\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.append(block->getName());\r
- controllerFile.append("_ctrl.vhd"); \r
- }\r
- else {\r
- controllerFile = "nofile.vhd"; \r
- }\r
- coreFile = path;\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(QDomElement &elt, QString coreFile, QTextStream& out) throw(Exception) {\r