\r
unsaveModif = false;\r
isRstClkShown = false;\r
-\r
- projectPath = QDir::currentPath();\r
\r
validityExtension = "_enb";\r
+\r
+ projectPath = "";\r
+ projectName = "";\r
+ projectFile = "";\r
}\r
\r
Parameters::~Parameters() {\r
BlockCategory* blockCat = categoryTree->searchCategory(idCategory);\r
\r
if (blockCat == NULL) return NULL;\r
- ReferenceBlock* ref = blockCat->getBlock(idBlock);\r
+ ReferenceBlock* ref = blockCat->getBlockById(idBlock);\r
+ return ref;\r
+}\r
+\r
+ReferenceBlock* Parameters::getHiddenReferenceBlock(QString blockName) {\r
+\r
+ BlockCategory* blockCat = categoryTree->searchCategory(100);\r
+ if (blockCat == NULL) return NULL;\r
+ ReferenceBlock* ref = blockCat->getBlockByName(blockName);\r
return ref;\r
}\r
\r
GroupBlock *groupBlock = NULL;\r
\r
GroupWidget* topGroup = NULL;\r
+\r
+ QString path = root.attribute("project_path","none");\r
+ if (path != "none") {\r
+ QDir dir(path);\r
+ if (dir.exists()) {\r
+ projectPath = path;\r
+\r
+ }\r
+ cout << "project path set to " << qPrintable(projectPath) << endl;\r
+ }\r
/**********************************************************\r
1 : getting scene and creating associated group widgets\r
***********************************************************/\r
QString paramsStr = currentModifierNode.attribute("params","none");\r
if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));\r
\r
- AbstractInputModifier* mod = NULL;\r
- if (typeStr == "delay") {\r
- int delay = paramsStr.toInt(&ok);\r
- if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));\r
- mod = new DelayInputModifier(delay);\r
- }\r
-\r
/* NB: just adding delays for now. To be cont'd */\r
InterfaceItem *iface = searchInterfaceItemById(id,topScene);\r
\r
- if(iface != NULL ) {\r
- iface->refInter->setInputModifier(mod);\r
+ if ((iface == NULL ) || (iface->refInter == NULL) || (iface->refInter->getAssociatedIface() == NULL)) {\r
+ cout << "modified interface not found, modifiers setup canceled!" << endl;\r
+ }\r
+ else {\r
+ ConnectedInterface* connIface = AI_TO_CON(iface->refInter->getAssociatedIface());\r
\r
- } else {\r
- cout << "interfaces not found, modifiers setup canceled!" << endl;\r
+ AbstractInputModifier* mod = NULL;\r
+ if (typeStr == "delay") {\r
+ int delay = paramsStr.toInt(&ok);\r
+ if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));\r
+ mod = new DelayInputModifier(connIface, delay);\r
+ connIface->setInputModifier(mod);\r
+ }\r
}\r
}\r
+\r
cout << "modifiers loaded and created succefully!" << endl;\r
\r
return topGroup;\r
implPathes.append(path);\r
cout << "impl path : " << qPrintable(path) << endl << endl;\r
}\r
+\r
+ QDomElement eltSource = eltImpl.nextSiblingElement("sources");\r
+ nbPathesStr = eltSource.attribute("nb","none");\r
+ nbPathes = nbPathesStr.toInt(&ok);\r
+ QDomNodeList listSourceDir = eltSource.elementsByTagName("source_lib");\r
+ if ((!ok) || (nbPathes != listSourceDir.size())) throw(Exception(CONFIGFILE_CORRUPTED));\r
+\r
+ for(int i=0;i<listSourceDir.size();i++) {\r
+ QDomNode nodeSourceDir = listSourceDir.at(i);\r
+ QDomElement eltSourceDir = nodeSourceDir.toElement();\r
+ if (eltSourceDir.isNull()) throw(Exception(CONFIGFILE_CORRUPTED));\r
+ QString path = eltSourceDir.attribute("path","none");\r
+ if (path == "none") throw(Exception(CONFIGFILE_CORRUPTED));\r
+ sourcePathes.append(path);\r
+ cout << "core path : " << qPrintable(path) << endl << endl;\r
+ }\r
+\r
// getting elt = the element <defaults>\r
// for each child element, initialize the associated attributes of Parameters\r
\r
- QDomElement eltDefaults = eltImpl.nextSiblingElement("defaults");\r
+ QDomElement eltDefaults = eltSource.nextSiblingElement("defaults");\r
\r
QDomElement eltBlocks = eltDefaults.firstChildElement("blocks");\r
QString attributeStr = eltBlocks.attribute("width", "none");\r
QString refXml = implRoot.attribute("ref_name","none");\r
QString refMd5 = implRoot.attribute("ref_md5","none");\r
BlockImplementation* impl = new BlockImplementation(fileName,refXml,refMd5);\r
+\r
+ QDomNodeList archNode = implRoot.elementsByTagName("architecture");\r
+\r
+ if (archNode.isEmpty()) {\r
+ cout << "impl has no architecture" << endl;\r
+ return;\r
+ }\r
+ QDomElement archElt = archNode.at(0).toElement();\r
+ QString compList = archElt.attribute("comp_list","none");\r
+ if (compList != "none") {\r
+ QStringList compos = compList.split(",");\r
+ foreach(QString s, compos) {\r
+ impl->addSource(s);\r
+ }\r
+ }\r
+\r
try {\r
impl->loadPatterns(implRoot);\r
}\r
libFile.close();\r
\r
}\r
+\r
+\r
+void Parameters::loadSources() throw(Exception) {\r
+\r
+ for(int i=0;i<sourcePathes.size();i++) {\r
+ cout << "analyzing " << qPrintable(sourcePathes.at(i)) << endl;\r
+ QDir dir(sourcePathes.at(i));\r
+ QStringList filter;\r
+ filter << "*.vhd" << "*.ngc";\r
+ dir.setNameFilters(filter);\r
+ QStringList list = dir.entryList();\r
+ for(int j=0;j<list.size();j++) {\r
+ QString fileName = dir.absolutePath();\r
+ fileName.append("/"+list.at(j));\r
+\r
+ if (list.at(j).endsWith(".ngc")) {\r
+ QString netName = list.at(j);\r
+ netName.truncate(list.at(j).size() -4);\r
+ cout << "found netlist " << qPrintable(netName) << endl;\r
+ availableSources.append(new ExternalSource(netName,fileName,ExternalSource::Netlist));\r
+ }\r
+ else {\r
+ cout << "parsing " << qPrintable(fileName) << " ... ";\r
+ QFile srcXML(fileName);\r
+ if (!srcXML.open(QIODevice::ReadOnly)) {\r
+ throw(Exception(IMPLFILE_NOACCESS));\r
+ }\r
+ QTextStream in(&srcXML);\r
+\r
+ QString line = in.readLine();\r
+ while (!line.isNull()) {\r
+ if (line.contains("package", Qt::CaseInsensitive)) {\r
+ QRegularExpression rxPack("^package (.+) is$",QRegularExpression::CaseInsensitiveOption);\r
+ QRegularExpressionMatch matchPack = rxPack.match(line);\r
+ if (matchPack.hasMatch()) {\r
+ QString packName = matchPack.captured(1);\r
+ cout << "found package " << qPrintable(packName) << endl;\r
+ availableSources.append(new ExternalSource(packName,fileName,ExternalSource::Package));\r
+ }\r
+ }\r
+ else if (line.contains("entity", Qt::CaseInsensitive)) {\r
+ QRegularExpression rxEnt("^entity (.+) is$",QRegularExpression::CaseInsensitiveOption);\r
+ QRegularExpressionMatch matchEnt = rxEnt.match(line);\r
+ if (matchEnt.hasMatch()) {\r
+ QString entityName = matchEnt.captured(1);\r
+ cout << "found entity " << qPrintable(entityName) << endl;\r
+ availableSources.append(new ExternalSource(entityName,fileName,ExternalSource::Code));\r
+ }\r
+ }\r
+ line = in.readLine();\r
+ }\r
+ srcXML.close();\r
+ cout << "OK" << endl;\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
+ExternalSource* Parameters::searchSourceByName(const QString& name) {\r
+ foreach(ExternalSource* s, availableSources) {\r
+ if (s->getName() == name) return s;\r
+ }\r
+ return NULL;\r
+}\r
+\r
void Parameters::addAvailableBlock(ReferenceBlock *block) {\r
availableBlocks.append(block);\r
foreach (int id,block->getCategories()) {\r
_inArrow.lineTo(arrowLineLength+arrowWidth,-arrowHeight/2);\r
_inArrow.lineTo(arrowLineLength+arrowWidth,arrowHeight/2);\r
_inArrow.lineTo(arrowLineLength,0);\r
- _inArrow.closeSubpath();\r
- inArrow = _inArrow;\r
+ //_inArrow.closeSubpath();\r
+ dataArrowIn = _inArrow;\r
+\r
+ QPainterPath _inArrowC;\r
+ _inArrowC.lineTo(arrowLineLength,0);\r
+ _inArrowC.addEllipse(arrowLineLength,-arrowHeight/2,arrowHeight-1,arrowHeight-1);\r
+ clkrstArrow = _inArrowC;\r
\r
QPainterPath _outArrow;\r
_outArrow.lineTo(arrowLineLength,0);\r
_outArrow.lineTo(arrowLineLength+arrowWidth,0);\r
_outArrow.lineTo(arrowLineLength,arrowHeight/2);\r
_outArrow.lineTo(arrowLineLength,0);\r
- _outArrow.closeSubpath();\r
- outArrow = _outArrow;\r
+ //_outArrow.closeSubpath();\r
+ dataArrowOut = _outArrow;\r
\r
}\r
\r
}\r
return NULL;\r
}\r
+\r
+QString Parameters::normalizeName(const QString &name) {\r
+ QString s = name;\r
+ s.replace(QRegularExpression("[^a-zA-Z0-9_]"),"_");\r
+ s.replace(QRegularExpression("[_]+"),"_");\r
+ return s;\r
+}\r