+
+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) {
+ delete [] comboClkGen;
+ nbClock = 0;
+ }
+ if (nbRst != 0) {
+ delete [] comboRstGen;
+ nbRst = 0;
+ }
+
+ if ((idCat == -1) || (idBlock == -1)) return;
+
+ QList<AbstractInterface*> lstClocks = currentRefBlock->getInterfaces(AbstractInterface::Input, AbstractInterface::Clock);
+ nbClock = lstClocks.size();
+ QList<AbstractInterface*> lstRst = currentRefBlock->getInterfaces(AbstractInterface::Input, AbstractInterface::Reset);
+ nbRst = lstRst.size();
+ cout << "For chosen block there are " << nbClock << " clocks and " << nbRst << " resets" << endl;
+
+ 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->getGraph()->getClocks()) {
+ 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->getGraph()->getClocks().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++;
+ }
+}
+
+void BlockLibraryWidget::enableAvailableClocks(bool state) {
+
+ if (state == false) {
+ stack->setCurrentIndex(0);
+ }
+ else {
+ stack->setCurrentIndex(1);
+ }
+}
+