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

Private GIT Repository
started top group gen, added project subdirs
[blast.git] / ReferenceBlock.cpp
index 037c64459ff8185ee0f05be5f09fd7c404019c55..70677dfa233020f9cfea9d9ee9b70c8e95a2dc81 100644 (file)
@@ -6,6 +6,7 @@
 #include "BlockParameterGeneric.h"
 #include "BlockParameterPort.h"
 #include "BlockParameterWishbone.h"
 #include "BlockParameterGeneric.h"
 #include "BlockParameterPort.h"
 #include "BlockParameterWishbone.h"
+#include "Parameters.h"
 
 ReferenceBlock::ReferenceBlock(const QString _xmlFile) : AbstractBlock() {
   xmlFile = _xmlFile;
 
 ReferenceBlock::ReferenceBlock(const QString _xmlFile) : AbstractBlock() {
   xmlFile = _xmlFile;
@@ -94,7 +95,7 @@ void ReferenceBlock::loadInformations(QDomElement &elt) throw(Exception) {
   }
   else {
     QDomText txtName = nodeNameTxt.toText();
   }
   else {
     QDomText txtName = nodeNameTxt.toText();
-    name = txtName.data().trimmed();
+    name = Parameters::normalizeName(txtName.data().trimmed());
     cout<< "block name : " << qPrintable(name) << endl;
   }
 
     cout<< "block name : " << qPrintable(name) << endl;
   }
 
@@ -104,11 +105,16 @@ void ReferenceBlock::loadInformations(QDomElement &elt) throw(Exception) {
 
   QString idsStr = eltCat.attribute("ids","none");
   if (idsStr == "none") throw (Exception(BLOCKFILE_CORRUPTED));
 
   QString idsStr = eltCat.attribute("ids","none");
   if (idsStr == "none") throw (Exception(BLOCKFILE_CORRUPTED));
-  QStringList listCat = idsStr.split(",");
-  foreach(QString str, listCat)
-  {
-    int idCat = str.toInt(&ok);
-    categories.append(idCat);
+  if (idsStr.isEmpty()) {
+    categories.append(99);
+  }
+  else {
+    QStringList listCat = idsStr.split(",");
+    foreach(QString str, listCat)
+    {
+      int idCat = str.toInt(&ok);
+      categories.append(idCat);
+    }
   }
 
   // getting description
   }
 
   // getting description
@@ -417,6 +423,7 @@ QDataStream& operator<<(QDataStream &out, const ReferenceBlock &b) {
     ReferenceInterface *iface = (ReferenceInterface *)(b.inputs.at(i));
     if (iface->getPurpose() == AbstractInterface::Control) {
       toWrite << iface->getName();
     ReferenceInterface *iface = (ReferenceInterface *)(b.inputs.at(i));
     if (iface->getPurpose() == AbstractInterface::Control) {
       toWrite << iface->getName();
+      toWrite << iface->getType();
       toWrite << iface->getWidth();
       toWrite << iface->getPurpose();
       toWrite << iface->getDirection();    
       toWrite << iface->getWidth();
       toWrite << iface->getPurpose();
       toWrite << iface->getDirection();    
@@ -428,6 +435,7 @@ QDataStream& operator<<(QDataStream &out, const ReferenceBlock &b) {
     ReferenceInterface *iface = (ReferenceInterface *)(b.inputs.at(i));
     if (iface->getPurpose() != AbstractInterface::Control) {
       toWrite << iface->getName();
     ReferenceInterface *iface = (ReferenceInterface *)(b.inputs.at(i));
     if (iface->getPurpose() != AbstractInterface::Control) {
       toWrite << iface->getName();
+      toWrite << iface->getType();
       toWrite << iface->getWidth();
       toWrite << iface->getPurpose();
       toWrite << iface->getDirection();    
       toWrite << iface->getWidth();
       toWrite << iface->getPurpose();
       toWrite << iface->getDirection();    
@@ -440,6 +448,7 @@ QDataStream& operator<<(QDataStream &out, const ReferenceBlock &b) {
     ReferenceInterface *iface = (ReferenceInterface *)(b.outputs.at(i));
     if (iface->getPurpose() == AbstractInterface::Control) {
       toWrite << iface->getName();
     ReferenceInterface *iface = (ReferenceInterface *)(b.outputs.at(i));
     if (iface->getPurpose() == AbstractInterface::Control) {
       toWrite << iface->getName();
+      toWrite << iface->getType();
       toWrite << iface->getWidth();
       toWrite << iface->getPurpose();
       toWrite << iface->getDirection();    
       toWrite << iface->getWidth();
       toWrite << iface->getPurpose();
       toWrite << iface->getDirection();    
@@ -451,6 +460,7 @@ QDataStream& operator<<(QDataStream &out, const ReferenceBlock &b) {
     ReferenceInterface *iface = (ReferenceInterface *)(b.outputs.at(i));
     if (iface->getPurpose() != AbstractInterface::Control) {
       toWrite << iface->getName();
     ReferenceInterface *iface = (ReferenceInterface *)(b.outputs.at(i));
     if (iface->getPurpose() != AbstractInterface::Control) {
       toWrite << iface->getName();
+      toWrite << iface->getType();
       toWrite << iface->getWidth();
       toWrite << iface->getPurpose();
       toWrite << iface->getDirection();    
       toWrite << iface->getWidth();
       toWrite << iface->getPurpose();
       toWrite << iface->getDirection();    
@@ -461,6 +471,7 @@ QDataStream& operator<<(QDataStream &out, const ReferenceBlock &b) {
   for(int i=0; i<b.bidirs.size(); i++){
     ReferenceInterface *iface = (ReferenceInterface *)(b.bidirs.at(i));
     toWrite << iface->getName();
   for(int i=0; i<b.bidirs.size(); i++){
     ReferenceInterface *iface = (ReferenceInterface *)(b.bidirs.at(i));
     toWrite << iface->getName();
+    toWrite << iface->getType();
     toWrite << iface->getWidth();
     toWrite << iface->getPurpose();
     toWrite << iface->getDirection();    
     toWrite << iface->getWidth();
     toWrite << iface->getPurpose();
     toWrite << iface->getDirection();    
@@ -535,6 +546,9 @@ QDataStream& operator>>(QDataStream &in, ReferenceBlock &b) {
     iface = new ReferenceInterface(&b);
     in >> txt;
     iface->setName(txt);
     iface = new ReferenceInterface(&b);
     in >> txt;
     iface->setName(txt);
+    int type;
+    in >> type;
+    iface->setType(type);
     in >> txt;
     iface->setWidth(txt);
     in >> val;
     in >> txt;
     iface->setWidth(txt);
     in >> val;
@@ -561,6 +575,9 @@ QDataStream& operator>>(QDataStream &in, ReferenceBlock &b) {
     iface = new ReferenceInterface(&b);
     in >> txt;
     iface->setName(txt);
     iface = new ReferenceInterface(&b);
     in >> txt;
     iface->setName(txt);
+    int type;
+    in >> type;
+    iface->setType(type);
     in >> txt;
     iface->setWidth(txt);
     in >> val;
     in >> txt;
     iface->setWidth(txt);
     in >> val;
@@ -587,6 +604,9 @@ QDataStream& operator>>(QDataStream &in, ReferenceBlock &b) {
     iface = new ReferenceInterface(&b);
     in >> txt;
     iface->setName(txt);
     iface = new ReferenceInterface(&b);
     in >> txt;
     iface->setName(txt);
+    int type;
+    in >> type;
+    iface->setType(type);
     in >> txt;
     iface->setWidth(txt);
     in >> val;
     in >> txt;
     iface->setWidth(txt);
     in >> val;
@@ -609,3 +629,34 @@ void ReferenceBlock::computeOutputPattern(int nbExec)  throw(Exception) {
   // does strictly nothing
   throw(Exception(INVALID_REFBLOCK_USE));  
 }
   // does strictly nothing
   throw(Exception(INVALID_REFBLOCK_USE));  
 }
+
+void ReferenceBlock::computeAdmittanceDelays() throw(Exception) {
+  // does strictly nothing
+  throw(Exception(INVALID_REFBLOCK_USE));
+}
+
+
+void ReferenceBlock::generateVHDL(const QString& path) throw(Exception){
+ throw(Exception(INVALID_REFBLOCK_USE));
+}
+
+void ReferenceBlock::generateComments(QTextStream& out, QDomElement &elt, QString coreFile) throw(Exception) {
+  throw(Exception(INVALID_REFBLOCK_USE));
+}
+
+void ReferenceBlock::generateLibraries(QTextStream& out, QDomElement &elt) throw(Exception) {
+  throw(Exception(INVALID_REFBLOCK_USE));
+}
+
+void ReferenceBlock::generateEntity(QTextStream& out, bool hasController) throw(Exception) {
+  throw(Exception(INVALID_REFBLOCK_USE));
+}
+
+void ReferenceBlock::generateArchitecture(QTextStream& out, QDomElement &elt ) throw(Exception) {
+  throw(Exception(INVALID_REFBLOCK_USE));
+}
+
+void ReferenceBlock::generateController(QTextStream& out) throw(Exception) {
+  throw(Exception(INVALID_REFBLOCK_USE));
+}
+