1 |
4 |
igorloi |
#include "top_debug.h"
|
2 |
|
|
|
3 |
|
|
void decode(sc_lv<32> if_id_inst, unsigned int i, ostream& out)
|
4 |
|
|
{
|
5 |
|
|
|
6 |
|
|
sc_lv<32> inst = if_id_inst;
|
7 |
|
|
sc_lv<6> func = inst.range(5,0);
|
8 |
|
|
sc_lv<6> op = inst.range(31,26);
|
9 |
|
|
|
10 |
|
|
char *charinst=0;
|
11 |
|
|
|
12 |
|
|
sc_lv<5> rs, rt ,rd ,lrs, lrt, lrd, lsa; // lv version of reg #
|
13 |
|
|
sc_uint<5> uirs, uirt, uird, uisa; // unsigned integer version of reg #
|
14 |
|
|
sc_int<32> is, it, id; // integer version of register contents...
|
15 |
|
|
|
16 |
|
|
//! The immediate value in an instruction
|
17 |
|
|
sc_lv<16> imm;
|
18 |
|
|
sc_lv<32> imm_sign, imm_zero;
|
19 |
|
|
sc_int<32> iimm_sign, iimm_zero;
|
20 |
|
|
sc_uint<32> uiimm_sign, uiimm_zero;
|
21 |
|
|
sc_lv<28> instr_index;
|
22 |
|
|
sc_uint<28> uiinstr_index;
|
23 |
|
|
|
24 |
|
|
// register destinations and recipients
|
25 |
|
|
rs = inst.range(25,21);
|
26 |
|
|
rt = inst.range(20,16);
|
27 |
|
|
rd = inst.range(15,11);
|
28 |
|
|
uirs = lrs = inst.range(25,21);
|
29 |
|
|
uirt = lrt = inst.range(20,16);
|
30 |
|
|
uird = lrd = inst.range(15,11);
|
31 |
|
|
uisa = lsa = inst.range(10,6);
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
// Immediate values
|
35 |
|
|
imm = inst.range(15,0);
|
36 |
|
|
uiimm_zero = iimm_zero = imm_zero = (HALFWORD_ZERO,imm);
|
37 |
|
|
if( imm[15] == '1')
|
38 |
|
|
uiimm_sign = iimm_sign = imm_sign = (HALFWORD_ONE,imm);
|
39 |
|
|
else
|
40 |
|
|
uiimm_sign = iimm_sign = imm_sign = (HALFWORD_ZERO,imm);
|
41 |
|
|
|
42 |
|
|
uiinstr_index = instr_index = (inst.range(25,0), "00");
|
43 |
|
|
|
44 |
|
|
|
45 |
|
|
|
46 |
|
|
//switch stage
|
47 |
|
|
if(op == OP_RFORMAT)
|
48 |
|
|
{
|
49 |
|
|
if(func == FUNC_JR)
|
50 |
|
|
{
|
51 |
|
|
out << " MIPS (ID): jr $"<< dec << (unsigned int)uirs << endl;
|
52 |
|
|
}
|
53 |
|
|
else if(func == FUNC_JALR)
|
54 |
|
|
{
|
55 |
|
|
if (uird == 0)
|
56 |
|
|
out << " MIPS (ID): jalr $" << dec << (unsigned int)uirs << endl;
|
57 |
|
|
else
|
58 |
|
|
out << " MIPS (ID): jalr $" << dec << (unsigned int)uird << ", $" << dec << (unsigned int)uirs << endl;
|
59 |
|
|
}
|
60 |
|
|
|
61 |
|
|
/*
|
62 |
|
|
|
63 |
|
|
*/
|
64 |
|
|
else
|
65 |
|
|
if(func == FUNC_MTHI ||
|
66 |
|
|
func == FUNC_MFLO ||
|
67 |
|
|
func == FUNC_MULT ||
|
68 |
|
|
func == FUNC_MULTU ||
|
69 |
|
|
func == FUNC_DIV ||
|
70 |
|
|
func == FUNC_DIVU)
|
71 |
|
|
|
72 |
|
|
if (func == FUNC_MTHI) {charinst = "mthi"; out << " MIPS (ID): " << charinst << " $" << dec << (unsigned int) uirs << " [Hi]" << endl;}
|
73 |
|
|
|
74 |
|
|
if (func == FUNC_MFLO) {charinst = "mflo"; out << " MIPS (ID): " << charinst << " $" << dec << (unsigned int) uird << " [Lo]" << endl;}
|
75 |
|
|
|
76 |
|
|
if (func == FUNC_MULT) {charinst = "mult"; out << " MIPS (ID): " << charinst << " [Hi,Lo]," <<" $" << dec << (unsigned int)uirs << ", $" << dec << (unsigned int)uirt << endl;}
|
77 |
|
|
|
78 |
|
|
if (func == FUNC_MULTU) {charinst = "multu"; out << " MIPS (ID): " << charinst <<" [Hi,Lo], $" << dec << (unsigned int)uirs << ", $" << dec << (unsigned int)uirt << endl;}
|
79 |
|
|
|
80 |
|
|
if (func == FUNC_DIV) {charinst = "div"; out << " MIPS (ID): " << charinst << " [Quoz = Hi, Resto = Lo], $" << dec << (unsigned int)uirs << ", $" << dec << (unsigned int)uirt << endl;}
|
81 |
|
|
|
82 |
|
|
if (func == FUNC_DIVU) {charinst = "divu"; out << " MIPS (ID): " << charinst << " [Quoz = Hi, Rest = Lo], $" << dec << (unsigned int)uirs << ", $" << dec << (unsigned int)uirt << endl;}
|
83 |
|
|
|
84 |
|
|
|
85 |
|
|
else if(func == FUNC_SLL ||
|
86 |
|
|
func == FUNC_SRL ||
|
87 |
|
|
func == FUNC_SRA)
|
88 |
|
|
{
|
89 |
|
|
if (func == FUNC_SLL) charinst = "sll";
|
90 |
|
|
if (func == FUNC_SRL) charinst = "srl";
|
91 |
|
|
if (func == FUNC_SRA) charinst = "sra";
|
92 |
|
|
if (func == FUNC_SLL && (unsigned int)uird == 0)
|
93 |
|
|
out << " MIPS (ID): nop" << endl;
|
94 |
|
|
else
|
95 |
|
|
out << " MIPS (ID): " << charinst << " $" << dec << (unsigned int)uird <<", $" << dec << (unsigned int)uirt <<", " << dec << (unsigned int)uisa << endl;
|
96 |
|
|
}
|
97 |
|
|
else if(func == FUNC_SLLV ||
|
98 |
|
|
func == FUNC_SRLV ||
|
99 |
|
|
func == FUNC_SRAV ||
|
100 |
|
|
func == FUNC_ADD ||
|
101 |
|
|
func == FUNC_ADDU ||
|
102 |
|
|
func == FUNC_SUB ||
|
103 |
|
|
func == FUNC_SUBU ||
|
104 |
|
|
func == FUNC_AND ||
|
105 |
|
|
func == FUNC_OR ||
|
106 |
|
|
func == FUNC_XOR ||
|
107 |
|
|
func == FUNC_NOR ||
|
108 |
|
|
func == FUNC_SLT ||
|
109 |
|
|
func == FUNC_SLTU)
|
110 |
|
|
{
|
111 |
|
|
|
112 |
|
|
// printf("MIPS (ID): R-Format - read next line!\n");
|
113 |
|
|
if (func == FUNC_SLLV) charinst = "sllv";
|
114 |
|
|
if (func == FUNC_SRLV) charinst = "srlv";
|
115 |
|
|
if (func == FUNC_SRAV) charinst = "srav";
|
116 |
|
|
if (func == FUNC_ADD) charinst = "add";
|
117 |
|
|
if (func == FUNC_ADDU) charinst = "addu";
|
118 |
|
|
if (func == FUNC_SUB) charinst = "sub";
|
119 |
|
|
if (func == FUNC_SUBU) charinst = "subu";
|
120 |
|
|
if (func == FUNC_AND) charinst = "and";
|
121 |
|
|
if (func == FUNC_OR) charinst = "or";
|
122 |
|
|
if (func == FUNC_XOR) charinst = "xor";
|
123 |
|
|
if (func == FUNC_NOR) charinst = "nor";
|
124 |
|
|
if (func == FUNC_SLT) charinst = "slt";
|
125 |
|
|
if (func == FUNC_SLTU) charinst = "sltu";
|
126 |
|
|
out << " MIPS (ID): " << charinst << " $" << dec << (unsigned int)uird << ", $" << dec << (unsigned int)uirs << ", $" << dec << (unsigned int)uirt << endl;
|
127 |
|
|
}
|
128 |
|
|
else if (func == FUNC_BREAK)
|
129 |
|
|
{
|
130 |
|
|
out << " MIPS (ID): BREAK" << endl;
|
131 |
|
|
}
|
132 |
|
|
|
133 |
|
|
else if (func == FUNC_SYSCALL)
|
134 |
|
|
{
|
135 |
|
|
out << " MIPS (ID): SYSCALL" << endl;
|
136 |
|
|
}
|
137 |
|
|
|
138 |
|
|
else if (func == FUNC_BREAK || func == FUNC_SYSCALL)
|
139 |
|
|
{
|
140 |
|
|
out << " Exception!!" << endl;
|
141 |
|
|
}
|
142 |
|
|
|
143 |
|
|
else
|
144 |
|
|
{
|
145 |
|
|
out << " * UNKNOWN FUNCTION CODE FOR R-format" << endl;
|
146 |
|
|
}
|
147 |
|
|
}
|
148 |
|
|
else if(op == OP_BRANCH)
|
149 |
|
|
{
|
150 |
|
|
// PRINTLN("Branch format");
|
151 |
|
|
if(lrt.range(1,0) == BRANCH_BLTZ)
|
152 |
|
|
{
|
153 |
|
|
out << " MIPS (ID): bltz $" << dec << (unsigned int)uirs << ", " << dec << (unsigned int)iimm_sign << endl;
|
154 |
|
|
}
|
155 |
|
|
|
156 |
|
|
else if(lrt.range(1,0) == BRANCH_BGEZ)
|
157 |
|
|
{
|
158 |
|
|
out << " MIPS (ID): bgez $" << dec << (unsigned int)uirs << ", " << dec << (unsigned int)iimm_sign << endl;
|
159 |
|
|
}
|
160 |
|
|
|
161 |
|
|
else if(lrt.range(1,0) == BRANCH_BLTZAL)
|
162 |
|
|
{
|
163 |
|
|
out << " MIPS (ID): bltzal $"<< dec << (unsigned int)uirs << ", " << dec << (unsigned int)iimm_sign << endl;
|
164 |
|
|
}
|
165 |
|
|
else if(lrt.range(1,0) == BRANCH_BGEZAL)
|
166 |
|
|
{
|
167 |
|
|
|
168 |
|
|
out << " MIPS (ID): bgezal $" << dec << (unsigned int)uirs << ", " << dec << (unsigned int)iimm_sign << endl;
|
169 |
|
|
}
|
170 |
|
|
}
|
171 |
|
|
|
172 |
|
|
|
173 |
|
|
else if(op == OP_J)
|
174 |
|
|
{
|
175 |
|
|
|
176 |
|
|
out << " MIPS (ID): j "<< dec << (unsigned int) uiinstr_index << endl;
|
177 |
|
|
}
|
178 |
|
|
|
179 |
|
|
|
180 |
|
|
else if(op == OP_JAL)
|
181 |
|
|
{
|
182 |
|
|
out << " MIPS (ID): jal " << dec << (unsigned int) uiinstr_index << endl;
|
183 |
|
|
}
|
184 |
|
|
|
185 |
|
|
|
186 |
|
|
else if(op == OP_BEQ)
|
187 |
|
|
{
|
188 |
|
|
out << " MIPS (ID): beq $" << dec << (unsigned int)uirt << ", $" << dec << (unsigned int)uirs << ", " << dec << (unsigned int)iimm_sign << endl;
|
189 |
|
|
}
|
190 |
|
|
|
191 |
|
|
|
192 |
|
|
else if(op == OP_BNE)
|
193 |
|
|
{
|
194 |
|
|
out << " MIPS (ID): bne $"<< dec << (unsigned int)uirt << ", $" << dec << (unsigned int)uirs << ", " << dec << (unsigned int)iimm_sign << endl;
|
195 |
|
|
}
|
196 |
|
|
|
197 |
|
|
|
198 |
|
|
else if(op == OP_BLEZ)
|
199 |
|
|
{
|
200 |
|
|
out << " MIPS (ID): blez $" << dec << (unsigned int) uirs << ", " << dec << (unsigned int) iimm_sign << endl;
|
201 |
|
|
}
|
202 |
|
|
|
203 |
|
|
|
204 |
|
|
else if(op == OP_BGTZ)
|
205 |
|
|
{
|
206 |
|
|
out << " MIPS (ID): bgtz $" << dec << (unsigned int)uirs << ", " << (unsigned int)iimm_sign << endl;
|
207 |
|
|
}
|
208 |
|
|
|
209 |
|
|
|
210 |
|
|
else if(op == OP_ADDI)
|
211 |
|
|
{
|
212 |
|
|
out << " MIPS (ID): addi $" << dec << (unsigned int)uirt << ", $" << dec << (unsigned int)uirs << ", " << dec << (unsigned int)iimm_sign << endl;
|
213 |
|
|
}
|
214 |
|
|
|
215 |
|
|
|
216 |
|
|
else if(op == OP_ADDIU)
|
217 |
|
|
{
|
218 |
|
|
out << " MIPS (ID): addiu $" << dec << (unsigned int)uirt << ", $" << dec << (unsigned int)uirs << ", " << dec << (int)uiimm_sign << endl;
|
219 |
|
|
}
|
220 |
|
|
|
221 |
|
|
|
222 |
|
|
else if(op == OP_SLTI)
|
223 |
|
|
{
|
224 |
|
|
out << " MIPS (ID): slti $" << dec << (unsigned int)uirt << ", $" << dec << (unsigned int)uirs << ", " << dec << (unsigned int)iimm_sign << endl;
|
225 |
|
|
}
|
226 |
|
|
|
227 |
|
|
|
228 |
|
|
else if(op == OP_SLTIU)
|
229 |
|
|
{
|
230 |
|
|
out << " MIPS (ID): sltiu $" << dec << (unsigned int)uirt << ", $" << dec << (unsigned int)uirs << ", " << dec << (unsigned int)iimm_sign << endl;
|
231 |
|
|
}
|
232 |
|
|
|
233 |
|
|
|
234 |
|
|
else if(op == OP_ANDI)
|
235 |
|
|
{
|
236 |
|
|
out << " MIPS (ID): andi $" << dec << (unsigned int)uirt << ", $" << dec << (unsigned int)uirs << ", 0x" << hex << (unsigned int)iimm_sign << endl;
|
237 |
|
|
}
|
238 |
|
|
|
239 |
|
|
|
240 |
|
|
else if(op == OP_ORI)
|
241 |
|
|
{
|
242 |
|
|
out << " MIPS (ID): ori $" << dec << (unsigned int)uirt << ", $" << dec << (unsigned int)uirs << ", 0x" << hex << (unsigned int)iimm_sign << endl;
|
243 |
|
|
}
|
244 |
|
|
|
245 |
|
|
|
246 |
|
|
else if(op == OP_XORI)
|
247 |
|
|
{
|
248 |
|
|
out << " MIPS (ID): xori $" << dec << (unsigned int)uirt << ", $" << dec << (unsigned int)uirs << ", 0x" << hex << (unsigned int)iimm_sign << endl;
|
249 |
|
|
}
|
250 |
|
|
|
251 |
|
|
|
252 |
|
|
else if(op == OP_LUI)
|
253 |
|
|
{
|
254 |
|
|
out << " MIPS (ID): lui $" << dec << (unsigned int)uirt << ", " << dec << (unsigned int)iimm_sign << endl;
|
255 |
|
|
}
|
256 |
|
|
|
257 |
|
|
|
258 |
|
|
else if(op == OP_LB ||
|
259 |
|
|
op == OP_LH ||
|
260 |
|
|
op == OP_LWL ||
|
261 |
|
|
op == OP_LW ||
|
262 |
|
|
op == OP_LBU ||
|
263 |
|
|
op == OP_LHU ||
|
264 |
|
|
op == OP_LWR)
|
265 |
|
|
{
|
266 |
|
|
if (op == OP_LB) charinst = "lb";
|
267 |
|
|
if (op == OP_LH) charinst = "lh";
|
268 |
|
|
if (op == OP_LWL) charinst = "lwl";
|
269 |
|
|
if (op == OP_LW) charinst = "lw";
|
270 |
|
|
if (op == OP_LBU) charinst = "lbu";
|
271 |
|
|
if (op == OP_LHU) charinst = "lhu";
|
272 |
|
|
if (op == OP_LWR) charinst = "lwr";
|
273 |
|
|
out << " MIPS (ID): " << charinst << " $" << dec << (unsigned int)uirt << ", " << dec << (unsigned int)iimm_sign << "($" << dec << (unsigned int)uirs << ") (" << dec << (unsigned int)(is + iimm_sign) << ")" << endl;
|
274 |
|
|
}
|
275 |
|
|
|
276 |
|
|
|
277 |
|
|
else if(op == OP_SB ||
|
278 |
|
|
op == OP_SH ||
|
279 |
|
|
op == OP_SWL ||
|
280 |
|
|
op == OP_SW ||
|
281 |
|
|
op == OP_SWR)
|
282 |
|
|
{
|
283 |
|
|
if (op == OP_SB) charinst = "sb";
|
284 |
|
|
if (op == OP_SH) charinst = "sh";
|
285 |
|
|
if (op == OP_SWL) charinst = "swl";
|
286 |
|
|
if (op == OP_SW) charinst = "sw";
|
287 |
|
|
if (op == OP_SWR) charinst = "swr";
|
288 |
|
|
out << " MIPS (ID): " << charinst <<" $" << dec << (unsigned int)uirt << ", " << dec << (unsigned int)iimm_sign << "($" << dec << (unsigned int)uirs << ") (" << dec << (unsigned int)(is + iimm_sign) << ")" << endl;
|
289 |
|
|
}
|
290 |
|
|
|
291 |
|
|
|
292 |
|
|
else if(op == OP_CACHE)
|
293 |
|
|
{
|
294 |
|
|
out << " MIPS (ID): CACHE $" << dec << (unsigned int)uirt << ", $" << dec << (unsigned int)iimm_sign.range(15,0) << "(" << dec << (unsigned int) uirs << ")" << endl;
|
295 |
|
|
}
|
296 |
|
|
|
297 |
|
|
|
298 |
|
|
else if(op == OP_COPROC0)
|
299 |
|
|
{
|
300 |
|
|
out << " MIPS (ID): CP0 instruction" << endl;
|
301 |
|
|
}
|
302 |
|
|
else
|
303 |
|
|
{
|
304 |
|
|
if(lrs == RS_MFC0)
|
305 |
|
|
{
|
306 |
|
|
out << " MIPS (ID): mfc0 $" << dec << (unsigned int)uirt << ", $" << dec << (unsigned int)uird << endl;
|
307 |
|
|
}
|
308 |
|
|
else if(lrs == RS_MTC0)
|
309 |
|
|
{
|
310 |
|
|
out << " MIPS (ID): mtc0 $" << dec << (unsigned int)uirt << ", $" << dec << (unsigned int)uird << endl;
|
311 |
|
|
}
|
312 |
|
|
}
|
313 |
|
|
}
|
314 |
|
|
|
315 |
|
|
|
316 |
|
|
|
317 |
|
|
|
318 |
|
|
|
319 |
|
|
|
320 |
|
|
|
321 |
|
|
|
322 |
|
|
|
323 |
|
|
void top_debug::debug_signals()
|
324 |
|
|
{
|
325 |
|
|
ofstream out("GIGINO.txt");
|
326 |
|
|
|
327 |
|
|
out << endl;
|
328 |
|
|
out << "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" << endl;
|
329 |
|
|
out << " Simulationon after " << sc_simulation_time() << "ns Clock n°" << sc_simulation_time()/20 << " Reset =" << top_level->reset << endl;
|
330 |
|
|
out << "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx REGISTERS xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" << endl;
|
331 |
|
|
out << endl;
|
332 |
|
|
for (int n=0; n < 8; n++)
|
333 |
|
|
{
|
334 |
|
|
out << "$"<< dec << n <<" = 0x" << hex << setw(8) << setfill('0') <<(unsigned int) ((sc_uint<32>)(top_level->risc->cpu->id->localreg->r[n]));
|
335 |
|
|
|
336 |
|
|
out << " $"<< dec << n+8 <<" = 0x" << hex << setw(8) << setfill('0') <<(unsigned int) ((sc_uint<32>)(top_level->risc->cpu->id->localreg->r[n+8]));
|
337 |
|
|
|
338 |
|
|
out << " $"<< dec << n+16 <<" = 0x" << hex << setw(8) << setfill('0') <<(unsigned int) ((sc_uint<32>)(top_level->risc->cpu->id->localreg->r[n+16]));
|
339 |
|
|
|
340 |
|
|
out << " $"<< dec << n+24 <<" = 0x" << hex << setw(8) << setfill('0') <<(unsigned int) ((sc_uint<32>)(top_level->risc->cpu->id->localreg->r[n+24]))<< endl;
|
341 |
|
|
|
342 |
|
|
}
|
343 |
|
|
|
344 |
|
|
out << " [HI] = " << hex << setw(8) << setfill('0') << (unsigned int) ((sc_uint<32>) top_level->risc->cpu->ex->out_hi) << endl;
|
345 |
|
|
|
346 |
|
|
out << " [LO] = " << hex << setw(8) << setfill('0') << (unsigned int) ((sc_uint<32>) top_level->risc->cpu->ex->out_lo) << endl;
|
347 |
|
|
|
348 |
|
|
|
349 |
|
|
out << endl;
|
350 |
|
|
out << "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx DATA xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" << endl;
|
351 |
|
|
|
352 |
|
|
out << " dataaddr = 0x" << hex << setw(8) << setfill('0') << (unsigned int) ((sc_uint<32>)(top_level->dataaddr)) << endl;
|
353 |
|
|
out << " dataread = 0x" << hex << setw(8) << setfill('0') << (unsigned int) ((sc_uint<32>) (top_level->dataread_dec_cpu)) << " ("<< top_level->dataread_dec_cpu <<")"<< endl;
|
354 |
|
|
out << " datawrite = 0x" << hex << setw(8) << setfill('0') << (unsigned int) ((sc_uint<32>) (top_level->datawrite)) << " ("<< top_level->datawrite <<")"<< endl;
|
355 |
|
|
out << " datarw = " << top_level->datarw << endl;
|
356 |
|
|
out << " datareq = " << top_level->datareq << endl;
|
357 |
|
|
out << " databs = " << top_level->databs << endl;
|
358 |
|
|
|
359 |
|
|
out << endl;
|
360 |
|
|
out << "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx INST_MEM xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" << endl;
|
361 |
|
|
|
362 |
|
|
decode(top_level->instdataread,((unsigned int) ((sc_uint<32>)(top_level->instaddr))), out);
|
363 |
|
|
|
364 |
|
|
out << " PC = 0x" << hex << setw(8) << setfill('0') << ((unsigned int)((sc_uint<32>)(top_level->instaddr))) << endl;
|
365 |
|
|
out << " InstDataRead = 0x" << hex << setw(8) << setfill('0') << (unsigned int) ((sc_uint<32>) (top_level->instdataread)) << " " << top_level->instdataread << endl;
|
366 |
|
|
|
367 |
|
|
out << " instreq = " << top_level->instreq << endl;
|
368 |
|
|
|
369 |
|
|
out << endl;
|
370 |
|
|
out << endl;
|
371 |
|
|
|
372 |
|
|
|
373 |
|
|
out << "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx MEMORY xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" << endl;
|
374 |
|
|
|
375 |
|
|
int temp, temp2, Start, Stop;
|
376 |
|
|
Start = Start_pos;
|
377 |
|
|
Stop = Finish_pos;
|
378 |
|
|
temp = (Start + (Stop - Start)/4);
|
379 |
|
|
temp2 = ((Stop - Start)/4);
|
380 |
|
|
|
381 |
|
|
for(int n= Start; n < temp; n=n+4)
|
382 |
|
|
{
|
383 |
|
|
out << "[0x"<< hex << n << "] = 0x"<< hex << setw(8) << setfill('0') << top_level->datamem->x[(n >> 2)] << " ";
|
384 |
|
|
|
385 |
|
|
out << "[0x"<< hex << (n + temp2) << "] = 0x"<< hex << setw(8) << setfill('0') << top_level->datamem->x[((n+temp2) >> 2)] << " ";
|
386 |
|
|
|
387 |
|
|
out << "[0x"<< hex << (n + 2*temp2) << "] = 0x"<< hex << setw(8) << setfill('0') << top_level->datamem->x[((n+2*temp2) >> 2)] << " ";
|
388 |
|
|
|
389 |
|
|
out << "[0x"<< hex << (n + 3*temp2) << "] = 0x"<< hex << setw(8) << setfill('0') << top_level->datamem->x[((n+3*temp2) >> 2)] << " " << endl;
|
390 |
|
|
|
391 |
|
|
/*out << "cella [0x"<< hex << (n+8) << "] = "<< hex << setw(8) << setfill('0') << top_level->datamem->x[((n+8) >> 2)] << " ";
|
392 |
|
|
|
393 |
|
|
out << "cella [0x"<< hex << (n+12) << "] = "<< hex << setw(8) << setfill('0') << top_level->datamem->x[((n+12) >> 2)] << endl;*/
|
394 |
|
|
|
395 |
|
|
}
|
396 |
|
|
|
397 |
|
|
|
398 |
|
|
|
399 |
|
|
char buffer[256];
|
400 |
|
|
ifstream examplefile ("GIGINO.txt");
|
401 |
|
|
if (! examplefile.is_open())
|
402 |
|
|
{ cout << "Error opening file"; exit (1); }
|
403 |
|
|
|
404 |
|
|
while (! examplefile.eof() )
|
405 |
|
|
{
|
406 |
|
|
examplefile.getline (buffer,100);
|
407 |
|
|
fprintf (fp ,"%s\n", buffer);
|
408 |
|
|
}
|
409 |
|
|
}
|