1 |
2 |
EziDebug |
|
2 |
|
|
#include <QtAlgorithms>
|
3 |
|
|
#include <QString>
|
4 |
|
|
#include <QStringList>
|
5 |
|
|
#include <QFile>
|
6 |
|
|
#include <QFileInfo>
|
7 |
|
|
#include <QVector>
|
8 |
|
|
#include <QDir>
|
9 |
|
|
#include <QPair>
|
10 |
|
|
#include <QTextStream>
|
11 |
|
|
#include <QDebug>
|
12 |
|
|
#include <memory.h>
|
13 |
|
|
#include "textquery.h"
|
14 |
|
|
|
15 |
|
|
#define OUT(n) "OUT" #n ".txt"
|
16 |
|
|
#define OUTT(n) OUT##n
|
17 |
|
|
#define OUTFILE(n) outfile##n
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
//int main()
|
21 |
|
|
//{
|
22 |
|
|
// TextQuery tq;
|
23 |
|
|
// tq.doit();
|
24 |
|
|
//}
|
25 |
|
|
|
26 |
|
|
void TextQuery::constructDataFile(const QString &filename ,const QStringList &datalist)
|
27 |
|
|
{
|
28 |
|
|
QStringList list(datalist);
|
29 |
|
|
QFile ifile(filename) ;
|
30 |
|
|
|
31 |
|
|
qDebug() << filename ;
|
32 |
|
|
|
33 |
|
|
if(!list.size())
|
34 |
|
|
{
|
35 |
|
|
return ;
|
36 |
|
|
}
|
37 |
|
|
// generate the datafile which needed by Testbench
|
38 |
|
|
|
39 |
|
|
qDebug() << "retrieve_text" << __LINE__ ;
|
40 |
|
|
|
41 |
|
|
QString Data ;
|
42 |
|
|
|
43 |
|
|
if(!ifile.open(QIODevice::WriteOnly))
|
44 |
|
|
{
|
45 |
|
|
qDebug() << "Something wrong happen in open Outfile" << "!" << endl;
|
46 |
|
|
}
|
47 |
|
|
|
48 |
|
|
qDebug() << "retrieve_text" << __LINE__ ;
|
49 |
|
|
|
50 |
|
|
QTextStream Out1(&ifile);
|
51 |
|
|
|
52 |
|
|
qDebug() << list.size() << __LINE__ ;
|
53 |
|
|
|
54 |
|
|
for(short k = list.size()-1 ; k >= 0 ; k--)
|
55 |
|
|
{
|
56 |
|
|
Data.append(list.at(k) + QObject::tr("\n")) ;
|
57 |
|
|
}
|
58 |
|
|
|
59 |
|
|
Out1 << Data ;
|
60 |
|
|
|
61 |
|
|
qDebug() << "retrieve_text" << __LINE__ ;
|
62 |
|
|
|
63 |
|
|
ifile.close();
|
64 |
|
|
}
|
65 |
|
|
void TextQuery::retrieve_text()
|
66 |
|
|
{
|
67 |
|
|
short open = 0;
|
68 |
|
|
int nsignalNum = 0 ;
|
69 |
|
|
int nfileCount = 0 ;
|
70 |
|
|
|
71 |
|
|
QVector<QString> lines_of_text;
|
72 |
|
|
QMultiMap<QString, QString> Key_value;
|
73 |
|
|
// QString filename;
|
74 |
|
|
|
75 |
|
|
qDebug() << "retrieve_text" << __LINE__ ;
|
76 |
|
|
|
77 |
|
|
QFile Outfile(m_ioutputDirectory + QObject::tr("/""tb.v"));
|
78 |
|
|
|
79 |
|
|
if(!Outfile.open(QIODevice::WriteOnly))
|
80 |
|
|
{
|
81 |
|
|
qDebug() << "EziDebug Error: Something wrong happen in open Outfile!" << endl;
|
82 |
|
|
return ;
|
83 |
|
|
}
|
84 |
|
|
QTextStream Out(&Outfile);
|
85 |
|
|
|
86 |
|
|
// parse data File
|
87 |
|
|
QStringList list;
|
88 |
|
|
for(;nfileCount < m_idataFileNameList.count(); nfileCount++)
|
89 |
|
|
{
|
90 |
|
|
QString idataFileName = m_idataFileNameList.at(nfileCount) ;
|
91 |
|
|
QFile file(idataFileName);
|
92 |
|
|
if(!file.open( QIODevice::ReadOnly | QIODevice::Text))
|
93 |
|
|
{
|
94 |
|
|
qDebug() << "EziDebug Error: Something wrong happen in open file!" << endl;
|
95 |
|
|
return ;
|
96 |
|
|
}
|
97 |
|
|
QTextStream in(&file);
|
98 |
|
|
while(!in.atEnd())
|
99 |
|
|
{
|
100 |
|
|
QString line = in.readLine();
|
101 |
|
|
lines_of_text.append(line);
|
102 |
|
|
}
|
103 |
|
|
file.close();
|
104 |
|
|
|
105 |
|
|
QString wordsline, single_word,single_word1,single_word2, string_num;
|
106 |
|
|
|
107 |
|
|
short j = 0, word_num = 0;
|
108 |
|
|
|
109 |
|
|
|
110 |
|
|
for(short line_pos = 0; line_pos < lines_of_text.size(); line_pos++)
|
111 |
|
|
{
|
112 |
|
|
wordsline = lines_of_text[line_pos];
|
113 |
|
|
list = wordsline.split(QRegExp("\\s+"));
|
114 |
|
|
word_num++;
|
115 |
|
|
if(list.filter(QRegExp("^\\d+$")).count())
|
116 |
|
|
{
|
117 |
|
|
nsignalNum = list.at(0).toInt() + 1 ;
|
118 |
|
|
}
|
119 |
|
|
short i = 0;
|
120 |
|
|
|
121 |
|
|
if(Fpga == Altera){
|
122 |
|
|
do{
|
123 |
|
|
single_word = list.at(i).toLocal8Bit().constData();
|
124 |
|
|
// Out << "list.size() is"<< list.size() << "\tline_pos is:" <<line_pos << " list i is:"<< i <<" word content is:"<< single_word << endl;
|
125 |
|
|
|
126 |
|
|
if((single_word == string_num.setNum(j)) && open == 0)
|
127 |
|
|
{
|
128 |
|
|
j++;
|
129 |
|
|
break;
|
130 |
|
|
}else if(single_word.toLower() == "sample")
|
131 |
|
|
{
|
132 |
|
|
open = 1;
|
133 |
|
|
}
|
134 |
|
|
|
135 |
|
|
if(open == 1 && list.size() >= j && i>=1)
|
136 |
|
|
{
|
137 |
|
|
Key_value.insertMulti( string_num.setNum(i-1),list.at(i).toLocal8Bit().constData());
|
138 |
|
|
}
|
139 |
|
|
|
140 |
|
|
i++;
|
141 |
|
|
}while(i < list.size()-1);
|
142 |
|
|
}
|
143 |
|
|
else
|
144 |
|
|
{
|
145 |
|
|
short sampleNum = 0;
|
146 |
|
|
short sample_WidthCount = 0;
|
147 |
|
|
QString word;
|
148 |
|
|
|
149 |
|
|
do{
|
150 |
|
|
// single_word = list.at(i);
|
151 |
|
|
// Out << " line_pos is:" <<line_pos << " list i is:"<<i<<" word content is:"<< single_word << endl;
|
152 |
|
|
|
153 |
|
|
if(list.at(i) == "Sample" && open == 0)
|
154 |
|
|
{
|
155 |
|
|
single_word1 = list.at(i+1) ;
|
156 |
|
|
single_word2 = list.at(i+2) ;
|
157 |
|
|
if(single_word1 == "in" && single_word2 == "Buffer")
|
158 |
|
|
{
|
159 |
|
|
open = 1;
|
160 |
|
|
// j = list.size() - 5; // µÃµ½²ÉÑùµãÊý
|
161 |
|
|
// Out << "j = " << j << endl;
|
162 |
|
|
break ;
|
163 |
|
|
}
|
164 |
|
|
}
|
165 |
|
|
|
166 |
|
|
// ´ÓµÚ¶þÁпªÊ¼ ÊÇÊý¾Ý
|
167 |
|
|
if(open == 1 && list.size()>=2 && i > 1)
|
168 |
|
|
{
|
169 |
|
|
if(sampleNum >= sample_table.count() )
|
170 |
|
|
{
|
171 |
|
|
break ;
|
172 |
|
|
}
|
173 |
|
|
int nwidth = qAbs(sample_table[sampleNum]->width_first - sample_table[sampleNum]->width_second) + 1;
|
174 |
|
|
|
175 |
|
|
qDebug() << __LINE__ << nwidth << sampleNum << sample_table[sampleNum]->sample_name;
|
176 |
|
|
do
|
177 |
|
|
{
|
178 |
|
|
word.append(list.at(i));
|
179 |
|
|
i++;
|
180 |
|
|
nwidth-- ;
|
181 |
|
|
}
|
182 |
|
|
while((nwidth > 0)&& ( i<list.size()-1 ));
|
183 |
|
|
|
184 |
|
|
Key_value.insertMulti(string_num.setNum(sampleNum),word);
|
185 |
|
|
word.clear();
|
186 |
|
|
|
187 |
|
|
sampleNum++ ;
|
188 |
|
|
|
189 |
|
|
}
|
190 |
|
|
else
|
191 |
|
|
{
|
192 |
|
|
i++;
|
193 |
|
|
}
|
194 |
|
|
|
195 |
|
|
}while (i < list.size()-1 );
|
196 |
|
|
|
197 |
|
|
}
|
198 |
|
|
}
|
199 |
|
|
|
200 |
|
|
}
|
201 |
|
|
|
202 |
|
|
qDebug() << "retrieve_text" << __LINE__ ;
|
203 |
|
|
|
204 |
|
|
|
205 |
|
|
short filecount = 0 ;
|
206 |
|
|
for(;filecount < sample_table.count() ; filecount++)
|
207 |
|
|
{
|
208 |
|
|
qDebug() << "retrieve_text" << filecount << __LINE__ ;
|
209 |
|
|
|
210 |
|
|
// string_num = QObject::tr("%1").arg(filecount);
|
211 |
|
|
QString ifileName = m_ioutputDirectory + QObject::tr("%1Out%2").arg(QDir::separator()).arg(filecount) + QObject::tr(".txt") ;
|
212 |
|
|
list= Key_value.values(QString::number(filecount));
|
213 |
|
|
constructDataFile(ifileName,list);
|
214 |
|
|
}
|
215 |
|
|
|
216 |
|
|
|
217 |
|
|
qDebug() << "retrieve_text" << __LINE__ ;
|
218 |
|
|
|
219 |
|
|
Out << endl << endl ;
|
220 |
|
|
|
221 |
|
|
qDebug() << "retrieve_text" << __LINE__ ;
|
222 |
|
|
|
223 |
|
|
Out << "`timescale 1ns/1ps" << endl;
|
224 |
|
|
Out << "module tb();" << endl;
|
225 |
|
|
Out << QObject::tr("parameter DATA_WIDTH = %1; ").arg(nsignalNum) << endl;
|
226 |
|
|
|
227 |
|
|
Out.setFieldAlignment(QTextStream::AlignLeft);
|
228 |
|
|
|
229 |
|
|
#if 1
|
230 |
|
|
for(short i = 0; i < sample_table.count(); i++)
|
231 |
|
|
{
|
232 |
|
|
if(sample_table[i]->width_first == 0)
|
233 |
|
|
{
|
234 |
|
|
// Out.setFieldAlignment(QTextStream::AlignLeft);
|
235 |
|
|
Out << "\t" << qSetFieldWidth(30)<< "reg" << qSetFieldWidth(0)<< sample_table[i]->sample_name << "_buf[1:DATA_WIDTH];" << endl;
|
236 |
|
|
}
|
237 |
|
|
else
|
238 |
|
|
{
|
239 |
|
|
// Out.setFieldAlignment(QTextStream::AlignLeft);
|
240 |
|
|
Out << "\treg [";
|
241 |
|
|
|
242 |
|
|
Out << qSetFieldWidth(0) << sample_table[i]->width_first << ":" << sample_table[i]->width_second << qSetFieldWidth(20)<< "]";
|
243 |
|
|
|
244 |
|
|
Out << qSetFieldWidth(0) << sample_table[i]->sample_name << qSetFieldWidth(0)<<"_buf[1:" << "DATA_WIDTH" << "];" << endl;
|
245 |
|
|
}
|
246 |
|
|
}
|
247 |
|
|
|
248 |
|
|
qDebug() << "retrieve_text" << __LINE__ ;
|
249 |
|
|
|
250 |
|
|
Out << endl << endl;
|
251 |
|
|
Out << "//{Buffer initialization" << endl;
|
252 |
|
|
Out << "\tinitial" << endl;
|
253 |
|
|
Out << "\tbegin" << endl;
|
254 |
|
|
|
255 |
|
|
#if 0
|
256 |
|
|
for (short i = 0 ; i < sample_table.count() ; i++)
|
257 |
|
|
{
|
258 |
|
|
Out << "\t\t$readmemh(" << "Out"+string_num.setNum(i)+".txt" <<", "<< sample_table[i]->sample_name << "_buf);" << endl;
|
259 |
|
|
}
|
260 |
|
|
#endif
|
261 |
|
|
|
262 |
|
|
QString string_num ;
|
263 |
|
|
QString idirctoryStr = m_ioutputDirectory ;
|
264 |
|
|
idirctoryStr.replace(QDir::separator(),"/") ;
|
265 |
|
|
idirctoryStr.append(QObject::tr("/"));
|
266 |
|
|
#if 1
|
267 |
|
|
if(Fpga==Altera)
|
268 |
|
|
{
|
269 |
|
|
for (short i = 0; i<sample_table.count(); i++)
|
270 |
|
|
{
|
271 |
|
|
Out << "\t\t$readmemh(" << "Out"+string_num.setNum(i)+".txt" <<", "<< sample_table[i]->sample_name << "_buf);" << endl;
|
272 |
|
|
}
|
273 |
|
|
}
|
274 |
|
|
else if(Fpga == Xilinx)
|
275 |
|
|
{
|
276 |
|
|
unsigned int j=0;
|
277 |
|
|
|
278 |
|
|
for (short i = 0; i < sample_table.count(); i++)
|
279 |
|
|
{
|
280 |
|
|
// short sample_width = sample_table[i]->width_first;
|
281 |
|
|
// Out << "\t\t$readmemb(" << "Out"+string_num.setNum(i)+".txt" <<", "<< sample_table[i]->sample_name <<"_buf"<< "[" << sample_table[i]->width_first << ":" << sample_table[i]->width_second <<"] );" << endl;
|
282 |
|
|
Out << "\t\t$readmemb(" << "\"" <<idirctoryStr <<"Out"+string_num.setNum(i)+".txt" << "\"" <<", "<< sample_table[i]->sample_name <<"_buf"<< " );" << endl;
|
283 |
|
|
|
284 |
|
|
}
|
285 |
|
|
}
|
286 |
|
|
#endif
|
287 |
|
|
// Ìí¼Ó end ½áβ
|
288 |
|
|
Out << "\tend" << endl;
|
289 |
|
|
|
290 |
|
|
Out << endl;
|
291 |
|
|
#if 0
|
292 |
|
|
Out << "\t reg [31:0] cnt_Pos ;" << endl;
|
293 |
|
|
Out << "\t reg [31:0] cnt_Neg ;" << endl << endl;
|
294 |
|
|
|
295 |
|
|
Out << "\t reg [31:0] sample_0_ ;" << endl;
|
296 |
|
|
Out << "\t reg [31:0] sample_1_ ;" << endl << endl;
|
297 |
|
|
#else
|
298 |
|
|
Out << "\t reg check_en ;" << endl ;
|
299 |
|
|
Out << "\t reg [31:0] cnt ;" << endl ;
|
300 |
|
|
Out << "\t reg _EziDebug_clk ;" << endl ;
|
301 |
|
|
Out << "\t reg _EziDebug_rst ;" << endl ;
|
302 |
|
|
Out << "\t reg _EziDebug_TOUT_reg ;" << endl ;
|
303 |
|
|
|
304 |
|
|
#endif
|
305 |
|
|
for(short i = 0; i < inout_table.count(); i++) // Éú³ÉÊäÈëÊä³ö¶Ë¿Ú
|
306 |
|
|
{
|
307 |
|
|
if((QString::fromAscii(inout_table[i]->port_name) == m_iclockSigName)\
|
308 |
|
|
||(QString::fromAscii(inout_table[i]->port_name) == m_iresetSigName))
|
309 |
|
|
{
|
310 |
|
|
continue ;
|
311 |
|
|
}
|
312 |
|
|
|
313 |
|
|
if(inout_table[i]->inout)
|
314 |
|
|
{
|
315 |
|
|
if(inout_table[i]->width_first == 0)
|
316 |
|
|
{
|
317 |
|
|
Out << " reg "<< qSetFieldWidth(0) << inout_table[i]->port_name << " ;"<< endl;
|
318 |
|
|
}else
|
319 |
|
|
{
|
320 |
|
|
Out << " reg " <<" ["<< inout_table[i]->width_first << ":" << inout_table[i]->width_second << "] ";
|
321 |
|
|
Out << inout_table[i]->port_name << ";" << endl;
|
322 |
|
|
}
|
323 |
|
|
}else
|
324 |
|
|
{
|
325 |
|
|
if(inout_table[i]->width_first == 0)
|
326 |
|
|
{
|
327 |
|
|
Out << endl;
|
328 |
|
|
Out << " reg " << inout_table[i]->port_name << "_hw" << " ;" <<endl;
|
329 |
|
|
Out << " wire " << inout_table[i]->port_name << " ;" << endl ;
|
330 |
|
|
|
331 |
|
|
}else
|
332 |
|
|
{
|
333 |
|
|
Out << endl;
|
334 |
|
|
Out << " reg " << qSetFieldWidth(0) <<"["<< inout_table[i]->width_first << ":" << inout_table[i]->width_second << "] ";
|
335 |
|
|
Out << inout_table[i]->port_name << "_hw" << " ;"<< endl;
|
336 |
|
|
Out << " wire " << qSetFieldWidth(0) <<"["<< inout_table[i]->width_first << ":" << inout_table[i]->width_second << "] ";
|
337 |
|
|
Out << inout_table[i]->port_name << " ;"<< endl;
|
338 |
|
|
}
|
339 |
|
|
}
|
340 |
|
|
}
|
341 |
|
|
|
342 |
|
|
Out << "\t\t ///////////////////////////////////////////////////////////////////////////////////" << endl;
|
343 |
|
|
Out << "\t\t // Inner signal initializing" << endl;
|
344 |
|
|
Out << "\t\t ////////////////////////////////////////////////////////////////////////////////////" << endl << endl << endl;
|
345 |
|
|
|
346 |
|
|
Out << "\t\t initial" << endl;
|
347 |
|
|
Out << "\t\t begin" << endl;
|
348 |
|
|
|
349 |
|
|
|
350 |
|
|
Out << "\t\t\t " << "cnt =0 ;" << endl;
|
351 |
|
|
Out << "\t\t\t " << "check_en =0 ;" << endl;
|
352 |
|
|
Out << "\t\t\t " << "_EziDebug_clk =0 ;" << endl;
|
353 |
|
|
Out << "\t\t\t " << "_EziDebug_rst =0 ;" << endl;
|
354 |
|
|
Out << "\t\t\t " << "_EziDebug_TOUT_reg =0 ;" << endl;
|
355 |
|
|
for(short i = 0; i < inout_table.count(); i++)
|
356 |
|
|
{
|
357 |
|
|
if((QString::fromAscii(inout_table[i]->port_name) == m_iclockSigName)\
|
358 |
|
|
||(QString::fromAscii(inout_table[i]->port_name) == m_iresetSigName))
|
359 |
|
|
{
|
360 |
|
|
continue ;
|
361 |
|
|
}
|
362 |
|
|
if(inout_table[i]->inout)
|
363 |
|
|
{
|
364 |
|
|
Out << "\t\t\t "<< inout_table[i]->port_name << " =0 ;"<< endl;
|
365 |
|
|
}else
|
366 |
|
|
{
|
367 |
|
|
Out << "\t\t\t "<< inout_table[i]->port_name << "_hw" << " =0 ;" <<endl;
|
368 |
|
|
}
|
369 |
|
|
}
|
370 |
|
|
|
371 |
|
|
Out << "\t\t\t repeat(3) @(posedge _EziDebug_clk);" << endl;
|
372 |
|
|
Out << "\t\t\t _EziDebug_rst = 1; " << endl;
|
373 |
|
|
Out << "\t\t\t repeat(3) @(posedge _EziDebug_clk);" << endl;
|
374 |
|
|
Out << "\t\t\t _EziDebug_rst = 0; " << endl;
|
375 |
|
|
Out << "\t\t end" << endl << endl;
|
376 |
|
|
|
377 |
|
|
Out << "\t\t always #10 _EziDebug_clk = ~_EziDebug_clk ;" << endl << endl;
|
378 |
|
|
|
379 |
|
|
Out << "\t\t///////////////////////////////////////////////////////////////////////////" << endl;
|
380 |
|
|
Out << "\t\t// Register Initializing" << endl;
|
381 |
|
|
Out << "\t\t////////////////////////////////////////////////////////////////////////// " << endl;
|
382 |
|
|
|
383 |
|
|
Out << "\t\treg [7:0] k;" << endl;
|
384 |
|
|
Out << "\t\t initial" << endl;
|
385 |
|
|
Out << "\t\t begin" << endl;
|
386 |
|
|
Out << "\t\t\t k = 0;" << endl;
|
387 |
|
|
Out << "\t\t\t @(posedge _EziDebug_clk);" << endl;
|
388 |
|
|
Out << "\t\t\t\t wait (_EziDebug_TOUT_reg == 1'b1);" << endl;
|
389 |
|
|
Out << "\t\t\t @(negedge _EziDebug_clk);" << endl;
|
390 |
|
|
Out << "\t\t\t @(posedge _EziDebug_clk);" << endl;
|
391 |
|
|
Out << "\t\t\t\t wait (_EziDebug_TOUT_reg == 1'b0);" << endl;
|
392 |
|
|
Out << "\t\t\t @(negedge _EziDebug_clk);" << endl;
|
393 |
|
|
Out << "\t\t\t @(posedge _EziDebug_clk);" << endl;
|
394 |
|
|
Out << "\t\t\t\t begin" << endl;
|
395 |
|
|
Out << "\t\t\t\t $stop;" << endl ;
|
396 |
|
|
Out << "\t\t\t\t #1" << endl;
|
397 |
|
|
Out << "\t\t\t\t check_en = 1'b1;" << endl ;
|
398 |
|
|
|
399 |
|
|
short i1 = 1;
|
400 |
|
|
short format_open = 0;
|
401 |
|
|
|
402 |
|
|
#if 1
|
403 |
|
|
//QVector<QList<regchain *> > regchain_table ;
|
404 |
|
|
sample * ptdoSample = sample_table.at(0) ;
|
405 |
|
|
QString itdoPort = QString::fromAscii(ptdoSample->sample_name);
|
406 |
|
|
for(short i = 0; i < regchain_table.count() ; i++)
|
407 |
|
|
{
|
408 |
|
|
QString itdoTemp ;
|
409 |
|
|
QList<regchain *> iregChainList = regchain_table.at(i) ;
|
410 |
|
|
if(regchain_table.count() > 1)
|
411 |
|
|
{
|
412 |
|
|
itdoTemp = QObject::tr(" = %1_buf[%2][cnt -1 +").arg(itdoPort).arg(i);
|
413 |
|
|
}
|
414 |
|
|
else
|
415 |
|
|
{
|
416 |
|
|
itdoTemp = QObject::tr(" = %1_buf[cnt -1 +").arg(itdoPort);
|
417 |
|
|
}
|
418 |
|
|
|
419 |
|
|
for(short j = 0 ; j < iregChainList.count() ; j++)
|
420 |
|
|
{
|
421 |
|
|
if(iregChainList[j]->width_first == 0)
|
422 |
|
|
{
|
423 |
|
|
if(format_open == 1)
|
424 |
|
|
{
|
425 |
|
|
Out << endl;
|
426 |
|
|
format_open = 0;
|
427 |
|
|
}
|
428 |
|
|
Out << "\t\t\t\t dut." << iregChainList[j]->reg_name << itdoTemp << i1 << "];" << endl;
|
429 |
|
|
i1++;
|
430 |
|
|
}
|
431 |
|
|
else
|
432 |
|
|
{
|
433 |
|
|
Out << endl;
|
434 |
|
|
Out << "\t\t\t\t for( k=0; k<" << (iregChainList[j]->width_first + 1) << ";k=k+1) begin" << endl;
|
435 |
|
|
Out << "\t\t\t\t dut." << iregChainList[j]->reg_name << "[" << iregChainList[j]->width_first << "-k]" << itdoTemp << i1 << "+k];" << endl;
|
436 |
|
|
Out << "\t\t\t\t end " << endl;
|
437 |
|
|
i1 += iregChainList[j]->width_first +1;
|
438 |
|
|
format_open = 1;
|
439 |
|
|
}
|
440 |
|
|
}
|
441 |
|
|
}
|
442 |
|
|
// Ìí¼Ó end ½áβ
|
443 |
|
|
Out << "\t\t\t\t end" << endl ;
|
444 |
|
|
|
445 |
|
|
// Ìí¼Ó end ½áβ
|
446 |
|
|
Out << "\t\t end" << endl ;
|
447 |
|
|
#endif
|
448 |
|
|
|
449 |
|
|
Out << endl << endl ;
|
450 |
|
|
Out << "\t\t///////////////////////////////////////////////////////////////////////////" << endl;
|
451 |
|
|
Out << "\t\t// Input Signals " << endl;
|
452 |
|
|
Out << "\t\t////////////////////////////////////////////////////////////////////////// " << endl;
|
453 |
|
|
Out << endl;
|
454 |
|
|
Out << "\t\t\t always@(posedge _EziDebug_clk)" << endl;
|
455 |
|
|
Out << "\t\t\t\t begin" << endl;
|
456 |
|
|
|
457 |
|
|
QString itout = QString::fromAscii(sample_table[1]->sample_name);
|
458 |
|
|
QString ichainName = itout.split("_").at(2) ;
|
459 |
|
|
QString itoutPortName = QObject::tr("_EziDebug_%1_TOUT_reg").arg(ichainName) ;
|
460 |
|
|
// EziDebug_TOUT_reg
|
461 |
|
|
Out << "\t\t\t\t force " << "_EziDebug_TOUT_reg" << " =" << itout << "_buf[cnt+1];" << endl;
|
462 |
|
|
|
463 |
|
|
for(short i = 0 ; i < inout_table.count() ; i++)
|
464 |
|
|
{
|
465 |
|
|
if((QString::fromAscii(inout_table[i]->port_name) == m_iclockSigName)\
|
466 |
|
|
||(QString::fromAscii(inout_table[i]->port_name) == m_iresetSigName))
|
467 |
|
|
{
|
468 |
|
|
continue ;
|
469 |
|
|
}
|
470 |
|
|
if(inout_table[i]->inout == 1)
|
471 |
|
|
{
|
472 |
|
|
Out << "\t\t\t\t force " << inout_table[i]->port_name << " =" << inout_table[i]->port_name << "_buf[cnt];" << endl;
|
473 |
|
|
|
474 |
|
|
}else
|
475 |
|
|
{
|
476 |
|
|
Out << "\t\t\t\t force " << inout_table[i]->port_name << "_hw =" << inout_table[i]->port_name << "_buf[cnt];" << endl;
|
477 |
|
|
|
478 |
|
|
}
|
479 |
|
|
}
|
480 |
|
|
|
481 |
|
|
for(short i = 0 ; i < systeminout_table.count() ; i++)
|
482 |
|
|
{
|
483 |
|
|
QString isysPort = QString::fromAscii(systeminout_table[i]->port_name) ;
|
484 |
|
|
// QString isysTempPort = isysPort.split(".").last();
|
485 |
|
|
QString isysReg = QString::fromAscii(systeminout_table[i]->reg_name) ;
|
486 |
|
|
Out << "\t\t\t\t force " << isysPort << " =" << isysReg << "_buf" << "[cnt];" << endl;
|
487 |
|
|
}
|
488 |
|
|
|
489 |
|
|
Out << "\t\t\t\t #1" << endl;
|
490 |
|
|
Out << "\t\t\t\t cnt = cnt + 32'h1;" << endl;
|
491 |
|
|
Out << "\t\t\t if(cnt == DATA_WIDTH) $stop;" << endl;
|
492 |
|
|
Out << "\t\t\t end" << endl << endl << endl;
|
493 |
|
|
|
494 |
|
|
Out << "\t\t///////////////////////////////////////////////////////////////////////////" << endl;
|
495 |
|
|
Out << "\t\t// Outputs checks " << endl;
|
496 |
|
|
Out << "\t\t////////////////////////////////////////////////////////////////////////// " << endl << endl;
|
497 |
|
|
|
498 |
|
|
Out << "\t\t always@ (posedge _EziDebug_clk)" << endl;
|
499 |
|
|
Out << "\t\t\t if(check_en == 1'b1)" << endl;
|
500 |
|
|
Out << "\t\t\t begin" << endl;
|
501 |
|
|
Out << "\t\t\t if(" << endl;
|
502 |
|
|
|
503 |
|
|
qDebug() << "retrieve_text" << __LINE__ ;
|
504 |
|
|
|
505 |
|
|
for(short i = 0 ; i < inout_table.count() ; i++)
|
506 |
|
|
{
|
507 |
|
|
if((QString::fromAscii(inout_table[i]->port_name) == m_iclockSigName)\
|
508 |
|
|
||(QString::fromAscii(inout_table[i]->port_name) == m_iresetSigName))
|
509 |
|
|
{
|
510 |
|
|
continue ;
|
511 |
|
|
}
|
512 |
|
|
// Ö»±È½ÏÊä³ö
|
513 |
|
|
if(inout_table[i]->inout == 0)
|
514 |
|
|
{
|
515 |
|
|
if( i != (inout_table.count() - 1))
|
516 |
|
|
{
|
517 |
|
|
Out << "\t\t\t ( " << inout_table[i]->port_name << "_hw != " << inout_table[i]->port_name << " )|" << endl;
|
518 |
|
|
}else
|
519 |
|
|
{
|
520 |
|
|
Out << "\t\t\t ( " << inout_table[i]->port_name << "_hw != " << inout_table[i]->port_name << " )" << endl;
|
521 |
|
|
}
|
522 |
|
|
}
|
523 |
|
|
}
|
524 |
|
|
Out << "\t\t\t )" << endl;
|
525 |
|
|
Out << "\t\t $stop;" << endl;
|
526 |
|
|
Out << "\t\t end" << endl << endl << endl;
|
527 |
|
|
|
528 |
|
|
Out << "\t\t///////////////////////////////////////////////////////////////////////////" << endl;
|
529 |
|
|
Out << "\t\t// top module " << endl;
|
530 |
|
|
Out << "\t\t////////////////////////////////////////////////////////////////////////// " << endl << endl;
|
531 |
|
|
|
532 |
|
|
Out << "\t\t "<< module_name << " dut(" << endl;
|
533 |
|
|
QString iresetName ;
|
534 |
|
|
for(short i = 0; i < inout_table.count(); i++ )
|
535 |
|
|
{
|
536 |
|
|
if(i != (inout_table.count() -1))
|
537 |
|
|
{
|
538 |
|
|
if(m_iclockSigName == QString::fromAscii(inout_table[i]->port_name))
|
539 |
|
|
{
|
540 |
|
|
Out << "\t\t ." << qSetFieldWidth(40) << inout_table[i]->port_name << qSetFieldWidth(0) << "( " << "_EziDebug_clk" << " )," << endl;
|
541 |
|
|
}
|
542 |
|
|
else if(m_iresetSigName == QString::fromAscii(inout_table[i]->port_name))
|
543 |
|
|
{
|
544 |
|
|
if(m_eresetEdge == posedge)
|
545 |
|
|
{
|
546 |
|
|
iresetName = "_EziDebug_rst";
|
547 |
|
|
}
|
548 |
|
|
else if(m_eresetEdge == nededge )
|
549 |
|
|
{
|
550 |
|
|
iresetName = "!_EziDebug_rst" ;
|
551 |
|
|
}
|
552 |
|
|
else
|
553 |
|
|
{
|
554 |
|
|
iresetName = m_iresetSigVal ;
|
555 |
|
|
}
|
556 |
|
|
|
557 |
|
|
Out << "\t\t ." << qSetFieldWidth(40) << inout_table[i]->port_name << qSetFieldWidth(0) << "( " << iresetName << " )," << endl;
|
558 |
|
|
}
|
559 |
|
|
else
|
560 |
|
|
{
|
561 |
|
|
Out << "\t\t ." << qSetFieldWidth(40) << inout_table[i]->port_name << qSetFieldWidth(0) << "( " << inout_table[i]->port_name << " )," << endl;
|
562 |
|
|
}
|
563 |
|
|
}else
|
564 |
|
|
{
|
565 |
|
|
if(m_iclockSigName == QString::fromAscii(inout_table[i]->port_name))
|
566 |
|
|
{
|
567 |
|
|
Out << "\t\t ." << qSetFieldWidth(40) << inout_table[i]->port_name << qSetFieldWidth(0) << "( " << "_EziDebug_clk" << " )" << endl;
|
568 |
|
|
}
|
569 |
|
|
else if(m_iresetSigName == QString::fromAscii(inout_table[i]->port_name))
|
570 |
|
|
{
|
571 |
|
|
if(m_eresetEdge == posedge)
|
572 |
|
|
{
|
573 |
|
|
iresetName = "_EziDebug_rst";
|
574 |
|
|
}
|
575 |
|
|
else if(m_eresetEdge == nededge )
|
576 |
|
|
{
|
577 |
|
|
iresetName = "!_EziDebug_rst" ;
|
578 |
|
|
}
|
579 |
|
|
else
|
580 |
|
|
{
|
581 |
|
|
iresetName = m_iresetSigVal ;
|
582 |
|
|
}
|
583 |
|
|
|
584 |
|
|
Out << "\t\t ." << qSetFieldWidth(40) << inout_table[i]->port_name << qSetFieldWidth(0) << "( " << iresetName << " )" << endl;
|
585 |
|
|
}
|
586 |
|
|
else
|
587 |
|
|
{
|
588 |
|
|
Out << "\t\t ." << qSetFieldWidth(40) << inout_table[i]->port_name << qSetFieldWidth(0) << "( " << inout_table[i]->port_name << " )" << endl;
|
589 |
|
|
}
|
590 |
|
|
}
|
591 |
|
|
}
|
592 |
|
|
|
593 |
|
|
Out << "\t\t ); "<< endl << endl ;
|
594 |
|
|
Out << "\t endmodule "<< endl ;
|
595 |
|
|
#endif
|
596 |
|
|
|
597 |
|
|
Outfile.close();
|
598 |
|
|
|
599 |
|
|
qDebug() << "retrieve_text" << __LINE__ ;
|
600 |
|
|
}
|
601 |
|
|
|
602 |
|
|
void TextQuery::setNoNeedSig(QString clockport, QString resetport ,EDGE_TYPE resetedge,QString resetval)
|
603 |
|
|
{
|
604 |
|
|
m_iclockSigName = clockport ;
|
605 |
|
|
m_iresetSigName = resetport ;
|
606 |
|
|
m_eresetEdge = resetedge ;
|
607 |
|
|
m_iresetSigVal = resetval ;
|
608 |
|
|
}
|
609 |
|
|
|