return lst;\r
}\r
\r
-void AbstractBlock::connectClock(QString clkName, int idGen) throw(Exception) {\r
-\r
- GroupBlock* parentBlock = AB_TO_GRP(parent); \r
- ConnectedInterface* fromClk = NULL;\r
- ConnectedInterface* toClk = AI_TO_CON(getIfaceFromName(clkName));\r
-\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
- 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
-void AbstractBlock::connectReset(QString rstName, int idGen) throw(Exception) {\r
-\r
- GroupBlock* parentBlock = AB_TO_GRP(parent);\r
- ConnectedInterface* fromRst = NULL;\r
- ConnectedInterface* toRst = AI_TO_CON(getIfaceFromName(rstName));\r
-\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
- fromRst = AI_TO_CON(clkrstgen->getIfaceFromName("reset"));\r
- }\r
- cout << "connecting reset for " << qPrintable(name) << " to " << qPrintable(genName) << endl;\r
- }\r
- else {\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 (fromRst == NULL) {\r
- throw(Exception(IFACE_GROUP_NOCLKRST,parentBlock));\r
- }\r
- else {\r
- fromRst->connectTo(toRst);\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
void AbstractBlock::generateEntity(QTextStream& out, bool hasController) throw(Exception) {\r
\r
out << "entity " << name << " is" << endl;\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
+ */ \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
if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));
int dimY = dimensionStr.at(1).toInt(&ok);
if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));
+
+ QString visStr = funcElement.attribute("visible","none");
+ bool showItem = true;
+ if (visStr == "false") {
+ showItem = false;
+ }
ReferenceBlock *referenceMd5 = NULL;
ReferenceBlock *referenceXml = NULL;
}
GroupBlock* parentGroupBlock = AB_TO_GRP(((GroupItem *)parentItem())->getRefBlock());
- FunctionalBlock* functionalBlock = params->getGraph()->createFunctionalBlock(parentGroupBlock, reference);
+ FunctionalBlock* functionalBlock = params->getGraph()->createFunctionalBlock(parentGroupBlock, reference, false);
/* NB: addFunctionalBlock creates all interfaces from the reference, which is annoying when
reading bif_iface tags. Thus interface are all removed.
*/
}
// recreate all (non-control) interfaces because of some may have a multiplicity>1 with several examplars
- functionalBlock->removeAllInterfaces();
+ //functionalBlock->removeAllInterfaces();
QDomNodeList interfaceNodes = funcElement.elementsByTagName("bif_iface");
// setting interfaces (user name, and for multiplicity>1 may be create some new ones)
for(int i=0; i<interfaceNodes.length(); i++) {
interfaceItem->setOrientation(orientation);
interfaceItem->setPositionRatio(position);
}
+ setVisible(showItem);
updateGeometry(Resize);
}
writer.writeAttribute("position",attrPos);
QString attrDim = QString::number(getWidth()).append(",").append(QString::number(getHeight()));
writer.writeAttribute("dimension",attrDim);
+ if (!isVisible()) {
+ writer.writeAttribute("visible","false");
+ }
writer.writeStartElement("bif_parameters");
foreach(BlockParameter *param,refBlock->getParameters()){
//int ConnectionItem::counter = 0;
-ConnectionItem::ConnectionItem(InterfaceItem* _iface1,
- InterfaceItem* _iface2,
+ConnectionItem::ConnectionItem(InterfaceItem* _fromInterfaceItem,
+ InterfaceItem* _toInterfaceItem,
Dispatcher* _dispatcher,
Parameters* _params) : QGraphicsItem() {
dispatcher = _dispatcher;
params = _params;
+ fromInterfaceItem = _fromInterfaceItem;
+ toInterfaceItem = _toInterfaceItem;
+
+ /* NOTE: originally, the following was testing the correct order
+ * to connect the 2 interfaces. Presently, the order is predetermined
+ * when testing the AbstractInterface objets that must be connected.
ConnectedInterface* ref1 = _iface1->refInter;
ConnectedInterface* ref2 = _iface2->refInter;
- /* ref. note in .h
+ ref. note in .h
case 1 : ref1 is group interface, and ref2 block interface of a block within the group
case 2 : the opposite of case 1
case 3 : ref1 and ref2 are block interface of blocks that are both within the same parent group.
- case 4 : ref1 is source interface and ref2 interface of top group
+ case 4 : ref1 is stimuli interface and ref2 interface of top group
case 5 : the opposite of case 4
- */
+
if (ref1->getOwner() == ref2->getOwner()->getParent()) {
if (ref1->getDirection() == AbstractInterface::Input) {
}
}
else if ((ref1->getOwner()->isStimuliBlock()) && (ref2->getOwner()->isTopGroupBlock())) {
- fromInterfaceItem = _iface1;
+ fromInterfaceItem = _iface1;
toInterfaceItem = _iface2;
}
else if ((ref2->getOwner()->isStimuliBlock()) && (ref1->getOwner()->isTopGroupBlock())) {
- fromInterfaceItem = _iface2;
+ fromInterfaceItem = _iface2;
toInterfaceItem = _iface1;
}
+
+ */
// adding this to interface items
fromInterfaceItem->addConnectionItem(this);
toInterfaceItem->addConnectionItem(this);
public:
- ConnectionItem(InterfaceItem* _iface1,
- InterfaceItem* _iface2,
+ ConnectionItem(InterfaceItem* _fromInterfaceItem,
+ InterfaceItem* _toInterfaceItem,
Dispatcher* _dispatcher,
Parameters* _params);
ConnectionItem (const ConnectionItem & copy);
}
if ((ok1 == true) || (ok2 == true)) {
- iface1->getOwner()->getScene()->createConnectionItem(iface1,iface2, visible);
+ cout << "trying to create a connection from " << qPrintable(ref1->getOwner()->getName()) << "/" << qPrintable(ref1->getName());
+ cout << " to " << qPrintable(ref2->getOwner()->getName()) << "/" << qPrintable(ref2->getName());
+
+ if (ok1) {
+ iface1->getOwner()->getScene()->createConnectionItem(iface1,iface2, visible);
+ }
+ else {
+ iface2->getOwner()->getScene()->createConnectionItem(iface2,iface1, visible);
+ }
+
+ cout << " ... done." << endl;
unselectAllItems(context);
- params->unsaveModif = true;
- cout << "created a connection from " << qPrintable(ref1->getName()) << " to " << qPrintable(ref2->getName()) << endl;
+ params->unsaveModif = true;
return true;
}
return false;
}
-BoxItem* Dispatcher::addBlock(Context context, int idCategory, int idBlock, int idScene, QHash<QString, int> clkRstToGen) {
+void 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;
#endif
- bool newStimuli = false;
- BoxItem* item = NULL;
+ bool newStimuli = false;
/* For now, this method is only used while designing and not loading */
if (context == Design) {
}
if (newStimuli) {
FunctionalBlock* newOne = params->getGraph()->createStimuliBlock(ref, true);
- scene->createStimuliItem(newOne);
+ StimuliItem* item = scene->createStimuliItem(newOne);
+ QHashIterator<QString,int> iter(clkRstToGen);
+ while (iter.hasNext()) {
+ iter.next();
+ AbstractInterface* iface = newOne->getIfaceFromName(iter.key());
+ if (iface->getPurpose() == AbstractInterface::Clock) {
+ connectStimuliItemClock(context,item,iface->getName(),iter.value());
+ }
+ else if (iface->getPurpose() == AbstractInterface::Reset) {
+ connectStimuliItemReset(context,item,iface->getName(),iter.value());
+ }
+ }
}
else {
FunctionalBlock* newOne = params->getGraph()->createFunctionalBlock(group, ref, true);
// creating the box item
- 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());
- }
+ BoxItem* item = scene->createBoxItem(newOne);
+
+ QHashIterator<QString,int> iter(clkRstToGen);
+ while (iter.hasNext()) {
+ iter.next();
+ AbstractInterface* iface = newOne->getIfaceFromName(iter.key());
+ if (iface->getPurpose() == AbstractInterface::Clock) {
+ connectBoxItemClock(context,item,iface->getName(),iter.value());
+ }
+ else if (iface->getPurpose() == AbstractInterface::Reset) {
+ connectBoxItemReset(context,item,iface->getName(),iter.value());
}
}
+
params->blockToItem.insert(newOne,item);
}
params->unsaveModif = true;
}
-
- return item;
}
void Dispatcher::addClkRstGenBlock(Context context, double frequency) {
}
}
+void Dispatcher::connectBoxItemClock(Context context, BoxItem *item, QString clkName, int idGen) throw(Exception) {
+
+ InterfaceItem* fromIfaceItemClk = NULL;
+ InterfaceItem* toIfaceItemClk = item->searchInterfaceItemByName(clkName);
+ GroupItem* parentGroup = item->getScene()->getGroupItem();
+ BoxItem* clkrstItem = NULL;
+
+ if (parentGroup->getRefBlock()->isTopGroupBlock()) {
+ QString genName = "clkrstgen_" + QString::number(idGen);
+ clkrstItem = item->getScene()->searchBoxItemByName(genName);
+ if (clkrstItem == NULL) {
+ throw(Exception(IFACE_TOP_NOCLKRSTGEN));
+ }
+ else {
+ fromIfaceItemClk = clkrstItem->searchInterfaceItemByName("clk");
+ }
+ cout << "connecting clock of " << qPrintable(item->getRefBlock()->getName()) << " to clk of " << qPrintable(genName) << endl;
+ }
+ else {
+ // searching for ext_clk_idGen
+ QString name = "ext_clk_"+QString::number(idGen);
+ fromIfaceItemClk = parentGroup->searchInterfaceItemByName(name);
+ cout << "connecting clock of " << qPrintable(item->getRefBlock()->getName()) << " to " << qPrintable(name) << " of parent group " << qPrintable(parentGroup->getRefBlock()->getName()) << endl;
+ }
+
+ if (fromIfaceItemClk == NULL) {
+ throw(Exception(IFACE_GROUP_NOCLKRST));
+ }
+ else {
+ createConnection(context, fromIfaceItemClk, toIfaceItemClk, false);
+ cout << "connection done." << endl;
+ }
+}
+
+void Dispatcher::connectBoxItemReset(Context context, BoxItem *item, QString rstName, int idGen) throw(Exception) {
+ InterfaceItem* fromIfaceItemRst = NULL;
+ InterfaceItem* toIfaceItemRst = item->searchInterfaceItemByName(rstName);
+ GroupItem* parentGroup = item->getScene()->getGroupItem();
+ BoxItem* clkrstItem = NULL;
+
+ if (parentGroup->getRefBlock()->isTopGroupBlock()) {
+ QString genName = "clkrstgen_" + QString::number(idGen);
+ clkrstItem = item->getScene()->searchBoxItemByName(genName);
+ if (clkrstItem == NULL) {
+ throw(Exception(IFACE_TOP_NOCLKRSTGEN));
+ }
+ else {
+ fromIfaceItemRst = clkrstItem->searchInterfaceItemByName("reset");
+ }
+ cout << "connecting reset of " << qPrintable(item->getRefBlock()->getName()) << " to reset of " << qPrintable(genName) << endl;
+ }
+ else {
+ // searching for ext_rst_idGen
+ QString name = "ext_rst_"+QString::number(idGen);
+ fromIfaceItemRst = parentGroup->searchInterfaceItemByName(name);
+ cout << "connecting reset of " << qPrintable(item->getRefBlock()->getName()) << " to " << qPrintable(name) << " of parent group " << qPrintable(parentGroup->getRefBlock()->getName()) << endl;
+ }
+
+ if (fromIfaceItemRst == NULL) {
+ throw(Exception(IFACE_GROUP_NOCLKRST));
+ }
+ else {
+ createConnection(context, fromIfaceItemRst, toIfaceItemRst, false);
+ cout << "connection done." << endl;
+ }
+}
+
+void Dispatcher::connectStimuliItemClock(Context context, StimuliItem *item, QString clkName, int idGen) throw(Exception) {
+ InterfaceItem* fromIfaceItemClk = NULL;
+ InterfaceItem* toIfaceItemClk = item->searchInterfaceItemByName(clkName);
+ BoxItem* clkrstItem = NULL;
+
+ QString genName = "clkrstgen_" + QString::number(idGen);
+ clkrstItem = item->getScene()->searchBoxItemByName(genName);
+ if (clkrstItem == NULL) {
+ throw(Exception(IFACE_TOP_NOCLKRSTGEN));
+ }
+ else {
+ fromIfaceItemClk = clkrstItem->searchInterfaceItemByName("clk");
+ }
+ cout << "connecting clock of " << qPrintable(item->getRefBlock()->getName()) << " to clock of " << qPrintable(genName) << endl;
+
+ if (fromIfaceItemClk == NULL) {
+ throw(Exception(IFACE_GROUP_NOCLKRST));
+ }
+ else {
+ createConnection(context, fromIfaceItemClk, toIfaceItemClk, false);
+ cout << "connection done." << endl;
+ }
+}
+
+void Dispatcher::connectStimuliItemReset(Context context, StimuliItem *item, QString rstName, int idGen) throw(Exception) {
+ InterfaceItem* fromIfaceItemRst = NULL;
+ InterfaceItem* toIfaceItemRst = item->searchInterfaceItemByName(rstName);
+ BoxItem* clkrstItem = NULL;
+
+ QString genName = "clkrstgen_" + QString::number(idGen);
+ clkrstItem = item->getScene()->searchBoxItemByName(genName);
+ if (clkrstItem == NULL) {
+ throw(Exception(IFACE_TOP_NOCLKRSTGEN));
+ }
+ else {
+ fromIfaceItemRst = clkrstItem->searchInterfaceItemByName("reset");
+ }
+ cout << "connecting reset of " << qPrintable(item->getRefBlock()->getName()) << " to reset of " << qPrintable(genName) << endl;
+
+ if (fromIfaceItemRst == NULL) {
+ throw(Exception(IFACE_GROUP_NOCLKRST));
+ }
+ else {
+ createConnection(context, fromIfaceItemRst, toIfaceItemRst, false);
+ cout << "connection done." << endl;
+ }
+}
+
+
void Dispatcher::showBlocksLibrary(){
cout << "showing block library" << endl;
mainWindow->getLibrary()->show();
/**************************
* block ops
*************************/
- BoxItem* addBlock(Context context, int idCategory, int idBlock, int idScene, QHash<QString,int> clkRstToGen );
+ void 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);
bool createConnection(Context context, InterfaceItem *iface1, InterfaceItem *iface2, bool visible = true);
void removeAllBlockConnections(Context context, AbstractBoxItem *item);
void removeConnection(Context context, ConnectionItem *conn);
+ void connectBoxItemClock(Context context, BoxItem* item, QString clkName, int idGen = 0) throw(Exception);
+ void connectBoxItemReset(Context context, BoxItem* item, QString rstName, int idGen = 0) throw(Exception);
+ void connectStimuliItemClock(Context context, StimuliItem* item, QString clkName, int idGen = 0) throw(Exception);
+ void connectStimuliItemReset(Context context, StimuliItem* item, QString rstName, int idGen = 0) throw(Exception);
// analysis ops
delta = -1;\r
evaluator = NULL;\r
\r
+ BlockParameter* p;\r
+ // create parameters from reference block\r
+ QList<BlockParameter*> lstParam = reference->getParameters();\r
+ for(int i=0;i<lstParam.size();i++) {\r
+ p = lstParam.at(i)->clone();\r
+ addParameter(p);\r
+ }\r
+\r
if (createIfaces) {\r
populate();\r
}\r
-\r
}\r
\r
FunctionalBlock::~FunctionalBlock() {\r
}\r
\r
void FunctionalBlock::populate() {\r
- int i;\r
- BlockParameter* p;\r
- AbstractInterface* inter;\r
-\r
- // create parameters from reference block\r
- QList<BlockParameter*> lstParam = reference->getParameters();\r
- for(i=0;i<lstParam.size();i++) {\r
- p = lstParam.at(i)->clone();\r
- addParameter(p);\r
- }\r
+ int i; \r
\r
+ AbstractInterface* inter;\r
ConnectedInterface* toClk = NULL;\r
ConnectedInterface* toRst = NULL;\r
// create interfaces from reference block\r
- iface type must be functional or group interface\r
- iface->connectedFrom must be NULL\r
\r
- valid cases:\r
+ valid "normal" cases:\r
1 - iface is owned by a block (group or func) that is within the same group as the block that own this\r
1.1 - this is output and iface is input\r
1.2 - both are inout\r
2.2 - both are inout\r
3 - this is owned by a source block and iface is owned by the top group\r
\r
+ special case : clk/reset from clkrstgen can connect to stimuli clk/reset\r
+\r
*/\r
if (direction == Input) return false;\r
if (iface->isReferenceInterface()) return false;\r
ConnectedInterface* connIface = AI_TO_CON(iface);\r
if (connIface->getConnectedFrom() != NULL) return false;\r
+ // special case\r
+ if ((getOwner()->getName().startsWith("clkrstgen")) && (iface->getOwner()->isStimuliBlock())) {\r
+ if ((direction == Output) && (iface->getDirection() == Input)) {\r
+ if ((purpose == AbstractInterface::Clock) && (iface->getPurpose() == AbstractInterface::Clock)) return true;\r
+ else if ((purpose == AbstractInterface::Reset) && (iface->getPurpose() == AbstractInterface::Reset)) return true;\r
+ }\r
+ }\r
+\r
// first case: interface of blocks within the same group\r
if (getOwner()->getParent() == iface->getOwner()->getParent()) {\r
\r
2 - iface is owned by the parent group of the block that owns this\r
2.1 - this is an input, iface is an input of the group\r
2.2 - both are inout\r
+\r
+ special case : clk/reset of stimuli can connect from clk/reset of clkrstgen\r
*/\r
if (direction == Output) return false;\r
if (iface->isReferenceInterface()) return false;\r
if (connectedFrom != NULL) return false;\r
\r
+ // special case\r
+ if ((iface->getOwner()->getName().startsWith("clkrstgen")) && (getOwner()->isStimuliBlock())) {\r
+ if ((direction == Input) && (iface->getDirection() == Output)) {\r
+ if ((purpose == AbstractInterface::Clock) && (iface->getPurpose() == AbstractInterface::Clock)) return true;\r
+ else if ((purpose == AbstractInterface::Reset) && (iface->getPurpose() == AbstractInterface::Reset)) return true;\r
+ }\r
+ }\r
+\r
if (getOwner()->getParent() == iface->getOwner()->getParent()) {\r
\r
if ((direction == Input) && (iface->getDirection() == Output) && (purpose == iface->getPurpose())) return true;\r
GroupInterface *groupIface = new GroupInterface(groupBlock,name,direction,purpose);
groupBlock->addInterface(groupIface);
- InterfaceItem *interfaceItem = new InterfaceItem(position,orientation,groupIface,this,params);
+ bool show = false;
+ if ((groupBlock->isTopGroupBlock()) && (purpose == AbstractInterface::Clock)) {
+ show = true;
+ }
+
+ InterfaceItem *interfaceItem = new InterfaceItem(position,orientation,groupIface,this,params,show);
interfaceItem->setId(id);
addInterfaceItem(interfaceItem, false);
groupCtlIface->setAssociatedIface(groupIface);
groupBlock->addInterface(groupCtlIface);
}
- cout << "interface add to " << groupBlock->getName().toStdString() << endl;
+ cout << "interface " << qPrintable(name) << " added to " << groupBlock->getName().toStdString() << endl;
}
}
#include "ConnectionItem.h"
#include "InterfaceItem.h"
#include "AbstractBlock.h"
+#include "Graph.h"
GroupScene::GroupScene(GroupScene *_parentScene, GroupWidget *_window, Dispatcher* _dispatcher, Parameters* _params, bool _topScene, QObject *parent) : QGraphicsScene(parent) {
dispatcher = _dispatcher;
groupItem->updateShape();
}
+BoxItem* GroupScene::searchBoxItemByName(QString name) {
+ foreach(BoxItem* item, boxItems) {
+ if (item->getRefBlock()->getName() == name) {
+ return item;
+ }
+ }
+ return NULL;
+}
+
StimuliItem *GroupScene::createStimuliItem(AbstractBlock *block) {
StimuliItem* item = new StimuliItem(block,dispatcher,params);
else {
writer.writeAttribute("upper_scene",QString::number(parentScene->getId()));
}
+ if (isTopScene()) {
+ QString clkList = "";
+ QList<double> lst = params->getGraph()->getClocks();
+ foreach(double d, lst) {
+ clkList += QString::number(d)+",";
+ }
+ clkList.chop(1);
+ writer.writeAttribute("clkList",clkList);
+
+ }
groupItem->save(writer);
if (isTopScene()) {
BoxItem* createBoxItem(AbstractBlock* block, BoxItem::Position position = BoxItem::Free, int lock = AbstractBoxItem::NoLock, BoxItem::SpanType span = BoxItem::NoSpan); //! create a new BoxItem and place it at the center of the scene
void addBoxItem(BoxItem* item); //! add an already configured BoxItem in the scene.
void removeBoxItem(BoxItem* item);
+ BoxItem* searchBoxItemByName(QString name);
// ConnectionItem related
void createConnectionItem(InterfaceItem* iface1, InterfaceItem* iface2, bool visible = true);
+++ /dev/null
-OPT := params-isim.txt
-
-include $(OPT)
-
-ISIM_DIR := isim
-
-ISIM_LIB := work
-
-all : project compile
-
-project : $(PROJECT_NAME).prj
-
-compile : $(PROJECT_NAME).prj $(VHDL_SRC)
- tb_name=$$( echo $(TB_SRC) | sed 's,.*/,,' | sed 's,[.].*,,'); \
- fuse $(ISIM_LIB).$$tb_name $(ISIM_LIB).glbl -prj $(PROJECT_NAME).prj -L unisim -L secureip -timeprecision_vhdl ps -o $(SIMU_EXE)
-
-view :
- $(SIMU_EXE) -gui -wdb $(SIMU_EXE).wdb
-
-$(PROJECT_NAME).prj :
- if [ -f $@ ]; then rm $@; fi
- echo "### VHDL sources"
- for fich in $(VHDL_SRC); do echo vhdl $(ISIM_LIB) $$fich >> $@; done
- echo "### verilog sources"
- for fich in $(VL_SRC); do echo verilog $(ISIM_LIB) $$fich >> $@; done
- echo "### test bench sources"
- for fich in $(TB_SRC); do echo vhdl $(ISIM_LIB) $$fich >> $@; done
-
-clean :
- rm -f *~
- rm -f $(PROJECT_NAME).prj
- cd $(SRC_DIR); rm -f *~
- cd $(TB_DIR); rm -f *~
\r
void Parameters::destroyGraph() {\r
delete graph;\r
+ graph = new Graph();\r
}\r
\r
ReferenceBlock* Parameters::getReferenceBlock(int idCategory, int idBlock) {\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
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
- 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
\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
// assign pattern to interface\r
connIface->setOutputPattern(pattern);\r
// store it in QMap\r
- outputPattern.insert(connIface,pattern);\r
+ outputPattern.insert(connIface,pattern); \r
}\r
setOutputPatternComputed(true);\r
}\r
AbstractInterface* clkIn = getIfaceFromName("clk_in");\r
AbstractInterface* clkOut = getIfaceFromName("clk_out");\r
cout << "freq clk_in = " << clkIn->getClockFrequency() << endl;\r
- cout << "freq clk_out = " << clkOut->getClockFrequency() << endl;\r
-\r
- // in case of inputPattern not created, do it\r
- if (lengthIP <= 0) {\r
-\r
- cout << "Strange case: input pattern is not created while it is time to compute output pattern !" << endl;\r
- // collect the input patterns for each input\r
- try {\r
- createInputPattern();\r
+ cout << "freq clk_out = " << clkOut->getClockFrequency() << endl; \r
+ double periodIn = 1000.0/clkIn->getClockFrequency();\r
+ double periodOut = 1000.0/clkOut->getClockFrequency();\r
+ cout << "period clk_in = " << periodIn << endl;\r
+ cout << "period clk_out = " << periodOut << endl;\r
+ // starts with 1 data in FIFO\r
+ int latency = 1+(int)((periodIn+5.0*periodOut)/periodOut);\r
+ QList<char> pattern;\r
+ for(int i=0;i<latency;i++) {\r
+ pattern.append(0);\r
+ }\r
+ int inFifo = 1;\r
+ int idIn = 1;\r
+ int idOut = 1;\r
+ while (idIn < lengthIP) {\r
+ double tIn = (double)idIn * periodIn;\r
+ double tOut = (double)idOut * periodOut;\r
+ if (fabs(tIn-tOut) < 0.001) {\r
+ if (inFifo > 0) {\r
+ pattern.append(1);\r
+ }\r
+ else {\r
+ pattern.append(0);\r
+ inFifo ++;\r
+ }\r
+ idIn ++;\r
+ idOut ++;\r
+ }\r
+ else if (tIn < tOut) {\r
+ inFifo++;\r
+ idIn ++;\r
}\r
- catch(Exception e) {\r
- throw(e);\r
+ else {\r
+ if (inFifo > 0) {\r
+ pattern.append(1);\r
+ inFifo--;\r
+ }\r
+ else {\r
+ pattern.append(0);\r
+ }\r
+ idOut++;\r
}\r
- cout << "input pattern array initialized with min. len " << lengthIP << endl;\r
}\r
+ foreach(char c, pattern) cout << (int)c;\r
+ cout << endl;\r
\r
// initialize the output pattern\r
- lengthOP = 0;\r
+ lengthOP = pattern.size();\r
foreach(AbstractInterface* iface, getControlOutputs()) {\r
- FunctionalInterface* connIface = AI_TO_FUN(iface);\r
- lengthOP = lengthIP+productionPattern.value(connIface)->size();\r
- QList<char>* pattern = new QList<char>();\r
- for(int i=0;i<lengthOP;i++) pattern->append(0);\r
- connIface->setOutputPattern(pattern);\r
- outputPattern.insert(connIface,pattern);\r
+ FunctionalInterface* connIface = AI_TO_FUN(iface); \r
+ QList<char>* pat = new QList<char>(pattern);\r
+ connIface->setOutputPattern(pat);\r
+ outputPattern.insert(connIface,pat);\r
}\r
- cout << "output pattern array initialized" << endl;\r
-\r
- int clock = 0;\r
-\r
+ cout << "output pattern computed" << endl;\r
}\r
\r
\r
reference = referenceMd5;
}
- FunctionalBlock* functionalBlock = params->getGraph()->createStimuliBlock(reference);
+ FunctionalBlock* functionalBlock = params->getGraph()->createStimuliBlock(reference, false);
/* NB: createSourceBlock creates all interfaces from the reference, which is annoying when
reading bif_iface tags. Thus interface are all removed.
*/
}
// recreate all (non-control) interfaces because of some may have a multiplicity>1 with several examplars
- functionalBlock->removeAllInterfaces();
+ //functionalBlock->removeAllInterfaces();
QDomNodeList interfaceNodes = funcElement.elementsByTagName("source_iface");
// setting interfaces (user name, and for multiplicity>1 may be create some new ones)
for(int i=0; i<interfaceNodes.length(); i++) {
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 4.2.0, 2018-05-04T14:41:26. -->
+<!-- Written by QtCreator 4.2.0, 2018-05-07T18:17:25. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<xs:attribute ref="name" />
<xs:attribute ref="position" />
<xs:attribute ref="dimension" />
+ <xs:attribute ref="visible" use="optional"/>
</xs:attributeGroup>
<xs:attributeGroup name="source_parameterAttrGroup">
<xs:attributeGroup name="connectionAttrGroup">
<xs:attribute ref="from" />
<xs:attribute ref="to" />
+ <xs:attribute ref="visible" use="optional" />
</xs:attributeGroup>
<xs:attributeGroup name="modifierAttrGroup">
</xs:simpleType>
</xs:attribute>
+ <xs:attribute name="visible">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="true"/>
+ <xs:enumeration value="false"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+
<xs:attribute name="inside_group">
<xs:simpleType>
<xs:restriction base="xs:nonNegativeInteger">
<xs:group ref="sceneElmtGroup"/>
<xs:attribute ref="id"/>
<xs:attribute ref="upper_scene"/>
+ <xs:attribute name="clklist" type="xs:string" use="optional" />
</xs:complexType>
</xs:element>