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

Private GIT Repository
adding show/hide wb ifaces
[blast.git] / ReferenceBlock.cpp
index a0a8220d297e10043a7a4d975999e4676f0419e1..722fc12186da982f691d33db7a402b1b9cb9803b 100644 (file)
@@ -169,11 +169,16 @@ void ReferenceBlock::loadParameters(QDomElement &elt) throw(Exception) {
       int duration = 0;
       QString wbValue = "";
       QStringList listWb = wbStr.split(",");
+      cout << "wb param has:";
+      foreach(QString s, listWb) {
+        cout << qPrintable(s) << " | ";
+      }
+      cout << endl;
 
       if (listWb.at(0) == "r") {
         access = BlockParameter::Read;
       }
-      else if (wbStr == "w") {
+      else if (listWb.at(0) == "w") {
         access = BlockParameter::Write;
         bool ok;
         wbValue = listWb.at(1).toInt(&ok);
@@ -246,7 +251,7 @@ void ReferenceBlock::loadInterfaces(QDomElement &elt) throw(Exception) {
     nameStr = eltOutput.attribute("name","none");
     typeStr = eltOutput.attribute("type","none");
     widthStr = eltOutput.attribute("width","none");
-    purposeStr = eltOutput.attribute("type","none");
+    purposeStr = eltOutput.attribute("purpose","none");
     purpose = ReferenceInterface::translatePurpose(purposeStr);
     multStr = eltOutput.attribute("multiplicity","none");
     mult = ReferenceInterface::translateMultiplicity(multStr);
@@ -263,7 +268,7 @@ void ReferenceBlock::loadInterfaces(QDomElement &elt) throw(Exception) {
     nameStr = eltBidir.attribute("name","none");
     typeStr = eltBidir.attribute("type","none");
     widthStr = eltBidir.attribute("width","none");
-    purposeStr = eltBidir.attribute("type","none");
+    purposeStr = eltBidir.attribute("purpose","none");
     purpose = ReferenceInterface::translatePurpose(purposeStr);
     multStr = eltBidir.attribute("multiplicity","none");
     mult = ReferenceInterface::translateMultiplicity(multStr);
@@ -278,17 +283,21 @@ void ReferenceBlock::createInterfaceForParameters() throw(Exception){
   foreach(BlockParameter* param, params) {
     
     if (param->isWishboneParameter()) {
-      BlockParameterWishbone* p = (BlockParameterWishbone*)param;
-      int orientation = -1;
+      
+      BlockParameterWishbone* p = (BlockParameterWishbone*)param;      
+      cout << "creating interface for parameter wb " << qPrintable(p->getName()) << endl;
+      
       if (p->getWBAccess() == BlockParameter::Read) {
-        iface = new ReferenceInterface(this,p->getName(),p->getType(),p->getWidth(), AbstractInterface::Output, AbstractInterface::Wishbone,1);
+        iface = new ReferenceInterface(this,p->getName(),p->getTypeString(),p->getWidth(), AbstractInterface::Output, AbstractInterface::Wishbone,1);
         outputs.append(iface);        
       }
       else if (p->getWBAccess() == BlockParameter::Write) {
-        iface = new ReferenceInterface(this,p->getName(),p->getType(),p->getWidth(), AbstractInterface::Input, AbstractInterface::Wishbone,1);
+        iface = new ReferenceInterface(this,p->getName(),p->getTypeString(),p->getWidth(), AbstractInterface::Input, AbstractInterface::Wishbone,1);
         inputs.append(iface);                
       }
-      ReferenceInterface* iface = new ReferenceInterface(this,p->getName(),p->getType(),p->getWidth(), orientation, AbstractInterface::Wishbone,1);
+      else {
+        throw (Exception(BLOCKFILE_CORRUPTED));
+      }
     }
   }
 }