1 |
2 |
EziDebug |
#ifndef EZIDEBUGMODULE_H
|
2 |
|
|
#define EZIDEBUGMODULE_H
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
#include "ezidebugprj.h"
|
6 |
|
|
|
7 |
|
|
class QString ;
|
8 |
|
|
class QStringList ;
|
9 |
|
|
template <class Key, class T> class QMap ;
|
10 |
|
|
template <typename T> class QVector;
|
11 |
|
|
|
12 |
|
|
class EziDebugModule
|
13 |
|
|
{
|
14 |
|
|
public:
|
15 |
|
|
enum DIRECTION_TYPE
|
16 |
|
|
{
|
17 |
|
|
dirctionNone = 0 ,
|
18 |
|
|
directionTypeInput,
|
19 |
|
|
directionTypeOutput,
|
20 |
|
|
directionTypeInoutput
|
21 |
|
|
};
|
22 |
|
|
|
23 |
|
|
enum SIGNAL_EDGE
|
24 |
|
|
{
|
25 |
|
|
signalPosEdge = 0 ,
|
26 |
|
|
signalNegEdge,
|
27 |
|
|
signalLow,
|
28 |
|
|
signalHigh,
|
29 |
|
|
signalOtherEdge
|
30 |
|
|
};
|
31 |
|
|
|
32 |
|
|
enum ENDIAN_TYPE
|
33 |
|
|
{
|
34 |
|
|
endianLittle = 0 ,
|
35 |
|
|
endianBig ,
|
36 |
|
|
endianOther
|
37 |
|
|
};
|
38 |
|
|
|
39 |
|
|
enum ATTRIBUTE_TYPE
|
40 |
|
|
{
|
41 |
|
|
attributeStatic = 0 ,
|
42 |
|
|
attributeDynamic ,
|
43 |
|
|
attributeOther
|
44 |
|
|
};
|
45 |
|
|
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
struct RegStructure
|
49 |
|
|
{
|
50 |
|
|
// 静态属性
|
51 |
|
|
char m_pMouduleName[128] ;
|
52 |
|
|
char m_pRegName[128] ;
|
53 |
|
|
char m_pclockName[128] ;
|
54 |
|
|
SIGNAL_EDGE m_eedge ;
|
55 |
|
|
|
56 |
|
|
char m_pregNum[64] ;
|
57 |
|
|
char m_pregNumNoMacroString[128] ;
|
58 |
|
|
|
59 |
|
|
char m_pExpString[64] ; // 用于根据参数 计算位数的表达式
|
60 |
|
|
char m_pExpNoMacroString[128] ; // 只是做 宏替换 并不能真正保证 parameter 引入 宏
|
61 |
|
|
|
62 |
|
|
// 变化属性 (随扫描链不同可能变化)
|
63 |
|
|
unsigned int m_unMaxRegNum ; // 存在 defparameter 的最大寄存器个数
|
64 |
|
|
ENDIAN_TYPE m_eRegNumEndian ;
|
65 |
|
|
ATTRIBUTE_TYPE m_eRegNumType ;
|
66 |
|
|
unsigned int m_unMaxBitWidth ; // 位宽可能出现的最大宽度
|
67 |
|
|
ENDIAN_TYPE m_eRegBitWidthEndian ;
|
68 |
|
|
ATTRIBUTE_TYPE m_eRegBitWidthType ;
|
69 |
|
|
|
70 |
|
|
|
71 |
|
|
// 用于静态寄存器使用(每个例化的寄存器是静态的)
|
72 |
|
|
unsigned int m_unStartNum ;
|
73 |
|
|
unsigned int m_unEndNum ;
|
74 |
|
|
unsigned int m_unRegNum ;
|
75 |
|
|
|
76 |
|
|
unsigned int m_unStartBit ;
|
77 |
|
|
unsigned int m_unEndBit ;
|
78 |
|
|
unsigned int m_unRegBitWidth ;
|
79 |
|
|
};
|
80 |
|
|
|
81 |
|
|
|
82 |
|
|
|
83 |
|
|
struct PortStructure
|
84 |
|
|
{
|
85 |
|
|
char m_pPortName[128] ;
|
86 |
|
|
char m_pModuleName[128] ;
|
87 |
|
|
DIRECTION_TYPE eDirectionType ;
|
88 |
|
|
char m_pBitWidth[64] ;
|
89 |
|
|
unsigned int m_unStartBit ;
|
90 |
|
|
unsigned int m_unEndBit ;
|
91 |
|
|
unsigned int m_unBitwidth ;
|
92 |
|
|
ENDIAN_TYPE m_eEndian ;
|
93 |
|
|
};
|
94 |
|
|
|
95 |
|
|
EziDebugModule(const QString modulename);
|
96 |
|
|
~EziDebugModule();
|
97 |
|
|
|
98 |
|
|
|
99 |
|
|
friend int EziDebugPrj::readModuleStructure(char readflag) ;
|
100 |
|
|
friend int EziDebugPrj::readClockStructure(char readflag ,EziDebugModule* module) ;
|
101 |
|
|
friend int EziDebugPrj::readRegStructure(char readflag ,EziDebugModule* module);
|
102 |
|
|
friend int EziDebugPrj::readPortStructure(char readflag ,EziDebugModule* module);
|
103 |
|
|
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
friend int EziDebugPrj::domParseModuleInfoElement(const QDomElement &element, char readflag);
|
107 |
|
|
|
108 |
|
|
|
109 |
|
|
friend int EziDebugPrj::domParseClockDescriptionElement(const QDomElement &element, char readflag, EziDebugModule* module) ;
|
110 |
|
|
friend int EziDebugPrj::domParseRegDescriptionElement(const QDomElement &element,char readflag, EziDebugModule* module) ;
|
111 |
|
|
friend int EziDebugPrj::domParsePortDescriptionElement(const QDomElement &element,char readflag, EziDebugModule* module) ;
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
friend int EziDebugPrj::domParsePortStructure(const QDomElement &element, char readflag, EziDebugModule *module);
|
115 |
|
|
friend int EziDebugPrj::domParseRegStructure(const QDomElement &element, char readflag, EziDebugModule *module);
|
116 |
|
|
friend int EziDebugPrj::domParseClockStructure(const QDomElement &element, char readflag, EziDebugModule *module);
|
117 |
|
|
friend int EziDebugPrj::domParseInstancePortMapDescriptionElement(const QDomElement &element,char readflag, EziDebugModule* module);
|
118 |
|
|
|
119 |
|
|
|
120 |
|
|
friend int EziDebugPrj::saveInfoToLogFile(QDomDocument &idoc , EziDebugPrj::LOG_FILE_INFO* loginfo);
|
121 |
|
|
friend class EziDebugVlgFile ;
|
122 |
|
|
//friend int EziDebugVlgFile::scanFile(EziDebugPrj* prj,EziDebugPrj::SCAN_TYPE type,QList<EziDebugPrj::LOG_FILE_INFO*> &addedinfolist,QList<EziDebugPrj::LOG_FILE_INFO*> &deletedinfolist) ;
|
123 |
|
|
|
124 |
|
|
|
125 |
|
|
|
126 |
|
|
QString getModuleName(void) const ;
|
127 |
|
|
const QStringList &getInstanceList(void) const;
|
128 |
|
|
QVector<RegStructure*> getReg(const QString &clock) ;
|
129 |
|
|
const QMap<QString,QVector<EziDebugModule::RegStructure*> > getRegMap(void) const ;
|
130 |
|
|
const QMap<QString,QString> & getClockSignal(void) const ;
|
131 |
|
|
const QMap<QString,QString> & getResetSignal(void) const ;
|
132 |
|
|
const QVector<PortStructure*> & getPort(EziDebugPrj *prj ,const QString &instancename) ;
|
133 |
|
|
void addToClockMap(const QString &clock);
|
134 |
|
|
void addToResetSignalMap(const QString &reset,const QString &edge);
|
135 |
|
|
|
136 |
|
|
|
137 |
|
|
const QMap<QString,QMap<QString,QString> > &getInstancePortMap(void) const ;
|
138 |
|
|
QMap<QString,QString> getInstancePortMap(const QString &instanceName) ;
|
139 |
|
|
|
140 |
|
|
const QString &getLocatedFileName(void) const;
|
141 |
|
|
bool getAddCodeFlag(void) ;
|
142 |
|
|
int getInstancedTimesPerChain(const QString &chainName);
|
143 |
|
|
int getConstInstacedTimesPerChain(const QString &chainName);
|
144 |
|
|
// int getRegNumber(const QString &clock) ;
|
145 |
|
|
|
146 |
|
|
|
147 |
|
|
void getBitRangeInChain(const QString& chainname, const QString &clockname, int* startbit,int * endbit);
|
148 |
|
|
void setBitRangeInChain(const QString& chainname, const QString &clockname, int startbit,int endbit);
|
149 |
|
|
|
150 |
|
|
void AddToRegMap(const QString &clock,RegStructure*preg);
|
151 |
|
|
// void addToVaribleRegMap(const QString &clock,RegStructure*preg);
|
152 |
|
|
void addToDefParameterMap(const QString &instancename, const QString ¶metername ,const QString &value);
|
153 |
|
|
void addToParameterMap(const QString ¶metername,const QString &value);
|
154 |
|
|
int getInstanceTimes(void) ;
|
155 |
|
|
QString getChainClockWireNameMap(const QString& chainname ,const QString& clockname) ;
|
156 |
|
|
bool isLibaryCore(void) ;
|
157 |
|
|
void setLibaryCoreFlag(bool flag) ;
|
158 |
|
|
//void setInstanceTimes(int count) ;
|
159 |
|
|
void setInstancedTimesPerChain(const QString &chainame,int count);
|
160 |
|
|
void setConstInstanceTimesPerChain(const QString &chainname,int count);
|
161 |
|
|
void setEziDebugCoreCounts(const QString &chainname,int count);
|
162 |
|
|
int getEziDebugCoreCounts(const QString &chainname);
|
163 |
|
|
void setEziDebugWireCounts(const QString &chainname,int count);
|
164 |
|
|
int getEziDebugWireCounts(const QString &chainname);
|
165 |
|
|
void AddToClockWireNameMap(const QString& chainname,const QString& clockname,const QString& lastwirename);
|
166 |
|
|
void setAddCodeFlag(bool flag) ;
|
167 |
|
|
void setRegInfoToInitalState(void) ;
|
168 |
|
|
bool isChainCompleted(EziDebugScanChain *pchain);
|
169 |
|
|
bool isChainCompleted(EziDebugModule *pmodue);
|
170 |
|
|
void clearChainInfo(const QString& chainname);
|
171 |
|
|
|
172 |
|
|
int getAllRegMap(QString clock ,QVector<EziDebugModule::RegStructure*> &sregVec,QVector<EziDebugModule::RegStructure*> &vregVec);
|
173 |
|
|
void calInstanceRegData(EziDebugPrj*prj,const QString &instancename);
|
174 |
|
|
RegStructure* getInstanceReg(QString instancename , QString clock , QString regname) ;
|
175 |
|
|
void getBitRange(const QString &widthStr ,int *startbit ,int *endbit) ;
|
176 |
|
|
int constructChainRegMap(EziDebugPrj * prj ,const QStringList &cominstanceList,QString instancename) ;
|
177 |
|
|
|
178 |
|
|
|
179 |
|
|
private:
|
180 |
|
|
QString m_imoduleName ;
|
181 |
|
|
QStringList m_iinstanceNameList ;
|
182 |
|
|
//QStringList m_iclockNameList ;
|
183 |
|
|
QMap<QString,QString> m_iclockMap ;
|
184 |
|
|
QMap<QString,QString> m_iresetMap ;
|
185 |
|
|
// <clock,reg>
|
186 |
|
|
QMap<QString,QVector<RegStructure*> > m_iregMap ; // 所有寄存器
|
187 |
|
|
|
188 |
|
|
#if 0
|
189 |
|
|
QMap<QString,QVector<RegStructure*> > m_ivregMap ; // 不可计算 变化位宽的寄存器组
|
190 |
|
|
QMap<QString,QVector<RegStructure*> > m_isregMap ; // 可计算 固定位宽的寄存器组
|
191 |
|
|
#endif
|
192 |
|
|
|
193 |
|
|
// 计算当前例化的寄存器的宽度需要 当前的例化名字、扫描链出现的module所有例化(例化次数可将一些变化位宽的寄存器固定化)、
|
194 |
|
|
|
195 |
|
|
QMap<QString,QMap<QString ,QVector<RegStructure*> > > m_iinstanceRegMap ; // module 的 每个例化 对应具体值的 寄存器组
|
196 |
|
|
|
197 |
|
|
// 在扫描链中例化出现1次的都为 固定位宽的寄存器组
|
198 |
|
|
|
199 |
|
|
QMap<QString,QMap<QString,QString> > m_iinstancePortMap ; //例化对应 各个例化上的对应的端口名字
|
200 |
|
|
QMap<QString,QMap<QString,QString> > m_iclockWireNameMap ; // 仅用于添加扫描链时使用,不保存在log文件里(避免函数参数过多)
|
201 |
|
|
// 保存每条链 最后一个非系统core 例化 创建的 wire_tdo
|
202 |
|
|
|
203 |
|
|
QMap<QString,QMap<QString,int> > m_istartChainNum ; // 本 module 在 每个 clock链 在 总链 开始 bit 位 用于连接 用户core 和 module tdo
|
204 |
|
|
QMap<QString,QMap<QString,int> > m_iendChainNum ; // 本 module 在每个 clock 链 在 总链 的 结束 bit 位 用于 连接 tdo
|
205 |
|
|
QVector<PortStructure*> m_iportVec ;
|
206 |
|
|
bool m_isSubstituted ;
|
207 |
|
|
QString m_ilocatedFile ;
|
208 |
|
|
int m_ninstanceTimes ;
|
209 |
|
|
int m_nConstInstanceTimes ;
|
210 |
|
|
bool m_isLibaryCore ;
|
211 |
|
|
QMap<QString,int> m_iinstanceTimesPerChain ;
|
212 |
|
|
QMap<QString,int> m_iconstInstanceTimesPerChain ;
|
213 |
|
|
QMap<QString,int> m_ieziDebugCoreCounts ;
|
214 |
|
|
QMap<QString,int> m_ieziDebugWireCounts ;
|
215 |
|
|
QMap<QString,QString> m_iparameter ; // ( parameter : value )
|
216 |
|
|
QMap<QString,QMap<QString,QString> > m_idefparameter ; // instance (parameter: value)
|
217 |
|
|
//QMap<QString,QMap<QString,QString> > m_ivarRegWidth ;
|
218 |
|
|
// 寄存器名 不同的宽度字符串
|
219 |
|
|
QMultiMap<QString,QString> m_ivarRegWidth ; // 保存 1个寄存器 1条扫描链 不同例化 对应 的宽度字符串
|
220 |
|
|
|
221 |
|
|
// 固定位宽
|
222 |
|
|
// 1、无parameter 只有数字与 define 宏来组成
|
223 |
|
|
// 2、虽然有parameter 却无 defparameter
|
224 |
|
|
// 3、有defparameter 却扫描链中只存在1次例化
|
225 |
|
|
|
226 |
|
|
// 变化位宽
|
227 |
|
|
// 1、有parameter 且 有 defparameter ,扫描链存在多次例化 ,正好都在defparameter 中
|
228 |
|
|
// 计算位宽时 用例化对应的defparamete ;
|
229 |
|
|
// 扫描整条链时 记录每个module具体例化了哪些
|
230 |
|
|
// 在根据位宽字符串计算位宽时
|
231 |
|
|
// 1、将define 的宏全部替换
|
232 |
|
|
// 2、根据替换后的字符串 ,根据当前例化 把defparameter 放入到 parameter 中 ,并计算最大位宽
|
233 |
|
|
// 3、最大位宽 与 当前位宽 不一样 则 为变化位宽
|
234 |
|
|
bool m_isaddedCode ;
|
235 |
|
|
};
|
236 |
|
|
|
237 |
|
|
#endif // EZIDEBUGMODULE_H
|