| 1 |
2 |
EziDebug |
#include <QString>
|
| 2 |
|
|
#include <QDir>
|
| 3 |
|
|
#include <QMap>
|
| 4 |
|
|
#include <QStringList>
|
| 5 |
|
|
#include <QXmlStreamReader>
|
| 6 |
|
|
#include <QtXml>
|
| 7 |
|
|
#include <QFileInfo>
|
| 8 |
|
|
#include <string.h>
|
| 9 |
|
|
#include <QMessageBox>
|
| 10 |
|
|
#include <QDebug>
|
| 11 |
|
|
|
| 12 |
|
|
|
| 13 |
|
|
#include "UpdateDetectThread.h"
|
| 14 |
|
|
#include "ezidebugprj.h"
|
| 15 |
|
|
#include "ezidebugmodule.h"
|
| 16 |
|
|
#include "ezidebugvlgfile.h"
|
| 17 |
|
|
#include "ezidebugvhdlfile.h"
|
| 18 |
|
|
#include "ezidebugscanchain.h"
|
| 19 |
|
|
#include "ezidebuginstancetreeitem.h"
|
| 20 |
|
|
#include <algorithm>
|
| 21 |
|
|
|
| 22 |
|
|
|
| 23 |
|
|
char *month[13] = {"", "Jan" ,"Feb" , "Mar" , "Apr" , "May" , "Jun" , "Jul" , "Aug" , "Sep" \
|
| 24 |
|
|
"Oct" , "Nov" , "Dec" } ;
|
| 25 |
|
|
|
| 26 |
|
|
|
| 27 |
|
|
char *day[8] = {"", "Mon" , "Tue" , "Wed" , "Thu" , "Fri" , "Sat" , "Sun"} ;
|
| 28 |
|
|
|
| 29 |
|
|
|
| 30 |
|
|
|
| 31 |
|
|
|
| 32 |
|
|
|
| 33 |
|
|
EziDebugPrj::EziDebugPrj(int maxregnum , QString projectdir , TOOL tool , QObject * parent)\
|
| 34 |
|
|
: QObject(parent) ,m_iprjPath(QDir(projectdir)),m_nmaxRegNumInChain(maxregnum),m_eusedTool(tool)
|
| 35 |
|
|
{
|
| 36 |
|
|
m_pthread = new UpdateDetectThread(this,NULL);
|
| 37 |
|
|
m_headItem = NULL ;
|
| 38 |
|
|
m_pLastOperateChain = NULL ;
|
| 39 |
|
|
m_pLastOperteTreeItem = NULL ;
|
| 40 |
|
|
m_elastOperation = OperateTypeNone ;
|
| 41 |
|
|
m_isLogFileExist = false ;
|
| 42 |
|
|
m_ipermettedMaxRegNum = 0 ;
|
| 43 |
|
|
m_imaxRegWidth = 0 ;
|
| 44 |
|
|
m_isUpdated = false ;
|
| 45 |
|
|
m_isLogFileDestroyed = false ;
|
| 46 |
|
|
}
|
| 47 |
|
|
|
| 48 |
|
|
EziDebugPrj::~EziDebugPrj()
|
| 49 |
|
|
{
|
| 50 |
|
|
// 注::工程指针 析构时 其他对象不能使用
|
| 51 |
|
|
qDebug() << "Attention : Begin to destruct EziDebugPrj object!";
|
| 52 |
|
|
|
| 53 |
|
|
if(m_pthread->isRunning())
|
| 54 |
|
|
{
|
| 55 |
|
|
m_pthread->quit();
|
| 56 |
|
|
m_pthread->wait();
|
| 57 |
|
|
}
|
| 58 |
|
|
delete m_pthread ;
|
| 59 |
|
|
|
| 60 |
|
|
if(EziDebugScanChain::getUserDir().toLower() != "no dir")
|
| 61 |
|
|
{
|
| 62 |
|
|
QDir idir(m_iprjPath.absolutePath() + EziDebugScanChain::getUserDir());
|
| 63 |
|
|
|
| 64 |
|
|
idir.setFilter(QDir::Files);
|
| 65 |
|
|
QFileInfoList iinfolist = idir.entryInfoList();
|
| 66 |
|
|
for(int i = 0; i < iinfolist.size(); ++i)
|
| 67 |
|
|
{
|
| 68 |
|
|
QFileInfo fileInfo = iinfolist.at(i);
|
| 69 |
|
|
QString ifileName = fileInfo.fileName() ;
|
| 70 |
|
|
if(!(fileInfo.fileName().endsWith(".v")||fileInfo.fileName().endsWith(".vhd")))
|
| 71 |
|
|
{
|
| 72 |
|
|
idir.remove(ifileName);
|
| 73 |
|
|
}
|
| 74 |
|
|
}
|
| 75 |
|
|
}
|
| 76 |
|
|
|
| 77 |
|
|
// verilog file 指针析构
|
| 78 |
|
|
QMap<QString,EziDebugVlgFile*>::iterator i = m_ivlgFileMap.begin() ;
|
| 79 |
|
|
while(i != m_ivlgFileMap.end())
|
| 80 |
|
|
{
|
| 81 |
|
|
EziDebugVlgFile* pfile = m_ivlgFileMap.value(i.key());
|
| 82 |
|
|
if(pfile)
|
| 83 |
|
|
{
|
| 84 |
|
|
delete pfile ;
|
| 85 |
|
|
}
|
| 86 |
|
|
++i ;
|
| 87 |
|
|
}
|
| 88 |
|
|
m_ivlgFileMap.clear() ;
|
| 89 |
|
|
|
| 90 |
|
|
// vhdl file 指针析构
|
| 91 |
|
|
QMap<QString,EziDebugVhdlFile*>::iterator j = m_ivhdlFileMap.begin() ;
|
| 92 |
|
|
while(j != m_ivhdlFileMap.end())
|
| 93 |
|
|
{
|
| 94 |
|
|
EziDebugVhdlFile* pfile = m_ivhdlFileMap.value(j.key());
|
| 95 |
|
|
if(pfile)
|
| 96 |
|
|
{
|
| 97 |
|
|
delete pfile ;
|
| 98 |
|
|
}
|
| 99 |
|
|
++j ;
|
| 100 |
|
|
}
|
| 101 |
|
|
m_ivhdlFileMap.clear() ;
|
| 102 |
|
|
|
| 103 |
|
|
// module 析构
|
| 104 |
|
|
QMap<QString,EziDebugModule*>::iterator k = m_imoduleMap.begin() ;
|
| 105 |
|
|
while(k != m_imoduleMap.end())
|
| 106 |
|
|
{
|
| 107 |
|
|
EziDebugModule* pmodule = m_imoduleMap.value(k.key());
|
| 108 |
|
|
if(pmodule)
|
| 109 |
|
|
{
|
| 110 |
|
|
delete pmodule ;
|
| 111 |
|
|
}
|
| 112 |
|
|
++k ;
|
| 113 |
|
|
}
|
| 114 |
|
|
m_imoduleMap.clear() ;
|
| 115 |
|
|
|
| 116 |
|
|
|
| 117 |
|
|
// treeitemmap 析构
|
| 118 |
|
|
// QMap<QString,EziDebugInstanceTreeItem*>::iterator itreeItemIterator = m_ichainTreeItemMap.begin() ;
|
| 119 |
|
|
// while(itreeItemIterator != m_ichainTreeItemMap.end())
|
| 120 |
|
|
// {
|
| 121 |
|
|
// EziDebugInstanceTreeItem* pitem = m_ichainTreeItemMap.value(itreeItemIterator.key());
|
| 122 |
|
|
// if(!pitem)
|
| 123 |
|
|
// {
|
| 124 |
|
|
// delete pitem ;
|
| 125 |
|
|
// }
|
| 126 |
|
|
// ++itreeItemIterator ;
|
| 127 |
|
|
// }
|
| 128 |
|
|
m_ichainTreeItemMap.clear() ;
|
| 129 |
|
|
|
| 130 |
|
|
// backup TreeItemMap 析构
|
| 131 |
|
|
// QMap<QString,EziDebugInstanceTreeItem*>::iterator ibakTreeItemIterator = m_ibackupChainTreeItemMap.begin() ;
|
| 132 |
|
|
// while(ibakTreeItemIterator != m_ibackupChainTreeItemMap.end())
|
| 133 |
|
|
// {
|
| 134 |
|
|
// EziDebugInstanceTreeItem* pitem = m_ibackupChainTreeItemMap.value(ibakTreeItemIterator.key());
|
| 135 |
|
|
// if(!pitem)
|
| 136 |
|
|
// {
|
| 137 |
|
|
// delete pitem ;
|
| 138 |
|
|
// }
|
| 139 |
|
|
// ++ibakTreeItemIterator ;
|
| 140 |
|
|
// }
|
| 141 |
|
|
m_ibackupChainTreeItemMap.clear() ;
|
| 142 |
|
|
|
| 143 |
|
|
// m_ichainInfoMap 析构
|
| 144 |
|
|
QMap<QString,EziDebugScanChain*>::iterator ichainIterator = m_ichainInfoMap.begin() ;
|
| 145 |
|
|
while(ichainIterator != m_ichainInfoMap.end())
|
| 146 |
|
|
{
|
| 147 |
|
|
// LastOperateChain 析构
|
| 148 |
|
|
EziDebugScanChain* pitem = m_ichainInfoMap.value(ichainIterator.key());
|
| 149 |
|
|
if(pitem)
|
| 150 |
|
|
{
|
| 151 |
|
|
if(pitem == m_pLastOperateChain)
|
| 152 |
|
|
{
|
| 153 |
|
|
m_pLastOperateChain = NULL ;
|
| 154 |
|
|
}
|
| 155 |
|
|
delete pitem ;
|
| 156 |
|
|
}
|
| 157 |
|
|
++ichainIterator ;
|
| 158 |
|
|
}
|
| 159 |
|
|
m_ichainInfoMap.clear() ;
|
| 160 |
|
|
|
| 161 |
|
|
// backupchaininfo 析构
|
| 162 |
|
|
QMap<QString,EziDebugScanChain*>::iterator ibakChainIterator = m_ibackupChainInfoMap.begin() ;
|
| 163 |
|
|
while(ibakChainIterator != m_ibackupChainInfoMap.end())
|
| 164 |
|
|
{
|
| 165 |
|
|
EziDebugScanChain* pitem = m_ibackupChainInfoMap.value(ibakChainIterator.key());
|
| 166 |
|
|
if(pitem)
|
| 167 |
|
|
{
|
| 168 |
|
|
delete pitem ;
|
| 169 |
|
|
}
|
| 170 |
|
|
++ibakChainIterator ;
|
| 171 |
|
|
}
|
| 172 |
|
|
|
| 173 |
|
|
m_ibackupChainInfoMap.clear() ;
|
| 174 |
|
|
|
| 175 |
|
|
m_iqueryTreeItemMap.clear();
|
| 176 |
|
|
m_ibackupQueryTreeItemMap.clear();
|
| 177 |
|
|
|
| 178 |
|
|
if(m_pLastOperateChain)
|
| 179 |
|
|
delete m_pLastOperateChain ;
|
| 180 |
|
|
|
| 181 |
|
|
// LastOperteTreeItem 析构
|
| 182 |
|
|
// if(!m_pLastOperteTreeItem)
|
| 183 |
|
|
m_pLastOperteTreeItem = NULL ;
|
| 184 |
|
|
|
| 185 |
|
|
}
|
| 186 |
|
|
|
| 187 |
|
|
|
| 188 |
|
|
const EziDebugPrj::TOOL &EziDebugPrj::getToolType(void) const
|
| 189 |
|
|
{
|
| 190 |
|
|
return m_eusedTool ;
|
| 191 |
|
|
}
|
| 192 |
|
|
|
| 193 |
|
|
const QDir &EziDebugPrj::getCurrentDir(void) const
|
| 194 |
|
|
{
|
| 195 |
|
|
return m_iprjPath ;
|
| 196 |
|
|
}
|
| 197 |
|
|
|
| 198 |
|
|
bool EziDebugPrj::getSoftwareXilinxErrCheckedFlag(void)
|
| 199 |
|
|
{
|
| 200 |
|
|
return m_isDisXilinxErrChecked ;
|
| 201 |
|
|
}
|
| 202 |
|
|
QString EziDebugPrj::getTopModule(void)
|
| 203 |
|
|
{
|
| 204 |
|
|
return m_itopModule ;
|
| 205 |
|
|
}
|
| 206 |
|
|
|
| 207 |
|
|
UpdateDetectThread *EziDebugPrj::getThread(void) const
|
| 208 |
|
|
{
|
| 209 |
|
|
return m_pthread ;
|
| 210 |
|
|
}
|
| 211 |
|
|
|
| 212 |
|
|
bool EziDebugPrj::getLogFileExistFlag(void)
|
| 213 |
|
|
{
|
| 214 |
|
|
return m_isLogFileExist ;
|
| 215 |
|
|
}
|
| 216 |
|
|
|
| 217 |
|
|
const QMap<QString,EziDebugScanChain*> &EziDebugPrj::getScanChainInfo(void) const
|
| 218 |
|
|
{
|
| 219 |
|
|
return m_ichainInfoMap ;
|
| 220 |
|
|
}
|
| 221 |
|
|
|
| 222 |
|
|
const QMap<QString,EziDebugInstanceTreeItem*> &EziDebugPrj::getChainTreeItemMap(void) const
|
| 223 |
|
|
{
|
| 224 |
|
|
return m_ichainTreeItemMap ;
|
| 225 |
|
|
}
|
| 226 |
|
|
|
| 227 |
|
|
const QMap<QString,EziDebugInstanceTreeItem*> &EziDebugPrj::getBackupChainTreeItemMap(void) const
|
| 228 |
|
|
{
|
| 229 |
|
|
return m_ibackupChainTreeItemMap ;
|
| 230 |
|
|
}
|
| 231 |
|
|
|
| 232 |
|
|
const QMap<QString,EziDebugScanChain*> &EziDebugPrj::getBackupChainMap(void) const
|
| 233 |
|
|
{
|
| 234 |
|
|
return m_ibackupChainInfoMap ;
|
| 235 |
|
|
}
|
| 236 |
|
|
|
| 237 |
|
|
const QStringList &EziDebugPrj::getPrjCodeFileNameList(void) const
|
| 238 |
|
|
{
|
| 239 |
|
|
return m_iCodefileNameList ;
|
| 240 |
|
|
}
|
| 241 |
|
|
|
| 242 |
|
|
const QStringList &EziDebugPrj::getUpdateFileList(FILE_UPDATE_TYPE fileupdatetype) const
|
| 243 |
|
|
{
|
| 244 |
|
|
if(fileupdatetype == addedUpdateFileType)
|
| 245 |
|
|
{
|
| 246 |
|
|
return m_iupdateAddedFileList ;
|
| 247 |
|
|
}
|
| 248 |
|
|
else if(fileupdatetype == deletedUpdateFileType)
|
| 249 |
|
|
{
|
| 250 |
|
|
return m_iupdateDeletedFileList ;
|
| 251 |
|
|
}
|
| 252 |
|
|
else
|
| 253 |
|
|
{
|
| 254 |
|
|
return m_iupdateChangedFileList ;
|
| 255 |
|
|
}
|
| 256 |
|
|
}
|
| 257 |
|
|
const QStringList &EziDebugPrj::getFileNameList(void) const
|
| 258 |
|
|
{
|
| 259 |
|
|
return m_iCodefileNameList ;
|
| 260 |
|
|
}
|
| 261 |
|
|
|
| 262 |
|
|
const QString &EziDebugPrj::getPrjName(void) const
|
| 263 |
|
|
{
|
| 264 |
|
|
return m_iprjName ;
|
| 265 |
|
|
}
|
| 266 |
|
|
|
| 267 |
|
|
EziDebugPrj::OPERATE_TYPE EziDebugPrj::getLastOperation(void)
|
| 268 |
|
|
{
|
| 269 |
|
|
return m_elastOperation ;
|
| 270 |
|
|
}
|
| 271 |
|
|
|
| 272 |
|
|
int EziDebugPrj::getPermittedRegNum(void)
|
| 273 |
|
|
{
|
| 274 |
|
|
return m_ipermettedMaxRegNum ;
|
| 275 |
|
|
}
|
| 276 |
|
|
|
| 277 |
|
|
EziDebugScanChain* EziDebugPrj::getLastOperateChain(void)
|
| 278 |
|
|
{
|
| 279 |
|
|
return m_pLastOperateChain ;
|
| 280 |
|
|
}
|
| 281 |
|
|
|
| 282 |
|
|
int EziDebugPrj::eliminateLastOperation(void)
|
| 283 |
|
|
{
|
| 284 |
|
|
QString ieziDebugFileSuffix ;
|
| 285 |
|
|
|
| 286 |
|
|
/*对上一步操作进行善后*/
|
| 287 |
|
|
if(m_elastOperation == OperateTypeAddScanChain)
|
| 288 |
|
|
{
|
| 289 |
|
|
if(!m_pLastOperateChain)
|
| 290 |
|
|
{
|
| 291 |
|
|
qDebug() << "Error:Last Operation chain is NULL Pointer!";
|
| 292 |
|
|
return 1 ;
|
| 293 |
|
|
}
|
| 294 |
|
|
ieziDebugFileSuffix = QObject::tr(".add.%1").arg(m_pLastOperateChain->getChainName());
|
| 295 |
|
|
QStringList iscanFileList = m_pLastOperateChain->getScanedFileList() ;
|
| 296 |
|
|
for(int i = 0 ; i < iscanFileList.count();i++)
|
| 297 |
|
|
{
|
| 298 |
|
|
// 获取备份的文件名全称
|
| 299 |
|
|
QFileInfo ifileInfo(iscanFileList.at(i));
|
| 300 |
|
|
|
| 301 |
|
|
|
| 302 |
|
|
|
| 303 |
|
|
QString ibackupFileName = m_iprjPath.absolutePath() \
|
| 304 |
|
|
+ EziDebugScanChain::getUserDir() + QObject::tr("/") + ifileInfo.fileName() \
|
| 305 |
|
|
+ ieziDebugFileSuffix;
|
| 306 |
|
|
QFile ibackupFile(ibackupFileName) ;
|
| 307 |
|
|
|
| 308 |
|
|
// 删除上一步操作备份的文件
|
| 309 |
|
|
ibackupFile.remove();
|
| 310 |
|
|
}
|
| 311 |
|
|
// 清空所有上次备份
|
| 312 |
|
|
m_elastOperation = OperateTypeNone ;
|
| 313 |
|
|
m_pLastOperateChain = NULL ;
|
| 314 |
|
|
m_pLastOperteTreeItem = NULL ;
|
| 315 |
|
|
}
|
| 316 |
|
|
else if(m_elastOperation == OperateTypeDelSingleScanChain)
|
| 317 |
|
|
{
|
| 318 |
|
|
// 释放
|
| 319 |
|
|
if(!m_pLastOperateChain)
|
| 320 |
|
|
{
|
| 321 |
|
|
qDebug() << "Error:Last Operation chain is NULL Pointer!";
|
| 322 |
|
|
return 1 ;
|
| 323 |
|
|
}
|
| 324 |
|
|
ieziDebugFileSuffix = QObject::tr(".delete.%1").arg(m_pLastOperateChain->getChainName());
|
| 325 |
|
|
|
| 326 |
|
|
QStringList iscanFileList = m_pLastOperateChain->getScanedFileList() ;
|
| 327 |
|
|
for(int i = 0 ; i < iscanFileList.count();i++)
|
| 328 |
|
|
{
|
| 329 |
|
|
// 获取备份的文件名全称
|
| 330 |
|
|
QFileInfo ifileInfo(iscanFileList.at(i));
|
| 331 |
|
|
|
| 332 |
|
|
|
| 333 |
|
|
|
| 334 |
|
|
QString ibackupFileName = m_iprjPath.absolutePath() \
|
| 335 |
|
|
+ EziDebugScanChain::getUserDir() + QObject::tr("/") + ifileInfo.fileName() \
|
| 336 |
|
|
+ ieziDebugFileSuffix ;
|
| 337 |
|
|
QFile ibackupFile(ibackupFileName) ;
|
| 338 |
|
|
|
| 339 |
|
|
// 删除上一步操作备份的文件
|
| 340 |
|
|
ibackupFile.remove();
|
| 341 |
|
|
}
|
| 342 |
|
|
|
| 343 |
|
|
delete m_pLastOperateChain ;
|
| 344 |
|
|
// 清空所有上次备份
|
| 345 |
|
|
//updateOperation(OperateTypeNone , NULL , NULL);
|
| 346 |
|
|
m_elastOperation = OperateTypeNone ;
|
| 347 |
|
|
m_pLastOperateChain = NULL ;
|
| 348 |
|
|
m_pLastOperteTreeItem = NULL ;
|
| 349 |
|
|
}
|
| 350 |
|
|
else if(m_elastOperation == OperateTypeDelAllScanChain)
|
| 351 |
|
|
{
|
| 352 |
|
|
ieziDebugFileSuffix = QObject::tr(".deleteall");
|
| 353 |
|
|
|
| 354 |
|
|
// 将所有 扫描立链指针内存 释放
|
| 355 |
|
|
QMap<QString,EziDebugScanChain*>::const_iterator i = m_ibackupChainInfoMap.constBegin() ;
|
| 356 |
|
|
while(i != m_ibackupChainInfoMap.constEnd())
|
| 357 |
|
|
{
|
| 358 |
|
|
EziDebugScanChain* pchain = i.value();
|
| 359 |
|
|
if(!pchain)
|
| 360 |
|
|
{
|
| 361 |
|
|
qDebug() << "Error: The chain Pointer is NULL !";
|
| 362 |
|
|
++i ;
|
| 363 |
|
|
continue ;
|
| 364 |
|
|
}
|
| 365 |
|
|
|
| 366 |
|
|
QStringList iscanFileList = pchain->getScanedFileList() ;
|
| 367 |
|
|
for(int j = 0 ; j < iscanFileList.count();j++)
|
| 368 |
|
|
{
|
| 369 |
|
|
// 获取备份的文件名全称
|
| 370 |
|
|
QFileInfo ifileInfo(iscanFileList.at(j));
|
| 371 |
|
|
|
| 372 |
|
|
QString ibackupFileName = m_iprjPath.absolutePath() \
|
| 373 |
|
|
+ EziDebugScanChain::getUserDir()+ QObject::tr("/") +ifileInfo.fileName() \
|
| 374 |
|
|
+ ieziDebugFileSuffix ;
|
| 375 |
|
|
QFile ibackupFile(ibackupFileName) ;
|
| 376 |
|
|
|
| 377 |
|
|
// 删除上一步操作备份的文件
|
| 378 |
|
|
ibackupFile.remove();
|
| 379 |
|
|
}
|
| 380 |
|
|
|
| 381 |
|
|
delete pchain ;
|
| 382 |
|
|
pchain = NULL ;
|
| 383 |
|
|
++i ;
|
| 384 |
|
|
}
|
| 385 |
|
|
// 清空所有上次备份
|
| 386 |
|
|
updateOperation(OperateTypeNone , NULL , NULL);
|
| 387 |
|
|
}
|
| 388 |
|
|
else if(m_elastOperation == OperateTypeNone)
|
| 389 |
|
|
{
|
| 390 |
|
|
return 0 ;
|
| 391 |
|
|
}
|
| 392 |
|
|
else
|
| 393 |
|
|
{
|
| 394 |
|
|
qDebug() << "Error:Last Operation Type is Wrong!";
|
| 395 |
|
|
return 1 ;
|
| 396 |
|
|
}
|
| 397 |
|
|
|
| 398 |
|
|
return 0 ;
|
| 399 |
|
|
|
| 400 |
|
|
}
|
| 401 |
|
|
|
| 402 |
|
|
EziDebugInstanceTreeItem* EziDebugPrj::getLastOperateTreeItem(void)
|
| 403 |
|
|
{
|
| 404 |
|
|
return m_pLastOperteTreeItem ;
|
| 405 |
|
|
}
|
| 406 |
|
|
|
| 407 |
|
|
const QMap<QString,EziDebugModule*> &EziDebugPrj::getPrjModuleMap(void) const
|
| 408 |
|
|
{
|
| 409 |
|
|
return m_imoduleMap ;
|
| 410 |
|
|
}
|
| 411 |
|
|
|
| 412 |
|
|
const QMap<QString,EziDebugVlgFile*> &EziDebugPrj::getPrjVlgFileMap(void) const
|
| 413 |
|
|
{
|
| 414 |
|
|
return m_ivlgFileMap ;
|
| 415 |
|
|
}
|
| 416 |
|
|
|
| 417 |
|
|
const QMap<QString,EziDebugVhdlFile*> &EziDebugPrj::getPrjVhdlFileMap(void) const
|
| 418 |
|
|
{
|
| 419 |
|
|
return m_ivhdlFileMap ;
|
| 420 |
|
|
}
|
| 421 |
|
|
|
| 422 |
|
|
int EziDebugPrj::eliminateFile(const QString &filename,QList<LOG_FILE_INFO*> &infolist)
|
| 423 |
|
|
{
|
| 424 |
|
|
if(filename.endsWith(".v"))
|
| 425 |
|
|
{
|
| 426 |
|
|
EziDebugVlgFile* pfile = m_ivlgFileMap.value(filename);
|
| 427 |
|
|
if(pfile)
|
| 428 |
|
|
{
|
| 429 |
|
|
struct LOG_FILE_INFO* pinfo = new LOG_FILE_INFO ;
|
| 430 |
|
|
pinfo->etype = infoTypeFileInfo ;
|
| 431 |
|
|
pinfo->pinfo = NULL ;
|
| 432 |
|
|
memcpy(pinfo->ainfoName,pfile->fileName().toAscii().data(),pfile->fileName().size()+1);
|
| 433 |
|
|
infolist.append(pinfo);
|
| 434 |
|
|
QStringList imoduleList = pfile->getModuleList();
|
| 435 |
|
|
for(int i = 0 ; i < imoduleList.count();i++)
|
| 436 |
|
|
{
|
| 437 |
|
|
EziDebugModule *pmodule = m_imoduleMap.value(imoduleList.at(i),NULL) ;
|
| 438 |
|
|
if(!pmodule)
|
| 439 |
|
|
{
|
| 440 |
|
|
struct LOG_FILE_INFO* pinfo = new LOG_FILE_INFO ;
|
| 441 |
|
|
pinfo->etype = infoTypeModuleStructure ;
|
| 442 |
|
|
pinfo->pinfo = NULL ;
|
| 443 |
|
|
memcpy(pinfo->ainfoName,pmodule->getModuleName().toAscii().data(),pmodule->getModuleName().size()+1);
|
| 444 |
|
|
infolist.append(pinfo);
|
| 445 |
|
|
}
|
| 446 |
|
|
m_imoduleMap.remove(imoduleList.at(i));
|
| 447 |
|
|
delete pmodule ;
|
| 448 |
|
|
}
|
| 449 |
|
|
}
|
| 450 |
|
|
m_ivlgFileMap.remove(filename);
|
| 451 |
|
|
delete pfile ;
|
| 452 |
|
|
}
|
| 453 |
|
|
else if(filename.endsWith(".vhd"))
|
| 454 |
|
|
{
|
| 455 |
|
|
EziDebugVhdlFile* pfile = m_ivhdlFileMap.value(filename);
|
| 456 |
|
|
if(!pfile)
|
| 457 |
|
|
delete pfile ;
|
| 458 |
|
|
m_ivhdlFileMap.remove(filename);
|
| 459 |
|
|
}
|
| 460 |
|
|
else
|
| 461 |
|
|
{
|
| 462 |
|
|
return 1 ;
|
| 463 |
|
|
}
|
| 464 |
|
|
return 0 ;
|
| 465 |
|
|
}
|
| 466 |
|
|
|
| 467 |
|
|
int EziDebugPrj::addFile(const QString &filename ,SCAN_TYPE type,QList<LOG_FILE_INFO*> &infolist)
|
| 468 |
|
|
{
|
| 469 |
|
|
QList<LOG_FILE_INFO*> ideletedinfoList ;
|
| 470 |
|
|
if(filename.endsWith(".v"))
|
| 471 |
|
|
{
|
| 472 |
|
|
QFileInfo ifileInfo(m_iprjPath,filename);
|
| 473 |
|
|
EziDebugVlgFile* pfile = new EziDebugVlgFile(ifileInfo.absoluteDir().absolutePath() + QObject::tr("'/") + ifileInfo.fileName()) ;
|
| 474 |
|
|
if(!pfile->scanFile(this,type,infolist,ideletedinfoList))
|
| 475 |
|
|
{
|
| 476 |
|
|
m_ivlgFileMap.insert(filename,pfile) ;
|
| 477 |
|
|
}
|
| 478 |
|
|
else
|
| 479 |
|
|
{
|
| 480 |
|
|
// 删除所有 list 节点
|
| 481 |
|
|
return 1 ;
|
| 482 |
|
|
}
|
| 483 |
|
|
}
|
| 484 |
|
|
else if(filename.endsWith(".vhd"))
|
| 485 |
|
|
{
|
| 486 |
|
|
// EziDebugVhdlFile* pfile = new EziDebugVhdlFile(filename) ;
|
| 487 |
|
|
// if(!pfile->scanFile(this,type))
|
| 488 |
|
|
// {
|
| 489 |
|
|
// m_ivhdlFileMap.insert(filename,pfile);
|
| 490 |
|
|
// }
|
| 491 |
|
|
// else
|
| 492 |
|
|
// {
|
| 493 |
|
|
|
| 494 |
|
|
// }
|
| 495 |
|
|
}
|
| 496 |
|
|
else
|
| 497 |
|
|
{
|
| 498 |
|
|
return 1 ;
|
| 499 |
|
|
}
|
| 500 |
|
|
|
| 501 |
|
|
return 0 ;
|
| 502 |
|
|
}
|
| 503 |
|
|
|
| 504 |
|
|
void EziDebugPrj::addToModuleMap(const QString &modoule,EziDebugModule *pmodule)
|
| 505 |
|
|
{
|
| 506 |
|
|
EziDebugModule *poriginModule = m_imoduleMap.value(modoule,NULL) ;
|
| 507 |
|
|
|
| 508 |
|
|
if(!poriginModule)
|
| 509 |
|
|
{
|
| 510 |
|
|
m_imoduleMap.insert(modoule,pmodule);
|
| 511 |
|
|
}
|
| 512 |
|
|
else
|
| 513 |
|
|
{
|
| 514 |
|
|
qDebug() << "Info: There is already existing this module:" << modoule \
|
| 515 |
|
|
<< "Ready to delete it!";
|
| 516 |
|
|
m_imoduleMap.remove(modoule) ;
|
| 517 |
|
|
delete poriginModule ;
|
| 518 |
|
|
m_imoduleMap.insert(modoule,pmodule);
|
| 519 |
|
|
}
|
| 520 |
|
|
return ;
|
| 521 |
|
|
}
|
| 522 |
|
|
|
| 523 |
|
|
void EziDebugPrj::addToDestroyedChainList(const QString& chainname)
|
| 524 |
|
|
{
|
| 525 |
|
|
if(!m_idestroyedChain.contains(chainname))
|
| 526 |
|
|
{
|
| 527 |
|
|
m_idestroyedChain.append(chainname);
|
| 528 |
|
|
}
|
| 529 |
|
|
}
|
| 530 |
|
|
|
| 531 |
|
|
void EziDebugPrj::addToCheckedChainList(const QString& chainname)
|
| 532 |
|
|
{
|
| 533 |
|
|
if(!m_icheckedChain.contains(chainname))
|
| 534 |
|
|
{
|
| 535 |
|
|
m_icheckedChain.append(chainname);
|
| 536 |
|
|
}
|
| 537 |
|
|
}
|
| 538 |
|
|
|
| 539 |
|
|
void EziDebugPrj::clearupDestroyedChainList(void)
|
| 540 |
|
|
{
|
| 541 |
|
|
m_idestroyedChain.clear();
|
| 542 |
|
|
}
|
| 543 |
|
|
|
| 544 |
|
|
void EziDebugPrj::clearupCheckedChainList(void)
|
| 545 |
|
|
{
|
| 546 |
|
|
m_icheckedChain.clear();
|
| 547 |
|
|
}
|
| 548 |
|
|
|
| 549 |
|
|
QStringList EziDebugPrj::checkChainExist(void)
|
| 550 |
|
|
{
|
| 551 |
|
|
QStringList iunexistChain ;
|
| 552 |
|
|
QMap<QString,EziDebugScanChain*>::const_iterator ichainIter = m_ichainInfoMap.constBegin() ;
|
| 553 |
|
|
|
| 554 |
|
|
while(ichainIter != m_ichainInfoMap.constEnd())
|
| 555 |
|
|
{
|
| 556 |
|
|
QString ichainName = ichainIter.key() ;
|
| 557 |
|
|
|
| 558 |
|
|
m_idestroyedChain.append(ichainName);
|
| 559 |
|
|
++ichainIter ;
|
| 560 |
|
|
}
|
| 561 |
|
|
m_icheckedChain.clear();
|
| 562 |
|
|
return iunexistChain ;
|
| 563 |
|
|
}
|
| 564 |
|
|
|
| 565 |
|
|
|
| 566 |
|
|
const QStringList &EziDebugPrj::getDestroyedChainList(void) const
|
| 567 |
|
|
{
|
| 568 |
|
|
return m_idestroyedChain ;
|
| 569 |
|
|
}
|
| 570 |
|
|
|
| 571 |
|
|
const QStringList &EziDebugPrj::getCheckedChainList(void) const
|
| 572 |
|
|
{
|
| 573 |
|
|
return m_icheckedChain ;
|
| 574 |
|
|
}
|
| 575 |
|
|
|
| 576 |
|
|
QStringList EziDebugPrj::deleteDestroyedChain(QList<LOG_FILE_INFO*> &addedinfoList,QList<LOG_FILE_INFO*> &deletedinfoList)
|
| 577 |
|
|
{
|
| 578 |
|
|
QString ieziDebugFileSuffix ;
|
| 579 |
|
|
QStringList iundelChainList ;
|
| 580 |
|
|
|
| 581 |
|
|
for(int i = 0 ; i < m_idestroyedChain.count() ; i++)
|
| 582 |
|
|
{
|
| 583 |
|
|
QString ichainName = m_idestroyedChain.at(i) ;
|
| 584 |
|
|
EziDebugScanChain* pchain = m_ichainInfoMap.value(ichainName , NULL);
|
| 585 |
|
|
if(!pchain)
|
| 586 |
|
|
{
|
| 587 |
|
|
continue ;
|
| 588 |
|
|
}
|
| 589 |
|
|
ieziDebugFileSuffix = QObject::tr(".delete.%1").arg(ichainName);
|
| 590 |
|
|
|
| 591 |
|
|
EziDebugInstanceTreeItem* pitem = m_ichainTreeItemMap.value(ichainName , NULL);
|
| 592 |
|
|
|
| 593 |
|
|
if(pitem)
|
| 594 |
|
|
{
|
| 595 |
|
|
if(pitem->deleteScanChain(OperateTypeDelSingleScanChain))
|
| 596 |
|
|
{
|
| 597 |
|
|
// 恢复文件
|
| 598 |
|
|
|
| 599 |
|
|
/*读取删除链 已经扫描过的文件,从已经备份的文件进行恢复*/
|
| 600 |
|
|
for(int i = 0 ; i < pchain->getScanedFileList().count();i++)
|
| 601 |
|
|
{
|
| 602 |
|
|
// 获取备份的文件名全称
|
| 603 |
|
|
QString ifileName = pchain->getScanedFileList().at(i) ;
|
| 604 |
|
|
QFileInfo ifileInfo(pchain->getScanedFileList().at(i));
|
| 605 |
|
|
|
| 606 |
|
|
QString ibackupFileName = this->getCurrentDir().absolutePath() \
|
| 607 |
|
|
+ EziDebugScanChain::getUserDir() + tr("/") + ifileInfo.fileName() \
|
| 608 |
|
|
+ ieziDebugFileSuffix;
|
| 609 |
|
|
QFile ibackupFile(ibackupFileName) ;
|
| 610 |
|
|
|
| 611 |
|
|
QFileInfo ibakfileInfo(ibackupFileName);
|
| 612 |
|
|
QDateTime idateTime = ibakfileInfo.lastModified();
|
| 613 |
|
|
|
| 614 |
|
|
QString irelativeName = m_iprjPath.relativeFilePath(ifileName) ;
|
| 615 |
|
|
|
| 616 |
|
|
// 恢复 源文件
|
| 617 |
|
|
if(ibakfileInfo.exists())
|
| 618 |
|
|
{
|
| 619 |
|
|
if(ifileName.endsWith(".v"))
|
| 620 |
|
|
{
|
| 621 |
|
|
m_ivlgFileMap.value(irelativeName)->remove();
|
| 622 |
|
|
ibackupFile.copy(ifileName);
|
| 623 |
|
|
m_ivlgFileMap.value(irelativeName)->modifyStoredTime(idateTime);
|
| 624 |
|
|
}
|
| 625 |
|
|
else if(ifileName.endsWith(".vhd"))
|
| 626 |
|
|
{
|
| 627 |
|
|
m_ivhdlFileMap.value(irelativeName)->remove();
|
| 628 |
|
|
ibackupFile.copy(ifileName);
|
| 629 |
|
|
m_ivhdlFileMap.value(irelativeName)->modifyStoredTime(idateTime);
|
| 630 |
|
|
}
|
| 631 |
|
|
else
|
| 632 |
|
|
{
|
| 633 |
|
|
// do nothing
|
| 634 |
|
|
}
|
| 635 |
|
|
// 删除备份文件
|
| 636 |
|
|
ibackupFile.remove();
|
| 637 |
|
|
}
|
| 638 |
|
|
}
|
| 639 |
|
|
// 错误 这条链没有被删除 ,检查文件是否编译通过
|
| 640 |
|
|
iundelChainList << ichainName ;
|
| 641 |
|
|
continue ;
|
| 642 |
|
|
}
|
| 643 |
|
|
|
| 644 |
|
|
m_ichainInfoMap.remove(ichainName) ;
|
| 645 |
|
|
m_ichainTreeItemMap.remove(ichainName) ;
|
| 646 |
|
|
m_iqueryTreeItemMap.remove(pitem->getNameData());
|
| 647 |
|
|
|
| 648 |
|
|
if(m_pLastOperateChain)
|
| 649 |
|
|
{
|
| 650 |
|
|
if(m_pLastOperateChain->getChainName() == ichainName)
|
| 651 |
|
|
{
|
| 652 |
|
|
m_pLastOperateChain = NULL ;
|
| 653 |
|
|
m_pLastOperteTreeItem = NULL ;
|
| 654 |
|
|
m_elastOperation = OperateTypeNone ;
|
| 655 |
|
|
}
|
| 656 |
|
|
}
|
| 657 |
|
|
|
| 658 |
|
|
|
| 659 |
|
|
pitem->setScanChainInfo(NULL);
|
| 660 |
|
|
|
| 661 |
|
|
// 删除备份文件
|
| 662 |
|
|
QStringList iscanFileList = pchain->getScanedFileList();
|
| 663 |
|
|
for(int i = 0 ; i < iscanFileList.count(); i++)
|
| 664 |
|
|
{
|
| 665 |
|
|
QString ifileName = iscanFileList.at(i) ;
|
| 666 |
|
|
QString irelativeName = m_iprjPath.relativeFilePath(ifileName) ;
|
| 667 |
|
|
QFileInfo ifileInfo(ifileName);
|
| 668 |
|
|
QDateTime idateTime = ifileInfo.lastModified();
|
| 669 |
|
|
|
| 670 |
|
|
QFile ibakFile(ifileName + ieziDebugFileSuffix) ;
|
| 671 |
|
|
if(ibakFile.exists())
|
| 672 |
|
|
{
|
| 673 |
|
|
ibakFile.remove();
|
| 674 |
|
|
}
|
| 675 |
|
|
|
| 676 |
|
|
// 更改文件时间
|
| 677 |
|
|
if(ifileName.endsWith(".v"))
|
| 678 |
|
|
{
|
| 679 |
|
|
m_ivlgFileMap.value(irelativeName)->modifyStoredTime(idateTime);
|
| 680 |
|
|
|
| 681 |
|
|
EziDebugVlgFile* pfile = m_ivlgFileMap.value(irelativeName) ;
|
| 682 |
|
|
|
| 683 |
|
|
EziDebugPrj::LOG_FILE_INFO* pdelFileInfo = new EziDebugPrj::LOG_FILE_INFO ;
|
| 684 |
|
|
pdelFileInfo->etype = EziDebugPrj::infoTypeFileInfo ;
|
| 685 |
|
|
pdelFileInfo->pinfo = NULL ;
|
| 686 |
|
|
memcpy(pdelFileInfo->ainfoName , irelativeName.toAscii().data() , irelativeName.size()+1);
|
| 687 |
|
|
deletedinfoList.append(pdelFileInfo);
|
| 688 |
|
|
|
| 689 |
|
|
struct EziDebugPrj::LOG_FILE_INFO* paddFileInfo = new EziDebugPrj::LOG_FILE_INFO ;
|
| 690 |
|
|
paddFileInfo->etype = EziDebugPrj::infoTypeFileInfo ;
|
| 691 |
|
|
paddFileInfo->pinfo = pfile ;
|
| 692 |
|
|
memcpy(paddFileInfo->ainfoName , irelativeName.toAscii().data(), irelativeName.size()+1);
|
| 693 |
|
|
addedinfoList.append(paddFileInfo);
|
| 694 |
|
|
|
| 695 |
|
|
}
|
| 696 |
|
|
else if(ifileName.endsWith(".vhd"))
|
| 697 |
|
|
{
|
| 698 |
|
|
m_ivhdlFileMap.value(irelativeName)->modifyStoredTime(idateTime);
|
| 699 |
|
|
|
| 700 |
|
|
EziDebugVhdlFile* pfile = m_ivhdlFileMap.value(irelativeName) ;
|
| 701 |
|
|
EziDebugPrj::LOG_FILE_INFO* pdelFileInfo = new EziDebugPrj::LOG_FILE_INFO ;
|
| 702 |
|
|
pdelFileInfo->etype = EziDebugPrj::infoTypeFileInfo ;
|
| 703 |
|
|
pdelFileInfo->pinfo = NULL ;
|
| 704 |
|
|
memcpy(pdelFileInfo->ainfoName , irelativeName.toAscii().data() , irelativeName.size()+1);
|
| 705 |
|
|
deletedinfoList.append(pdelFileInfo);
|
| 706 |
|
|
|
| 707 |
|
|
struct EziDebugPrj::LOG_FILE_INFO* paddFileInfo = new EziDebugPrj::LOG_FILE_INFO ;
|
| 708 |
|
|
paddFileInfo->etype = EziDebugPrj::infoTypeFileInfo ;
|
| 709 |
|
|
paddFileInfo->pinfo = pfile ;
|
| 710 |
|
|
memcpy(paddFileInfo->ainfoName , irelativeName.toAscii().data(), irelativeName.size()+1);
|
| 711 |
|
|
addedinfoList.append(paddFileInfo);
|
| 712 |
|
|
}
|
| 713 |
|
|
else
|
| 714 |
|
|
{
|
| 715 |
|
|
// do nothing
|
| 716 |
|
|
continue ;
|
| 717 |
|
|
}
|
| 718 |
|
|
|
| 719 |
|
|
}
|
| 720 |
|
|
|
| 721 |
|
|
// 删除链指针
|
| 722 |
|
|
delete pchain ;
|
| 723 |
|
|
}
|
| 724 |
|
|
}
|
| 725 |
|
|
// 删除破坏掉的链,下次接着扫描链是否被破坏
|
| 726 |
|
|
m_idestroyedChain.clear() ;
|
| 727 |
|
|
return iundelChainList ;
|
| 728 |
|
|
}
|
| 729 |
|
|
|
| 730 |
|
|
|
| 731 |
|
|
bool EziDebugPrj::isPrjFileExist(void)
|
| 732 |
|
|
{
|
| 733 |
|
|
QStringList inameFilter ;
|
| 734 |
|
|
QStringList ifileList ;
|
| 735 |
|
|
|
| 736 |
|
|
if(ToolQuartus == m_eusedTool)
|
| 737 |
|
|
{
|
| 738 |
|
|
inameFilter.append("*.qsf");
|
| 739 |
|
|
}
|
| 740 |
|
|
else if(ToolIse == m_eusedTool)
|
| 741 |
|
|
{
|
| 742 |
|
|
// 版本 10.1
|
| 743 |
|
|
inameFilter.append("*.restore");
|
| 744 |
|
|
// 版本 14.4
|
| 745 |
|
|
inameFilter.append("*.xise");
|
| 746 |
|
|
}
|
| 747 |
|
|
else
|
| 748 |
|
|
{
|
| 749 |
|
|
/*do nothing*/
|
| 750 |
|
|
qDebug() << "Is there other tool in the world ?" ;
|
| 751 |
|
|
return 0 ;
|
| 752 |
|
|
}
|
| 753 |
|
|
ifileList = m_iprjPath.entryList(inameFilter,QDir::Files) ;
|
| 754 |
|
|
if(!ifileList.count())
|
| 755 |
|
|
{
|
| 756 |
4 |
EziDebug |
//qDebug() << "Please Check the path \""<< m_iprjPath.absolutePath() <<"\" to verify the " << inameFilter.at(0) << "file exist !";
|
| 757 |
|
|
QMessageBox::warning(NULL, QObject::tr("EziDebug"),QObject::tr("Please Check the path \n \"%1\" \n to verify the %2 file exist!").arg(m_iprjPath.absolutePath()) \
|
| 758 |
|
|
.arg(inameFilter.at(0))) ;
|
| 759 |
|
|
// .arg(inameFilter.at(0))));
|
| 760 |
2 |
EziDebug |
return 0 ;
|
| 761 |
|
|
}
|
| 762 |
|
|
else if(ifileList.count() > 1)
|
| 763 |
|
|
{
|
| 764 |
|
|
qDebug() << "Please Delete the unnecessary file " << inameFilter.at(0) ;
|
| 765 |
4 |
EziDebug |
QMessageBox::warning(NULL, QObject::tr("EziDebug"),QObject::tr("Please delete the unnecessary \"%1\"file!").arg(inameFilter.at(0)));
|
| 766 |
2 |
EziDebug |
return 0 ;
|
| 767 |
|
|
}
|
| 768 |
|
|
else
|
| 769 |
|
|
{
|
| 770 |
|
|
m_iprjName = const_cast<QString&>(ifileList.at(0));
|
| 771 |
|
|
m_iprjName = m_iprjPath.absoluteFilePath(m_iprjName);
|
| 772 |
|
|
qDebug() << "isPrjFileExist" << m_iprjName ;
|
| 773 |
|
|
return 1 ;
|
| 774 |
|
|
}
|
| 775 |
|
|
}
|
| 776 |
|
|
|
| 777 |
|
|
void EziDebugPrj::preModifyPrjFile(void)
|
| 778 |
|
|
{
|
| 779 |
|
|
QString itrueStr = "true" ;
|
| 780 |
|
|
QString ifalseStr = "false" ;
|
| 781 |
|
|
if((ToolIse == m_eusedTool)&&(m_itoolSoftwareVersion == "10.x"))
|
| 782 |
|
|
{
|
| 783 |
|
|
// m_isXilinxErrChecked 如果为true 才进行修改 否则保持不变
|
| 784 |
|
|
|
| 785 |
|
|
QFile iprjFile(m_iprjName);
|
| 786 |
|
|
QString iline;
|
| 787 |
|
|
|
| 788 |
|
|
if(!iprjFile.open(QIODevice::ReadOnly|QIODevice::Text))
|
| 789 |
|
|
{
|
| 790 |
|
|
qDebug() << "Cannot Open file for reading:" << qPrintable(iprjFile.errorString());
|
| 791 |
|
|
return ;
|
| 792 |
|
|
}
|
| 793 |
|
|
|
| 794 |
|
|
QTextStream iinStream(&iprjFile) ;
|
| 795 |
|
|
iline = iinStream.readAll() ;
|
| 796 |
|
|
int nKeyWordsPos = iline.indexOf("PROP_xstEquivRegRemoval") ;
|
| 797 |
|
|
int ntrueBoolValue = iline.indexOf(itrueStr,nKeyWordsPos) ;
|
| 798 |
|
|
int nfalseBoolValue = iline.indexOf(ifalseStr,nKeyWordsPos);
|
| 799 |
|
|
if(ntrueBoolValue < nfalseBoolValue)
|
| 800 |
|
|
{
|
| 801 |
|
|
if(m_isDisXilinxErrChecked)
|
| 802 |
|
|
{
|
| 803 |
|
|
// 改为 false
|
| 804 |
|
|
iline.replace(ntrueBoolValue,itrueStr.size(),ifalseStr);
|
| 805 |
|
|
}
|
| 806 |
|
|
else
|
| 807 |
|
|
{
|
| 808 |
|
|
// 改为 true
|
| 809 |
|
|
iprjFile.close();
|
| 810 |
|
|
return ;
|
| 811 |
|
|
}
|
| 812 |
|
|
}
|
| 813 |
|
|
else
|
| 814 |
|
|
{
|
| 815 |
|
|
if(m_isDisXilinxErrChecked)
|
| 816 |
|
|
{
|
| 817 |
|
|
// 改为 false
|
| 818 |
|
|
iprjFile.close();
|
| 819 |
|
|
return ;
|
| 820 |
|
|
}
|
| 821 |
|
|
else
|
| 822 |
|
|
{
|
| 823 |
|
|
// 改为 true
|
| 824 |
|
|
iline.replace(nfalseBoolValue,ifalseStr.size(),itrueStr);
|
| 825 |
|
|
}
|
| 826 |
|
|
}
|
| 827 |
|
|
|
| 828 |
|
|
iprjFile.close();
|
| 829 |
|
|
|
| 830 |
|
|
if(!iprjFile.open(QIODevice::WriteOnly|QIODevice::Text))
|
| 831 |
|
|
{
|
| 832 |
|
|
qDebug() << "Cannot Open file for reading:" << qPrintable(iprjFile.errorString());
|
| 833 |
|
|
return ;
|
| 834 |
|
|
}
|
| 835 |
|
|
|
| 836 |
|
|
QTextStream ioutStream(&iprjFile) ;
|
| 837 |
|
|
ioutStream << iline ;
|
| 838 |
|
|
iprjFile.close();
|
| 839 |
|
|
}
|
| 840 |
|
|
}
|
| 841 |
|
|
int EziDebugPrj::parseQuartusPrjFile(QMap<QString,EziDebugVlgFile*> &vlgFileMap ,QMap<QString,EziDebugVhdlFile*> &vhdlFileMap)
|
| 842 |
|
|
{
|
| 843 |
|
|
QFile iprjFile(m_iprjName);
|
| 844 |
|
|
if(!iprjFile.open(QIODevice::ReadOnly|QIODevice::Text))
|
| 845 |
|
|
{
|
| 846 |
|
|
qDebug() << "Cannot Open file for reading:" << qPrintable(iprjFile.errorString());
|
| 847 |
|
|
return 1 ;
|
| 848 |
|
|
}
|
| 849 |
|
|
QTextStream iinStream(&iprjFile) ;
|
| 850 |
|
|
while(!iinStream.atEnd())
|
| 851 |
|
|
{
|
| 852 |
|
|
QString iline = iinStream.readLine();
|
| 853 |
|
|
|
| 854 |
|
|
if(iline.contains(QRegExp("\\bLAST_QUARTUS_VERSION\\b")))
|
| 855 |
|
|
{
|
| 856 |
|
|
QStringList ifileds = iline.split(QRegExp("\\s+"));
|
| 857 |
|
|
if(ifileds.size()!=4)
|
| 858 |
|
|
{
|
| 859 |
|
|
qDebug()<< "the project file has problem!" ;
|
| 860 |
|
|
break;
|
| 861 |
|
|
}
|
| 862 |
|
|
else
|
| 863 |
|
|
{
|
| 864 |
|
|
if(ifileds.at(2) == "LAST_QUARTUS_VERSION")
|
| 865 |
|
|
{
|
| 866 |
|
|
m_itoolSoftwareVersion = ifileds.at(3) ;
|
| 867 |
|
|
}
|
| 868 |
|
|
else
|
| 869 |
|
|
{
|
| 870 |
|
|
qDebug()<< "the project file has problem!" ;
|
| 871 |
|
|
break;
|
| 872 |
|
|
}
|
| 873 |
|
|
}
|
| 874 |
|
|
}
|
| 875 |
|
|
|
| 876 |
|
|
if(iline.contains(QRegExp("\\bVERILOG_FILE\\b")))
|
| 877 |
|
|
{
|
| 878 |
|
|
QStringList ifileds = iline.split(QRegExp("\\s+"));
|
| 879 |
|
|
if(ifileds.size()!=4)
|
| 880 |
|
|
{
|
| 881 |
|
|
qDebug()<< "the project file has problem!" ;
|
| 882 |
|
|
break;
|
| 883 |
|
|
}
|
| 884 |
|
|
else
|
| 885 |
|
|
{
|
| 886 |
|
|
if(ifileds.at(2) == "VERILOG_FILE")
|
| 887 |
|
|
{
|
| 888 |
|
|
QString ifileName = ifileds.at(3) ;
|
| 889 |
|
|
// 转换成绝对路径
|
| 890 |
|
|
if(!(ifileName.endsWith("_EziDebug_ScanChainReg.v")||ifileName.endsWith("_EziDebug_TOUT_m.v")))
|
| 891 |
|
|
{
|
| 892 |
|
|
QFileInfo ifileinfo(m_iprjPath,ifileName);
|
| 893 |
|
|
|
| 894 |
|
|
if(ifileinfo.exists())
|
| 895 |
|
|
{
|
| 896 |
|
|
EziDebugVlgFile *ifileObj = new EziDebugVlgFile(ifileinfo.absoluteDir().absolutePath()+ QObject::tr("/") + ifileinfo.fileName());
|
| 897 |
|
|
vlgFileMap.insert(ifileName,ifileObj);
|
| 898 |
|
|
m_iCodefileNameList.append(ifileName);
|
| 899 |
|
|
}
|
| 900 |
|
|
}
|
| 901 |
|
|
// vlgfilemap.insert(ifileName,ifileObj);
|
| 902 |
|
|
}
|
| 903 |
|
|
else
|
| 904 |
|
|
{
|
| 905 |
|
|
qDebug()<< "the project file has problem!" ;
|
| 906 |
|
|
break;
|
| 907 |
|
|
}
|
| 908 |
|
|
}
|
| 909 |
|
|
}
|
| 910 |
|
|
|
| 911 |
|
|
if(iline.contains(QRegExp("\\bVHDL_FILE\\b")))
|
| 912 |
|
|
{
|
| 913 |
|
|
QStringList ifileds = iline.split(QRegExp("\\s+"));
|
| 914 |
|
|
if(ifileds.size()!=4)
|
| 915 |
|
|
{
|
| 916 |
|
|
qDebug()<< "the project file has problem!" ;
|
| 917 |
|
|
break;
|
| 918 |
|
|
}
|
| 919 |
|
|
else
|
| 920 |
|
|
{
|
| 921 |
|
|
if(ifileds.at(2) == "VHDL_FILE")
|
| 922 |
|
|
{
|
| 923 |
|
|
QString ifileName = ifileds.at(3) ;
|
| 924 |
|
|
// 转换成绝对路径
|
| 925 |
|
|
QFileInfo ifileinfo(m_iprjPath,ifileName);
|
| 926 |
|
|
if(ifileinfo.exists())
|
| 927 |
|
|
{
|
| 928 |
|
|
EziDebugVhdlFile *ifileObj = new EziDebugVhdlFile(ifileinfo.absoluteDir().absolutePath()+ QObject::tr("/") + ifileinfo.fileName());
|
| 929 |
|
|
vhdlFileMap.insert(ifileName,ifileObj);
|
| 930 |
|
|
m_iCodefileNameList.append(ifileName);
|
| 931 |
|
|
}
|
| 932 |
|
|
// vhdlfilemap.insert(ifileName,ifileObj);
|
| 933 |
|
|
}
|
| 934 |
|
|
else
|
| 935 |
|
|
{
|
| 936 |
|
|
qDebug()<< "the project file has problem!" ;
|
| 937 |
|
|
break;
|
| 938 |
|
|
}
|
| 939 |
|
|
}
|
| 940 |
|
|
}
|
| 941 |
|
|
|
| 942 |
|
|
if(iline.contains(QRegExp("\\bTOP_LEVEL_ENTITY\\b")))
|
| 943 |
|
|
{
|
| 944 |
|
|
QStringList ifileds = iline.split(QRegExp("\\s+"));
|
| 945 |
|
|
if(ifileds.size()!=4)
|
| 946 |
|
|
{
|
| 947 |
|
|
qDebug()<< "the project file has problem!" ;
|
| 948 |
|
|
break;
|
| 949 |
|
|
}
|
| 950 |
|
|
else
|
| 951 |
|
|
{
|
| 952 |
|
|
if(ifileds.at(2) == "TOP_LEVEL_ENTITY")
|
| 953 |
|
|
{
|
| 954 |
|
|
m_itopModule = ifileds.at(3) ;
|
| 955 |
|
|
}
|
| 956 |
|
|
else
|
| 957 |
|
|
{
|
| 958 |
|
|
qDebug()<< "the project file has problem!" ;
|
| 959 |
|
|
break;
|
| 960 |
|
|
}
|
| 961 |
|
|
}
|
| 962 |
|
|
}
|
| 963 |
|
|
|
| 964 |
|
|
if(iline.contains(QRegExp("\\bSIGNALTAP_FILE\\b")))
|
| 965 |
|
|
{
|
| 966 |
|
|
QStringList ifileds = iline.split(QRegExp("\\s+"));
|
| 967 |
|
|
if(ifileds.size()!=4)
|
| 968 |
|
|
{
|
| 969 |
|
|
qDebug()<< "the project file has problem!" ;
|
| 970 |
|
|
break;
|
| 971 |
|
|
}
|
| 972 |
|
|
else
|
| 973 |
|
|
{
|
| 974 |
|
|
if(ifileds.at(2) == "SIGNALTAP_FILE")
|
| 975 |
|
|
{
|
| 976 |
|
|
m_iwaveFileList << ifileds.at(3) ;
|
| 977 |
|
|
}
|
| 978 |
|
|
else
|
| 979 |
|
|
{
|
| 980 |
|
|
qDebug()<< "the project file has problem!" ;
|
| 981 |
|
|
break;
|
| 982 |
|
|
}
|
| 983 |
|
|
}
|
| 984 |
|
|
}
|
| 985 |
|
|
|
| 986 |
|
|
}
|
| 987 |
|
|
return 0 ;
|
| 988 |
|
|
}
|
| 989 |
|
|
|
| 990 |
|
|
int EziDebugPrj::parseQuartusPrjFile(QStringList &filelist)
|
| 991 |
|
|
{
|
| 992 |
|
|
QFile iprjFile(m_iprjName);
|
| 993 |
|
|
if(!iprjFile.open(QIODevice::ReadOnly|QIODevice::Text))
|
| 994 |
|
|
{
|
| 995 |
|
|
qDebug() << "Cannot Open file for reading:" << qPrintable(iprjFile.errorString());
|
| 996 |
|
|
return 1 ;
|
| 997 |
|
|
}
|
| 998 |
|
|
QTextStream iinStream(&iprjFile) ;
|
| 999 |
|
|
while(!iinStream.atEnd())
|
| 1000 |
|
|
{
|
| 1001 |
|
|
QString iline = iinStream.readLine();
|
| 1002 |
|
|
if(iline.contains(QRegExp("\\bVERILOG_FILE\\b")))
|
| 1003 |
|
|
{
|
| 1004 |
|
|
QStringList ifileds = iline.split(QRegExp("\\s+"));
|
| 1005 |
|
|
if(ifileds.size()!=4)
|
| 1006 |
|
|
{
|
| 1007 |
|
|
qDebug()<< "the project file has problem!" ;
|
| 1008 |
|
|
break;
|
| 1009 |
|
|
}
|
| 1010 |
|
|
else
|
| 1011 |
|
|
{
|
| 1012 |
|
|
if(ifileds.at(2) == "VERILOG_FILE")
|
| 1013 |
|
|
{
|
| 1014 |
|
|
QString ifileName = ifileds.at(3) ;
|
| 1015 |
|
|
QFileInfo ifileinfo(m_iprjPath,ifileName);
|
| 1016 |
|
|
|
| 1017 |
|
|
if(!(ifileName.endsWith("_EziDebug_ScanChainReg.v")||ifileName.endsWith("_EziDebug_TOUT_m.v")))
|
| 1018 |
|
|
{
|
| 1019 |
|
|
if(ifileinfo.exists())
|
| 1020 |
|
|
{
|
| 1021 |
|
|
filelist.append(ifileName);
|
| 1022 |
|
|
}
|
| 1023 |
|
|
}
|
| 1024 |
|
|
// vlgfilemap.insert(ifileName,ifileObj);
|
| 1025 |
|
|
}
|
| 1026 |
|
|
else
|
| 1027 |
|
|
{
|
| 1028 |
|
|
qDebug()<< "the project file has problem!" ;
|
| 1029 |
|
|
break;
|
| 1030 |
|
|
}
|
| 1031 |
|
|
}
|
| 1032 |
|
|
}
|
| 1033 |
|
|
if(iline.contains(QRegExp("\\bVHDL_FILE\\b")))
|
| 1034 |
|
|
{
|
| 1035 |
|
|
QStringList ifileds = iline.split(QRegExp("\\s+"));
|
| 1036 |
|
|
if(ifileds.size()!=4)
|
| 1037 |
|
|
{
|
| 1038 |
|
|
qDebug()<< "the project file has problem!" ;
|
| 1039 |
|
|
break;
|
| 1040 |
|
|
}
|
| 1041 |
|
|
else
|
| 1042 |
|
|
{
|
| 1043 |
|
|
if(ifileds.at(2) == "VHDL_FILE")
|
| 1044 |
|
|
{
|
| 1045 |
|
|
QString ifileName = ifileds.at(3) ;
|
| 1046 |
|
|
QFileInfo ifileinfo(m_iprjPath,ifileName);
|
| 1047 |
|
|
if(ifileinfo.exists())
|
| 1048 |
|
|
{
|
| 1049 |
|
|
filelist.append(ifileName);
|
| 1050 |
|
|
}
|
| 1051 |
|
|
// vhdlfilemap.insert(ifileName,ifileObj);
|
| 1052 |
|
|
}
|
| 1053 |
|
|
else
|
| 1054 |
|
|
{
|
| 1055 |
|
|
qDebug()<< "the project file has problem!" ;
|
| 1056 |
|
|
break;
|
| 1057 |
|
|
}
|
| 1058 |
|
|
}
|
| 1059 |
|
|
}
|
| 1060 |
|
|
// 暂时去掉 暂不考虑 topmodule 被修改了 ,作为遗留问题跟踪
|
| 1061 |
|
|
// if(iline.contains(QRegExp("\\bTOP_LEVEL_ENTITY\\b")))
|
| 1062 |
|
|
// {
|
| 1063 |
|
|
// QStringList ifileds = iline.split(QRegExp("\\s+"));
|
| 1064 |
|
|
// if(ifileds.size()!=4)
|
| 1065 |
|
|
// {
|
| 1066 |
|
|
// qDebug()<< "the project file has problem!" ;
|
| 1067 |
|
|
// break;
|
| 1068 |
|
|
// }
|
| 1069 |
|
|
// else
|
| 1070 |
|
|
// {
|
| 1071 |
|
|
// if(ifileds.at(2) == "TOP_LEVEL_ENTITY")
|
| 1072 |
|
|
// {
|
| 1073 |
|
|
// topmodue = ifileds.at(3) ;
|
| 1074 |
|
|
// }
|
| 1075 |
|
|
// else
|
| 1076 |
|
|
// {
|
| 1077 |
|
|
// qDebug()<< "the project file has problem!" ;
|
| 1078 |
|
|
// break;
|
| 1079 |
|
|
// }
|
| 1080 |
|
|
// }
|
| 1081 |
|
|
// }
|
| 1082 |
|
|
|
| 1083 |
|
|
}
|
| 1084 |
|
|
iprjFile.close();
|
| 1085 |
|
|
return 0 ;
|
| 1086 |
|
|
}
|
| 1087 |
|
|
|
| 1088 |
|
|
int EziDebugPrj::parseIsePrjFile(QMap<QString,EziDebugVlgFile*> &vlgFileMap ,QMap<QString,EziDebugVhdlFile*> &vhdlFileMap)
|
| 1089 |
|
|
{
|
| 1090 |
|
|
qDebug() << "parseIsePrjFile " << __LINE__ ;
|
| 1091 |
|
|
QFile iprjFile(m_iprjName);
|
| 1092 |
|
|
QString iLangType ;
|
| 1093 |
|
|
QString ifileInfo ;
|
| 1094 |
|
|
QString iprjInfo ;
|
| 1095 |
|
|
QString iProcessInfo ;
|
| 1096 |
|
|
QStringList ifileInfoList ;
|
| 1097 |
|
|
QStringList iProcessInfoList ;
|
| 1098 |
|
|
if(!iprjFile.open(QIODevice::ReadOnly|QIODevice::Text))
|
| 1099 |
|
|
{
|
| 1100 |
|
|
qDebug() << "Cannot Open file for reading:" << qPrintable(iprjFile.errorString());
|
| 1101 |
|
|
return 1 ;
|
| 1102 |
|
|
}
|
| 1103 |
|
|
QTextStream iinStream(&iprjFile) ;
|
| 1104 |
|
|
QString iline = iinStream.readAll();
|
| 1105 |
|
|
int nstartPos = 0 ;
|
| 1106 |
|
|
int npositionOfProjectSetting = 0 ;
|
| 1107 |
|
|
int npositionOfFileKeyWord = 0 ;
|
| 1108 |
|
|
int npositionOfFileLeftBracket = 0 ;
|
| 1109 |
|
|
int npositionOfFileRightBracket = 0 ;
|
| 1110 |
|
|
int npositionOfProcessKeyWord = 0 ;
|
| 1111 |
|
|
int npositionOfProcessLeftBracket = 0 ;
|
| 1112 |
|
|
int npositionOfProcessRightBracket = 0 ;
|
| 1113 |
|
|
|
| 1114 |
|
|
//m_iprjName
|
| 1115 |
|
|
// 查找所有 代码文件
|
| 1116 |
|
|
if(m_iprjName.endsWith(".restore",Qt::CaseSensitive))
|
| 1117 |
|
|
{
|
| 1118 |
|
|
m_itoolSoftwareVersion = "10.x" ;
|
| 1119 |
|
|
npositionOfProjectSetting = iline.indexOf(QRegExp("\\bset\\s+project_settings\\b"),0);
|
| 1120 |
|
|
if(npositionOfProjectSetting != -1 )
|
| 1121 |
|
|
{
|
| 1122 |
|
|
npositionOfFileLeftBracket = iline.indexOf("{",npositionOfProjectSetting,Qt::CaseSensitive);
|
| 1123 |
|
|
if(npositionOfFileLeftBracket != -1 )
|
| 1124 |
|
|
{
|
| 1125 |
|
|
npositionOfFileRightBracket = iline.indexOf("}",npositionOfFileLeftBracket,Qt::CaseSensitive);
|
| 1126 |
|
|
if(npositionOfFileRightBracket != -1)
|
| 1127 |
|
|
{
|
| 1128 |
|
|
iprjInfo = iline.mid(npositionOfFileLeftBracket+1,npositionOfFileRightBracket-npositionOfFileLeftBracket-1);
|
| 1129 |
|
|
QRegExp iLangExp("\"\\s*PROP_PreferredLanguage\"\\s*");
|
| 1130 |
|
|
int nKeyOfLang = iLangExp.indexIn(iprjInfo,0);
|
| 1131 |
|
|
if(nKeyOfLang != -1)
|
| 1132 |
|
|
{
|
| 1133 |
|
|
int nlen = iLangExp.matchedLength();
|
| 1134 |
|
|
int nFirstQuote = iprjInfo.indexOf("\"" ,nKeyOfLang + nlen );
|
| 1135 |
|
|
int nSecondQuote = iprjInfo.indexOf("\"",nFirstQuote + 1);
|
| 1136 |
|
|
m_icoreLangType = iprjInfo.mid(nFirstQuote + 1 ,nSecondQuote - nFirstQuote - 1) ;
|
| 1137 |
|
|
}
|
| 1138 |
|
|
else
|
| 1139 |
|
|
{
|
| 1140 |
|
|
iprjFile.close();
|
| 1141 |
|
|
|
| 1142 |
|
|
return 1 ;
|
| 1143 |
|
|
}
|
| 1144 |
|
|
}
|
| 1145 |
|
|
}
|
| 1146 |
|
|
else
|
| 1147 |
|
|
{
|
| 1148 |
|
|
qDebug() << "The project File error :The left bracket is not exist!" ;
|
| 1149 |
|
|
iprjFile.close();
|
| 1150 |
|
|
|
| 1151 |
|
|
return 1 ;
|
| 1152 |
|
|
}
|
| 1153 |
|
|
}
|
| 1154 |
|
|
else
|
| 1155 |
|
|
{
|
| 1156 |
|
|
iprjFile.close();
|
| 1157 |
|
|
|
| 1158 |
|
|
return 1 ;
|
| 1159 |
|
|
}
|
| 1160 |
|
|
|
| 1161 |
|
|
nstartPos = npositionOfFileRightBracket + 1 ;
|
| 1162 |
|
|
|
| 1163 |
|
|
// 搜索代码文件
|
| 1164 |
|
|
npositionOfFileKeyWord = iline.indexOf(QRegExp("\\bset\\s+user_files\\b"),nstartPos);
|
| 1165 |
|
|
if(npositionOfFileKeyWord != -1)
|
| 1166 |
|
|
{
|
| 1167 |
|
|
npositionOfFileLeftBracket = iline.indexOf("{",npositionOfFileKeyWord,Qt::CaseSensitive);
|
| 1168 |
|
|
if( npositionOfFileLeftBracket != -1)
|
| 1169 |
|
|
{
|
| 1170 |
|
|
npositionOfFileRightBracket = iline.indexOf("}",npositionOfFileKeyWord,Qt::CaseSensitive);
|
| 1171 |
|
|
if(npositionOfFileRightBracket != -1)
|
| 1172 |
|
|
{
|
| 1173 |
|
|
ifileInfo = iline.mid(npositionOfFileLeftBracket+1,npositionOfFileRightBracket-npositionOfFileLeftBracket-1);
|
| 1174 |
|
|
ifileInfoList = ifileInfo.split("\"",QString::KeepEmptyParts);
|
| 1175 |
|
|
QStringList::const_iterator constIterator ;
|
| 1176 |
|
|
for (constIterator = ifileInfoList.constBegin(); constIterator != ifileInfoList.constEnd();++constIterator)
|
| 1177 |
|
|
{
|
| 1178 |
|
|
QString ifileName = (*constIterator) ;
|
| 1179 |
|
|
if(ifileName.endsWith(".vhd", Qt::CaseSensitive))
|
| 1180 |
|
|
{
|
| 1181 |
|
|
// 转换成绝对路径
|
| 1182 |
|
|
QFileInfo ifileinfo(m_iprjPath,*constIterator);
|
| 1183 |
|
|
EziDebugVhdlFile* pvhdlFileObj = new EziDebugVhdlFile(ifileinfo.absoluteDir().absolutePath()+ QObject::tr("/") + ifileinfo.fileName());
|
| 1184 |
|
|
qDebug() << const_cast<QString&>(*constIterator);
|
| 1185 |
|
|
if(!(ifileName.endsWith("_EziDebug_ScanChainReg.vhd")||ifileName.endsWith("_EziDebug_TOUT_m.vhd")))
|
| 1186 |
|
|
{
|
| 1187 |
|
|
vhdlFileMap.insert(ifileName,pvhdlFileObj);
|
| 1188 |
|
|
m_iCodefileNameList.append(ifileName);
|
| 1189 |
|
|
}
|
| 1190 |
|
|
// vhdlfilemap.insert((*constIterator),pvhdlFileObj);
|
| 1191 |
|
|
}
|
| 1192 |
|
|
else if(ifileName.endsWith(".v", Qt::CaseSensitive))
|
| 1193 |
|
|
{
|
| 1194 |
|
|
QFileInfo ifileinfo(m_iprjPath,*constIterator);
|
| 1195 |
|
|
EziDebugVlgFile* pvlgFileObj = new EziDebugVlgFile(ifileinfo.absoluteDir().absolutePath()+ QObject::tr("/") + ifileinfo.fileName());
|
| 1196 |
|
|
qDebug() << const_cast<QString&>(*constIterator);
|
| 1197 |
|
|
if(!(ifileName.endsWith("_EziDebug_ScanChainReg.v")||ifileName.endsWith("_EziDebug_TOUT_m.v")))
|
| 1198 |
|
|
{
|
| 1199 |
|
|
vlgFileMap.insert((*constIterator),pvlgFileObj);
|
| 1200 |
|
|
m_iCodefileNameList.append((*constIterator));
|
| 1201 |
|
|
}
|
| 1202 |
|
|
// vlgfilemap.insert((*constIterator),pvlgFileObj);
|
| 1203 |
|
|
}
|
| 1204 |
|
|
else if(ifileName.endsWith(".xco", Qt::CaseSensitive))
|
| 1205 |
|
|
{
|
| 1206 |
|
|
#if 1
|
| 1207 |
|
|
QString iHdlFileName ;
|
| 1208 |
|
|
QString iCompleteRelativeHdlFileName = *constIterator ;
|
| 1209 |
|
|
|
| 1210 |
|
|
QFileInfo ifileinfo(m_iprjPath,*constIterator);
|
| 1211 |
|
|
iHdlFileName = ifileinfo.fileName();
|
| 1212 |
|
|
|
| 1213 |
|
|
qDebug() << const_cast<QString&>(*constIterator);
|
| 1214 |
|
|
if(m_icoreLangType == "Verilog")
|
| 1215 |
|
|
{
|
| 1216 |
|
|
iHdlFileName.replace(".xco",".v");
|
| 1217 |
|
|
iCompleteRelativeHdlFileName.replace(".xco",".v");
|
| 1218 |
|
|
// 用绝对路径构造
|
| 1219 |
|
|
EziDebugVlgFile* pvlgFileObj = new EziDebugVlgFile(ifileinfo.absoluteDir().absolutePath()+ QObject::tr("/") + iHdlFileName);
|
| 1220 |
|
|
pvlgFileObj->setLibaryFlag(true);
|
| 1221 |
|
|
vlgFileMap.insert(iCompleteRelativeHdlFileName,pvlgFileObj);
|
| 1222 |
|
|
m_iCodefileNameList.append(iCompleteRelativeHdlFileName);
|
| 1223 |
|
|
}
|
| 1224 |
|
|
else
|
| 1225 |
|
|
{
|
| 1226 |
|
|
// 用绝对路径构造
|
| 1227 |
|
|
iHdlFileName.replace(".xco",".vhd");
|
| 1228 |
|
|
iCompleteRelativeHdlFileName.replace(".xco",".vhd") ;
|
| 1229 |
|
|
EziDebugVhdlFile* pvhdlFileObj = new EziDebugVhdlFile(ifileinfo.absoluteDir().absolutePath()+ QObject::tr("/") + iHdlFileName);
|
| 1230 |
|
|
pvhdlFileObj->setLibaryFlag(true);
|
| 1231 |
|
|
vhdlFileMap.insert(iCompleteRelativeHdlFileName,pvhdlFileObj);
|
| 1232 |
|
|
m_iCodefileNameList.append(iCompleteRelativeHdlFileName);
|
| 1233 |
|
|
}
|
| 1234 |
|
|
#endif
|
| 1235 |
|
|
}
|
| 1236 |
|
|
}
|
| 1237 |
|
|
}
|
| 1238 |
|
|
else
|
| 1239 |
|
|
{
|
| 1240 |
|
|
qDebug() << "the setting file has some problem!" ;
|
| 1241 |
|
|
iprjFile.close();
|
| 1242 |
|
|
return 1 ;
|
| 1243 |
|
|
}
|
| 1244 |
|
|
}
|
| 1245 |
|
|
else
|
| 1246 |
|
|
{
|
| 1247 |
|
|
qDebug() << "There is leftbracket after \"set user_files\" !";
|
| 1248 |
|
|
iprjFile.close();
|
| 1249 |
|
|
return 1 ;
|
| 1250 |
|
|
}
|
| 1251 |
|
|
}
|
| 1252 |
|
|
else
|
| 1253 |
|
|
{
|
| 1254 |
|
|
qDebug() << "There is leftbracket after \"set user_files\" !";
|
| 1255 |
|
|
iprjFile.close();
|
| 1256 |
|
|
return 1 ;
|
| 1257 |
|
|
}
|
| 1258 |
|
|
|
| 1259 |
|
|
|
| 1260 |
|
|
nstartPos = npositionOfFileRightBracket + 1;
|
| 1261 |
|
|
npositionOfProcessKeyWord = iline.indexOf(QRegExp("\\bset\\s+process_props\\b"),nstartPos);
|
| 1262 |
|
|
|
| 1263 |
|
|
npositionOfProcessLeftBracket = iline.indexOf("{",npositionOfProcessKeyWord,Qt::CaseSensitive);
|
| 1264 |
|
|
if( npositionOfProcessLeftBracket != -1)
|
| 1265 |
|
|
{
|
| 1266 |
|
|
npositionOfProcessRightBracket = iline.indexOf("}",npositionOfProcessKeyWord,Qt::CaseSensitive);
|
| 1267 |
|
|
if(npositionOfProcessRightBracket != -1)
|
| 1268 |
|
|
{
|
| 1269 |
|
|
iProcessInfo = iline.mid(npositionOfProcessLeftBracket+1,npositionOfProcessRightBracket-npositionOfFileLeftBracket-1);
|
| 1270 |
|
|
iProcessInfoList = iProcessInfo.split("\"",QString::SkipEmptyParts);
|
| 1271 |
|
|
QStringList::const_iterator constIterator ;
|
| 1272 |
|
|
for (constIterator = iProcessInfoList.constBegin(); constIterator != iProcessInfoList.constEnd();++constIterator)
|
| 1273 |
|
|
{
|
| 1274 |
|
|
if((*constIterator)== "PROP_SynthTop")
|
| 1275 |
|
|
{
|
| 1276 |
|
|
constIterator += 2 ;
|
| 1277 |
|
|
qDebug() << "detect top key word!" ;
|
| 1278 |
|
|
if(((*constIterator).contains("Module"),Qt::CaseSensitive)||((*constIterator).contains("Architecture"),Qt::CaseSensitive))
|
| 1279 |
|
|
{
|
| 1280 |
|
|
QString itopmodule = *constIterator ;
|
| 1281 |
|
|
|
| 1282 |
|
|
QStringList itopModuleList = itopmodule.split("|");
|
| 1283 |
|
|
m_itopModule = itopModuleList.at(1);
|
| 1284 |
|
|
qDebug() << m_itopModule ;
|
| 1285 |
|
|
}
|
| 1286 |
|
|
else
|
| 1287 |
|
|
{
|
| 1288 |
|
|
qDebug() << "parseIsePrjFile error!";
|
| 1289 |
|
|
iprjFile.close();
|
| 1290 |
|
|
return 1 ;
|
| 1291 |
|
|
}
|
| 1292 |
|
|
}
|
| 1293 |
|
|
}
|
| 1294 |
|
|
}
|
| 1295 |
|
|
else
|
| 1296 |
|
|
{
|
| 1297 |
|
|
qDebug() << "the setting file has some problem!" ;
|
| 1298 |
|
|
iprjFile.close();
|
| 1299 |
|
|
return 1 ;
|
| 1300 |
|
|
}
|
| 1301 |
|
|
}
|
| 1302 |
|
|
else
|
| 1303 |
|
|
{
|
| 1304 |
|
|
qDebug() << "There is leftbracket after \"set user_files\" !";
|
| 1305 |
|
|
iprjFile.close();
|
| 1306 |
|
|
return 1 ;
|
| 1307 |
|
|
}
|
| 1308 |
|
|
|
| 1309 |
|
|
}
|
| 1310 |
|
|
else if(m_iprjName.endsWith(".xise",Qt::CaseSensitive))
|
| 1311 |
|
|
{
|
| 1312 |
|
|
QDomDocument idomDocument ;
|
| 1313 |
|
|
QString iErrorStr ;
|
| 1314 |
|
|
int nErrorLine ;
|
| 1315 |
|
|
int nErrorColumn = 0 ;
|
| 1316 |
|
|
if (!idomDocument.setContent(&iprjFile, true, &iErrorStr, &nErrorLine, &nErrorColumn))
|
| 1317 |
|
|
{
|
| 1318 |
|
|
qDebug() << tr("Parse error at line %1, column %2:\n%3").arg(nErrorLine)\
|
| 1319 |
|
|
.arg(nErrorColumn).arg(iErrorStr) ;
|
| 1320 |
|
|
return 1 ;
|
| 1321 |
|
|
}
|
| 1322 |
|
|
|
| 1323 |
|
|
QDomElement root = idomDocument.documentElement();
|
| 1324 |
|
|
if(root.tagName() == "project")
|
| 1325 |
|
|
{
|
| 1326 |
|
|
// 获取工程设置的代码语言 以及 获取 topmodule
|
| 1327 |
|
|
QDomElement iPrjProperties = root.firstChildElement("properties");
|
| 1328 |
|
|
if(!iPrjProperties.isNull())
|
| 1329 |
|
|
{
|
| 1330 |
|
|
QDomElement iPrjProperty = iPrjProperties.firstChildElement("property");
|
| 1331 |
|
|
while(!iPrjProperty.isNull())
|
| 1332 |
|
|
{
|
| 1333 |
|
|
if(iPrjProperty.attribute("xil_pn:name") == "Implementation Top")
|
| 1334 |
|
|
{
|
| 1335 |
|
|
m_itopModule = iPrjProperty.attribute("xil_pn:value") ;
|
| 1336 |
|
|
}
|
| 1337 |
|
|
|
| 1338 |
|
|
if(iPrjProperty.attribute("xil_pn:name") == "Preferred Language")
|
| 1339 |
|
|
{
|
| 1340 |
|
|
m_icoreLangType = iPrjProperty.attribute("xil_pn:value");
|
| 1341 |
|
|
break ;
|
| 1342 |
|
|
}
|
| 1343 |
|
|
iPrjProperty = iPrjProperties.nextSiblingElement("property") ;
|
| 1344 |
|
|
}
|
| 1345 |
|
|
}
|
| 1346 |
|
|
else
|
| 1347 |
|
|
{
|
| 1348 |
|
|
qDebug() << "The project file parse error!";
|
| 1349 |
|
|
iprjFile.close();
|
| 1350 |
|
|
return 1 ;
|
| 1351 |
|
|
}
|
| 1352 |
|
|
|
| 1353 |
|
|
if(m_itopModule.isEmpty())
|
| 1354 |
|
|
{
|
| 1355 |
|
|
qDebug() << "The project file parse error: NO Topmodule!";
|
| 1356 |
|
|
iprjFile.close();
|
| 1357 |
|
|
return 1 ;
|
| 1358 |
|
|
}
|
| 1359 |
|
|
|
| 1360 |
|
|
if(iLangType.isEmpty())
|
| 1361 |
|
|
{
|
| 1362 |
|
|
qDebug() << "The project file parse error: NO Language Type!";
|
| 1363 |
|
|
iprjFile.close();
|
| 1364 |
|
|
return 1 ;
|
| 1365 |
|
|
}
|
| 1366 |
|
|
|
| 1367 |
|
|
QDomElement ifilesChild = root.firstChildElement("files");
|
| 1368 |
|
|
if(!ifilesChild.isNull())
|
| 1369 |
|
|
{
|
| 1370 |
|
|
QDomElement ifileChild = ifilesChild.firstChildElement("file");
|
| 1371 |
|
|
|
| 1372 |
|
|
while(!ifileChild.isNull())
|
| 1373 |
|
|
{
|
| 1374 |
|
|
// 相对路径
|
| 1375 |
|
|
QString ifileName = ifileChild.attribute("xil_pn:name") ;
|
| 1376 |
|
|
if(ifileName.endsWith(".v"))
|
| 1377 |
|
|
{
|
| 1378 |
|
|
QFileInfo ifileinfo(m_iprjPath,ifileName);
|
| 1379 |
|
|
EziDebugVlgFile* pvlgFileObj = new EziDebugVlgFile(ifileinfo.absoluteDir().absolutePath()+ QObject::tr("/") + ifileinfo.fileName());
|
| 1380 |
|
|
qDebug() << ifileName ;
|
| 1381 |
|
|
if(!(ifileName.endsWith("_EziDebug_ScanChainReg.v")||ifileName.endsWith("_EziDebug_TOUT_m.v")))
|
| 1382 |
|
|
{
|
| 1383 |
|
|
vlgFileMap.insert(ifileName,pvlgFileObj);
|
| 1384 |
|
|
m_iCodefileNameList.append(ifileName);
|
| 1385 |
|
|
}
|
| 1386 |
|
|
|
| 1387 |
|
|
}
|
| 1388 |
|
|
else if(ifileName.endsWith(".vhd"))
|
| 1389 |
|
|
{
|
| 1390 |
|
|
QFileInfo ifileinfo(m_iprjPath,ifileName);
|
| 1391 |
|
|
EziDebugVhdlFile* pvhdlFileObj = new EziDebugVhdlFile(ifileinfo.absoluteDir().absolutePath()+ QObject::tr("/") + ifileinfo.fileName());
|
| 1392 |
|
|
qDebug() << ifileName ;
|
| 1393 |
|
|
if(!(ifileName.endsWith("_EziDebug_ScanChainReg.vhd")||ifileName.endsWith("_EziDebug_TOUT_m.vhd")))
|
| 1394 |
|
|
{
|
| 1395 |
|
|
vhdlFileMap.insert(ifileName,pvhdlFileObj);
|
| 1396 |
|
|
m_iCodefileNameList.append(ifileName);
|
| 1397 |
|
|
}
|
| 1398 |
|
|
}
|
| 1399 |
|
|
else if(ifileName.endsWith(".xco"))
|
| 1400 |
|
|
{
|
| 1401 |
|
|
if(iLangType == "Verilog")
|
| 1402 |
|
|
{
|
| 1403 |
|
|
ifileName.replace(".xco",".v") ;
|
| 1404 |
|
|
QFileInfo ifileinfo(m_iprjPath,ifileName);
|
| 1405 |
|
|
EziDebugVlgFile* pvlgFileObj = new EziDebugVlgFile(ifileinfo.absoluteDir().absolutePath()+ QObject::tr("/") + ifileinfo.fileName());
|
| 1406 |
|
|
qDebug() << ifileName ;
|
| 1407 |
|
|
|
| 1408 |
|
|
vlgFileMap.insert(ifileName,pvlgFileObj);
|
| 1409 |
|
|
m_iCodefileNameList.append(ifileName);
|
| 1410 |
|
|
}
|
| 1411 |
|
|
else
|
| 1412 |
|
|
{
|
| 1413 |
|
|
ifileName.replace(".xco",".vhd") ;
|
| 1414 |
|
|
QFileInfo ifileinfo(m_iprjPath,ifileName);
|
| 1415 |
|
|
EziDebugVhdlFile* pvhdlFileObj = new EziDebugVhdlFile(ifileinfo.absoluteDir().absolutePath()+ QObject::tr("/") + ifileinfo.fileName());
|
| 1416 |
|
|
qDebug() << ifileName ;
|
| 1417 |
|
|
|
| 1418 |
|
|
vhdlFileMap.insert(ifileName,pvhdlFileObj);
|
| 1419 |
|
|
m_iCodefileNameList.append(ifileName);
|
| 1420 |
|
|
}
|
| 1421 |
|
|
}
|
| 1422 |
|
|
|
| 1423 |
|
|
ifileChild = ifilesChild.nextSiblingElement("file");
|
| 1424 |
|
|
}
|
| 1425 |
|
|
}
|
| 1426 |
|
|
else
|
| 1427 |
|
|
{
|
| 1428 |
|
|
iprjFile.close();
|
| 1429 |
|
|
return 1 ;
|
| 1430 |
|
|
}
|
| 1431 |
|
|
m_itoolSoftwareVersion = "14.x" ;
|
| 1432 |
|
|
}
|
| 1433 |
|
|
}
|
| 1434 |
|
|
|
| 1435 |
|
|
iprjFile.close();
|
| 1436 |
|
|
return 0 ;
|
| 1437 |
|
|
}
|
| 1438 |
|
|
|
| 1439 |
|
|
int EziDebugPrj::parseIsePrjFile(QStringList &filelist)
|
| 1440 |
|
|
{
|
| 1441 |
|
|
qDebug() << "parseIsePrjFile " << __LINE__ ;
|
| 1442 |
|
|
QFile iprjFile(m_iprjName);
|
| 1443 |
|
|
QString ifileInfo ;
|
| 1444 |
|
|
QString iPrjInfo ;
|
| 1445 |
|
|
QString iPreferLang ;
|
| 1446 |
|
|
//QString iProcessInfo ;
|
| 1447 |
|
|
QStringList ifileInfoList ;
|
| 1448 |
|
|
QStringList iPrjInfoList ;
|
| 1449 |
|
|
//QStringList iProcessInfoList ;
|
| 1450 |
|
|
if(!iprjFile.open(QIODevice::ReadOnly|QIODevice::Text))
|
| 1451 |
|
|
{
|
| 1452 |
|
|
qDebug() << "Cannot Open file for reading:" << qPrintable(iprjFile.errorString());
|
| 1453 |
|
|
return 1 ;
|
| 1454 |
|
|
}
|
| 1455 |
|
|
QTextStream iinStream(&iprjFile) ;
|
| 1456 |
|
|
QString iline = iinStream.readAll();
|
| 1457 |
|
|
//int searchPosition = 0 ;
|
| 1458 |
|
|
int npositionOfFileKeyWord = 0 ;
|
| 1459 |
|
|
int npositionOfFileLeftBracket = 0 ;
|
| 1460 |
|
|
int npositionOfFileRightBracket = 0 ;
|
| 1461 |
|
|
int npositionOfPrjKeyWord = 0 ;
|
| 1462 |
|
|
// int npositionOfProcessLeftBracket = 0 ;
|
| 1463 |
|
|
// int npositionOfProcessRightBracket = 0 ;
|
| 1464 |
|
|
|
| 1465 |
|
|
if(m_itoolSoftwareVersion.isEmpty())
|
| 1466 |
|
|
{
|
| 1467 |
|
|
if(m_iprjName.endsWith(".restore",Qt::CaseSensitive))
|
| 1468 |
|
|
{
|
| 1469 |
|
|
m_itoolSoftwareVersion = "10.x" ;
|
| 1470 |
|
|
}
|
| 1471 |
|
|
else if(m_iprjName.endsWith(".xise",Qt::CaseSensitive))
|
| 1472 |
|
|
{
|
| 1473 |
|
|
m_itoolSoftwareVersion = "14.x" ;
|
| 1474 |
|
|
}
|
| 1475 |
|
|
else
|
| 1476 |
|
|
{
|
| 1477 |
|
|
qDebug("EziDebug Error: the version of software that opened the project is confused!");
|
| 1478 |
|
|
return 1 ;
|
| 1479 |
|
|
}
|
| 1480 |
|
|
}
|
| 1481 |
|
|
|
| 1482 |
|
|
if(m_itoolSoftwareVersion == "10.x")
|
| 1483 |
|
|
{
|
| 1484 |
|
|
npositionOfPrjKeyWord = iline.indexOf(QRegExp("\\bset\\s+project_settings\\b"),0);
|
| 1485 |
|
|
if(npositionOfPrjKeyWord != -1)
|
| 1486 |
|
|
{
|
| 1487 |
|
|
npositionOfFileLeftBracket = iline.indexOf("{" , npositionOfPrjKeyWord , Qt::CaseSensitive);
|
| 1488 |
|
|
if( npositionOfFileLeftBracket != -1)
|
| 1489 |
|
|
{
|
| 1490 |
|
|
npositionOfFileRightBracket = iline.indexOf("}",npositionOfFileLeftBracket,Qt::CaseSensitive);
|
| 1491 |
|
|
if(npositionOfFileRightBracket != -1)
|
| 1492 |
|
|
{
|
| 1493 |
|
|
iPrjInfo = iline.mid(npositionOfFileLeftBracket+1,npositionOfFileRightBracket-npositionOfFileLeftBracket-1);
|
| 1494 |
|
|
iPrjInfoList = iPrjInfo.split("\"",QString::SkipEmptyParts);
|
| 1495 |
|
|
QStringList::ConstIterator iprjIter = iPrjInfoList.constBegin();
|
| 1496 |
|
|
while(iprjIter != iPrjInfoList.constEnd())
|
| 1497 |
|
|
{
|
| 1498 |
|
|
QString iKeyWords = *iprjIter ;
|
| 1499 |
|
|
if(iKeyWords == "PROP_PreferredLanguage")
|
| 1500 |
|
|
{
|
| 1501 |
|
|
iprjIter += 2 ;
|
| 1502 |
|
|
iPreferLang = *iprjIter ;
|
| 1503 |
|
|
break ;
|
| 1504 |
|
|
}
|
| 1505 |
|
|
++iprjIter ;
|
| 1506 |
|
|
}
|
| 1507 |
|
|
}
|
| 1508 |
|
|
else
|
| 1509 |
|
|
{
|
| 1510 |
|
|
iprjFile.close();
|
| 1511 |
|
|
qDebug() << "The Prject file parse failed!";
|
| 1512 |
|
|
return 1 ;
|
| 1513 |
|
|
}
|
| 1514 |
|
|
}
|
| 1515 |
|
|
else
|
| 1516 |
|
|
{
|
| 1517 |
|
|
iprjFile.close();
|
| 1518 |
|
|
qDebug() << "The Prject file parse failed!";
|
| 1519 |
|
|
return 1 ;
|
| 1520 |
|
|
}
|
| 1521 |
|
|
}
|
| 1522 |
|
|
else
|
| 1523 |
|
|
{
|
| 1524 |
|
|
iprjFile.close();
|
| 1525 |
|
|
qDebug() << "The Prject file parse failed!";
|
| 1526 |
|
|
return 1 ;
|
| 1527 |
|
|
}
|
| 1528 |
|
|
|
| 1529 |
|
|
npositionOfFileKeyWord = iline.indexOf(QRegExp("\\bset\\s+user_files\\b"),0);
|
| 1530 |
|
|
if(npositionOfFileKeyWord != -1)
|
| 1531 |
|
|
{
|
| 1532 |
|
|
npositionOfFileLeftBracket = iline.indexOf("{" , npositionOfFileKeyWord , Qt::CaseSensitive);
|
| 1533 |
|
|
if( npositionOfFileLeftBracket != -1)
|
| 1534 |
|
|
{
|
| 1535 |
|
|
npositionOfFileRightBracket = iline.indexOf("}",npositionOfFileLeftBracket,Qt::CaseSensitive);
|
| 1536 |
|
|
if(npositionOfFileRightBracket != -1)
|
| 1537 |
|
|
{
|
| 1538 |
|
|
//searchPosition = npositionOfFileRightBracket ;
|
| 1539 |
|
|
ifileInfo = iline.mid(npositionOfFileLeftBracket+1,npositionOfFileRightBracket-npositionOfFileLeftBracket-1);
|
| 1540 |
|
|
|
| 1541 |
|
|
ifileInfoList = ifileInfo.split("\"",QString::SkipEmptyParts);
|
| 1542 |
|
|
QStringList::const_iterator constIterator ;
|
| 1543 |
|
|
for (constIterator = ifileInfoList.constBegin(); constIterator != ifileInfoList.constEnd();++constIterator)
|
| 1544 |
|
|
{
|
| 1545 |
|
|
QString ifileName = (*constIterator) ;
|
| 1546 |
|
|
|
| 1547 |
|
|
if(ifileName.endsWith(".vhd", Qt::CaseSensitive))
|
| 1548 |
|
|
{
|
| 1549 |
|
|
qDebug() << const_cast<QString&>(*constIterator);
|
| 1550 |
|
|
if(!(ifileName.endsWith("_EziDebug_ScanChainReg.vhd")||ifileName.endsWith("_EziDebug_TOUT_m.vhd")))
|
| 1551 |
|
|
{
|
| 1552 |
|
|
filelist.append(ifileName);
|
| 1553 |
|
|
}
|
| 1554 |
|
|
// vhdlfilemap.insert((*constIterator),pvhdlFileObj);
|
| 1555 |
|
|
}
|
| 1556 |
|
|
else if(ifileName.endsWith(".v", Qt::CaseSensitive))
|
| 1557 |
|
|
{
|
| 1558 |
|
|
qDebug() << const_cast<QString&>(*constIterator);
|
| 1559 |
|
|
if(!(ifileName.endsWith("_EziDebug_ScanChainReg.v")||ifileName.endsWith("_EziDebug_TOUT_m.v")))
|
| 1560 |
|
|
{
|
| 1561 |
|
|
filelist.append(ifileName);
|
| 1562 |
|
|
}
|
| 1563 |
|
|
// vlgfilemap.insert((*constIterator),pvlgFileObj);
|
| 1564 |
|
|
}
|
| 1565 |
|
|
else if(ifileName.endsWith(".xco",Qt::CaseSensitive))
|
| 1566 |
|
|
{
|
| 1567 |
|
|
if(iPreferLang == "Verilog")
|
| 1568 |
|
|
{
|
| 1569 |
|
|
ifileName.replace(".xco",".v");
|
| 1570 |
|
|
filelist.append(ifileName);
|
| 1571 |
|
|
}
|
| 1572 |
|
|
else
|
| 1573 |
|
|
{
|
| 1574 |
|
|
ifileName.replace(".xco",".vhd");
|
| 1575 |
|
|
filelist.append(ifileName);
|
| 1576 |
|
|
}
|
| 1577 |
|
|
}
|
| 1578 |
|
|
}
|
| 1579 |
|
|
}
|
| 1580 |
|
|
else
|
| 1581 |
|
|
{
|
| 1582 |
|
|
qDebug() << "the setting file has some problem!" ;
|
| 1583 |
|
|
iprjFile.close();
|
| 1584 |
|
|
return 1 ;
|
| 1585 |
|
|
}
|
| 1586 |
|
|
}
|
| 1587 |
|
|
else
|
| 1588 |
|
|
{
|
| 1589 |
|
|
qDebug() << "There is leftbracket after \"set user_files\" !";
|
| 1590 |
|
|
iprjFile.close();
|
| 1591 |
|
|
return 1 ;
|
| 1592 |
|
|
}
|
| 1593 |
|
|
}
|
| 1594 |
|
|
else
|
| 1595 |
|
|
{
|
| 1596 |
|
|
iprjFile.close();
|
| 1597 |
|
|
return 1 ;
|
| 1598 |
|
|
}
|
| 1599 |
|
|
}
|
| 1600 |
|
|
else if(m_itoolSoftwareVersion == "14.x")
|
| 1601 |
|
|
{
|
| 1602 |
|
|
QDomDocument idomDocument ;
|
| 1603 |
|
|
QString iErrorStr ;
|
| 1604 |
|
|
int nErrorLine ;
|
| 1605 |
|
|
int nErrorColumn = 0 ;
|
| 1606 |
|
|
if (!idomDocument.setContent(&iprjFile, true, &iErrorStr, &nErrorLine, &nErrorColumn))
|
| 1607 |
|
|
{
|
| 1608 |
|
|
qDebug() << tr("Parse error at line %1, column %2:\n%3").arg(nErrorLine)\
|
| 1609 |
|
|
.arg(nErrorColumn).arg(iErrorStr) ;
|
| 1610 |
|
|
return 1 ;
|
| 1611 |
|
|
}
|
| 1612 |
|
|
|
| 1613 |
|
|
QDomElement root = idomDocument.documentElement();
|
| 1614 |
|
|
if(root.tagName() == "project")
|
| 1615 |
|
|
{
|
| 1616 |
|
|
QDomElement ifilesChild = root.firstChildElement("files");
|
| 1617 |
|
|
if(!ifilesChild.isNull())
|
| 1618 |
|
|
{
|
| 1619 |
|
|
QDomElement ifileChild = ifilesChild.firstChildElement("file");
|
| 1620 |
|
|
|
| 1621 |
|
|
while(!ifileChild.isNull())
|
| 1622 |
|
|
{
|
| 1623 |
|
|
// 相对路径
|
| 1624 |
|
|
QString ifileName = ifileChild.attribute("xil_pn:name") ;
|
| 1625 |
|
|
if(ifileName.endsWith(".v"))
|
| 1626 |
|
|
{
|
| 1627 |
|
|
if(!(ifileName.endsWith("_EziDebug_ScanChainReg.v")||ifileName.endsWith("_EziDebug_TOUT_m.v")))
|
| 1628 |
|
|
{
|
| 1629 |
|
|
filelist.append(ifileName);
|
| 1630 |
|
|
}
|
| 1631 |
|
|
}
|
| 1632 |
|
|
else if(ifileName.endsWith(".vhd"))
|
| 1633 |
|
|
{
|
| 1634 |
|
|
if(!(ifileName.endsWith("_EziDebug_ScanChainReg.vhd")||ifileName.endsWith("_EziDebug_TOUT_m.vhd")))
|
| 1635 |
|
|
{
|
| 1636 |
|
|
filelist.append(ifileName);
|
| 1637 |
|
|
}
|
| 1638 |
|
|
}
|
| 1639 |
|
|
else if(ifileName.endsWith(".xco"))
|
| 1640 |
|
|
{
|
| 1641 |
|
|
if(m_icoreLangType == "Verilog")
|
| 1642 |
|
|
{
|
| 1643 |
|
|
ifileName.replace(".xco",".v") ;
|
| 1644 |
|
|
filelist.append(ifileName);
|
| 1645 |
|
|
}
|
| 1646 |
|
|
else
|
| 1647 |
|
|
{
|
| 1648 |
|
|
ifileName.replace(".xco",".vhd") ;
|
| 1649 |
|
|
filelist.append(ifileName);
|
| 1650 |
|
|
}
|
| 1651 |
|
|
}
|
| 1652 |
|
|
ifileChild = ifilesChild.nextSiblingElement("file");
|
| 1653 |
|
|
}
|
| 1654 |
|
|
}
|
| 1655 |
|
|
else
|
| 1656 |
|
|
{
|
| 1657 |
|
|
qDebug() << "The project file parse failed: NO root element!";
|
| 1658 |
|
|
iprjFile.close();
|
| 1659 |
|
|
return 1 ;
|
| 1660 |
|
|
}
|
| 1661 |
|
|
}
|
| 1662 |
|
|
}
|
| 1663 |
|
|
|
| 1664 |
|
|
iprjFile.close();
|
| 1665 |
|
|
return 0 ;
|
| 1666 |
|
|
}
|
| 1667 |
|
|
|
| 1668 |
|
|
void EziDebugPrj::deleteAllEziDebugCode(const QMap<QString,EziDebugVlgFile*> &vlgFileMap ,const QMap<QString,EziDebugVhdlFile*> &vhdlFileMap)
|
| 1669 |
|
|
{
|
| 1670 |
|
|
QMap<QString,EziDebugVlgFile*>::const_iterator i = vlgFileMap.constBegin() ;
|
| 1671 |
|
|
while(i != vlgFileMap.constEnd())
|
| 1672 |
|
|
{
|
| 1673 |
|
|
EziDebugVlgFile* pfile = i.value();
|
| 1674 |
|
|
pfile->deleteEziDebugCode();
|
| 1675 |
|
|
++i;
|
| 1676 |
|
|
}
|
| 1677 |
|
|
|
| 1678 |
|
|
QMap<QString,EziDebugVhdlFile*>::const_iterator j = vhdlFileMap.constBegin() ;
|
| 1679 |
|
|
while(j != vhdlFileMap.constEnd())
|
| 1680 |
|
|
{
|
| 1681 |
|
|
EziDebugVhdlFile* pfile = j.value();
|
| 1682 |
|
|
pfile->deleteEziDebugCode();
|
| 1683 |
|
|
++j;
|
| 1684 |
|
|
}
|
| 1685 |
|
|
}
|
| 1686 |
|
|
|
| 1687 |
|
|
|
| 1688 |
|
|
int EziDebugPrj::domParseFileInfoElement(const QDomElement &element, char readflag)
|
| 1689 |
|
|
{
|
| 1690 |
|
|
/*子节点数目是否为零*/
|
| 1691 |
|
|
if(!(element.childNodes().count()))
|
| 1692 |
|
|
{
|
| 1693 |
|
|
qDebug() << "domParseFileInfoElement Error:There is no fileinfo!";
|
| 1694 |
|
|
return 0 ;
|
| 1695 |
|
|
}
|
| 1696 |
|
|
|
| 1697 |
|
|
QDomNode ichild = element.firstChild();
|
| 1698 |
|
|
/*扫描子节点 ,是否存在下一个子节点*/
|
| 1699 |
|
|
while (!ichild.isNull())
|
| 1700 |
|
|
{
|
| 1701 |
|
|
if (ichild.toElement().tagName() == "file")
|
| 1702 |
|
|
{
|
| 1703 |
|
|
if(domParseFileStructure(ichild.toElement(),readflag))
|
| 1704 |
|
|
{
|
| 1705 |
|
|
qDebug() << "domParseFileInfoElement Error :fileinfo format is not right!";
|
| 1706 |
|
|
return 1 ;
|
| 1707 |
|
|
}
|
| 1708 |
|
|
}
|
| 1709 |
|
|
else
|
| 1710 |
|
|
{
|
| 1711 |
|
|
qDebug() << "Info:There is no file element in the log file!";
|
| 1712 |
|
|
return 0 ;
|
| 1713 |
|
|
}
|
| 1714 |
|
|
ichild = ichild.nextSibling();
|
| 1715 |
|
|
}
|
| 1716 |
|
|
return 0 ;
|
| 1717 |
|
|
}
|
| 1718 |
|
|
|
| 1719 |
|
|
int EziDebugPrj::domParseFileStructure(const QDomElement &element, char readflag)
|
| 1720 |
|
|
{
|
| 1721 |
|
|
QString ifileName ;
|
| 1722 |
|
|
QDateTime idateTime ;
|
| 1723 |
|
|
QDate idate ;
|
| 1724 |
|
|
QTime itime ;
|
| 1725 |
|
|
QStringList imoduleList ;
|
| 1726 |
|
|
|
| 1727 |
|
|
if(element.attribute("file_name").isEmpty())
|
| 1728 |
|
|
{
|
| 1729 |
|
|
return 1 ;
|
| 1730 |
|
|
}
|
| 1731 |
|
|
|
| 1732 |
|
|
if(element.attribute("modified_date").isEmpty())
|
| 1733 |
|
|
{
|
| 1734 |
|
|
return 1 ;
|
| 1735 |
|
|
}
|
| 1736 |
|
|
|
| 1737 |
|
|
if(element.attribute("modified_time").isEmpty())
|
| 1738 |
|
|
{
|
| 1739 |
|
|
return 1 ;
|
| 1740 |
|
|
}
|
| 1741 |
|
|
|
| 1742 |
|
|
// if(element.attribute("module_array").isEmpty())
|
| 1743 |
|
|
// {
|
| 1744 |
|
|
// return 1 ;
|
| 1745 |
|
|
// }
|
| 1746 |
|
|
|
| 1747 |
|
|
if(element.attribute("macro").isEmpty())
|
| 1748 |
|
|
{
|
| 1749 |
|
|
return 1 ;
|
| 1750 |
|
|
}
|
| 1751 |
|
|
|
| 1752 |
|
|
if(element.attribute("defparameter").isEmpty())
|
| 1753 |
|
|
{
|
| 1754 |
|
|
return 1 ;
|
| 1755 |
|
|
}
|
| 1756 |
|
|
|
| 1757 |
|
|
ifileName = element.attribute("file_name");
|
| 1758 |
|
|
imoduleList = element.attribute("module_array").split(QRegExp("\\s+"));
|
| 1759 |
|
|
QStringList idateList = element.attribute("modified_date").split("/") ;
|
| 1760 |
|
|
QStringList itimeList = element.attribute("modified_time").split(":") ;
|
| 1761 |
|
|
|
| 1762 |
|
|
idate = QDate(idateList.at(2).toInt(),idateList.at(0).toInt(),idateList.at(1).toInt()) ;
|
| 1763 |
|
|
itime = QTime(itimeList.at(0).toInt(),itimeList.at(1).toInt(),itimeList.at(2).toInt()) ;
|
| 1764 |
|
|
|
| 1765 |
|
|
idateTime = QDateTime(idate,itime) ;
|
| 1766 |
|
|
|
| 1767 |
|
|
if((ifileName.endsWith(".v",Qt::CaseSensitive)))
|
| 1768 |
|
|
{
|
| 1769 |
|
|
if(readflag&READ_FILE_INFO)
|
| 1770 |
|
|
{
|
| 1771 |
|
|
/*创建文件对象指针 并加入工程对象的文件map中*/
|
| 1772 |
|
|
QFileInfo ifileinfo(m_iprjPath,ifileName);
|
| 1773 |
|
|
QString ifileFullName = ifileinfo.absoluteDir().absolutePath()+ QObject::tr("/") + ifileinfo.fileName() ;
|
| 1774 |
|
|
EziDebugVlgFile * pvlgFileObj = new EziDebugVlgFile(ifileFullName,idateTime,imoduleList);
|
| 1775 |
|
|
|
| 1776 |
|
|
if(element.attribute("macro").compare("No Macro"))
|
| 1777 |
|
|
{
|
| 1778 |
|
|
QStringList imacroList = element.attribute("macro").split("$$") ;
|
| 1779 |
|
|
int nmacroCount = 0 ;
|
| 1780 |
|
|
for(;nmacroCount < imacroList.count();nmacroCount++)
|
| 1781 |
|
|
{
|
| 1782 |
|
|
QString imacroStr = imacroList.at(nmacroCount).split("::").at(0) ;
|
| 1783 |
|
|
QString imacroVal = imacroList.at(nmacroCount).split("::").at(1) ;
|
| 1784 |
|
|
pvlgFileObj->addToMacroMap(imacroStr , imacroVal);
|
| 1785 |
|
|
}
|
| 1786 |
|
|
|
| 1787 |
|
|
}
|
| 1788 |
|
|
|
| 1789 |
|
|
if(element.attribute("defparameter").compare("No Defparam"))
|
| 1790 |
|
|
{
|
| 1791 |
|
|
QStringList idefParmeterList = element.attribute("defparameter").split("$$") ;
|
| 1792 |
|
|
int ndefparameterCount = 0 ;
|
| 1793 |
|
|
for(;ndefparameterCount < idefParmeterList.count();ndefparameterCount++)
|
| 1794 |
|
|
{
|
| 1795 |
|
|
QString icomDefParaStr = idefParmeterList.at(ndefparameterCount).split("::").at(0) ;
|
| 1796 |
|
|
QString idefParaVal = idefParmeterList.at(ndefparameterCount).split("::").at(1) ;
|
| 1797 |
|
|
QString iinstanceName = icomDefParaStr.split(".").at(0) ;
|
| 1798 |
|
|
QString idefParaStr = icomDefParaStr.split(".").at(1) ;
|
| 1799 |
|
|
pvlgFileObj->addToDefParameterMap(iinstanceName ,idefParaStr ,idefParaVal);
|
| 1800 |
|
|
}
|
| 1801 |
|
|
}
|
| 1802 |
|
|
|
| 1803 |
|
|
m_ivlgFileMap.insert(ifileName,pvlgFileObj);
|
| 1804 |
|
|
m_iCodefileNameList << ifileName ;
|
| 1805 |
|
|
}
|
| 1806 |
|
|
}
|
| 1807 |
|
|
else if((ifileName.endsWith(".vhd",Qt::CaseSensitive)))
|
| 1808 |
|
|
{
|
| 1809 |
|
|
/*创建文件对象指针 并加入工程对象的文件map中*/
|
| 1810 |
|
|
if(readflag&READ_FILE_INFO)
|
| 1811 |
|
|
{
|
| 1812 |
|
|
QFileInfo ifileinfo(m_iprjPath,ifileName);
|
| 1813 |
|
|
QString ifileFullName = ifileinfo.absoluteDir().absolutePath()+ QObject::tr("/") + ifileinfo.fileName() ;
|
| 1814 |
|
|
EziDebugVhdlFile * pvlgFileObj = new EziDebugVhdlFile(ifileFullName,idateTime,imoduleList);
|
| 1815 |
|
|
m_ivhdlFileMap.insert(ifileName,pvlgFileObj);
|
| 1816 |
|
|
m_iCodefileNameList << ifileName ;
|
| 1817 |
|
|
}
|
| 1818 |
|
|
}
|
| 1819 |
|
|
else
|
| 1820 |
|
|
{
|
| 1821 |
|
|
qDebug() << "domParseFileStructure Error:The log file format is not right(the source code file type is not right)!";
|
| 1822 |
|
|
return 1 ;
|
| 1823 |
|
|
}
|
| 1824 |
|
|
return 0 ;
|
| 1825 |
|
|
}
|
| 1826 |
|
|
|
| 1827 |
|
|
int EziDebugPrj::domParseModuleInfoElement(const QDomElement &element, char readflag)
|
| 1828 |
|
|
{
|
| 1829 |
|
|
QString imoduleName ;
|
| 1830 |
|
|
EziDebugModule *pmoduleObj = NULL ;
|
| 1831 |
|
|
/*子节点数目是否为零*/
|
| 1832 |
|
|
if(!(element.childNodes().count()))
|
| 1833 |
|
|
{
|
| 1834 |
|
|
qDebug() << "Info:There is no module info in the log file!";
|
| 1835 |
|
|
return 0 ;
|
| 1836 |
|
|
}
|
| 1837 |
|
|
|
| 1838 |
|
|
// 存在 module 则检查 topmodule
|
| 1839 |
|
|
if(element.attribute("topmodule").isEmpty())
|
| 1840 |
|
|
{
|
| 1841 |
|
|
qDebug() << "domParseEziDebugElement Error:There is no topmodule!" ;
|
| 1842 |
|
|
return 1 ;
|
| 1843 |
|
|
}
|
| 1844 |
|
|
else
|
| 1845 |
|
|
{
|
| 1846 |
|
|
if(element.attribute("topmodule").toLower() != "no module")
|
| 1847 |
|
|
{
|
| 1848 |
|
|
m_itopModule = element.attribute("topmodule") ;
|
| 1849 |
|
|
}
|
| 1850 |
|
|
}
|
| 1851 |
|
|
|
| 1852 |
|
|
QDomNode ichild = element.firstChild();
|
| 1853 |
|
|
/*扫描子节点 ,是否存在下一个子节点*/
|
| 1854 |
|
|
while (!ichild.isNull())
|
| 1855 |
|
|
{
|
| 1856 |
|
|
if (ichild.toElement().tagName() == "module")
|
| 1857 |
|
|
{
|
| 1858 |
|
|
if(ichild.toElement().attribute("module_name").isEmpty())
|
| 1859 |
|
|
{
|
| 1860 |
|
|
return 1 ;
|
| 1861 |
|
|
}
|
| 1862 |
|
|
|
| 1863 |
|
|
// if(ichild.toElement().attribute("appearance_count").isEmpty())
|
| 1864 |
|
|
// {
|
| 1865 |
|
|
// return 1 ;
|
| 1866 |
|
|
// }
|
| 1867 |
|
|
|
| 1868 |
|
|
// if(QRegExp("^\\d+$").exactMatch(ichild.toElement().attribute("appearance_count")))
|
| 1869 |
|
|
// {
|
| 1870 |
|
|
// return 1 ;
|
| 1871 |
|
|
// }
|
| 1872 |
|
|
|
| 1873 |
|
|
if(ichild.toElement().attribute("lib_core").isEmpty())
|
| 1874 |
|
|
{
|
| 1875 |
|
|
return 1 ;
|
| 1876 |
|
|
}
|
| 1877 |
|
|
|
| 1878 |
|
|
if(!QRegExp("^\\d+$").exactMatch(ichild.toElement().attribute("lib_core")))
|
| 1879 |
|
|
{
|
| 1880 |
|
|
return 1 ;
|
| 1881 |
|
|
}
|
| 1882 |
|
|
|
| 1883 |
|
|
if(ichild.toElement().attribute("file_name").isEmpty())
|
| 1884 |
|
|
{
|
| 1885 |
|
|
return 1 ;
|
| 1886 |
|
|
}
|
| 1887 |
|
|
|
| 1888 |
|
|
if(ichild.toElement().attribute("instance_array").isEmpty())
|
| 1889 |
|
|
{
|
| 1890 |
|
|
return 1 ;
|
| 1891 |
|
|
}
|
| 1892 |
|
|
|
| 1893 |
|
|
if(ichild.toElement().attribute("reset_signal").isEmpty())
|
| 1894 |
|
|
{
|
| 1895 |
|
|
return 1 ;
|
| 1896 |
|
|
}
|
| 1897 |
|
|
|
| 1898 |
|
|
if(ichild.toElement().attribute("parameter").isEmpty())
|
| 1899 |
|
|
{
|
| 1900 |
|
|
return 1 ;
|
| 1901 |
|
|
}
|
| 1902 |
|
|
|
| 1903 |
|
|
if(readflag&READ_MODULE_INFO)
|
| 1904 |
|
|
{
|
| 1905 |
|
|
imoduleName = ichild.toElement().attribute("module_name") ;
|
| 1906 |
|
|
qDebug() << "Test module" <<imoduleName ;
|
| 1907 |
|
|
pmoduleObj = new EziDebugModule(imoduleName) ;
|
| 1908 |
|
|
if(!pmoduleObj)
|
| 1909 |
|
|
{
|
| 1910 |
|
|
qDebug() << "Error: domParseModuleInfoElement :There is no memory left !" ;
|
| 1911 |
|
|
return 1 ;
|
| 1912 |
|
|
}
|
| 1913 |
|
|
|
| 1914 |
|
|
pmoduleObj->m_isLibaryCore = ichild.toElement().attribute("lib_core").toInt() ;
|
| 1915 |
|
|
//pmoduleObj->m_ninstanceTimes = ichild.toElement().attribute("appearance_count").toInt();
|
| 1916 |
|
|
pmoduleObj->m_ilocatedFile = ichild.toElement().attribute("file_name") ;
|
| 1917 |
|
|
|
| 1918 |
|
|
if(!(ichild.toElement().attribute("instance_array").toLower() == "no instance"))
|
| 1919 |
|
|
{
|
| 1920 |
|
|
pmoduleObj->m_iinstanceNameList = ichild.toElement().attribute("instance_array").split("|") ;
|
| 1921 |
|
|
}
|
| 1922 |
|
|
|
| 1923 |
|
|
if(ichild.toElement().attribute("reset_signal").compare("No Reset Signal"))
|
| 1924 |
|
|
{
|
| 1925 |
|
|
|
| 1926 |
|
|
pmoduleObj->m_iresetMap.insert(ichild.toElement().attribute("reset_signal").split(":").at(0),\
|
| 1927 |
|
|
ichild.toElement().attribute("reset_signal").split(":").at(1));
|
| 1928 |
|
|
}
|
| 1929 |
|
|
|
| 1930 |
|
|
if(ichild.toElement().attribute("parameter").compare("No Parameter"))
|
| 1931 |
|
|
{
|
| 1932 |
|
|
QStringList iparameterList = ichild.toElement().attribute("parameter").split("$$") ;
|
| 1933 |
|
|
int nparameterCount = 0 ;
|
| 1934 |
|
|
for( ; nparameterCount < iparameterList.count() ;nparameterCount++)
|
| 1935 |
|
|
{
|
| 1936 |
|
|
QString iparameterStr = iparameterList.at(nparameterCount).split("::").at(0) ;
|
| 1937 |
|
|
QString iparameterVal = iparameterList.at(nparameterCount).split("::").at(1) ;
|
| 1938 |
|
|
pmoduleObj->m_iparameter.insert(iparameterStr,iparameterVal) ;
|
| 1939 |
|
|
}
|
| 1940 |
|
|
}
|
| 1941 |
|
|
}
|
| 1942 |
|
|
|
| 1943 |
|
|
|
| 1944 |
|
|
|
| 1945 |
|
|
/*解析module 结构*/
|
| 1946 |
|
|
if(domParseModuleStructure(ichild.toElement() , readflag , pmoduleObj))
|
| 1947 |
|
|
{
|
| 1948 |
|
|
qDebug() << "domParseFileInfoElement Error :moduleinfo format is not right!";
|
| 1949 |
|
|
return 1 ;
|
| 1950 |
|
|
}
|
| 1951 |
|
|
|
| 1952 |
|
|
if(pmoduleObj)
|
| 1953 |
|
|
{
|
| 1954 |
|
|
m_imoduleMap.insert(pmoduleObj->getModuleName(),pmoduleObj);
|
| 1955 |
|
|
}
|
| 1956 |
|
|
|
| 1957 |
|
|
}
|
| 1958 |
|
|
else
|
| 1959 |
|
|
{
|
| 1960 |
|
|
qDebug() << "domParseFileInfoElement Error : There is strange element in the file!";
|
| 1961 |
|
|
return 1 ;
|
| 1962 |
|
|
}
|
| 1963 |
|
|
ichild = ichild.nextSibling();
|
| 1964 |
|
|
}
|
| 1965 |
|
|
return 0 ;
|
| 1966 |
|
|
}
|
| 1967 |
|
|
|
| 1968 |
|
|
int EziDebugPrj::domParseModuleStructure(const QDomElement &element,char readflag,EziDebugModule* module)
|
| 1969 |
|
|
{
|
| 1970 |
|
|
/*子节点数目是否为零*/
|
| 1971 |
|
|
int emoduleStructureExistFlag = 0 ;
|
| 1972 |
|
|
if(element.childNodes().count() != 4)
|
| 1973 |
|
|
{
|
| 1974 |
|
|
qDebug() << "domParseFileInfoElement Error:module format is not right!";
|
| 1975 |
|
|
return 1 ;
|
| 1976 |
|
|
}
|
| 1977 |
|
|
QDomNode ichild = element.firstChild();
|
| 1978 |
|
|
/*扫描子节点 ,是否存在下一个子节点*/
|
| 1979 |
|
|
while (!ichild.isNull())
|
| 1980 |
|
|
{
|
| 1981 |
|
|
if (ichild.toElement().tagName() == "clock_description")
|
| 1982 |
|
|
{
|
| 1983 |
|
|
emoduleStructureExistFlag |= MODULE_STRUCTURE_CLOCK_DESCRIPTION ;
|
| 1984 |
|
|
if(domParseClockDescriptionElement(ichild.toElement() , readflag , module))
|
| 1985 |
|
|
{
|
| 1986 |
|
|
qDebug() << "domParseModuleStructure Error :moduleinfo format is not right!";
|
| 1987 |
|
|
return 1 ;
|
| 1988 |
|
|
}
|
| 1989 |
|
|
}
|
| 1990 |
|
|
else if(ichild.toElement().tagName() == "reg_description")
|
| 1991 |
|
|
{
|
| 1992 |
|
|
emoduleStructureExistFlag |= MODULE_STRUCTURE_REG_DESCRIPTION ;
|
| 1993 |
|
|
if(domParseRegDescriptionElement(ichild.toElement() , readflag , module))
|
| 1994 |
|
|
{
|
| 1995 |
|
|
qDebug() << "domParseModuleStructure Error :reginfo format is not right!";
|
| 1996 |
|
|
return 1 ;
|
| 1997 |
|
|
}
|
| 1998 |
|
|
}
|
| 1999 |
|
|
else if(ichild.toElement().tagName() == "port_description")
|
| 2000 |
|
|
{
|
| 2001 |
|
|
emoduleStructureExistFlag |= MODULE_STRUCTURE_PORT_DESCRIPTION ;
|
| 2002 |
|
|
if(domParsePortDescriptionElement(ichild.toElement() , readflag ,module))
|
| 2003 |
|
|
{
|
| 2004 |
|
|
qDebug() << "domParseModuleStructure Error :portinfo format is not right!";
|
| 2005 |
|
|
return 1 ;
|
| 2006 |
|
|
}
|
| 2007 |
|
|
}
|
| 2008 |
|
|
else if(ichild.toElement().tagName() == "instance_port_map_description")
|
| 2009 |
|
|
{
|
| 2010 |
|
|
emoduleStructureExistFlag |= MODULE_STRUCTURE_INSTANCE_PORT_MAP_DESCRIPTION ;
|
| 2011 |
|
|
if(domParseInstancePortMapDescriptionElement(ichild.toElement() , readflag ,module))
|
| 2012 |
|
|
{
|
| 2013 |
|
|
qDebug() << "domParseModuleStructure Error :portmap format is not right!";
|
| 2014 |
|
|
return 1 ;
|
| 2015 |
|
|
}
|
| 2016 |
|
|
}
|
| 2017 |
|
|
else
|
| 2018 |
|
|
{
|
| 2019 |
|
|
qDebug() << "domParseModuleStructure Error : There is strange element in the file!";
|
| 2020 |
|
|
return 1 ;
|
| 2021 |
|
|
}
|
| 2022 |
|
|
ichild = ichild.nextSibling();
|
| 2023 |
|
|
}
|
| 2024 |
|
|
|
| 2025 |
|
|
if((emoduleStructureExistFlag&MODULE_STRUCTURE_ALL_DESCRIPTION) == MODULE_STRUCTURE_ALL_DESCRIPTION )
|
| 2026 |
|
|
{
|
| 2027 |
|
|
return 0 ;
|
| 2028 |
|
|
}
|
| 2029 |
|
|
else
|
| 2030 |
|
|
{
|
| 2031 |
|
|
return 1 ;
|
| 2032 |
|
|
}
|
| 2033 |
|
|
|
| 2034 |
|
|
}
|
| 2035 |
|
|
|
| 2036 |
|
|
|
| 2037 |
|
|
int EziDebugPrj::domParseClockDescriptionElement(const QDomElement &element, char readflag, EziDebugModule* module)
|
| 2038 |
|
|
{
|
| 2039 |
|
|
/*子节点数目是否为零*/
|
| 2040 |
|
|
if(!(element.childNodes().count()))
|
| 2041 |
|
|
{
|
| 2042 |
|
|
qDebug() << "EziDebug Info: There is no clockinfo " << (module? (QObject::tr("in module:%1").arg(module->getModuleName())):"");
|
| 2043 |
|
|
return 0 ;
|
| 2044 |
|
|
}
|
| 2045 |
|
|
QDomNode ichild = element.firstChild();
|
| 2046 |
|
|
/*扫描子节点 ,是否存在下一个子节点*/
|
| 2047 |
|
|
while (!ichild.isNull())
|
| 2048 |
|
|
{
|
| 2049 |
|
|
if (ichild.toElement().tagName() == "clock")
|
| 2050 |
|
|
{
|
| 2051 |
|
|
|
| 2052 |
|
|
if(ichild.toElement().attribute("clock_name").isEmpty())
|
| 2053 |
|
|
{
|
| 2054 |
|
|
return 1 ;
|
| 2055 |
|
|
}
|
| 2056 |
|
|
|
| 2057 |
|
|
if(ichild.toElement().attribute("polarity").isEmpty())
|
| 2058 |
|
|
{
|
| 2059 |
|
|
return 1 ;
|
| 2060 |
|
|
}
|
| 2061 |
|
|
|
| 2062 |
|
|
if(!((ichild.toElement().attribute("polarity").toLower() == "posedge") \
|
| 2063 |
|
|
|| (ichild.toElement().attribute("polarity").toLower() == "negedge")))
|
| 2064 |
|
|
{
|
| 2065 |
|
|
return 1 ;
|
| 2066 |
|
|
}
|
| 2067 |
|
|
|
| 2068 |
|
|
if(readflag & READ_MODULE_INFO)
|
| 2069 |
|
|
{
|
| 2070 |
|
|
if(module)
|
| 2071 |
|
|
{
|
| 2072 |
|
|
QString iclockName = ichild.toElement().attribute("clock_name");
|
| 2073 |
|
|
module->m_iclockMap.insert(iclockName,ichild.toElement().attribute("polarity"));
|
| 2074 |
|
|
}
|
| 2075 |
|
|
else
|
| 2076 |
|
|
{
|
| 2077 |
|
|
qDebug() << "domParseClockDescriptionElement: NULL Pointer!";
|
| 2078 |
|
|
return 1 ;
|
| 2079 |
|
|
}
|
| 2080 |
|
|
}
|
| 2081 |
|
|
|
| 2082 |
|
|
}
|
| 2083 |
|
|
else
|
| 2084 |
|
|
{
|
| 2085 |
|
|
qDebug() << "domParseFileInfoElement Error : There is strange element in the file!";
|
| 2086 |
|
|
return 1 ;
|
| 2087 |
|
|
}
|
| 2088 |
|
|
ichild = ichild.nextSibling();
|
| 2089 |
|
|
}
|
| 2090 |
|
|
return 0 ;
|
| 2091 |
|
|
}
|
| 2092 |
|
|
|
| 2093 |
|
|
int EziDebugPrj::domParseClockStructure(const QDomElement &element, char readflag , EziDebugModule* module)
|
| 2094 |
|
|
{
|
| 2095 |
|
|
return 0 ;
|
| 2096 |
|
|
}
|
| 2097 |
|
|
|
| 2098 |
|
|
|
| 2099 |
|
|
int EziDebugPrj::domParseRegDescriptionElement(const QDomElement &element ,char readflag, EziDebugModule* module)
|
| 2100 |
|
|
{
|
| 2101 |
|
|
/*子节点数目是否为零*/
|
| 2102 |
|
|
if(!(element.childNodes().count()))
|
| 2103 |
|
|
{
|
| 2104 |
|
|
qDebug() << "EziDebug Info:There is no reginfo in the module " << (module ? module->getModuleName() : "") << "!";
|
| 2105 |
|
|
return 0 ;
|
| 2106 |
|
|
}
|
| 2107 |
|
|
QDomNode ichild = element.firstChild();
|
| 2108 |
|
|
/*扫描子节点 ,是否存在下一个子节点*/
|
| 2109 |
|
|
while (!ichild.isNull())
|
| 2110 |
|
|
{
|
| 2111 |
|
|
if (ichild.toElement().tagName() == "reg")
|
| 2112 |
|
|
{
|
| 2113 |
|
|
if(ichild.toElement().attribute("module_name").isEmpty())
|
| 2114 |
|
|
{
|
| 2115 |
|
|
return 1 ;
|
| 2116 |
|
|
}
|
| 2117 |
|
|
|
| 2118 |
|
|
if(ichild.toElement().attribute("locate_clock").isEmpty())
|
| 2119 |
|
|
{
|
| 2120 |
|
|
return 1 ;
|
| 2121 |
|
|
}
|
| 2122 |
|
|
|
| 2123 |
|
|
if(ichild.toElement().attribute("reg_name").isEmpty())
|
| 2124 |
|
|
{
|
| 2125 |
|
|
return 1 ;
|
| 2126 |
|
|
}
|
| 2127 |
|
|
|
| 2128 |
|
|
if(ichild.toElement().attribute("bitwidth").isEmpty())
|
| 2129 |
|
|
{
|
| 2130 |
|
|
return 1 ;
|
| 2131 |
|
|
}
|
| 2132 |
|
|
|
| 2133 |
|
|
if(ichild.toElement().attribute("regnum").isEmpty())
|
| 2134 |
|
|
{
|
| 2135 |
|
|
return 1 ;
|
| 2136 |
|
|
}
|
| 2137 |
|
|
#if 0
|
| 2138 |
|
|
if(ichild.toElement().attribute("endian").isEmpty())
|
| 2139 |
|
|
{
|
| 2140 |
|
|
return 1 ;
|
| 2141 |
|
|
}
|
| 2142 |
|
|
#endif
|
| 2143 |
|
|
|
| 2144 |
|
|
if(ichild.toElement().attribute("polarity").isEmpty())
|
| 2145 |
|
|
{
|
| 2146 |
|
|
return 1 ;
|
| 2147 |
|
|
}
|
| 2148 |
|
|
|
| 2149 |
|
|
if(!((ichild.toElement().attribute("polarity").toLower() == "posedge") \
|
| 2150 |
|
|
|| (ichild.toElement().attribute("polarity").toLower() == "negedge") \
|
| 2151 |
|
|
|| (ichild.toElement().attribute("polarity").toLower() == "low") \
|
| 2152 |
|
|
|| (ichild.toElement().attribute("polarity").toLower() == "high")))
|
| 2153 |
|
|
{
|
| 2154 |
|
|
return 1 ;
|
| 2155 |
|
|
}
|
| 2156 |
|
|
#if 0
|
| 2157 |
|
|
if(!((ichild.toElement().attribute("endian") == "0")\
|
| 2158 |
|
|
||(ichild.toElement().attribute("endian") == "1")))
|
| 2159 |
|
|
{
|
| 2160 |
|
|
return 1 ;
|
| 2161 |
|
|
}
|
| 2162 |
|
|
#endif
|
| 2163 |
|
|
|
| 2164 |
|
|
if(readflag & READ_MODULE_INFO)
|
| 2165 |
|
|
{
|
| 2166 |
|
|
if(module)
|
| 2167 |
|
|
{
|
| 2168 |
|
|
EziDebugModule::RegStructure * preg= new EziDebugModule::RegStructure ;
|
| 2169 |
|
|
// preg->m_isEndian = ichild.toElement().attribute("endian").toInt();
|
| 2170 |
|
|
|
| 2171 |
|
|
// preg->m_pMouduleName = (char*)malloc(ichild.toElement().attribute("module_name").size()+1);
|
| 2172 |
|
|
memcpy(preg->m_pMouduleName,ichild.toElement().attribute("module_name").toAscii().data(),ichild.toElement().attribute("module_name").size()+1);
|
| 2173 |
|
|
|
| 2174 |
|
|
// preg->m_pRegName = (char*)malloc(ichild.toElement().attribute("reg_name").size()+1);
|
| 2175 |
|
|
memcpy(preg->m_pRegName,ichild.toElement().attribute("reg_name").toAscii().data(),ichild.toElement().attribute("reg_name").size()+1);
|
| 2176 |
|
|
|
| 2177 |
|
|
memset(preg->m_pExpString,0,64) ;
|
| 2178 |
|
|
if(ichild.toElement().attribute("bitwidth").size() <= 63)
|
| 2179 |
|
|
{
|
| 2180 |
|
|
qstrcpy(preg->m_pExpString,ichild.toElement().attribute("bitwidth").toAscii().constData());
|
| 2181 |
|
|
}
|
| 2182 |
|
|
|
| 2183 |
|
|
memset(preg->m_pregNum,0,64) ;
|
| 2184 |
|
|
if(ichild.toElement().attribute("regnum").size() <= 63)
|
| 2185 |
|
|
{
|
| 2186 |
|
|
qstrcpy(preg->m_pregNum ,ichild.toElement().attribute("regnum").toAscii().constData()) ;
|
| 2187 |
|
|
}
|
| 2188 |
|
|
|
| 2189 |
|
|
|
| 2190 |
|
|
if(ichild.toElement().attribute("polarity").toLower() == "posedge")
|
| 2191 |
|
|
{
|
| 2192 |
|
|
preg->m_eedge = EziDebugModule::signalPosEdge ;
|
| 2193 |
|
|
}
|
| 2194 |
|
|
else if(ichild.toElement().attribute("polarity").toLower() == "negedge")
|
| 2195 |
|
|
{
|
| 2196 |
|
|
preg->m_eedge = EziDebugModule::signalNegEdge ;
|
| 2197 |
|
|
}
|
| 2198 |
|
|
else if(ichild.toElement().attribute("polarity").toLower() == "low")
|
| 2199 |
|
|
{
|
| 2200 |
|
|
preg->m_eedge = EziDebugModule::signalLow ;
|
| 2201 |
|
|
}
|
| 2202 |
|
|
else
|
| 2203 |
|
|
{
|
| 2204 |
|
|
preg->m_eedge = EziDebugModule::signalHigh ;
|
| 2205 |
|
|
}
|
| 2206 |
|
|
|
| 2207 |
|
|
QString iclockName = ichild.toElement().attribute("locate_clock");
|
| 2208 |
|
|
qstrcpy(preg->m_pclockName,iclockName.toAscii().data());
|
| 2209 |
|
|
QVector<EziDebugModule::RegStructure*> iregStructureVec = module->m_iregMap.value(iclockName) ;
|
| 2210 |
|
|
iregStructureVec.append(preg);
|
| 2211 |
|
|
module->m_iregMap.insert(iclockName,iregStructureVec);
|
| 2212 |
|
|
}
|
| 2213 |
|
|
else
|
| 2214 |
|
|
{
|
| 2215 |
|
|
qDebug() << "domParseRegDescriptionElement Error: NULL Pointer!";
|
| 2216 |
|
|
return 1 ;
|
| 2217 |
|
|
}
|
| 2218 |
|
|
}
|
| 2219 |
|
|
}
|
| 2220 |
|
|
else
|
| 2221 |
|
|
{
|
| 2222 |
|
|
qDebug() << "domParseRegDescriptionElement Error : There is strange element in the file!";
|
| 2223 |
|
|
return 1 ;
|
| 2224 |
|
|
}
|
| 2225 |
|
|
ichild = ichild.nextSibling();
|
| 2226 |
|
|
}
|
| 2227 |
|
|
return 0 ;
|
| 2228 |
|
|
}
|
| 2229 |
|
|
|
| 2230 |
|
|
int EziDebugPrj::domParseRegStructure(const QDomElement &element , char readflag , EziDebugModule* module)
|
| 2231 |
|
|
{
|
| 2232 |
|
|
return 0 ;
|
| 2233 |
|
|
}
|
| 2234 |
|
|
|
| 2235 |
|
|
int EziDebugPrj::domParsePortDescriptionElement(const QDomElement &element ,char readflag, EziDebugModule* module)
|
| 2236 |
|
|
{
|
| 2237 |
|
|
/*子节点数目是否为零*/
|
| 2238 |
|
|
if(!(element.childNodes().count()))
|
| 2239 |
|
|
{
|
| 2240 |
|
|
qDebug() << "domParsePortDescriptionElement Error:There is no port!";
|
| 2241 |
|
|
return 1 ;
|
| 2242 |
|
|
}
|
| 2243 |
|
|
QDomNode ichild = element.firstChild();
|
| 2244 |
|
|
/*扫描子节点 ,是否存在下一个子节点*/
|
| 2245 |
|
|
while (!ichild.isNull())
|
| 2246 |
|
|
{
|
| 2247 |
|
|
if (ichild.toElement().tagName() == "port")
|
| 2248 |
|
|
{
|
| 2249 |
|
|
if(ichild.toElement().attribute("port_name").isEmpty())
|
| 2250 |
|
|
{
|
| 2251 |
|
|
return 1 ;
|
| 2252 |
|
|
}
|
| 2253 |
|
|
|
| 2254 |
|
|
if(ichild.toElement().attribute("module_name").isEmpty())
|
| 2255 |
|
|
{
|
| 2256 |
|
|
return 1 ;
|
| 2257 |
|
|
}
|
| 2258 |
|
|
|
| 2259 |
|
|
if(ichild.toElement().attribute("direction_type").isEmpty())
|
| 2260 |
|
|
{
|
| 2261 |
|
|
return 1 ;
|
| 2262 |
|
|
}
|
| 2263 |
|
|
|
| 2264 |
|
|
if(ichild.toElement().attribute("bitwidth").isEmpty())
|
| 2265 |
|
|
{
|
| 2266 |
|
|
return 1 ;
|
| 2267 |
|
|
}
|
| 2268 |
|
|
|
| 2269 |
|
|
#if 0
|
| 2270 |
|
|
if(ichild.toElement().attribute("endian").isEmpty())
|
| 2271 |
|
|
{
|
| 2272 |
|
|
return 1 ;
|
| 2273 |
|
|
}
|
| 2274 |
|
|
|
| 2275 |
|
|
|
| 2276 |
|
|
if(!((ichild.toElement().attribute("endian").toLower() == "little")\
|
| 2277 |
|
|
||(ichild.toElement().attribute("endian").toLower()== "big")))
|
| 2278 |
|
|
{
|
| 2279 |
|
|
return 1 ;
|
| 2280 |
|
|
}
|
| 2281 |
|
|
#endif
|
| 2282 |
|
|
|
| 2283 |
|
|
if(!((ichild.toElement().attribute("direction_type").toLower() == "in")\
|
| 2284 |
|
|
||(ichild.toElement().attribute("direction_type").toLower() == "out")\
|
| 2285 |
|
|
||(ichild.toElement().attribute("direction_type").toLower() == "inout")))
|
| 2286 |
|
|
{
|
| 2287 |
|
|
return 1 ;
|
| 2288 |
|
|
}
|
| 2289 |
|
|
|
| 2290 |
|
|
if(readflag & READ_MODULE_INFO)
|
| 2291 |
|
|
{
|
| 2292 |
|
|
if(module)
|
| 2293 |
|
|
{
|
| 2294 |
|
|
EziDebugModule::PortStructure * pport= new EziDebugModule::PortStructure ;
|
| 2295 |
|
|
|
| 2296 |
|
|
// pport->m_isEndian = (ichild.toElement().attribute("endian").toLower() == "big");
|
| 2297 |
|
|
|
| 2298 |
|
|
//pport->m_pModuleName = (char*)malloc(ichild.toElement().attribute("module_name").size()+1);
|
| 2299 |
|
|
memcpy(pport->m_pModuleName,ichild.toElement().attribute("module_name").toAscii().data(),ichild.toElement().attribute("module_name").size()+1);
|
| 2300 |
|
|
|
| 2301 |
|
|
//pport->m_pPortName = (char*)malloc(ichild.toElement().attribute("port_name").size()+1);
|
| 2302 |
|
|
memcpy(pport->m_pPortName,ichild.toElement().attribute("port_name").toAscii().data(),ichild.toElement().attribute("port_name").size()+1);
|
| 2303 |
|
|
|
| 2304 |
|
|
if(ichild.toElement().attribute("direction_type").toLower() == "in")
|
| 2305 |
|
|
{
|
| 2306 |
|
|
pport->eDirectionType = EziDebugModule::directionTypeInput ;
|
| 2307 |
|
|
}
|
| 2308 |
|
|
else if(ichild.toElement().attribute("direction_type").toLower() == "out")
|
| 2309 |
|
|
{
|
| 2310 |
|
|
pport->eDirectionType = EziDebugModule::directionTypeOutput ;
|
| 2311 |
|
|
}
|
| 2312 |
|
|
else
|
| 2313 |
|
|
{
|
| 2314 |
|
|
pport->eDirectionType = EziDebugModule::directionTypeInoutput ;
|
| 2315 |
|
|
}
|
| 2316 |
|
|
|
| 2317 |
|
|
memset(pport->m_pBitWidth,0,64) ;
|
| 2318 |
|
|
if(ichild.toElement().attribute("bitwidth").size() <= 63)
|
| 2319 |
|
|
{
|
| 2320 |
|
|
qstrcpy(pport->m_pBitWidth ,ichild.toElement().attribute("bitwidth").toAscii().constData());
|
| 2321 |
|
|
}
|
| 2322 |
|
|
|
| 2323 |
|
|
if(pport)
|
| 2324 |
|
|
{
|
| 2325 |
|
|
module->m_iportVec.append(pport);
|
| 2326 |
|
|
}
|
| 2327 |
|
|
else
|
| 2328 |
|
|
{
|
| 2329 |
|
|
return 1 ;
|
| 2330 |
|
|
}
|
| 2331 |
|
|
}
|
| 2332 |
|
|
else
|
| 2333 |
|
|
{
|
| 2334 |
|
|
qDebug() << "readPortStructure: NULL Pointer!";
|
| 2335 |
|
|
return 1 ;
|
| 2336 |
|
|
}
|
| 2337 |
|
|
}
|
| 2338 |
|
|
}
|
| 2339 |
|
|
else
|
| 2340 |
|
|
{
|
| 2341 |
|
|
qDebug() << "domParsePortDescriptionElement Error : There is strange element in the file!";
|
| 2342 |
|
|
return 1 ;
|
| 2343 |
|
|
}
|
| 2344 |
|
|
ichild = ichild.nextSibling();
|
| 2345 |
|
|
}
|
| 2346 |
|
|
return 0 ;
|
| 2347 |
|
|
}
|
| 2348 |
|
|
|
| 2349 |
|
|
int EziDebugPrj::domParseInstancePortMapDescriptionElement(const QDomElement &element,char readflag, EziDebugModule* module)
|
| 2350 |
|
|
{
|
| 2351 |
|
|
/*子节点数目是否为零*/
|
| 2352 |
|
|
if(!(element.childNodes().count()))
|
| 2353 |
|
|
{
|
| 2354 |
|
|
qDebug() << "EziDebug Info:There is no instance port map !";
|
| 2355 |
|
|
return 0 ;
|
| 2356 |
|
|
}
|
| 2357 |
|
|
QDomNode ichild = element.firstChild();
|
| 2358 |
|
|
/*扫描子节点 ,是否存在下一个子节点*/
|
| 2359 |
|
|
while (!ichild.isNull())
|
| 2360 |
|
|
{
|
| 2361 |
|
|
if (ichild.toElement().tagName() == "instance")
|
| 2362 |
|
|
{
|
| 2363 |
|
|
if(ichild.toElement().attribute("instance_name").isEmpty())
|
| 2364 |
|
|
{
|
| 2365 |
|
|
return 1 ;
|
| 2366 |
|
|
}
|
| 2367 |
|
|
|
| 2368 |
|
|
if(ichild.toElement().attribute("port_map").isEmpty())
|
| 2369 |
|
|
{
|
| 2370 |
|
|
return 1 ;
|
| 2371 |
|
|
}
|
| 2372 |
|
|
}
|
| 2373 |
|
|
|
| 2374 |
|
|
if(readflag & READ_MODULE_INFO)
|
| 2375 |
|
|
{
|
| 2376 |
|
|
if(module)
|
| 2377 |
|
|
{
|
| 2378 |
|
|
int i = 0 ;
|
| 2379 |
|
|
QString iinstanceName = ichild.toElement().attribute("instance_name") ;
|
| 2380 |
|
|
QMap<QString,QString> iportMap ;
|
| 2381 |
|
|
QString iportMapStr = ichild.toElement().attribute("port_map") ;
|
| 2382 |
|
|
QStringList iportMapList = iportMapStr.split('#');
|
| 2383 |
|
|
for(;i < iportMapList.count() ;i++)
|
| 2384 |
|
|
{
|
| 2385 |
|
|
iportMap.insert(iportMapList.at(i).split('@').at(0),iportMapList.at(i).split('@').at(1));
|
| 2386 |
|
|
}
|
| 2387 |
|
|
module->m_iinstancePortMap.insert(iinstanceName,iportMap) ;
|
| 2388 |
|
|
}
|
| 2389 |
|
|
else
|
| 2390 |
|
|
{
|
| 2391 |
|
|
qDebug() << "domParsePortDescriptionElement Error : The pmodule is NULL pointer!";
|
| 2392 |
|
|
return 1 ;
|
| 2393 |
|
|
}
|
| 2394 |
|
|
}
|
| 2395 |
|
|
ichild = ichild.nextSibling();
|
| 2396 |
|
|
}
|
| 2397 |
|
|
return 0 ;
|
| 2398 |
|
|
}
|
| 2399 |
|
|
|
| 2400 |
|
|
int EziDebugPrj::domParsePortStructure(const QDomElement &element, char readflag , EziDebugModule* module)
|
| 2401 |
|
|
{
|
| 2402 |
|
|
return 0 ;
|
| 2403 |
|
|
}
|
| 2404 |
|
|
|
| 2405 |
|
|
int EziDebugPrj::domParseScanChainInfoElement(const QDomElement &element,char readflag)
|
| 2406 |
|
|
{
|
| 2407 |
|
|
QString ichainName ;
|
| 2408 |
|
|
QString iscanRegCore ;
|
| 2409 |
|
|
QString itoutCore ;
|
| 2410 |
|
|
QString iuserDir ;
|
| 2411 |
|
|
EziDebugScanChain *pchainObj = NULL ;
|
| 2412 |
|
|
|
| 2413 |
|
|
if(element.attribute("scanreg_core_name").toLower() != "no core")
|
| 2414 |
|
|
{
|
| 2415 |
|
|
iscanRegCore = element.attribute("scanreg_core_name");
|
| 2416 |
|
|
}
|
| 2417 |
|
|
else
|
| 2418 |
|
|
{
|
| 2419 |
|
|
iscanRegCore = "No Core";
|
| 2420 |
|
|
}
|
| 2421 |
|
|
|
| 2422 |
|
|
if(element.attribute("tout_core_name").toLower() != "no core")
|
| 2423 |
|
|
{
|
| 2424 |
|
|
itoutCore = element.attribute("tout_core_name");
|
| 2425 |
|
|
}
|
| 2426 |
|
|
else
|
| 2427 |
|
|
{
|
| 2428 |
|
|
itoutCore = "No Core" ;
|
| 2429 |
|
|
}
|
| 2430 |
|
|
|
| 2431 |
|
|
if(element.attribute("user_dir").toLower() != "no dir")
|
| 2432 |
|
|
{
|
| 2433 |
|
|
iuserDir = element.attribute("user_dir");
|
| 2434 |
|
|
}
|
| 2435 |
|
|
else
|
| 2436 |
|
|
{
|
| 2437 |
|
|
iuserDir = "No Dir" ;
|
| 2438 |
|
|
}
|
| 2439 |
|
|
|
| 2440 |
|
|
EziDebugScanChain::saveEziDebugAddedInfo(iscanRegCore , itoutCore , iuserDir) ;
|
| 2441 |
|
|
|
| 2442 |
|
|
/*子节点数目是否为零*/
|
| 2443 |
|
|
if(!(element.childNodes().count()))
|
| 2444 |
|
|
{
|
| 2445 |
|
|
qDebug() << "EziDebug Info: There is no Scan chain infomation!";
|
| 2446 |
|
|
return 0 ;
|
| 2447 |
|
|
}
|
| 2448 |
|
|
|
| 2449 |
|
|
|
| 2450 |
|
|
QDomNode ichild = element.firstChild();
|
| 2451 |
|
|
/*扫描子节点 ,是否存在下一个子节点*/
|
| 2452 |
|
|
while (!ichild.isNull())
|
| 2453 |
|
|
{
|
| 2454 |
|
|
if (ichild.toElement().tagName() == "chain")
|
| 2455 |
|
|
{
|
| 2456 |
|
|
if(ichild.toElement().attribute("chain_name").isEmpty())
|
| 2457 |
|
|
{
|
| 2458 |
|
|
return 1 ;
|
| 2459 |
|
|
}
|
| 2460 |
|
|
|
| 2461 |
|
|
// if(ichild.toElement().attribute("instance_list").isEmpty())
|
| 2462 |
|
|
// {
|
| 2463 |
|
|
// return 1 ;
|
| 2464 |
|
|
// }
|
| 2465 |
|
|
if(ichild.toElement().attribute("scaned_file_list").isEmpty())
|
| 2466 |
|
|
|
| 2467 |
|
|
{
|
| 2468 |
|
|
return 1 ;
|
| 2469 |
|
|
}
|
| 2470 |
|
|
|
| 2471 |
|
|
if(ichild.toElement().attribute("system_output").isEmpty())
|
| 2472 |
|
|
{
|
| 2473 |
|
|
return 1 ;
|
| 2474 |
|
|
}
|
| 2475 |
|
|
|
| 2476 |
|
|
ichainName = ichild.toElement().attribute("chain_name") ;
|
| 2477 |
|
|
|
| 2478 |
|
|
if(readflag&READ_CHAIN_INFO)
|
| 2479 |
|
|
{
|
| 2480 |
|
|
pchainObj = new EziDebugScanChain(ichainName) ;
|
| 2481 |
|
|
if(!pchainObj)
|
| 2482 |
|
|
{
|
| 2483 |
|
|
qDebug() << "Error: domParseScanChainInfoElement :There is no memory left !" ;
|
| 2484 |
|
|
return 1 ;
|
| 2485 |
|
|
}
|
| 2486 |
|
|
pchainObj->m_iinstanceItemList = ichild.toElement().attribute("instance_list").split("|") ;
|
| 2487 |
|
|
pchainObj->m_iscanedFileNameList = ichild.toElement().attribute("scaned_file_list").split("|") ;
|
| 2488 |
|
|
if(ichild.toElement().attribute("system_output")!= "No Sysoutput")
|
| 2489 |
|
|
{
|
| 2490 |
|
|
pchainObj->m_isysCoreOutputPortList = ichild.toElement().attribute("system_output").split("@") ;
|
| 2491 |
|
|
}
|
| 2492 |
|
|
}
|
| 2493 |
|
|
|
| 2494 |
|
|
//
|
| 2495 |
|
|
/*解析扫描链结构*/
|
| 2496 |
|
|
if(domParseScanChainStructure(ichild.toElement() , readflag , pchainObj))
|
| 2497 |
|
|
{
|
| 2498 |
|
|
qDebug() << "domParseScanChainInfoElement Error :chaininfo format is not right!";
|
| 2499 |
|
|
return 1 ;
|
| 2500 |
|
|
}
|
| 2501 |
|
|
}
|
| 2502 |
|
|
else
|
| 2503 |
|
|
{
|
| 2504 |
|
|
qDebug() << "domParseScanChainInfoElement Error : There is strange element in the file!";
|
| 2505 |
|
|
return 1 ;
|
| 2506 |
|
|
}
|
| 2507 |
|
|
ichild = ichild.nextSibling();
|
| 2508 |
|
|
}
|
| 2509 |
|
|
return 0 ;
|
| 2510 |
|
|
}
|
| 2511 |
|
|
|
| 2512 |
|
|
int EziDebugPrj::domParseScanChainStructure(const QDomElement &element,char readflag, EziDebugScanChain *chain)
|
| 2513 |
|
|
{
|
| 2514 |
|
|
/*子节点数目是否为零*/
|
| 2515 |
|
|
int echainStructureExistFlag = 0 ;
|
| 2516 |
|
|
if(element.childNodes().count() != 2)
|
| 2517 |
|
|
{
|
| 2518 |
|
|
qDebug() << "domParseScanChainStructure Error:There is no fileinfo!";
|
| 2519 |
|
|
return 1 ;
|
| 2520 |
|
|
}
|
| 2521 |
|
|
QDomNode ichild = element.firstChild();
|
| 2522 |
|
|
/*扫描子节点 ,是否存在下一个子节点*/
|
| 2523 |
|
|
while (!ichild.isNull())
|
| 2524 |
|
|
{
|
| 2525 |
|
|
if (ichild.toElement().tagName() == "reglist_description")
|
| 2526 |
|
|
{
|
| 2527 |
|
|
echainStructureExistFlag |= SCAN_CHAIN_STRUCTURE_REGLIST_DESCRIPTION ;
|
| 2528 |
|
|
if(domParseReglistDescriptionElement(ichild.toElement() , readflag , chain))
|
| 2529 |
|
|
{
|
| 2530 |
|
|
qDebug() << "domParseScanChainStructure Error :fileinfo format is not right!";
|
| 2531 |
|
|
return 1 ;
|
| 2532 |
|
|
}
|
| 2533 |
|
|
}
|
| 2534 |
|
|
else if(ichild.toElement().tagName() == "code_description")
|
| 2535 |
|
|
{
|
| 2536 |
|
|
echainStructureExistFlag |= SCAN_CHAIN_STRUCTURE_CODE_DESCRIPTION ;
|
| 2537 |
|
|
if(domParseCodeDescriptionElement(ichild.toElement() , readflag , chain))
|
| 2538 |
|
|
{
|
| 2539 |
|
|
qDebug() << "domParseScanChainStructure Error :reginfo format is not right!";
|
| 2540 |
|
|
return 1 ;
|
| 2541 |
|
|
}
|
| 2542 |
|
|
}
|
| 2543 |
|
|
else
|
| 2544 |
|
|
{
|
| 2545 |
|
|
qDebug() << "domParseScanChainStructure Error : There is strange element in the file!";
|
| 2546 |
|
|
return 1 ;
|
| 2547 |
|
|
}
|
| 2548 |
|
|
ichild = ichild.nextSibling();
|
| 2549 |
|
|
}
|
| 2550 |
|
|
|
| 2551 |
|
|
if((echainStructureExistFlag&SCAN_CHAIN_STRUCTURE_ALL_DESCRIPTION) == SCAN_CHAIN_STRUCTURE_ALL_DESCRIPTION )
|
| 2552 |
|
|
{
|
| 2553 |
|
|
if(readflag&READ_CHAIN_INFO)
|
| 2554 |
|
|
{
|
| 2555 |
|
|
m_ichainInfoMap.insert(chain->m_iChainName,chain);
|
| 2556 |
|
|
}
|
| 2557 |
|
|
return 0 ;
|
| 2558 |
|
|
}
|
| 2559 |
|
|
else
|
| 2560 |
|
|
{
|
| 2561 |
|
|
return 1 ;
|
| 2562 |
|
|
}
|
| 2563 |
|
|
|
| 2564 |
|
|
return 0 ;
|
| 2565 |
|
|
}
|
| 2566 |
|
|
|
| 2567 |
|
|
int EziDebugPrj::domParseReglistDescriptionElement(const QDomElement &element,char readflag, EziDebugScanChain *chain)
|
| 2568 |
|
|
{
|
| 2569 |
|
|
QVector<QStringList> iregListVec ;
|
| 2570 |
|
|
|
| 2571 |
|
|
/*子节点数目是否为零*/
|
| 2572 |
|
|
if(!(element.childNodes().count()))
|
| 2573 |
|
|
{
|
| 2574 |
|
|
qDebug() << "domParseReglistDescriptionElement Error:There is no fileinfo!";
|
| 2575 |
|
|
return 1 ;
|
| 2576 |
|
|
}
|
| 2577 |
|
|
QDomNode ichild = element.firstChild();
|
| 2578 |
|
|
/*扫描子节点 ,是否存在下一个子节点*/
|
| 2579 |
|
|
while (!ichild.isNull())
|
| 2580 |
|
|
{
|
| 2581 |
|
|
if(ichild.toElement().tagName() == "regchain")
|
| 2582 |
|
|
{
|
| 2583 |
|
|
if(ichild.toElement().attribute("reglist").isEmpty())
|
| 2584 |
|
|
{
|
| 2585 |
|
|
return 1 ;
|
| 2586 |
|
|
}
|
| 2587 |
|
|
|
| 2588 |
|
|
if(ichild.toElement().attribute("insertclock").isEmpty())
|
| 2589 |
|
|
{
|
| 2590 |
|
|
return 1 ;
|
| 2591 |
|
|
}
|
| 2592 |
|
|
|
| 2593 |
|
|
if(readflag&READ_CHAIN_INFO)
|
| 2594 |
|
|
{
|
| 2595 |
|
|
if(chain)
|
| 2596 |
|
|
{
|
| 2597 |
|
|
QString iinsertClock = ichild.toElement().attribute("insertclock") ;
|
| 2598 |
|
|
|
| 2599 |
|
|
int nregCount = ichild.toElement().attribute("regcount").toInt();
|
| 2600 |
|
|
|
| 2601 |
|
|
chain->m_nregCountMap.insert(iinsertClock,nregCount);
|
| 2602 |
|
|
|
| 2603 |
|
|
QStringList ireglist = ichild.toElement().attribute("reglist").split("@") ;
|
| 2604 |
|
|
|
| 2605 |
|
|
iregListVec.append(ireglist);
|
| 2606 |
|
|
|
| 2607 |
|
|
chain->m_iregChainStructure.insert(iinsertClock,iregListVec) ;
|
| 2608 |
|
|
}
|
| 2609 |
|
|
else
|
| 2610 |
|
|
{
|
| 2611 |
|
|
return 1 ;
|
| 2612 |
|
|
}
|
| 2613 |
|
|
}
|
| 2614 |
|
|
|
| 2615 |
|
|
}
|
| 2616 |
|
|
else
|
| 2617 |
|
|
{
|
| 2618 |
|
|
qDebug() << "domParseReglistStructure Error : There is unknown element in the EziDebug file!";
|
| 2619 |
|
|
return 1 ;
|
| 2620 |
|
|
}
|
| 2621 |
|
|
ichild = ichild.nextSibling();
|
| 2622 |
|
|
}
|
| 2623 |
|
|
return 0 ;
|
| 2624 |
|
|
}
|
| 2625 |
|
|
|
| 2626 |
|
|
//int EziDebugPrj::domParseReglistStructure(const QDomElement &element,char readflag, EziDebugScanChain *chain)
|
| 2627 |
|
|
//{
|
| 2628 |
|
|
// /*子节点数目是否为零*/
|
| 2629 |
|
|
// if(!(element.childNodes().count()))
|
| 2630 |
|
|
// {
|
| 2631 |
|
|
// qDebug() << "domParseReglistStructure Error:There is no fileinfo!";
|
| 2632 |
|
|
// return 1 ;
|
| 2633 |
|
|
// }
|
| 2634 |
|
|
// QDomNode ichild = element.firstChild();
|
| 2635 |
|
|
// /*扫描子节点 ,是否存在下一个子节点*/
|
| 2636 |
|
|
// while (!ichild.isNull())
|
| 2637 |
|
|
// {
|
| 2638 |
|
|
// if(ichild.toElement().tagName() == "regchain")
|
| 2639 |
|
|
// {
|
| 2640 |
|
|
// if(ichild.toElement().attribute("reglist").isEmpty())
|
| 2641 |
|
|
// {
|
| 2642 |
|
|
// return 1 ;
|
| 2643 |
|
|
// }
|
| 2644 |
|
|
|
| 2645 |
|
|
// if(readflag&READ_CHAIN_INFO)
|
| 2646 |
|
|
// {
|
| 2647 |
|
|
// if(chain)
|
| 2648 |
|
|
// {
|
| 2649 |
|
|
// QStringList ireglist = ichild.toElement().attribute("reglist").split("|") ;
|
| 2650 |
|
|
// QList<EziDebugScanChain::RegListStructure*> itempRegList ;
|
| 2651 |
|
|
// for (int i = 0; i < ireglist.size(); i++)
|
| 2652 |
|
|
// {
|
| 2653 |
|
|
// QStringList isinglereglist = ireglist.at(i).split("%") ;
|
| 2654 |
|
|
// EziDebugScanChain::RegListStructure* preg = new EziDebugScanChain::RegListStructure ;
|
| 2655 |
|
|
// preg->m_pnamehiberarchy = (char*)malloc(isinglereglist.at(0).size()+1);
|
| 2656 |
|
|
// memcpy(preg->m_pnamehiberarchy,isinglereglist.at(0).toAscii().data(),isinglereglist.at(0).size()+1);
|
| 2657 |
|
|
|
| 2658 |
|
|
// preg->m_pregName = (char*)malloc(isinglereglist.at(1).size()+1) ;
|
| 2659 |
|
|
// memcpy(preg->m_pregName,isinglereglist.at(1).toAscii().data(),isinglereglist.at(1).size()+1);
|
| 2660 |
|
|
|
| 2661 |
|
|
// preg->m_pclock = (char*)malloc(isinglereglist.at(2).size()+1);
|
| 2662 |
|
|
// memcpy(preg->m_pclock,isinglereglist.at(2).toAscii().data(),isinglereglist.at(2).size()+1);
|
| 2663 |
|
|
|
| 2664 |
|
|
// preg->m_nbitwidth = isinglereglist.at(3).toInt();
|
| 2665 |
|
|
// preg->m_nstartbit = isinglereglist.at(4).toInt();
|
| 2666 |
|
|
// preg->m_nendbit = isinglereglist.at(5).toInt();
|
| 2667 |
|
|
|
| 2668 |
|
|
// itempRegList.append(preg);
|
| 2669 |
|
|
// chain->m_iregChainStructure.append(itempRegList);
|
| 2670 |
|
|
// }
|
| 2671 |
|
|
// }
|
| 2672 |
|
|
// else
|
| 2673 |
|
|
// {
|
| 2674 |
|
|
// return 1 ;
|
| 2675 |
|
|
// }
|
| 2676 |
|
|
// }
|
| 2677 |
|
|
|
| 2678 |
|
|
// }
|
| 2679 |
|
|
// else
|
| 2680 |
|
|
// {
|
| 2681 |
|
|
// qDebug() << "domParseReglistStructure Error : There is unknown element in the EziDebug file!";
|
| 2682 |
|
|
// return 1 ;
|
| 2683 |
|
|
// }
|
| 2684 |
|
|
// ichild = ichild.nextSibling();
|
| 2685 |
|
|
// }
|
| 2686 |
|
|
// return 0 ;
|
| 2687 |
|
|
//}
|
| 2688 |
|
|
|
| 2689 |
|
|
int EziDebugPrj::domParseCodeDescriptionElement(const QDomElement &element,char readflag, EziDebugScanChain *chain)
|
| 2690 |
|
|
{
|
| 2691 |
|
|
if(!(element.childNodes().count()))
|
| 2692 |
|
|
{
|
| 2693 |
|
|
qDebug() << "domParseCodeDescriptionElement Error:There is no codedescription int ScanChain infomation!";
|
| 2694 |
|
|
return 1 ;
|
| 2695 |
|
|
}
|
| 2696 |
|
|
QDomNode ichild = element.firstChild();
|
| 2697 |
|
|
/*扫描子节点 ,是否存在下一个子节点*/
|
| 2698 |
|
|
while (!ichild.isNull())
|
| 2699 |
|
|
{
|
| 2700 |
|
|
if (ichild.toElement().tagName() == "added_code")
|
| 2701 |
|
|
{
|
| 2702 |
|
|
if(ichild.toElement().attribute("module_name").isEmpty())
|
| 2703 |
|
|
{
|
| 2704 |
|
|
return 1 ;
|
| 2705 |
|
|
}
|
| 2706 |
|
|
|
| 2707 |
|
|
if(ichild.toElement().attribute("user_line_code").isEmpty())
|
| 2708 |
|
|
{
|
| 2709 |
|
|
return 1 ;
|
| 2710 |
|
|
}
|
| 2711 |
|
|
|
| 2712 |
|
|
if(ichild.toElement().attribute("user_block_code").isEmpty())
|
| 2713 |
|
|
{
|
| 2714 |
|
|
return 1 ;
|
| 2715 |
|
|
}
|
| 2716 |
|
|
|
| 2717 |
|
|
|
| 2718 |
|
|
if(readflag&READ_CHAIN_INFO)
|
| 2719 |
|
|
{
|
| 2720 |
|
|
if(chain)
|
| 2721 |
|
|
{
|
| 2722 |
|
|
chain->m_icodeMap.insert(ichild.toElement().attribute("module_name"),ichild.toElement().attribute("user_line_code").split("#"));
|
| 2723 |
|
|
if(ichild.toElement().attribute("user_block_code").toLower() != "no code")
|
| 2724 |
|
|
{
|
| 2725 |
|
|
chain->m_iblockCodeMap.insert(ichild.toElement().attribute("module_name"),ichild.toElement().attribute("user_block_code").split("#"));
|
| 2726 |
|
|
}
|
| 2727 |
|
|
}
|
| 2728 |
|
|
else
|
| 2729 |
|
|
{
|
| 2730 |
|
|
return 1 ;
|
| 2731 |
|
|
}
|
| 2732 |
|
|
}
|
| 2733 |
|
|
|
| 2734 |
|
|
}
|
| 2735 |
|
|
else
|
| 2736 |
|
|
{
|
| 2737 |
|
|
qDebug() << "domParseCodeStructure Error : There is unknown element in the EziDebug file!";
|
| 2738 |
|
|
return 1 ;
|
| 2739 |
|
|
}
|
| 2740 |
|
|
ichild = ichild.nextSibling();
|
| 2741 |
|
|
}
|
| 2742 |
|
|
return 0 ;
|
| 2743 |
|
|
}
|
| 2744 |
|
|
|
| 2745 |
|
|
|
| 2746 |
|
|
//int EziDebugPrj::domParseCodeStructure(const QDomElement &element,char readflag ,EziDebugScanChain * chain)
|
| 2747 |
|
|
//{
|
| 2748 |
|
|
// /*子节点数目是否为零*/
|
| 2749 |
|
|
// if(!(element.childNodes().count()))
|
| 2750 |
|
|
// {
|
| 2751 |
|
|
// qDebug() << "domParseScanChainStructure Error:There is no fileinfo!";
|
| 2752 |
|
|
// return 1 ;
|
| 2753 |
|
|
// }
|
| 2754 |
|
|
// QDomNode ichild = element.firstChild();
|
| 2755 |
|
|
// /*扫描子节点 ,是否存在下一个子节点*/
|
| 2756 |
|
|
// while (!ichild.isNull())
|
| 2757 |
|
|
// {
|
| 2758 |
|
|
// if (ichild.toElement().tagName() == "added_code")
|
| 2759 |
|
|
// {
|
| 2760 |
|
|
// if(ichild.toElement().attribute("module_name").isEmpty())
|
| 2761 |
|
|
// {
|
| 2762 |
|
|
// return 1 ;
|
| 2763 |
|
|
// }
|
| 2764 |
|
|
|
| 2765 |
|
|
// if(ichild.toElement().attribute("user_code").isEmpty())
|
| 2766 |
|
|
// {
|
| 2767 |
|
|
// return 1 ;
|
| 2768 |
|
|
// }
|
| 2769 |
|
|
|
| 2770 |
|
|
// if(ichild.toElement().attribute("user_core_code").isEmpty())
|
| 2771 |
|
|
// {
|
| 2772 |
|
|
// return 1 ;
|
| 2773 |
|
|
// }
|
| 2774 |
|
|
|
| 2775 |
|
|
// if(readflag&READ_CHAIN_INFO)
|
| 2776 |
|
|
// {
|
| 2777 |
|
|
// if(chain)
|
| 2778 |
|
|
// {
|
| 2779 |
|
|
// chain->m_icodeMap.insert(ichild.toElement().attribute("module_name"),ichild.toElement().attribute("user_code").split("#"));
|
| 2780 |
|
|
// chain->m_iuserDefineCoreMap.insert(ichild.toElement().attribute("module_name"),ichild.toElement().attribute("user_core_code"));
|
| 2781 |
|
|
// }
|
| 2782 |
|
|
// else
|
| 2783 |
|
|
// {
|
| 2784 |
|
|
// return 1 ;
|
| 2785 |
|
|
// }
|
| 2786 |
|
|
// }
|
| 2787 |
|
|
|
| 2788 |
|
|
// }
|
| 2789 |
|
|
// else
|
| 2790 |
|
|
// {
|
| 2791 |
|
|
// qDebug() << "domParseCodeStructure Error : There is unknown element in the EziDebug file!";
|
| 2792 |
|
|
// return 1 ;
|
| 2793 |
|
|
// }
|
| 2794 |
|
|
// ichild = ichild.nextSibling();
|
| 2795 |
|
|
// }
|
| 2796 |
|
|
// return 0 ;
|
| 2797 |
|
|
//}
|
| 2798 |
|
|
|
| 2799 |
|
|
|
| 2800 |
|
|
// 读取log文件中的 有关文件的信息
|
| 2801 |
|
|
int EziDebugPrj::readFileInfo(char readflag)
|
| 2802 |
|
|
{
|
| 2803 |
|
|
// 过程中只能遇到三种类型的 xml 标签
|
| 2804 |
|
|
bool isFileInfoExist = 0 ;
|
| 2805 |
|
|
/*读取下一个有效的开始 标签*/
|
| 2806 |
|
|
m_ireader.readNext();
|
| 2807 |
|
|
while(!m_ireader.atEnd())
|
| 2808 |
|
|
{
|
| 2809 |
|
|
if(m_ireader.isStartElement())
|
| 2810 |
|
|
{
|
| 2811 |
|
|
if(m_ireader.name() == "FILE_INFO")
|
| 2812 |
|
|
{
|
| 2813 |
|
|
/*do nothing! 继续读取 文件信息*/
|
| 2814 |
|
|
isFileInfoExist = 1 ;
|
| 2815 |
|
|
|
| 2816 |
|
|
if(readFileStructure(readflag))
|
| 2817 |
|
|
return 1 ;
|
| 2818 |
|
|
m_ireader.readNext();
|
| 2819 |
|
|
}
|
| 2820 |
|
|
else
|
| 2821 |
|
|
{
|
| 2822 |
|
|
qDebug() << "the log file is not complete!";
|
| 2823 |
|
|
return 1 ;
|
| 2824 |
|
|
}
|
| 2825 |
|
|
}
|
| 2826 |
|
|
else if(m_ireader.isCharacters())
|
| 2827 |
|
|
{
|
| 2828 |
|
|
QRegExp icomExp("\\s+");
|
| 2829 |
|
|
if(icomExp.exactMatch(m_ireader.text().toString()))
|
| 2830 |
|
|
{
|
| 2831 |
|
|
m_ireader.readNext();
|
| 2832 |
|
|
}
|
| 2833 |
|
|
else
|
| 2834 |
|
|
{
|
| 2835 |
|
|
qDebug() << "the log file's format is not right!";
|
| 2836 |
|
|
return 1 ;
|
| 2837 |
|
|
}
|
| 2838 |
|
|
}
|
| 2839 |
|
|
else if(m_ireader.isEndElement())
|
| 2840 |
|
|
{
|
| 2841 |
|
|
if(m_ireader.name()== "FILE_INFO")
|
| 2842 |
|
|
{
|
| 2843 |
|
|
/*存在 FILE_INFO 标签*/
|
| 2844 |
|
|
if(isFileInfoExist)
|
| 2845 |
|
|
{
|
| 2846 |
|
|
return 0 ;
|
| 2847 |
|
|
}
|
| 2848 |
|
|
else
|
| 2849 |
|
|
{
|
| 2850 |
|
|
/*不存在 FILE_INFO 开始标签*/
|
| 2851 |
|
|
qDebug() << "There is not label \"FILE_INFO\"'s StartElement !" ;
|
| 2852 |
|
|
return 1 ;
|
| 2853 |
|
|
}
|
| 2854 |
|
|
}
|
| 2855 |
|
|
else
|
| 2856 |
|
|
{
|
| 2857 |
|
|
qDebug() << "readFileInfo: The log file is not complete!" ;
|
| 2858 |
|
|
return 1 ;
|
| 2859 |
|
|
}
|
| 2860 |
|
|
}
|
| 2861 |
|
|
else
|
| 2862 |
|
|
{
|
| 2863 |
|
|
qDebug() << "readFileInfo: the log file format is not right!";
|
| 2864 |
|
|
return 1 ;
|
| 2865 |
|
|
}
|
| 2866 |
|
|
}
|
| 2867 |
|
|
return 0 ;
|
| 2868 |
|
|
}
|
| 2869 |
|
|
|
| 2870 |
|
|
|
| 2871 |
|
|
int EziDebugPrj::readFileStructure(char readflag)
|
| 2872 |
|
|
{
|
| 2873 |
|
|
// 过程中只能遇到三种类型的 xml 标签
|
| 2874 |
|
|
QString ifileName ;
|
| 2875 |
|
|
QDateTime idateTime ;
|
| 2876 |
|
|
QDate idate ;
|
| 2877 |
|
|
QTime itime ;
|
| 2878 |
|
|
QStringList imoduleList ;
|
| 2879 |
|
|
bool isFileStructureInfoExist = 0 ;
|
| 2880 |
|
|
int nfileStructureInfoCount = 0 ;
|
| 2881 |
|
|
|
| 2882 |
|
|
/*读取下一个有效的开始 标签*/
|
| 2883 |
|
|
m_ireader.readNext();
|
| 2884 |
|
|
while(!m_ireader.atEnd())
|
| 2885 |
|
|
{
|
| 2886 |
|
|
if(m_ireader.isStartElement())
|
| 2887 |
|
|
{
|
| 2888 |
|
|
if(m_ireader.name() == "file")
|
| 2889 |
|
|
{
|
| 2890 |
|
|
isFileStructureInfoExist = 1 ;
|
| 2891 |
|
|
nfileStructureInfoCount++ ;
|
| 2892 |
|
|
if(m_ireader.attributes().value("filename").isEmpty())
|
| 2893 |
|
|
{
|
| 2894 |
|
|
return 1 ;
|
| 2895 |
|
|
}
|
| 2896 |
|
|
|
| 2897 |
|
|
if(m_ireader.attributes().value("modify_date").isEmpty())
|
| 2898 |
|
|
{
|
| 2899 |
|
|
return 1 ;
|
| 2900 |
|
|
}
|
| 2901 |
|
|
|
| 2902 |
|
|
if(m_ireader.attributes().value("modify_time").isEmpty())
|
| 2903 |
|
|
{
|
| 2904 |
|
|
return 1 ;
|
| 2905 |
|
|
}
|
| 2906 |
|
|
|
| 2907 |
|
|
if(m_ireader.attributes().value("module_array").isEmpty())
|
| 2908 |
|
|
{
|
| 2909 |
|
|
return 1 ;
|
| 2910 |
|
|
}
|
| 2911 |
|
|
|
| 2912 |
|
|
ifileName = m_ireader.attributes().value("filename").toString();
|
| 2913 |
|
|
imoduleList = m_ireader.attributes().value("filename").toString().split(QRegExp("\\s+"));
|
| 2914 |
|
|
QStringList idateList = m_ireader.attributes().value("modify_date").toString().split("/") ;
|
| 2915 |
|
|
QStringList itimeList = m_ireader.attributes().value("modify_time").toString().split(":") ;
|
| 2916 |
|
|
|
| 2917 |
|
|
idate = QDate(idateList.at(2).toInt(),idateList.at(0).toInt(),idateList.at(1).toInt()) ;
|
| 2918 |
|
|
itime = QTime(itimeList.at(0).toInt(),itimeList.at(1).toInt(),itimeList.at(2).toInt()) ;
|
| 2919 |
|
|
|
| 2920 |
|
|
idateTime = QDateTime(idate,itime) ;
|
| 2921 |
|
|
if((ifileName.endsWith(".v",Qt::CaseSensitive))&&(readflag|READ_FILE_INFO))
|
| 2922 |
|
|
{
|
| 2923 |
|
|
/*创建文件对象指针 并加入工程对象的文件map中*/
|
| 2924 |
|
|
EziDebugVlgFile * pvlgFileObj = new EziDebugVlgFile(ifileName,idateTime,imoduleList);
|
| 2925 |
|
|
m_ivlgFileMap.insert(ifileName,pvlgFileObj);
|
| 2926 |
|
|
m_ireader.readNext() ;
|
| 2927 |
|
|
}
|
| 2928 |
|
|
else if((ifileName.endsWith(".vhd",Qt::CaseSensitive))&&(readflag|READ_FILE_INFO))
|
| 2929 |
|
|
{
|
| 2930 |
|
|
/*创建文件对象指针 并加入工程对象的文件map中*/
|
| 2931 |
|
|
EziDebugVhdlFile * pvlgFileObj = new EziDebugVhdlFile(ifileName,idateTime,imoduleList);
|
| 2932 |
|
|
m_ivhdlFileMap.insert(ifileName,pvlgFileObj);
|
| 2933 |
|
|
m_ireader.readNext() ;
|
| 2934 |
|
|
}
|
| 2935 |
|
|
else
|
| 2936 |
|
|
{
|
| 2937 |
|
|
qDebug() << "The log file format is not right(the source code file type is not right)!";
|
| 2938 |
|
|
return 1 ;
|
| 2939 |
|
|
}
|
| 2940 |
|
|
}
|
| 2941 |
|
|
else
|
| 2942 |
|
|
{
|
| 2943 |
|
|
qDebug() << "the log file is not complete!";
|
| 2944 |
|
|
return 1 ;
|
| 2945 |
|
|
}
|
| 2946 |
|
|
}
|
| 2947 |
|
|
else if(m_ireader.isEndElement())
|
| 2948 |
|
|
{
|
| 2949 |
|
|
if(m_ireader.name() == "file")
|
| 2950 |
|
|
{
|
| 2951 |
|
|
if(1 == isFileStructureInfoExist)
|
| 2952 |
|
|
{
|
| 2953 |
|
|
m_ireader.readNext();
|
| 2954 |
|
|
isFileStructureInfoExist = 0 ;
|
| 2955 |
|
|
}
|
| 2956 |
|
|
else
|
| 2957 |
|
|
{
|
| 2958 |
|
|
qDebug() << "The Label File Has No endElement!" ;
|
| 2959 |
|
|
return 1 ;
|
| 2960 |
|
|
}
|
| 2961 |
|
|
}
|
| 2962 |
|
|
else if(m_ireader.name() == "FILE_INFO")
|
| 2963 |
|
|
{
|
| 2964 |
|
|
if(!nfileStructureInfoCount)
|
| 2965 |
|
|
{
|
| 2966 |
|
|
qDebug() << "there is not file info exist!" ;
|
| 2967 |
|
|
return 1 ;
|
| 2968 |
|
|
}
|
| 2969 |
|
|
else
|
| 2970 |
|
|
{
|
| 2971 |
|
|
return 0 ;
|
| 2972 |
|
|
}
|
| 2973 |
|
|
}
|
| 2974 |
|
|
else
|
| 2975 |
|
|
{
|
| 2976 |
|
|
qDebug() << "end element is not completed";
|
| 2977 |
|
|
return 1 ;
|
| 2978 |
|
|
}
|
| 2979 |
|
|
}
|
| 2980 |
|
|
else if(m_ireader.isCharacters())
|
| 2981 |
|
|
{
|
| 2982 |
|
|
QRegExp icomExp("\\s+");
|
| 2983 |
|
|
if(icomExp.exactMatch(m_ireader.text().toString()))
|
| 2984 |
|
|
{
|
| 2985 |
|
|
m_ireader.readNext();
|
| 2986 |
|
|
}
|
| 2987 |
|
|
else
|
| 2988 |
|
|
{
|
| 2989 |
|
|
qDebug() << "the log file's format is not right!";
|
| 2990 |
|
|
return 1 ;
|
| 2991 |
|
|
}
|
| 2992 |
|
|
}
|
| 2993 |
|
|
else
|
| 2994 |
|
|
{
|
| 2995 |
|
|
qDebug() << "the log file is not right!";
|
| 2996 |
|
|
return 1 ;
|
| 2997 |
|
|
}
|
| 2998 |
|
|
}
|
| 2999 |
|
|
return 0 ;
|
| 3000 |
|
|
}
|
| 3001 |
|
|
|
| 3002 |
|
|
int EziDebugPrj::readModuleInfo(char readflag)
|
| 3003 |
|
|
{
|
| 3004 |
|
|
// 过程中只能遇到三种类型的 xml 标签
|
| 3005 |
|
|
bool isModuleInfoExist = 0 ;
|
| 3006 |
|
|
|
| 3007 |
|
|
/*读取下一个有效的开始 标签*/
|
| 3008 |
|
|
m_ireader.readNext();
|
| 3009 |
|
|
while(!m_ireader.atEnd())
|
| 3010 |
|
|
{
|
| 3011 |
|
|
if(m_ireader.isStartElement())
|
| 3012 |
|
|
{
|
| 3013 |
|
|
if(m_ireader.name() == "MODULE_INFO")
|
| 3014 |
|
|
{
|
| 3015 |
|
|
/*继续读取 文件信息*/
|
| 3016 |
|
|
isModuleInfoExist = 1 ;
|
| 3017 |
|
|
/*读取topmodule信息*/
|
| 3018 |
|
|
if(m_ireader.attributes().value("topmodule").isEmpty())
|
| 3019 |
|
|
{
|
| 3020 |
|
|
qDebug()<< "readModuleInfo: There is no top Module in the log file! ";
|
| 3021 |
|
|
return 1 ;
|
| 3022 |
|
|
}
|
| 3023 |
|
|
else
|
| 3024 |
|
|
{
|
| 3025 |
|
|
// 从默认路径下恢复 数据结构时 需要topmodule ,正常流程下 topmodule 会一致么 ?
|
| 3026 |
|
|
if(m_ireader.attributes().value("topmodule").toString() != m_itopModule)
|
| 3027 |
|
|
{
|
| 3028 |
|
|
//重新设置topmodule
|
| 3029 |
|
|
qDebug()<< "readModuleInfo: The topmodule in log file is not agree with QSF file";
|
| 3030 |
|
|
return 1 ;
|
| 3031 |
|
|
}
|
| 3032 |
|
|
}
|
| 3033 |
|
|
if(readModuleStructure(readflag))
|
| 3034 |
|
|
return 1 ;
|
| 3035 |
|
|
m_ireader.readNext();
|
| 3036 |
|
|
}
|
| 3037 |
|
|
else
|
| 3038 |
|
|
{
|
| 3039 |
|
|
qDebug() << "the log file is not complete!";
|
| 3040 |
|
|
return 1 ;
|
| 3041 |
|
|
}
|
| 3042 |
|
|
}
|
| 3043 |
|
|
else if(m_ireader.isCharacters())
|
| 3044 |
|
|
{
|
| 3045 |
|
|
QRegExp icomExp("\\s+");
|
| 3046 |
|
|
if(icomExp.exactMatch(m_ireader.text().toString()))
|
| 3047 |
|
|
{
|
| 3048 |
|
|
m_ireader.readNext();
|
| 3049 |
|
|
}
|
| 3050 |
|
|
else
|
| 3051 |
|
|
{
|
| 3052 |
|
|
qDebug() << "the log file's format is not right!";
|
| 3053 |
|
|
return 1 ;
|
| 3054 |
|
|
}
|
| 3055 |
|
|
}
|
| 3056 |
|
|
else if(m_ireader.isEndElement())
|
| 3057 |
|
|
{
|
| 3058 |
|
|
if(m_ireader.name()== "MODULE_INFO")
|
| 3059 |
|
|
{
|
| 3060 |
|
|
/*存在 MODULE_INFO 标签*/
|
| 3061 |
|
|
if(isModuleInfoExist)
|
| 3062 |
|
|
{
|
| 3063 |
|
|
return 0 ;
|
| 3064 |
|
|
}
|
| 3065 |
|
|
else
|
| 3066 |
|
|
{
|
| 3067 |
|
|
/*不存在 MODULE_INFO 开始标签*/
|
| 3068 |
|
|
qDebug() << "The Label \"MODULE_INFO\" Has no StartElement !" ;
|
| 3069 |
|
|
return 1 ;
|
| 3070 |
|
|
}
|
| 3071 |
|
|
}
|
| 3072 |
|
|
else
|
| 3073 |
|
|
{
|
| 3074 |
|
|
qDebug() << "readModuleInfo: The log file is not complete!" ;
|
| 3075 |
|
|
return 1 ;
|
| 3076 |
|
|
}
|
| 3077 |
|
|
}
|
| 3078 |
|
|
else
|
| 3079 |
|
|
{
|
| 3080 |
|
|
qDebug() << "readModuleInfo: the log file format is not right!";
|
| 3081 |
|
|
return 1 ;
|
| 3082 |
|
|
}
|
| 3083 |
|
|
}
|
| 3084 |
|
|
return 0 ;
|
| 3085 |
|
|
}
|
| 3086 |
|
|
|
| 3087 |
|
|
int EziDebugPrj::readModuleStructure(char readflag)
|
| 3088 |
|
|
{
|
| 3089 |
|
|
// 过程中只能遇到三种类型的 xml 标签
|
| 3090 |
|
|
QString imoduleName ;
|
| 3091 |
|
|
|
| 3092 |
|
|
// QStringList iclockNameList ;
|
| 3093 |
|
|
|
| 3094 |
|
|
// EziDebugModule::RegStructure* preg ;
|
| 3095 |
|
|
// EziDebugModule::PortStructure *pport ;
|
| 3096 |
|
|
|
| 3097 |
|
|
EziDebugModule * pmoduleObj = NULL ;
|
| 3098 |
|
|
|
| 3099 |
|
|
bool isModuleStructureInfoExist = 0 ;
|
| 3100 |
|
|
int nModuleStructureInfoCount = 0 ;
|
| 3101 |
|
|
|
| 3102 |
|
|
|
| 3103 |
|
|
/*读取下一个有效的开始 标签*/
|
| 3104 |
|
|
m_ireader.readNext();
|
| 3105 |
|
|
while(!m_ireader.atEnd())
|
| 3106 |
|
|
{
|
| 3107 |
|
|
if(m_ireader.isStartElement())
|
| 3108 |
|
|
{
|
| 3109 |
|
|
if(m_ireader.name() == "module")
|
| 3110 |
|
|
{
|
| 3111 |
|
|
isModuleStructureInfoExist = 1 ;
|
| 3112 |
|
|
nModuleStructureInfoCount++ ;
|
| 3113 |
|
|
|
| 3114 |
|
|
if(m_ireader.attributes().value("name").isEmpty())
|
| 3115 |
|
|
{
|
| 3116 |
|
|
return 1 ;
|
| 3117 |
|
|
}
|
| 3118 |
|
|
|
| 3119 |
|
|
/*
|
| 3120 |
|
|
if(m_ireader.attributes().value("appearance_count").isEmpty())
|
| 3121 |
|
|
{
|
| 3122 |
|
|
return 1 ;
|
| 3123 |
|
|
}
|
| 3124 |
|
|
*/
|
| 3125 |
|
|
if(m_ireader.attributes().value("lib_core").isEmpty())
|
| 3126 |
|
|
{
|
| 3127 |
|
|
return 1 ;
|
| 3128 |
|
|
}
|
| 3129 |
|
|
|
| 3130 |
|
|
if(m_ireader.attributes().value("file_name").isEmpty())
|
| 3131 |
|
|
{
|
| 3132 |
|
|
return 1 ;
|
| 3133 |
|
|
}
|
| 3134 |
|
|
|
| 3135 |
|
|
if(m_ireader.attributes().value("array_name").isEmpty())
|
| 3136 |
|
|
{
|
| 3137 |
|
|
return 1 ;
|
| 3138 |
|
|
}
|
| 3139 |
|
|
|
| 3140 |
|
|
if(readflag & READ_MODULE_INFO)
|
| 3141 |
|
|
{
|
| 3142 |
|
|
/*创建module对象指针 并加入工程对象的module map中*/
|
| 3143 |
|
|
imoduleName = m_ireader.attributes().value("name").toString();
|
| 3144 |
|
|
|
| 3145 |
|
|
EziDebugModule *ptempModuleObj = new EziDebugModule(imoduleName);
|
| 3146 |
|
|
if(!ptempModuleObj)
|
| 3147 |
|
|
return 1 ;
|
| 3148 |
|
|
pmoduleObj = ptempModuleObj ;
|
| 3149 |
|
|
|
| 3150 |
|
|
m_imoduleMap.insert(imoduleName,ptempModuleObj);
|
| 3151 |
|
|
ptempModuleObj->m_imoduleName = m_ireader.attributes().value("name").toString();
|
| 3152 |
|
|
//ptempModuleObj->m_ninstanceTimes = static_cast<bool>(m_ireader.attributes().value("appearance_count").toString().toInt()) ;
|
| 3153 |
|
|
ptempModuleObj->m_isLibaryCore = (m_ireader.attributes().value("lib_core").toString().toLower() == "yes") ;
|
| 3154 |
|
|
ptempModuleObj->m_ilocatedFile = m_ireader.attributes().value("file_name").toString() ;
|
| 3155 |
|
|
ptempModuleObj->m_iinstanceNameList = m_ireader.attributes().value("file_name").toString().split("|");
|
| 3156 |
|
|
|
| 3157 |
|
|
}
|
| 3158 |
|
|
|
| 3159 |
|
|
if(!readClockDescription(readflag , pmoduleObj))
|
| 3160 |
|
|
{
|
| 3161 |
|
|
if(!readRegDescription(readflag , pmoduleObj))
|
| 3162 |
|
|
{
|
| 3163 |
|
|
if(!readPortDescription(readflag , pmoduleObj))
|
| 3164 |
|
|
{
|
| 3165 |
|
|
m_ireader.readNext();
|
| 3166 |
|
|
}
|
| 3167 |
|
|
else
|
| 3168 |
|
|
{
|
| 3169 |
|
|
if(pmoduleObj)
|
| 3170 |
|
|
{
|
| 3171 |
|
|
delete pmoduleObj ;
|
| 3172 |
|
|
pmoduleObj = NULL ;
|
| 3173 |
|
|
qDebug() << "after readPortDescription ,There is no memory left !";
|
| 3174 |
|
|
return 1 ;
|
| 3175 |
|
|
}
|
| 3176 |
|
|
}
|
| 3177 |
|
|
}
|
| 3178 |
|
|
else
|
| 3179 |
|
|
{
|
| 3180 |
|
|
if(pmoduleObj)
|
| 3181 |
|
|
{
|
| 3182 |
|
|
delete pmoduleObj ;
|
| 3183 |
|
|
pmoduleObj = NULL ;
|
| 3184 |
|
|
qDebug() << "after readRegDescription ,There is no memory left !";
|
| 3185 |
|
|
return 1 ;
|
| 3186 |
|
|
}
|
| 3187 |
|
|
}
|
| 3188 |
|
|
}
|
| 3189 |
|
|
else
|
| 3190 |
|
|
{
|
| 3191 |
|
|
if(pmoduleObj)
|
| 3192 |
|
|
{
|
| 3193 |
|
|
delete pmoduleObj ;
|
| 3194 |
|
|
pmoduleObj = NULL ;
|
| 3195 |
|
|
qDebug() << "after readClockDescription ,There is no memory left !";
|
| 3196 |
|
|
return 1 ;
|
| 3197 |
|
|
}
|
| 3198 |
|
|
|
| 3199 |
|
|
}
|
| 3200 |
|
|
}
|
| 3201 |
|
|
else
|
| 3202 |
|
|
{
|
| 3203 |
|
|
qDebug() << "readModuleStructure:The Label module is not complete!";
|
| 3204 |
|
|
return 1 ;
|
| 3205 |
|
|
}
|
| 3206 |
|
|
}
|
| 3207 |
|
|
else if(m_ireader.isEndElement())
|
| 3208 |
|
|
{
|
| 3209 |
|
|
if(m_ireader.name() == "module")
|
| 3210 |
|
|
{
|
| 3211 |
|
|
if(1 == isModuleStructureInfoExist)
|
| 3212 |
|
|
{
|
| 3213 |
|
|
m_ireader.readNext();
|
| 3214 |
|
|
isModuleStructureInfoExist = 0 ;
|
| 3215 |
|
|
}
|
| 3216 |
|
|
else
|
| 3217 |
|
|
{
|
| 3218 |
|
|
qDebug() << "readModuleStructure:The Label File Has No endElement!" ;
|
| 3219 |
|
|
return 1 ;
|
| 3220 |
|
|
}
|
| 3221 |
|
|
}
|
| 3222 |
|
|
else if(m_ireader.name() == "FILE_INFO")
|
| 3223 |
|
|
{
|
| 3224 |
|
|
if(!isModuleStructureInfoExist)
|
| 3225 |
|
|
{
|
| 3226 |
|
|
qDebug() << "readModuleStructure:there is not file info exist!" ;
|
| 3227 |
|
|
return 1 ;
|
| 3228 |
|
|
}
|
| 3229 |
|
|
else
|
| 3230 |
|
|
{
|
| 3231 |
|
|
return 0 ;
|
| 3232 |
|
|
}
|
| 3233 |
|
|
}
|
| 3234 |
|
|
else
|
| 3235 |
|
|
{
|
| 3236 |
|
|
qDebug() << "readModuleStructure:end element is not completed";
|
| 3237 |
|
|
return 1 ;
|
| 3238 |
|
|
}
|
| 3239 |
|
|
}
|
| 3240 |
|
|
else if(m_ireader.isCharacters())
|
| 3241 |
|
|
{
|
| 3242 |
|
|
QRegExp icomExp("\\s+");
|
| 3243 |
|
|
if(icomExp.exactMatch(m_ireader.text().toString()))
|
| 3244 |
|
|
{
|
| 3245 |
|
|
m_ireader.readNext();
|
| 3246 |
|
|
}
|
| 3247 |
|
|
else
|
| 3248 |
|
|
{
|
| 3249 |
|
|
qDebug() << "readModuleStructure:the log file's format is not right!";
|
| 3250 |
|
|
return 1 ;
|
| 3251 |
|
|
}
|
| 3252 |
|
|
}
|
| 3253 |
|
|
else
|
| 3254 |
|
|
{
|
| 3255 |
|
|
qDebug() << "readModuleStructure:the log file is not right!";
|
| 3256 |
|
|
return 1 ;
|
| 3257 |
|
|
}
|
| 3258 |
|
|
}
|
| 3259 |
|
|
return 0 ;
|
| 3260 |
|
|
}
|
| 3261 |
|
|
|
| 3262 |
|
|
int EziDebugPrj::readClockDescription(char readflag, EziDebugModule* module)
|
| 3263 |
|
|
{
|
| 3264 |
|
|
bool isClockDescriptionMarkExist = 0 ;
|
| 3265 |
|
|
/*读取下一个有效的开始 标签*/
|
| 3266 |
|
|
m_ireader.readNext();
|
| 3267 |
|
|
while(!m_ireader.atEnd())
|
| 3268 |
|
|
{
|
| 3269 |
|
|
if(m_ireader.isStartElement())
|
| 3270 |
|
|
{
|
| 3271 |
|
|
if(m_ireader.name() == "clock_description")
|
| 3272 |
|
|
{
|
| 3273 |
|
|
isClockDescriptionMarkExist = 1 ;
|
| 3274 |
|
|
if(readClockStructure(readflag,module))
|
| 3275 |
|
|
{
|
| 3276 |
|
|
qDebug() << "readClockDescription: ClockStructure has some problem!";
|
| 3277 |
|
|
return 1 ;
|
| 3278 |
|
|
}
|
| 3279 |
|
|
}
|
| 3280 |
|
|
}
|
| 3281 |
|
|
else if(m_ireader.isEndElement())
|
| 3282 |
|
|
{
|
| 3283 |
|
|
if(m_ireader.name() == "clock_description")
|
| 3284 |
|
|
{
|
| 3285 |
|
|
if(1 == isClockDescriptionMarkExist)
|
| 3286 |
|
|
{
|
| 3287 |
|
|
return 0 ;
|
| 3288 |
|
|
}
|
| 3289 |
|
|
else
|
| 3290 |
|
|
{
|
| 3291 |
|
|
qDebug() << "readClockDescription:The Label clock_description Has No StartElement!" ;
|
| 3292 |
|
|
return 1 ;
|
| 3293 |
|
|
}
|
| 3294 |
|
|
}
|
| 3295 |
|
|
else
|
| 3296 |
|
|
{
|
| 3297 |
|
|
qDebug() << "readClockDescription:The Label clock_description Has No EndElement!";
|
| 3298 |
|
|
return 1 ;
|
| 3299 |
|
|
}
|
| 3300 |
|
|
}
|
| 3301 |
|
|
else if(m_ireader.isCharacters())
|
| 3302 |
|
|
{
|
| 3303 |
|
|
QRegExp icomExp("\\s+");
|
| 3304 |
|
|
if(icomExp.exactMatch(m_ireader.text().toString()))
|
| 3305 |
|
|
{
|
| 3306 |
|
|
m_ireader.readNext();
|
| 3307 |
|
|
}
|
| 3308 |
|
|
else
|
| 3309 |
|
|
{
|
| 3310 |
|
|
qDebug() << "readClockDescription:the log file's format is not right!";
|
| 3311 |
|
|
return 1 ;
|
| 3312 |
|
|
}
|
| 3313 |
|
|
}
|
| 3314 |
|
|
else
|
| 3315 |
|
|
{
|
| 3316 |
|
|
qDebug() << "readClockDescription:the log file is not right!";
|
| 3317 |
|
|
return 1 ;
|
| 3318 |
|
|
}
|
| 3319 |
|
|
}
|
| 3320 |
|
|
return 0 ;
|
| 3321 |
|
|
}
|
| 3322 |
|
|
|
| 3323 |
|
|
int EziDebugPrj::readClockStructure(char readflag, EziDebugModule* module)
|
| 3324 |
|
|
{
|
| 3325 |
|
|
// 过程中只能遇到三种类型的 xml 标签
|
| 3326 |
|
|
bool isClockStructureInfoExist = 0 ;
|
| 3327 |
|
|
int nclockStructureInfoCount = 0 ;
|
| 3328 |
|
|
/*读取下一个有效的开始 标签*/
|
| 3329 |
|
|
m_ireader.readNext();
|
| 3330 |
|
|
while(!m_ireader.atEnd())
|
| 3331 |
|
|
{
|
| 3332 |
|
|
if(m_ireader.isStartElement())
|
| 3333 |
|
|
{
|
| 3334 |
|
|
if(m_ireader.name() == "clock")
|
| 3335 |
|
|
{
|
| 3336 |
|
|
isClockStructureInfoExist = 1 ;
|
| 3337 |
|
|
nclockStructureInfoCount++ ;
|
| 3338 |
|
|
|
| 3339 |
|
|
if(m_ireader.attributes().value("clock_name").isEmpty())
|
| 3340 |
|
|
{
|
| 3341 |
|
|
return 1 ;
|
| 3342 |
|
|
}
|
| 3343 |
|
|
|
| 3344 |
|
|
if(m_ireader.attributes().value("polarity").isEmpty())
|
| 3345 |
|
|
{
|
| 3346 |
|
|
return 1 ;
|
| 3347 |
|
|
}
|
| 3348 |
|
|
|
| 3349 |
|
|
if(!(m_ireader.attributes().value("polarity").toString().toLower().compare("posedge")\
|
| 3350 |
|
|
&m_ireader.attributes().value("polarity").toString().toLower().compare("negedge")))
|
| 3351 |
|
|
{
|
| 3352 |
|
|
return 1 ;
|
| 3353 |
|
|
}
|
| 3354 |
|
|
|
| 3355 |
|
|
if(readflag & READ_MODULE_INFO)
|
| 3356 |
|
|
{
|
| 3357 |
|
|
if(module)
|
| 3358 |
|
|
{
|
| 3359 |
|
|
|
| 3360 |
|
|
QString iclockName = m_ireader.attributes().value("clock_name").toString();
|
| 3361 |
|
|
module->m_iclockMap.insert(iclockName,m_ireader.attributes().value("polarity").toString());
|
| 3362 |
|
|
}
|
| 3363 |
|
|
else
|
| 3364 |
|
|
{
|
| 3365 |
|
|
qDebug() << "readClockStructure: NULL Pointer!";
|
| 3366 |
|
|
return 1 ;
|
| 3367 |
|
|
}
|
| 3368 |
|
|
|
| 3369 |
|
|
}
|
| 3370 |
|
|
m_ireader.readNext();
|
| 3371 |
|
|
}
|
| 3372 |
|
|
else
|
| 3373 |
|
|
{
|
| 3374 |
|
|
qDebug() << "the log file is not complete!";
|
| 3375 |
|
|
return 1 ;
|
| 3376 |
|
|
}
|
| 3377 |
|
|
}
|
| 3378 |
|
|
else if(m_ireader.isEndElement())
|
| 3379 |
|
|
{
|
| 3380 |
|
|
if(m_ireader.name() == "clock")
|
| 3381 |
|
|
{
|
| 3382 |
|
|
if(1 == isClockStructureInfoExist)
|
| 3383 |
|
|
{
|
| 3384 |
|
|
m_ireader.readNext();
|
| 3385 |
|
|
isClockStructureInfoExist = 0 ;
|
| 3386 |
|
|
}
|
| 3387 |
|
|
else
|
| 3388 |
|
|
{
|
| 3389 |
|
|
qDebug() << "The Label clock Has No StartElement!" ;
|
| 3390 |
|
|
return 1 ;
|
| 3391 |
|
|
}
|
| 3392 |
|
|
}
|
| 3393 |
|
|
else if(m_ireader.name() == "clock_description")
|
| 3394 |
|
|
{
|
| 3395 |
|
|
if(!nclockStructureInfoCount)
|
| 3396 |
|
|
{
|
| 3397 |
|
|
qDebug() << "there is not clock structure info exist!" ;
|
| 3398 |
|
|
return 1 ;
|
| 3399 |
|
|
}
|
| 3400 |
|
|
else
|
| 3401 |
|
|
{
|
| 3402 |
|
|
return 0 ;
|
| 3403 |
|
|
}
|
| 3404 |
|
|
}
|
| 3405 |
|
|
else
|
| 3406 |
|
|
{
|
| 3407 |
|
|
qDebug() << "end element is not completed";
|
| 3408 |
|
|
return 1 ;
|
| 3409 |
|
|
}
|
| 3410 |
|
|
}
|
| 3411 |
|
|
else if(m_ireader.isCharacters())
|
| 3412 |
|
|
{
|
| 3413 |
|
|
QRegExp icomExp("\\s+");
|
| 3414 |
|
|
if(icomExp.exactMatch(m_ireader.text().toString()))
|
| 3415 |
|
|
{
|
| 3416 |
|
|
m_ireader.readNext();
|
| 3417 |
|
|
}
|
| 3418 |
|
|
else
|
| 3419 |
|
|
{
|
| 3420 |
|
|
qDebug() << "the log file's format is not right!";
|
| 3421 |
|
|
return 1 ;
|
| 3422 |
|
|
}
|
| 3423 |
|
|
}
|
| 3424 |
|
|
else
|
| 3425 |
|
|
{
|
| 3426 |
|
|
qDebug() << "the log file is not right!";
|
| 3427 |
|
|
return 1 ;
|
| 3428 |
|
|
}
|
| 3429 |
|
|
}
|
| 3430 |
|
|
return 0 ;
|
| 3431 |
|
|
}
|
| 3432 |
|
|
|
| 3433 |
|
|
int EziDebugPrj::readRegDescription(char readflag , EziDebugModule* module)
|
| 3434 |
|
|
{
|
| 3435 |
|
|
bool isRegDescriptionMarkExist = 0 ;
|
| 3436 |
|
|
/*读取下一个有效的开始 标签*/
|
| 3437 |
|
|
m_ireader.readNext();
|
| 3438 |
|
|
while(!m_ireader.atEnd())
|
| 3439 |
|
|
{
|
| 3440 |
|
|
if(m_ireader.isStartElement())
|
| 3441 |
|
|
{
|
| 3442 |
|
|
if(m_ireader.name() == "reg_description")
|
| 3443 |
|
|
{
|
| 3444 |
|
|
isRegDescriptionMarkExist = 1 ;
|
| 3445 |
|
|
if(readRegStructure(readflag,module))
|
| 3446 |
|
|
{
|
| 3447 |
|
|
qDebug() << "readRegDescription: readRegStructure has some problem!";
|
| 3448 |
|
|
return 1 ;
|
| 3449 |
|
|
}
|
| 3450 |
|
|
}
|
| 3451 |
|
|
}
|
| 3452 |
|
|
else if(m_ireader.isEndElement())
|
| 3453 |
|
|
{
|
| 3454 |
|
|
if(m_ireader.name() == "reg_description")
|
| 3455 |
|
|
{
|
| 3456 |
|
|
if(1 == isRegDescriptionMarkExist)
|
| 3457 |
|
|
{
|
| 3458 |
|
|
return 0 ;
|
| 3459 |
|
|
}
|
| 3460 |
|
|
else
|
| 3461 |
|
|
{
|
| 3462 |
|
|
qDebug() << "readRegDescription:The Label reg_description Has No StartElement!" ;
|
| 3463 |
|
|
return 1 ;
|
| 3464 |
|
|
}
|
| 3465 |
|
|
}
|
| 3466 |
|
|
else
|
| 3467 |
|
|
{
|
| 3468 |
|
|
qDebug() << "readRegDescription:The Label reg_description Has No EndElement!";
|
| 3469 |
|
|
return 1 ;
|
| 3470 |
|
|
}
|
| 3471 |
|
|
}
|
| 3472 |
|
|
else if(m_ireader.isCharacters())
|
| 3473 |
|
|
{
|
| 3474 |
|
|
QRegExp icomExp("\\s+");
|
| 3475 |
|
|
if(icomExp.exactMatch(m_ireader.text().toString()))
|
| 3476 |
|
|
{
|
| 3477 |
|
|
m_ireader.readNext();
|
| 3478 |
|
|
}
|
| 3479 |
|
|
else
|
| 3480 |
|
|
{
|
| 3481 |
|
|
qDebug() << "readClockDescription:the log file's format is not right!";
|
| 3482 |
|
|
return 1 ;
|
| 3483 |
|
|
}
|
| 3484 |
|
|
}
|
| 3485 |
|
|
else
|
| 3486 |
|
|
{
|
| 3487 |
|
|
qDebug() << "readClockDescription:the log file is not right!";
|
| 3488 |
|
|
return 1 ;
|
| 3489 |
|
|
}
|
| 3490 |
|
|
}
|
| 3491 |
|
|
return 0 ;
|
| 3492 |
|
|
}
|
| 3493 |
|
|
|
| 3494 |
|
|
int EziDebugPrj::readRegStructure(char readflag , EziDebugModule* module)
|
| 3495 |
|
|
{
|
| 3496 |
|
|
// 过程中只能遇到三种类型的 xml 标签
|
| 3497 |
|
|
bool isRegStructureInfoExist = 0 ;
|
| 3498 |
|
|
int nregStructureInfoCount = 0 ;
|
| 3499 |
|
|
/*读取下一个有效的开始 标签*/
|
| 3500 |
|
|
m_ireader.readNext();
|
| 3501 |
|
|
while(!m_ireader.atEnd())
|
| 3502 |
|
|
{
|
| 3503 |
|
|
if(m_ireader.isStartElement())
|
| 3504 |
|
|
{
|
| 3505 |
|
|
if(m_ireader.name() == "reg")
|
| 3506 |
|
|
{
|
| 3507 |
|
|
isRegStructureInfoExist = 1 ;
|
| 3508 |
|
|
nregStructureInfoCount++ ;
|
| 3509 |
|
|
|
| 3510 |
|
|
if(m_ireader.attributes().value("module_name").isEmpty())
|
| 3511 |
|
|
{
|
| 3512 |
|
|
return 1 ;
|
| 3513 |
|
|
}
|
| 3514 |
|
|
|
| 3515 |
|
|
if(m_ireader.attributes().value("locate_clock").isEmpty())
|
| 3516 |
|
|
{
|
| 3517 |
|
|
return 1 ;
|
| 3518 |
|
|
}
|
| 3519 |
|
|
|
| 3520 |
|
|
if(m_ireader.attributes().value("reg_name").isEmpty())
|
| 3521 |
|
|
{
|
| 3522 |
|
|
return 1 ;
|
| 3523 |
|
|
}
|
| 3524 |
|
|
|
| 3525 |
|
|
if(m_ireader.attributes().value("bitwidth").isEmpty())
|
| 3526 |
|
|
{
|
| 3527 |
|
|
return 1 ;
|
| 3528 |
|
|
}
|
| 3529 |
|
|
|
| 3530 |
|
|
if(m_ireader.attributes().value("regnum").isEmpty())
|
| 3531 |
|
|
{
|
| 3532 |
|
|
return 1 ;
|
| 3533 |
|
|
}
|
| 3534 |
|
|
|
| 3535 |
|
|
if(m_ireader.attributes().value("endian").isEmpty())
|
| 3536 |
|
|
{
|
| 3537 |
|
|
return 1 ;
|
| 3538 |
|
|
}
|
| 3539 |
|
|
|
| 3540 |
|
|
if(!(m_ireader.attributes().value("endian").toString().toLower().compare("little")\
|
| 3541 |
|
|
&m_ireader.attributes().value("endian").toString().toLower().compare("big")))
|
| 3542 |
|
|
{
|
| 3543 |
|
|
return 1 ;
|
| 3544 |
|
|
}
|
| 3545 |
|
|
|
| 3546 |
|
|
if(readflag & READ_MODULE_INFO)
|
| 3547 |
|
|
{
|
| 3548 |
|
|
if(module)
|
| 3549 |
|
|
{
|
| 3550 |
|
|
EziDebugModule::RegStructure * preg= new EziDebugModule::RegStructure ;
|
| 3551 |
|
|
// preg->m_isEndian = static_cast<bool>(m_ireader.attributes().value("endian").toString().toLower().compare("little"));
|
| 3552 |
|
|
|
| 3553 |
|
|
memcpy(preg->m_pMouduleName,m_ireader.attributes().value("module_name").toString().toAscii().data(),sizeof(preg->m_pMouduleName));
|
| 3554 |
|
|
memcpy(preg->m_pRegName,m_ireader.attributes().value("reg_name").toString().toAscii().data(),sizeof(preg->m_pRegName));
|
| 3555 |
|
|
|
| 3556 |
|
|
// preg->m_unBitWidth = m_ireader.attributes().value("bitwidth").toString().toInt();
|
| 3557 |
|
|
preg->m_unRegNum = m_ireader.attributes().value("regnum").toString().toInt();
|
| 3558 |
|
|
QString iclockName = m_ireader.attributes().value("locate_clock").toString();
|
| 3559 |
|
|
QVector<EziDebugModule::RegStructure*> iregStructureVec = module->m_iregMap.value(iclockName) ;
|
| 3560 |
|
|
iregStructureVec.append(preg);
|
| 3561 |
|
|
module->m_iregMap.insert(iclockName,iregStructureVec);
|
| 3562 |
|
|
}
|
| 3563 |
|
|
else
|
| 3564 |
|
|
{
|
| 3565 |
|
|
qDebug() << "readRegStructure: NULL Pointer!";
|
| 3566 |
|
|
return 1 ;
|
| 3567 |
|
|
}
|
| 3568 |
|
|
}
|
| 3569 |
|
|
m_ireader.readNext();
|
| 3570 |
|
|
}
|
| 3571 |
|
|
else
|
| 3572 |
|
|
{
|
| 3573 |
|
|
qDebug() << "readRegStructure: the log file is not complete!(There is no reg)";
|
| 3574 |
|
|
return 1 ;
|
| 3575 |
|
|
}
|
| 3576 |
|
|
}
|
| 3577 |
|
|
else if(m_ireader.isEndElement())
|
| 3578 |
|
|
{
|
| 3579 |
|
|
if(m_ireader.name() == "reg")
|
| 3580 |
|
|
{
|
| 3581 |
|
|
if(1 == isRegStructureInfoExist)
|
| 3582 |
|
|
{
|
| 3583 |
|
|
m_ireader.readNext();
|
| 3584 |
|
|
isRegStructureInfoExist = 0 ;
|
| 3585 |
|
|
}
|
| 3586 |
|
|
else
|
| 3587 |
|
|
{
|
| 3588 |
|
|
qDebug() << "The Label reg Has No StartElement!" ;
|
| 3589 |
|
|
return 1 ;
|
| 3590 |
|
|
}
|
| 3591 |
|
|
}
|
| 3592 |
|
|
else if(m_ireader.name() == "reg_description")
|
| 3593 |
|
|
{
|
| 3594 |
|
|
if(!nregStructureInfoCount)
|
| 3595 |
|
|
{
|
| 3596 |
|
|
qDebug() << "there is not reg structure info exist!" ;
|
| 3597 |
|
|
return 1 ;
|
| 3598 |
|
|
}
|
| 3599 |
|
|
else
|
| 3600 |
|
|
{
|
| 3601 |
|
|
return 0 ;
|
| 3602 |
|
|
}
|
| 3603 |
|
|
}
|
| 3604 |
|
|
else
|
| 3605 |
|
|
{
|
| 3606 |
|
|
qDebug() << "end element is not completed";
|
| 3607 |
|
|
return 1 ;
|
| 3608 |
|
|
}
|
| 3609 |
|
|
}
|
| 3610 |
|
|
else if(m_ireader.isCharacters())
|
| 3611 |
|
|
{
|
| 3612 |
|
|
QRegExp icomExp("\\s+");
|
| 3613 |
|
|
if(icomExp.exactMatch(m_ireader.text().toString()))
|
| 3614 |
|
|
{
|
| 3615 |
|
|
m_ireader.readNext();
|
| 3616 |
|
|
}
|
| 3617 |
|
|
else
|
| 3618 |
|
|
{
|
| 3619 |
|
|
qDebug() << "the log file's format is not right!";
|
| 3620 |
|
|
return 1 ;
|
| 3621 |
|
|
}
|
| 3622 |
|
|
}
|
| 3623 |
|
|
else
|
| 3624 |
|
|
{
|
| 3625 |
|
|
qDebug() << "the log file is not right!";
|
| 3626 |
|
|
return 1 ;
|
| 3627 |
|
|
}
|
| 3628 |
|
|
}
|
| 3629 |
|
|
return 0 ;
|
| 3630 |
|
|
}
|
| 3631 |
|
|
|
| 3632 |
|
|
|
| 3633 |
|
|
int EziDebugPrj::readPortDescription(char readflag , EziDebugModule* module)
|
| 3634 |
|
|
{
|
| 3635 |
|
|
bool isPortDescriptionMarkExist = 0 ;
|
| 3636 |
|
|
/*读取下一个有效的开始 标签*/
|
| 3637 |
|
|
m_ireader.readNext();
|
| 3638 |
|
|
while(!m_ireader.atEnd())
|
| 3639 |
|
|
{
|
| 3640 |
|
|
if(m_ireader.isStartElement())
|
| 3641 |
|
|
{
|
| 3642 |
|
|
if(m_ireader.name() == "port_description")
|
| 3643 |
|
|
{
|
| 3644 |
|
|
isPortDescriptionMarkExist = 1 ;
|
| 3645 |
|
|
if(readPortStructure(readflag,module))
|
| 3646 |
|
|
{
|
| 3647 |
|
|
qDebug() << "readPortDescription: readPortStructure has some problem!";
|
| 3648 |
|
|
return 1 ;
|
| 3649 |
|
|
}
|
| 3650 |
|
|
}
|
| 3651 |
|
|
}
|
| 3652 |
|
|
else if(m_ireader.isEndElement())
|
| 3653 |
|
|
{
|
| 3654 |
|
|
if(m_ireader.name() == "port_description")
|
| 3655 |
|
|
{
|
| 3656 |
|
|
if(1 == isPortDescriptionMarkExist)
|
| 3657 |
|
|
{
|
| 3658 |
|
|
return 0 ;
|
| 3659 |
|
|
}
|
| 3660 |
|
|
else
|
| 3661 |
|
|
{
|
| 3662 |
|
|
qDebug() << "readPortDescription:The Label port_description Has No StartElement!" ;
|
| 3663 |
|
|
return 1 ;
|
| 3664 |
|
|
}
|
| 3665 |
|
|
}
|
| 3666 |
|
|
else
|
| 3667 |
|
|
{
|
| 3668 |
|
|
qDebug() << "readPortDescription:The Label port_description Has No EndElement!";
|
| 3669 |
|
|
return 1 ;
|
| 3670 |
|
|
}
|
| 3671 |
|
|
}
|
| 3672 |
|
|
else if(m_ireader.isCharacters())
|
| 3673 |
|
|
{
|
| 3674 |
|
|
QRegExp icomExp("\\s+");
|
| 3675 |
|
|
if(icomExp.exactMatch(m_ireader.text().toString()))
|
| 3676 |
|
|
{
|
| 3677 |
|
|
m_ireader.readNext();
|
| 3678 |
|
|
}
|
| 3679 |
|
|
else
|
| 3680 |
|
|
{
|
| 3681 |
|
|
qDebug() << "readPortDescription:the log file's format is not right!";
|
| 3682 |
|
|
return 1 ;
|
| 3683 |
|
|
}
|
| 3684 |
|
|
}
|
| 3685 |
|
|
else
|
| 3686 |
|
|
{
|
| 3687 |
|
|
qDebug() << "readPortDescription:the log file is not right!";
|
| 3688 |
|
|
return 1 ;
|
| 3689 |
|
|
}
|
| 3690 |
|
|
}
|
| 3691 |
|
|
return 0 ;
|
| 3692 |
|
|
}
|
| 3693 |
|
|
|
| 3694 |
|
|
int EziDebugPrj::readPortStructure(char readflag , EziDebugModule* module)
|
| 3695 |
|
|
{
|
| 3696 |
|
|
// 过程中只能遇到三种类型的 xml 标签
|
| 3697 |
|
|
bool isPortStructureInfoExist = 0 ;
|
| 3698 |
|
|
int nPortStructureInfoCount = 0 ;
|
| 3699 |
|
|
/*读取下一个有效的开始 标签*/
|
| 3700 |
|
|
m_ireader.readNext();
|
| 3701 |
|
|
while(!m_ireader.atEnd())
|
| 3702 |
|
|
{
|
| 3703 |
|
|
if(m_ireader.isStartElement())
|
| 3704 |
|
|
{
|
| 3705 |
|
|
if(m_ireader.name() == "reg")
|
| 3706 |
|
|
{
|
| 3707 |
|
|
isPortStructureInfoExist = 1 ;
|
| 3708 |
|
|
nPortStructureInfoCount++ ;
|
| 3709 |
|
|
|
| 3710 |
|
|
if(m_ireader.attributes().value("port_name").isEmpty())
|
| 3711 |
|
|
{
|
| 3712 |
|
|
return 1 ;
|
| 3713 |
|
|
}
|
| 3714 |
|
|
|
| 3715 |
|
|
if(m_ireader.attributes().value("module_name").isEmpty())
|
| 3716 |
|
|
{
|
| 3717 |
|
|
return 1 ;
|
| 3718 |
|
|
}
|
| 3719 |
|
|
|
| 3720 |
|
|
if(m_ireader.attributes().value("direction_type").isEmpty())
|
| 3721 |
|
|
{
|
| 3722 |
|
|
return 1 ;
|
| 3723 |
|
|
}
|
| 3724 |
|
|
|
| 3725 |
|
|
if(m_ireader.attributes().value("bitwidth").isEmpty())
|
| 3726 |
|
|
{
|
| 3727 |
|
|
return 1 ;
|
| 3728 |
|
|
}
|
| 3729 |
|
|
|
| 3730 |
|
|
if(m_ireader.attributes().value("endian").isEmpty())
|
| 3731 |
|
|
{
|
| 3732 |
|
|
return 1 ;
|
| 3733 |
|
|
}
|
| 3734 |
|
|
|
| 3735 |
|
|
if(!(m_ireader.attributes().value("endian").toString().toLower().compare("little")\
|
| 3736 |
|
|
&m_ireader.attributes().value("endian").toString().toLower().compare("big")))
|
| 3737 |
|
|
{
|
| 3738 |
|
|
return 1 ;
|
| 3739 |
|
|
}
|
| 3740 |
|
|
|
| 3741 |
|
|
if(!(m_ireader.attributes().value("direction_type").toString().toLower().compare("in")\
|
| 3742 |
|
|
&m_ireader.attributes().value("direction_type").toString().toLower().compare("out")))
|
| 3743 |
|
|
{
|
| 3744 |
|
|
return 1 ;
|
| 3745 |
|
|
}
|
| 3746 |
|
|
|
| 3747 |
|
|
if(readflag & READ_MODULE_INFO)
|
| 3748 |
|
|
{
|
| 3749 |
|
|
if(module)
|
| 3750 |
|
|
{
|
| 3751 |
|
|
EziDebugModule::PortStructure * pport= new EziDebugModule::PortStructure ;
|
| 3752 |
|
|
// pport->m_isEndian = static_cast<bool>(m_ireader.attributes().value("endian").toString().toLower().compare("little"));
|
| 3753 |
|
|
|
| 3754 |
|
|
//pport->m_pModuleName = m_ireader.attributes().value("module_name").toString().toAscii().data();
|
| 3755 |
|
|
memcpy(pport->m_pModuleName,m_ireader.attributes().value("module_name").toString().toAscii().data(),m_ireader.attributes().value("module_name").size()+1);
|
| 3756 |
|
|
|
| 3757 |
|
|
if(m_ireader.attributes().value("direction_type").toString().toLower() == "in")
|
| 3758 |
|
|
{
|
| 3759 |
|
|
pport->eDirectionType = EziDebugModule::directionTypeInput ;
|
| 3760 |
|
|
}
|
| 3761 |
|
|
else if(m_ireader.attributes().value("direction_type").toString().toLower() == "out")
|
| 3762 |
|
|
{
|
| 3763 |
|
|
pport->eDirectionType = EziDebugModule::directionTypeInput ;
|
| 3764 |
|
|
}
|
| 3765 |
|
|
else
|
| 3766 |
|
|
{
|
| 3767 |
|
|
delete pport ;
|
| 3768 |
|
|
return 1 ;
|
| 3769 |
|
|
}
|
| 3770 |
|
|
pport->m_unBitwidth = m_ireader.attributes().value("bitwidth").toString().toInt();
|
| 3771 |
|
|
//pport->m_pPortName = m_ireader.attributes().value("regnum").toString().toAscii().data();
|
| 3772 |
|
|
memcpy(pport->m_pPortName,m_ireader.attributes().value("regnum").toString().toAscii().data(),m_ireader.attributes().value("regnum").size()+1);
|
| 3773 |
|
|
|
| 3774 |
|
|
if(pport)
|
| 3775 |
|
|
{
|
| 3776 |
|
|
module->m_iportVec.append(pport);
|
| 3777 |
|
|
}
|
| 3778 |
|
|
else
|
| 3779 |
|
|
{
|
| 3780 |
|
|
return 1 ;
|
| 3781 |
|
|
}
|
| 3782 |
|
|
}
|
| 3783 |
|
|
else
|
| 3784 |
|
|
{
|
| 3785 |
|
|
qDebug() << "readPortStructure: NULL Pointer!";
|
| 3786 |
|
|
return 1 ;
|
| 3787 |
|
|
}
|
| 3788 |
|
|
}
|
| 3789 |
|
|
m_ireader.readNext();
|
| 3790 |
|
|
}
|
| 3791 |
|
|
else
|
| 3792 |
|
|
{
|
| 3793 |
|
|
qDebug() << "readPortStructure: the log file is not complete!(There is no reg)";
|
| 3794 |
|
|
return 1 ;
|
| 3795 |
|
|
}
|
| 3796 |
|
|
}
|
| 3797 |
|
|
else if(m_ireader.isEndElement())
|
| 3798 |
|
|
{
|
| 3799 |
|
|
if(m_ireader.name() == "port")
|
| 3800 |
|
|
{
|
| 3801 |
|
|
if(1 == isPortStructureInfoExist)
|
| 3802 |
|
|
{
|
| 3803 |
|
|
m_ireader.readNext();
|
| 3804 |
|
|
isPortStructureInfoExist = 0 ;
|
| 3805 |
|
|
}
|
| 3806 |
|
|
else
|
| 3807 |
|
|
{
|
| 3808 |
|
|
qDebug() << "The Label port Has No StartElement!" ;
|
| 3809 |
|
|
return 1 ;
|
| 3810 |
|
|
}
|
| 3811 |
|
|
}
|
| 3812 |
|
|
else if(m_ireader.name() == "port_description")
|
| 3813 |
|
|
{
|
| 3814 |
|
|
if(!nPortStructureInfoCount)
|
| 3815 |
|
|
{
|
| 3816 |
|
|
qDebug() << "there is not port structure info exist!" ;
|
| 3817 |
|
|
return 1 ;
|
| 3818 |
|
|
}
|
| 3819 |
|
|
else
|
| 3820 |
|
|
{
|
| 3821 |
|
|
return 0 ;
|
| 3822 |
|
|
}
|
| 3823 |
|
|
}
|
| 3824 |
|
|
else
|
| 3825 |
|
|
{
|
| 3826 |
|
|
qDebug() << "end element is not completed";
|
| 3827 |
|
|
return 1 ;
|
| 3828 |
|
|
}
|
| 3829 |
|
|
}
|
| 3830 |
|
|
else if(m_ireader.isCharacters())
|
| 3831 |
|
|
{
|
| 3832 |
|
|
QRegExp icomExp("\\s+");
|
| 3833 |
|
|
if(icomExp.exactMatch(m_ireader.text().toString()))
|
| 3834 |
|
|
{
|
| 3835 |
|
|
m_ireader.readNext();
|
| 3836 |
|
|
}
|
| 3837 |
|
|
else
|
| 3838 |
|
|
{
|
| 3839 |
|
|
qDebug() << "the log file's format is not right!";
|
| 3840 |
|
|
return 1 ;
|
| 3841 |
|
|
}
|
| 3842 |
|
|
}
|
| 3843 |
|
|
else
|
| 3844 |
|
|
{
|
| 3845 |
|
|
qDebug() << "the log file is not right!";
|
| 3846 |
|
|
return 1 ;
|
| 3847 |
|
|
}
|
| 3848 |
|
|
}
|
| 3849 |
|
|
|
| 3850 |
|
|
|
| 3851 |
|
|
return 0 ;
|
| 3852 |
|
|
}
|
| 3853 |
|
|
|
| 3854 |
|
|
|
| 3855 |
|
|
int EziDebugPrj::readScanChainInfo(char readflag)
|
| 3856 |
|
|
{
|
| 3857 |
|
|
// 过程中只能遇到三种类型的 xml 标签
|
| 3858 |
|
|
QString ifileName ;
|
| 3859 |
|
|
QDateTime idateTime ;
|
| 3860 |
|
|
QDate idate ;
|
| 3861 |
|
|
QTime itime ;
|
| 3862 |
|
|
QStringList imoduleList ;
|
| 3863 |
|
|
bool isFileStructureInfoExist = 0 ;
|
| 3864 |
|
|
int nfileStructureInfoCount = 0 ;
|
| 3865 |
|
|
m_ireader.readNext();
|
| 3866 |
|
|
/*读取下一个有效的开始 标签*/
|
| 3867 |
|
|
while(!m_ireader.atEnd())
|
| 3868 |
|
|
{
|
| 3869 |
|
|
if(m_ireader.isStartElement())
|
| 3870 |
|
|
{
|
| 3871 |
|
|
if(m_ireader.name() == "file")
|
| 3872 |
|
|
{
|
| 3873 |
|
|
isFileStructureInfoExist = 1 ;
|
| 3874 |
|
|
nfileStructureInfoCount++ ;
|
| 3875 |
|
|
if(m_ireader.attributes().value("filename").isEmpty())
|
| 3876 |
|
|
{
|
| 3877 |
|
|
return 1 ;
|
| 3878 |
|
|
}
|
| 3879 |
|
|
|
| 3880 |
|
|
if(m_ireader.attributes().value("modify_date").isEmpty())
|
| 3881 |
|
|
{
|
| 3882 |
|
|
return 1 ;
|
| 3883 |
|
|
}
|
| 3884 |
|
|
|
| 3885 |
|
|
if(m_ireader.attributes().value("modify_time").isEmpty())
|
| 3886 |
|
|
{
|
| 3887 |
|
|
return 1 ;
|
| 3888 |
|
|
}
|
| 3889 |
|
|
|
| 3890 |
|
|
if(m_ireader.attributes().value("module_array").isEmpty())
|
| 3891 |
|
|
{
|
| 3892 |
|
|
return 1 ;
|
| 3893 |
|
|
}
|
| 3894 |
|
|
|
| 3895 |
|
|
ifileName = m_ireader.attributes().value("filename").toString();
|
| 3896 |
|
|
imoduleList = m_ireader.attributes().value("filename").toString().split(QRegExp("\\s+"));
|
| 3897 |
|
|
QStringList idateList = m_ireader.attributes().value("modify_date").toString().split("/") ;
|
| 3898 |
|
|
QStringList itimeList = m_ireader.attributes().value("modify_time").toString().split(":") ;
|
| 3899 |
|
|
|
| 3900 |
|
|
idate = QDate(idateList.at(2).toInt(),idateList.at(0).toInt(),idateList.at(1).toInt()) ;
|
| 3901 |
|
|
itime = QTime(itimeList.at(0).toInt(),itimeList.at(1).toInt(),itimeList.at(2).toInt()) ;
|
| 3902 |
|
|
|
| 3903 |
|
|
idateTime = QDateTime(idate,itime) ;
|
| 3904 |
|
|
if((ifileName.endsWith(".v",Qt::CaseSensitive))&&(readflag|READ_FILE_INFO))
|
| 3905 |
|
|
{
|
| 3906 |
|
|
/*创建文件对象指针 并加入工程对象的文件map中*/
|
| 3907 |
|
|
EziDebugVlgFile * pvlgFileObj = new EziDebugVlgFile(ifileName,idateTime,imoduleList);
|
| 3908 |
|
|
m_ivlgFileMap.insert(ifileName,pvlgFileObj);
|
| 3909 |
|
|
continue ;
|
| 3910 |
|
|
}
|
| 3911 |
|
|
else if((ifileName.endsWith(".vhd",Qt::CaseSensitive))&&(readflag|READ_FILE_INFO))
|
| 3912 |
|
|
{
|
| 3913 |
|
|
/*创建文件对象指针 并加入工程对象的文件map中*/
|
| 3914 |
|
|
EziDebugVhdlFile * pvlgFileObj = new EziDebugVhdlFile(ifileName,idateTime,imoduleList);
|
| 3915 |
|
|
m_ivhdlFileMap.insert(ifileName,pvlgFileObj);
|
| 3916 |
|
|
continue ;
|
| 3917 |
|
|
}
|
| 3918 |
|
|
else
|
| 3919 |
|
|
{
|
| 3920 |
|
|
qDebug() << "The log file format is not right(the source code file type is not right)!";
|
| 3921 |
|
|
return 1 ;
|
| 3922 |
|
|
}
|
| 3923 |
|
|
}
|
| 3924 |
|
|
else
|
| 3925 |
|
|
{
|
| 3926 |
|
|
qDebug() << "the log file is not complete!";
|
| 3927 |
|
|
return 1 ;
|
| 3928 |
|
|
}
|
| 3929 |
|
|
}
|
| 3930 |
|
|
else if(m_ireader.isEndElement())
|
| 3931 |
|
|
{
|
| 3932 |
|
|
if(m_ireader.name() == "file")
|
| 3933 |
|
|
{
|
| 3934 |
|
|
if(1 == isFileStructureInfoExist)
|
| 3935 |
|
|
{
|
| 3936 |
|
|
m_ireader.readNext();
|
| 3937 |
|
|
isFileStructureInfoExist = 0 ;
|
| 3938 |
|
|
}
|
| 3939 |
|
|
else
|
| 3940 |
|
|
{
|
| 3941 |
|
|
qDebug() << "The Label File Has No endElement!" ;
|
| 3942 |
|
|
return 1 ;
|
| 3943 |
|
|
}
|
| 3944 |
|
|
}
|
| 3945 |
|
|
else if(m_ireader.name() == "FILE_INFO")
|
| 3946 |
|
|
{
|
| 3947 |
|
|
if(!nfileStructureInfoCount)
|
| 3948 |
|
|
{
|
| 3949 |
|
|
qDebug() << "there is not file info exist!" ;
|
| 3950 |
|
|
return 1 ;
|
| 3951 |
|
|
}
|
| 3952 |
|
|
else
|
| 3953 |
|
|
{
|
| 3954 |
|
|
return 0 ;
|
| 3955 |
|
|
}
|
| 3956 |
|
|
}
|
| 3957 |
|
|
else
|
| 3958 |
|
|
{
|
| 3959 |
|
|
qDebug() << "end element is not completed";
|
| 3960 |
|
|
return 1 ;
|
| 3961 |
|
|
}
|
| 3962 |
|
|
}
|
| 3963 |
|
|
else if(m_ireader.isCharacters())
|
| 3964 |
|
|
{
|
| 3965 |
|
|
QRegExp icomExp("\\s+");
|
| 3966 |
|
|
if(icomExp.exactMatch(m_ireader.text().toString()))
|
| 3967 |
|
|
{
|
| 3968 |
|
|
m_ireader.readNext();
|
| 3969 |
|
|
}
|
| 3970 |
|
|
else
|
| 3971 |
|
|
{
|
| 3972 |
|
|
qDebug() << "the log file's format is not right!";
|
| 3973 |
|
|
return 1 ;
|
| 3974 |
|
|
}
|
| 3975 |
|
|
}
|
| 3976 |
|
|
else
|
| 3977 |
|
|
{
|
| 3978 |
|
|
qDebug() << "the log file is not right!";
|
| 3979 |
|
|
return 1 ;
|
| 3980 |
|
|
}
|
| 3981 |
|
|
}
|
| 3982 |
|
|
return 0 ;
|
| 3983 |
|
|
}
|
| 3984 |
|
|
|
| 3985 |
|
|
/*检测 log 文件 是否 OK */
|
| 3986 |
|
|
int EziDebugPrj::detectLogFile(char nreadFlag)
|
| 3987 |
|
|
{
|
| 3988 |
|
|
QFile file(m_ilogFileName);
|
| 3989 |
|
|
|
| 3990 |
|
|
#ifdef Parse_by_QXmlStreamReader
|
| 3991 |
|
|
bool isFileMarkExist = 0 ;
|
| 3992 |
|
|
#endif
|
| 3993 |
|
|
|
| 3994 |
|
|
if (!file.open(QFile::ReadOnly | QFile::Text))
|
| 3995 |
|
|
{
|
| 3996 |
|
|
qDebug() << "Error: Cannot read file " << qPrintable(m_ilogFileName) \
|
| 3997 |
|
|
<< ": " << qPrintable(file.errorString()) << __LINE__ << __FILE__;
|
| 3998 |
|
|
return 1 ;
|
| 3999 |
|
|
}
|
| 4000 |
|
|
|
| 4001 |
|
|
#ifdef Parse_by_QDom
|
| 4002 |
|
|
QString ierrorStr;
|
| 4003 |
|
|
int nerrorLine;
|
| 4004 |
|
|
int nerrorColumn;
|
| 4005 |
|
|
|
| 4006 |
|
|
QDomDocument idoc ;
|
| 4007 |
|
|
if (!idoc.setContent(&file, false, &ierrorStr, &nerrorLine,
|
| 4008 |
|
|
&nerrorColumn)) {
|
| 4009 |
|
|
qDebug() << "Error: Parse error at line " << nerrorLine << ", "
|
| 4010 |
|
|
<< "column " << nerrorColumn << ": "
|
| 4011 |
|
|
<< qPrintable(ierrorStr) ;
|
| 4012 |
|
|
return 1 ;
|
| 4013 |
|
|
}
|
| 4014 |
|
|
|
| 4015 |
|
|
QDomElement irootElement = idoc.documentElement();
|
| 4016 |
|
|
|
| 4017 |
|
|
if (irootElement.tagName() != "EziDebug")
|
| 4018 |
|
|
{
|
| 4019 |
|
|
qDebug() << "detectLogFile Error: Not a EziDebug file" ;
|
| 4020 |
|
|
return 1 ;
|
| 4021 |
|
|
}
|
| 4022 |
|
|
|
| 4023 |
|
|
if(domParseEziDebugElement(irootElement,nreadFlag))
|
| 4024 |
|
|
{
|
| 4025 |
|
|
file.close();
|
| 4026 |
|
|
return 1 ;
|
| 4027 |
|
|
}
|
| 4028 |
|
|
#endif
|
| 4029 |
|
|
|
| 4030 |
|
|
#ifdef Parse_by_QXmlStreamReader
|
| 4031 |
|
|
|
| 4032 |
|
|
m_ireader.setDevice(&file);
|
| 4033 |
|
|
m_ireader.readNext();
|
| 4034 |
|
|
|
| 4035 |
|
|
while (!m_ireader.atEnd())
|
| 4036 |
|
|
{
|
| 4037 |
|
|
if (m_ireader.isStartElement())
|
| 4038 |
|
|
{
|
| 4039 |
|
|
QStringRef ielement = m_ireader.name();
|
| 4040 |
|
|
QString ielementString = ielement.toString();
|
| 4041 |
|
|
if (ielementString == "EZIDEBUG")
|
| 4042 |
|
|
{
|
| 4043 |
|
|
isFileMarkExist = 1 ;
|
| 4044 |
|
|
|
| 4045 |
|
|
if(readFileInfo(nreadFlag))
|
| 4046 |
|
|
{
|
| 4047 |
|
|
qDebug() << "detectLogFile: encounter some problem in readFileInfo!";
|
| 4048 |
|
|
file.close();
|
| 4049 |
|
|
return 1 ;
|
| 4050 |
|
|
}
|
| 4051 |
|
|
else
|
| 4052 |
|
|
{
|
| 4053 |
|
|
if(readModuleInfo(nreadFlag))
|
| 4054 |
|
|
{
|
| 4055 |
|
|
qDebug() << "detectLogFile: encounter some problem in readModuleInfo!";
|
| 4056 |
|
|
file.close();
|
| 4057 |
|
|
return 1 ;
|
| 4058 |
|
|
}
|
| 4059 |
|
|
else
|
| 4060 |
|
|
{
|
| 4061 |
|
|
m_ireader.readNext();
|
| 4062 |
|
|
if(readScanChainInfo(nreadFlag))
|
| 4063 |
|
|
{
|
| 4064 |
|
|
qDebug() << "detectLogFile: encounter some problem in readScanChainInfo!";
|
| 4065 |
|
|
file.close();
|
| 4066 |
|
|
return 1 ;
|
| 4067 |
|
|
}
|
| 4068 |
|
|
}
|
| 4069 |
|
|
}
|
| 4070 |
|
|
}
|
| 4071 |
|
|
else if(m_ireader.isEndElement())
|
| 4072 |
|
|
{
|
| 4073 |
|
|
if(m_ireader.name() == "EZIDEBUG")
|
| 4074 |
|
|
{
|
| 4075 |
|
|
if(isFileMarkExist)
|
| 4076 |
|
|
{
|
| 4077 |
|
|
// return 0 ;
|
| 4078 |
|
|
// do nothing !
|
| 4079 |
|
|
}
|
| 4080 |
|
|
else
|
| 4081 |
|
|
{
|
| 4082 |
|
|
qDebug() << "detectLogFile: \"EZIDEBUG\" has no StartElement ";
|
| 4083 |
|
|
file.close();
|
| 4084 |
|
|
return 1 ;
|
| 4085 |
|
|
}
|
| 4086 |
|
|
}
|
| 4087 |
|
|
else
|
| 4088 |
|
|
{
|
| 4089 |
|
|
qDebug() << "detectLogFile: This Is Not a EziDebug File!";
|
| 4090 |
|
|
file.close();
|
| 4091 |
|
|
return 1 ;
|
| 4092 |
|
|
}
|
| 4093 |
|
|
}
|
| 4094 |
|
|
else
|
| 4095 |
|
|
{
|
| 4096 |
|
|
m_ireader.raiseError(QObject::tr("Not a EZIDEBUG file"));
|
| 4097 |
|
|
file.close();
|
| 4098 |
|
|
return 1 ;
|
| 4099 |
|
|
}
|
| 4100 |
|
|
|
| 4101 |
|
|
}
|
| 4102 |
|
|
else if(m_ireader.isCharacters())
|
| 4103 |
|
|
{
|
| 4104 |
|
|
QRegExp icomExp("\\s+");
|
| 4105 |
|
|
if(icomExp.exactMatch(m_ireader.text().toString()))
|
| 4106 |
|
|
{
|
| 4107 |
|
|
m_ireader.readNext();
|
| 4108 |
|
|
}
|
| 4109 |
|
|
else
|
| 4110 |
|
|
{
|
| 4111 |
|
|
break ;
|
| 4112 |
|
|
}
|
| 4113 |
|
|
}
|
| 4114 |
|
|
else if(m_ireader.isStartDocument())
|
| 4115 |
|
|
{
|
| 4116 |
|
|
m_ireader.readNext();
|
| 4117 |
|
|
}
|
| 4118 |
|
|
else
|
| 4119 |
|
|
{
|
| 4120 |
|
|
qDebug() << "the saved logfile format is not right, needed to scan the whole prject again!" ;
|
| 4121 |
|
|
file.close();
|
| 4122 |
|
|
return 1 ;
|
| 4123 |
|
|
}
|
| 4124 |
|
|
}
|
| 4125 |
|
|
#endif
|
| 4126 |
|
|
file.close();
|
| 4127 |
|
|
return 0 ;
|
| 4128 |
|
|
}
|
| 4129 |
|
|
|
| 4130 |
|
|
int EziDebugPrj::updatePrjAllFile(const QStringList& addfilelist,const QStringList& delfilelist,const QStringList& chgfilelist,QList<LOG_FILE_INFO*>& addinfolist , QList<LOG_FILE_INFO*> &deleteinfolist ,bool updateFlag)
|
| 4131 |
|
|
{
|
| 4132 |
|
|
int i = 0 ;
|
| 4133 |
|
|
QStringList ifileList ;
|
| 4134 |
|
|
ifileList = delfilelist ;
|
| 4135 |
|
|
/*获取删除的文件信息*/
|
| 4136 |
|
|
/*找到相应的文件对象,删除有关的结构,然后释放对象指针*/
|
| 4137 |
|
|
for(; i < ifileList.count(); i++)
|
| 4138 |
|
|
{
|
| 4139 |
|
|
|
| 4140 |
|
|
eliminateFile(ifileList.at(i),deleteinfolist);
|
| 4141 |
|
|
preupdateProgressBar(updateFlag,(10+(i/ifileList.count())*10));
|
| 4142 |
|
|
|
| 4143 |
|
|
}
|
| 4144 |
|
|
ifileList.clear();
|
| 4145 |
|
|
ifileList = addfilelist ;
|
| 4146 |
|
|
/*获取增加的文件信息*/
|
| 4147 |
|
|
/*扫描新添加的文件、创建文件对象指针、加入相应的结构*/
|
| 4148 |
|
|
for(i = 0 ; i < ifileList.count() ; i++)
|
| 4149 |
|
|
{
|
| 4150 |
|
|
preupdateProgressBar(updateFlag,(20+(i/ifileList.count())*15));
|
| 4151 |
|
|
|
| 4152 |
|
|
if(addFile(ifileList.at(i),partScanType,addinfolist))
|
| 4153 |
4 |
EziDebug |
{
|
| 4154 |
|
|
#if 0
|
| 4155 |
2 |
EziDebug |
QMessageBox::StandardButton rb = QMessageBox::question(NULL, tr("扫描文件错误"), tr("是否继续扫描?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
| 4156 |
4 |
EziDebug |
#else
|
| 4157 |
|
|
QMessageBox::StandardButton rb = QMessageBox::question(NULL, tr("EziDebug"), tr("Scan file Error , do you want to continue to scan file ?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
| 4158 |
|
|
#endif
|
| 4159 |
|
|
|
| 4160 |
2 |
EziDebug |
if(rb == QMessageBox::Yes)
|
| 4161 |
|
|
{
|
| 4162 |
|
|
++i;
|
| 4163 |
|
|
continue ;
|
| 4164 |
|
|
}
|
| 4165 |
|
|
else
|
| 4166 |
|
|
{
|
| 4167 |
|
|
return 1 ;
|
| 4168 |
|
|
}
|
| 4169 |
|
|
}
|
| 4170 |
|
|
}
|
| 4171 |
|
|
|
| 4172 |
|
|
ifileList.clear();
|
| 4173 |
|
|
ifileList = chgfilelist ;
|
| 4174 |
|
|
/*获取更改的文件信息*/
|
| 4175 |
|
|
/*扫描被更改的文件、创建文件对象指针、加入相应的结构 */
|
| 4176 |
|
|
for(i = 0 ; i < ifileList.count() ; i++)
|
| 4177 |
|
|
{
|
| 4178 |
|
|
QString irelativeFileName = ifileList.at(i);
|
| 4179 |
|
|
if(ifileList.at(i).endsWith(".v"))
|
| 4180 |
|
|
{
|
| 4181 |
|
|
EziDebugVlgFile* pfile = m_ivlgFileMap.value(ifileList.at(i)) ;
|
| 4182 |
|
|
|
| 4183 |
|
|
preupdateProgressBar(updateFlag,(35+(i/ifileList.count())*15));
|
| 4184 |
|
|
|
| 4185 |
|
|
if(!pfile->scanFile(this,partScanType,addinfolist,deleteinfolist))
|
| 4186 |
|
|
{
|
| 4187 |
|
|
// 文件被修改了 需要重新保存文件日期
|
| 4188 |
|
|
LOG_FILE_INFO* pdelFileInfo = new LOG_FILE_INFO ;
|
| 4189 |
|
|
pdelFileInfo->etype = infoTypeFileInfo ;
|
| 4190 |
|
|
pdelFileInfo->pinfo = NULL ;
|
| 4191 |
|
|
memcpy(pdelFileInfo->ainfoName , irelativeFileName.toAscii().data() , irelativeFileName.size()+1);
|
| 4192 |
|
|
deleteinfolist.append(pdelFileInfo);
|
| 4193 |
|
|
|
| 4194 |
|
|
struct LOG_FILE_INFO* paddFileInfo = new LOG_FILE_INFO ;
|
| 4195 |
|
|
paddFileInfo->etype = infoTypeFileInfo ;
|
| 4196 |
|
|
paddFileInfo->pinfo = pfile ;
|
| 4197 |
|
|
memcpy(paddFileInfo->ainfoName , irelativeFileName.toAscii().data(), irelativeFileName.size()+1);
|
| 4198 |
|
|
addinfolist.append(paddFileInfo);
|
| 4199 |
|
|
}
|
| 4200 |
|
|
else
|
| 4201 |
|
|
{
|
| 4202 |
|
|
// 如果出错 ,提示是否继续扫描
|
| 4203 |
4 |
EziDebug |
#if 0
|
| 4204 |
2 |
EziDebug |
QMessageBox::StandardButton rb = QMessageBox::question(NULL, tr("扫描文件错误"), tr("是否继续扫描?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
| 4205 |
4 |
EziDebug |
#else
|
| 4206 |
|
|
QMessageBox::StandardButton rb = QMessageBox::question(NULL, tr("EziDebug"), tr("Scan file Error , do you want to continue to scan file ?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
| 4207 |
|
|
#endif
|
| 4208 |
|
|
|
| 4209 |
2 |
EziDebug |
if(rb == QMessageBox::Yes)
|
| 4210 |
|
|
{
|
| 4211 |
|
|
++i;
|
| 4212 |
|
|
continue ;
|
| 4213 |
|
|
}
|
| 4214 |
|
|
else
|
| 4215 |
|
|
{
|
| 4216 |
|
|
return 1 ;
|
| 4217 |
|
|
}
|
| 4218 |
|
|
}
|
| 4219 |
|
|
}
|
| 4220 |
|
|
else if(ifileList.at(i).endsWith(".vhd"))
|
| 4221 |
|
|
{
|
| 4222 |
|
|
EziDebugVhdlFile* pfile = m_ivhdlFileMap.value(ifileList.at(i)) ;
|
| 4223 |
|
|
// if(!pfile->scanFile(currentPrj,EziDebugPrj::partScanType,iaddedinfoList,ideletedinfoList))
|
| 4224 |
|
|
// {
|
| 4225 |
|
|
|
| 4226 |
|
|
// }
|
| 4227 |
|
|
// else
|
| 4228 |
|
|
// {
|
| 4229 |
|
|
// // 如果出错 ,提示是否继续扫描
|
| 4230 |
|
|
// }
|
| 4231 |
|
|
}
|
| 4232 |
|
|
else
|
| 4233 |
|
|
{
|
| 4234 |
|
|
|
| 4235 |
|
|
}
|
| 4236 |
|
|
}
|
| 4237 |
|
|
return 0 ;
|
| 4238 |
|
|
}
|
| 4239 |
|
|
|
| 4240 |
|
|
void EziDebugPrj::preupdateProgressBar(bool updateflag ,int value)
|
| 4241 |
|
|
{
|
| 4242 |
|
|
if(updateflag)
|
| 4243 |
|
|
{
|
| 4244 |
|
|
emit updateProgressBar(value);
|
| 4245 |
|
|
}
|
| 4246 |
|
|
}
|
| 4247 |
|
|
|
| 4248 |
|
|
void EziDebugPrj::compareFileList(const QStringList& newfilelist,QStringList& addFileList,QStringList &delFileList,QStringList &chgFileList)
|
| 4249 |
|
|
{
|
| 4250 |
|
|
std::list<QString> ideletedFileList(m_iCodefileNameList.count()) ;
|
| 4251 |
|
|
std::list<QString> iidenticalFileList(m_iCodefileNameList.count()) ;
|
| 4252 |
|
|
std::list<QString> iaddedFileList(m_iCodefileNameList.count()) ;
|
| 4253 |
|
|
|
| 4254 |
|
|
std::list<QString>::iterator ioutDelIterator = ideletedFileList.begin() ;
|
| 4255 |
|
|
std::list<QString>::iterator ioutIdenticalIterator = iidenticalFileList.begin() ;
|
| 4256 |
|
|
std::list<QString>::iterator ioutAddIterator = iaddedFileList.begin() ;
|
| 4257 |
|
|
|
| 4258 |
|
|
//newfilelist.sort();
|
| 4259 |
|
|
QStringList::const_iterator ifirstBeginIterator = newfilelist.begin() ;
|
| 4260 |
|
|
QStringList::const_iterator ifirstEndIterator = newfilelist.end() ;
|
| 4261 |
|
|
|
| 4262 |
|
|
m_iCodefileNameList.sort();
|
| 4263 |
|
|
QStringList::Iterator iSecondBeginIterator = m_iCodefileNameList.begin() ;
|
| 4264 |
|
|
QStringList::Iterator iSecondEndIterator = m_iCodefileNameList.end() ;
|
| 4265 |
|
|
|
| 4266 |
|
|
// ifirstBeginIterator 最新文件列表 iSecondBeginIterator 旧的文件列表
|
| 4267 |
|
|
std::set_difference(ifirstBeginIterator,ifirstEndIterator,iSecondBeginIterator,iSecondEndIterator,ioutDelIterator);
|
| 4268 |
|
|
|
| 4269 |
|
|
addFileList = QList<QString>::fromStdList(ideletedFileList) ;
|
| 4270 |
|
|
addFileList = delFileList.filter(QRegExp(QObject::tr(".+"))) ;
|
| 4271 |
|
|
|
| 4272 |
|
|
|
| 4273 |
|
|
std::set_difference(iSecondBeginIterator,iSecondEndIterator,ifirstBeginIterator,ifirstEndIterator,ioutAddIterator);
|
| 4274 |
|
|
delFileList = QList<QString>::fromStdList(iaddedFileList);
|
| 4275 |
|
|
delFileList = addFileList.filter(QRegExp(QObject::tr(".+"))) ;
|
| 4276 |
|
|
|
| 4277 |
|
|
|
| 4278 |
|
|
std::set_intersection(ifirstBeginIterator,ifirstEndIterator,iSecondBeginIterator,iSecondEndIterator,ioutIdenticalIterator);
|
| 4279 |
|
|
|
| 4280 |
|
|
ioutIdenticalIterator = iidenticalFileList.begin() ;
|
| 4281 |
|
|
while(ioutIdenticalIterator != iidenticalFileList.end())
|
| 4282 |
|
|
{
|
| 4283 |
|
|
QFileInfo itempFileInfo(m_iprjPath,*ioutIdenticalIterator);
|
| 4284 |
|
|
QDateTime idateTime = itempFileInfo.lastModified() ;
|
| 4285 |
|
|
|
| 4286 |
|
|
|
| 4287 |
|
|
if((*ioutIdenticalIterator).endsWith(".v"))
|
| 4288 |
|
|
{
|
| 4289 |
|
|
QDateTime ilastDateTime = m_ivlgFileMap.value(*ioutIdenticalIterator)->getLastStoredTime();
|
| 4290 |
|
|
if(idateTime.toString("dd.MM.yyyy hh:mm:ss") != ilastDateTime.toString("dd.MM.yyyy hh:mm:ss"))
|
| 4291 |
|
|
{
|
| 4292 |
|
|
qDebug() << idateTime << ilastDateTime ;
|
| 4293 |
|
|
chgFileList.append(*ioutIdenticalIterator);
|
| 4294 |
|
|
}
|
| 4295 |
|
|
}
|
| 4296 |
|
|
else if((*ioutIdenticalIterator).endsWith(".vhd"))
|
| 4297 |
|
|
{
|
| 4298 |
|
|
QDateTime ilastDateTime = m_ivhdlFileMap.value(*ioutIdenticalIterator)->getLastStoredTime();
|
| 4299 |
|
|
if(idateTime != ilastDateTime)
|
| 4300 |
|
|
{
|
| 4301 |
|
|
chgFileList.append(*ioutIdenticalIterator);
|
| 4302 |
|
|
}
|
| 4303 |
|
|
}
|
| 4304 |
|
|
else
|
| 4305 |
|
|
{
|
| 4306 |
|
|
// do nothing
|
| 4307 |
|
|
}
|
| 4308 |
|
|
++ioutIdenticalIterator ;
|
| 4309 |
|
|
}
|
| 4310 |
|
|
|
| 4311 |
|
|
if(addFileList.count()&&delFileList.count()&&chgFileList.count())
|
| 4312 |
|
|
{
|
| 4313 |
|
|
m_isUpdated = true ;
|
| 4314 |
|
|
}
|
| 4315 |
|
|
}
|
| 4316 |
|
|
|
| 4317 |
|
|
int EziDebugPrj::domParseEziDebugElement(const QDomElement &element,char readflag)
|
| 4318 |
|
|
{
|
| 4319 |
|
|
QDomNode ichild = element.firstChild();
|
| 4320 |
|
|
bool eeziDebugFileStructureExistFlag = 0 ;
|
| 4321 |
|
|
qDebug() << "Attention: Begin to detect the log file!";
|
| 4322 |
|
|
|
| 4323 |
|
|
while(!ichild.isNull())
|
| 4324 |
|
|
{
|
| 4325 |
|
|
if(ichild.toElement().tagName() == "FILE_INFO")
|
| 4326 |
|
|
{
|
| 4327 |
|
|
eeziDebugFileStructureExistFlag |= EZIDEBUG_STRUCTURE_FILE ;
|
| 4328 |
|
|
if(domParseFileInfoElement(ichild.toElement(),readflag))
|
| 4329 |
|
|
{
|
| 4330 |
|
|
qDebug() << "domParseEziDebugElement Error: function domParseFileInfoElement return wrong!" ;
|
| 4331 |
|
|
goto Error ;
|
| 4332 |
|
|
}
|
| 4333 |
|
|
}
|
| 4334 |
|
|
else if(ichild.toElement().tagName() == "MODULE_INFO")
|
| 4335 |
|
|
{
|
| 4336 |
|
|
eeziDebugFileStructureExistFlag |= EZIDEBUG_STRUCTURE_MODULE ;
|
| 4337 |
|
|
if(domParseModuleInfoElement(ichild.toElement(),readflag))
|
| 4338 |
|
|
{
|
| 4339 |
|
|
qDebug() << "domParseEziDebugElement Error: function domParseModuleInfoElement return wrong!" ;
|
| 4340 |
|
|
goto Error ;
|
| 4341 |
|
|
}
|
| 4342 |
|
|
}
|
| 4343 |
|
|
else if(ichild.toElement().tagName() == "SCAN_CHAIN_INFO")
|
| 4344 |
|
|
{
|
| 4345 |
|
|
eeziDebugFileStructureExistFlag |= EZIDEBUG_STRUCTURE_SCAN_CHAIN ;
|
| 4346 |
|
|
if(domParseScanChainInfoElement(ichild.toElement(),readflag))
|
| 4347 |
|
|
{
|
| 4348 |
|
|
qDebug() << "domParseEziDebugElement Error: function domParseScanChainInfoElement return wrong!" ;
|
| 4349 |
|
|
goto Error ;
|
| 4350 |
|
|
}
|
| 4351 |
|
|
}
|
| 4352 |
|
|
else
|
| 4353 |
|
|
{
|
| 4354 |
|
|
qDebug() << "domParseEziDebugElement Error: There is unknown element in the EziDebug File!" ;
|
| 4355 |
|
|
goto Error ;
|
| 4356 |
|
|
}
|
| 4357 |
|
|
|
| 4358 |
|
|
ichild = ichild.nextSibling();
|
| 4359 |
|
|
}
|
| 4360 |
|
|
|
| 4361 |
|
|
if((eeziDebugFileStructureExistFlag&EZIDEBUG_STRUCTURE_ALL) == EZIDEBUG_STRUCTURE_ALL)
|
| 4362 |
|
|
{
|
| 4363 |
|
|
goto Error ;
|
| 4364 |
|
|
}
|
| 4365 |
|
|
|
| 4366 |
|
|
return 0 ;
|
| 4367 |
|
|
|
| 4368 |
|
|
Error:
|
| 4369 |
|
|
return 1 ;
|
| 4370 |
|
|
|
| 4371 |
|
|
}
|
| 4372 |
|
|
|
| 4373 |
|
|
const int &EziDebugPrj::getMaxRegNumPerChain(void) const
|
| 4374 |
|
|
{
|
| 4375 |
|
|
return m_nmaxRegNumInChain ;
|
| 4376 |
|
|
}
|
| 4377 |
|
|
|
| 4378 |
|
|
int EziDebugPrj::setToolType(TOOL tool)
|
| 4379 |
|
|
{
|
| 4380 |
|
|
if(ToolOther <= tool)
|
| 4381 |
|
|
{
|
| 4382 |
|
|
//QMessageBox::warning(0,QObject::tr("设置工具类型"),QObject::tr("确认工具是否正确"));
|
| 4383 |
|
|
|
| 4384 |
|
|
return 1 ;
|
| 4385 |
|
|
}
|
| 4386 |
|
|
m_eusedTool = tool ;
|
| 4387 |
|
|
return 0 ;
|
| 4388 |
|
|
}
|
| 4389 |
|
|
|
| 4390 |
|
|
int EziDebugPrj::setMaxRegNumPerChain(int num)
|
| 4391 |
|
|
{
|
| 4392 |
|
|
/*需要 判断 个数是否在 范围中 */
|
| 4393 |
|
|
m_nmaxRegNumInChain = num ;
|
| 4394 |
|
|
return 0 ;
|
| 4395 |
|
|
}
|
| 4396 |
|
|
|
| 4397 |
|
|
|
| 4398 |
|
|
void EziDebugPrj::setLogFileExistFlag(bool flag)
|
| 4399 |
|
|
{
|
| 4400 |
|
|
m_isLogFileExist = flag ;
|
| 4401 |
|
|
return ;
|
| 4402 |
|
|
}
|
| 4403 |
|
|
|
| 4404 |
|
|
void EziDebugPrj::setXilinxErrCheckedFlag(bool flag)
|
| 4405 |
|
|
{
|
| 4406 |
|
|
m_isDisXilinxErrChecked = flag ;
|
| 4407 |
|
|
}
|
| 4408 |
4 |
EziDebug |
|
| 4409 |
2 |
EziDebug |
void EziDebugPrj::setLogFileName(const QString& filename)
|
| 4410 |
|
|
{
|
| 4411 |
|
|
m_ilogFileName = filename ;
|
| 4412 |
|
|
return ;
|
| 4413 |
|
|
}
|
| 4414 |
|
|
|
| 4415 |
|
|
void EziDebugPrj::setMaxRegWidth(int width)
|
| 4416 |
|
|
{
|
| 4417 |
|
|
if(m_imaxRegWidth < width)
|
| 4418 |
|
|
{
|
| 4419 |
|
|
m_imaxRegWidth = width ;
|
| 4420 |
|
|
}
|
| 4421 |
|
|
}
|
| 4422 |
|
|
|
| 4423 |
|
|
void EziDebugPrj::setLogfileDestroyedFlag(bool flag)
|
| 4424 |
|
|
{
|
| 4425 |
|
|
m_isLogFileDestroyed = flag ;
|
| 4426 |
|
|
}
|
| 4427 |
|
|
|
| 4428 |
|
|
bool EziDebugPrj::getLogfileDestroyedFlag(void)
|
| 4429 |
|
|
{
|
| 4430 |
|
|
return m_isLogFileDestroyed ;
|
| 4431 |
|
|
}
|
| 4432 |
|
|
|
| 4433 |
|
|
int EziDebugPrj::parsePrjFile(QMap<QString,EziDebugVlgFile*> &vlgFileMap ,QMap<QString,EziDebugVhdlFile*> &vhdlFileMap)
|
| 4434 |
|
|
{
|
| 4435 |
|
|
m_iCodefileNameList.clear();
|
| 4436 |
|
|
if(ToolQuartus == m_eusedTool)
|
| 4437 |
|
|
{
|
| 4438 |
|
|
if(parseQuartusPrjFile(vlgFileMap,vhdlFileMap))
|
| 4439 |
|
|
{
|
| 4440 |
|
|
qDebug() << "Error:Parse Quartus PrjFile failed!" ;
|
| 4441 |
|
|
return 1 ;
|
| 4442 |
|
|
}
|
| 4443 |
|
|
}
|
| 4444 |
|
|
else if(ToolIse == m_eusedTool)
|
| 4445 |
|
|
{
|
| 4446 |
|
|
if(parseIsePrjFile(vlgFileMap,vhdlFileMap))
|
| 4447 |
|
|
{
|
| 4448 |
|
|
qDebug() << "Error:Parse ISE PrjFile failed!" ;
|
| 4449 |
|
|
return 1 ;
|
| 4450 |
|
|
}
|
| 4451 |
|
|
}
|
| 4452 |
|
|
else
|
| 4453 |
|
|
{
|
| 4454 |
|
|
qDebug() << "EziDebug is not support this sortware project file parse!";
|
| 4455 |
|
|
return 1 ;
|
| 4456 |
|
|
}
|
| 4457 |
|
|
|
| 4458 |
|
|
// QMessageBox::information(0, QObject::tr("EziDebug解析文件"),QObject::tr("可以继续试验了"));
|
| 4459 |
|
|
|
| 4460 |
|
|
return 0 ;
|
| 4461 |
|
|
}
|
| 4462 |
|
|
|
| 4463 |
|
|
void EziDebugPrj::checkDelFile(QMap<QString,EziDebugVlgFile*> &vlgFileMap , QMap<QString,EziDebugVhdlFile*> &vhdlFileMap , QList<LOG_FILE_INFO*> &deleteinfolist)
|
| 4464 |
|
|
{
|
| 4465 |
|
|
QMap<QString,EziDebugVlgFile*>::const_iterator i = m_ivlgFileMap.constBegin();
|
| 4466 |
|
|
while(i != m_ivlgFileMap.constEnd())
|
| 4467 |
|
|
{
|
| 4468 |
|
|
QString ifileName = i.key() ;
|
| 4469 |
|
|
EziDebugVlgFile* pnewFile = vlgFileMap.value(ifileName,NULL);
|
| 4470 |
|
|
if(!pnewFile)
|
| 4471 |
|
|
{
|
| 4472 |
|
|
struct LOG_FILE_INFO* pdelFileInfo = new LOG_FILE_INFO ;
|
| 4473 |
|
|
pdelFileInfo->etype = infoTypeFileInfo ;
|
| 4474 |
|
|
pdelFileInfo->pinfo = NULL ;
|
| 4475 |
|
|
memcpy(pdelFileInfo->ainfoName , ifileName.toAscii().data() , ifileName.size()+1);
|
| 4476 |
|
|
deleteinfolist.append(pdelFileInfo);
|
| 4477 |
|
|
}
|
| 4478 |
|
|
++i ;
|
| 4479 |
|
|
}
|
| 4480 |
|
|
|
| 4481 |
|
|
QMap<QString,EziDebugVhdlFile*>::const_iterator j = m_ivhdlFileMap.constBegin() ;
|
| 4482 |
|
|
while(j != m_ivhdlFileMap.constEnd())
|
| 4483 |
|
|
{
|
| 4484 |
|
|
QString ifileName = j.key() ;
|
| 4485 |
|
|
EziDebugVhdlFile* pnewFile = vhdlFileMap.value(ifileName,NULL);
|
| 4486 |
|
|
if(!pnewFile)
|
| 4487 |
|
|
{
|
| 4488 |
|
|
struct LOG_FILE_INFO* pdelFileInfo = new LOG_FILE_INFO ;
|
| 4489 |
|
|
pdelFileInfo->etype = infoTypeFileInfo ;
|
| 4490 |
|
|
pdelFileInfo->pinfo = NULL ;
|
| 4491 |
|
|
memcpy(pdelFileInfo->ainfoName , ifileName.toAscii().data() , ifileName.size()+1);
|
| 4492 |
|
|
deleteinfolist.append(pdelFileInfo);
|
| 4493 |
|
|
}
|
| 4494 |
|
|
++j ;
|
| 4495 |
|
|
}
|
| 4496 |
|
|
|
| 4497 |
|
|
}
|
| 4498 |
|
|
|
| 4499 |
|
|
void EziDebugPrj::updateFileMap(const QMap<QString,EziDebugVlgFile*> &vlgFileMap ,const QMap<QString,EziDebugVhdlFile*> &vhdlFileMap)
|
| 4500 |
|
|
{
|
| 4501 |
|
|
EziDebugVlgFile* poldVlgFile = NULL ;
|
| 4502 |
|
|
EziDebugVhdlFile* poldVhdlFile = NULL ;
|
| 4503 |
|
|
EziDebugVlgFile* pnewVlgFile = NULL ;
|
| 4504 |
|
|
EziDebugVhdlFile* pnewVhdlFile = NULL ;
|
| 4505 |
|
|
QMap<QString,EziDebugVlgFile*>::const_iterator ivlgFileIter = m_ivlgFileMap.constBegin() ;
|
| 4506 |
|
|
QMap<QString,EziDebugVhdlFile*>::const_iterator ivhdlFileIter = m_ivhdlFileMap.constBegin() ;
|
| 4507 |
|
|
|
| 4508 |
|
|
while(ivlgFileIter != m_ivlgFileMap.constEnd())
|
| 4509 |
|
|
{
|
| 4510 |
|
|
poldVlgFile = ivlgFileIter.value() ;
|
| 4511 |
|
|
delete poldVlgFile ;
|
| 4512 |
|
|
poldVlgFile = NULL ;
|
| 4513 |
|
|
++ivlgFileIter ;
|
| 4514 |
|
|
}
|
| 4515 |
|
|
m_ivlgFileMap.clear();
|
| 4516 |
|
|
|
| 4517 |
|
|
while(ivhdlFileIter != m_ivhdlFileMap.constEnd())
|
| 4518 |
|
|
{
|
| 4519 |
|
|
poldVhdlFile = ivhdlFileIter.value() ;
|
| 4520 |
|
|
delete poldVhdlFile ;
|
| 4521 |
|
|
poldVhdlFile = NULL ;
|
| 4522 |
|
|
++ivhdlFileIter ;
|
| 4523 |
|
|
}
|
| 4524 |
|
|
m_ivhdlFileMap.clear();
|
| 4525 |
|
|
|
| 4526 |
|
|
if(vlgFileMap.count()!= 0)
|
| 4527 |
|
|
{
|
| 4528 |
|
|
ivlgFileIter = vlgFileMap.constBegin();
|
| 4529 |
|
|
while(ivlgFileIter != vlgFileMap.constEnd())
|
| 4530 |
|
|
{
|
| 4531 |
|
|
pnewVlgFile = ivlgFileIter.value() ;
|
| 4532 |
|
|
m_ivlgFileMap.insert(ivlgFileIter.key() , pnewVlgFile);
|
| 4533 |
|
|
++ivlgFileIter ;
|
| 4534 |
|
|
}
|
| 4535 |
|
|
|
| 4536 |
|
|
}
|
| 4537 |
|
|
|
| 4538 |
|
|
if(vhdlFileMap.count()!= 0)
|
| 4539 |
|
|
{
|
| 4540 |
|
|
ivhdlFileIter = vhdlFileMap.constBegin();
|
| 4541 |
|
|
while(ivhdlFileIter != vhdlFileMap.constEnd())
|
| 4542 |
|
|
{
|
| 4543 |
|
|
pnewVhdlFile = ivhdlFileIter.value() ;
|
| 4544 |
|
|
m_ivhdlFileMap.insert(ivhdlFileIter.key() , pnewVhdlFile);
|
| 4545 |
|
|
++ivhdlFileIter ;
|
| 4546 |
|
|
}
|
| 4547 |
|
|
}
|
| 4548 |
|
|
}
|
| 4549 |
|
|
|
| 4550 |
|
|
int EziDebugPrj::traverseAllCodeFile(EziDebugPrj::SCAN_TYPE type , const QMap<QString,EziDebugVlgFile*> &vlgFileMap ,const QMap<QString,EziDebugVhdlFile*> &vhdlFileMap ,QList<LOG_FILE_INFO*> &addedinfoList,QList<LOG_FILE_INFO*> &deletedinfoList)
|
| 4551 |
|
|
{
|
| 4552 |
|
|
//QList<LOG_FILE_INFO*> iaddedinfoList ;
|
| 4553 |
|
|
//QList<LOG_FILE_INFO*> ideletedinfoList ;
|
| 4554 |
|
|
QString irelativeFileName ;
|
| 4555 |
|
|
EziDebugVlgFile* poldVlgFile = NULL ;
|
| 4556 |
|
|
EziDebugVhdlFile* poldVhdlFile = NULL ;
|
| 4557 |
|
|
EziDebugVlgFile* pnewVlgFile = NULL ;
|
| 4558 |
|
|
EziDebugVhdlFile* pnewVhdlFile = NULL ;
|
| 4559 |
|
|
int nfileCount = 0 ;
|
| 4560 |
|
|
|
| 4561 |
|
|
/*解析每个代码文件*/
|
| 4562 |
|
|
qDebug() << QObject::tr("EziDebug::Begin traverAllCodeFile!");
|
| 4563 |
|
|
/* 遍历 verilog 文件 获取 所有 module 信息*/
|
| 4564 |
|
|
// 15 + (i/vlgFileMap.count())*45
|
| 4565 |
|
|
if(vlgFileMap.count()!= 0)
|
| 4566 |
|
|
{
|
| 4567 |
|
|
QMap<QString,EziDebugVlgFile*>::const_iterator i = vlgFileMap.constBegin();
|
| 4568 |
|
|
while(i != vlgFileMap.constEnd())
|
| 4569 |
|
|
{
|
| 4570 |
|
|
pnewVlgFile = i.value() ;
|
| 4571 |
|
|
irelativeFileName = i.key() ;
|
| 4572 |
|
|
if(pnewVlgFile)
|
| 4573 |
|
|
{
|
| 4574 |
|
|
if(pnewVlgFile->scanFile(this,type,addedinfoList,deletedinfoList))
|
| 4575 |
|
|
{
|
| 4576 |
|
|
qDebug() << "traverseAllCodeFile:scan file failed! FILE NAME" << i.key();
|
| 4577 |
|
|
//dynamic_cast<QWidget*>(this->parent())
|
| 4578 |
4 |
EziDebug |
#if 0
|
| 4579 |
2 |
EziDebug |
QMessageBox::StandardButton rb = QMessageBox::question(NULL, tr("扫描文件错误"), tr("是否继续扫描?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
| 4580 |
4 |
EziDebug |
#else
|
| 4581 |
|
|
QMessageBox::StandardButton rb = QMessageBox::question(NULL, tr("EziDebug"), tr("Scan file Error , do you want to continue to scan file ?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
| 4582 |
|
|
#endif
|
| 4583 |
|
|
|
| 4584 |
2 |
EziDebug |
if(rb == QMessageBox::Yes)
|
| 4585 |
|
|
{
|
| 4586 |
|
|
++i;
|
| 4587 |
|
|
continue ;
|
| 4588 |
|
|
}
|
| 4589 |
|
|
else
|
| 4590 |
|
|
{
|
| 4591 |
|
|
return 1 ;
|
| 4592 |
|
|
}
|
| 4593 |
|
|
}
|
| 4594 |
|
|
else
|
| 4595 |
|
|
{
|
| 4596 |
|
|
// 已经存在 扫描文件
|
| 4597 |
|
|
if((poldVlgFile = m_ivlgFileMap.value(i.key(),NULL)))
|
| 4598 |
|
|
{
|
| 4599 |
|
|
if((poldVlgFile->getLastStoredTime() != pnewVlgFile->getLastStoredTime())\
|
| 4600 |
|
|
||(poldVlgFile->getModuleList() == pnewVlgFile->getModuleList()))
|
| 4601 |
|
|
{
|
| 4602 |
|
|
struct LOG_FILE_INFO* pdelFileInfo = new LOG_FILE_INFO ;
|
| 4603 |
|
|
pdelFileInfo->etype = infoTypeFileInfo ;
|
| 4604 |
|
|
pdelFileInfo->pinfo = NULL ;
|
| 4605 |
|
|
memcpy(pdelFileInfo->ainfoName , irelativeFileName.toAscii().data() , irelativeFileName.size()+1);
|
| 4606 |
|
|
deletedinfoList.append(pdelFileInfo);
|
| 4607 |
|
|
|
| 4608 |
|
|
// 新增文件
|
| 4609 |
|
|
struct LOG_FILE_INFO* paddFileInfo = new LOG_FILE_INFO ;
|
| 4610 |
|
|
paddFileInfo->etype = infoTypeFileInfo ;
|
| 4611 |
|
|
paddFileInfo->pinfo = pnewVlgFile ;
|
| 4612 |
|
|
memcpy(paddFileInfo->ainfoName , irelativeFileName.toAscii().data(), irelativeFileName.size()+1);
|
| 4613 |
|
|
addedinfoList.append(paddFileInfo);
|
| 4614 |
|
|
}
|
| 4615 |
|
|
// m_ivlgFileMap.remove(i.key());
|
| 4616 |
|
|
// delete poldVlgFile ;
|
| 4617 |
|
|
}
|
| 4618 |
|
|
else
|
| 4619 |
|
|
{
|
| 4620 |
|
|
// 新增文件
|
| 4621 |
|
|
struct LOG_FILE_INFO* paddFileInfo = new LOG_FILE_INFO ;
|
| 4622 |
|
|
paddFileInfo->etype = infoTypeFileInfo ;
|
| 4623 |
|
|
paddFileInfo->pinfo = pnewVlgFile ;
|
| 4624 |
|
|
memcpy(paddFileInfo->ainfoName , irelativeFileName.toAscii().data() , irelativeFileName.size()+1);
|
| 4625 |
|
|
addedinfoList.append(paddFileInfo);
|
| 4626 |
|
|
}
|
| 4627 |
|
|
// m_ivlgFileMap.insert(i.key() , pnewVlgFile);
|
| 4628 |
|
|
++i;
|
| 4629 |
|
|
emit updateProgressBar(15 + (nfileCount/vlgFileMap.count())*45);
|
| 4630 |
|
|
nfileCount++ ;
|
| 4631 |
|
|
continue ;
|
| 4632 |
|
|
}
|
| 4633 |
|
|
}
|
| 4634 |
|
|
else
|
| 4635 |
|
|
{
|
| 4636 |
|
|
qDebug() << "null fileobj pointer!";
|
| 4637 |
|
|
}
|
| 4638 |
|
|
++i;
|
| 4639 |
|
|
}
|
| 4640 |
|
|
|
| 4641 |
|
|
}
|
| 4642 |
|
|
|
| 4643 |
|
|
/* 遍历 vhdl 文件 获取 所有 module 信息*/
|
| 4644 |
|
|
if(vhdlFileMap.count() != 0)
|
| 4645 |
|
|
{
|
| 4646 |
|
|
QMap<QString,EziDebugVhdlFile*>::const_iterator i = vhdlFileMap.constBegin();
|
| 4647 |
|
|
while(i != vhdlFileMap.constEnd())
|
| 4648 |
|
|
{
|
| 4649 |
|
|
if(i.value())
|
| 4650 |
|
|
{
|
| 4651 |
|
|
//(i.value())->scanFile();
|
| 4652 |
|
|
}
|
| 4653 |
|
|
else
|
| 4654 |
|
|
{
|
| 4655 |
|
|
qDebug() << "null fileobj pointer!";
|
| 4656 |
|
|
return 1 ;
|
| 4657 |
|
|
}
|
| 4658 |
|
|
++i;
|
| 4659 |
|
|
}
|
| 4660 |
|
|
}
|
| 4661 |
|
|
|
| 4662 |
|
|
qDebug() << QObject::tr("EziDebug:: finish tranverse all code file!");
|
| 4663 |
|
|
|
| 4664 |
|
|
return 0 ;
|
| 4665 |
|
|
}
|
| 4666 |
|
|
|
| 4667 |
|
|
int EziDebugPrj::resumeDataFromFile(void)
|
| 4668 |
|
|
{
|
| 4669 |
|
|
|
| 4670 |
|
|
return 0 ;
|
| 4671 |
|
|
}
|
| 4672 |
|
|
|
| 4673 |
|
|
int EziDebugPrj::generateTreeView(void)
|
| 4674 |
|
|
{
|
| 4675 |
|
|
QStringList imoduleList ;
|
| 4676 |
|
|
QString itopModuleName = m_itopModule + QObject::tr(":")+ m_itopModule ;
|
| 4677 |
|
|
|
| 4678 |
|
|
if(!m_imoduleMap.contains(m_itopModule))
|
| 4679 |
|
|
{
|
| 4680 |
|
|
qDebug() << "EziDebug Error: There is no Topmodule definition!";
|
| 4681 |
|
|
return 1;
|
| 4682 |
|
|
}
|
| 4683 |
4 |
EziDebug |
|
| 4684 |
2 |
EziDebug |
/*根据topmodule 构造树状显示结构的数据信息*/
|
| 4685 |
|
|
// if (!m_imoduleMap.contains(m_itopModule))
|
| 4686 |
|
|
// {
|
| 4687 |
|
|
// qDebug() << " there is not topModule!";
|
| 4688 |
|
|
// return 1 ;
|
| 4689 |
|
|
// }
|
| 4690 |
4 |
EziDebug |
|
| 4691 |
2 |
EziDebug |
EziDebugInstanceTreeItem* item = new EziDebugInstanceTreeItem(m_itopModule,m_itopModule);
|
| 4692 |
|
|
if(!item)
|
| 4693 |
|
|
{
|
| 4694 |
|
|
qDebug() << "Error:There is no memory left!";
|
| 4695 |
|
|
return 1 ;
|
| 4696 |
|
|
}
|
| 4697 |
|
|
m_headItem = item ;
|
| 4698 |
|
|
//return (traverseModuleTree(itopModuleName,item));
|
| 4699 |
|
|
return(traverseModuleTree(itopModuleName,item)) ;
|
| 4700 |
|
|
}
|
| 4701 |
|
|
|
| 4702 |
|
|
int EziDebugPrj::traverseModuleTree(const QString &module,EziDebugInstanceTreeItem* item)
|
| 4703 |
|
|
{
|
| 4704 |
|
|
QString iparentItemModuleName = module.split(":").at(0);
|
| 4705 |
|
|
QString iparentItemInstanceName = module.split(":").at(1);
|
| 4706 |
|
|
QMap<QString,QString> iparentClockMap = m_imoduleMap.value(iparentItemModuleName)->getClockSignal();
|
| 4707 |
|
|
QStringList iinstanceList ;
|
| 4708 |
|
|
QString ihierarchyName ;
|
| 4709 |
|
|
// QMap<QString,QString> iclockSignalMap = m_imoduleMap.value(pchildItem->getModuleName())->getClockSignal() ;
|
| 4710 |
|
|
QMap<QString,QString> ichildClockMap ;
|
| 4711 |
|
|
QMap<QString,QString>::const_iterator iclockIter = iparentClockMap .constBegin();
|
| 4712 |
|
|
QMap<QString,QString> iparentResetMap = m_imoduleMap.value(iparentItemModuleName)->getResetSignal();
|
| 4713 |
|
|
QMap<QString,QString> ichildResetMap ;
|
| 4714 |
|
|
|
| 4715 |
|
|
// 创建本节点 然后再根据 子module 创建 子节点
|
| 4716 |
|
|
EziDebugInstanceTreeItem* pparentItem = item ;
|
| 4717 |
|
|
if(!pparentItem)
|
| 4718 |
|
|
{
|
| 4719 |
|
|
qDebug() << "Error:There is no memory left!" ;
|
| 4720 |
|
|
return 1 ;
|
| 4721 |
|
|
}
|
| 4722 |
|
|
|
| 4723 |
|
|
if(iparentItemModuleName == m_itopModule)
|
| 4724 |
|
|
{
|
| 4725 |
|
|
qDebug() << "This is topModule!" ;
|
| 4726 |
|
|
pparentItem->settItemHierarchyName(ihierarchyName);
|
| 4727 |
|
|
}
|
| 4728 |
|
|
else
|
| 4729 |
|
|
{
|
| 4730 |
|
|
ihierarchyName = pparentItem->parent()->getItemHierarchyName();
|
| 4731 |
|
|
ihierarchyName = ihierarchyName ;
|
| 4732 |
|
|
ihierarchyName.append(QObject::tr("%1:%2|").arg(iparentItemModuleName).arg(iparentItemInstanceName));
|
| 4733 |
|
|
pparentItem->settItemHierarchyName(ihierarchyName);
|
| 4734 |
|
|
// chainInfo 有值 、treeitem无值
|
| 4735 |
|
|
if((m_ichainInfoMap.count())&&(!m_ichainTreeItemMap.count()))
|
| 4736 |
|
|
{
|
| 4737 |
|
|
QMap<QString,EziDebugScanChain*>::const_iterator i = m_ichainInfoMap.constBegin() ;
|
| 4738 |
|
|
while(i != m_ichainInfoMap.constEnd())
|
| 4739 |
|
|
{
|
| 4740 |
|
|
EziDebugScanChain *pchain = i.value() ;
|
| 4741 |
|
|
if(pchain)
|
| 4742 |
|
|
{
|
| 4743 |
|
|
QString itopInstanceNode = pchain->getInstanceItemList().last();
|
| 4744 |
|
|
if(itopInstanceNode == module)
|
| 4745 |
|
|
{
|
| 4746 |
|
|
pparentItem->setScanChainInfo(pchain);
|
| 4747 |
|
|
pchain->setHeadTreeItem(pparentItem);
|
| 4748 |
|
|
m_ibackupChainTreeItemMap.insert(pchain->getChainName(),pparentItem);
|
| 4749 |
|
|
m_iqueryTreeItemMap.insert(module,pparentItem);
|
| 4750 |
|
|
m_ichainInfoMap.remove(i.key());
|
| 4751 |
|
|
break ;
|
| 4752 |
|
|
}
|
| 4753 |
|
|
}
|
| 4754 |
|
|
++i ;
|
| 4755 |
|
|
}
|
| 4756 |
|
|
}
|
| 4757 |
|
|
}
|
| 4758 |
|
|
|
| 4759 |
|
|
|
| 4760 |
|
|
if(m_imoduleMap.contains(iparentItemModuleName))
|
| 4761 |
|
|
{
|
| 4762 |
|
|
iinstanceList = (m_imoduleMap.value(iparentItemModuleName))->getInstanceList();
|
| 4763 |
|
|
|
| 4764 |
|
|
// 将所有的defparameter 记录到 module中方便 计算寄存器宽度
|
| 4765 |
|
|
QMap<QString,QString> idefparameterMap = m_idefparameter.value(iparentItemInstanceName);
|
| 4766 |
|
|
QMap<QString,QString>::const_iterator iiterrator = idefparameterMap.constBegin() ;
|
| 4767 |
|
|
while(iiterrator != idefparameterMap.constEnd())
|
| 4768 |
|
|
{
|
| 4769 |
|
|
m_imoduleMap.value(iparentItemModuleName)->addToDefParameterMap(iparentItemInstanceName,iiterrator.key(),iiterrator.value());
|
| 4770 |
|
|
++iiterrator ;
|
| 4771 |
|
|
}
|
| 4772 |
|
|
m_imoduleMap.value(iparentItemModuleName)->calInstanceRegData(this,iparentItemInstanceName);
|
| 4773 |
|
|
// 将寄存器宽度 所有的 宏全部替换
|
| 4774 |
|
|
|
| 4775 |
|
|
}
|
| 4776 |
|
|
else
|
| 4777 |
|
|
{
|
| 4778 |
|
|
qDebug() << "Error:module:" << iparentItemModuleName << "has no definition !" << "Can't finded in module map!" ;
|
| 4779 |
|
|
return 1 ;
|
| 4780 |
|
|
}
|
| 4781 |
|
|
|
| 4782 |
|
|
if(!(iinstanceList.count()))
|
| 4783 |
|
|
{
|
| 4784 |
|
|
return 0 ;
|
| 4785 |
|
|
}
|
| 4786 |
|
|
else
|
| 4787 |
|
|
{
|
| 4788 |
|
|
for(int i = 0 ; i < iinstanceList.count();i++)
|
| 4789 |
|
|
{
|
| 4790 |
|
|
QString ichildItemCombinedName = iinstanceList.at(i) ;
|
| 4791 |
|
|
QString ichildItemModuleName = (ichildItemCombinedName.split(":")).at(0) ;
|
| 4792 |
|
|
|
| 4793 |
|
|
// 每个子例化名
|
| 4794 |
|
|
if(!m_imoduleMap.value(ichildItemModuleName,NULL))
|
| 4795 |
|
|
{
|
| 4796 |
|
|
qDebug() << "Warnning:: module:" << ichildItemModuleName << "has no definition!";
|
| 4797 |
|
|
continue ;
|
| 4798 |
|
|
}
|
| 4799 |
|
|
|
| 4800 |
|
|
// 确定 子module 与 父module 之间的 clock 对应关系
|
| 4801 |
|
|
QString ichildItemInstanceName = (ichildItemCombinedName.split(":")).at(1) ;
|
| 4802 |
|
|
EziDebugInstanceTreeItem * pchildItem = new EziDebugInstanceTreeItem(ichildItemInstanceName,ichildItemModuleName);
|
| 4803 |
|
|
if(!pchildItem)
|
| 4804 |
|
|
{
|
| 4805 |
|
|
qDebug() << "Error:There is not memory left !" ;
|
| 4806 |
|
|
return 1 ;
|
| 4807 |
|
|
}
|
| 4808 |
|
|
|
| 4809 |
|
|
pparentItem->appendChild(pchildItem);
|
| 4810 |
|
|
|
| 4811 |
|
|
pchildItem->setItemParent(pparentItem);
|
| 4812 |
|
|
|
| 4813 |
|
|
if(m_imoduleMap.value(pchildItem->getModuleName())->isLibaryCore())
|
| 4814 |
|
|
{
|
| 4815 |
|
|
// 专门为 libarycore 加入 层次名
|
| 4816 |
|
|
QString ichildhierarchyName = pparentItem->getItemHierarchyName();
|
| 4817 |
|
|
ichildhierarchyName.append(QObject::tr("%1:%2|").arg(ichildItemModuleName).arg(ichildItemInstanceName));
|
| 4818 |
|
|
pchildItem->settItemHierarchyName(ichildhierarchyName);
|
| 4819 |
|
|
continue ;
|
| 4820 |
|
|
}
|
| 4821 |
|
|
|
| 4822 |
|
|
|
| 4823 |
|
|
// QString iparentClockName ;
|
| 4824 |
|
|
|
| 4825 |
|
|
// 只针对单一时钟情况 遍历所有节点之前 确保父节点 有 存在 clock
|
| 4826 |
|
|
// QMap<QString,QString>::const_iterator iclockIter = iclockSignalMap.constBegin();
|
| 4827 |
|
|
// int j = 0 ;
|
| 4828 |
|
|
// if(!iparentClockMap.count())
|
| 4829 |
|
|
// {
|
| 4830 |
|
|
// /*检查 clock 是否 缺少*/
|
| 4831 |
|
|
// /*根据子节点 的 port-map 和 子节点 的 clock 来找到 父节点 的 clock */
|
| 4832 |
|
|
// QString icheckInstanceName = pchildItem->getInstanceName() ;
|
| 4833 |
|
|
// QString icheckModuleName = pchildItem->getModuleName() ;
|
| 4834 |
|
|
|
| 4835 |
|
|
// if(!iclockSignalMap.count())
|
| 4836 |
|
|
// {
|
| 4837 |
|
|
// qDebug() << "EziDebug Info: child module:"<< pchildItem->getModuleName() << "has no clock!";
|
| 4838 |
|
|
|
| 4839 |
|
|
|
| 4840 |
|
|
// while(!iclockSignalMap.count())
|
| 4841 |
|
|
// {
|
| 4842 |
|
|
// j++ ;
|
| 4843 |
|
|
// if(j >= iinstanceList.count())
|
| 4844 |
|
|
// {
|
| 4845 |
|
|
// qDebug() << "EziDebug Error: The module:" << iparentItemModuleName << "'s child instance is ignoreg for no clock!" ;
|
| 4846 |
|
|
// return 0 ;
|
| 4847 |
|
|
// }
|
| 4848 |
|
|
|
| 4849 |
|
|
// icheckInstanceName = iinstanceList.at(i+j).split(":").at(1) ;
|
| 4850 |
|
|
// icheckModuleName = iinstanceList.at(i+j).split(':').at(0) ;
|
| 4851 |
|
|
// iclockSignalMap = m_imoduleMap.value(icheckModuleName)->getClockSignal();
|
| 4852 |
|
|
// }
|
| 4853 |
|
|
// }
|
| 4854 |
|
|
// else
|
| 4855 |
|
|
// {
|
| 4856 |
|
|
// //iparentClockName = ;
|
| 4857 |
|
|
// if(iclockSignalMap.count()>1)
|
| 4858 |
|
|
// {
|
| 4859 |
|
|
// qDebug() << "EziDebug Error: It is not Supported muticlock domain!";
|
| 4860 |
|
|
// return 1 ;
|
| 4861 |
|
|
// }
|
| 4862 |
|
|
|
| 4863 |
|
|
// iclockIter = iclockSignalMap.constBegin();
|
| 4864 |
|
|
// while(iclockIter != iclockSignalMap.constEnd())
|
| 4865 |
|
|
// {
|
| 4866 |
|
|
// iparentClockName = m_imoduleMap.value(pparentItem->getModuleName())->getInstancePortMap(pchildItem->getInstanceName()).value(iclockIter.key(),NULL);
|
| 4867 |
|
|
// if(iparentClockName.isEmpty())
|
| 4868 |
|
|
// {
|
| 4869 |
|
|
// qDebug() << "EziDebug Error: clock wire is not correspond to the clock port!";
|
| 4870 |
|
|
// return 1 ;
|
| 4871 |
|
|
// }
|
| 4872 |
|
|
// m_imoduleMap.value(pparentItem->getModuleName())->addToClockMap(iparentClockName);
|
| 4873 |
|
|
// ++iclockIter ;
|
| 4874 |
|
|
// }
|
| 4875 |
|
|
// }
|
| 4876 |
|
|
|
| 4877 |
|
|
|
| 4878 |
|
|
|
| 4879 |
|
|
// if(iclockSignalMap.count()>1)
|
| 4880 |
|
|
// {
|
| 4881 |
|
|
// qDebug() << "EziDebug Error: It is not Supported muticlock domain!";
|
| 4882 |
|
|
// return 1 ;
|
| 4883 |
|
|
// }
|
| 4884 |
|
|
|
| 4885 |
|
|
// iclockIter = iclockSignalMap.constBegin();
|
| 4886 |
|
|
// while(iclockIter != iclockSignalMap.constEnd())
|
| 4887 |
|
|
// {
|
| 4888 |
|
|
// iparentClockName = m_imoduleMap.value(pparentItem->getModuleName())->getInstancePortMap(icheckInstanceName).value(iclockIter.key(),NULL);
|
| 4889 |
|
|
// if(iparentClockName.isEmpty())
|
| 4890 |
|
|
// {
|
| 4891 |
|
|
// qDebug() << "EziDebug Error: clock wire is not correspond to the clock port!";
|
| 4892 |
|
|
// return 1 ;
|
| 4893 |
|
|
// }
|
| 4894 |
|
|
// ++iclockIter ;
|
| 4895 |
|
|
// }
|
| 4896 |
|
|
|
| 4897 |
|
|
|
| 4898 |
|
|
// QString ichildClockName ;
|
| 4899 |
|
|
|
| 4900 |
|
|
// QVector<EziDebugModule::PortStructure*> iportVec = m_imoduleMap.value(pchildItem->getModuleName())->getPort() ;
|
| 4901 |
|
|
// while(iclockIter != iclockSignalMap.constEnd())
|
| 4902 |
|
|
// {
|
| 4903 |
|
|
// for(int j = 0 ; j < iportVec.count(); j++)
|
| 4904 |
|
|
// {
|
| 4905 |
|
|
// if(iclockIter.key() == QString::fromAscii(iportVec.at(j)->m_pPortName))
|
| 4906 |
|
|
// {
|
| 4907 |
|
|
// ichildClockName = iclockIter.key() ;
|
| 4908 |
|
|
// QMap<QString,QString> iportMap = m_imoduleMap.value(pparentItem->getModuleName())->getInstancePortMap(pchildItem->getInstanceName());
|
| 4909 |
|
|
// iparentClockName = iportMap.value(ichildClockName,QString()) ;
|
| 4910 |
|
|
// if(iparentClockName.isEmpty())
|
| 4911 |
|
|
// {
|
| 4912 |
|
|
// qDebug() << "Error: The clock is not correspond!";
|
| 4913 |
|
|
// return 1 ;
|
| 4914 |
|
|
// }
|
| 4915 |
|
|
|
| 4916 |
|
|
// // 以后加上 检查 父节点端口 clock 和 例化端口 的 clock 是不是 一一对应的
|
| 4917 |
|
|
// if(m_imoduleMap.value(pparentItem->getModuleName())->getClockSignal().value(iparentClockName,QString()).isEmpty())
|
| 4918 |
|
|
// {
|
| 4919 |
|
|
// m_imoduleMap.value(pparentItem->getModuleName())->addToClockMap(iparentClockName);
|
| 4920 |
|
|
|
| 4921 |
|
|
// }
|
| 4922 |
|
|
// }
|
| 4923 |
|
|
// }
|
| 4924 |
|
|
// ++iclockIter ;
|
| 4925 |
|
|
// }
|
| 4926 |
|
|
|
| 4927 |
|
|
|
| 4928 |
|
|
//iclockSignalMap.clear();
|
| 4929 |
|
|
// 添加相应的 本module里面的 clock 和 子例化的 module clock 名字对应关系
|
| 4930 |
|
|
// 以后要 获取 是否 存在 clock 的别名,用于 clock 的 连接 <端口clock,别名clock>
|
| 4931 |
|
|
// 在找对应关系时 端口clock 和 instance 的clock 不匹配 ,则尝试用别名匹配
|
| 4932 |
|
|
|
| 4933 |
|
|
|
| 4934 |
|
|
QMap<QString,QMap<QString,QString> > iinstancePortMap = m_imoduleMap.value(iparentItemModuleName)->getInstancePortMap() ;
|
| 4935 |
|
|
QMap<QString,QString> ichildPortMap = iinstancePortMap.value(ichildItemInstanceName);
|
| 4936 |
|
|
//QMap<QString,QMap<QString,QString> >::const_iterator i = iinstancePortMap.constBegin() ;
|
| 4937 |
|
|
|
| 4938 |
|
|
if(traverseModuleTree(ichildItemCombinedName,pchildItem))
|
| 4939 |
|
|
{
|
| 4940 |
|
|
qDebug() << "EziDebug Error: The node" << ichildItemCombinedName << "Travere Error!";
|
| 4941 |
|
|
|
| 4942 |
|
|
pparentItem->removeChild(pchildItem);
|
| 4943 |
|
|
|
| 4944 |
|
|
pchildItem->setItemParent(NULL);
|
| 4945 |
|
|
|
| 4946 |
|
|
delete pchildItem ;
|
| 4947 |
|
|
|
| 4948 |
|
|
return 1;
|
| 4949 |
|
|
}
|
| 4950 |
|
|
else
|
| 4951 |
|
|
{
|
| 4952 |
|
|
|
| 4953 |
|
|
// 子节点的时钟 map , 将子节点的时钟 填充到 父节点 中 ,防止 父节点无时钟
|
| 4954 |
|
|
ichildClockMap = m_imoduleMap.value(pchildItem->getModuleName())->getClockSignal() ;
|
| 4955 |
|
|
iclockIter = ichildClockMap.constBegin() ;
|
| 4956 |
|
|
while(iclockIter != ichildClockMap.constEnd())
|
| 4957 |
|
|
{
|
| 4958 |
|
|
// 将所有子节点的时钟 加入 到 父节点的 时钟 map 中
|
| 4959 |
|
|
// 应该 根据 iclockIter.key() 和 端口 列表 以及 端口对应关系 得到 父节点的时钟
|
| 4960 |
|
|
// 目前不考虑 时钟名字 改变 即 子节点的时钟端口名与时钟名一致
|
| 4961 |
|
|
QString iparentCLockName = ichildPortMap.value(iclockIter.key(),QString()) ;
|
| 4962 |
|
|
if(!iparentCLockName.isEmpty())
|
| 4963 |
|
|
{
|
| 4964 |
|
|
m_imoduleMap.value(pparentItem->getModuleName())->addToClockMap(iparentCLockName);
|
| 4965 |
|
|
}
|
| 4966 |
|
|
++iclockIter ;
|
| 4967 |
|
|
}
|
| 4968 |
|
|
|
| 4969 |
|
|
// 子节点的时钟 map , 将子节点的时钟 填充到 父节点 中 ,防止 父节点无时钟
|
| 4970 |
|
|
ichildResetMap = m_imoduleMap.value(pchildItem->getModuleName())->getResetSignal();
|
| 4971 |
|
|
iclockIter = ichildResetMap.constBegin() ;
|
| 4972 |
|
|
while(iclockIter != ichildResetMap.constEnd())
|
| 4973 |
|
|
{
|
| 4974 |
|
|
// 将所有子节点的时钟 加入 到 父节点的 时钟 map 中
|
| 4975 |
|
|
// 应该 根据 iclockIter.key() 和 端口 列表 以及 端口对应关系 得到 父节点的时钟
|
| 4976 |
|
|
// 目前不考虑 时钟名字 改变 即 子节点的时钟端口名与时钟名一致
|
| 4977 |
|
|
QString iparentResetName = ichildPortMap.value(iclockIter.key(),QString()) ;
|
| 4978 |
|
|
QString iedge = iclockIter.value() ;
|
| 4979 |
|
|
if(!iparentResetName.isEmpty())
|
| 4980 |
|
|
{
|
| 4981 |
|
|
m_imoduleMap.value(pparentItem->getModuleName())->addToResetSignalMap(iparentResetName,iedge);
|
| 4982 |
|
|
}
|
| 4983 |
|
|
++iclockIter ;
|
| 4984 |
|
|
}
|
| 4985 |
|
|
|
| 4986 |
|
|
//iclockSignalMap.clear();
|
| 4987 |
|
|
//iclockSignalMap = m_imoduleMap.value(pparentItem->getModuleName())->getClockSignal() ;
|
| 4988 |
|
|
}
|
| 4989 |
|
|
}
|
| 4990 |
|
|
QMap<QString,QString> iclockMap ;
|
| 4991 |
|
|
|
| 4992 |
|
|
iparentClockMap = m_imoduleMap.value(iparentItemModuleName)->getClockSignal();
|
| 4993 |
|
|
iparentResetMap = m_imoduleMap.value(iparentItemModuleName)->getResetSignal();
|
| 4994 |
|
|
|
| 4995 |
|
|
|
| 4996 |
|
|
// 遍历完所有节点之后 根据父节点 的 clock map 找到 填充 子节点 的 clock map
|
| 4997 |
|
|
// 填充 父节点的clock map
|
| 4998 |
|
|
|
| 4999 |
|
|
for(int i = 0 ; i < pparentItem->childCount();i++)
|
| 5000 |
|
|
{
|
| 5001 |
|
|
iclockMap.clear();
|
| 5002 |
|
|
QString ichildModuleName = pparentItem->child(i)->getModuleName() ;
|
| 5003 |
|
|
QString ichildInstanceName = pparentItem->child(i)->getInstanceName() ;
|
| 5004 |
|
|
|
| 5005 |
|
|
QMap<QString,QString> ichildPortMap = m_imoduleMap.value(iparentItemModuleName)->getInstancePortMap(ichildInstanceName) ;
|
| 5006 |
|
|
iclockIter = iparentClockMap.constBegin() ;
|
| 5007 |
|
|
ichildClockMap = m_imoduleMap.value(ichildModuleName)->getClockSignal();
|
| 5008 |
|
|
|
| 5009 |
|
|
while(iclockIter != iparentClockMap.constEnd())
|
| 5010 |
|
|
{
|
| 5011 |
|
|
QString ichildClockName = ichildPortMap.key(iclockIter.key());
|
| 5012 |
|
|
|
| 5013 |
|
|
if(!ichildClockName.isEmpty())
|
| 5014 |
|
|
{
|
| 5015 |
|
|
QMap<QString,QMap<QString,QString> > iinstancesPortMap = m_imoduleMap.value(ichildModuleName)->getInstancePortMap();
|
| 5016 |
|
|
QMap<QString,QMap<QString,QString> >::const_iterator iportMapIter = iinstancesPortMap.constBegin() ;
|
| 5017 |
|
|
while(iportMapIter != iinstancesPortMap.constEnd())
|
| 5018 |
|
|
{
|
| 5019 |
|
|
QMap<QString,QString> iinstancePortMap = iportMapIter.value();
|
| 5020 |
|
|
|
| 5021 |
|
|
if(!(iinstancePortMap.key(ichildClockName,QString()).isEmpty()))
|
| 5022 |
|
|
{
|
| 5023 |
|
|
// 子节点用到了 这个 clock
|
| 5024 |
|
|
m_imoduleMap.value(ichildModuleName)->addToClockMap(ichildClockName) ;
|
| 5025 |
|
|
iclockMap.insert(iclockIter.key(),ichildClockName);
|
| 5026 |
|
|
}
|
| 5027 |
|
|
++iportMapIter ;
|
| 5028 |
|
|
}
|
| 5029 |
|
|
|
| 5030 |
|
|
//子节点 本身含有 这个clock
|
| 5031 |
|
|
if(!ichildClockMap.value(ichildClockName,QString()).isEmpty())
|
| 5032 |
|
|
{
|
| 5033 |
|
|
iclockMap.insert(iclockIter.key(),ichildClockName);
|
| 5034 |
|
|
}
|
| 5035 |
|
|
}
|
| 5036 |
|
|
++iclockIter ;
|
| 5037 |
|
|
}
|
| 5038 |
|
|
pparentItem->setModuleClockMap(ichildInstanceName,iclockMap);
|
| 5039 |
|
|
|
| 5040 |
|
|
|
| 5041 |
|
|
iclockIter = iparentResetMap.constBegin() ;
|
| 5042 |
|
|
while(iclockIter != iparentResetMap.constEnd())
|
| 5043 |
|
|
{
|
| 5044 |
|
|
QString ichildResetSignalName = ichildPortMap.key(iclockIter.key());
|
| 5045 |
|
|
QString iedge = iclockIter.value() ;
|
| 5046 |
|
|
if(!ichildResetSignalName.isEmpty())
|
| 5047 |
|
|
{
|
| 5048 |
|
|
QMap<QString,QMap<QString,QString> > iinstancesPortMap = m_imoduleMap.value(ichildModuleName)->getInstancePortMap();
|
| 5049 |
|
|
QMap<QString,QMap<QString,QString> >::const_iterator iportMapIter = iinstancesPortMap.constBegin() ;
|
| 5050 |
|
|
while(iportMapIter != iinstancesPortMap.constEnd())
|
| 5051 |
|
|
{
|
| 5052 |
|
|
QMap<QString,QString> iinstancePortMap = iportMapIter.value();
|
| 5053 |
|
|
|
| 5054 |
|
|
if(!(iinstancePortMap.key(ichildResetSignalName,QString()).isEmpty()))
|
| 5055 |
|
|
{
|
| 5056 |
|
|
// 子节点用到了 这个 clock
|
| 5057 |
|
|
m_imoduleMap.value(ichildModuleName)->addToResetSignalMap(ichildResetSignalName,iedge);
|
| 5058 |
|
|
}
|
| 5059 |
|
|
++iportMapIter ;
|
| 5060 |
|
|
}
|
| 5061 |
|
|
}
|
| 5062 |
|
|
++iclockIter ;
|
| 5063 |
|
|
}
|
| 5064 |
|
|
}
|
| 5065 |
|
|
}
|
| 5066 |
|
|
return 0 ;
|
| 5067 |
|
|
}
|
| 5068 |
|
|
|
| 5069 |
|
|
|
| 5070 |
|
|
|
| 5071 |
|
|
EziDebugInstanceTreeItem * EziDebugPrj::getInstanceTreeHeadItem(void)
|
| 5072 |
|
|
{
|
| 5073 |
|
|
return m_headItem ;
|
| 5074 |
|
|
}
|
| 5075 |
|
|
|
| 5076 |
|
|
void EziDebugPrj::setInstanceTreeHeadItem(EziDebugInstanceTreeItem *item)
|
| 5077 |
|
|
{
|
| 5078 |
|
|
m_headItem = item ;
|
| 5079 |
|
|
return ;
|
| 5080 |
|
|
}
|
| 5081 |
|
|
|
| 5082 |
|
|
void EziDebugPrj::updateOperation(OPERATE_TYPE type, EziDebugScanChain* chain,EziDebugInstanceTreeItem* item)
|
| 5083 |
|
|
{
|
| 5084 |
|
|
m_elastOperation = type ;
|
| 5085 |
|
|
m_pLastOperateChain = chain ;
|
| 5086 |
|
|
m_pLastOperteTreeItem = item ;
|
| 5087 |
|
|
|
| 5088 |
|
|
if(OperateTypeNone == type)
|
| 5089 |
|
|
{
|
| 5090 |
|
|
m_ibackupChainInfoMap.clear();
|
| 5091 |
|
|
m_ibackupChainTreeItemMap.clear();
|
| 5092 |
|
|
m_ibackupQueryTreeItemMap.clear();
|
| 5093 |
|
|
}
|
| 5094 |
|
|
return ;
|
| 5095 |
|
|
}
|
| 5096 |
|
|
|
| 5097 |
|
|
int EziDebugPrj::changedLogFile(const QList<LOG_FILE_INFO*>& addlist, const QList<LOG_FILE_INFO*> &deletelist)
|
| 5098 |
|
|
{
|
| 5099 |
|
|
QFile file(m_ilogFileName);
|
| 5100 |
|
|
|
| 5101 |
|
|
if(!file.open(QFile::ReadOnly | QFile::Text))
|
| 5102 |
|
|
{
|
| 5103 |
|
|
qDebug() << "Error: Cannot read file " << qPrintable(m_ilogFileName) \
|
| 5104 |
|
|
<< ": " << qPrintable(file.errorString()) << __LINE__ << __FILE__;
|
| 5105 |
|
|
return 1 ;
|
| 5106 |
|
|
}
|
| 5107 |
|
|
|
| 5108 |
|
|
QDomDocument idoc;
|
| 5109 |
|
|
QString ierrorStr;
|
| 5110 |
|
|
int nerrorLine;
|
| 5111 |
|
|
int nerrorColumn;
|
| 5112 |
|
|
|
| 5113 |
|
|
if (!idoc.setContent(&file, false, &ierrorStr, &nerrorLine,&nerrorColumn))
|
| 5114 |
|
|
{
|
| 5115 |
|
|
qDebug() << "Error: Parse error at line " << nerrorLine << ", "
|
| 5116 |
|
|
<< "column " << nerrorColumn << ": "
|
| 5117 |
|
|
<< qPrintable(ierrorStr) ;
|
| 5118 |
|
|
return 1 ;
|
| 5119 |
|
|
}
|
| 5120 |
|
|
|
| 5121 |
|
|
qDebug() << "changedLogFile" << __FILE__ << __LINE__ << deletelist.count();
|
| 5122 |
|
|
for(int i = 0 ; i < deletelist.count() ; i++)
|
| 5123 |
|
|
{
|
| 5124 |
|
|
LOG_FILE_INFO* pinfo = deletelist.at(i) ;
|
| 5125 |
|
|
if(deleteLogFileElement(idoc,pinfo))
|
| 5126 |
|
|
{
|
| 5127 |
|
|
file.close();
|
| 5128 |
|
|
return 1 ;
|
| 5129 |
|
|
}
|
| 5130 |
|
|
}
|
| 5131 |
|
|
|
| 5132 |
|
|
for(int i = 0 ; i < addlist.count() ; i++)
|
| 5133 |
|
|
{
|
| 5134 |
|
|
LOG_FILE_INFO* pinfo = addlist.at(i) ;
|
| 5135 |
|
|
if(saveInfoToLogFile(idoc,pinfo))
|
| 5136 |
|
|
{
|
| 5137 |
|
|
file.close();
|
| 5138 |
|
|
qDebug() << "Error:save info!!!!" ;
|
| 5139 |
|
|
return 1 ;
|
| 5140 |
|
|
}
|
| 5141 |
|
|
qDebug() << "save info to log file " << i;
|
| 5142 |
|
|
}
|
| 5143 |
|
|
|
| 5144 |
|
|
|
| 5145 |
|
|
file.close();
|
| 5146 |
|
|
if(!file.open(QFile::WriteOnly | QIODevice::Truncate | QFile::Text))
|
| 5147 |
|
|
{
|
| 5148 |
|
|
qDebug() << "Error: Cannot write file " << qPrintable(m_ilogFileName) \
|
| 5149 |
|
|
<< ": " << qPrintable(file.errorString());
|
| 5150 |
|
|
return 1 ;
|
| 5151 |
|
|
}
|
| 5152 |
|
|
QTextStream iout(&file);
|
| 5153 |
|
|
iout.setCodec("UTF-8");
|
| 5154 |
|
|
idoc.save(iout,4,QDomNode::EncodingFromTextStream);
|
| 5155 |
|
|
file.close();
|
| 5156 |
|
|
return 0 ;
|
| 5157 |
|
|
}
|
| 5158 |
|
|
|
| 5159 |
|
|
|
| 5160 |
|
|
int EziDebugPrj::createLogFile(void)
|
| 5161 |
|
|
{
|
| 5162 |
|
|
QString iuserDir = "No Dir";
|
| 5163 |
|
|
QString itoutCore = "No Core" ;
|
| 5164 |
|
|
QString iscanRegCore = "No Core" ;
|
| 5165 |
|
|
|
| 5166 |
|
|
QDomDocument idoc;
|
| 5167 |
|
|
|
| 5168 |
|
|
QDomElement iroot = idoc.createElement("EziDebug");
|
| 5169 |
|
|
|
| 5170 |
|
|
idoc.appendChild(iroot);
|
| 5171 |
|
|
|
| 5172 |
|
|
QDomElement ifileInfo = idoc.createElement("FILE_INFO");
|
| 5173 |
|
|
iroot.appendChild(ifileInfo);
|
| 5174 |
|
|
|
| 5175 |
|
|
QDomElement imoduleInfo = idoc.createElement("MODULE_INFO");
|
| 5176 |
|
|
imoduleInfo.setAttribute("topmodule","No Module");
|
| 5177 |
|
|
iroot.appendChild(imoduleInfo);
|
| 5178 |
|
|
|
| 5179 |
|
|
if(EziDebugScanChain::getChainRegCore().toLower() != "no core")
|
| 5180 |
|
|
{
|
| 5181 |
|
|
iscanRegCore = EziDebugScanChain::getChainRegCore() ;
|
| 5182 |
|
|
}
|
| 5183 |
|
|
|
| 5184 |
|
|
if(EziDebugScanChain::getChainToutCore().toLower() != "no core")
|
| 5185 |
|
|
{
|
| 5186 |
|
|
itoutCore = EziDebugScanChain::getChainToutCore() ;
|
| 5187 |
|
|
}
|
| 5188 |
|
|
|
| 5189 |
|
|
if(EziDebugScanChain::getUserDir().toLower() != "no dir")
|
| 5190 |
|
|
{
|
| 5191 |
|
|
iuserDir = EziDebugScanChain::getUserDir() ;
|
| 5192 |
|
|
}
|
| 5193 |
|
|
|
| 5194 |
|
|
QDomElement iscanChainInfo = idoc.createElement("SCAN_CHAIN_INFO");
|
| 5195 |
|
|
iscanChainInfo.setAttribute("scanreg_core_name",iscanRegCore);
|
| 5196 |
|
|
iscanChainInfo.setAttribute("tout_core_name",itoutCore);
|
| 5197 |
|
|
iscanChainInfo.setAttribute("user_dir",iuserDir);
|
| 5198 |
|
|
iroot.appendChild(iscanChainInfo);
|
| 5199 |
|
|
|
| 5200 |
|
|
QFile ifile(m_iprjPath.absoluteFilePath("config.ezi"));
|
| 5201 |
|
|
if (!ifile.open(QIODevice::WriteOnly | QIODevice::Truncate |QIODevice::Text))
|
| 5202 |
|
|
{
|
| 5203 |
|
|
return 1 ;
|
| 5204 |
|
|
}
|
| 5205 |
|
|
|
| 5206 |
|
|
QTextStream iout(&ifile);
|
| 5207 |
|
|
|
| 5208 |
|
|
iout.setCodec("UTF-8");
|
| 5209 |
|
|
|
| 5210 |
|
|
idoc.save(iout,4,QDomNode::EncodingFromTextStream);
|
| 5211 |
|
|
m_ilogFileName = m_iprjPath.absoluteFilePath("config.ezi") ;
|
| 5212 |
|
|
ifile.close();
|
| 5213 |
|
|
return 0 ;
|
| 5214 |
|
|
}
|
| 5215 |
|
|
|
| 5216 |
|
|
int EziDebugPrj::updateCodeFile()
|
| 5217 |
|
|
{
|
| 5218 |
|
|
return 0 ;
|
| 5219 |
|
|
}
|
| 5220 |
|
|
|
| 5221 |
|
|
int EziDebugPrj::saveInfoToLogFile(QDomDocument &idoc, LOG_FILE_INFO* loginfo)
|
| 5222 |
|
|
{
|
| 5223 |
|
|
//void *info , INFO_TYPE type
|
| 5224 |
|
|
INFO_TYPE type = loginfo->etype ;
|
| 5225 |
|
|
void *info = loginfo->pinfo ;
|
| 5226 |
|
|
if(!loginfo)
|
| 5227 |
|
|
{
|
| 5228 |
|
|
qDebug() << "NULL Pointer!" << __LINE__ << __FILE__ ;
|
| 5229 |
|
|
return 1 ;
|
| 5230 |
|
|
}
|
| 5231 |
|
|
|
| 5232 |
|
|
if(!info)
|
| 5233 |
|
|
{
|
| 5234 |
|
|
qDebug() << "NULL Pointer!" << __LINE__ << __FILE__ ;
|
| 5235 |
|
|
return 1 ;
|
| 5236 |
|
|
}
|
| 5237 |
|
|
|
| 5238 |
|
|
if(type == infoTypeFileInfo)
|
| 5239 |
|
|
{
|
| 5240 |
|
|
//qDebug() << "saveInfoToLogFile!" << __LINE__ << __FILE__ ;
|
| 5241 |
|
|
EziDebugFile * pfile = static_cast<EziDebugFile*>(info);
|
| 5242 |
|
|
|
| 5243 |
|
|
if(pfile->fileName().endsWith(".v"))
|
| 5244 |
|
|
{
|
| 5245 |
|
|
EziDebugVlgFile *pvlgFile = static_cast<EziDebugVlgFile*>(info);
|
| 5246 |
|
|
|
| 5247 |
|
|
QDomElement ielement = idoc.elementsByTagName("FILE_INFO").at(0).toElement() ;
|
| 5248 |
|
|
QDomElement ifileElement = idoc.createElement("file") ;
|
| 5249 |
|
|
QStringList imoduleList = pvlgFile->getModuleList() ;
|
| 5250 |
|
|
QString imodule_array = imoduleList.join(",");
|
| 5251 |
|
|
|
| 5252 |
|
|
ifileElement.setAttribute("file_name",m_iprjPath.relativeFilePath(pvlgFile->fileName()));
|
| 5253 |
|
|
ifileElement.setAttribute("module_array",imodule_array);
|
| 5254 |
|
|
QDateTime idateTime = pvlgFile->getLastStoredTime() ;
|
| 5255 |
|
|
QDate imodifiedDate = idateTime.date();
|
| 5256 |
|
|
QTime imodifiedTime = idateTime.time();
|
| 5257 |
|
|
|
| 5258 |
|
|
if(imodifiedDate.isNull()||imodifiedTime.isNull())
|
| 5259 |
|
|
{
|
| 5260 |
|
|
qDebug() << "EziDebug Error: !!!!! save date and time error !!!!";
|
| 5261 |
|
|
}
|
| 5262 |
|
|
|
| 5263 |
|
|
ifileElement.setAttribute("modified_date",imodifiedDate.toString("MM/dd/yyyy"));
|
| 5264 |
|
|
ifileElement.setAttribute("modified_time",imodifiedTime.toString("hh:mm:ss"));
|
| 5265 |
|
|
|
| 5266 |
|
|
// macro
|
| 5267 |
|
|
QStringList imacroStrList ;
|
| 5268 |
|
|
|
| 5269 |
|
|
QMap<QString,QString>::const_iterator imacroIter = pvlgFile->m_imacro.constBegin() ;
|
| 5270 |
|
|
while(imacroIter != pvlgFile->m_imacro.constEnd())
|
| 5271 |
|
|
{
|
| 5272 |
|
|
QString imacroStr = imacroIter.key() ;
|
| 5273 |
|
|
QString imacroVal = imacroIter.value() ;
|
| 5274 |
|
|
imacroStrList.append(imacroStr + tr("::") + imacroVal) ;
|
| 5275 |
|
|
++imacroIter ;
|
| 5276 |
|
|
}
|
| 5277 |
|
|
|
| 5278 |
|
|
if(imacroStrList.count())
|
| 5279 |
|
|
{
|
| 5280 |
|
|
ifileElement.setAttribute("macro",imacroStrList.join("$$"));
|
| 5281 |
|
|
}
|
| 5282 |
|
|
else
|
| 5283 |
|
|
{
|
| 5284 |
|
|
ifileElement.setAttribute("macro" , "No Macro");
|
| 5285 |
|
|
}
|
| 5286 |
|
|
|
| 5287 |
|
|
// defparameter
|
| 5288 |
|
|
QStringList idefParamList ;
|
| 5289 |
|
|
QMap<QString,QMap<QString,QString> >::const_iterator idefParaIter = pvlgFile->m_idefparameter.constBegin() ;
|
| 5290 |
|
|
while(idefParaIter != pvlgFile->m_idefparameter.constEnd())
|
| 5291 |
|
|
{
|
| 5292 |
|
|
QString iinstanceName = idefParaIter.key() ;
|
| 5293 |
|
|
QMap<QString,QString> iparameterMap = idefParaIter.value() ;
|
| 5294 |
|
|
QMap<QString,QString>::const_iterator iparameterIter = iparameterMap.constBegin() ;
|
| 5295 |
|
|
while(iparameterIter != iparameterMap.constEnd())
|
| 5296 |
|
|
{
|
| 5297 |
|
|
QString iparameterStr = iparameterIter.key() ;
|
| 5298 |
|
|
QString iparameterVal = iparameterIter.value() ;
|
| 5299 |
|
|
idefParamList.append(iinstanceName + tr(".") + iparameterStr + tr("::") + iparameterVal);
|
| 5300 |
|
|
++iparameterIter ;
|
| 5301 |
|
|
}
|
| 5302 |
|
|
++idefParaIter ;
|
| 5303 |
|
|
}
|
| 5304 |
|
|
|
| 5305 |
|
|
if(idefParamList.count())
|
| 5306 |
|
|
{
|
| 5307 |
|
|
ifileElement.setAttribute("defparameter",idefParamList.join("$$"));
|
| 5308 |
|
|
}
|
| 5309 |
|
|
else
|
| 5310 |
|
|
{
|
| 5311 |
|
|
ifileElement.setAttribute("defparameter", "No Defparam");
|
| 5312 |
|
|
}
|
| 5313 |
|
|
|
| 5314 |
|
|
ielement.appendChild(ifileElement);
|
| 5315 |
|
|
|
| 5316 |
|
|
}
|
| 5317 |
|
|
}
|
| 5318 |
|
|
else if(type == infoTypeModuleStructure)
|
| 5319 |
|
|
{
|
| 5320 |
|
|
//qDebug() << "saveInfoToLogFile!" << __LINE__ << __FILE__ ;
|
| 5321 |
|
|
|
| 5322 |
|
|
EziDebugModule *pmodule = static_cast<EziDebugModule*>(info);
|
| 5323 |
|
|
QDomElement imoduleInfoElement = idoc.elementsByTagName("MODULE_INFO").at(0).toElement() ;
|
| 5324 |
|
|
|
| 5325 |
|
|
if(imoduleInfoElement.attribute("topmodule").toLower() == "no module")
|
| 5326 |
|
|
{
|
| 5327 |
|
|
imoduleInfoElement.setAttribute("topmodule",m_itopModule);
|
| 5328 |
|
|
}
|
| 5329 |
|
|
|
| 5330 |
|
|
//qDebug() << "saveInfoToLogFile!" << __LINE__ << __FILE__ ;
|
| 5331 |
|
|
|
| 5332 |
|
|
QDomElement imoduleElement = idoc.createElement("module") ;
|
| 5333 |
|
|
imoduleElement.setAttribute("module_name",pmodule->m_imoduleName);
|
| 5334 |
|
|
//imoduleElement.setAttribute("appearance_count",QString::number(pmodule->m_ninstanceTimes));
|
| 5335 |
|
|
|
| 5336 |
|
|
imoduleElement.setAttribute("lib_core",pmodule->m_isLibaryCore);
|
| 5337 |
|
|
imoduleElement.setAttribute("file_name",pmodule->m_ilocatedFile);
|
| 5338 |
|
|
|
| 5339 |
|
|
if(!pmodule->m_iinstanceNameList.size())
|
| 5340 |
|
|
{
|
| 5341 |
|
|
imoduleElement.setAttribute("instance_array","No Instance");
|
| 5342 |
|
|
}
|
| 5343 |
|
|
else
|
| 5344 |
|
|
{
|
| 5345 |
|
|
imoduleElement.setAttribute("instance_array",pmodule->m_iinstanceNameList.join("|"));
|
| 5346 |
|
|
}
|
| 5347 |
|
|
|
| 5348 |
|
|
//qDebug() << "saveInfoToLogFile!" << __LINE__ << __FILE__ ;
|
| 5349 |
|
|
|
| 5350 |
|
|
QStringList iresetList ;
|
| 5351 |
|
|
QMap<QString,QString>::const_iterator i = pmodule->m_iresetMap.constBegin();
|
| 5352 |
|
|
while (i != pmodule->m_iresetMap.constEnd())
|
| 5353 |
|
|
{
|
| 5354 |
|
|
iresetList.append(i.key()+ QObject::tr(":") + i.value());
|
| 5355 |
|
|
++i;
|
| 5356 |
|
|
}
|
| 5357 |
|
|
|
| 5358 |
|
|
if(iresetList.size())
|
| 5359 |
|
|
{
|
| 5360 |
|
|
imoduleElement.setAttribute("reset_signal",iresetList.join("|"));
|
| 5361 |
|
|
}
|
| 5362 |
|
|
else
|
| 5363 |
|
|
{
|
| 5364 |
|
|
imoduleElement.setAttribute("reset_signal","No Reset Signal");
|
| 5365 |
|
|
}
|
| 5366 |
|
|
|
| 5367 |
|
|
// 插入parameter 参数
|
| 5368 |
|
|
QStringList ipraramList ;
|
| 5369 |
|
|
QMap<QString,QString>::const_iterator iparamIter = pmodule->m_iparameter.constBegin() ;
|
| 5370 |
|
|
while(iparamIter != pmodule->m_iparameter.constEnd())
|
| 5371 |
|
|
{
|
| 5372 |
|
|
QString iparamStr = iparamIter.key() ;
|
| 5373 |
|
|
QString iparamVal = iparamIter.value() ;
|
| 5374 |
|
|
ipraramList.append(iparamStr + tr("::") + iparamVal);
|
| 5375 |
|
|
++iparamIter ;
|
| 5376 |
|
|
}
|
| 5377 |
|
|
|
| 5378 |
|
|
if(ipraramList.count())
|
| 5379 |
|
|
{
|
| 5380 |
|
|
imoduleElement.setAttribute("parameter",ipraramList.join("$$"));
|
| 5381 |
|
|
}
|
| 5382 |
|
|
else
|
| 5383 |
|
|
{
|
| 5384 |
|
|
imoduleElement.setAttribute("parameter","No Parameter");
|
| 5385 |
|
|
}
|
| 5386 |
|
|
|
| 5387 |
|
|
|
| 5388 |
|
|
QDomElement iclockDescriptionElement = idoc.createElement("clock_description") ;
|
| 5389 |
|
|
QMap<QString,QString>::const_iterator j = pmodule->m_iclockMap.constBegin();
|
| 5390 |
|
|
while (j != pmodule->m_iclockMap.constEnd())
|
| 5391 |
|
|
{
|
| 5392 |
|
|
QDomElement iclock = idoc.createElement("clock") ;
|
| 5393 |
|
|
iclock.setAttribute("clock_name",j.key());
|
| 5394 |
|
|
iclock.setAttribute("polarity",j.value());
|
| 5395 |
|
|
iclockDescriptionElement.appendChild(iclock);
|
| 5396 |
|
|
++j ;
|
| 5397 |
|
|
}
|
| 5398 |
|
|
imoduleElement.appendChild(iclockDescriptionElement) ;
|
| 5399 |
|
|
|
| 5400 |
|
|
//qDebug() << "saveInfoToLogFile!" << __LINE__ << __FILE__ ;
|
| 5401 |
|
|
|
| 5402 |
|
|
QDomElement iregDescriptionElement = idoc.createElement("reg_description") ;
|
| 5403 |
|
|
QMap<QString,QVector<EziDebugModule::RegStructure*> >::const_iterator k= pmodule->m_iregMap.constBegin();
|
| 5404 |
|
|
while (k!= pmodule->m_iregMap.constEnd())
|
| 5405 |
|
|
{
|
| 5406 |
|
|
for(int m = 0; m < k.value().size(); ++m)
|
| 5407 |
|
|
{
|
| 5408 |
|
|
QDomElement ireg = idoc.createElement("reg") ;
|
| 5409 |
|
|
EziDebugModule::RegStructure * preg = k.value().at(m) ;
|
| 5410 |
|
|
ireg.setAttribute("module_name",QString::fromLocal8Bit(preg->m_pMouduleName));
|
| 5411 |
|
|
ireg.setAttribute("locate_clock",k.key());
|
| 5412 |
|
|
ireg.setAttribute("reg_name",QString::fromLocal8Bit(preg->m_pRegName));
|
| 5413 |
|
|
ireg.setAttribute("regnum",preg->m_pregNum);
|
| 5414 |
|
|
//ireg.setAttribute("endian",preg->m_isEndian);
|
| 5415 |
|
|
// 保存 位宽字符串
|
| 5416 |
|
|
ireg.setAttribute("bitwidth",QString::fromAscii(preg->m_pExpString));
|
| 5417 |
|
|
if(preg->m_eedge == EziDebugModule::signalPosEdge)
|
| 5418 |
|
|
{
|
| 5419 |
|
|
ireg.setAttribute("polarity","posedge");
|
| 5420 |
|
|
}
|
| 5421 |
|
|
else if(preg->m_eedge == EziDebugModule::signalNegEdge)
|
| 5422 |
|
|
{
|
| 5423 |
|
|
ireg.setAttribute("polarity","negedge");
|
| 5424 |
|
|
}
|
| 5425 |
|
|
else
|
| 5426 |
|
|
{
|
| 5427 |
|
|
ireg.setAttribute("polarity","noedge");
|
| 5428 |
|
|
}
|
| 5429 |
|
|
|
| 5430 |
|
|
iregDescriptionElement.appendChild(ireg);
|
| 5431 |
|
|
}
|
| 5432 |
|
|
++k ;
|
| 5433 |
|
|
}
|
| 5434 |
|
|
imoduleElement.appendChild(iregDescriptionElement) ;
|
| 5435 |
|
|
|
| 5436 |
|
|
//qDebug() << "saveInfoToLogFile!" << __LINE__ << __FILE__ ;
|
| 5437 |
|
|
|
| 5438 |
|
|
QDomElement iportDescriptionElement = idoc.createElement("port_description") ;
|
| 5439 |
|
|
for(int n = 0 ; n < pmodule->m_iportVec.size();++n)
|
| 5440 |
|
|
{
|
| 5441 |
|
|
QDomElement iport = idoc.createElement("port") ;
|
| 5442 |
|
|
EziDebugModule::PortStructure *pport = pmodule->m_iportVec.at(n) ;
|
| 5443 |
|
|
iport.setAttribute("port_name",QString::fromLocal8Bit(pport->m_pPortName));
|
| 5444 |
|
|
iport.setAttribute("module_name",QString::fromLocal8Bit(pport->m_pModuleName));
|
| 5445 |
|
|
if(pport->eDirectionType == EziDebugModule::directionTypeInput)
|
| 5446 |
|
|
{
|
| 5447 |
|
|
iport.setAttribute("direction_type","in");
|
| 5448 |
|
|
}
|
| 5449 |
|
|
else if(pport->eDirectionType == EziDebugModule::directionTypeOutput)
|
| 5450 |
|
|
{
|
| 5451 |
|
|
iport.setAttribute("direction_type","out");
|
| 5452 |
|
|
}
|
| 5453 |
|
|
else
|
| 5454 |
|
|
{
|
| 5455 |
|
|
iport.setAttribute("direction_type","inout");
|
| 5456 |
|
|
}
|
| 5457 |
|
|
|
| 5458 |
|
|
iport.setAttribute("bitwidth",QString::fromAscii(pport->m_pBitWidth));
|
| 5459 |
|
|
|
| 5460 |
|
|
// iport.setAttribute("endian",(pport->m_isEndian ? "big" :"little"));
|
| 5461 |
|
|
iportDescriptionElement.appendChild(iport);
|
| 5462 |
|
|
}
|
| 5463 |
|
|
imoduleElement.appendChild(iportDescriptionElement);
|
| 5464 |
|
|
|
| 5465 |
|
|
//qDebug() << "saveInfoToLogFile!" << __LINE__ << __FILE__ ;
|
| 5466 |
|
|
QStringList iportList ;
|
| 5467 |
|
|
QDomElement iinstancePortMapDescriptionElement = idoc.createElement("instance_port_map_description") ;
|
| 5468 |
|
|
QMap<QString,QMap<QString,QString> > iinstancePortMap = pmodule->getInstancePortMap() ;
|
| 5469 |
|
|
QMap<QString,QMap<QString,QString> >::const_iterator instanceportiterator = iinstancePortMap.constBegin();
|
| 5470 |
|
|
while(instanceportiterator != iinstancePortMap.constEnd())
|
| 5471 |
|
|
{
|
| 5472 |
|
|
iportList.clear();
|
| 5473 |
|
|
QDomElement iinstance = idoc.createElement("instance") ;
|
| 5474 |
|
|
iinstance.setAttribute("instance_name",instanceportiterator.key());
|
| 5475 |
|
|
QMap<QString,QString> iportMap = instanceportiterator.value() ;
|
| 5476 |
|
|
QMap<QString,QString>::const_iterator iportMapIterator = iportMap.constBegin();
|
| 5477 |
|
|
while(iportMapIterator != iportMap.constEnd())
|
| 5478 |
|
|
{
|
| 5479 |
|
|
iportList << iportMapIterator.key() + QObject::tr("@") + iportMapIterator.value();
|
| 5480 |
|
|
++iportMapIterator ;
|
| 5481 |
|
|
}
|
| 5482 |
|
|
iinstance.setAttribute("port_map",iportList.join("#"));
|
| 5483 |
|
|
iinstancePortMapDescriptionElement.appendChild(iinstance);
|
| 5484 |
|
|
++instanceportiterator ;
|
| 5485 |
|
|
}
|
| 5486 |
|
|
|
| 5487 |
|
|
imoduleElement.appendChild(iinstancePortMapDescriptionElement);
|
| 5488 |
|
|
imoduleInfoElement.appendChild(imoduleElement);
|
| 5489 |
|
|
}
|
| 5490 |
|
|
else if(type == infoTypeScanChainStructure)
|
| 5491 |
|
|
{
|
| 5492 |
|
|
EziDebugScanChain * pchain = static_cast<EziDebugScanChain*>(info);
|
| 5493 |
|
|
|
| 5494 |
|
|
QDomElement ielement = idoc.elementsByTagName("SCAN_CHAIN_INFO").at(0).toElement() ;
|
| 5495 |
|
|
|
| 5496 |
|
|
// 重新创建log文件时, 保证信息不为空
|
| 5497 |
|
|
if(ielement.attribute("scanreg_core_name").toLower() == "no core")
|
| 5498 |
|
|
{
|
| 5499 |
|
|
QString iregCore = EziDebugScanChain::getChainRegCore().toLower() ;
|
| 5500 |
|
|
if(iregCore == "no core")
|
| 5501 |
|
|
{
|
| 5502 |
|
|
qDebug() << "EziDebug Error: there is no core info!";
|
| 5503 |
|
|
}
|
| 5504 |
|
|
ielement.setAttribute("scanreg_core_name","_EziDebug_ScnReg");
|
| 5505 |
|
|
}
|
| 5506 |
|
|
|
| 5507 |
|
|
if(ielement.attribute("tout_core_name").toLower() == "no core")
|
| 5508 |
|
|
{
|
| 5509 |
|
|
QString itoutCore = EziDebugScanChain::getChainToutCore().toLower() ;
|
| 5510 |
|
|
if(itoutCore == "no core")
|
| 5511 |
|
|
{
|
| 5512 |
|
|
qDebug() << "EziDebug Error: there is no core info!";
|
| 5513 |
|
|
}
|
| 5514 |
|
|
ielement.setAttribute("tout_core_name","_EziDebug_TOUT_m");
|
| 5515 |
|
|
}
|
| 5516 |
|
|
|
| 5517 |
|
|
if(ielement.attribute("user_dir").toLower().toLower() == "no dir")
|
| 5518 |
|
|
{
|
| 5519 |
|
|
ielement.setAttribute("user_dir","/EziDebug_1.0");
|
| 5520 |
|
|
}
|
| 5521 |
|
|
|
| 5522 |
|
|
|
| 5523 |
|
|
QDomElement ichainElement = idoc.createElement("chain") ;
|
| 5524 |
|
|
ichainElement.setAttribute("chain_name",pchain->m_iChainName);
|
| 5525 |
|
|
|
| 5526 |
|
|
ichainElement.setAttribute("instance_list",pchain->m_iinstanceItemList.join("|"));
|
| 5527 |
|
|
|
| 5528 |
|
|
ichainElement.setAttribute("scaned_file_list",pchain->m_iscanedFileNameList.join("|"));
|
| 5529 |
|
|
if(pchain->m_isysCoreOutputPortList.count())
|
| 5530 |
|
|
{
|
| 5531 |
|
|
ichainElement.setAttribute("system_output",pchain->m_isysCoreOutputPortList.join("@"));
|
| 5532 |
|
|
}
|
| 5533 |
|
|
else
|
| 5534 |
|
|
{
|
| 5535 |
|
|
ichainElement.setAttribute("system_output","No Sysoutput");
|
| 5536 |
|
|
}
|
| 5537 |
|
|
|
| 5538 |
|
|
QDomElement iregListDescriptionElement = idoc.createElement("reglist_description");
|
| 5539 |
|
|
|
| 5540 |
|
|
QMap<QString,QVector<QStringList> >::const_iterator iregChainIter = pchain->m_iregChainStructure.constBegin() ;
|
| 5541 |
|
|
while(iregChainIter != pchain->m_iregChainStructure.constEnd())
|
| 5542 |
|
|
{
|
| 5543 |
|
|
QString iinsertClock = iregChainIter.key() ;
|
| 5544 |
|
|
QVector<QStringList> iregListVec = iregChainIter.value() ;
|
| 5545 |
|
|
|
| 5546 |
|
|
for(int p = 0 ; p < iregListVec.size(); ++p)
|
| 5547 |
|
|
{
|
| 5548 |
|
|
QStringList iregList = iregListVec.at(p) ;
|
| 5549 |
|
|
QString iregString ;
|
| 5550 |
|
|
iregString = iregList.join("@");
|
| 5551 |
|
|
|
| 5552 |
|
|
QDomElement iregChainElement = idoc.createElement("regchain") ;
|
| 5553 |
|
|
iregChainElement.setAttribute("insertclock",iinsertClock);
|
| 5554 |
|
|
|
| 5555 |
|
|
iregChainElement.setAttribute("regcount",pchain->m_nregCountMap.value(iinsertClock,0));
|
| 5556 |
|
|
|
| 5557 |
|
|
iregChainElement.setAttribute("reglist",iregString);
|
| 5558 |
|
|
iregListDescriptionElement.appendChild(iregChainElement);
|
| 5559 |
|
|
}
|
| 5560 |
|
|
|
| 5561 |
|
|
++iregChainIter ;
|
| 5562 |
|
|
}
|
| 5563 |
|
|
|
| 5564 |
|
|
ichainElement.appendChild(iregListDescriptionElement);
|
| 5565 |
|
|
|
| 5566 |
|
|
QDomElement icodeDescriptionElement = idoc.createElement("code_description") ;
|
| 5567 |
|
|
|
| 5568 |
|
|
QMap<QString,QStringList>::const_iterator u = pchain->m_icodeMap.constBegin() ;
|
| 5569 |
|
|
while(u != pchain->m_icodeMap.constEnd())
|
| 5570 |
|
|
{
|
| 5571 |
|
|
QStringList iblockCodeList = pchain->m_iblockCodeMap.value(u.key(),QStringList()) ;
|
| 5572 |
|
|
QDomElement icode = idoc.createElement("added_code");
|
| 5573 |
|
|
icode.setAttribute("module_name",u.key());
|
| 5574 |
|
|
|
| 5575 |
|
|
icode.setAttribute("user_line_code",u.value().join("#"));
|
| 5576 |
|
|
icodeDescriptionElement.appendChild(icode);
|
| 5577 |
|
|
|
| 5578 |
|
|
if(iblockCodeList.count())
|
| 5579 |
|
|
{
|
| 5580 |
|
|
icode.setAttribute("user_block_code",iblockCodeList.join("#"));
|
| 5581 |
|
|
}
|
| 5582 |
|
|
else
|
| 5583 |
|
|
{
|
| 5584 |
|
|
icode.setAttribute("user_block_code","No Code");
|
| 5585 |
|
|
}
|
| 5586 |
|
|
++u ;
|
| 5587 |
|
|
}
|
| 5588 |
|
|
|
| 5589 |
|
|
|
| 5590 |
|
|
ichainElement.appendChild(icodeDescriptionElement);
|
| 5591 |
|
|
|
| 5592 |
|
|
ielement.appendChild(ichainElement);
|
| 5593 |
|
|
}
|
| 5594 |
|
|
else
|
| 5595 |
|
|
{
|
| 5596 |
|
|
return 1 ;
|
| 5597 |
|
|
}
|
| 5598 |
|
|
|
| 5599 |
|
|
return 0 ;
|
| 5600 |
|
|
}
|
| 5601 |
|
|
|
| 5602 |
|
|
// 删除指定的 file、module、chain 元素
|
| 5603 |
|
|
int EziDebugPrj::deleteLogFileElement(QDomDocument &idoc ,LOG_FILE_INFO* loginfo)
|
| 5604 |
|
|
{
|
| 5605 |
|
|
QString ielementName ;
|
| 5606 |
|
|
QString iattributionName ;
|
| 5607 |
|
|
if(!loginfo)
|
| 5608 |
|
|
{
|
| 5609 |
|
|
return 1 ;
|
| 5610 |
|
|
}
|
| 5611 |
|
|
QString iinfoName = QString::fromAscii(loginfo->ainfoName);
|
| 5612 |
|
|
INFO_TYPE etype = loginfo->etype ;
|
| 5613 |
|
|
QDomNode ielement ;
|
| 5614 |
|
|
if(etype == infoTypeFileInfo)
|
| 5615 |
|
|
{
|
| 5616 |
|
|
ielement = idoc.elementsByTagName("FILE_INFO").at(0);
|
| 5617 |
|
|
ielementName = "file" ;
|
| 5618 |
|
|
iattributionName = "file_name" ;
|
| 5619 |
|
|
}
|
| 5620 |
|
|
else if(etype == infoTypeModuleStructure)
|
| 5621 |
|
|
{
|
| 5622 |
|
|
ielement = idoc.elementsByTagName("MODULE_INFO").at(0);
|
| 5623 |
|
|
ielementName = "module" ;
|
| 5624 |
|
|
iattributionName = "module_name" ;
|
| 5625 |
|
|
}
|
| 5626 |
|
|
else if(etype == infoTypeScanChainStructure)
|
| 5627 |
|
|
{
|
| 5628 |
|
|
ielement = idoc.elementsByTagName("SCAN_CHAIN_INFO").at(0);
|
| 5629 |
|
|
ielementName = "chain" ;
|
| 5630 |
|
|
iattributionName = "chain_name" ;
|
| 5631 |
|
|
}
|
| 5632 |
|
|
else
|
| 5633 |
|
|
{
|
| 5634 |
|
|
qDebug() << "Error: The element type is not suppport now!";
|
| 5635 |
|
|
return 1 ;
|
| 5636 |
|
|
}
|
| 5637 |
|
|
//ichild.toElement().attribute("module_name")
|
| 5638 |
|
|
QDomNode ichild = ielement.firstChild() ;
|
| 5639 |
|
|
while(!ichild.isNull())
|
| 5640 |
|
|
{
|
| 5641 |
|
|
if((ichild.toElement().tagName() == ielementName )&&(ichild.toElement().attribute(iattributionName) == iinfoName))
|
| 5642 |
|
|
{
|
| 5643 |
|
|
ielement.removeChild(ichild);
|
| 5644 |
|
|
return 0 ;
|
| 5645 |
|
|
}
|
| 5646 |
|
|
ichild = ichild.nextSibling() ;
|
| 5647 |
|
|
}
|
| 5648 |
|
|
|
| 5649 |
|
|
qDebug() << "EziDebug Info: The element is not delete !" ;
|
| 5650 |
|
|
return 0 ;
|
| 5651 |
|
|
|
| 5652 |
|
|
}
|
| 5653 |
|
|
|
| 5654 |
|
|
void EziDebugPrj::addToChainMap(EziDebugScanChain* chain)
|
| 5655 |
|
|
{
|
| 5656 |
|
|
m_ichainInfoMap.insert(chain->getChainName(),chain);
|
| 5657 |
|
|
return ;
|
| 5658 |
|
|
}
|
| 5659 |
|
|
|
| 5660 |
|
|
void EziDebugPrj::addToTreeItemMap(const QString &chain ,EziDebugInstanceTreeItem* item)
|
| 5661 |
|
|
{
|
| 5662 |
|
|
m_ichainTreeItemMap.insert(chain,item);
|
| 5663 |
|
|
return ;
|
| 5664 |
|
|
}
|
| 5665 |
|
|
|
| 5666 |
|
|
void EziDebugPrj::addToQueryItemMap(const QString &name ,EziDebugInstanceTreeItem* item)
|
| 5667 |
|
|
{
|
| 5668 |
|
|
m_iqueryTreeItemMap.insert(name,item);
|
| 5669 |
|
|
return ;
|
| 5670 |
|
|
}
|
| 5671 |
|
|
|
| 5672 |
|
|
// 将所有文件中的宏放入到 prj 中 方便后面读取
|
| 5673 |
|
|
void EziDebugPrj::addToMacroMap(void)
|
| 5674 |
|
|
{
|
| 5675 |
|
|
// 目前只考虑 verilog 的宏 不清楚 vhdl 的宏或者其他参数等
|
| 5676 |
|
|
m_imacro.clear();
|
| 5677 |
|
|
QMap<QString,EziDebugVlgFile*>::const_iterator ifileIter = m_ivlgFileMap.constBegin() ;
|
| 5678 |
|
|
while(ifileIter != m_ivlgFileMap.constEnd())
|
| 5679 |
|
|
{
|
| 5680 |
|
|
EziDebugVlgFile *pfile = ifileIter.value() ;
|
| 5681 |
|
|
QMap<QString,QString> imacroMap = pfile->getMacroMap();
|
| 5682 |
|
|
QMap<QString,QString>::const_iterator imacroIter = imacroMap.constBegin() ;
|
| 5683 |
|
|
while(imacroIter != imacroMap.constEnd())
|
| 5684 |
|
|
{
|
| 5685 |
|
|
QString imacroStr = imacroIter.key() ;
|
| 5686 |
|
|
QString imacroVal = imacroIter.value() ;
|
| 5687 |
|
|
m_imacro.insert(imacroStr,imacroVal);
|
| 5688 |
|
|
++imacroIter ;
|
| 5689 |
|
|
}
|
| 5690 |
|
|
++ifileIter ;
|
| 5691 |
|
|
}
|
| 5692 |
|
|
}
|
| 5693 |
|
|
|
| 5694 |
|
|
const QMap<QString,QString> &EziDebugPrj::getMacroMap(void) const
|
| 5695 |
|
|
{
|
| 5696 |
|
|
return m_imacro ;
|
| 5697 |
|
|
}
|
| 5698 |
|
|
|
| 5699 |
|
|
void EziDebugPrj::addToDefparameterMap(void)
|
| 5700 |
|
|
{
|
| 5701 |
|
|
m_idefparameter.clear();
|
| 5702 |
|
|
QMap<QString,EziDebugVlgFile*>::const_iterator ifileIter = m_ivlgFileMap.constBegin() ;
|
| 5703 |
|
|
while(ifileIter != m_ivlgFileMap.constEnd())
|
| 5704 |
|
|
{
|
| 5705 |
|
|
EziDebugVlgFile* pfile = ifileIter.value();
|
| 5706 |
|
|
QMap<QString,QMap<QString,QString> > idefParamMap = pfile->getDefParamMap() ;
|
| 5707 |
|
|
QMap<QString,QMap<QString,QString> >::const_iterator idefParamIter = idefParamMap.constBegin() ;
|
| 5708 |
|
|
while(idefParamIter != idefParamMap.constEnd())
|
| 5709 |
|
|
{ QMap<QString,QString> iparamMap = idefParamIter.value() ;
|
| 5710 |
|
|
QString iinstanceName = idefParamIter.key() ;
|
| 5711 |
|
|
QMap<QString,QString>::const_iterator iparamIter = iparamMap.constBegin() ;
|
| 5712 |
|
|
while(iparamIter != iparamMap.constEnd())
|
| 5713 |
|
|
{
|
| 5714 |
|
|
QString iparamStr = iparamIter.key() ;
|
| 5715 |
|
|
QString iparamVal = iparamIter.value() ;
|
| 5716 |
|
|
QMap<QString,QString> ivalueMap ;
|
| 5717 |
|
|
ivalueMap = m_idefparameter.value(iinstanceName,ivalueMap) ;
|
| 5718 |
|
|
ivalueMap.insert(iparamStr,iparamVal) ;
|
| 5719 |
|
|
m_idefparameter.insert(iinstanceName,ivalueMap) ;
|
| 5720 |
|
|
++iparamIter ;
|
| 5721 |
|
|
}
|
| 5722 |
|
|
++idefParamIter ;
|
| 5723 |
|
|
}
|
| 5724 |
|
|
++ifileIter ;
|
| 5725 |
|
|
}
|
| 5726 |
|
|
}
|
| 5727 |
|
|
|
| 5728 |
|
|
QMap<QString,QString> EziDebugPrj::getdefparam(const QString &instancename)
|
| 5729 |
|
|
{
|
| 5730 |
|
|
QMap<QString,QString> idefparamMap ;
|
| 5731 |
|
|
return m_idefparameter.value(instancename,idefparamMap) ;
|
| 5732 |
|
|
}
|
| 5733 |
|
|
|
| 5734 |
|
|
EziDebugInstanceTreeItem* EziDebugPrj::getQueryItem(const QString &name)
|
| 5735 |
|
|
{
|
| 5736 |
|
|
return m_iqueryTreeItemMap.value(name,NULL);
|
| 5737 |
|
|
}
|
| 5738 |
|
|
|
| 5739 |
|
|
void EziDebugPrj::updateTreeItem(EziDebugInstanceTreeItem* item)
|
| 5740 |
|
|
{
|
| 5741 |
|
|
EziDebugInstanceTreeItem* pitem = NULL ;
|
| 5742 |
|
|
|
| 5743 |
|
|
// 获得 那些已经加入链的 头节点,用来给新的节点 赋值
|
| 5744 |
|
|
if(m_elastOperation == OperateTypeDelAllScanChain)
|
| 5745 |
|
|
{
|
| 5746 |
|
|
pitem = m_ibackupQueryTreeItemMap.value(item->getNameData(),NULL);
|
| 5747 |
|
|
if(pitem)
|
| 5748 |
|
|
{
|
| 5749 |
|
|
item->setScanChainInfo(pitem->getScanChainInfo()) ;
|
| 5750 |
|
|
m_iqueryTreeItemMap.insert(item->getNameData(),item);
|
| 5751 |
|
|
m_ibackupChainTreeItemMap.insert(pitem->getScanChainInfo()->getChainName(),item);
|
| 5752 |
|
|
}
|
| 5753 |
|
|
}
|
| 5754 |
|
|
else
|
| 5755 |
|
|
{
|
| 5756 |
|
|
pitem = m_iqueryTreeItemMap.value(item->getNameData(),NULL);
|
| 5757 |
|
|
if(pitem)
|
| 5758 |
|
|
{
|
| 5759 |
|
|
item->setScanChainInfo(pitem->getScanChainInfo()) ;
|
| 5760 |
|
|
m_ibackupQueryTreeItemMap.insert(item->getNameData(),item);
|
| 5761 |
|
|
m_ichainTreeItemMap.insert(pitem->getScanChainInfo()->getChainName(),item);
|
| 5762 |
|
|
}
|
| 5763 |
|
|
|
| 5764 |
|
|
// 添加链、或删除链
|
| 5765 |
|
|
if(m_pLastOperteTreeItem)
|
| 5766 |
|
|
{
|
| 5767 |
|
|
if(m_pLastOperteTreeItem->getNameData() == item->getNameData())
|
| 5768 |
|
|
{
|
| 5769 |
|
|
m_pLastOperteTreeItem = item ;
|
| 5770 |
|
|
}
|
| 5771 |
|
|
}
|
| 5772 |
|
|
|
| 5773 |
|
|
}
|
| 5774 |
|
|
|
| 5775 |
|
|
// m_ichainTreeItemMap.insert(pitem->getScanChainInfo()->getChainName(),item);
|
| 5776 |
|
|
|
| 5777 |
|
|
// EziDebugScanChain* pchain = m_ichainInfoMap.value(pitem->getScanChainInfo()->getChainName(),NULL);
|
| 5778 |
|
|
// if(pchain)
|
| 5779 |
|
|
// {
|
| 5780 |
|
|
// pchain->setHeadTreeItem(item);
|
| 5781 |
|
|
// }
|
| 5782 |
|
|
// else
|
| 5783 |
|
|
// {
|
| 5784 |
|
|
// qDebug() << "NULL Pointer!" << __LINE__ << __FILE__ ;
|
| 5785 |
|
|
// }
|
| 5786 |
|
|
|
| 5787 |
|
|
// 遍历所有子节点
|
| 5788 |
|
|
for(int i = 0 ; i < item->childCount() ;i++)
|
| 5789 |
|
|
{
|
| 5790 |
|
|
updateTreeItem(item->child(i));
|
| 5791 |
|
|
}
|
| 5792 |
|
|
|
| 5793 |
|
|
}
|
| 5794 |
|
|
|
| 5795 |
|
|
void EziDebugPrj::eliminateChainFromMap(const QString &chain)
|
| 5796 |
|
|
{
|
| 5797 |
|
|
m_ichainInfoMap.remove(chain);
|
| 5798 |
|
|
return ;
|
| 5799 |
|
|
}
|
| 5800 |
|
|
|
| 5801 |
|
|
void EziDebugPrj::eliminateTreeItemFromMap(const QString &chain)
|
| 5802 |
|
|
|
| 5803 |
|
|
{
|
| 5804 |
|
|
m_ichainTreeItemMap.remove(chain);
|
| 5805 |
|
|
return ;
|
| 5806 |
|
|
}
|
| 5807 |
|
|
|
| 5808 |
|
|
void EziDebugPrj::eliminateTreeItemFromQueryMap(const QString &combinedname)
|
| 5809 |
|
|
{
|
| 5810 |
|
|
m_iqueryTreeItemMap.remove(combinedname);
|
| 5811 |
|
|
return ;
|
| 5812 |
|
|
}
|
| 5813 |
|
|
|
| 5814 |
|
|
void EziDebugPrj::backupChainQueryTreeItemMap(void)
|
| 5815 |
|
|
{
|
| 5816 |
|
|
m_ibackupQueryTreeItemMap = m_iqueryTreeItemMap ;
|
| 5817 |
|
|
return ;
|
| 5818 |
|
|
}
|
| 5819 |
|
|
|
| 5820 |
|
|
void EziDebugPrj::backupChainTreeItemMap(void)
|
| 5821 |
|
|
{
|
| 5822 |
|
|
m_ibackupChainTreeItemMap = m_ichainTreeItemMap ;
|
| 5823 |
|
|
return ;
|
| 5824 |
|
|
}
|
| 5825 |
|
|
|
| 5826 |
|
|
void EziDebugPrj::cleanupBakChainTreeItemMap(void)
|
| 5827 |
|
|
{
|
| 5828 |
|
|
m_ibackupChainTreeItemMap.clear() ;
|
| 5829 |
|
|
return ;
|
| 5830 |
|
|
}
|
| 5831 |
|
|
|
| 5832 |
|
|
void EziDebugPrj::cleanupChainTreeItemMap(void)
|
| 5833 |
|
|
{
|
| 5834 |
|
|
m_ichainTreeItemMap.clear();
|
| 5835 |
|
|
return ;
|
| 5836 |
|
|
}
|
| 5837 |
|
|
|
| 5838 |
|
|
void EziDebugPrj::cleanupChainQueryTreeItemMap(void)
|
| 5839 |
|
|
{
|
| 5840 |
|
|
m_iqueryTreeItemMap.clear();
|
| 5841 |
|
|
return ;
|
| 5842 |
|
|
}
|
| 5843 |
|
|
|
| 5844 |
|
|
void EziDebugPrj::cleanupBakChainQueryTreeItemMap(void)
|
| 5845 |
|
|
{
|
| 5846 |
|
|
m_ibackupQueryTreeItemMap.clear();
|
| 5847 |
|
|
return ;
|
| 5848 |
|
|
}
|
| 5849 |
|
|
|
| 5850 |
|
|
void EziDebugPrj::resumeChainTreeItemMap(void)
|
| 5851 |
|
|
{
|
| 5852 |
|
|
m_ichainTreeItemMap = m_ibackupChainTreeItemMap ;
|
| 5853 |
|
|
}
|
| 5854 |
|
|
|
| 5855 |
|
|
void EziDebugPrj::resumeChainQueryTreeItemMap(void)
|
| 5856 |
|
|
{
|
| 5857 |
|
|
m_iqueryTreeItemMap = m_ibackupQueryTreeItemMap ;
|
| 5858 |
|
|
}
|
| 5859 |
|
|
|
| 5860 |
|
|
void EziDebugPrj::backupChainMap(void)
|
| 5861 |
|
|
{
|
| 5862 |
|
|
m_ibackupChainInfoMap = m_ichainInfoMap ;
|
| 5863 |
|
|
}
|
| 5864 |
|
|
|
| 5865 |
|
|
void EziDebugPrj::cleanupChainMap(void)
|
| 5866 |
|
|
{
|
| 5867 |
|
|
m_ichainInfoMap.clear();
|
| 5868 |
|
|
}
|
| 5869 |
|
|
|
| 5870 |
|
|
void EziDebugPrj::resumeChainMap(void)
|
| 5871 |
|
|
{
|
| 5872 |
|
|
m_ichainInfoMap = m_ibackupChainInfoMap ;
|
| 5873 |
|
|
return ;
|
| 5874 |
|
|
}
|
| 5875 |
|
|
|
| 5876 |
|
|
int EziDebugPrj::createCfgFile(EziDebugInstanceTreeItem * item)
|
| 5877 |
|
|
{
|
| 5878 |
|
|
if(m_eusedTool == ToolQuartus)
|
| 5879 |
|
|
{
|
| 5880 |
|
|
if(m_itoolSoftwareVersion == "8.0")
|
| 5881 |
|
|
{
|
| 5882 |
|
|
/*创建 stp 文件 */
|
| 5883 |
|
|
QString istpFileName("_EziDebug_stp.stp");
|
| 5884 |
|
|
int istpCount = 0 ;
|
| 5885 |
|
|
while(m_iwaveFileList.contains(istpFileName))
|
| 5886 |
|
|
{
|
| 5887 |
|
|
istpFileName = QObject::tr("_EziDebug_stp%1.stp").arg(istpCount);
|
| 5888 |
|
|
istpCount++ ;
|
| 5889 |
|
|
}
|
| 5890 |
|
|
|
| 5891 |
|
|
QFileInfo istpFileInfo(m_iprjPath ,istpFileName);
|
| 5892 |
|
|
QFile istpFile(istpFileInfo.absoluteFilePath());
|
| 5893 |
|
|
|
| 5894 |
|
|
if(!istpFile.open(QIODevice::WriteOnly|QIODevice::Text))
|
| 5895 |
|
|
{
|
| 5896 |
|
|
qDebug() << "Cannot Open file for reading:" << qPrintable(istpFile.errorString());
|
| 5897 |
|
|
return 1 ;
|
| 5898 |
|
|
}
|
| 5899 |
|
|
|
| 5900 |
|
|
QTextStream istpOutStream(&istpFile) ;
|
| 5901 |
|
|
|
| 5902 |
|
|
/*判断软件版本*/
|
| 5903 |
|
|
QString ifileContent ;
|
| 5904 |
|
|
// <session sof_file="" top_level_entity="tb_ifft_top">
|
| 5905 |
|
|
QString ilabelSessionStart(QObject::tr("<session sof_file=\"\" top_level_entity=\"%1\">").arg(m_itopModule));
|
| 5906 |
|
|
// <display_tree gui_logging_enabled="0">
|
| 5907 |
|
|
QString ilabelDisplay_treeStart(QObject::tr("\n <display_tree gui_logging_enabled=\"0\">"));
|
| 5908 |
|
|
ifileContent.append(ilabelSessionStart);
|
| 5909 |
|
|
ifileContent.append(ilabelDisplay_treeStart);
|
| 5910 |
|
|
|
| 5911 |
|
|
/*
|
| 5912 |
|
|
<display_branch instance="auto_signaltap_0" signal_set="USE_GLOBAL_TEMP" trigger="USE_GLOBAL_TEMP"/>
|
| 5913 |
|
|
<display_branch instance="auto_signaltap_1" signal_set="USE_GLOBAL_TEMP" trigger="USE_GLOBAL_TEMP"/>
|
| 5914 |
|
|
*/
|
| 5915 |
|
|
|
| 5916 |
|
|
EziDebugModule *pmodule = this->getPrjModuleMap().value(item->getModuleName());
|
| 5917 |
|
|
|
| 5918 |
|
|
for(int i = 0 ; i < pmodule->getClockSignal().count() ;i++)
|
| 5919 |
|
|
{
|
| 5920 |
|
|
QString ilabelDisplay_branch(QObject::tr("\n <display_branch instance=\"auto_signaltap_%1\" signal_set=\"USE_GLOBAL_TEMP\" trigger=\"USE_GLOBAL_TEMP\"/>")\
|
| 5921 |
|
|
.arg(i)) ;
|
| 5922 |
|
|
ifileContent.append(ilabelDisplay_branch);
|
| 5923 |
|
|
}
|
| 5924 |
|
|
|
| 5925 |
|
|
// </display_tree>
|
| 5926 |
|
|
QString ilabelDisplay_treeEnd(QObject::tr("\n </display_tree>")) ;
|
| 5927 |
|
|
ifileContent.append(ilabelDisplay_treeEnd);
|
| 5928 |
|
|
|
| 5929 |
|
|
|
| 5930 |
|
|
/*创建 各个时钟 的 instance */
|
| 5931 |
|
|
|
| 5932 |
|
|
/*
|
| 5933 |
|
|
<instance entity_name="sld_signaltap" is_auto_node="yes" is_expanded="true" name="auto_signaltap_0" source_file="sld_signaltap.vhd">
|
| 5934 |
|
|
<node_ip_info instance_id="0" mfg_id="110" node_id="0" version="6"/>
|
| 5935 |
|
|
<position_info>
|
| 5936 |
|
|
<single attribute="active tab" value="1"/>
|
| 5937 |
|
|
<single attribute="setup horizontal scroll position" value="0"/>
|
| 5938 |
|
|
<single attribute="setup vertical scroll position" value="0"/>
|
| 5939 |
|
|
</position_info>
|
| 5940 |
|
|
*/
|
| 5941 |
|
|
|
| 5942 |
|
|
// QString ilabelInstanceStart(tr(""\
|
| 5943 |
|
|
// "<instance entity_name=\"sld_signaltap\" is_auto_node=\"yes\" is_expanded=\"true\" name=\"auto_signaltap_0\" source_file=\"sld_signaltap.vhd\">")) ;
|
| 5944 |
|
|
|
| 5945 |
|
|
|
| 5946 |
|
|
// ifileContent.append(ilabelInstanceStart);
|
| 5947 |
|
|
|
| 5948 |
|
|
QString iinstanceString = constructCfgInstanceString(item);
|
| 5949 |
|
|
|
| 5950 |
|
|
if(iinstanceString.isEmpty())
|
| 5951 |
|
|
{
|
| 5952 |
|
|
return 1 ;
|
| 5953 |
|
|
}
|
| 5954 |
|
|
ifileContent.append(iinstanceString);
|
| 5955 |
|
|
|
| 5956 |
|
|
QString ilabelGlobal_infoStart(QObject::tr("\n <global_info>"));
|
| 5957 |
|
|
ifileContent.append(ilabelGlobal_infoStart);
|
| 5958 |
|
|
|
| 5959 |
|
|
QString ilabelSingle1(QObject::tr("\n <single attribute=\"active instance\" value=\"0\"/>"));
|
| 5960 |
|
|
ifileContent.append(ilabelSingle1);
|
| 5961 |
|
|
|
| 5962 |
|
|
QString ilabelSingle2(QObject::tr("\n <single attribute=\"lock mode\" value=\"36110\"/>"));
|
| 5963 |
|
|
ifileContent.append(ilabelSingle2);
|
| 5964 |
|
|
|
| 5965 |
|
|
QString ilabelmulti1(QObject::tr("\n <multi attribute=\"column width\" size=\"18\" value=\"34,34,223,74,68,70,88,100,101,101,101,101,101,101,101,101,107,78\"/>"));
|
| 5966 |
|
|
ifileContent.append(ilabelmulti1);
|
| 5967 |
|
|
|
| 5968 |
|
|
QString ilabelmulti2(QObject::tr("\n <multi attribute=\"window position\" size=\"9\" value=\"1440,799,398,124,356,50,124,0,0\"/>"));
|
| 5969 |
|
|
ifileContent.append(ilabelmulti2);
|
| 5970 |
|
|
|
| 5971 |
|
|
QString ilabelGlobal_infoEnd(QObject::tr("\n </global_info>"));
|
| 5972 |
|
|
ifileContent.append(ilabelGlobal_infoEnd);
|
| 5973 |
|
|
|
| 5974 |
|
|
QString ilabelSessionEnd(QObject::tr("\n</session>"));
|
| 5975 |
|
|
ifileContent.append(ilabelSessionEnd);
|
| 5976 |
|
|
|
| 5977 |
|
|
istpOutStream << ifileContent ;
|
| 5978 |
|
|
|
| 5979 |
|
|
istpFile.close();
|
| 5980 |
|
|
|
| 5981 |
|
|
QFile iprjFile(m_iprjName);
|
| 5982 |
|
|
if(!iprjFile.open(QIODevice::ReadOnly|QIODevice::Text))
|
| 5983 |
|
|
{
|
| 5984 |
|
|
qDebug() << "Cannot Open file for reading:" << qPrintable(iprjFile.errorString());
|
| 5985 |
|
|
return 1 ;
|
| 5986 |
|
|
}
|
| 5987 |
|
|
|
| 5988 |
|
|
QTextStream iinStream(&iprjFile) ;
|
| 5989 |
|
|
QString ifileAllString = iinStream.readAll();
|
| 5990 |
|
|
iprjFile.close();
|
| 5991 |
|
|
|
| 5992 |
|
|
int nlastPosOfVlgKeyWord = ifileAllString.lastIndexOf(QRegExp(QObject::tr("\\bVERILOG_FILE\\b")));
|
| 5993 |
|
|
int nlastPosOfVhdlKeyWord = ifileAllString.lastIndexOf(QRegExp(QObject::tr("\\bVHDL_FILE\\b"))) ;
|
| 5994 |
|
|
|
| 5995 |
|
|
|
| 5996 |
|
|
if(nlastPosOfVlgKeyWord > nlastPosOfVhdlKeyWord)
|
| 5997 |
|
|
{
|
| 5998 |
|
|
int ienterPos = ifileAllString.indexOf('\n',nlastPosOfVlgKeyWord);
|
| 5999 |
|
|
|
| 6000 |
|
|
ifileAllString.insert(ienterPos,QObject::tr("\n""set_global_assignment -name SIGNALTAP_FILE %1").arg(istpFileName));
|
| 6001 |
|
|
}
|
| 6002 |
|
|
else
|
| 6003 |
|
|
{
|
| 6004 |
|
|
int ienterPos = ifileAllString.indexOf('\n',nlastPosOfVhdlKeyWord);
|
| 6005 |
|
|
ifileAllString.insert(ienterPos,QObject::tr("\n""set_global_assignment -name SIGNALTAP_FILE %1").arg(istpFileName));
|
| 6006 |
|
|
}
|
| 6007 |
|
|
|
| 6008 |
|
|
|
| 6009 |
|
|
if(!iprjFile.open(QIODevice::WriteOnly|QIODevice::Text|QIODevice::Truncate))
|
| 6010 |
|
|
{
|
| 6011 |
|
|
qDebug() << "Cannot Open file for reading:" << qPrintable(iprjFile.errorString());
|
| 6012 |
|
|
return 1 ;
|
| 6013 |
|
|
}
|
| 6014 |
|
|
|
| 6015 |
|
|
QTextStream iprjOutStream(&iprjFile) ;
|
| 6016 |
|
|
|
| 6017 |
|
|
iprjOutStream << ifileAllString ;
|
| 6018 |
|
|
|
| 6019 |
|
|
iprjFile.close();
|
| 6020 |
|
|
|
| 6021 |
|
|
}
|
| 6022 |
|
|
}
|
| 6023 |
|
|
else if(m_eusedTool == ToolIse)
|
| 6024 |
|
|
{
|
| 6025 |
|
|
QString iinstanceName = item->getInstanceName();
|
| 6026 |
|
|
QString ifileContent(QObject::tr("#ChipScope Core Inserter Project File Version 3.0")) ;
|
| 6027 |
|
|
/*创建 cdc 文件 */
|
| 6028 |
|
|
QString icdcFileName(QObject::tr("_EziDebug_%1.cdc").arg(iinstanceName));
|
| 6029 |
|
|
QString ichainName(item->getScanChainInfo()->getChainName()) ;
|
| 6030 |
|
|
QString iilaStr ;
|
| 6031 |
|
|
int icdcCount = 0 ;
|
| 6032 |
|
|
while(m_iprjPath.exists(icdcFileName))
|
| 6033 |
|
|
{
|
| 6034 |
|
|
icdcFileName = QObject::tr("_EziDebug_%1.cdc").arg(iinstanceName+QString::number(icdcCount));
|
| 6035 |
|
|
icdcCount++ ;
|
| 6036 |
|
|
}
|
| 6037 |
|
|
QString iprjPath ;
|
| 6038 |
|
|
iprjPath.clear();
|
| 6039 |
|
|
QString iinputFilePath = m_iprjPath.absolutePath();
|
| 6040 |
|
|
|
| 6041 |
|
|
QString isingleSep(QDir::separator());
|
| 6042 |
|
|
QString idoubleSep ;
|
| 6043 |
|
|
|
| 6044 |
|
|
if(isingleSep == "\\")
|
| 6045 |
|
|
{
|
| 6046 |
|
|
isingleSep = "\\";
|
| 6047 |
|
|
idoubleSep = "\\\\" ;
|
| 6048 |
|
|
}
|
| 6049 |
|
|
else
|
| 6050 |
|
|
{
|
| 6051 |
|
|
isingleSep = "\\";
|
| 6052 |
|
|
idoubleSep = "\\\\" ;
|
| 6053 |
|
|
}
|
| 6054 |
|
|
iinputFilePath = QDir::toNativeSeparators(iinputFilePath) ;
|
| 6055 |
|
|
|
| 6056 |
|
|
iinputFilePath.replace(isingleSep ,idoubleSep );
|
| 6057 |
|
|
|
| 6058 |
|
|
|
| 6059 |
|
|
QString icolon ;
|
| 6060 |
|
|
icolon.append(isingleSep + ":");
|
| 6061 |
|
|
iinputFilePath.replace(":", icolon);
|
| 6062 |
|
|
iprjPath.append(iinputFilePath) ;
|
| 6063 |
|
|
iinputFilePath.append(tr("%1%2.ngc").arg(idoubleSep).arg(m_headItem->getModuleName()));
|
| 6064 |
|
|
|
| 6065 |
|
|
QString ioutputDir = iprjPath.append(tr("%1_ngo").arg(idoubleSep));
|
| 6066 |
|
|
|
| 6067 |
|
|
QFileInfo icdcFileInfo(m_iprjPath ,icdcFileName);
|
| 6068 |
|
|
QFile icdcFile(icdcFileInfo.absoluteFilePath());
|
| 6069 |
|
|
if(!icdcFile.open(QIODevice::WriteOnly|QIODevice::Text))
|
| 6070 |
|
|
{
|
| 6071 |
|
|
qDebug() << "Cannot Open file for reading:" << icdcFile.errorString();
|
| 6072 |
|
|
return 1 ;
|
| 6073 |
|
|
}
|
| 6074 |
|
|
|
| 6075 |
|
|
QTextStream icdcOutStream(&icdcFile) ;
|
| 6076 |
|
|
|
| 6077 |
|
|
QDate icurrentDate = QDate::currentDate() ;
|
| 6078 |
|
|
QTime icurrentTime = QTime::currentTime() ;
|
| 6079 |
|
|
|
| 6080 |
|
|
//QString idateCom = QObject::tr("%1" "%2" "%3").arg(day[icurrentDate.dayOfWeek()]).arg(month[icurrentDate.month()]).arg(icurrentDate.daysInMonth());
|
| 6081 |
|
|
// icurrentDate.toString("ddd MMM dd")
|
| 6082 |
|
|
QString itimeString(QObject::tr("\n""#%1 %2 %3 %4 CST %5")\
|
| 6083 |
|
|
.arg(day[icurrentDate.dayOfWeek()]) \
|
| 6084 |
|
|
.arg(month[icurrentDate.month()])\
|
| 6085 |
|
|
.arg(icurrentDate.toString("dd"))\
|
| 6086 |
|
|
.arg(icurrentTime.toString(QObject::tr("hh:mm:ss")))
|
| 6087 |
|
|
.arg(icurrentDate.year())) ;
|
| 6088 |
|
|
|
| 6089 |
|
|
|
| 6090 |
|
|
/*工程 导入 的网表文件 和 导出的 网表文件 */
|
| 6091 |
|
|
QString iinNetFile(QObject::tr("\n""Project.device.designInputFile=%1").arg(iinputFilePath));
|
| 6092 |
|
|
QString ioutNetFile(QObject::tr("\n""Project.device.designOutputFile=%1").arg(iinputFilePath));
|
| 6093 |
|
|
|
| 6094 |
|
|
QString ideviceFamily(QObject::tr("\n""Project.device.deviceFamily=12"));
|
| 6095 |
|
|
QString idevice_enableRPMs(QObject::tr("\n""Project.device.enableRPMs=true"));
|
| 6096 |
|
|
QString idevice_outputDirectory(QObject::tr("\n""Project.device.outputDirectory=%1").arg(ioutputDir));
|
| 6097 |
|
|
QString idevice_useSRL16(QObject::tr("\n""Project.device.useSRL16=true"));
|
| 6098 |
|
|
QString ifilter_dimension(QObject::tr("\n""Project.filter.dimension=1"));
|
| 6099 |
|
|
QString ifilter(QObject::tr("\n""Project.filter<0>="));
|
| 6100 |
|
|
QString iicon_boundaryScanChain(QObject::tr("\n""Project.icon.boundaryScanChain=1"));
|
| 6101 |
|
|
QString iicon_disableBUFGInsertion(QObject::tr("\n""Project.icon.disableBUFGInsertion=false"));
|
| 6102 |
|
|
QString iicon_enableExtTriggerIn(QObject::tr("\n""Project.icon.enableExtTriggerIn=false"));
|
| 6103 |
|
|
QString iicon_enableExtTriggerOut(QObject::tr("\n""Project.icon.enableExtTriggerOut=false"));
|
| 6104 |
|
|
QString iicon_triggerInPinName(QObject::tr("\n""Project.icon.triggerInPinName="));
|
| 6105 |
|
|
QString iicon_triggerOutPinName(QObject::tr("\n""Project.icon.triggerOutPinName="));
|
| 6106 |
|
|
|
| 6107 |
|
|
|
| 6108 |
|
|
/*
|
| 6109 |
|
|
#ChipScope Core Inserter Project File Version 3.0
|
| 6110 |
|
|
#Mon Sep 03 15:30:56 CST 2012
|
| 6111 |
|
|
Project.device.designInputFile=E\:\\gy\\ise_test\\ise_test.ngc
|
| 6112 |
|
|
Project.device.designOutputFile=E\:\\gy\\ise_test\\ise_test.ngc
|
| 6113 |
|
|
Project.device.deviceFamily=12
|
| 6114 |
|
|
Project.device.enableRPMs=true
|
| 6115 |
|
|
Project.device.outputDirectory=E\:\\gy\\ise_test\\_ngo
|
| 6116 |
|
|
Project.device.useSRL16=true
|
| 6117 |
|
|
Project.filter.dimension=1
|
| 6118 |
|
|
Project.filter<0>=
|
| 6119 |
|
|
Project.icon.boundaryScanChain=1
|
| 6120 |
|
|
Project.icon.disableBUFGInsertion=false
|
| 6121 |
|
|
Project.icon.enableExtTriggerIn=false
|
| 6122 |
|
|
Project.icon.enableExtTriggerOut=false
|
| 6123 |
|
|
Project.icon.triggerInPinName=
|
| 6124 |
|
|
Project.icon.triggerOutPinName=
|
| 6125 |
|
|
Project.unit.dimension=1
|
| 6126 |
|
|
Project.unit<0>.clockChannel=clk_BUFGP
|
| 6127 |
|
|
Project.unit<0>.clockEdge=Rising
|
| 6128 |
|
|
Project.unit<0>.dataDepth=512
|
| 6129 |
|
|
Project.unit<0>.dataEqualsTrigger=true
|
| 6130 |
|
|
Project.unit<0>.dataPortWidth=2
|
| 6131 |
|
|
Project.unit<0>.enableGaps=false
|
| 6132 |
|
|
Project.unit<0>.enableStorageQualification=true
|
| 6133 |
|
|
Project.unit<0>.enableTimestamps=false
|
| 6134 |
|
|
Project.unit<0>.timestampDepth=0
|
| 6135 |
|
|
Project.unit<0>.timestampWidth=0
|
| 6136 |
|
|
Project.unit<0>.triggerChannel<0><0>=cnt1
|
| 6137 |
|
|
Project.unit<0>.triggerChannel<0><1>=cnt2
|
| 6138 |
|
|
Project.unit<0>.triggerConditionCountWidth=0
|
| 6139 |
|
|
Project.unit<0>.triggerMatchCount<0>=1
|
| 6140 |
|
|
Project.unit<0>.triggerMatchCountWidth<0><0>=0
|
| 6141 |
|
|
Project.unit<0>.triggerMatchType<0><0>=0
|
| 6142 |
|
|
Project.unit<0>.triggerPortCount=1
|
| 6143 |
|
|
Project.unit<0>.triggerPortIsData<0>=true
|
| 6144 |
|
|
Project.unit<0>.triggerPortWidth<0>=2
|
| 6145 |
|
|
Project.unit<0>.triggerSequencerLevels=16
|
| 6146 |
|
|
Project.unit<0>.triggerSequencerType=1
|
| 6147 |
|
|
Project.unit<0>.type=ilaprol
|
| 6148 |
|
|
*/
|
| 6149 |
|
|
//
|
| 6150 |
|
|
|
| 6151 |
|
|
QMap<QString,QString> iclockMap = item->parent()->getModuleClockMap(item->getInstanceName()) ;
|
| 6152 |
|
|
QString iregHiberarchy = item->getItemHierarchyName();
|
| 6153 |
|
|
|
| 6154 |
|
|
QRegExp ireplaceRegExp(QObject::tr("\\b\\w*:"));
|
| 6155 |
|
|
QRegExp iregExp(QObject::tr("\\b%1:%2.*").arg(item->getModuleName()).arg(item->getInstanceName()));
|
| 6156 |
|
|
QString inewRegHiberarchy = iregHiberarchy.replace('|','/') ;
|
| 6157 |
|
|
inewRegHiberarchy = inewRegHiberarchy.replace(iregExp,"") ;
|
| 6158 |
|
|
// 剔出 modulexxx: 字符
|
| 6159 |
|
|
inewRegHiberarchy.replace(ireplaceRegExp,"");
|
| 6160 |
|
|
|
| 6161 |
|
|
int i = 0 ;
|
| 6162 |
|
|
int ntriggerNum = 0 ;
|
| 6163 |
|
|
|
| 6164 |
|
|
QMap<QString,QString>::const_iterator iclockIterator = iclockMap.constBegin();
|
| 6165 |
|
|
{
|
| 6166 |
|
|
int nregWidth = -1 ;
|
| 6167 |
|
|
ntriggerNum = 0 ;
|
| 6168 |
|
|
QString itriggerChannelString ;
|
| 6169 |
|
|
//Project.unit<0>.clockChannel=clk_BUFGP
|
| 6170 |
|
|
//Project.unit<0>.clockEdge=Rising
|
| 6171 |
|
|
// .arg(iclockIterator.key())
|
| 6172 |
|
|
|
| 6173 |
|
|
#if 0
|
| 6174 |
|
|
QString iedgeString = this->getPrjModuleMap().value(item->getModuleName())->getClockSignal().value(iclockIterator.value());
|
| 6175 |
|
|
if(iedgeString == "posedge")
|
| 6176 |
|
|
{
|
| 6177 |
|
|
iedgeString = QObject::tr("Rising");
|
| 6178 |
|
|
}
|
| 6179 |
|
|
else
|
| 6180 |
|
|
{
|
| 6181 |
|
|
iedgeString = QObject::tr("Descending");
|
| 6182 |
|
|
}
|
| 6183 |
|
|
#endif
|
| 6184 |
|
|
|
| 6185 |
|
|
if((iclockIterator.key() == item->getScanChainInfo()->getscaningPortClock())||(iclockMap.count()==1))
|
| 6186 |
|
|
{
|
| 6187 |
|
|
QString isuffixString ;
|
| 6188 |
|
|
QString itdoPortRegName(QObject::tr("_EziDebug_%1_%2_tdo_r").arg(item->getScanChainInfo()->getChainName()).arg(iclockIterator.value()));
|
| 6189 |
|
|
|
| 6190 |
|
|
|
| 6191 |
|
|
for(int m = (item->getScanChainInfo()->getChildChainNum(iclockIterator.key()) - 1) ; m >= 0 ; m--)
|
| 6192 |
|
|
{
|
| 6193 |
|
|
if(item->getScanChainInfo()->getChildChainNum(iclockIterator.key()) > 1)
|
| 6194 |
|
|
{
|
| 6195 |
|
|
isuffixString = QObject::tr("<%1>").arg(m) ;
|
| 6196 |
|
|
}
|
| 6197 |
|
|
else
|
| 6198 |
|
|
{
|
| 6199 |
|
|
isuffixString.clear();
|
| 6200 |
|
|
}
|
| 6201 |
|
|
|
| 6202 |
|
|
if(nregWidth == 255)
|
| 6203 |
|
|
{
|
| 6204 |
|
|
ntriggerNum++ ;
|
| 6205 |
|
|
nregWidth = 0 ;
|
| 6206 |
|
|
}
|
| 6207 |
|
|
else
|
| 6208 |
|
|
{
|
| 6209 |
|
|
nregWidth++ ;
|
| 6210 |
|
|
}
|
| 6211 |
|
|
|
| 6212 |
|
|
itriggerChannelString.append(QObject::tr("\n""Project.unit<%1>.triggerChannel<%2><%3>=%4")\
|
| 6213 |
|
|
.arg(i).arg(ntriggerNum).arg(nregWidth).arg(inewRegHiberarchy + itdoPortRegName + isuffixString));
|
| 6214 |
|
|
|
| 6215 |
|
|
}
|
| 6216 |
|
|
|
| 6217 |
|
|
// tout
|
| 6218 |
|
|
|
| 6219 |
|
|
if(nregWidth == 255)
|
| 6220 |
|
|
{
|
| 6221 |
|
|
ntriggerNum++ ;
|
| 6222 |
|
|
nregWidth = 0 ;
|
| 6223 |
|
|
}
|
| 6224 |
|
|
else
|
| 6225 |
|
|
{
|
| 6226 |
|
|
nregWidth++ ;
|
| 6227 |
|
|
}
|
| 6228 |
|
|
QString itoutPortRegName(QObject::tr("_EziDebug_%1_tout_r").arg(item->getScanChainInfo()->getChainName()));
|
| 6229 |
|
|
itriggerChannelString.append(QObject::tr("\n""Project.unit<%1>.triggerChannel<%2><%3>=%4")\
|
| 6230 |
|
|
.arg(i).arg(ntriggerNum).arg(nregWidth).arg(inewRegHiberarchy + itoutPortRegName));
|
| 6231 |
|
|
|
| 6232 |
|
|
|
| 6233 |
|
|
|
| 6234 |
|
|
EziDebugModule * pmodule = m_imoduleMap.value(item->getModuleName(),NULL) ;
|
| 6235 |
|
|
|
| 6236 |
|
|
if(!pmodule)
|
| 6237 |
|
|
{
|
| 6238 |
|
|
qDebug() << "EziDebug Error: NULL Pointer!";
|
| 6239 |
|
|
return 1 ;
|
| 6240 |
|
|
}
|
| 6241 |
|
|
|
| 6242 |
|
|
QVector<EziDebugModule::PortStructure*> iportVec = this->getPrjModuleMap().value(item->getModuleName())->getPort(this,item->getInstanceName());
|
| 6243 |
|
|
for(int j = 0 ; j < iportVec.count() ; j++)
|
| 6244 |
|
|
{
|
| 6245 |
|
|
QString iportName = QString::fromAscii(iportVec.at(j)->m_pPortName) ;
|
| 6246 |
|
|
QString iportRegName(QObject::tr("_EziDebug_%1_%2_r").arg(ichainName).arg(iportName));
|
| 6247 |
|
|
// 跳过时钟 复位信号
|
| 6248 |
|
|
if(!(pmodule->getClockSignal().value(iportName,QString())).isEmpty())
|
| 6249 |
|
|
{
|
| 6250 |
|
|
continue ;
|
| 6251 |
|
|
}
|
| 6252 |
|
|
|
| 6253 |
|
|
if(!(pmodule->getResetSignal().value(iportName,QString())).isEmpty())
|
| 6254 |
|
|
{
|
| 6255 |
|
|
continue ;
|
| 6256 |
|
|
}
|
| 6257 |
|
|
|
| 6258 |
|
|
QString isuffixString ;
|
| 6259 |
|
|
for(int m = 0 ; m < iportVec.at(j)->m_unBitwidth ; m++)
|
| 6260 |
|
|
{
|
| 6261 |
|
|
if(1 == iportVec.at(j)->m_unBitwidth)
|
| 6262 |
|
|
{
|
| 6263 |
|
|
isuffixString.clear();
|
| 6264 |
|
|
}
|
| 6265 |
|
|
else
|
| 6266 |
|
|
{
|
| 6267 |
|
|
if(iportVec.at(j)->m_eEndian == EziDebugModule::endianBig)
|
| 6268 |
|
|
{
|
| 6269 |
|
|
|
| 6270 |
|
|
isuffixString = QObject::tr("<%1>").arg(iportVec.at(j)->m_unStartBit- m) ;
|
| 6271 |
|
|
}
|
| 6272 |
|
|
else
|
| 6273 |
|
|
{
|
| 6274 |
|
|
isuffixString = QObject::tr("<%1>").arg(iportVec.at(j)->m_unStartBit + m) ;
|
| 6275 |
|
|
}
|
| 6276 |
|
|
}
|
| 6277 |
|
|
|
| 6278 |
|
|
if(nregWidth == 255)
|
| 6279 |
|
|
{
|
| 6280 |
|
|
ntriggerNum++ ;
|
| 6281 |
|
|
nregWidth = 0 ;
|
| 6282 |
|
|
}
|
| 6283 |
|
|
else
|
| 6284 |
|
|
{
|
| 6285 |
|
|
nregWidth++ ;
|
| 6286 |
|
|
}
|
| 6287 |
|
|
|
| 6288 |
|
|
itriggerChannelString.append(QObject::tr("\n""Project.unit<%1>.triggerChannel<%2><%3>=%4")\
|
| 6289 |
|
|
.arg(i).arg(ntriggerNum).arg(nregWidth).arg(inewRegHiberarchy + iportRegName + isuffixString));
|
| 6290 |
|
|
|
| 6291 |
|
|
}
|
| 6292 |
|
|
}
|
| 6293 |
|
|
|
| 6294 |
|
|
// 内部端口寄存器
|
| 6295 |
|
|
QStringList iportList = item->getScanChainInfo()->getSyscoreOutputPortList() ;
|
| 6296 |
|
|
for(int n = 0 ; n < iportList.count() ; n++ )
|
| 6297 |
|
|
{
|
| 6298 |
|
|
QString ihierarchyName = iportList.at(n).split(QObject::tr("#")).at(0);
|
| 6299 |
|
|
QRegExp ieraseExp(QObject::tr("\\b\\w*:"));
|
| 6300 |
|
|
ihierarchyName.replace(ieraseExp,"");
|
| 6301 |
|
|
ihierarchyName.replace("|","/");
|
| 6302 |
|
|
|
| 6303 |
|
|
QString iregName = iportList.at(n).split(QObject::tr("#")).at(2);
|
| 6304 |
|
|
int nbitWidth = iportList.at(n).split(QObject::tr("#")).at(3).toInt();
|
| 6305 |
|
|
QString isuffixString ;
|
| 6306 |
|
|
for(int n = (nbitWidth -1) ; n >= 0 ; n--)
|
| 6307 |
|
|
{
|
| 6308 |
|
|
if(nbitWidth > 1)
|
| 6309 |
|
|
{
|
| 6310 |
|
|
isuffixString = QObject::tr("<%1>").arg(n) ;
|
| 6311 |
|
|
}
|
| 6312 |
|
|
else
|
| 6313 |
|
|
{
|
| 6314 |
|
|
isuffixString.clear();
|
| 6315 |
|
|
}
|
| 6316 |
|
|
|
| 6317 |
|
|
if(nregWidth == 255)
|
| 6318 |
|
|
{
|
| 6319 |
|
|
ntriggerNum++ ;
|
| 6320 |
|
|
nregWidth = 0 ;
|
| 6321 |
|
|
}
|
| 6322 |
|
|
else
|
| 6323 |
|
|
{
|
| 6324 |
|
|
nregWidth++ ;
|
| 6325 |
|
|
}
|
| 6326 |
|
|
|
| 6327 |
|
|
itriggerChannelString.append(QObject::tr("\n""Project.unit<%1>.triggerChannel<%2><%3>=%4")\
|
| 6328 |
|
|
.arg(i).arg(ntriggerNum).arg(nregWidth).arg(ihierarchyName + iregName + isuffixString));
|
| 6329 |
|
|
}
|
| 6330 |
|
|
}
|
| 6331 |
|
|
|
| 6332 |
|
|
}
|
| 6333 |
|
|
else
|
| 6334 |
|
|
{
|
| 6335 |
|
|
qDebug() << "EziDebug Error: create the cdc file error!";
|
| 6336 |
|
|
return 2 ;
|
| 6337 |
|
|
}
|
| 6338 |
|
|
|
| 6339 |
|
|
QString iclockChannel(QObject::tr("\n""Project.unit<%1>.clockChannel=").arg(i));
|
| 6340 |
|
|
QString iclockEdge(QObject::tr("\n""Project.unit<%1>.clockEdge=").arg(i));
|
| 6341 |
|
|
QString idataDepth(QObject::tr("\n""Project.unit<%1>.dataDepth=%2").arg(i).arg(m_nmaxRegNumInChain*2));
|
| 6342 |
|
|
QString idataEqualsTrigger(QObject::tr("\n""Project.unit<%1>.dataEqualsTrigger=true").arg(i));
|
| 6343 |
|
|
|
| 6344 |
|
|
QString idataPortWidth(QObject::tr("\n""Project.unit<%1>.dataPortWidth=").arg(i));
|
| 6345 |
|
|
QString ienableGaps(QObject::tr("\n""Project.unit<%1>.enableGaps=false").arg(i));
|
| 6346 |
|
|
QString ienableStorageQualification(QObject::tr("\n""Project.unit<%1>.enableStorageQualification=true").arg(i));
|
| 6347 |
|
|
QString ienableTimestamps(QObject::tr("\n""Project.unit<%1>.enableTimestamps=false").arg(i));
|
| 6348 |
|
|
QString itimestampDepth(QObject::tr("\n""Project.unit<%1>.timestampDepth=0").arg(i));
|
| 6349 |
|
|
QString itimestampWidth(QObject::tr("\n""Project.unit<%1>.timestampWidth=0").arg(i));
|
| 6350 |
|
|
|
| 6351 |
|
|
QString itriggerConditionCountWidth(QObject::tr("\n""Project.unit<%1>.triggerConditionCountWidth=0").arg(i));
|
| 6352 |
|
|
QString itriggerMatchCount(QObject::tr("\n""Project.unit<%1>.triggerMatchCount<0>=1").arg(i));
|
| 6353 |
|
|
QString itriggerMatchCountWidth(QObject::tr("\n""Project.unit<%1>.triggerMatchCountWidth<0><0>=0").arg(i));
|
| 6354 |
|
|
QString itriggerMatchType(QObject::tr("\n""Project.unit<%1>.triggerMatchType<0><0>=0").arg(i));
|
| 6355 |
|
|
QString itriggerPortCount(QObject::tr("\n""Project.unit<%1>.triggerPortCount=%2").arg(i).arg(ntriggerNum+1)) ;
|
| 6356 |
|
|
QString itriggerPortIsData ;
|
| 6357 |
|
|
for(int trinum = 0 ; trinum < (ntriggerNum+1);trinum++)
|
| 6358 |
|
|
{
|
| 6359 |
|
|
itriggerPortIsData.append(QObject::tr("\n""Project.unit<%1>.triggerPortIsData<%2>=true").arg(i).arg(trinum));
|
| 6360 |
|
|
}
|
| 6361 |
|
|
|
| 6362 |
|
|
QString itriggerPortWidth ;
|
| 6363 |
|
|
for(int trinum = 0 ; trinum < (ntriggerNum+1);trinum++)
|
| 6364 |
|
|
{
|
| 6365 |
|
|
if(trinum == ntriggerNum)
|
| 6366 |
|
|
{
|
| 6367 |
|
|
itriggerPortWidth.append(QObject::tr("\n""Project.unit<%1>.triggerPortWidth<%2>=%3").arg(i).arg(trinum).arg(nregWidth));
|
| 6368 |
|
|
}
|
| 6369 |
|
|
else
|
| 6370 |
|
|
{
|
| 6371 |
|
|
itriggerPortWidth.append(QObject::tr("\n""Project.unit<%1>.triggerPortWidth<%2>=%3").arg(i).arg(trinum).arg(255));
|
| 6372 |
|
|
}
|
| 6373 |
|
|
}
|
| 6374 |
|
|
QString itriggerSequencerLevels(QObject::tr("\n""Project.unit<%1>.triggerSequencerLevels=16").arg(i));
|
| 6375 |
|
|
QString itriggerSequencerType(QObject::tr("\n""Project.unit<%1>.triggerSequencerType=1").arg(i));
|
| 6376 |
|
|
QString itype(QObject::tr("\n""Project.unit<%1>.type=ilapro").arg(i));
|
| 6377 |
|
|
|
| 6378 |
|
|
|
| 6379 |
|
|
QString iprjUnit = iclockChannel \
|
| 6380 |
|
|
+ iclockEdge \
|
| 6381 |
|
|
+ idataDepth \
|
| 6382 |
|
|
+ idataEqualsTrigger \
|
| 6383 |
|
|
+ idataPortWidth \
|
| 6384 |
|
|
+ ienableGaps \
|
| 6385 |
|
|
+ ienableStorageQualification \
|
| 6386 |
|
|
+ ienableTimestamps \
|
| 6387 |
|
|
+ itimestampDepth \
|
| 6388 |
|
|
+ itimestampWidth \
|
| 6389 |
|
|
+ itriggerChannelString \
|
| 6390 |
|
|
+ itriggerConditionCountWidth \
|
| 6391 |
|
|
+ itriggerMatchCount \
|
| 6392 |
|
|
+ itriggerMatchCountWidth \
|
| 6393 |
|
|
+ itriggerPortCount \
|
| 6394 |
|
|
+ itriggerMatchType \
|
| 6395 |
|
|
+ itriggerPortIsData \
|
| 6396 |
|
|
+ itriggerPortWidth \
|
| 6397 |
|
|
+ itriggerSequencerLevels \
|
| 6398 |
|
|
+ itriggerSequencerType \
|
| 6399 |
|
|
+ itype ;
|
| 6400 |
|
|
iilaStr.append(iprjUnit) ;
|
| 6401 |
|
|
|
| 6402 |
|
|
++i ;
|
| 6403 |
|
|
++iclockIterator ;
|
| 6404 |
|
|
}
|
| 6405 |
|
|
|
| 6406 |
|
|
|
| 6407 |
|
|
QString iunit_dimension(QObject::tr("\n""Project.unit.dimension=%1").arg(i));
|
| 6408 |
|
|
|
| 6409 |
|
|
QString ipartOneString = itimeString \
|
| 6410 |
|
|
+ iinNetFile \
|
| 6411 |
|
|
+ ioutNetFile \
|
| 6412 |
|
|
+ ideviceFamily \
|
| 6413 |
|
|
+ idevice_enableRPMs \
|
| 6414 |
|
|
+ idevice_outputDirectory \
|
| 6415 |
|
|
+ idevice_useSRL16 \
|
| 6416 |
|
|
+ ifilter_dimension \
|
| 6417 |
|
|
+ ifilter \
|
| 6418 |
|
|
+ iicon_boundaryScanChain \
|
| 6419 |
|
|
+ iicon_disableBUFGInsertion \
|
| 6420 |
|
|
+ iicon_enableExtTriggerIn \
|
| 6421 |
|
|
+ iicon_enableExtTriggerOut \
|
| 6422 |
|
|
+ iicon_triggerInPinName \
|
| 6423 |
|
|
+ iicon_triggerOutPinName \
|
| 6424 |
|
|
+ iunit_dimension ;
|
| 6425 |
|
|
|
| 6426 |
|
|
ifileContent.append(ipartOneString) ;
|
| 6427 |
|
|
ifileContent.append(iilaStr) ;
|
| 6428 |
|
|
|
| 6429 |
|
|
icdcOutStream << ifileContent ;
|
| 6430 |
|
|
icdcFile.close();
|
| 6431 |
|
|
}
|
| 6432 |
|
|
else
|
| 6433 |
|
|
{
|
| 6434 |
|
|
/*输出文本*/
|
| 6435 |
|
|
return 1 ;
|
| 6436 |
|
|
}
|
| 6437 |
|
|
|
| 6438 |
|
|
return 0 ;
|
| 6439 |
|
|
}
|
| 6440 |
|
|
|
| 6441 |
|
|
int EziDebugPrj:: chkEziDebugFileInvolved()
|
| 6442 |
|
|
{
|
| 6443 |
|
|
QFile iprjFile(m_iprjName);
|
| 6444 |
|
|
if(!iprjFile.open(QIODevice::Text|QIODevice::ReadOnly))
|
| 6445 |
|
|
{
|
| 6446 |
|
|
qDebug() << "EziDebug Error:Can not Open file for reading:" << qPrintable(iprjFile.errorString());
|
| 6447 |
|
|
return -1 ;
|
| 6448 |
|
|
}
|
| 6449 |
|
|
// "A" "" "" "" "PROP_UserBrowsedStrategyFiles" ""
|
| 6450 |
|
|
QTextStream ifileStream(&iprjFile);
|
| 6451 |
|
|
QString ifileContent = ifileStream.readAll() ;
|
| 6452 |
|
|
iprjFile.close();
|
| 6453 |
|
|
|
| 6454 |
|
|
|
| 6455 |
|
|
if(m_eusedTool == ToolQuartus)
|
| 6456 |
|
|
{
|
| 6457 |
|
|
return 0 ;
|
| 6458 |
|
|
}
|
| 6459 |
|
|
else if(m_eusedTool == ToolIse)
|
| 6460 |
|
|
{
|
| 6461 |
|
|
if(m_itoolSoftwareVersion == "10.x")
|
| 6462 |
|
|
{
|
| 6463 |
|
|
// 修改 set user_files
|
| 6464 |
|
|
|
| 6465 |
|
|
// set user_files
|
| 6466 |
|
|
int nfileKeyPos = ifileContent.indexOf("set user_files") ;
|
| 6467 |
|
|
if(nfileKeyPos != -1)
|
| 6468 |
|
|
{
|
| 6469 |
|
|
int nleftBra = ifileContent.indexOf('}',nfileKeyPos) ;
|
| 6470 |
|
|
if(nleftBra != -1)
|
| 6471 |
|
|
{
|
| 6472 |
|
|
QString ifileListStr = ifileContent.mid(nfileKeyPos,nleftBra - nfileKeyPos + 1);
|
| 6473 |
|
|
if((ifileListStr.contains(QRegExp("\"EziDebug_1.0/_EziDebug_ScanChainReg.v\"")))
|
| 6474 |
|
|
&&(ifileListStr.contains(QRegExp("\"EziDebug_1.0/_EziDebug_TOUT_m.v\""))))
|
| 6475 |
|
|
{
|
| 6476 |
|
|
qDebug() << "The project file already contains the new file info!";
|
| 6477 |
|
|
return 1 ;
|
| 6478 |
|
|
}
|
| 6479 |
|
|
else
|
| 6480 |
|
|
{
|
| 6481 |
|
|
return 0 ;
|
| 6482 |
|
|
}
|
| 6483 |
|
|
|
| 6484 |
|
|
}
|
| 6485 |
|
|
else
|
| 6486 |
|
|
{
|
| 6487 |
|
|
qDebug() << "EziDebug Error:reading filecontent error!" << __LINE__;
|
| 6488 |
|
|
return -1;
|
| 6489 |
|
|
}
|
| 6490 |
|
|
}
|
| 6491 |
|
|
else
|
| 6492 |
|
|
{
|
| 6493 |
|
|
qDebug() << "EziDebug Error:reading filecontent error!" << __LINE__;
|
| 6494 |
|
|
return -1 ;
|
| 6495 |
|
|
}
|
| 6496 |
|
|
}
|
| 6497 |
|
|
else if(m_itoolSoftwareVersion == "14.x")
|
| 6498 |
|
|
{
|
| 6499 |
|
|
return 0 ;
|
| 6500 |
|
|
}
|
| 6501 |
|
|
else
|
| 6502 |
|
|
{
|
| 6503 |
|
|
return 0 ; // do nothing!
|
| 6504 |
|
|
}
|
| 6505 |
|
|
}
|
| 6506 |
|
|
else
|
| 6507 |
|
|
{
|
| 6508 |
|
|
return 0 ; // do nothing!
|
| 6509 |
|
|
}
|
| 6510 |
|
|
}
|
| 6511 |
|
|
|
| 6512 |
|
|
QString EziDebugPrj::constructCfgInstanceString(EziDebugInstanceTreeItem * item)
|
| 6513 |
|
|
{
|
| 6514 |
|
|
/*
|
| 6515 |
|
|
<node_ip_info instance_id="0" mfg_id="110" node_id="0" version="6"/>
|
| 6516 |
|
|
<position_info>
|
| 6517 |
|
|
<single attribute="active tab" value="1"/>
|
| 6518 |
|
|
<single attribute="setup horizontal scroll position" value="0"/>
|
| 6519 |
|
|
<single attribute="setup vertical scroll position" value="0"/>
|
| 6520 |
|
|
</position_info>
|
| 6521 |
|
|
*/
|
| 6522 |
|
|
QString ifileContent ;
|
| 6523 |
|
|
|
| 6524 |
|
|
EziDebugModule *pmodule = this->getPrjModuleMap().value(item->getModuleName());
|
| 6525 |
|
|
|
| 6526 |
|
|
QMap<QString,QString>::const_iterator iclockiterator = pmodule->getClockSignal().constBegin() ;
|
| 6527 |
|
|
|
| 6528 |
|
|
QString iscanPortClock = item->getScanChainInfo()->getscaningPortClock() ;
|
| 6529 |
|
|
if(!iscanPortClock.isEmpty())
|
| 6530 |
|
|
{
|
| 6531 |
|
|
iscanPortClock = item->parent()->getModuleClockMap(item->getInstanceName()).value(item->getScanChainInfo()->getscaningPortClock(),QString());
|
| 6532 |
|
|
}
|
| 6533 |
|
|
else
|
| 6534 |
|
|
{
|
| 6535 |
|
|
if(pmodule->getClockSignal().count()!= 1)
|
| 6536 |
|
|
{
|
| 6537 |
|
|
return QString();
|
| 6538 |
|
|
}
|
| 6539 |
|
|
else
|
| 6540 |
|
|
{
|
| 6541 |
|
|
while(iclockiterator != pmodule->getClockSignal().constEnd())
|
| 6542 |
|
|
{
|
| 6543 |
|
|
iscanPortClock = iclockiterator.key();
|
| 6544 |
|
|
++iclockiterator ;
|
| 6545 |
|
|
}
|
| 6546 |
|
|
}
|
| 6547 |
|
|
}
|
| 6548 |
|
|
|
| 6549 |
|
|
|
| 6550 |
|
|
int i = 0 ;
|
| 6551 |
|
|
iclockiterator = pmodule->getClockSignal().constBegin() ;
|
| 6552 |
|
|
while(iclockiterator != pmodule->getClockSignal().constEnd())
|
| 6553 |
|
|
{
|
| 6554 |
|
|
QString ilabelInstanceStart(QObject::tr("\n <instance entity_name=\"sld_signaltap\" is_auto_node=\"yes\" is_expanded=\"true\" name=\"auto_signaltap_%1\" source_file=\"sld_signaltap.vhd\">").arg(i));
|
| 6555 |
|
|
ifileContent.append(ilabelInstanceStart);
|
| 6556 |
|
|
|
| 6557 |
|
|
QString ilabelNode_ip_info(QObject::tr("\n <node_ip_info instance_id=\"%1\" mfg_id=\"110\" node_id=\"0\" version=\"6\"/>").arg(i));
|
| 6558 |
|
|
ifileContent.append(ilabelNode_ip_info);
|
| 6559 |
|
|
|
| 6560 |
|
|
|
| 6561 |
|
|
/*
|
| 6562 |
|
|
<signal_set global_temp="1" name="signal_set: 2012/10/31 17:44:31 #0">
|
| 6563 |
|
|
<clock name="auto_stp_external_clock_0" polarity="posedge" tap_mode="classic"/>
|
| 6564 |
|
|
<config ram_type="M4K" reserved_data_nodes="0" reserved_trigger_nodes="0" sample_depth="128" trigger_in_enable="no" trigger_out_enable="no"/>
|
| 6565 |
|
|
<top_entity/>
|
| 6566 |
|
|
<signal_vec>
|
| 6567 |
|
|
<trigger_input_vec>
|
| 6568 |
|
|
*/
|
| 6569 |
|
|
QDate icurrentDate = QDate::currentDate();
|
| 6570 |
|
|
QTime icurrentTime = QTime::currentTime();
|
| 6571 |
|
|
|
| 6572 |
|
|
QString ilabelSignal_setStart(QObject::tr("\n <signal_set global_temp=\"1\" name=\"signal_set: %1 %2 #0\">").arg(icurrentDate.toString(QObject::tr("yyyy/MM/dd")))\
|
| 6573 |
|
|
.arg(icurrentTime.toString(QObject::tr("hh:mm:ss")))) ;
|
| 6574 |
|
|
ifileContent.append(ilabelSignal_setStart);
|
| 6575 |
|
|
|
| 6576 |
|
|
QString idefaultLabelClock(QObject::tr("\n <clock name=\"auto_stp_external_clock_0\" polarity=\"posedge\" tap_mode=\"classic\"/>"));
|
| 6577 |
|
|
ifileContent.append(idefaultLabelClock);
|
| 6578 |
|
|
|
| 6579 |
|
|
QString idefaultConfig(QObject::tr("\n <config ram_type=\"M4K\" reserved_data_nodes=\"0\" reserved_trigger_nodes=\"0\" sample_depth=\"128\" trigger_in_enable=\"no\" trigger_out_enable=\"no\"/>"));
|
| 6580 |
|
|
ifileContent.append(idefaultConfig);
|
| 6581 |
|
|
|
| 6582 |
|
|
QString ilabelTop_entity(QObject::tr("\n <top_entity/>"));
|
| 6583 |
|
|
ifileContent.append(ilabelTop_entity);
|
| 6584 |
|
|
|
| 6585 |
|
|
QString ilabelSignal_vecStart(QObject::tr("\n <signal_vec>"));
|
| 6586 |
|
|
ifileContent.append(ilabelSignal_vecStart);
|
| 6587 |
|
|
|
| 6588 |
|
|
QString ilabeltrigger_input_vecStart(QObject::tr("\n <trigger_input_vec>"));
|
| 6589 |
|
|
ifileContent.append(ilabeltrigger_input_vecStart);
|
| 6590 |
|
|
|
| 6591 |
|
|
|
| 6592 |
|
|
// 新加入的 tdo_reg 输出端口 的 reg
|
| 6593 |
|
|
QString iTdoPortName(QObject::tr("_EziDebug_%1_%2_TDO_r").arg(item->getScanChainInfo()->getChainName()).arg(iclockiterator.key()));
|
| 6594 |
|
|
|
| 6595 |
|
|
QString ichainClock = item->parent()->getModuleClockMap(item->getInstanceName()).key(iclockiterator.key(),QString());
|
| 6596 |
|
|
int nchildChainNum = item->getScanChainInfo()->getChildChainNum(ichainClock);
|
| 6597 |
|
|
QString iregTdoHiberarchy = item->getItemHierarchyName();
|
| 6598 |
|
|
if(1 == nchildChainNum)
|
| 6599 |
|
|
{
|
| 6600 |
|
|
QString itdo_reg(QObject::tr("\n <wire name=\"%1\" tap_mode=\"classic\" type=\"register\"/>").arg(iregTdoHiberarchy + iTdoPortName));
|
| 6601 |
|
|
ifileContent.append(itdo_reg);
|
| 6602 |
|
|
}
|
| 6603 |
|
|
else if(nchildChainNum > 1)
|
| 6604 |
|
|
{
|
| 6605 |
|
|
for(int m = 0 ; m < nchildChainNum ; m++)
|
| 6606 |
|
|
{
|
| 6607 |
|
|
QString itdo_reg(QObject::tr("\n <wire name=\"%1[%2]\" tap_mode=\"classic\" type=\"register\"/>").arg(iregTdoHiberarchy + iTdoPortName).arg(m));
|
| 6608 |
|
|
ifileContent.append(itdo_reg);
|
| 6609 |
|
|
}
|
| 6610 |
|
|
}
|
| 6611 |
|
|
else
|
| 6612 |
|
|
{
|
| 6613 |
|
|
return QString();
|
| 6614 |
|
|
}
|
| 6615 |
|
|
|
| 6616 |
|
|
QString iToutRegName(QObject::tr("_EziDebug_%1_TOUT_reg").arg(item->getScanChainInfo()->getChainName()));
|
| 6617 |
|
|
QString itout_reg(QObject::tr("\n <wire name=\"%1\" tap_mode=\"classic\" type=\"register\"/>").arg(iregTdoHiberarchy + iToutRegName));
|
| 6618 |
|
|
ifileContent.append(itout_reg);
|
| 6619 |
|
|
|
| 6620 |
|
|
if(iscanPortClock == iclockiterator.key())
|
| 6621 |
|
|
{
|
| 6622 |
|
|
// 所有观测模块的 输入输出端口的 reg
|
| 6623 |
|
|
QVector<EziDebugModule::PortStructure*> iportVec = pmodule->getPort(this,item->getInstanceName());
|
| 6624 |
|
|
for(int i = 0 ; i < iportVec.count() ;i++)
|
| 6625 |
|
|
{
|
| 6626 |
|
|
QString iportName = QString::fromAscii(iportVec.at(i)->m_pPortName) ;
|
| 6627 |
|
|
if(!(pmodule->getClockSignal().value(iportName,QString())).isEmpty())
|
| 6628 |
|
|
{
|
| 6629 |
|
|
continue ;
|
| 6630 |
|
|
}
|
| 6631 |
|
|
|
| 6632 |
|
|
if(!(pmodule->getResetSignal().value(iportName,QString())).isEmpty())
|
| 6633 |
|
|
{
|
| 6634 |
|
|
continue ;
|
| 6635 |
|
|
}
|
| 6636 |
|
|
|
| 6637 |
|
|
QString iregHiberarchy = item->getItemHierarchyName();
|
| 6638 |
|
|
QString ieziDebugPortName ;
|
| 6639 |
|
|
//ieziDebugPortName.append(QObject::tr("_EziDebug_")+iportName + QObject::tr("_r"));
|
| 6640 |
|
|
ieziDebugPortName.append(QObject::tr("_EziDebug_%1_%2_r").arg(item->getScanChainInfo()->getChainName()).arg(iportName));
|
| 6641 |
|
|
if(1 == iportVec.at(i)->m_unBitwidth)
|
| 6642 |
|
|
{
|
| 6643 |
|
|
QString ilabelwire(QObject::tr("\n <wire name=\"%1\" tap_mode=\"classic\" type=\"register\"/>").arg(iregHiberarchy + ieziDebugPortName));
|
| 6644 |
|
|
ifileContent.append(ilabelwire);
|
| 6645 |
|
|
}
|
| 6646 |
|
|
else
|
| 6647 |
|
|
{
|
| 6648 |
|
|
for(unsigned int j = 0 ;j < iportVec.at(i)->m_unBitwidth ; j++)
|
| 6649 |
|
|
{
|
| 6650 |
|
|
QString ilabelwire(QObject::tr("\n <wire name=\"%1\" tap_mode=\"classic\" type=\"register\"/>").arg(iregHiberarchy +ieziDebugPortName+QObject::tr("[%1]").arg(j)));
|
| 6651 |
|
|
ifileContent.append(ilabelwire);
|
| 6652 |
|
|
}
|
| 6653 |
|
|
}
|
| 6654 |
|
|
}
|
| 6655 |
|
|
}
|
| 6656 |
|
|
|
| 6657 |
|
|
if(iscanPortClock == iclockiterator.key())
|
| 6658 |
|
|
{
|
| 6659 |
|
|
// 内部系统模块的输出端口 reg
|
| 6660 |
|
|
QStringList iportList = item->getScanChainInfo()->getSyscoreOutputPortList() ;
|
| 6661 |
|
|
for(int n = 0 ; n < iportList.count() ;n++)
|
| 6662 |
|
|
{
|
| 6663 |
|
|
QString iportHiberarchy = iportList.at(n).split(QObject::tr("#")).at(0);
|
| 6664 |
|
|
QString iportName = iportList.at(n).split(QObject::tr("#")).at(1);
|
| 6665 |
|
|
QString iportBitWidth = iportList.at(n).split(QObject::tr("#")).at(2) ;
|
| 6666 |
|
|
// QString iportEndian = iportList.at(n).split(QObject::tr("#")).at(3) ;
|
| 6667 |
|
|
|
| 6668 |
|
|
QString iportReg = QObject::tr("_EziDebug_%1_%2_r").arg(item->getScanChainInfo()->getChainName()).arg(iportName);
|
| 6669 |
|
|
|
| 6670 |
|
|
int nportBitWidth = iportBitWidth.toInt();
|
| 6671 |
|
|
if(1 == nportBitWidth)
|
| 6672 |
|
|
{
|
| 6673 |
|
|
QString itdo_reg(QObject::tr("\n <wire name=\"%1\" tap_mode=\"classic\" type=\"register\"/>").arg(iportHiberarchy + iportReg));
|
| 6674 |
|
|
ifileContent.append(itdo_reg);
|
| 6675 |
|
|
}
|
| 6676 |
|
|
else if(nportBitWidth > 1)
|
| 6677 |
|
|
{
|
| 6678 |
|
|
for(int m = 0 ; m < nchildChainNum ; m++)
|
| 6679 |
|
|
{
|
| 6680 |
|
|
QString itdo_reg(QObject::tr("\n <wire name=\"%1[%2]\" tap_mode=\"classic\" type=\"register\"/>").arg(iportHiberarchy + iportReg).arg(m));
|
| 6681 |
|
|
ifileContent.append(itdo_reg);
|
| 6682 |
|
|
}
|
| 6683 |
|
|
}
|
| 6684 |
|
|
else
|
| 6685 |
|
|
{
|
| 6686 |
|
|
return QString();
|
| 6687 |
|
|
}
|
| 6688 |
|
|
}
|
| 6689 |
|
|
}
|
| 6690 |
|
|
|
| 6691 |
|
|
QString ilabeltrigger_input_vecEnd(QObject::tr("\n </trigger_input_vec>"));
|
| 6692 |
|
|
ifileContent.append(ilabeltrigger_input_vecEnd);
|
| 6693 |
|
|
|
| 6694 |
|
|
|
| 6695 |
|
|
QString ilabelData_input_vecStart(QObject::tr("\n <data_input_vec>"));
|
| 6696 |
|
|
ifileContent.append(ilabelData_input_vecStart);
|
| 6697 |
|
|
|
| 6698 |
|
|
|
| 6699 |
|
|
// 新加入的 tdo_reg 输出端口 的 reg
|
| 6700 |
|
|
// QString iTdoPortName(QObject::tr("_EziDebug_%1_%2_TDO_r").arg(item->getScanChainInfo()->getChainName()).arg(iclockiterator.key()));
|
| 6701 |
|
|
// int nchildChainNum = item->getScanChainInfo()->getChildChainNum(iclockiterator.key());
|
| 6702 |
|
|
|
| 6703 |
|
|
if(1 == nchildChainNum)
|
| 6704 |
|
|
{
|
| 6705 |
|
|
QString itdo_reg(QObject::tr("\n <wire name=\"%1\" tap_mode=\"classic\" type=\"register\"/>").arg(iregTdoHiberarchy + iTdoPortName));
|
| 6706 |
|
|
ifileContent.append(itdo_reg);
|
| 6707 |
|
|
}
|
| 6708 |
|
|
else if(nchildChainNum > 1)
|
| 6709 |
|
|
{
|
| 6710 |
|
|
for(int m = 0 ; m < nchildChainNum ; m++)
|
| 6711 |
|
|
{
|
| 6712 |
|
|
QString itdo_reg(QObject::tr("\n <wire name=\"%1[%2]\" tap_mode=\"classic\" type=\"register\"/>").arg(iregTdoHiberarchy + iTdoPortName).arg(m));
|
| 6713 |
|
|
ifileContent.append(itdo_reg);
|
| 6714 |
|
|
}
|
| 6715 |
|
|
}
|
| 6716 |
|
|
else
|
| 6717 |
|
|
{
|
| 6718 |
|
|
return QString();
|
| 6719 |
|
|
}
|
| 6720 |
|
|
|
| 6721 |
|
|
QString itout_reg1(QObject::tr("\n <wire name=\"%1\" tap_mode=\"classic\" type=\"register\"/>").arg(iregTdoHiberarchy + iToutRegName));
|
| 6722 |
|
|
ifileContent.append(itout_reg1);
|
| 6723 |
|
|
|
| 6724 |
|
|
if(iscanPortClock == iclockiterator.key())
|
| 6725 |
|
|
{
|
| 6726 |
|
|
// 所有观测模块的 输入输出端口的 reg
|
| 6727 |
|
|
QVector<EziDebugModule::PortStructure*> iportVec = pmodule->getPort(this,item->getInstanceName());
|
| 6728 |
|
|
for(int i = 0 ; i < iportVec.count() ;i++)
|
| 6729 |
|
|
{
|
| 6730 |
|
|
QString iportName = QString::fromAscii(iportVec.at(i)->m_pPortName) ;
|
| 6731 |
|
|
|
| 6732 |
|
|
if(!(pmodule->getClockSignal().value(iportName,QString())).isEmpty())
|
| 6733 |
|
|
{
|
| 6734 |
|
|
continue ;
|
| 6735 |
|
|
}
|
| 6736 |
|
|
|
| 6737 |
|
|
if(!(pmodule->getResetSignal().value(iportName,QString())).isEmpty())
|
| 6738 |
|
|
{
|
| 6739 |
|
|
continue ;
|
| 6740 |
|
|
}
|
| 6741 |
|
|
|
| 6742 |
|
|
QString iregHiberarchy = item->getItemHierarchyName();
|
| 6743 |
|
|
QString ieziDebugPortName ;
|
| 6744 |
|
|
ieziDebugPortName.append(QObject::tr("_EziDebug_%1_%2_r").arg(item->getScanChainInfo()->getChainName()).arg(iportName));
|
| 6745 |
|
|
if(1 == iportVec.at(i)->m_unBitwidth)
|
| 6746 |
|
|
{
|
| 6747 |
|
|
QString ilabelwire(QObject::tr("\n <wire name=\"%1\" tap_mode=\"classic\" type=\"register\"/>").arg(iregHiberarchy + ieziDebugPortName));
|
| 6748 |
|
|
ifileContent.append(ilabelwire);
|
| 6749 |
|
|
}
|
| 6750 |
|
|
else
|
| 6751 |
|
|
{
|
| 6752 |
|
|
for(unsigned int j = 0 ;j < iportVec.at(i)->m_unBitwidth ; j++)
|
| 6753 |
|
|
{
|
| 6754 |
|
|
QString ilabelwire(QObject::tr("\n <wire name=\"%1\" tap_mode=\"classic\" type=\"register\"/>").arg(iregHiberarchy + ieziDebugPortName + QObject::tr("[%1]").arg(j)));
|
| 6755 |
|
|
ifileContent.append(ilabelwire);
|
| 6756 |
|
|
}
|
| 6757 |
|
|
}
|
| 6758 |
|
|
}
|
| 6759 |
|
|
}
|
| 6760 |
|
|
|
| 6761 |
|
|
|
| 6762 |
|
|
if(iscanPortClock == iclockiterator.key())
|
| 6763 |
|
|
{
|
| 6764 |
|
|
// 内部系统模块的输出端口 reg
|
| 6765 |
|
|
QStringList iportList = item->getScanChainInfo()->getSyscoreOutputPortList() ;
|
| 6766 |
|
|
for(int n = 0 ; n < iportList.count() ;n++)
|
| 6767 |
|
|
{
|
| 6768 |
|
|
QString iportHiberarchy = iportList.at(n).split(QObject::tr("#")).at(0);
|
| 6769 |
|
|
QString iportName = iportList.at(n).split(QObject::tr("#")).at(1);
|
| 6770 |
|
|
int nportBitWidth = iportList.at(n).split(QObject::tr("#")).at(2).toInt();
|
| 6771 |
|
|
|
| 6772 |
|
|
QString iportReg = QObject::tr("_EziDebug_%1_%2_r").arg(item->getScanChainInfo()->getChainName()).arg(iportName);
|
| 6773 |
|
|
|
| 6774 |
|
|
if(1 == nportBitWidth)
|
| 6775 |
|
|
{
|
| 6776 |
|
|
QString itdo_reg(QObject::tr("\n <wire name=\"%1\" tap_mode=\"classic\" type=\"register\"/>").arg(iportHiberarchy + iportReg));
|
| 6777 |
|
|
ifileContent.append(itdo_reg);
|
| 6778 |
|
|
}
|
| 6779 |
|
|
else if(nportBitWidth > 1)
|
| 6780 |
|
|
{
|
| 6781 |
|
|
for(int m = 0 ; m < nchildChainNum ; m++)
|
| 6782 |
|
|
{
|
| 6783 |
|
|
QString itdo_reg(QObject::tr("\n <wire name=\"%1[%2]\" tap_mode=\"classic\" type=\"register\"/>").arg(iportHiberarchy + iportReg).arg(m));
|
| 6784 |
|
|
ifileContent.append(itdo_reg);
|
| 6785 |
|
|
}
|
| 6786 |
|
|
}
|
| 6787 |
|
|
else
|
| 6788 |
|
|
{
|
| 6789 |
|
|
return QString();
|
| 6790 |
|
|
}
|
| 6791 |
|
|
}
|
| 6792 |
|
|
}
|
| 6793 |
|
|
|
| 6794 |
|
|
QString ilabelData_input_vecEnd(QObject::tr("\n </data_input_vec>"));
|
| 6795 |
|
|
ifileContent.append(ilabelData_input_vecEnd);
|
| 6796 |
|
|
|
| 6797 |
|
|
QString ilabelSignal_vecEnd(QObject::tr("\n </signal_vec>"));
|
| 6798 |
|
|
ifileContent.append(ilabelSignal_vecEnd);
|
| 6799 |
|
|
|
| 6800 |
|
|
QString ilabelPresentationStart(QObject::tr("\n <presentation>"));
|
| 6801 |
|
|
ifileContent.append(ilabelPresentationStart);
|
| 6802 |
|
|
|
| 6803 |
|
|
QString ilabelData_viewStart(QObject::tr("\n <data_view>"));
|
| 6804 |
|
|
ifileContent.append(ilabelData_viewStart);
|
| 6805 |
|
|
|
| 6806 |
|
|
|
| 6807 |
|
|
|
| 6808 |
|
|
// 新加入的 tdo_reg 输出端口 的 reg
|
| 6809 |
|
|
// QString iTdoPortName(QObject::tr("_EziDebug_%1_%2_TDO_r").arg(item->getScanChainInfo()->getChainName()).arg(iclockiterator.key()));
|
| 6810 |
|
|
// int nchildChainNum = item->getScanChainInfo()->getChildChainNum(iclockiterator.key());
|
| 6811 |
|
|
|
| 6812 |
|
|
if(1 == nchildChainNum)
|
| 6813 |
|
|
{
|
| 6814 |
|
|
QString ilabelnet(QObject::tr("\n <net is_signal_inverted=\"no\" name=\"%1\"/>").arg(iregTdoHiberarchy + iTdoPortName));
|
| 6815 |
|
|
ifileContent.append(ilabelnet);
|
| 6816 |
|
|
}
|
| 6817 |
|
|
else if(nchildChainNum > 1)
|
| 6818 |
|
|
{
|
| 6819 |
|
|
QString ilabelbusStart(QObject::tr("\n <bus is_signal_inverted=\"no\" link=\"all\" name=\"%1\" order=\"lsb_to_msb\" radix=\"hex\" state=\"collapse\" type=\"register\">").arg(iTdoPortName));
|
| 6820 |
|
|
ifileContent.append(ilabelbusStart);
|
| 6821 |
|
|
for(int m = 0 ; m < nchildChainNum ; m++)
|
| 6822 |
|
|
{
|
| 6823 |
|
|
QString ilabelnet(QObject::tr("\n <net is_signal_inverted=\"no\" name=\"%1[%2]\"/>").arg(iregTdoHiberarchy + iTdoPortName).arg(m));
|
| 6824 |
|
|
ifileContent.append(ilabelnet);
|
| 6825 |
|
|
}
|
| 6826 |
|
|
QString ilabelbusEnd(QObject::tr("\n </bus>"));
|
| 6827 |
|
|
ifileContent.append(ilabelbusEnd);
|
| 6828 |
|
|
}
|
| 6829 |
|
|
else
|
| 6830 |
|
|
{
|
| 6831 |
|
|
return QString();
|
| 6832 |
|
|
}
|
| 6833 |
|
|
|
| 6834 |
|
|
QString itout_reg2(QObject::tr("\n <net is_signal_inverted=\"no\" name=\"%1\"/>").arg(iregTdoHiberarchy + iToutRegName));
|
| 6835 |
|
|
ifileContent.append(itout_reg2);
|
| 6836 |
|
|
|
| 6837 |
|
|
if(iscanPortClock == iclockiterator.key())
|
| 6838 |
|
|
{
|
| 6839 |
|
|
// 所有观测模块的 输入输出端口的 reg
|
| 6840 |
|
|
QVector<EziDebugModule::PortStructure*> iportVec = pmodule->getPort(this,item->getInstanceName());
|
| 6841 |
|
|
for(int i = 0 ; i < iportVec.count() ;i++)
|
| 6842 |
|
|
{
|
| 6843 |
|
|
QString iportName = QString::fromAscii(iportVec.at(i)->m_pPortName) ;
|
| 6844 |
|
|
if(!(pmodule->getClockSignal().value(iportName,QString())).isEmpty())
|
| 6845 |
|
|
{
|
| 6846 |
|
|
continue ;
|
| 6847 |
|
|
}
|
| 6848 |
|
|
|
| 6849 |
|
|
if(!(pmodule->getResetSignal().value(iportName,QString())).isEmpty())
|
| 6850 |
|
|
{
|
| 6851 |
|
|
continue ;
|
| 6852 |
|
|
}
|
| 6853 |
|
|
|
| 6854 |
|
|
QString iregHiberarchy = item->getItemHierarchyName();
|
| 6855 |
|
|
QString ieziDebugPortName ;
|
| 6856 |
|
|
//ieziDebugPortName.append(QObject::tr("_EziDebug_")+iportName + QObject::tr("_r"));
|
| 6857 |
|
|
ieziDebugPortName.append(QObject::tr("_EziDebug_%1_%2_r").arg(item->getScanChainInfo()->getChainName()).arg(iportName));
|
| 6858 |
|
|
if(1 == iportVec.at(i)->m_unBitwidth)
|
| 6859 |
|
|
{
|
| 6860 |
|
|
QString ilabelnet(QObject::tr("\n <net is_signal_inverted=\"no\" name=\"%1\"/>").arg(iregHiberarchy + ieziDebugPortName));
|
| 6861 |
|
|
ifileContent.append(ilabelnet);
|
| 6862 |
|
|
}
|
| 6863 |
|
|
else
|
| 6864 |
|
|
{
|
| 6865 |
|
|
QString ilabelbusStart(QObject::tr("\n <bus is_signal_inverted=\"no\" link=\"all\" name=\"%1\" order=\"lsb_to_msb\" radix=\"hex\" state=\"collapse\" type=\"register\">").arg(ieziDebugPortName));
|
| 6866 |
|
|
ifileContent.append(ilabelbusStart);
|
| 6867 |
|
|
for(unsigned int j = 0 ;j < iportVec.at(i)->m_unBitwidth ; j++)
|
| 6868 |
|
|
{
|
| 6869 |
|
|
QString ilabelnet(QObject::tr("\n <net is_signal_inverted=\"no\" name=\"%1[%2]\"/>").arg(iregHiberarchy + ieziDebugPortName).arg(j));
|
| 6870 |
|
|
ifileContent.append(ilabelnet);
|
| 6871 |
|
|
}
|
| 6872 |
|
|
QString ilabelbusEnd(QObject::tr("\n </bus>"));
|
| 6873 |
|
|
ifileContent.append(ilabelbusEnd);
|
| 6874 |
|
|
}
|
| 6875 |
|
|
}
|
| 6876 |
|
|
}
|
| 6877 |
|
|
|
| 6878 |
|
|
|
| 6879 |
|
|
if(iscanPortClock == iclockiterator.key())
|
| 6880 |
|
|
{
|
| 6881 |
|
|
// 内部系统模块的输出端口 reg
|
| 6882 |
|
|
QStringList iportList = item->getScanChainInfo()->getSyscoreOutputPortList() ;
|
| 6883 |
|
|
for(int n = 0 ; n < iportList.count() ;n++)
|
| 6884 |
|
|
{
|
| 6885 |
|
|
QString iportHiberarchy = iportList.at(n).split(QObject::tr("#")).at(0);
|
| 6886 |
|
|
QString iportName = iportList.at(n).split(QObject::tr("#")).at(1);
|
| 6887 |
|
|
int nportBitWidth = iportList.at(n).split(QObject::tr("#")).at(2).toInt();
|
| 6888 |
|
|
QString iportReg = QObject::tr("_EziDebug_%1_%2_r").arg(item->getScanChainInfo()->getChainName()).arg(iportName);
|
| 6889 |
|
|
|
| 6890 |
|
|
if(1 == nportBitWidth)
|
| 6891 |
|
|
{
|
| 6892 |
|
|
QString ilabelnet(QObject::tr("\n <net is_signal_inverted=\"no\" name=\"%1\"/>").arg(iportHiberarchy + iportReg));
|
| 6893 |
|
|
ifileContent.append(ilabelnet);
|
| 6894 |
|
|
}
|
| 6895 |
|
|
else if(nportBitWidth > 1)
|
| 6896 |
|
|
{
|
| 6897 |
|
|
QString ilabelbusStart(QObject::tr("\n <bus is_signal_inverted=\"no\" link=\"all\" name=\"%1\" order=\"lsb_to_msb\" radix=\"hex\" state=\"collapse\" type=\"register\">").arg(iportHiberarchy + iportReg));
|
| 6898 |
|
|
ifileContent.append(ilabelbusStart);
|
| 6899 |
|
|
for(int m = 0 ; m < nchildChainNum ; m++)
|
| 6900 |
|
|
{
|
| 6901 |
|
|
QString ilabelnet(QObject::tr("\n <net is_signal_inverted=\"no\" name=\"%1[%2]\"/>").arg(iportHiberarchy + iportName).arg(m));
|
| 6902 |
|
|
ifileContent.append(ilabelnet);
|
| 6903 |
|
|
}
|
| 6904 |
|
|
QString ilabelbusEnd(QObject::tr("\n </bus>"));
|
| 6905 |
|
|
ifileContent.append(ilabelbusEnd);
|
| 6906 |
|
|
}
|
| 6907 |
|
|
else
|
| 6908 |
|
|
{
|
| 6909 |
|
|
return QString();
|
| 6910 |
|
|
}
|
| 6911 |
|
|
}
|
| 6912 |
|
|
}
|
| 6913 |
|
|
|
| 6914 |
|
|
QString ilabelData_viewEnd(QObject::tr("\n </data_view>"));
|
| 6915 |
|
|
ifileContent.append(ilabelData_viewEnd);
|
| 6916 |
|
|
|
| 6917 |
|
|
|
| 6918 |
|
|
QString ilabelSetup_viewStart(QObject::tr("\n <setup_view>"));
|
| 6919 |
|
|
ifileContent.append(ilabelSetup_viewStart);
|
| 6920 |
|
|
|
| 6921 |
|
|
|
| 6922 |
|
|
// 新加入的 tdo_reg 输出端口 的 reg
|
| 6923 |
|
|
// QString iTdoPortName(QObject::tr("_EziDebug_%1_%2_TDO_r").arg(item->getScanChainInfo()->getChainName()).arg(iclockiterator.key()));
|
| 6924 |
|
|
// int nchildChainNum = item->getScanChainInfo()->getChildChainNum(iclockiterator.key());
|
| 6925 |
|
|
|
| 6926 |
|
|
if(1 == nchildChainNum)
|
| 6927 |
|
|
{
|
| 6928 |
|
|
QString ilabelnet(QObject::tr("\n <net is_signal_inverted=\"no\" name=\"%1\"/>").arg(iregTdoHiberarchy + iTdoPortName));
|
| 6929 |
|
|
ifileContent.append(ilabelnet);
|
| 6930 |
|
|
}
|
| 6931 |
|
|
else if(nchildChainNum > 1)
|
| 6932 |
|
|
{
|
| 6933 |
|
|
QString ilabelbusStart(QObject::tr("\n <bus is_signal_inverted=\"no\" link=\"all\" name=\"%1\" order=\"lsb_to_msb\" radix=\"hex\" state=\"collapse\" type=\"register\">").arg(iTdoPortName));
|
| 6934 |
|
|
ifileContent.append(ilabelbusStart);
|
| 6935 |
|
|
for(int m = 0 ; m < nchildChainNum ; m++)
|
| 6936 |
|
|
{
|
| 6937 |
|
|
QString ilabelnet(QObject::tr("\n <net is_signal_inverted=\"no\" name=\"%1[%2]\"/>").arg(iregTdoHiberarchy + iTdoPortName).arg(m));
|
| 6938 |
|
|
ifileContent.append(ilabelnet);
|
| 6939 |
|
|
}
|
| 6940 |
|
|
QString ilabelbusEnd(QObject::tr("\n </bus>"));
|
| 6941 |
|
|
ifileContent.append(ilabelbusEnd);
|
| 6942 |
|
|
}
|
| 6943 |
|
|
else
|
| 6944 |
|
|
{
|
| 6945 |
|
|
return QString();
|
| 6946 |
|
|
}
|
| 6947 |
|
|
|
| 6948 |
|
|
QString itout_reg3(QObject::tr("\n <net is_signal_inverted=\"no\" name=\"%1\"/>").arg(iregTdoHiberarchy + iToutRegName));
|
| 6949 |
|
|
ifileContent.append(itout_reg3);
|
| 6950 |
|
|
|
| 6951 |
|
|
if(iscanPortClock == iclockiterator.key())
|
| 6952 |
|
|
{
|
| 6953 |
|
|
// 所有观测模块的 输入输出端口的 reg
|
| 6954 |
|
|
QVector<EziDebugModule::PortStructure*> iportVec = pmodule->getPort(this,item->getInstanceName());
|
| 6955 |
|
|
for(int i = 0 ; i < iportVec.count() ;i++)
|
| 6956 |
|
|
{
|
| 6957 |
|
|
QString iportName = QString::fromAscii(iportVec.at(i)->m_pPortName) ;
|
| 6958 |
|
|
if(!(pmodule->getClockSignal().value(iportName,QString())).isEmpty())
|
| 6959 |
|
|
{
|
| 6960 |
|
|
continue ;
|
| 6961 |
|
|
}
|
| 6962 |
|
|
|
| 6963 |
|
|
if(!(pmodule->getResetSignal().value(iportName,QString())).isEmpty())
|
| 6964 |
|
|
{
|
| 6965 |
|
|
continue ;
|
| 6966 |
|
|
}
|
| 6967 |
|
|
|
| 6968 |
|
|
QString iregHiberarchy = item->getItemHierarchyName();
|
| 6969 |
|
|
QString ieziDebugPortName ;
|
| 6970 |
|
|
//ieziDebugPortName.append(QObject::tr("_EziDebug_")+iportName + QObject::tr("_r"));
|
| 6971 |
|
|
ieziDebugPortName.append(QObject::tr("_EziDebug_%1_%2_r").arg(item->getScanChainInfo()->getChainName()).arg(iportName));
|
| 6972 |
|
|
|
| 6973 |
|
|
if(1 == iportVec.at(i)->m_unBitwidth)
|
| 6974 |
|
|
{
|
| 6975 |
|
|
QString ilabelnet(QObject::tr("\n <net is_signal_inverted=\"no\" name=\"%1\"/>").arg(iregHiberarchy + ieziDebugPortName));
|
| 6976 |
|
|
ifileContent.append(ilabelnet);
|
| 6977 |
|
|
}
|
| 6978 |
|
|
else
|
| 6979 |
|
|
{
|
| 6980 |
|
|
QString ilabelbusStart(QObject::tr("\n <bus is_signal_inverted=\"no\" link=\"all\" name=\"%1\" order=\"lsb_to_msb\" radix=\"hex\" state=\"collapse\" type=\"register\">").arg(ieziDebugPortName));
|
| 6981 |
|
|
ifileContent.append(ilabelbusStart);
|
| 6982 |
|
|
for(int j = 0 ;j < iportVec.at(i)->m_unBitwidth ; j++)
|
| 6983 |
|
|
{
|
| 6984 |
|
|
QString ilabelnet(QObject::tr("\n <net is_signal_inverted=\"no\" name=\"%1[%2]\"/>").arg(iregHiberarchy + ieziDebugPortName).arg(j));
|
| 6985 |
|
|
ifileContent.append(ilabelnet);
|
| 6986 |
|
|
}
|
| 6987 |
|
|
QString ilabelbusEnd(QObject::tr("\n </bus>"));
|
| 6988 |
|
|
ifileContent.append(ilabelbusEnd);
|
| 6989 |
|
|
}
|
| 6990 |
|
|
}
|
| 6991 |
|
|
}
|
| 6992 |
|
|
|
| 6993 |
|
|
|
| 6994 |
|
|
if(iscanPortClock == iclockiterator.key())
|
| 6995 |
|
|
{
|
| 6996 |
|
|
// 内部系统模块的输出端口 reg
|
| 6997 |
|
|
QStringList iportList = item->getScanChainInfo()->getSyscoreOutputPortList() ;
|
| 6998 |
|
|
for(int n = 0 ; n < iportList.count() ;n++)
|
| 6999 |
|
|
{
|
| 7000 |
|
|
QString iportHiberarchy = iportList.at(n).split(QObject::tr("#")).at(0);
|
| 7001 |
|
|
QString iportName = iportList.at(n).split(QObject::tr("#")).at(1);
|
| 7002 |
|
|
QString iportReg = QObject::tr("_EziDebug_%1_%2_r").arg(item->getScanChainInfo()->getChainName()).arg(iportName);
|
| 7003 |
|
|
|
| 7004 |
|
|
|
| 7005 |
|
|
int nportBitWidth = iportList.at(n).split(QObject::tr("#")).at(2).toInt();
|
| 7006 |
|
|
if(1 == nportBitWidth)
|
| 7007 |
|
|
{
|
| 7008 |
|
|
QString ilabelnet(QObject::tr("\n <net is_signal_inverted=\"no\" name=\"%1\"/>").arg(iportHiberarchy + iportReg));
|
| 7009 |
|
|
ifileContent.append(ilabelnet);
|
| 7010 |
|
|
}
|
| 7011 |
|
|
else if(nportBitWidth > 1)
|
| 7012 |
|
|
{
|
| 7013 |
|
|
QString ilabelbusStart(QObject::tr("\n <bus is_signal_inverted=\"no\" link=\"all\" name=\"%1\" order=\"lsb_to_msb\" radix=\"hex\" state=\"collapse\" type=\"register\">").arg(iportHiberarchy + iportReg));
|
| 7014 |
|
|
ifileContent.append(ilabelbusStart);
|
| 7015 |
|
|
for(int m = 0 ; m < nchildChainNum ; m++)
|
| 7016 |
|
|
{
|
| 7017 |
|
|
QString ilabelnet(QObject::tr("\n <net is_signal_inverted=\"no\" name=\"%1[%2]\"/>").arg(iportHiberarchy + iportReg).arg(m));
|
| 7018 |
|
|
ifileContent.append(ilabelnet);
|
| 7019 |
|
|
}
|
| 7020 |
|
|
QString ilabelbusEnd(QObject::tr("\n </bus>"));
|
| 7021 |
|
|
ifileContent.append(ilabelbusEnd);
|
| 7022 |
|
|
}
|
| 7023 |
|
|
else
|
| 7024 |
|
|
{
|
| 7025 |
|
|
return QString();
|
| 7026 |
|
|
}
|
| 7027 |
|
|
}
|
| 7028 |
|
|
}
|
| 7029 |
|
|
|
| 7030 |
|
|
QString ilabelSetup_viewEnd(QObject::tr("\n </setup_view>"));
|
| 7031 |
|
|
ifileContent.append(ilabelSetup_viewEnd);
|
| 7032 |
|
|
|
| 7033 |
|
|
|
| 7034 |
|
|
QString ilabelPresentationEnd("\n </presentation>");
|
| 7035 |
|
|
ifileContent.append(ilabelPresentationEnd);
|
| 7036 |
|
|
|
| 7037 |
|
|
/*
|
| 7038 |
|
|
<trigger attribute_mem_mode="false" global_temp="1" name="trigger: 2012/10/31 19:32:21 #1" position="pre" power_up_trigger_mode="false" segment_size="1" trigger_in="dont_care" trigger_out="active high" trigger_type="circular">
|
| 7039 |
|
|
<power_up_trigger position="pre" trigger_in="dont_care" trigger_out="active high"/>
|
| 7040 |
|
|
<events use_custom_flow_control="no">
|
| 7041 |
|
|
<level enabled="yes" name="condition1" type="basic">
|
| 7042 |
|
|
<power_up enabled="yes">
|
| 7043 |
|
|
</power_up>
|
| 7044 |
|
|
<op_node/>
|
| 7045 |
|
|
</level>
|
| 7046 |
|
|
</events>
|
| 7047 |
|
|
</trigger>
|
| 7048 |
|
|
</signal_set>
|
| 7049 |
|
|
</instance>
|
| 7050 |
|
|
<mnemonics/>
|
| 7051 |
|
|
*/
|
| 7052 |
|
|
|
| 7053 |
|
|
icurrentDate = QDate::currentDate();
|
| 7054 |
|
|
icurrentTime = QTime::currentTime();
|
| 7055 |
|
|
|
| 7056 |
|
|
QString ilabelTriggerStart(QObject::tr("\n <trigger attribute_mem_mode=\"false\" global_temp=\"1\" name=\"trigger: %1 %2 #1\" position=\"pre\" power_up_trigger_mode=\"false\" segment_size=\"1\" trigger_in=\"dont_care\" trigger_out=\"active high\" trigger_type=\"circular\">").arg(icurrentDate.toString(QObject::tr("yyyy/MM/dd")))\
|
| 7057 |
|
|
.arg(icurrentTime.toString(QObject::tr("hh:mm:ss")))) ;
|
| 7058 |
|
|
ifileContent.append(ilabelTriggerStart);
|
| 7059 |
|
|
|
| 7060 |
|
|
QString ilabelPower_up_trigger(QObject::tr("\n <power_up_trigger position=\"pre\" trigger_in=\"dont_care\" trigger_out=\"active high\"/>"));
|
| 7061 |
|
|
ifileContent.append(ilabelPower_up_trigger);
|
| 7062 |
|
|
|
| 7063 |
|
|
QString ilabelEventStart(QObject::tr("\n <events use_custom_flow_control=\"no\">"));
|
| 7064 |
|
|
ifileContent.append(ilabelEventStart);
|
| 7065 |
|
|
|
| 7066 |
|
|
QString ilabelLevelStart(QObject::tr("\n <level enabled=\"yes\" name=\"condition1\" type=\"basic\">"));
|
| 7067 |
|
|
ifileContent.append(ilabelLevelStart);
|
| 7068 |
|
|
|
| 7069 |
|
|
QString ilabelPower_upStart(QObject::tr("\n <power_up enabled=\"yes\">"));
|
| 7070 |
|
|
ifileContent.append(ilabelPower_upStart);
|
| 7071 |
|
|
|
| 7072 |
|
|
|
| 7073 |
|
|
QString ilabelPower_upEnd(QObject::tr("\n </power_up>"));
|
| 7074 |
|
|
ifileContent.append(ilabelPower_upEnd);
|
| 7075 |
|
|
|
| 7076 |
|
|
QString ilabelOp_nodeStart(QObject::tr("\n <op_node/>"));
|
| 7077 |
|
|
ifileContent.append(ilabelOp_nodeStart);
|
| 7078 |
|
|
|
| 7079 |
|
|
QString ilabelLevelEnd(QObject::tr("\n </level>"));
|
| 7080 |
|
|
ifileContent.append(ilabelLevelEnd);
|
| 7081 |
|
|
|
| 7082 |
|
|
QString ilabelEventEnd(QObject::tr("\n </events>"));
|
| 7083 |
|
|
ifileContent.append(ilabelEventEnd);
|
| 7084 |
|
|
|
| 7085 |
|
|
QString ilabelTriggerEnd(QObject::tr("\n </trigger>"));
|
| 7086 |
|
|
ifileContent.append(ilabelTriggerEnd);
|
| 7087 |
|
|
|
| 7088 |
|
|
|
| 7089 |
|
|
QString ilabelSignal_setEnd(QObject::tr("\n </signal_set>"));
|
| 7090 |
|
|
ifileContent.append(ilabelSignal_setEnd);
|
| 7091 |
|
|
|
| 7092 |
|
|
QString ilabelPosition_infoStart(QObject::tr("\n <position_info>")) ;
|
| 7093 |
|
|
ifileContent.append(ilabelPosition_infoStart);
|
| 7094 |
|
|
|
| 7095 |
|
|
QString ilableSingle1(QObject::tr("\n <single attribute=\"active tab\" value=\"1\"/>"));
|
| 7096 |
|
|
ifileContent.append(ilableSingle1);
|
| 7097 |
|
|
|
| 7098 |
|
|
QString ilableSingle2(QObject::tr("\n <single attribute=\"setup horizontal scroll position\" value=\"0\"/>"));
|
| 7099 |
|
|
ifileContent.append(ilableSingle2);
|
| 7100 |
|
|
|
| 7101 |
|
|
QString ilableSingle3(QObject::tr("\n <single attribute=\"setup vertical scroll position\" value=\"0\"/>"));
|
| 7102 |
|
|
ifileContent.append(ilableSingle3);
|
| 7103 |
|
|
|
| 7104 |
|
|
QString ilabelPosition_infoEnd(QObject::tr("\n </position_info>")) ;
|
| 7105 |
|
|
ifileContent.append(ilabelPosition_infoEnd);
|
| 7106 |
|
|
|
| 7107 |
|
|
QString ilabelInstanceEnd(QObject::tr("\n </instance>"));
|
| 7108 |
|
|
ifileContent.append(ilabelInstanceEnd);
|
| 7109 |
|
|
|
| 7110 |
|
|
|
| 7111 |
|
|
if(0 == i)
|
| 7112 |
|
|
{
|
| 7113 |
|
|
QString ilabelMnemonics(QObject::tr("\n <mnemonics/>"));
|
| 7114 |
|
|
ifileContent.append(ilabelMnemonics);
|
| 7115 |
|
|
}
|
| 7116 |
|
|
|
| 7117 |
|
|
++iclockiterator ;
|
| 7118 |
|
|
++i ;
|
| 7119 |
|
|
}
|
| 7120 |
|
|
|
| 7121 |
|
|
return ifileContent ;
|
| 7122 |
|
|
}
|
| 7123 |
|
|
|
| 7124 |
|
|
#if 0
|
| 7125 |
|
|
void EziDebugPrj::constructIlaunitString(int ®width,int &triggernum)
|
| 7126 |
|
|
{
|
| 7127 |
|
|
if(regwidth >= 255)
|
| 7128 |
|
|
{
|
| 7129 |
|
|
regwidth = 0 ;
|
| 7130 |
|
|
triggernum++ ;
|
| 7131 |
|
|
}
|
| 7132 |
|
|
else
|
| 7133 |
|
|
{
|
| 7134 |
|
|
++regwidth ;
|
| 7135 |
|
|
}
|
| 7136 |
|
|
}
|
| 7137 |
|
|
#endif
|
| 7138 |
|
|
|
| 7139 |
|
|
|
| 7140 |
|
|
|
| 7141 |
|
|
|
| 7142 |
|
|
|