#include "BlockLibraryWidget.h"
#include "BlockLibraryTree.h"
+#include "Graph.h"
BlockLibraryWidget::BlockLibraryWidget(Dispatcher* _dispatcher,
Parameters* _params,
QString msg = "Connect to main clock/rst ext_clk/reset_0 (";
- msg += QString::number(params->clocks.at(0));
+ msg += QString::number(params->getGraph()->getClock(0));
msg += ")";
radAutoClk = new QRadioButton(msg);
radChooseClk = new QRadioButton("Choose among available clk/rst");
cout << "adding block to scene " << v.toInt() << endl;
QHash<QString, int> clkRstToGen;
- for(int i=0;i<layClkRst->rowCount();i++) {
+ for(int i=1;i<=nbClock+nbRst;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());
+ cout << "addblock: have to connect " << qPrintable(lab->text()) << " to clk/rst n° " << combo->currentIndex() << endl;
}
//enableAvailableClocks(true);
}
QString msg = "Auto-connect to main clk/rst (ext_clk_0 at ";
- msg += QString::number(params->clocks.at(0));
+ msg += QString::number(params->getGraph()->getClock(0));
msg += " MHz)";
radAutoClk->setText(msg);
}
QWidget* widget = layClkRst->itemAt(0)->widget();
layClkRst->removeWidget(widget);
delete widget;
- }
+ }
if (nbClock != 0) {
delete [] comboClkGen;
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->clocks) {
+ foreach(double d, params->getGraph()->getClocks()) {
name = "ext_clk_"+QString::number(id)+" (";
name += QString::number(d) + " MHz)";
comboClkGen[i]->addItem(name);
for(int i=0;i<lstRst.size();i++) {
comboRstGen[i] = new QComboBox();
QString name = "";
- for(int j=0;j<params->clocks.size();j++) {
+ for(int j=0;j<params->getGraph()->getClocks().size();j++) {
name = "ext_rst_"+QString::number(j);
comboRstGen[i]->addItem(name);
}