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

Private GIT Repository
added clk/rst link when creating a block
authorstephane Domas <stephane.domas@univ-fcomte.fr>
Mon, 30 Apr 2018 16:24:27 +0000 (18:24 +0200)
committerstephane Domas <stephane.domas@univ-fcomte.fr>
Mon, 30 Apr 2018 16:24:27 +0000 (18:24 +0200)
30 files changed:
AbstractBlock.cpp
AbstractBlock.h
AbstractInterface.cpp
AbstractInterface.h
BlockLibraryWidget.cpp
BlockLibraryWidget.h
BoxItem.cpp
Dispatcher.cpp
Dispatcher.h
FunctionalBlock.cpp
FunctionalBlock.h
GroupBlock.cpp
GroupItem.cpp
InterfacePropertiesDialog.cpp [new file with mode: 0644]
InterfacePropertiesDialog.h [new file with mode: 0644]
InterfacePropertiesWindow.cpp [deleted file]
InterfacePropertiesWindow.h [deleted file]
MainWindow.cpp
ReferenceBlock.cpp
SpecialBlock.cpp [new file with mode: 0644]
SpecialBlock.h [new file with mode: 0644]
blast.creator.user
blast.files
blastconfig.xml
lib/implementations/impls.bmf
lib/references/apf27-wb-master.xml
lib/references/clkdomain_convert_1024x8.xml
lib/references/clkrstgen.xml
lib/references/references.bmf
object-files.txt

index 3c3dd55567143665fb453afe507fac18330e9e97..116494e1922f1ac830500aed518db2efc1a468f5 100644 (file)
@@ -243,51 +243,70 @@ QList<BlockParameter *> AbstractBlock::getWishboneParameters() {
   return lst;\r
 }\r
 \r
   return lst;\r
 }\r
 \r
+void AbstractBlock::connectClock(QString clkName, int idGen) throw(Exception) {\r
 \r
 \r
+  GroupBlock* parentBlock = AB_TO_GRP(parent);  \r
+  ConnectedInterface* fromClk = NULL;\r
+  ConnectedInterface* toClk = AI_TO_CON(getIfaceFromName(clkName));\r
 \r
 \r
-void AbstractBlock::connectClkReset() throw(Exception) {\r
-\r
-  GroupBlock* parentBlock = AB_TO_GRP(parent);\r
-\r
-\r
-\r
-  QList<AbstractInterface* > lstClk = getInterfaces(AbstractInterface::Input,AbstractInterface::Clock);\r
-  QList<AbstractInterface* > lstRst = getInterfaces(AbstractInterface::Input,AbstractInterface::Reset);\r
+  if (parentBlock->isTop()) {\r
+    QString genName = "clkrstgen_" + QString::number(idGen);\r
+    AbstractBlock* clkrstgen = parentBlock->getFunctionalBlockByName(genName);\r
+    if (clkrstgen == NULL) {\r
+      throw(Exception(IFACE_TOP_NOCLKRSTGEN,this));\r
+    }\r
+    else {\r
+      fromClk = AI_TO_CON(clkrstgen->getIfaceFromName("clk"));      \r
+    }\r
+    cout << "connecting clock for " << qPrintable(name) << " to " << qPrintable(genName) << endl;\r
+  }\r
+  else {\r
+    // searching for ext_clk_idGen\r
+    QString name = "ext_clk_"+QString::number(idGen);\r
+    fromClk = AI_TO_CON(parentBlock->getIfaceFromName(name));\r
+    cout << "connecting clk for child " << qPrintable(name) << " of " << qPrintable(parentBlock->getName()) << endl;\r
+  }\r
 \r
 \r
-  if ((lstClk.isEmpty()) || (lstRst.isEmpty())) {\r
-    throw(Exception(IFACE_GROUP_NOCLKRST,this));\r
+  if (fromClk == NULL) {\r
+    throw(Exception(IFACE_GROUP_NOCLKRST,parentBlock));\r
+  }\r
+  else {\r
+    fromClk->connectTo(toClk);\r
+    cout << "connection done between " << qPrintable(toClk->getConnectedFrom()->getOwner()->getName()) << "/" << qPrintable(toClk->getConnectedFrom()->getName());\r
+    cout << " and " << qPrintable(toClk->getOwner()->getName()) << "/" << qPrintable(toClk->getName()) << endl;\r
   }\r
   }\r
+}\r
 \r
 \r
-  ConnectedInterface* toClk = AI_TO_CON(lstClk.at(0));\r
-  ConnectedInterface* toRst = AI_TO_CON(lstRst.at(0));\r
+void AbstractBlock::connectReset(QString rstName, int idGen) throw(Exception) {\r
 \r
 \r
-  ConnectedInterface* fromClk = NULL;\r
+  GroupBlock* parentBlock = AB_TO_GRP(parent);\r
   ConnectedInterface* fromRst = NULL;\r
   ConnectedInterface* fromRst = NULL;\r
+  ConnectedInterface* toRst = AI_TO_CON(getIfaceFromName(rstName));\r
 \r
   if (parentBlock->isTop()) {\r
 \r
   if (parentBlock->isTop()) {\r
-    AbstractBlock* clkrstgen = parentBlock->getFunctionalBlockByName("clkrstgen");\r
+    QString genName = "clkrstgen_" + QString::number(idGen);\r
+    AbstractBlock* clkrstgen = parentBlock->getFunctionalBlockByName(genName);\r
     if (clkrstgen == NULL) {\r
       throw(Exception(IFACE_TOP_NOCLKRSTGEN,this));\r
     }\r
     else {\r
     if (clkrstgen == NULL) {\r
       throw(Exception(IFACE_TOP_NOCLKRSTGEN,this));\r
     }\r
     else {\r
-      fromClk = AI_TO_CON(clkrstgen->getIfaceFromName("clk"));\r
       fromRst = AI_TO_CON(clkrstgen->getIfaceFromName("reset"));\r
     }\r
       fromRst = AI_TO_CON(clkrstgen->getIfaceFromName("reset"));\r
     }\r
-    cout << "connecting clk/rst for " << qPrintable(name) << " to clkrstgen" << endl;\r
+    cout << "connecting reset for " << qPrintable(name) << " to " << qPrintable(genName) << endl;\r
   }\r
   else {\r
   }\r
   else {\r
-    fromClk = AI_TO_CON(parentBlock->getIfaceFromName("clk"));\r
-    fromRst = AI_TO_CON(parentBlock->getIfaceFromName("reset"));\r
-    cout << "connecting clk/rst for child " << qPrintable(name) << " of " << qPrintable(parentBlock->getName()) << endl;\r
+    QString name = "ext_reset_"+QString::number(idGen);\r
+    fromRst = AI_TO_CON(parentBlock->getIfaceFromName(name));\r
+    cout << "connecting reset for child " << qPrintable(name) << " of " << qPrintable(parentBlock->getName()) << endl;\r
   }\r
   }\r
-  if ((fromClk == NULL) || (fromRst == NULL)) {\r
+\r
+  if (fromRst == NULL) {\r
     throw(Exception(IFACE_GROUP_NOCLKRST,parentBlock));\r
   }\r
   else {\r
     throw(Exception(IFACE_GROUP_NOCLKRST,parentBlock));\r
   }\r
   else {\r
-    fromClk->connectTo(toClk);\r
     fromRst->connectTo(toRst);\r
     fromRst->connectTo(toRst);\r
-    cout << "connection done between " << qPrintable(toClk->getConnectedFrom()->getOwner()->getName()) << "/" << qPrintable(toClk->getConnectedFrom()->getName());\r
-    cout << " and " << qPrintable(toClk->getOwner()->getName()) << "/" << qPrintable(toClk->getName()) << endl;\r
+    cout << "connection done between " << qPrintable(toRst->getConnectedFrom()->getOwner()->getName()) << "/" << qPrintable(toRst->getConnectedFrom()->getName());\r
+    cout << " and " << qPrintable(toRst->getOwner()->getName()) << "/" << qPrintable(toRst->getName()) << endl;\r
   }\r
 }\r
 \r
   }\r
 }\r
 \r
index 0ca55360cc65c761bff83ffd442ad94f9cc00cc2..fe3f90e392c67c511d86d7060ba07d7eb62b18fe 100644 (file)
@@ -59,7 +59,14 @@ public:
   bool isWBConfigurable();\r
 \r
   // others\r
   bool isWBConfigurable();\r
 \r
   // others\r
-  void connectClkReset() throw(Exception);  \r
+\r
+  /*!\r
+   * \brief connectClkReset connects the clock and reset inputs to a clkrstgen block or the the group ifaces\r
+   * \param idBlockClk is the id of the clock interface (there may be severals)\r
+   * \param idGen is the id of the clkrstgen block\r
+  */\r
+  void connectClock(QString clkName, int idGen = 0) throw(Exception);\r
+  void connectReset(QString rstName, int idGen = 0) throw(Exception);\r
   virtual QList<QString> getExternalResources() = 0; // returns the list of all external files needed for VHDL generation\r
   virtual void generateVHDL(const QString& path) throw(Exception) = 0; // main entry to generate the VHDL code\r
   void generateComponent(QTextStream& out, bool hasController=false) throw(Exception); // generate the component using reference\r
   virtual QList<QString> getExternalResources() = 0; // returns the list of all external files needed for VHDL generation\r
   virtual void generateVHDL(const QString& path) throw(Exception) = 0; // main entry to generate the VHDL code\r
   void generateComponent(QTextStream& out, bool hasController=false) throw(Exception); // generate the component using reference\r
index 03a1a986e4cd35757cdfd4a337f460de6523958b..3295dc8eb99bde841b9351b1a44575ffc8c57366 100644 (file)
@@ -243,6 +243,13 @@ bool AbstractInterface::setAssociatedIface(AbstractInterface* iface) {
   return true;
 }
 
   return true;
 }
 
+AbstractInterface* AbstractInterface::getClockIface() {
+  if (clkIfaceType == ClockName) {
+    return owner->getIfaceFromName(clkIface);
+  }
+  return NULL;
+}
+
 bool AbstractInterface::setClockIface(QString name) {
   /* 2 cases :
    *  - this is a Data interface
 bool AbstractInterface::setClockIface(QString name) {
   /* 2 cases :
    *  - this is a Data interface
index 0e167dbc0039d992d4b7ec81a3ecaa6f51fcc655..95ad4bb5280ef7a8751b70ca5abeb62558511399 100644 (file)
@@ -54,8 +54,9 @@ public :
   QString getDirectionString();  
   inline AbstractBlock *getOwner() { return owner;}
   inline AbstractInterface* getAssociatedIface() { return associatedIface; }
   QString getDirectionString();  
   inline AbstractBlock *getOwner() { return owner;}
   inline AbstractInterface* getAssociatedIface() { return associatedIface; }
-  inline QString getClockIface() { return clkIface; }
+  inline QString getClockIfaceString() { return clkIface; }
   inline int getClockIfaceType() { return clkIfaceType; }
   inline int getClockIfaceType() { return clkIfaceType; }
+  AbstractInterface* getClockIface();
 
 
   double getDoubleWidth() throw(QException);
 
 
   double getDoubleWidth() throw(QException);
index e8f5c6da0f65d509b1b580e7d81d4cee89274bf4..62603b43cbda45514a8b04ce5280977abc9b8ea3 100644 (file)
@@ -9,6 +9,11 @@ BlockLibraryWidget::BlockLibraryWidget(Dispatcher* _dispatcher,
   dispatcher = _dispatcher;
   params = _params;
 
   dispatcher = _dispatcher;
   params = _params;
 
+  nbClock = 0;
+  comboClkGen = NULL;
+  nbRst = 0;
+  comboRstGen = NULL;
+
   // creating the widget : tree, buttons, ...
   QBoxLayout* layout = new QBoxLayout(QBoxLayout::TopToBottom, this);
   tree = new QTreeWidget(this);
   // creating the widget : tree, buttons, ...
   QBoxLayout* layout = new QBoxLayout(QBoxLayout::TopToBottom, this);
   tree = new QTreeWidget(this);
@@ -17,13 +22,23 @@ BlockLibraryWidget::BlockLibraryWidget(Dispatcher* _dispatcher,
   buttonAdd->setEnabled(false);
   comboScenes = new QComboBox();
 
   buttonAdd->setEnabled(false);
   comboScenes = new QComboBox();
 
-  QHBoxLayout* layBottom = new QHBoxLayout;
-  layBottom->addWidget(buttonAdd);
-  layBottom->addWidget(comboScenes);
+  QHBoxLayout* layAdd = new QHBoxLayout;
+  layAdd->addWidget(buttonAdd);
+  layAdd->addWidget(comboScenes);
+
+  layClkRst = new QGridLayout;
+
+  boxClkRst = new QGroupBox("Clock/reset connection");
+  boxClkRst->setLayout(layClkRst);
+
+  QVBoxLayout* layBottom = new QVBoxLayout;
+  layBottom->addLayout(layAdd);
+  layBottom->addWidget(boxClkRst);
+
 
   connect(tree, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(clicked()));
   connect(tree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(doubleClicked()));
 
   connect(tree, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(clicked()));
   connect(tree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(doubleClicked()));
-  connect(buttonAdd, SIGNAL(clicked()), this, SLOT(addClicked()));
+  connect(buttonAdd, SIGNAL(clicked()), this, SLOT(addClicked()));  
 
   BlockCategory* cat = params->categoryTree->searchCategory(0);
 
 
   BlockCategory* cat = params->categoryTree->searchCategory(0);
 
@@ -36,7 +51,7 @@ BlockLibraryWidget::BlockLibraryWidget(Dispatcher* _dispatcher,
   layout->addLayout(layBottom);
   this->setLayout(layout);
 
   layout->addLayout(layBottom);
   this->setLayout(layout);
 
-  this->setFixedSize(300,230);
+  //this->setFixedSize(300,230);
 }
 
 
 }
 
 
@@ -87,11 +102,23 @@ void BlockLibraryWidget::addClicked() {
 
   QTreeWidgetItem *item = tree->selectedItems().at(0);
   if(item->data(1,Qt::DisplayRole).isValid() && item->data(2,Qt::DisplayRole).isValid()){
 
   QTreeWidgetItem *item = tree->selectedItems().at(0);
   if(item->data(1,Qt::DisplayRole).isValid() && item->data(2,Qt::DisplayRole).isValid()){
-    int idParent = item->data(1,Qt::DisplayRole).toInt();
+    int idCat = item->data(1,Qt::DisplayRole).toInt();
     int idBlock = item->data(2,Qt::DisplayRole).toInt();
     int idBlock = item->data(2,Qt::DisplayRole).toInt();
-    QVariant v = comboScenes->currentData();
+    QVariant v = comboScenes->currentData();    
+
     cout << "adding block to scene " << v.toInt() << endl;
     cout << "adding block to scene " << v.toInt() << endl;
-    dispatcher->addBlock(Dispatcher::Design, idParent, idBlock, v.toInt());
+
+    QHash<QString, int> clkRstToGen;
+    for(int i=0;i<layClkRst->rowCount();i++) {
+      QLayoutItem* item = layClkRst->itemAtPosition(i,0);
+      QLabel* lab = (QLabel *)(item->widget());
+      item = layClkRst->itemAtPosition(i,1);
+      QComboBox* combo = (QComboBox *)(item->widget());
+      clkRstToGen.insert(lab->text(),combo->currentIndex());
+    }
+
+
+    dispatcher->addBlock(Dispatcher::Design, idCat, idBlock, v.toInt(), clkRstToGen);
   }
 
   // only take the first selected
   }
 
   // only take the first selected
@@ -102,10 +129,15 @@ void BlockLibraryWidget::addClicked() {
 void BlockLibraryWidget::clicked() {
   if(tree->selectedItems().length() > 0){
     QTreeWidgetItem *item = tree->selectedItems().at(0);
 void BlockLibraryWidget::clicked() {
   if(tree->selectedItems().length() > 0){
     QTreeWidgetItem *item = tree->selectedItems().at(0);
-    if(item->data(1,Qt::DisplayRole).isValid())
+    if(item->data(1,Qt::DisplayRole).isValid()) {
       buttonAdd->setEnabled(true);
       buttonAdd->setEnabled(true);
-    else
+      int idParent = item->data(1,Qt::DisplayRole).toInt();
+      int idBlock = item->data(2,Qt::DisplayRole).toInt();
+      updateClkRst(idParent, idBlock);
+    }
+    else {
       buttonAdd->setEnabled(false);
       buttonAdd->setEnabled(false);
+    }
   }
 }
 
   }
 }
 
@@ -122,3 +154,68 @@ void BlockLibraryWidget::updateComboScene() {
     comboScenes->addItem(iter.value(),QVariant(iter.key()));
   }
 }
     comboScenes->addItem(iter.value(),QVariant(iter.key()));
   }
 }
+
+void BlockLibraryWidget::updateClkRst(int idCat, int idBlock) {
+
+  while (layClkRst->count() > 0) {
+    QWidget* widget = layClkRst->itemAt(0)->widget();
+    layClkRst->removeWidget(widget);
+    delete widget;
+  }
+
+  if (nbClock != 0) {
+    for(int i=0;i<nbClock;i++) {
+      comboClkGen[i]->deleteLater();
+    }
+    delete [] comboClkGen;
+  }
+  if (nbRst != 0) {
+    for(int i=0;i<nbRst;i++) {
+      comboRstGen[i]->deleteLater();
+    }
+    delete [] comboRstGen;
+  }
+
+  ReferenceBlock* ref = params->getReferenceBlock(idCat,idBlock);
+  QList<AbstractInterface*> lstClocks = ref->getInterfaces(AbstractInterface::Input, AbstractInterface::Clock);
+  nbClock = lstClocks.size();
+  QList<AbstractInterface*> lstRst = ref->getInterfaces(AbstractInterface::Input, AbstractInterface::Reset);
+  nbRst = lstRst.size();
+
+  comboClkGen = new QComboBox*[lstClocks.size()];
+  for(int i=0;i<lstClocks.size();i++) {
+    comboClkGen[i] = new QComboBox();
+    QString name = "";
+    int id = 0;
+    foreach(double d, params->clocks) {
+      name = "ext_clk_"+QString::number(id)+" (";
+      name += QString::number(d) + " MHz)";
+      comboClkGen[i]->addItem(name);
+      id++;
+    }
+  }
+
+  comboRstGen = new QComboBox*[lstRst.size()];
+  for(int i=0;i<lstRst.size();i++) {
+    comboRstGen[i] = new QComboBox();
+    QString name = "";
+    for(int j=0;j<params->clocks.size();j++) {
+      name = "ext_rst_"+QString::number(j);
+      comboRstGen[i]->addItem(name);
+    }
+  }
+  layClkRst->addWidget(new QLabel("Clock/Reset name"), 0, 0);
+  layClkRst->addWidget(new QLabel("connect to"), 0, 1);
+  int row = 1;
+  foreach(AbstractInterface* iface, lstClocks) {
+    layClkRst->addWidget(new QLabel(iface->getName()), row,0);
+    layClkRst->addWidget(comboClkGen[row-1],row, 1);
+    row++;
+  }
+  foreach(AbstractInterface* iface, lstRst) {
+    layClkRst->addWidget(new QLabel(iface->getName()), row,0);
+    layClkRst->addWidget(comboRstGen[row-1-nbClock],row, 1);
+    row++;
+  }
+
+}
index 43ed5fc0931e5220edfa171ea4db8f8d6ff1a920..bf17316ccbdcc1e5a4dc8ad461b46833480acc58 100644 (file)
@@ -25,11 +25,12 @@ public:
 
 public slots:
   void updateComboScene();
 
 public slots:
   void updateComboScene();
+  void updateClkRst(int idCat, int idBlock);
 
 private slots:
 
 private slots:
-    void addClicked();
-    void clicked();
-    void doubleClicked();
+  void addClicked();
+  void clicked();
+  void doubleClicked();
 
 
 private:
 
 
 private:
@@ -38,6 +39,14 @@ private:
   QTreeWidget* tree;
   QPushButton* buttonAdd;
   QComboBox* comboScenes;
   QTreeWidget* tree;
   QPushButton* buttonAdd;
   QComboBox* comboScenes;
+
+  QGroupBox* boxClkRst;
+  QGridLayout* layClkRst;
+  QComboBox** comboClkGen;
+  int nbClock;
+  QComboBox** comboRstGen;
+  int nbRst;
+
   // other attributes
   
   void addChild(BlockCategory *catParent, QTreeWidgetItem* itemParent);
   // other attributes
   
   void addChild(BlockCategory *catParent, QTreeWidgetItem* itemParent);
index deee2cc81ca24a010da7603730b6cacde075e13e..ae15002120d4596156879144c449e905b5dcc3f4 100644 (file)
@@ -406,13 +406,19 @@ void BoxItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
     //cout << "block abs. pos: " << absPos.x() << "," << absPos.y() << " | ";
     //cout << "block current. pos: " << currentPosition.x() << "," << currentPosition.y() << " | ";
 
     //cout << "block abs. pos: " << absPos.x() << "," << absPos.y() << " | ";
     //cout << "block current. pos: " << currentPosition.x() << "," << currentPosition.y() << " | ";
 
-    if ((gapX < 0) && (absPos.x() == marginConn)) {
+    if ((position == Left) || (position == Right)) {
+      gapX = 0;
+    }
+    else if ((gapX < 0) && (absPos.x() == marginConn)) {
       gapX = 0;
     }
     else if (absPos.x()+gapX < marginConn) {
       gapX = marginConn-absPos.x();
     }
       gapX = 0;
     }
     else if (absPos.x()+gapX < marginConn) {
       gapX = marginConn-absPos.x();
     }
-    if ((gapY < 0) && (absPos.y() == marginConn)) {
+    if ((position == Top) || (position == Bottom)) {
+      gapY = 0;
+    }
+    else if ((gapY < 0) && (absPos.y() == marginConn)) {
       gapY = 0;
     }
     else if (absPos.y()+gapY < marginConn) {
       gapY = 0;
     }
     else if (absPos.y()+gapY < marginConn) {
@@ -985,17 +991,6 @@ void BoxItem::loadFunctional(QDomElement funcElement) throw(Exception) {
       functionalBlock->addInterface(ctlIface);
     }    
   }
       functionalBlock->addInterface(ctlIface);
     }    
   }
-  // connect clk and rst to group clk/rst or to clkrstgen
-  if ((name != "clkrstgen") && (parentGroupBlock != NULL)) {
-    try {
-      functionalBlock->connectClkReset();
-    }
-    catch(Exception e) {
-      AbstractBlock* source = (AbstractBlock *)(e.getSource());
-      cerr << qPrintable(source->getName()) << ":" << qPrintable(e.getMessage()) << endl;
-      throw(e);
-    }
-  }
   
   // creating InterfaceItem
   createInterfaceItems();
   
   // creating InterfaceItem
   createInterfaceItems();
index 8d1164964036eb4af1ede213cb1e7325ed9c9b0a..94cdfb66e7ad5b131e9d073b793fca7117ea21a5 100644 (file)
@@ -29,7 +29,9 @@
 #include "DelayInputModifier.h"
 
 
 #include "DelayInputModifier.h"
 
 
-#include "InterfacePropertiesWindow.h"
+#include "InterfacePropertiesDialog.h"
+
+#include <QHashIterator>
 
 int Dispatcher::sceneCounter = 0;
 
 
 int Dispatcher::sceneCounter = 0;
 
@@ -621,7 +623,7 @@ void Dispatcher::duplicateInterfaceItem(Context context, InterfaceItem *item) {
 }
 
 
 }
 
 
-BoxItem* Dispatcher::addBlock(Context context, int idCategory, int idBlock, int idScene) {
+BoxItem* Dispatcher::addBlock(Context context, int idCategory, int idBlock, int idScene, QHash<QString, int> clkRstToGen) {
   static QString fctName = "Dispatcher::addBlock()";
 #ifdef DEBUG_FCTNAME
   cout << "call to " << qPrintable(fctName) << endl;
   static QString fctName = "Dispatcher::addBlock()";
 #ifdef DEBUG_FCTNAME
   cout << "call to " << qPrintable(fctName) << endl;
@@ -645,9 +647,26 @@ BoxItem* Dispatcher::addBlock(Context context, int idCategory, int idBlock, int
       scene->createSourceItem(newOne);
     }
     else {
       scene->createSourceItem(newOne);
     }
     else {
+
       GroupBlock* group = AB_TO_GRP(scene->getGroupItem()->getRefBlock());
       FunctionalBlock* newOne = params->getGraph()->createFunctionalBlock(group, ref, true);
       GroupBlock* group = AB_TO_GRP(scene->getGroupItem()->getRefBlock());
       FunctionalBlock* newOne = params->getGraph()->createFunctionalBlock(group, ref, true);
+
+      // creating the box item
       item = scene->createBoxItem(newOne);
       item = scene->createBoxItem(newOne);
+      if (params->autoConnMainClk) {
+        // for now just use the first one
+        QHashIterator<QString,int> iter(clkRstToGen);
+        while (iter.hasNext()) {
+          iter.next();
+          AbstractInterface* iface = newOne->getIfaceFromName(iter.key());
+          if (iface->getPurpose() == AbstractInterface::Clock) {
+            newOne->connectClock(iface->getName(), iter.value());
+          }
+          else if (iface->getPurpose() == AbstractInterface::Reset) {
+            newOne->connectReset(iface->getName(), iter.value());
+          }
+        }
+      }
       params->blockToItem.insert(newOne,item);
     }
     params->unsaveModif = true;
       params->blockToItem.insert(newOne,item);
     }
     params->unsaveModif = true;
@@ -656,6 +675,67 @@ BoxItem* Dispatcher::addBlock(Context context, int idCategory, int idBlock, int
   return item;
 }
 
   return item;
 }
 
+void Dispatcher::addClkRstGenBlock(Context context, double frequency) {
+  static QString fctName = "Dispatcher::addClkRstGenBlock()";
+#ifdef DEBUG_FCTNAME
+  cout << "call to " << qPrintable(fctName) << endl;
+#endif
+
+
+  if (context == Design) {
+
+    params->clocks.append(frequency);
+
+    // get the top group
+    GroupBlock *group = params->getGraph()->getTopGroup();
+    GroupScene *scene = topGroupWidget->getScene();
+
+    // creating the clkrstgen block
+    ReferenceBlock* ref = params->getHiddenReferenceBlock("clkrstgen");
+    FunctionalBlock* newOne = params->getGraph()->createFunctionalBlock(group, ref, true);
+
+    QString name = "clkrstgen_";
+    name += QString::number(params->clocks.size()-1);
+    newOne->setName(name);
+
+    // creating the box item
+    BoxItem* item = scene->createBoxItem(newOne, BoxItem::Left, AbstractBoxItem::Dimension);
+    item->setVisible(false);
+
+    ConnectedInterface* fromIfaceClk = NULL;
+    ConnectedInterface* fromIfaceReset = NULL;
+    QString clkName = "ext_clk_"+QString::number(params->clocks.size()-1);
+    QString rstName = "ext_reset_"+QString::number(params->clocks.size()-1);
+    fromIfaceClk = new GroupInterface(group,clkName, AbstractInterface::Input, AbstractInterface::Clock);
+    fromIfaceReset = new GroupInterface(group,rstName, AbstractInterface::Input, AbstractInterface::Reset);
+    group->addInterface(fromIfaceClk);
+    group->addInterface(fromIfaceReset);
+  // creating top group ext_clk iface item
+    GroupItem* groupItem = scene->getGroupItem();
+    InterfaceItem* fromIfaceItemClk = new InterfaceItem(0.5 , Parameters::West, fromIfaceClk, groupItem, params, true);
+    groupItem->addInterfaceItem(fromIfaceItemClk,true);
+    // creating top group ext_reset iface item
+    InterfaceItem* fromIfaceItemReset = new InterfaceItem(0.5 , Parameters::West, fromIfaceReset, groupItem, params, false);
+    groupItem->addInterfaceItem(fromIfaceItemReset,true);
+    // connecting ext_clk iface items
+    InterfaceItem* toIfaceItemClk = item->searchInterfaceItemByName("ext_clk");
+    if (toIfaceItemClk == NULL) {
+      cerr << "Abnormal case while connecting top group ext_clk to clkrstgen" << endl;
+    }
+    createConnection(context,fromIfaceItemClk, toIfaceItemClk, false);
+    // connecting ext_reset iface items
+    InterfaceItem* toIfaceItemReset = item->searchInterfaceItemByName("ext_reset");
+    if (toIfaceItemReset == NULL) {
+      cerr << "Abnormal case while connecting top group ext_reset to clkrstgen" << endl;
+    }
+    createConnection(context,fromIfaceItemReset, toIfaceItemReset, false);
+
+    params->blockToItem.insert(newOne,item);
+    params->unsaveModif = true;
+  }
+}
+
+
 
 GroupWidget *Dispatcher::createTopScene(Context context){
   static QString fctName = "Dispatcher::createTopScene()";
 
 GroupWidget *Dispatcher::createTopScene(Context context){
   static QString fctName = "Dispatcher::createTopScene()";
@@ -690,35 +770,12 @@ GroupWidget *Dispatcher::createTopScene(Context context){
 
 
   if (context == Design) {
 
 
   if (context == Design) {
-    // creating the clkrstgen block
-    ReferenceBlock* ref = params->getHiddenReferenceBlock("clkrstgen");
-    FunctionalBlock* newOne = params->getGraph()->createFunctionalBlock(topBlock, ref, true);
-    // creating the clkrstgen item
-    BoxItem* clkResetItem = scene->createBoxItem(newOne, BoxItem::TopLeft, AbstractBoxItem::Position | AbstractBoxItem::Dimension, BoxItem::NoSpan);
-    params->blockToItem.insert(newOne,clkResetItem);
-    // creating top group ext_clk iface item
-    ConnectedInterface* fromIfaceClk = AI_TO_CON(topBlock->getIfaceFromName("ext_clk"));
-    InterfaceItem* fromIfaceItemClk = new InterfaceItem(0.5 , Parameters::West, fromIfaceClk, group, params, true);
-    group->addInterfaceItem(fromIfaceItemClk,true);
-    // creating top group ext_reset iface item
-    ConnectedInterface* fromIfaceReset = AI_TO_CON(topBlock->getIfaceFromName("ext_reset"));
-    InterfaceItem* fromIfaceItemReset = new InterfaceItem(0.5 , Parameters::West, fromIfaceReset, group, params, false);
-    group->addInterfaceItem(fromIfaceItemReset,true);
-    // connecting ext_clk iface items
-    InterfaceItem* toIfaceItemClk = clkResetItem->searchInterfaceItemByName("ext_clk");
-    if (toIfaceItemClk == NULL) {
-      cerr << "Abnormal case while connecting top group ext_clk to clkrstgen" << endl;
-    }
-    createConnection(context,fromIfaceItemClk, toIfaceItemClk, false);
-    // connecting ext_reset iface items
-    InterfaceItem* toIfaceItemReset = clkResetItem->searchInterfaceItemByName("ext_reset");
-    if (toIfaceItemReset == NULL) {
-      cerr << "Abnormal case while connecting top group ext_reset to clkrstgen" << endl;
-    }
-    createConnection(context,fromIfaceItemReset, toIfaceItemReset, false);
+    // create clkrstgen
+    double freq = params->clocks.at(0);
+    params->clocks.clear();
+    addClkRstGenBlock(context,freq);
   }
 
   }
 
-
   groupList.append(topGroupWidget);
   return topGroupWidget;
 }
   groupList.append(topGroupWidget);
   return topGroupWidget;
 }
@@ -728,11 +785,15 @@ GroupWidget* Dispatcher::addNewEmptyGroup(Context context, GroupScene* scene, bo
 #ifdef DEBUG_FCTNAME
   cout << "call to " << qPrintable(fctName) << endl;
 #endif
 #ifdef DEBUG_FCTNAME
   cout << "call to " << qPrintable(fctName) << endl;
 #endif
+  bool createIfaces = true;
+  if (context == Load) {
+    createIfaces = false;
+  }
 
   // getting the parent block in the graph
   GroupBlock* parent = AB_TO_GRP(scene->getGroupItem()->getRefBlock());
   cout << "new group : parent = "<< qPrintable(parent->getName()) << endl;
 
   // getting the parent block in the graph
   GroupBlock* parent = AB_TO_GRP(scene->getGroupItem()->getRefBlock());
   cout << "new group : parent = "<< qPrintable(parent->getName()) << endl;
-  GroupBlock* groupBlock = params->getGraph()->createChildGroupBlock(parent);
+  GroupBlock* groupBlock = params->getGraph()->createChildGroupBlock(parent, createIfaces);
   cout << "new group : child = "<< qPrintable(groupBlock->getName()) << ", child of " << qPrintable(groupBlock->getParent()->getName()) << endl;
   // creating the BlockItem in the scene
   BoxItem* newItem = scene->createBoxItem(groupBlock);
   cout << "new group : child = "<< qPrintable(groupBlock->getName()) << ", child of " << qPrintable(groupBlock->getParent()->getName()) << endl;
   // creating the BlockItem in the scene
   BoxItem* newItem = scene->createBoxItem(groupBlock);
@@ -1204,7 +1265,8 @@ void Dispatcher::showBlocksLibrary(){
 }
 
 void Dispatcher::showProperties(Context context, InterfaceItem *inter) {
 }
 
 void Dispatcher::showProperties(Context context, InterfaceItem *inter) {
-  new InterfacePropertiesWindow(inter);
+  QDialog* dial = new InterfacePropertiesDialog(inter);
+  dial->exec();
 }
 
 /* connectInterToGroup() :
 }
 
 /* connectInterToGroup() :
index 4354466f7db5acd80329b85225a034e5d87614d6..0fa74bd0954c764c67cdad4cfa49b14660b3d96e 100644 (file)
@@ -94,7 +94,8 @@ public:
   /**************************
    *  block ops
    *************************/
   /**************************
    *  block ops
    *************************/
-  BoxItem* addBlock(Context context, int idCategory, int idBlock, int idScene);
+  BoxItem* addBlock(Context context, int idCategory, int idBlock, int idScene, QHash<QString,int> clkRstToGen );
+  void addClkRstGenBlock(Context context, double frequency);
   void removeBoxItem(Context context, BoxItem* item);
   void duplicateBoxItem(Context context, BoxItem* item);
   void renameFunctionalBlock(Context context, BoxItem* item);
   void removeBoxItem(Context context, BoxItem* item);
   void duplicateBoxItem(Context context, BoxItem* item);
   void renameFunctionalBlock(Context context, BoxItem* item);
index 65c8df81206466a06f0e7cb9eefe7c00f33305ae..ab9611d9f9aa3e9fc2276068418cf93b44cf76ee 100644 (file)
@@ -100,7 +100,7 @@ void FunctionalBlock::populate() {
     addInterface(inter);\r
     /* WARNING FOR THE FUTURE :\r
        in case of there are several clock interfaces ofr that block\r
     addInterface(inter);\r
     /* WARNING FOR THE FUTURE :\r
        in case of there are several clock interfaces ofr that block\r
-       it would be a godd idea to make the user choose which one\r
+       it would be a good idea to make the user choose which one\r
        must be connected to defautl clk.\r
        Presently, the first encountered is chosen\r
      */\r
        must be connected to defautl clk.\r
        Presently, the first encountered is chosen\r
      */\r
@@ -126,18 +126,6 @@ void FunctionalBlock::populate() {
       }       \r
     }\r
   }\r
       }       \r
     }\r
   }\r
-\r
-  // connect clk and rst to group clk/rst or to clkrstgen\r
-  if ((name != "clkrstgen") && (parent != NULL)) {\r
-    try {\r
-      connectClkReset();\r
-    }\r
-    catch(Exception e) {\r
-      AbstractBlock* source = (AbstractBlock *)(e.getSource());\r
-      cerr << qPrintable(source->getName()) << ":" << qPrintable(e.getMessage()) << endl;\r
-      throw(e);\r
-    }\r
-  }\r
 }\r
 \r
 QString FunctionalBlock::getReferenceXmlFile() {\r
 }\r
 \r
 QString FunctionalBlock::getReferenceXmlFile() {\r
index 8e0e2ed9b79a051192a8baa00f040341d0bc88de..8c469d5b2936d545eadd7c1baf4249f391dc8f07 100644 (file)
@@ -67,17 +67,17 @@ public:
   void computeOutputPattern(int nbExec = -1) throw(Exception);\r
   void computeAdmittanceDelays() throw(Exception); // compute differences between IP and admittance\r
 \r
   void computeOutputPattern(int nbExec = -1) throw(Exception);\r
   void computeAdmittanceDelays() throw(Exception); // compute differences between IP and admittance\r
 \r
-private:  \r
+protected:\r
   // patterns\r
   void createDelta() throw(Exception);\r
   void createConsumptionPattern() throw(Exception); // initialize a QList<char> for each interface from patterns defined in implementation\r
   void createProductionPattern() throw(Exception); // initialize a QList<char> for each interface from patterns defined in implementation\r
   void createProductionCounter() throw(Exception); // initialize a QList<int> from counter defined in implementation\r
   void createAdmittance(int nbExec) throw(Exception); // initialize a QList<char> from consumption pattern and delta\r
   // patterns\r
   void createDelta() throw(Exception);\r
   void createConsumptionPattern() throw(Exception); // initialize a QList<char> for each interface from patterns defined in implementation\r
   void createProductionPattern() throw(Exception); // initialize a QList<char> for each interface from patterns defined in implementation\r
   void createProductionCounter() throw(Exception); // initialize a QList<int> from counter defined in implementation\r
   void createAdmittance(int nbExec) throw(Exception); // initialize a QList<char> from consumption pattern and delta\r
+  void createInputPattern() throw(Exception);\r
 \r
   void clearConsumptionPattern();\r
 \r
   void clearConsumptionPattern();\r
-  void clearProductionPattern();\r
-  void createInputPattern() throw(Exception);\r
+  void clearProductionPattern(); \r
   void clearInputPattern();\r
   void clearOutputPattern();\r
   void clearAdmittanceDelays();\r
   void clearInputPattern();\r
   void clearOutputPattern();\r
   void clearAdmittanceDelays();\r
index ea7f2f7e7b7cc01c8709df86a557162f835e098b..fda0546ed12ff4fb57417ced4dbc4e8d46f948e4 100644 (file)
@@ -12,41 +12,42 @@ int GroupBlock::counter = 1;
 
 GroupBlock::GroupBlock(GroupBlock *_parent, bool createIfaces) throw(Exception) :  AbstractBlock() {
 
 
 GroupBlock::GroupBlock(GroupBlock *_parent, bool createIfaces) throw(Exception) :  AbstractBlock() {
 
+  parent = _parent;
   GroupInterface* clk = NULL;
   GroupInterface* rst = NULL;
   
   // force topGroup to false if this group has a parent
   GroupInterface* clk = NULL;
   GroupInterface* rst = NULL;
   
   // force topGroup to false if this group has a parent
-  if (_parent != NULL) {
+  if (parent != NULL) {
     topGroup = false;
     name = QString("sub_group")+"_"+QString::number(counter++);
     topGroup = false;
     name = QString("sub_group")+"_"+QString::number(counter++);
-    // creating clk/rst interfaces
-    clk = new GroupInterface(this,"clk", AbstractInterface::Input, AbstractInterface::Clock);
-    rst = new GroupInterface(this,"reset", AbstractInterface::Input, AbstractInterface::Reset);
-    addInterface(clk);    
-    addInterface(rst);
-
-    try {
-      connectClkReset();
-    }
-    catch(Exception e) {
-      AbstractBlock* source = (AbstractBlock *)(e.getSource());
-      cerr << qPrintable(source->getName()) << ":" << qPrintable(e.getMessage()) << endl;
-      throw(e);
-    }
   }
   else {
     topGroup = true;
     name = QString("top_group");
     // creating external clk/rst interfaces
   }
   else {
     topGroup = true;
     name = QString("top_group");
     // creating external clk/rst interfaces
-    clk = new GroupInterface(this,"ext_clk", AbstractInterface::Input, AbstractInterface::Clock);
-    rst = new GroupInterface(this,"ext_reset", AbstractInterface::Input, AbstractInterface::Reset);
-    addInterface(clk);
-    addInterface(rst);
-    // creating clkrstgen block and connecting it to this: done in Dispatcher since this has no access to library
-    cout << "created ext_clk and reset ifaces for top group" << endl;
   }
   }
-  parent = _parent;
 
 
+  if (createIfaces) {
+    if (topGroup) {
+      clk = new GroupInterface(this,"ext_clk_0", AbstractInterface::Input, AbstractInterface::Clock);
+      rst = new GroupInterface(this,"ext_reset_0", AbstractInterface::Input, AbstractInterface::Reset);
+      addInterface(clk);
+      addInterface(rst);
+    }
+    else {
+      // get all clock and reset from parent
+      QList<AbstractInterface*> lstClk = parent->getInterfaces(AbstractInterface::Input, AbstractInterface::Clock);
+      QList<AbstractInterface*> lstRst = parent->getInterfaces(AbstractInterface::Input, AbstractInterface::Reset);
+      foreach(AbstractInterface* iface, lstClk) {
+        clk = new GroupInterface(this,iface->getName(),AbstractInterface::Input, AbstractInterface::Clock);
+        addInterface(clk);
+      }
+      foreach(AbstractInterface* iface, lstRst) {
+        rst = new GroupInterface(this,iface->getName(),AbstractInterface::Input, AbstractInterface::Reset);
+        addInterface(rst);
+      }
+    }
+  }
 }
 
 GroupBlock::~GroupBlock() {
 }
 
 GroupBlock::~GroupBlock() {
index c165d029c214f3301c090fb0125ac1aa667d69de..385b352e3e86d4373257005db1800a8d63871f96 100644 (file)
@@ -683,6 +683,7 @@ void GroupItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) {
   QAction* removeAction = NULL;
   QAction* renameAction = NULL;
   QAction* showParameters = NULL;
   QAction* removeAction = NULL;
   QAction* renameAction = NULL;
   QAction* showParameters = NULL;
+  QAction* addExtClkAction = NULL;
 
   InterfaceItem* ifaceItem = getInterfaceItemFromCursor(event->pos().x(), event->pos().y());
 
 
   InterfaceItem* ifaceItem = getInterfaceItemFromCursor(event->pos().x(), event->pos().y());
 
@@ -713,6 +714,10 @@ void GroupItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) {
       showParameters = menu.addAction("Show parameters");
     }
     renameAction = menu.addAction("Rename");
       showParameters = menu.addAction("Show parameters");
     }
     renameAction = menu.addAction("Rename");
+    if (refBlock->isTopGroupBlock()) {
+      addExtClkAction = menu.addAction("Add new external clock/reset");
+    }
+
   }
   QAction* selectedAction = menu.exec(event->screenPos());
 
   }
   QAction* selectedAction = menu.exec(event->screenPos());
 
@@ -732,7 +737,13 @@ void GroupItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) {
   }
   else if(selectedAction == showParameters) {
     new ParametersWindow(refBlock, params, NULL);
   }
   else if(selectedAction == showParameters) {
     new ParametersWindow(refBlock, params, NULL);
-  }   
+  }
+  else if (selectedAction == addExtClkAction) {
+    bool ok = false;
+    double freq = QInputDialog::getDouble(NULL,"Adding a clkrstgen","External clock frequency (in MHz)",100,0,100000,1,&ok);
+    if (!ok) return;
+    dispatcher->addClkRstGenBlock(Dispatcher::Design, freq);
+  }
 }
 
 InterfaceItem* GroupItem::isHoverInterface(QPointF point) {
 }
 
 InterfaceItem* GroupItem::isHoverInterface(QPointF point) {
@@ -802,15 +813,16 @@ void GroupItem::load(QDomElement groupElement) throw(Exception) {
     if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));
     
     GroupInterface *groupIface = new GroupInterface(groupBlock,name,direction,purpose);
     if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));
     
     GroupInterface *groupIface = new GroupInterface(groupBlock,name,direction,purpose);
-    GroupInterface *groupCtlIface = new GroupInterface(groupBlock,name+"_enb",direction,AbstractInterface::Control);
-    groupCtlIface->setAssociatedIface(groupIface);
-    
+    groupBlock->addInterface(groupIface);
     InterfaceItem *interfaceItem = new InterfaceItem(position,orientation,groupIface,this,params);
     interfaceItem->setId(id);
     InterfaceItem *interfaceItem = new InterfaceItem(position,orientation,groupIface,this,params);
     interfaceItem->setId(id);
-
-    groupBlock->addInterface(groupIface);
-    groupBlock->addInterface(groupCtlIface);
     addInterfaceItem(interfaceItem, false);
     addInterfaceItem(interfaceItem, false);
+
+    if (purpose == AbstractInterface::Data) {
+      GroupInterface *groupCtlIface = new GroupInterface(groupBlock,name+"_enb",direction,AbstractInterface::Control);
+      groupCtlIface->setAssociatedIface(groupIface);
+      groupBlock->addInterface(groupCtlIface);
+    }
     cout << "interface add to " << groupBlock->getName().toStdString() << endl;
   }
 
     cout << "interface add to " << groupBlock->getName().toStdString() << endl;
   }
 
diff --git a/InterfacePropertiesDialog.cpp b/InterfacePropertiesDialog.cpp
new file mode 100644 (file)
index 0000000..cc0a3ad
--- /dev/null
@@ -0,0 +1,47 @@
+#include "InterfacePropertiesDialog.h"
+
+#include "ConnectedInterface.h"
+
+InterfacePropertiesDialog::InterfacePropertiesDialog(InterfaceItem *_inter, QWidget *parent) : QDialog(parent) {
+  inter = _inter;
+  QGroupBox* box = new QGroupBox("Properties");
+  okButton = new QPushButton(tr("OK"));
+
+  QGridLayout* layProp = new QGridLayout;
+
+  int w = inter->refInter->getWidth();
+  QString wStr = "";
+  if (w == -1) {
+    wStr = "invalid_size";
+  }
+  else {
+    if (w == 0) w++; // 0 means a boolean thus, size of 1 bit
+    wStr.setNum(w);
+  }
+
+  layProp->addWidget(new QLabel("Interface properties"), 0, 0);
+  layProp->addWidget(new QLabel(" "), 1, 0);
+
+  layProp->addWidget(new QLabel("Name :"), 2, 0);
+  layProp->addWidget(new QLabel(inter->getName()), 2, 1);
+  layProp->addWidget(new QLabel("Width :"), 3, 0);
+  layProp->addWidget(new QLabel(wStr), 3, 1);
+  layProp->addWidget(new QLabel("Direction :"), 4, 0);
+  layProp->addWidget(new QLabel(inter->refInter->getDirectionString()), 4, 1);
+  layProp->addWidget(new QLabel("Purpose :"), 5, 0);
+  layProp->addWidget(new QLabel(inter->refInter->getPurposeString()), 5, 1);
+  layProp->addWidget(new QLabel("Type :"), 6, 0);
+  layProp->addWidget(new QLabel(inter->refInter->getTypeString()), 6, 1);
+
+  QHBoxLayout* layBottom = new QHBoxLayout;
+  layBottom->addStretch();
+  layBottom->addWidget(okButton);
+
+  QVBoxLayout* layAll = new QVBoxLayout;
+  layAll->addLayout(layProp);
+  layAll->addLayout(layBottom);
+
+  setLayout(layAll);
+
+  connect(okButton,SIGNAL(clicked()),this, SLOT(accept()));
+}
diff --git a/InterfacePropertiesDialog.h b/InterfacePropertiesDialog.h
new file mode 100644 (file)
index 0000000..14a83bf
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef __INTERFACEPROPERTIESWINDOW_H__
+#define __INTERFACEPROPERTIESWINDOW_H__
+
+#include <QtWidgets>
+
+#include "InterfaceItem.h"
+
+class InterfacePropertiesDialog : public QDialog {
+
+  Q_OBJECT
+
+public:
+  InterfacePropertiesDialog(InterfaceItem *_inter, QWidget *parent = 0);
+
+private:
+
+  QPushButton *okButton;
+  InterfaceItem *inter;
+
+};
+
+#endif // INTERFACEPROPERTIESWINDOW_H
diff --git a/InterfacePropertiesWindow.cpp b/InterfacePropertiesWindow.cpp
deleted file mode 100644 (file)
index 5a571c0..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#include "InterfacePropertiesWindow.h"
-
-#include "ConnectedInterface.h"
-
-InterfacePropertiesWindow::InterfacePropertiesWindow(InterfaceItem *_inter, QWidget *parent) :
-    QWidget(parent)
-{
-  inter = _inter;
-
-  layout = new QGridLayout;
-
-  int w = inter->refInter->getWidth();
-  QString wStr = "";
-  if (w == -1) {
-    wStr = "invalid_size";
-  }
-  else {
-    if (w == 0) w++; // 0 means a boolean thus, size of 1 bit
-    wStr.setNum(w);
-  }
-
-  layout->addWidget(new QLabel("Interface properties"), 0, 0);
-  layout->addWidget(new QLabel(" "), 1, 0);
-
-  layout->addWidget(new QLabel("Name :"), 2, 0);
-  layout->addWidget(new QLabel(inter->getName()), 2, 1);
-  layout->addWidget(new QLabel("Width :"), 3, 0);
-  layout->addWidget(new QLabel(wStr), 3, 1);
-  layout->addWidget(new QLabel("Direction :"), 4, 0);
-  layout->addWidget(new QLabel(inter->refInter->getDirectionString()), 4, 1);
-  layout->addWidget(new QLabel("Purpose :"), 5, 0);
-  layout->addWidget(new QLabel(inter->refInter->getPurposeString()), 5, 1);  
-  layout->addWidget(new QLabel("Type :"), 6, 0);
-  layout->addWidget(new QLabel(inter->refInter->getTypeString()), 6, 1);
-
-  this->setLayout(layout);
-
-  show();
-}
diff --git a/InterfacePropertiesWindow.h b/InterfacePropertiesWindow.h
deleted file mode 100644 (file)
index 3b372a9..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef __INTERFACEPROPERTIESWINDOW_H__
-#define __INTERFACEPROPERTIESWINDOW_H__
-
-#include <QtWidgets>
-
-#include "InterfaceItem.h"
-
-class InterfacePropertiesWindow : public QWidget
-{
-    Q_OBJECT
-public:
-    explicit InterfacePropertiesWindow(InterfaceItem *_inter, QWidget *parent = 0);
-
-private:
-    QGridLayout *layout;
-    InterfaceItem *inter;
-
-
-
-};
-
-#endif // INTERFACEPROPERTIESWINDOW_H
index 2b8584fc9820779b448edc90bd2965030b0acf33..c7ff634194becd6261e230c5d2c859a47adc18eb 100644 (file)
@@ -319,7 +319,7 @@ void MainWindow::slotLoadProject(){
     GroupWidget* topGroup = dispatcher->loadProject(params->projectFile);
     if (topGroup != NULL) {
       addTopGroup(topGroup);
     GroupWidget* topGroup = dispatcher->loadProject(params->projectFile);
     if (topGroup != NULL) {
       addTopGroup(topGroup);
-      library->updateComboScene();
+      library->updateComboScene();      
       params->isCurrentProject = true;
       enableProjectActions(true, PROJECT_CLOSE | PROJECT_SAVE | PROJECT_SAVEAS | PROJECT_LIB, OP_RAZ);
       enableAnalysisActions(true, ANALYSIS_ANALYZE | ANALYSIS_GENERATE, OP_RAZ);
       params->isCurrentProject = true;
       enableProjectActions(true, PROJECT_CLOSE | PROJECT_SAVE | PROJECT_SAVEAS | PROJECT_LIB, OP_RAZ);
       enableAnalysisActions(true, ANALYSIS_ANALYZE | ANALYSIS_GENERATE, OP_RAZ);
@@ -346,7 +346,7 @@ void MainWindow::slotNewProject(){
     enableAnalysisActions(true, ANALYSIS_ANALYZE | ANALYSIS_GENERATE, OP_RAZ);
     GroupWidget* topGroup = dispatcher->createTopScene(Dispatcher::Design);
     addTopGroup(topGroup);
     enableAnalysisActions(true, ANALYSIS_ANALYZE | ANALYSIS_GENERATE, OP_RAZ);
     GroupWidget* topGroup = dispatcher->createTopScene(Dispatcher::Design);
     addTopGroup(topGroup);
-    library->updateComboScene();
+    library->updateComboScene();    
     library->show();
     params->isCurrentProject = true;
   }
     library->show();
     params->isCurrentProject = true;
   }
index 7e697eb1baabb7bb5cf997543abf403a6ae35611..c2d9bffdfefbb4dccd3b40385f86ede7762ee97b 100644 (file)
@@ -473,7 +473,7 @@ QDataStream& operator<<(QDataStream &out, const ReferenceBlock &b) {
       toWrite << iface->getDirection();
       toWrite << iface->getMultiplicity();
       toWrite << iface->getClockIfaceType();
       toWrite << iface->getDirection();
       toWrite << iface->getMultiplicity();
       toWrite << iface->getClockIfaceType();
-      toWrite << iface->getClockIface();
+      toWrite << iface->getClockIfaceString();
     }
   }
   // secondly write control ifaces
     }
   }
   // secondly write control ifaces
@@ -487,7 +487,7 @@ QDataStream& operator<<(QDataStream &out, const ReferenceBlock &b) {
       toWrite << iface->getDirection();    
       toWrite << iface->getMultiplicity();
       toWrite << iface->getClockIfaceType();
       toWrite << iface->getDirection();    
       toWrite << iface->getMultiplicity();
       toWrite << iface->getClockIfaceType();
-      toWrite << iface->getClockIface();
+      toWrite << iface->getClockIfaceString();
     }
   }
   // secondly, write other ifaces
     }
   }
   // secondly, write other ifaces
@@ -501,7 +501,7 @@ QDataStream& operator<<(QDataStream &out, const ReferenceBlock &b) {
       toWrite << iface->getDirection();    
       toWrite << iface->getMultiplicity();
       toWrite << iface->getClockIfaceType();
       toWrite << iface->getDirection();    
       toWrite << iface->getMultiplicity();
       toWrite << iface->getClockIfaceType();
-      toWrite << iface->getClockIface();
+      toWrite << iface->getClockIfaceString();
     }
   }
   toWrite << b.outputs.size();
     }
   }
   toWrite << b.outputs.size();
@@ -516,7 +516,7 @@ QDataStream& operator<<(QDataStream &out, const ReferenceBlock &b) {
       toWrite << iface->getDirection();    
       toWrite << iface->getMultiplicity();
       toWrite << iface->getClockIfaceType();
       toWrite << iface->getDirection();    
       toWrite << iface->getMultiplicity();
       toWrite << iface->getClockIfaceType();
-      toWrite << iface->getClockIface();
+      toWrite << iface->getClockIfaceString();
     }
   }
   // secondly, write other ifaces
     }
   }
   // secondly, write other ifaces
@@ -530,7 +530,7 @@ QDataStream& operator<<(QDataStream &out, const ReferenceBlock &b) {
       toWrite << iface->getDirection();    
       toWrite << iface->getMultiplicity();
       toWrite << iface->getClockIfaceType();
       toWrite << iface->getDirection();    
       toWrite << iface->getMultiplicity();
       toWrite << iface->getClockIfaceType();
-      toWrite << iface->getClockIface();
+      toWrite << iface->getClockIfaceString();
     }
   }
   toWrite << b.bidirs.size();
     }
   }
   toWrite << b.bidirs.size();
@@ -543,7 +543,7 @@ QDataStream& operator<<(QDataStream &out, const ReferenceBlock &b) {
     toWrite << iface->getDirection();    
     toWrite << iface->getMultiplicity();
     toWrite << iface->getClockIfaceType();
     toWrite << iface->getDirection();    
     toWrite << iface->getMultiplicity();
     toWrite << iface->getClockIfaceType();
-    toWrite << iface->getClockIface();
+    toWrite << iface->getClockIfaceString();
   }
 
   out << blockData;
   }
 
   out << blockData;
diff --git a/SpecialBlock.cpp b/SpecialBlock.cpp
new file mode 100644 (file)
index 0000000..8edff6f
--- /dev/null
@@ -0,0 +1,51 @@
+#include "SpecialBlock.h"\r
+\r
+SpecialBlock::SpecialBlock(SpecialType _type, GroupBlock* _parent, ReferenceBlock* _reference, bool createIfaces) throw(Exception) : FunctionalBlock(_parent, _reference, createIfaces) {\r
+  type = _type;  \r
+}\r
+\r
+SpecialBlock::~SpecialBlock() {\r
+}\r
+\r
+void SpecialBlock::checkInputPatternCompatibility() throw(Exception) {\r
+  try {\r
+    switch(type) {\r
+    case ClockConvert :\r
+      checkInputPatternCompatibilityClockConvert();\r
+      break;\r
+    case ClkRstGen:\r
+      checkInputPatternCompatibilityClkRstGen();\r
+      break;\r
+    }\r
+  }\r
+  catch(Exception e) {\r
+    throw (e);\r
+  }\r
+}\r
+\r
+void SpecialBlock::computeOutputPattern(int nbExec) throw(Exception) {\r
+  try {\r
+    switch(type) {\r
+    case ClockConvert :\r
+      computeOutputPatternClockConvert(nbExec);\r
+      break;\r
+    case ClkRstGen:\r
+      computeOutputPatternClkRstGen(nbExec);\r
+      break;\r
+    }\r
+  }\r
+  catch(Exception e) {\r
+    throw (e);\r
+  }\r
+}\r
+\r
+void SpecialBlock::checkInputPatternCompatibilityClockConvert() throw(Exception) {\r
+}\r
+void SpecialBlock::computeOutputPatternClockConvert(int nbExec) throw(Exception) {\r
+}\r
+\r
+\r
+void SpecialBlock::checkInputPatternCompatibilityClkRstGen() throw(Exception) {\r
+}\r
+void SpecialBlock::computeOutputPatternClkRstGen(int nbExec) throw(Exception) {\r
+}\r
diff --git a/SpecialBlock.h b/SpecialBlock.h
new file mode 100644 (file)
index 0000000..06c6459
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef __SPECIALBLOCK_H__\r
+#define __SPECIALBLOCK_H__\r
+\r
+#include <iostream>\r
+\r
+#include <QtCore>\r
+\r
+#include "FunctionalBlock.h"\r
+class FunctionalBlock; \r
+\r
+using namespace std;\r
+using namespace Qt;\r
+\r
+\r
+\r
+class SpecialBlock : public FunctionalBlock {\r
+public:\r
+\r
+  enum SpecialType { ClockConvert = 0, ClkRstGen = 1 };\r
+  \r
+  SpecialBlock(SpecialType _type, GroupBlock* _parent, ReferenceBlock* _reference, bool createIfaces = true) throw(Exception);\r
+  ~SpecialBlock();\r
+  // getters\r
+  \r
+  // setters\r
+  \r
+  // testers\r
+\r
+  // others\r
\r
+  // patterns\r
+  void checkInputPatternCompatibility() throw(Exception);\r
+  void computeOutputPattern(int nbExec = -1) throw(Exception);\r
+\r
+private:\r
+  SpecialType type;\r
+  \r
+  void checkInputPatternCompatibilityClockConvert() throw(Exception);\r
+  void computeOutputPatternClockConvert(int nbExec = -1) throw(Exception);\r
+  void checkInputPatternCompatibilityClkRstGen() throw(Exception);\r
+  void computeOutputPatternClkRstGen(int nbExec = -1) throw(Exception);\r
+\r
+};\r
+\r
+\r
+\r
+#endif // __SPEICALBLOCK_H__\r
index 6a8ea4d52a1f32b4521c55a1a00360fa70fa871f..53965192aac5abe863c968de9037acd2d54870d5 100644 (file)
@@ -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 4.2.0, 2018-04-27T16:43:37. -->
+<!-- Written by QtCreator 4.2.0, 2018-04-30T11:05:13. -->
 <qtcreator>
  <data>
   <variable>EnvironmentId</variable>
 <qtcreator>
  <data>
   <variable>EnvironmentId</variable>
index 01d93d0ea02040d0de2f351c5e643d7eaf28ccdc..114b32dca72a92ad76392027f9a39acb46aef60e 100755 (executable)
@@ -2,6 +2,8 @@ ExternalResource.cpp
 ExternalResource.h
 CustomDialog.h
 CustomDialog.cpp
 ExternalResource.h
 CustomDialog.h
 CustomDialog.cpp
+InterfacePropertiesDialog.cpp
+InterfacePropertiesDialog.h
 NewProjectDialog.h
 NewProjectDialog.cpp
 Exception.h
 NewProjectDialog.h
 NewProjectDialog.cpp
 Exception.h
@@ -16,6 +18,8 @@ AbstractBoxItem.h
 AbstractBoxItem.cpp
 FunctionalBlock.cpp
 FunctionalBlock.h
 AbstractBoxItem.cpp
 FunctionalBlock.cpp
 FunctionalBlock.h
+SpecialBlock.cpp
+SpecialBlock.h
 GroupBlock.h
 GroupBlock.cpp
 BlockImplementation.h
 GroupBlock.h
 GroupBlock.cpp
 BlockImplementation.h
@@ -83,5 +87,3 @@ ParametersWindow.h
 ParametersWindow.cpp
 ArithmeticEvaluator.cpp
 ArithmeticEvaluator.h
 ParametersWindow.cpp
 ArithmeticEvaluator.cpp
 ArithmeticEvaluator.h
-InterfacePropertiesWindow.h
-InterfacePropertiesWindow.cpp
index 354465035fdc6a530bb2b8c9dc949108b4ec5b08..9092eabd57784bca851790098a38deda92acb8a4 100644 (file)
@@ -9,7 +9,10 @@
     <category name="wishbone" id="5" parent="0"/>
     <category name="generators" id="6" parent="0"/>
     <category name="observers" id="7" parent="0"/>
     <category name="wishbone" id="5" parent="0"/>
     <category name="generators" id="6" parent="0"/>
     <category name="observers" id="7" parent="0"/>
-    <category name="user" id="8" parent="0"/>
+    <category name="special" id="8" parent="0"/>
+    <category name="clock related" id="9" parent="8"/>
+    <category name="clock domain converter" id="10" parent="9"/>        
+    <category name="user" id="66" parent="0"/>
     <category name="unclassified" id="99" parent="0"/>
   </categories>
 
     <category name="unclassified" id="99" parent="0"/>
   </categories>
 
index f2e8067992b095109f2ed871e487eeba2bcc0b83..0a2f0e6ee6405e605e6351d4cb6e2f6ba6b1127d 100644 (file)
Binary files a/lib/implementations/impls.bmf and b/lib/implementations/impls.bmf differ
index 32255bae20bbd00275e88a2a27d457237aee8d26..293b847f3eba200c83c37b04a52090d13093eae0 100644 (file)
@@ -4,7 +4,7 @@
     <name>
       apf27_wb_master
     </name>
     <name>
       apf27_wb_master
     </name>
-    <category ids="100" />  
+    <category ids="8" />  
     <description>
       <brief>
        This block is the wishbone master of the design, connected to the i.MX of APF27
     <description>
       <brief>
        This block is the wishbone master of the design, connected to the i.MX of APF27
index 40ee12ff311181517948cd63ca47b34c01fdefdd..1df9cf1e4c4604a05631bda95c65b8bf96dffddf 100644 (file)
@@ -2,7 +2,7 @@
 <block version="0.1">
   <informations>
     <name>clkdomain_convert_1024x8</name>
 <block version="0.1">
   <informations>
     <name>clkdomain_convert_1024x8</name>
-    <category ids="6"/>
+    <category ids="10"/>
     <description>
       <brief>This IP allows to pass 8 bits values from a clock domain to another. It uses a FIFO of 1024 entries.
 </brief>
     <description>
       <brief>This IP allows to pass 8 bits values from a clock domain to another. It uses a FIFO of 1024 entries.
 </brief>
       <input width="1" multiplicity="1" endian="little" type="boolean" name="clk_rd" purpose="clock"/>
       <input width="1" multiplicity="1" endian="little" type="boolean" name="clk_wr" purpose="clock"/>
       <input width="1" multiplicity="1" endian="little" type="boolean" name="reset" purpose="reset"/>
       <input width="1" multiplicity="1" endian="little" type="boolean" name="clk_rd" purpose="clock"/>
       <input width="1" multiplicity="1" endian="little" type="boolean" name="clk_wr" purpose="clock"/>
       <input width="1" multiplicity="1" endian="little" type="boolean" name="reset" purpose="reset"/>
-      <input width="8" multiplicity="1" endian="little" type="natural" name="data_in" purpose="data"/>
+      <input width="8" multiplicity="1" endian="little" type="natural" name="data_in" purpose="data" clock="clk_rd"/>
       <control iface="data_in"/>
     </inputs>
     <outputs>
       <control iface="data_in"/>
     </inputs>
     <outputs>
-      <output width="8" multiplicity="1" endian="little" type="natural" name="data_out" purpose="data"/>
+      <output width="8" multiplicity="1" endian="little" type="natural" name="data_out" purpose="data" clock="clk_wr"/>
       <control iface="data_out"/>
     </outputs>
   </interfaces>
       <control iface="data_out"/>
     </outputs>
   </interfaces>
index 79b60a9507847ffdb8b8bd760f4cd11886c74973..5f06f17b1e5a9eaacfe5683c7cd54279a08ef648 100644 (file)
@@ -7,11 +7,11 @@
     <category ids="100" />  
     <description>
       <brief>
     <category ids="100" />  
     <description>
       <brief>
-       This block generate a reset signal synchronous to clock
+       This block generates a reset signal synchronous to an external clock
       </brief>
       <detailed>
       </brief>
       <detailed>
-       This block generate a reset signal synchronous to clock and is the entry point
-       of the external clock and asynchronous reset.
+       This block generates a reset signal synchronous to clock. The block is automatically
+       connected to the external clock and asynchronous reset.
       </detailed>     
     </description>    
   </informations>
       </detailed>     
     </description>    
   </informations>
index 67e76eea9b6b68bd9b036454f0151a154c32ccdc..633acf924abd9235d3480563ac01b262e2b28313 100644 (file)
Binary files a/lib/references/references.bmf and b/lib/references/references.bmf differ
index 13f2ff62ff0137087a263a8e41945ffabc81f31b..2adb35efc2606fddf88732149f4c31e5e1204810 100644 (file)
@@ -1,5 +1,6 @@
 COMMON-OBJ = $(BUILDPATH)/AbstractBlock.o \
           $(BUILDPATH)/FunctionalBlock.o \
 COMMON-OBJ = $(BUILDPATH)/AbstractBlock.o \
           $(BUILDPATH)/FunctionalBlock.o \
+          $(BUILDPATH)/SpecialBlock.o \
           $(BUILDPATH)/ReferenceBlock.o \
           $(BUILDPATH)/GroupBlock.o \
            $(BUILDPATH)/AbstractInterface.o \
           $(BUILDPATH)/ReferenceBlock.o \
           $(BUILDPATH)/GroupBlock.o \
            $(BUILDPATH)/AbstractInterface.o \
@@ -47,8 +48,8 @@ COMMON-OBJ = $(BUILDPATH)/AbstractBlock.o \
            $(BUILDPATH)/moc_BlocksToConfigureWidget.o \
            $(BUILDPATH)/ParametersWindow.o \
            $(BUILDPATH)/moc_ParametersWindow.o \
            $(BUILDPATH)/moc_BlocksToConfigureWidget.o \
            $(BUILDPATH)/ParametersWindow.o \
            $(BUILDPATH)/moc_ParametersWindow.o \
-           $(BUILDPATH)/InterfacePropertiesWindow.o \
-           $(BUILDPATH)/moc_InterfacePropertiesWindow.o \
+           $(BUILDPATH)/InterfacePropertiesDialog.o \
+           $(BUILDPATH)/moc_InterfacePropertiesDialog.o \
           $(BUILDPATH)/CustomDialog.o \
           $(BUILDPATH)/moc_CustomDialog.o \
           $(BUILDPATH)/NewProjectDialog.o \
           $(BUILDPATH)/CustomDialog.o \
           $(BUILDPATH)/moc_CustomDialog.o \
           $(BUILDPATH)/NewProjectDialog.o \