]> AND Private Git Repository - blast.git/commitdiff
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
changed name of the class that converts VHDL -> XML
authorstephane Domas <stephane.domas@univ-fcomte.fr>
Fri, 13 Oct 2017 14:26:10 +0000 (16:26 +0200)
committerstephane Domas <stephane.domas@univ-fcomte.fr>
Fri, 13 Oct 2017 14:26:10 +0000 (16:26 +0200)
BlockWidget.h [deleted file]
Exception.cpp
Exception.h
MainWindow.cpp
MainWindow.h
Makefile.in
VHDLConverter.cpp [moved from BlockWidget.cpp with 64% similarity]
VHDLConverter.h [new file with mode: 0644]
blast.creator.user
blast.files
object-files.txt

diff --git a/BlockWidget.h b/BlockWidget.h
deleted file mode 100644 (file)
index 9150928..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef ENTITYWIDGET_H\r
-#define ENTITYWIDGET_H\r
-\r
-#include <QtGui>\r
-#include <QtWidgets>\r
-#include <QtCore>\r
-#include <QtXml>\r
-#include <iostream>\r
-#include <fstream>\r
-#include <QTextStream>\r
-\r
-#include "Parameters.h"\r
-#include "BlockParameter.h"\r
-#include "Graph.h"\r
-\r
-class BlockWidget : public QWidget\r
-{\r
-    Q_OBJECT\r
-public:\r
-    explicit BlockWidget(QWidget *parent = 0);\r
-    ~BlockWidget();\r
-\r
-private:\r
-    QPushButton *loadBt, *genBt;\r
-    int cptIn, cptOut, cptInout, cpt;\r
-    QRegExp *rxPort, *rxEnt, *rxArch, *rxComp, *rxComment, *rxComma,\r
-    *rxEndComp, *rxEnd, *rxGeneric, *rxEndGen, *rxGen, *rxConst, *rxWidth;\r
-    QString fileName, txt, s, entName, brief, desc;\r
-    QScrollArea *scrollPort, *scrollGen;\r
-    QWidget *wid;\r
-    QLabel *labelAppli, *lblBrief, *lblDesc, *lblName, *lblPort, *lblGen;\r
-    QTableWidget *twPort, *twGen;\r
-    QTextEdit *teBrief, *teDesc, *teName;\r
-\r
-signals:\r
-\r
-public slots:\r
-    void loadCode();\r
-    void generateXml();\r
-};\r
-\r
-#endif // ENTITYWIDGET_H\r
index a051e7ac7f07f713bc5a63f58b11adf719705903..4036dac6cb765e949d52e280920fe4c0d5d789f5 100644 (file)
@@ -27,6 +27,8 @@ QString Exception::getDefaultMessage() {
   case IMPLFILE_NOPATTERN : ret = tr("Implementation file does not contains pattern definitions"); break;
   case BLOCK_NULL : ret = tr("A parameter of type AbstractBlock* has been provided with NULL value."); break;
   case BLOCK_INVALID_TYPE : ret = tr("A parameter of type AbstractBlock* is used with an incorrect instance type."); break;
   case IMPLFILE_NOPATTERN : ret = tr("Implementation file does not contains pattern definitions"); break;
   case BLOCK_NULL : ret = tr("A parameter of type AbstractBlock* has been provided with NULL value."); break;
   case BLOCK_INVALID_TYPE : ret = tr("A parameter of type AbstractBlock* is used with an incorrect instance type."); break;
+  case VHDLFILE_NOACCESS : ret = tr("VHDL file cannot be read"); break;
+  case VHDLFILE_CORRUPTED : ret = tr("VHDL file is corrupted"); break;
   case IFACE_NULL : ret = tr("A parameter of type AbstractInterface* has been provided with NULL value."); break;
   case IFACE_INVALID_TYPE : ret = tr("A parameter of type AbstractInterface* is used with an incorrect instance type."); break;
   case IFACE_MULTIPLICITY_REACHED : ret = tr("Impossible to create another instance of a GraphInterface: the maximum multiplicity is reached."); break;
   case IFACE_NULL : ret = tr("A parameter of type AbstractInterface* has been provided with NULL value."); break;
   case IFACE_INVALID_TYPE : ret = tr("A parameter of type AbstractInterface* is used with an incorrect instance type."); break;
   case IFACE_MULTIPLICITY_REACHED : ret = tr("Impossible to create another instance of a GraphInterface: the maximum multiplicity is reached."); break;
index 3972d4ea302f0fd60c1913114273464cbd0160b4..ce2ea728bfccde526130f06400293c1eec0cf381 100644 (file)
@@ -34,6 +34,7 @@ supp. infos : saved in UTF-8 [éè]
 #define IMPLFILE_NOPATTERN 403
 
 #define VHDLFILE_NOACCESS 501
 #define IMPLFILE_NOPATTERN 403
 
 #define VHDLFILE_NOACCESS 501
+#define VHDLFILE_CORRUPTED 502
 
 #define BLOCKPATH_NOACCESS 601
 
 
 #define BLOCKPATH_NOACCESS 601
 
index e7724255ddb2be2854b9a063a2e3df2dd385b736..38ec48a4749efb203588129c960e63eb0dcb24e9 100644 (file)
@@ -4,7 +4,7 @@
 #include "BlockLibraryWidget.h"
 #include "GroupWidget.h"
 #include "GroupScene.h"
 #include "BlockLibraryWidget.h"
 #include "GroupWidget.h"
 #include "GroupScene.h"
-#include "BlockWidget.h"
+#include "VHDLConverter.h"
 #include "AbstractBoxItem.h"
 #include "Graph.h"
 #include "GroupItem.h"
 #include "AbstractBoxItem.h"
 #include "Graph.h"
 #include "GroupItem.h"
@@ -343,7 +343,7 @@ bool MainWindow::slotCloseProject(){
 
 
 void MainWindow::slotNewBlockWidget() {
 
 
 void MainWindow::slotNewBlockWidget() {
-  new BlockWidget();
+  new VHDLConverter();
 }
 
 void MainWindow::slotSaveProject(){
 }
 
 void MainWindow::slotSaveProject(){
index 2dee56c9a236b48cde3343c7698343dece5bc474..99858c8d0137e26151c2a2b380456410d7eb666a 100644 (file)
@@ -12,7 +12,7 @@ class Dispatcher;
 class Parameters;
 class BlockLibraryWidget;
 class GroupWidget;
 class Parameters;
 class BlockLibraryWidget;
 class GroupWidget;
-class BlockWidget;
+class VHDLConverter;
 class Graph;
 
 // versioning related
 class Graph;
 
 // versioning related
index 0801e938a8c3f583b1bb591a34cfc5fb7d3002ad..ab2cc125b82429e806342458a89f34ca6d52c8f5 100644 (file)
@@ -58,7 +58,7 @@ CXXFLAGS     = $(CXXFLAGS-$(OS)$(ARCH))
 
 INCPATH-lin64-qt4       = -I/usr/share/qt4/mkspecs/linux-g++ -I$(QTPATH)/QtCore -I$(QTPATH)/QtGui -I$(QTPATH)/QtNetwork -I$(QTPATH)/QtXml -I$(QTPATH)/QtXmlPatterns -I$(QTPATH)
 INCPATH-lin64-qt5       = -I$(QTPATH)/mkspecs/linux-g++-64 -I$(QTPATH) -I$(QTPATH)/QtWidgets -I$(QTPATH)/QtCore -I$(QTPATH)/QtGui -I$(QTPATH)/QtPrintSupport -I$(QTPATH)/QtNetwork -I$(QTPATH)/QtXml -I$(QTPATH)/QtXmlPatterns 
 
 INCPATH-lin64-qt4       = -I/usr/share/qt4/mkspecs/linux-g++ -I$(QTPATH)/QtCore -I$(QTPATH)/QtGui -I$(QTPATH)/QtNetwork -I$(QTPATH)/QtXml -I$(QTPATH)/QtXmlPatterns -I$(QTPATH)
 INCPATH-lin64-qt5       = -I$(QTPATH)/mkspecs/linux-g++-64 -I$(QTPATH) -I$(QTPATH)/QtWidgets -I$(QTPATH)/QtCore -I$(QTPATH)/QtGui -I$(QTPATH)/QtPrintSupport -I$(QTPATH)/QtNetwork -I$(QTPATH)/QtXml -I$(QTPATH)/QtXmlPatterns 
-INCPATH-win32-qt5       = -I$(QTPATH)/mkspecs/win32-g++ -I$(QTPATH)/include -I$(QTPATH)/include/ActiveQt -I$(QTPATH)/include/QtWidgets -I$(QTPATH)/include/QtGui -I$(QTPATH)/include/QtCore -I$(QTPATH)/include/QtXml -I$(QTPATH)/include/QtXmlPatterns -I$(QTPATH)/include/QtPrintSupport
+INCPATH-win32-qt5       = -I$(QTPATH)/mkspecs/win32-g++ -I$(QTPATH)/include -I$(QTPATH)/include/ActiveQt -I$(QTPATH)/include/QtWidgets -I$(QTPATH)/include/QtGui -I$(QTPATH)/include/QtCore -I$(QTPATH)/inlucde/QtNetwork -I$(QTPATH)/include/QtXml -I$(QTPATH)/include/QtXmlPatterns -I$(QTPATH)/include/QtPrintSupport
 
 INCPATH       = $(INCPATH-$(OS)$(ARCH)-qt$(QTVER)) -I.
 
 
 INCPATH       = $(INCPATH-$(OS)$(ARCH)-qt$(QTVER)) -I.
 
similarity index 64%
rename from BlockWidget.cpp
rename to VHDLConverter.cpp
index 3b8a658e437895adaaa9d3cc0c9399516c2b39d6..d32ab152c0a6ce43f2c6bdc4f97bb8ffe57eb948 100644 (file)
@@ -1,10 +1,9 @@
-#include "BlockWidget.h"\r
+#include "VHDLConverter.h"\r
 \r
 using namespace std;\r
 using namespace Qt;\r
 \r
 \r
 using namespace std;\r
 using namespace Qt;\r
 \r
-BlockWidget::BlockWidget(QWidget *parent) : QWidget(parent)\r
-{\r
+VHDLConverter::VHDLConverter(QWidget *parent) : QWidget(parent) {\r
 \r
     rxComment = new QRegExp("(.*)--.*");\r
     rxComma = new QRegExp("(.*)[;]");\r
 \r
     rxComment = new QRegExp("(.*)--.*");\r
     rxComma = new QRegExp("(.*)[;]");\r
@@ -19,21 +18,23 @@ BlockWidget::BlockWidget(QWidget *parent) : QWidget(parent)
     rxGen = new QRegExp("[\\s\\t]*(.*)[\\s\\t]*:[\\s\\t]*(.*)[\\s\\t]*:=[\\s\\t]*(.*)",CaseInsensitive,QRegExp::RegExp);\r
     rxConst = new QRegExp("[\\s\\t]*constant[\\s\\t]*(.*)[\\s\\t]*:[\\s\\t]*(.)*[\\s\\t]*:=[\\s\\t]*(.*)",CaseInsensitive,QRegExp::RegExp);\r
     rxWidth = new QRegExp(".*[(](.*)(downto|to)(.*)[)]",CaseInsensitive,QRegExp::RegExp);\r
     rxGen = new QRegExp("[\\s\\t]*(.*)[\\s\\t]*:[\\s\\t]*(.*)[\\s\\t]*:=[\\s\\t]*(.*)",CaseInsensitive,QRegExp::RegExp);\r
     rxConst = new QRegExp("[\\s\\t]*constant[\\s\\t]*(.*)[\\s\\t]*:[\\s\\t]*(.)*[\\s\\t]*:=[\\s\\t]*(.*)",CaseInsensitive,QRegExp::RegExp);\r
     rxWidth = new QRegExp(".*[(](.*)(downto|to)(.*)[)]",CaseInsensitive,QRegExp::RegExp);\r
+    \r
+    QLabel *labelAppli, *lblBrief, *lblDesc, *lblName, *lblPort, *lblGen;\r
 \r
 \r
-    loadBt = new QPushButton("load VHDL");\r
-    genBt = new QPushButton("generate XML");\r
+    loadBut = new QPushButton("load VHDL");\r
+    genBut = new QPushButton("generate XML");\r
     QHBoxLayout *widgetLayout = new QHBoxLayout;\r
     QVBoxLayout *left = new QVBoxLayout;\r
     QVBoxLayout *right = new QVBoxLayout;\r
 \r
     QHBoxLayout *widgetLayout = new QHBoxLayout;\r
     QVBoxLayout *left = new QVBoxLayout;\r
     QVBoxLayout *right = new QVBoxLayout;\r
 \r
-    scrollPort = new QScrollArea;\r
-    scrollPort->setWidgetResizable(true);\r
-    twPort = new QTableWidget(this);\r
-    scrollPort->setWidget(twPort);\r
-    scrollGen = new QScrollArea;\r
-    scrollGen->setWidgetResizable(true);\r
-    twGen = new QTableWidget(this);\r
-    scrollGen->setWidget(twGen);\r
+    scrollDataPort = new QScrollArea;\r
+    scrollDataPort->setWidgetResizable(true);\r
+    twDataPort = new QTableWidget(this);\r
+    scrollDataPort->setWidget(twDataPort);\r
+    scrollGenerics = new QScrollArea;\r
+    scrollGenerics->setWidgetResizable(true);\r
+    twGenerics = new QTableWidget(this);\r
+    scrollGenerics->setWidget(twGenerics);\r
     teName = new QTextEdit;\r
     teBrief = new QTextEdit;\r
     teDesc = new QTextEdit;\r
     teName = new QTextEdit;\r
     teBrief = new QTextEdit;\r
     teDesc = new QTextEdit;\r
@@ -43,14 +44,14 @@ BlockWidget::BlockWidget(QWidget *parent) : QWidget(parent)
     lblPort = new QLabel("Ports :");\r
     lblGen = new QLabel("Generics :");\r
 \r
     lblPort = new QLabel("Ports :");\r
     lblGen = new QLabel("Generics :");\r
 \r
-    connect(loadBt, SIGNAL(clicked()),this, SLOT(loadCode()));\r
-    connect(genBt, SIGNAL(clicked()), this, SLOT(generateXml()));\r
+    connect(loadBut, SIGNAL(clicked()),this, SLOT(loadVHDLFile()));\r
+    connect(genBut, SIGNAL(clicked()), this, SLOT(generateXml()));\r
 \r
 \r
-    left->addWidget(loadBt);\r
+    left->addWidget(loadBut);\r
     left->addWidget(lblPort);\r
     left->addWidget(lblPort);\r
-    left->addWidget(scrollPort);\r
+    left->addWidget(scrollDataPort);\r
     left->addWidget(lblGen);\r
     left->addWidget(lblGen);\r
-    left->addWidget(scrollGen);\r
+    left->addWidget(scrollGenerics);\r
 \r
     right->addWidget(lblName);\r
     right->addWidget(teName);\r
 \r
     right->addWidget(lblName);\r
     right->addWidget(teName);\r
@@ -58,7 +59,7 @@ BlockWidget::BlockWidget(QWidget *parent) : QWidget(parent)
     right->addWidget(teBrief);\r
     right->addWidget(lblDesc);\r
     right->addWidget(teDesc);\r
     right->addWidget(teBrief);\r
     right->addWidget(lblDesc);\r
     right->addWidget(teDesc);\r
-    right->addWidget(genBt);\r
+    right->addWidget(genBut);\r
 \r
     widgetLayout->addLayout(left);\r
     widgetLayout->addLayout(right);\r
 \r
     widgetLayout->addLayout(left);\r
     widgetLayout->addLayout(right);\r
@@ -66,23 +67,116 @@ BlockWidget::BlockWidget(QWidget *parent) : QWidget(parent)
     show();\r
 }\r
 \r
     show();\r
 }\r
 \r
-BlockWidget::~BlockWidget()\r
-{\r
+VHDLConverter::~VHDLConverter() {\r
 \r
 }\r
 \r
 \r
 }\r
 \r
+QString VHDLConverter::skipBlankAndComments(QTextStream &in) {\r
+  \r
+  QString line = "";\r
+  \r
+ // skipping blank/comment lines \r
+  while ( (line.isEmpty()) || ((line.at(0) == '-') && (line.at(1) == '-')) ) {\r
+    if (in.atEnd()) {\r
+      return "";\r
+    }\r
+    line = in.readLine();\r
+    if (!line.isEmpty()) line = line.trimmed();\r
+  }  \r
+  return line;\r
+}\r
+\r
+void VHDLConverter::readLibraries(QTextStream &in) throw(Exception) {\r
+  \r
+  QRegularExpression rxLib("^library[\\s\\t]*(.+);$",QRegularExpression::CaseInsensitiveOption);\r
+  QRegularExpression rxPack("^use[\\s\\t]*([^.]+)[.](.+);$",QRegularExpression::CaseInsensitiveOption);\r
+  QString line = "";\r
+  \r
+  line = skipBlankAndComments(in);\r
+  if (line == "") {\r
+    throw(Exception(VHDLFILE_CORRUPTED));\r
+  }    \r
+  \r
+  while (! line.contains("entity",Qt::CaseInsensitive)) {\r
+    \r
+    QRegularExpressionMatch matchLib = rxLib.match(line);\r
+    QRegularExpressionMatch matchPack = rxPack.match(line);\r
+    \r
+    if (matchLib.hasMatch()) {\r
+      \r
+      QString libName = matchLib.captured(1);\r
+      libName = libName.toLower();\r
+      \r
+      cout << "matching library: " << qPrintable(libName) << endl;      \r
+      \r
+      if (!packages.contains(libName)) {        \r
+        packages.insert(libName,new QList<QString>());      \r
+      }      \r
+    }\r
+    else if (matchPack.hasMatch()) {\r
+      cout << "matching packages" << endl;\r
+      \r
+      QString libName = matchPack.captured(1);\r
+      QString packName = matchPack.captured(2);      \r
+      \r
+      libName = libName.toLower();\r
+      packName = packName.toLower();      \r
+            \r
+      if (libName == "work") {\r
+        if (!packages.contains("work")) {\r
+          packages.insert("work",new QList<QString>());\r
+        }\r
+      }\r
+      else if (libName == "std") {\r
+        if (!packages.contains("std")) {\r
+          packages.insert("std",new QList<QString>());\r
+        }\r
+      }\r
+      else if (!packages.contains(libName)) throw(Exception(VHDLFILE_CORRUPTED));\r
+      \r
+      QList<QString>* lstPack = packages.value(libName);\r
+      QString s = libName + "." + packName;      \r
+      lstPack->append(s);\r
+      cout << qPrintable(s) << endl;\r
+      \r
+    }\r
+    \r
+    line = skipBlankAndComments(in);\r
+    if (line == "") {\r
+      throw(Exception(VHDLFILE_CORRUPTED));\r
+    }\r
+    cout << "read line = " << qPrintable(line) << endl;\r
+  }\r
+}\r
+\r
+void VHDLConverter::readEntity(QTextStream &in) throw(Exception) {\r
+  \r
+}\r
+\r
+void VHDLConverter::readGenerics(QTextStream &in) throw(Exception) {\r
+  \r
+}\r
+\r
+void VHDLConverter::readPorts(QTextStream &in) throw(Exception) {\r
+  \r
+}\r
+\r
+void VHDLConverter::readArchitecture(QTextStream &in) throw(Exception) {\r
+  \r
+}\r
+\r
 // This function opens a VHDL file and get the informations about the entity :\r
 // First the generics, then the signals.\r
 // You can edit the descriptions in the right, one for the brief description, the other for the detailled.\r
 // This function opens a VHDL file and get the informations about the entity :\r
 // First the generics, then the signals.\r
 // You can edit the descriptions in the right, one for the brief description, the other for the detailled.\r
-void BlockWidget::loadCode() {\r
+void VHDLConverter::loadVHDLFile() {\r
 \r
     QString line, portName, portType, portId, genName, genType, genValue;\r
     QStringList *portNameList, *portTypeList, *portIdList, *genNameList, *genTypeList, *genValueList;\r
     cpt = 0;\r
 \r
     QString line, portName, portType, portId, genName, genType, genValue;\r
     QStringList *portNameList, *portTypeList, *portIdList, *genNameList, *genTypeList, *genValueList;\r
     cpt = 0;\r
-    twPort->setColumnCount(3);\r
-    twPort->setRowCount(cpt);\r
-    twGen->setColumnCount(3);\r
-    twGen->setRowCount(cpt);\r
+    twDataPort->setColumnCount(3);\r
+    twDataPort->setRowCount(cpt);\r
+    twGenerics->setColumnCount(3);\r
+    twGenerics->setRowCount(cpt);\r
     portNameList = new QStringList;\r
     portTypeList = new QStringList;\r
     portIdList = new QStringList;\r
     portNameList = new QStringList;\r
     portTypeList = new QStringList;\r
     portIdList = new QStringList;\r
@@ -97,6 +191,10 @@ void BlockWidget::loadCode() {
     if(!file.open(QIODevice::ReadOnly | QIODevice::Text))\r
         return;\r
     QTextStream ts(&file);\r
     if(!file.open(QIODevice::ReadOnly | QIODevice::Text))\r
         return;\r
     QTextStream ts(&file);\r
+    \r
+    readLibraries(ts);\r
+    \r
+    /*\r
     while (!ts.atEnd())\r
     {\r
         line = ts.readLine();\r
     while (!ts.atEnd())\r
     {\r
         line = ts.readLine();\r
@@ -156,27 +254,28 @@ void BlockWidget::loadCode() {
             }\r
         }\r
     }\r
             }\r
         }\r
     }\r
+    */\r
 \r
 \r
-    twGen->setRowCount(genNameList->size());\r
+    twGenerics->setRowCount(genNameList->size());\r
     for(int i = 0; i < genNameList->size(); i++) {\r
     for(int i = 0; i < genNameList->size(); i++) {\r
-        twGen->setItem(i, 0, new QTableWidgetItem(genNameList->at(i)));\r
-        twGen->setItem(i, 1, new QTableWidgetItem(genTypeList->at(i)));\r
-        twGen->setItem(i, 2, new QTableWidgetItem(genValueList->at(i)));\r
+        twGenerics->setItem(i, 0, new QTableWidgetItem(genNameList->at(i)));\r
+        twGenerics->setItem(i, 1, new QTableWidgetItem(genTypeList->at(i)));\r
+        twGenerics->setItem(i, 2, new QTableWidgetItem(genValueList->at(i)));\r
     }\r
     }\r
-    twPort->setRowCount(portNameList->size());\r
+    twDataPort->setRowCount(portNameList->size());\r
     for(int i = 0; i < portNameList->size(); i++) {\r
     for(int i = 0; i < portNameList->size(); i++) {\r
-        twPort->setItem(i, 0, new QTableWidgetItem(portIdList->at(i)));\r
-        twPort->setItem(i, 1, new QTableWidgetItem(portNameList->at(i)));\r
-        twPort->setItem(i, 2, new QTableWidgetItem(portTypeList->at(i)));\r
+        twDataPort->setItem(i, 0, new QTableWidgetItem(portIdList->at(i)));\r
+        twDataPort->setItem(i, 1, new QTableWidgetItem(portNameList->at(i)));\r
+        twDataPort->setItem(i, 2, new QTableWidgetItem(portTypeList->at(i)));\r
     }\r
 \r
     file.close();\r
     }\r
 \r
     file.close();\r
-    scrollPort->setWidget(twPort);\r
+    scrollDataPort->setWidget(twDataPort);\r
     return;\r
 }\r
 \r
 // This function gets the informations in the table and the descriptions, and creates a XML file with this content\r
     return;\r
 }\r
 \r
 // This function gets the informations in the table and the descriptions, and creates a XML file with this content\r
-void BlockWidget::generateXml() {\r
+void VHDLConverter::generateXml() {\r
 \r
     QString portName, portType, portId, genName, genType, genValue;\r
     QStringList *portNameList, *portTypeList, *portIdList, *genNameList, *genTypeList, *genValueList;\r
 \r
     QString portName, portType, portId, genName, genType, genValue;\r
     QStringList *portNameList, *portTypeList, *portIdList, *genNameList, *genTypeList, *genValueList;\r
@@ -191,16 +290,16 @@ void BlockWidget::generateXml() {
     genNameList = new QStringList;\r
     genTypeList = new QStringList;\r
     genValueList = new QStringList;\r
     genNameList = new QStringList;\r
     genTypeList = new QStringList;\r
     genValueList = new QStringList;\r
-    for(int i = 0; i < twGen->rowCount(); i++) {\r
-        genNameList->append(twGen->item(i,0)->text());\r
-        genTypeList->append(twGen->item(i,1)->text());\r
-        genValueList->append(twGen->item(i,2)->text());\r
+    for(int i = 0; i < twGenerics->rowCount(); i++) {\r
+        genNameList->append(twGenerics->item(i,0)->text());\r
+        genTypeList->append(twGenerics->item(i,1)->text());\r
+        genValueList->append(twGenerics->item(i,2)->text());\r
     }\r
 \r
     }\r
 \r
-    for(int i = 0; i < twPort->rowCount(); i++) {\r
-        portIdList->append(twPort->item(i,0)->text());\r
-        portNameList->append(twPort->item(i,1)->text());\r
-        portTypeList->append(twPort->item(i,2)->text());\r
+    for(int i = 0; i < twDataPort->rowCount(); i++) {\r
+        portIdList->append(twDataPort->item(i,0)->text());\r
+        portNameList->append(twDataPort->item(i,1)->text());\r
+        portTypeList->append(twDataPort->item(i,2)->text());\r
     }\r
 \r
     QDomDocument doc (entName);\r
     }\r
 \r
     QDomDocument doc (entName);\r
@@ -239,7 +338,7 @@ void BlockWidget::generateXml() {
     interfaces.appendChild(outputs);\r
     interfaces.appendChild(bidirs);\r
 \r
     interfaces.appendChild(outputs);\r
     interfaces.appendChild(bidirs);\r
 \r
-    for(int i = 0; i < twGen->rowCount(); i++) {\r
+    for(int i = 0; i < twGenerics->rowCount(); i++) {\r
         genName = genNameList->at(i);\r
         genType = genTypeList->at(i);\r
         genValue = genValueList->at(i);\r
         genName = genNameList->at(i);\r
         genType = genTypeList->at(i);\r
         genValue = genValueList->at(i);\r
diff --git a/VHDLConverter.h b/VHDLConverter.h
new file mode 100644 (file)
index 0000000..7ddce3d
--- /dev/null
@@ -0,0 +1,70 @@
+#ifndef __VHDLCONVERTER_H__\r
+#define __VHDLCONVERTER_H__\r
+\r
+\r
+#include <QtGui>\r
+#include <QtWidgets>\r
+#include <QtCore>\r
+#include <QtXml>\r
+#include <iostream>\r
+#include <fstream>\r
+#include <QTextStream>\r
+\r
+#include "Parameters.h"\r
+#include "Exception.h"\r
+\r
+class VHDLConverter : public QWidget {\r
+    Q_OBJECT\r
+public:\r
+    explicit VHDLConverter(QWidget *parent = 0);\r
+    ~VHDLConverter();\r
+\r
+private:\r
+    QPushButton* loadBut;\r
+    QPushButton* genBut;\r
+    \r
+    // clk & rst ports related\r
+    QTextEdit* clkNameEdit;\r
+    QTextEdit* rstNameEdit;\r
+    QComboBox* clkCombo;\r
+    QComboBox* rstCombo;\r
+    \r
+    // data ports related\r
+    QScrollArea *scrollDataPort;        \r
+    QTableWidget* twDataPort;\r
+    \r
+    // wishbone ports related\r
+    QScrollArea *scrollWBPort;        \r
+    QTableWidget* twWBPort;\r
+    \r
+    // generics related\r
+    QScrollArea* scrollGenerics;    \r
+    QTableWidget* twGenerics;\r
+    \r
+    int cptIn, cptOut, cptInout, cpt;\r
+    QRegExp *rxPort, *rxEnt, *rxArch, *rxComp, *rxComment, *rxComma,\r
+    *rxEndComp, *rxEnd, *rxGeneric, *rxEndGen, *rxGen, *rxConst, *rxWidth;\r
+    QString fileName, txt, s, entName, brief, desc;        \r
+    \r
+    QHash<QString,QList<QString>* > packages;\r
+    \r
+    QWidget *wid;\r
+    \r
+    QTextEdit *teBrief, *teDesc, *teName;\r
+\r
+    void readLibraries(QTextStream& in) throw(Exception);\r
+    void readEntity(QTextStream& in) throw(Exception);\r
+    void readGenerics(QTextStream& in) throw(Exception);\r
+    void readPorts(QTextStream& in) throw(Exception);\r
+    void readArchitecture(QTextStream& in) throw(Exception);\r
+    \r
+    QString skipBlankAndComments(QTextStream& in);\r
+    \r
+signals:\r
+\r
+public slots:\r
+    void loadVHDLFile();\r
+    void generateXml();\r
+};\r
+\r
+#endif // __VHDLCONVERTER_H__\r
index 0f7c2537e670768969cdf156b48d1ce665c0039b..95274beb96c4f253fc5228f25a17e246eb55bee1 100755 (executable)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE QtCreatorProject>
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 3.2.1, 2017-05-23T17:26:50. -->
+<!-- Written by QtCreator 4.2.0, 2017-10-13T10:38:54. -->
 <qtcreator>
  <data>
   <variable>EnvironmentId</variable>
 <qtcreator>
  <data>
   <variable>EnvironmentId</variable>
@@ -40,6 +40,7 @@
    <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
    <value type="bool" key="EditorConfiguration.ShowMargin">false</value>
    <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
    <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
    <value type="bool" key="EditorConfiguration.ShowMargin">false</value>
    <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</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">4</value>
    <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
    <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
    <value type="int" key="EditorConfiguration.TabSize">4</value>
    <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
    <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
    <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
    <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
    <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
    <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">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"/>
     <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
     <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
     <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
     <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
     <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
  </data>
  <data>
   <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
  </data>
  <data>
   <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
-  <value type="int">16</value>
+  <value type="int">18</value>
  </data>
  <data>
   <variable>Version</variable>
  </data>
  <data>
   <variable>Version</variable>
-  <value type="int">16</value>
+  <value type="int">18</value>
  </data>
 </qtcreator>
  </data>
 </qtcreator>
index 3975c5fbba1463b07c7547c715b66c8c298496aa..1dbb3f165ea95e168b25ae18a013c4c68022c46b 100755 (executable)
@@ -26,6 +26,8 @@ GroupInterface.h
 GroupInterface.cpp
 BlockLibraryWidget.cpp
 BlockLibraryWidget.h
 GroupInterface.cpp
 BlockLibraryWidget.cpp
 BlockLibraryWidget.h
+VHDLConverter.cpp
+VHDLConverter.h
 blast.cpp
 BlockCategory.cpp
 BlockCategory.h
 blast.cpp
 BlockCategory.cpp
 BlockCategory.h
@@ -63,8 +65,6 @@ Abstractblockitem.h
 Abstractblockitem.cpp
 GroupWidget.h
 GroupWidget.cpp
 Abstractblockitem.cpp
 GroupWidget.h
 GroupWidget.cpp
-BlockWidget.cpp
-BlockWidget.h
 BlocksToConfigureWidget.h
 BlocksToConfigureWidget.cpp
 ParametersWindow.h
 BlocksToConfigureWidget.h
 BlocksToConfigureWidget.cpp
 ParametersWindow.h
index 704e9218b1acfba300052bdb364533714be52ea2..b46c2d8876b7dfe40050871fcc0e8c5419c405cb 100644 (file)
@@ -31,8 +31,8 @@ COMMON-OBJ = $(BUILDPATH)/AbstractBlock.o \
           $(BUILDPATH)/MainWindow.o \
           $(BUILDPATH)/moc_MainWindow.o \
           $(BUILDPATH)/ArithmeticEvaluator.o \
           $(BUILDPATH)/MainWindow.o \
           $(BUILDPATH)/moc_MainWindow.o \
           $(BUILDPATH)/ArithmeticEvaluator.o \
-          $(BUILDPATH)/BlockWidget.o \
-          $(BUILDPATH)/moc_BlockWidget.o \
+          $(BUILDPATH)/VHDLConverter.o \
+          $(BUILDPATH)/moc_VHDLConverter.o \
           $(BUILDPATH)/GroupWidget.o \
           $(BUILDPATH)/moc_GroupWidget.o \
           $(BUILDPATH)/Parameters.o \
           $(BUILDPATH)/GroupWidget.o \
           $(BUILDPATH)/moc_GroupWidget.o \
           $(BUILDPATH)/Parameters.o \