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

Private GIT Repository
clkconvert OP compute done
[blast.git] / Parameters.cpp
index d7621d232a1afa54f59d2a4078eeba3bac0f521b..23b798f1a47e54d16bb6a91fad8508b7ba31661b 100644 (file)
@@ -78,6 +78,7 @@ Graph* Parameters::initGraph(bool createTopGroupIfaces) {
 \r
 void Parameters::destroyGraph() {\r
   delete graph;\r
 \r
 void Parameters::destroyGraph() {\r
   delete graph;\r
+  graph = new Graph();\r
 }\r
 \r
 ReferenceBlock* Parameters::getReferenceBlock(int idCategory, int idBlock) {\r
 }\r
 \r
 ReferenceBlock* Parameters::getReferenceBlock(int idCategory, int idBlock) {\r
@@ -97,71 +98,6 @@ ReferenceBlock* Parameters::getHiddenReferenceBlock(QString blockName) {
   return ref;\r
 }\r
 \r
   return ref;\r
 }\r
 \r
-double Parameters::getFeedingClockFrequency(AbstractInterface *iface) {\r
-\r
-  int idClock = 0;\r
-\r
-  if (iface->isReferenceInterface()) return 0.0;\r
-\r
-  if (iface->getClockIfaceType() == AbstractInterface::ParameterName) {\r
-    BlockParameter* param = iface->getOwner()->getParameterFromName(iface->getClockIfaceString());\r
-    if (!param->isUserParameter()) return 0.0;\r
-    bool ok;\r
-    double freq = param->getDoubleValue(&ok);\r
-    if (!ok) {\r
-      cerr << "Abnormal case: cannot retrieve clock id from parameter  " << qPrintable(param->getName()) << endl;\r
-    }\r
-    return freq;\r
-  }\r
-  else if ( (iface->getClockIfaceType() == AbstractInterface::ClockName) || ((iface->getDirection() == AbstractInterface::Input) && (iface->getPurpose() == AbstractInterface::Clock))) {\r
-\r
-    // if iface is not clock, retrieve the clock related to it\r
-    if (iface->getClockIfaceType() == AbstractInterface::ClockName) {\r
-      iface = iface->getClockIface();\r
-    }\r
-    // if iface is a group interface, then iface name is ext_clk_X, thus extract the X\r
-    if (iface->isGroupInterface()) {\r
-      QString name = iface->getName();\r
-      name.remove(0,8);\r
-      bool ok;\r
-      idClock = name.toInt(&ok);\r
-      if (!ok) {\r
-        cerr << "Abnormal case: cannot retrieve clock id from iface name " << qPrintable(iface->getName()) << endl;\r
-        return 0.0;\r
-      }\r
-    }\r
-    // if iface is a functional interface, it is connected to clkrstgen_X (in top group) or to ext_clk_X (in subgroup)\r
-    else if (iface->isFunctionalInterface()) {\r
-      FunctionalInterface* funIface = AI_TO_FUN(iface);\r
-      ConnectedInterface* connFrom = funIface->getConnectedFrom();\r
-      if (connFrom == NULL) {\r
-        cerr << "Abnormal case: input clock " << qPrintable(iface->getName()) << " is not connected" << endl;\r
-        return 0.0;\r
-      }\r
-      if (iface->getOwner()->isTopGroupBlock()) {\r
-        QString name = connFrom->getOwner()->getName();\r
-        name.remove(0,10);\r
-        bool ok;\r
-        idClock = name.toInt(&ok);\r
-        if (!ok) {\r
-          cerr << "Abnormal case: cannot retrieve clock id for " << qPrintable(iface->getName()) << endl;\r
-          return 0.0;\r
-        }\r
-      }\r
-      else {\r
-        QString name = connFrom->getName();\r
-        name.remove(0,8);\r
-        bool ok;\r
-        idClock = name.toInt(&ok);\r
-        if (!ok) {\r
-          cerr << "Abnormal case: cannot retrieve clock id for " << qPrintable(iface->getName()) << endl;\r
-          return 0.0;\r
-        }\r
-      }\r
-    }\r
-  }\r
-  return graph->getClock(idClock);\r
-}\r
 \r
 void Parameters::createDelayBlock() {\r
   delayRef = new ReferenceBlock("no.xml");\r
 \r
 void Parameters::createDelayBlock() {\r
   delayRef = new ReferenceBlock("no.xml");\r
@@ -340,6 +276,14 @@ GroupWidget *Parameters::loadProject(QDomElement root) throw(Exception) {
     if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));\r
 \r
     if (idUpperScene == -1) {\r
     if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));\r
 \r
     if (idUpperScene == -1) {\r
+      QString clkList = currentSceneNode.attribute("clklist","none");\r
+      if (clkList == "none") throw(Exception(PROJECTFILE_CORRUPTED));\r
+      QStringList clks = clkList.split(",");\r
+      for(int j=0;j<clks.size();j++) {\r
+        double freq = clks.at(j).toDouble(&ok);\r
+        if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));\r
+        graph->addClock(freq);\r
+      }\r
       topGroup = dispatcher->createTopScene(Dispatcher::Load);\r
       topScene->setId(idScene);\r
       groupItem = topScene->getGroupItem();      \r
       topGroup = dispatcher->createTopScene(Dispatcher::Load);\r
       topScene->setId(idScene);\r
       groupItem = topScene->getGroupItem();      \r
@@ -525,12 +469,16 @@ GroupWidget *Parameters::loadProject(QDomElement root) throw(Exception) {
     int to = currentConnectionNode.attribute("to","none").toInt(&ok);\r
     if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));\r
 \r
     int to = currentConnectionNode.attribute("to","none").toInt(&ok);\r
     if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));\r
 \r
-\r
+    bool showConn = true;\r
+    QString visStr = currentConnectionNode.attribute("visible","none");\r
+    if (visStr == "false") {\r
+      showConn = false;\r
+    }\r
     InterfaceItem *iface1 = searchInterfaceItemById(from,topScene);\r
     InterfaceItem *iface2 = searchInterfaceItemById(to,topScene);\r
 \r
     if(iface1 != NULL && iface2 != NULL){\r
     InterfaceItem *iface1 = searchInterfaceItemById(from,topScene);\r
     InterfaceItem *iface2 = searchInterfaceItemById(to,topScene);\r
 \r
     if(iface1 != NULL && iface2 != NULL){\r
-      dispatcher->createConnection(Dispatcher::Load, iface1,iface2);\r
+      dispatcher->createConnection(Dispatcher::Load, iface1,iface2,showConn);\r
     } else {\r
       cout << "interfaces not found, connect canceled!" << endl;\r
     }\r
     } else {\r
       cout << "interfaces not found, connect canceled!" << endl;\r
     }\r
@@ -1238,7 +1186,9 @@ void Parameters::save(QString confFile) {
 \r
       writer.writeAttribute("from",QString::number(item->getFromInterfaceItem()->getId()));\r
       writer.writeAttribute("to", QString::number(item->getToInterfaceItem()->getId()));\r
 \r
       writer.writeAttribute("from",QString::number(item->getFromInterfaceItem()->getId()));\r
       writer.writeAttribute("to", QString::number(item->getToInterfaceItem()->getId()));\r
-\r
+      if (!item->isVisible()) {\r
+        writer.writeAttribute("visible","false");\r
+      }\r
       writer.writeEndElement();\r
     }\r
 \r
       writer.writeEndElement();\r
     }\r
 \r