1 |
213 |
diegovalve |
`include "aDefinitions.v"
|
2 |
|
|
|
3 |
|
|
/**********************************************************************************
|
4 |
|
|
Theia, Ray Cast Programable graphic Processing Unit.
|
5 |
|
|
Copyright (C) 2012 Diego Valverde (diego.valverde.g@gmail.com)
|
6 |
|
|
|
7 |
|
|
This program is free software; you can redistribute it and/or
|
8 |
|
|
modify it under the terms of the GNU General Public License
|
9 |
|
|
as published by the Free Software Foundation; either version 2
|
10 |
|
|
of the License, or (at your option) any later version.
|
11 |
|
|
|
12 |
|
|
This program is distributed in the hope that it will be useful,
|
13 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
|
|
GNU General Public License for more details.
|
16 |
|
|
|
17 |
|
|
You should have received a copy of the GNU General Public License
|
18 |
|
|
along with this program; if not, write to the Free Software
|
19 |
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
20 |
|
|
|
21 |
|
|
***********************************************************************************/
|
22 |
|
|
//`define VP2_TOP( core ) `THEIA_TOP.\VPX[ core ].VP
|
23 |
|
|
`define MAX_OMEM_DUMP_SIZE 32
|
24 |
|
|
`define MAX_RF_MEM_DUMP_SIZE 128
|
25 |
|
|
module VectorProcessor_Dumper # (parameter CVPID = 2);
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
integer RESULT_FILE,VP_LOG,OMEM_LOG,VP_REG_LOG,i;
|
29 |
|
|
reg [255:1] VPLogFileName,OMEMLogFileName,RegLogFileName;
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
initial
|
37 |
|
|
begin
|
38 |
|
|
//Open output file
|
39 |
|
|
$swrite(VPLogFileName,"vp.%01d.log",CVPID);
|
40 |
|
|
$swrite(OMEMLogFileName,"OMEM.vp.%01d.log",CVPID);
|
41 |
|
|
$swrite(RegLogFileName,"rf.vp.%01d.log",CVPID);
|
42 |
|
|
RESULT_FILE = $fopen("test_result.log");
|
43 |
|
|
VP_LOG = $fopen(VPLogFileName);
|
44 |
|
|
end
|
45 |
|
|
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
//always @ (posedge `THEIA_TOP.VPX[ CVPID ].VP.Clock )
|
49 |
|
|
always @ (posedge `VP_TOP.Clock)
|
50 |
|
|
begin
|
51 |
|
|
//-----------------------------------------------------------------
|
52 |
|
|
|
53 |
|
|
if (`VP_TOP.EXE.II0.iInstruction0[`INST_EOF_RNG])
|
54 |
|
|
begin
|
55 |
|
|
$display(VP_LOG,"End of flow instruction detected");
|
56 |
|
|
$fwrite(RESULT_FILE,"Simulation ended at time %dns\n",$time);
|
57 |
|
|
$fwrite(RESULT_FILE,"multithread = %d\n",`VP_TOP.EXE.wThreadControl[`SPR_TCONTROL0_MT_ENABLED]);
|
58 |
|
|
$fwrite(RESULT_FILE,"Simulation RESULT %h\n",`VP_TOP.EXE.RF.RF_X.Ram[66]);
|
59 |
|
|
$fclose(RESULT_FILE);
|
60 |
|
|
$fclose( VP_LOG );
|
61 |
|
|
|
62 |
|
|
//Now write the output log
|
63 |
|
|
OMEM_LOG = $fopen(OMEMLogFileName);
|
64 |
|
|
for (i = 0; i < `MAX_OMEM_DUMP_SIZE; i = i +1)
|
65 |
|
|
begin
|
66 |
|
|
$fwrite(OMEM_LOG,"@%d\t%h\n",i,`THEIA_TOP.VPX[ CVPID ].OMEM.Ram[i]);
|
67 |
|
|
end
|
68 |
|
|
$fclose(OMEM_LOG);
|
69 |
|
|
|
70 |
|
|
VP_REG_LOG = $fopen(RegLogFileName);
|
71 |
|
|
for (i = 0; i < `MAX_RF_MEM_DUMP_SIZE; i = i +1)
|
72 |
|
|
begin
|
73 |
|
|
$fwrite(VP_REG_LOG,"r%01d\t%h %h %h\n",i,
|
74 |
|
|
`THEIA_TOP.VPX[ CVPID ].VP.EXE.RF.RF_X.Ram[i],
|
75 |
|
|
`THEIA_TOP.VPX[ CVPID ].VP.EXE.RF.RF_Y.Ram[i],
|
76 |
|
|
`THEIA_TOP.VPX[ CVPID ].VP.EXE.RF.RF_Z.Ram[i]);
|
77 |
|
|
end
|
78 |
|
|
$fclose(VP_REG_LOG);
|
79 |
|
|
$stop;
|
80 |
|
|
$finish;
|
81 |
|
|
end
|
82 |
|
|
//`ifdef 0
|
83 |
|
|
if (`VP_TOP.EXE.II0.rIssueNow && `VP_TOP.EXE.II0.oIssueBcast[`ISSUE_RSID_RNG] != 0)
|
84 |
|
|
begin
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
//Issue state dump
|
88 |
|
|
$fwrite(VP_LOG,"\n%dns VP[%d] IP %d ISSUE ",$time,`VP_TOP.iVPID-1,`VP_TOP.EXE.II0.oIP0-1);
|
89 |
|
|
|
90 |
|
|
//Issue instruction undecoded
|
91 |
|
|
$fwrite(VP_LOG," (%h) \t",`VP_TOP.EXE.II0.iInstruction0);
|
92 |
|
|
|
93 |
|
|
if (`VP_TOP.EXE.II0.iInstruction0[`INST_BRANCH_BIT])
|
94 |
|
|
$fwrite(VP_LOG," BRANCH ");
|
95 |
|
|
|
96 |
|
|
case ( `VP_TOP.EXE.II0.oIssueBcast[`ISSUE_RSID_RNG] )
|
97 |
|
|
`RS_ADD0: $fwrite(VP_LOG," ADD_0 ");
|
98 |
|
|
`RS_ADD1: $fwrite(VP_LOG," ADD_1 ");
|
99 |
|
|
`RS_DIV: $fwrite(VP_LOG," DIV ");
|
100 |
|
|
`RS_MUL: $fwrite(VP_LOG," MUL ");
|
101 |
|
|
`RS_SQRT: $fwrite(VP_LOG," SQRT ");
|
102 |
|
|
`RS_LOGIC:
|
103 |
|
|
begin
|
104 |
|
|
$fwrite(VP_LOG," LOGIC( ");
|
105 |
|
|
case (`VP_TOP.EXE.II0.oIssueBcast[`ISSUE_SCALE_RNG])
|
106 |
|
|
0: $fwrite(VP_LOG,"AND");
|
107 |
|
|
1: $fwrite(VP_LOG,"OR");
|
108 |
|
|
2: $fwrite(VP_LOG,"NOT");
|
109 |
|
|
3: $fwrite(VP_LOG,"SHL");
|
110 |
|
|
4: $fwrite(VP_LOG,"SHR");
|
111 |
|
|
default:
|
112 |
|
|
$fwrite(VP_LOG,"UNKNOWN");
|
113 |
|
|
endcase
|
114 |
|
|
$fwrite(VP_LOG,") ");
|
115 |
|
|
end
|
116 |
|
|
`RS_IO:$fwrite(VP_LOG," IO ");
|
117 |
|
|
default:
|
118 |
|
|
$fwrite(VP_LOG," %b ",`VP_TOP.EXE.II0.oIssueBcast[`ISSUE_RSID_RNG]);
|
119 |
|
|
endcase
|
120 |
|
|
|
121 |
|
|
if ( `VP_TOP.EXE.II0.iInstruction0[`INST_IMM] == 0)
|
122 |
|
|
begin
|
123 |
|
|
if (`VP_TOP.EXE.II0.iInstruction0[`INST_DEST_ZERO])
|
124 |
|
|
$fwrite(VP_LOG, "R[%d + %d]", `VP_TOP.EXE.II0.iInstruction0[`INST_DST_RNG],`VP_TOP.EXE.II0.iFrameOffset);
|
125 |
|
|
else
|
126 |
|
|
$fwrite(VP_LOG, "R[%d]", `VP_TOP.EXE.II0.iInstruction0[`INST_DST_RNG]);
|
127 |
|
|
end
|
128 |
|
|
else
|
129 |
|
|
begin
|
130 |
|
|
|
131 |
|
|
case (`VP_TOP.EXE.II0.iInstruction0[`INST_ADDRMODE_RNG])
|
132 |
|
|
3'b000: $fwrite(VP_LOG,"R[%d]",`VP_TOP.EXE.II0.iInstruction0[`INST_DST_RNG]);
|
133 |
|
|
3'b001: $fwrite(VP_LOG,"R[%d + %d]",`VP_TOP.EXE.II0.iInstruction0[`INST_DST_RNG],`VP_TOP.EXE.II0.iFrameOffset);
|
134 |
|
|
3'b010: $fwrite(VP_LOG,"R[%d + %d]",`VP_TOP.EXE.II0.iInstruction0[`INST_DST_RNG],`VP_TOP.EXE.II0.iFrameOffset);
|
135 |
|
|
3'b011: $fwrite(VP_LOG,"R[%d + %d + %d]",`VP_TOP.EXE.II0.iInstruction0[`INST_DST_RNG],`VP_TOP.EXE.II0.iFrameOffset,`VP_TOP.EXE.II0.wSource1_Temp[`X_RNG]);
|
136 |
|
|
3'b100: $fwrite(VP_LOG,"R[%d]",`VP_TOP.EXE.II0.iInstruction0[`INST_DST_RNG]);
|
137 |
|
|
3'b101: $fwrite(VP_LOG,"R[%d + %d]",`VP_TOP.EXE.II0.iInstruction0[`INST_DST_RNG],`VP_TOP.EXE.II0.iFrameOffset);
|
138 |
|
|
3'b110: $fwrite(VP_LOG,"R[%d + %d]",`VP_TOP.EXE.II0.iInstruction0[`INST_DST_RNG],`VP_TOP.EXE.II0.iFrameOffset);
|
139 |
|
|
3'b111: $fwrite(VP_LOG,"R[%d + %d]",`VP_TOP.EXE.II0.iInstruction0[`INST_DST_RNG],`VP_TOP.EXE.II0.iFrameOffset);
|
140 |
|
|
endcase
|
141 |
|
|
end
|
142 |
|
|
|
143 |
|
|
case ( `VP_TOP.EXE.II0.oIssueBcast[`ISSUE_WE_RNG] )
|
144 |
|
|
3'b000: $fwrite(VP_LOG,".nowrite ");
|
145 |
|
|
3'b001: $fwrite(VP_LOG,".z ");
|
146 |
|
|
3'b010: $fwrite(VP_LOG,".y ");
|
147 |
|
|
3'b100: $fwrite(VP_LOG,".x ");
|
148 |
|
|
3'b111: $fwrite(VP_LOG,".xyz ");
|
149 |
|
|
default:
|
150 |
|
|
$fwrite(VP_LOG," %b ",`VP_TOP.EXE.II0.oIssueBcast[`ISSUE_WE_RNG]);
|
151 |
|
|
endcase
|
152 |
|
|
|
153 |
|
|
if (`VP_TOP.EXE.II0.iInstruction0[`INST_IMM])
|
154 |
|
|
/*if (`VP_TOP.EXE.II0.iInstruction0[`INST_SRC0_DISPLACED] && `VP_TOP.EXE.II0.iInstruction0[`INST_SRC1_DISPLACED])
|
155 |
|
|
$fwrite(VP_LOG, "R[%d] 0 ",`VP_TOP.EXE.II0.oSourceAddress0);
|
156 |
|
|
else
|
157 |
|
|
$fwrite(VP_LOG, "I(%h)",`VP_TOP.EXE.II0.iInstruction0[`INST_IMM_RNG]);*/
|
158 |
|
|
case (`VP_TOP.EXE.II0.iInstruction0[`INST_ADDRMODE_RNG])
|
159 |
|
|
3'b000: $fwrite(VP_LOG,"I(%h) R[%d]",`VP_TOP.EXE.II0.iInstruction0[`INST_IMM_RNG], `VP_TOP.EXE.II0.iInstruction0[`INST_DST_RNG]);
|
160 |
|
|
3'b001: $fwrite(VP_LOG,"**!!I(%h) R[%d + %d] ",`VP_TOP.EXE.II0.iInstruction0[`INST_IMM_RNG],`VP_TOP.EXE.II0.iInstruction0[`INST_DST_RNG],`VP_TOP.EXE.II0.iFrameOffset);
|
161 |
|
|
3'b010: $fwrite(VP_LOG,"R[%d+%d] R[%d+%d+%d]",`VP_TOP.EXE.II0.oSourceAddress1,`VP_TOP.EXE.II0.iFrameOffset,`VP_TOP.EXE.II0.oSourceAddress0,`VP_TOP.EXE.II0.iFrameOffset,`VP_TOP.EXE.II0.iIndexRegister);
|
162 |
|
|
3'b011: $fwrite(VP_LOG,"0 R[%d + %d]",`VP_TOP.EXE.II0.oSourceAddress0,`VP_TOP.EXE.II0.iFrameOffset);
|
163 |
|
|
3'b100: $fwrite(VP_LOG,"I(%h) 0",`VP_TOP.EXE.II0.iInstruction0[`INST_IMM_RNG]);
|
164 |
|
|
3'b101: $fwrite(VP_LOG,"I(%h) 0",`VP_TOP.EXE.II0.iInstruction0[`INST_IMM_RNG]);
|
165 |
|
|
3'b110: $fwrite(VP_LOG,"R[%d + %d + %d] 0", `VP_TOP.EXE.II0.oSourceAddress1,`VP_TOP.EXE.II0.iFrameOffset,`VP_TOP.EXE.II0.iIndexRegister);
|
166 |
|
|
3'b111: $fwrite(VP_LOG,"R[%d + %d + %d] R[%d + %d]",`VP_TOP.EXE.II0.iInstruction0[`INST_SCR1_ADDR_RNG],`VP_TOP.EXE.II0.iFrameOffset,`VP_TOP.EXE.II0.iIndexRegister,`VP_TOP.EXE.II0.oSourceAddress0,`VP_TOP.EXE.II0.iFrameOffset);
|
167 |
|
|
endcase
|
168 |
|
|
else
|
169 |
|
|
begin
|
170 |
|
|
if (`VP_TOP.EXE.II0.iInstruction0[`INST_SRC1_DISPLACED] == 0)
|
171 |
|
|
$fwrite(VP_LOG, "R[%d] ",`VP_TOP.EXE.II0.oSourceAddress1);
|
172 |
|
|
else
|
173 |
|
|
$fwrite(VP_LOG, "R[%d + %d] ", `VP_TOP.EXE.II0.iInstruction0[`INST_SCR1_ADDR_RNG],`VP_TOP.EXE.II0.iFrameOffset);
|
174 |
|
|
|
175 |
|
|
if (`VP_TOP.EXE.II0.iInstruction0[`INST_SRC0_DISPLACED] == 0)
|
176 |
|
|
$fwrite(VP_LOG, "R[%d] ",`VP_TOP.EXE.II0.oSourceAddress0);
|
177 |
|
|
else
|
178 |
|
|
$fwrite(VP_LOG, "R[%d + %d] ", `VP_TOP.EXE.II0.iInstruction0[`INST_SRC0_ADDR_RNG],`VP_TOP.EXE.II0.iFrameOffset);
|
179 |
|
|
end
|
180 |
|
|
|
181 |
|
|
$fwrite(VP_LOG,"\t\t\t\t");
|
182 |
|
|
case ( `VP_TOP.EXE.II0.oIssueBcast[`ISSUE_SRC1RS_RNG] )
|
183 |
|
|
`RS_ADD0: $fwrite(VP_LOG," ADD_0 ");
|
184 |
|
|
`RS_ADD1: $fwrite(VP_LOG," ADD_1 ");
|
185 |
|
|
`RS_DIV: $fwrite(VP_LOG," DIV ");
|
186 |
|
|
`RS_MUL: $fwrite(VP_LOG," MUL ");
|
187 |
|
|
`RS_SQRT: $fwrite(VP_LOG," SQRT ");
|
188 |
|
|
`RS_IO: $fwrite(VP_LOG," IO ");
|
189 |
|
|
default:
|
190 |
|
|
$fwrite(VP_LOG," %b ",`VP_TOP.EXE.II0.oIssueBcast[`ISSUE_SRC1RS_RNG]);
|
191 |
|
|
endcase
|
192 |
|
|
$fwrite(VP_LOG," | ");
|
193 |
|
|
|
194 |
|
|
case ( `VP_TOP.EXE.II0.oIssueBcast[`ISSUE_SRC0RS_RNG] )
|
195 |
|
|
`RS_ADD0: $fwrite(VP_LOG," ADD_0 ");
|
196 |
|
|
`RS_ADD1: $fwrite(VP_LOG," ADD_1 ");
|
197 |
|
|
`RS_DIV: $fwrite(VP_LOG," DIV ");
|
198 |
|
|
`RS_MUL: $fwrite(VP_LOG," MUL ");
|
199 |
|
|
`RS_SQRT: $fwrite(VP_LOG," SQRT ");
|
200 |
|
|
`RS_IO: $fwrite(VP_LOG," IO ");
|
201 |
|
|
default:
|
202 |
|
|
$fwrite(VP_LOG," %b ",`VP_TOP.EXE.II0.oIssueBcast[`ISSUE_SRC0RS_RNG]);
|
203 |
|
|
endcase
|
204 |
|
|
$fwrite(VP_LOG," | ");
|
205 |
|
|
|
206 |
|
|
$fwrite(VP_LOG," %h.%b | %h.%b s(%b)| -> ",
|
207 |
|
|
`VP_TOP.EXE.II0.oIssueBcast[`ISSUE_SRC1_DATA_RNG],
|
208 |
|
|
`VP_TOP.EXE.II0.oIssueBcast[`ISSUE_SWZZ1_RNG],
|
209 |
|
|
`VP_TOP.EXE.II0.oIssueBcast[`ISSUE_SRC0_DATA_RNG],
|
210 |
|
|
`VP_TOP.EXE.II0.oIssueBcast[`ISSUE_SWZZ0_RNG],
|
211 |
|
|
`VP_TOP.EXE.II0.oIssueBcast[`ISSUE_SCALE_RNG]);
|
212 |
|
|
|
213 |
|
|
$fwrite(VP_LOG," %h | %h",
|
214 |
|
|
`VP_TOP.EXE.wModIssue[`MOD_ISSUE_SRC1_DATA_RNG],
|
215 |
|
|
`VP_TOP.EXE.wModIssue[`MOD_ISSUE_SRC0_DATA_RNG]
|
216 |
|
|
);
|
217 |
|
|
end
|
218 |
|
|
|
219 |
|
|
|
220 |
|
|
////////////// Same for thread 1...
|
221 |
|
|
|
222 |
|
|
|
223 |
|
|
|
224 |
|
|
|
225 |
|
|
|
226 |
|
|
|
227 |
|
|
|
228 |
|
|
|
229 |
|
|
//-----------------------------------------------------------------
|
230 |
|
|
|
231 |
|
|
|
232 |
|
|
if (`VP_TOP.EXE.II1.rIssueNow && `VP_TOP.EXE.II1.oIssueBcast[`ISSUE_RSID_RNG] != 0)
|
233 |
|
|
begin
|
234 |
|
|
|
235 |
|
|
|
236 |
|
|
//Issue state dump
|
237 |
|
|
$fwrite(VP_LOG,"\n THREAD 1 %dns IP %d ISSUE ",$time,`VP_TOP.EXE.II1.oIP0-1);
|
238 |
|
|
|
239 |
|
|
//Issue instruction undecoded
|
240 |
|
|
$fwrite(VP_LOG," (%h) \t",`VP_TOP.EXE.II1.iInstruction0);
|
241 |
|
|
|
242 |
|
|
if (`VP_TOP.EXE.II1.iInstruction0[`INST_BRANCH_BIT])
|
243 |
|
|
$fwrite(VP_LOG," BRANCH ");
|
244 |
|
|
|
245 |
|
|
case ( `VP_TOP.EXE.II1.oIssueBcast[`ISSUE_RSID_RNG] )
|
246 |
|
|
`RS_ADD0: $fwrite(VP_LOG," ADD_0 ");
|
247 |
|
|
`RS_ADD1: $fwrite(VP_LOG," ADD_1 ");
|
248 |
|
|
`RS_DIV: $fwrite(VP_LOG," DIV ");
|
249 |
|
|
`RS_MUL: $fwrite(VP_LOG," MUL ");
|
250 |
|
|
`RS_SQRT: $fwrite(VP_LOG," SQRT ");
|
251 |
|
|
default:
|
252 |
|
|
$fwrite(VP_LOG," %b ",`VP_TOP.EXE.II1.oIssueBcast[`ISSUE_RSID_RNG]);
|
253 |
|
|
endcase
|
254 |
|
|
|
255 |
|
|
if ( `VP_TOP.EXE.II1.iInstruction0[`INST_IMM] == 0)
|
256 |
|
|
begin
|
257 |
|
|
if (`VP_TOP.EXE.II1.iInstruction0[`INST_DEST_ZERO])
|
258 |
|
|
$fwrite(VP_LOG, "R[%d + %d]", `VP_TOP.EXE.II1.iInstruction0[`INST_DST_RNG],`VP_TOP.EXE.II1.iFrameOffset);
|
259 |
|
|
else
|
260 |
|
|
$fwrite(VP_LOG, "R[%d]", `VP_TOP.EXE.II1.iInstruction0[`INST_DST_RNG]);
|
261 |
|
|
end
|
262 |
|
|
else
|
263 |
|
|
begin
|
264 |
|
|
|
265 |
|
|
case (`VP_TOP.EXE.II1.iInstruction0[`INST_ADDRMODE_RNG])
|
266 |
|
|
3'b000: $fwrite(VP_LOG,"R[%d]",`VP_TOP.EXE.II1.iInstruction0[`INST_DST_RNG]);
|
267 |
|
|
3'b001: $fwrite(VP_LOG,"R[%d + %d]",`VP_TOP.EXE.II1.iInstruction0[`INST_DST_RNG],`VP_TOP.EXE.II1.iFrameOffset);
|
268 |
|
|
3'b010: $fwrite(VP_LOG,"R[%d + %d]",`VP_TOP.EXE.II1.iInstruction0[`INST_DST_RNG],`VP_TOP.EXE.II1.iFrameOffset);
|
269 |
|
|
3'b011: $fwrite(VP_LOG,"R[%d + %d + %d]",`VP_TOP.EXE.II1.iInstruction0[`INST_DST_RNG],`VP_TOP.EXE.II1.iFrameOffset,`VP_TOP.EXE.II1.wSource1_Temp[`X_RNG]);
|
270 |
|
|
3'b100: $fwrite(VP_LOG,"R[%d]",`VP_TOP.EXE.II1.iInstruction0[`INST_DST_RNG]);
|
271 |
|
|
3'b101: $fwrite(VP_LOG,"R[%d + %d]",`VP_TOP.EXE.II1.iInstruction0[`INST_DST_RNG],`VP_TOP.EXE.II1.iFrameOffset);
|
272 |
|
|
3'b110: $fwrite(VP_LOG,"R[%d + %d]",`VP_TOP.EXE.II1.iInstruction0[`INST_DST_RNG],`VP_TOP.EXE.II1.iFrameOffset);
|
273 |
|
|
3'b111: $fwrite(VP_LOG,"R[%d + %d]",`VP_TOP.EXE.II1.iInstruction0[`INST_DST_RNG],`VP_TOP.EXE.II1.iFrameOffset);
|
274 |
|
|
endcase
|
275 |
|
|
end
|
276 |
|
|
|
277 |
|
|
case ( `VP_TOP.EXE.II1.oIssueBcast[`ISSUE_WE_RNG] )
|
278 |
|
|
3'b000: $fwrite(VP_LOG,".nowrite ");
|
279 |
|
|
3'b001: $fwrite(VP_LOG,".z ");
|
280 |
|
|
3'b010: $fwrite(VP_LOG,".y ");
|
281 |
|
|
3'b100: $fwrite(VP_LOG,".x ");
|
282 |
|
|
3'b111: $fwrite(VP_LOG,".xyz ");
|
283 |
|
|
default:
|
284 |
|
|
$fwrite(VP_LOG," %b ",`VP_TOP.EXE.II1.oIssueBcast[`ISSUE_WE_RNG]);
|
285 |
|
|
endcase
|
286 |
|
|
|
287 |
|
|
if (`VP_TOP.EXE.II1.iInstruction0[`INST_IMM])
|
288 |
|
|
/*if (`VP_TOP.EXE.II1.iInstruction0[`INST_SRC0_DISPLACED] && `VP_TOP.EXE.II1.iInstruction0[`INST_SRC1_DISPLACED])
|
289 |
|
|
$fwrite(VP_LOG, "R[%d] 0 ",`VP_TOP.EXE.II1.oSourceAddress0);
|
290 |
|
|
else
|
291 |
|
|
$fwrite(VP_LOG, "I(%h)",`VP_TOP.EXE.II1.iInstruction0[`INST_IMM_RNG]);*/
|
292 |
|
|
case (`VP_TOP.EXE.II1.iInstruction0[`INST_ADDRMODE_RNG])
|
293 |
|
|
3'b000: $fwrite(VP_LOG,"I(%h) R[%d]",`VP_TOP.EXE.II1.iInstruction0[`INST_IMM_RNG], `VP_TOP.EXE.II1.iInstruction0[`INST_DST_RNG]);
|
294 |
|
|
3'b001: $fwrite(VP_LOG,"I(%h) R[%d + %d]",`VP_TOP.EXE.II1.iInstruction0[`INST_DST_RNG],`VP_TOP.EXE.II1.oSourceAddress0,`VP_TOP.EXE.II1.iFrameOffset);
|
295 |
|
|
3'b010: $fwrite(VP_LOG,"R[%d+%d] R[%d+%d+%d]",`VP_TOP.EXE.II1.oSourceAddress1,`VP_TOP.EXE.II1.iFrameOffset,`VP_TOP.EXE.II1.oSourceAddress0,`VP_TOP.EXE.II1.iFrameOffset,`VP_TOP.EXE.II1.iIndexRegister);
|
296 |
|
|
3'b011: $fwrite(VP_LOG,"0 R[%d + %d]",`VP_TOP.EXE.II1.oSourceAddress0,`VP_TOP.EXE.II1.iFrameOffset);
|
297 |
|
|
3'b100: $fwrite(VP_LOG,"I(%h) 0",`VP_TOP.EXE.II1.iInstruction0[`INST_IMM_RNG]);
|
298 |
|
|
3'b101: $fwrite(VP_LOG,"I(%h) 0",`VP_TOP.EXE.II1.iInstruction0[`INST_IMM_RNG]);
|
299 |
|
|
3'b110: $fwrite(VP_LOG,"R[%d + %d + %d] 0", `VP_TOP.EXE.II1.oSourceAddress1,`VP_TOP.EXE.II1.iFrameOffset,`VP_TOP.EXE.II1.iIndexRegister);
|
300 |
|
|
3'b111: $fwrite(VP_LOG,"R[%d + %d + %d] R[%d + %d]",`VP_TOP.EXE.II1.iInstruction0[`INST_SCR1_ADDR_RNG],`VP_TOP.EXE.II1.iFrameOffset,`VP_TOP.EXE.II1.iIndexRegister,`VP_TOP.EXE.II1.oSourceAddress0,`VP_TOP.EXE.II1.iFrameOffset);
|
301 |
|
|
endcase
|
302 |
|
|
else
|
303 |
|
|
begin
|
304 |
|
|
if (`VP_TOP.EXE.II1.iInstruction0[`INST_SRC1_DISPLACED] == 0)
|
305 |
|
|
$fwrite(VP_LOG, "R[%d] ",`VP_TOP.EXE.II1.oSourceAddress1);
|
306 |
|
|
else
|
307 |
|
|
$fwrite(VP_LOG, "R[%d + %d] ", `VP_TOP.EXE.II1.iInstruction0[`INST_SCR1_ADDR_RNG],`VP_TOP.EXE.II1.iFrameOffset);
|
308 |
|
|
|
309 |
|
|
if (`VP_TOP.EXE.II1.iInstruction0[`INST_SRC0_DISPLACED] == 0)
|
310 |
|
|
$fwrite(VP_LOG, "R[%d] ",`VP_TOP.EXE.II1.oSourceAddress0);
|
311 |
|
|
else
|
312 |
|
|
$fwrite(VP_LOG, "R[%d + %d] ", `VP_TOP.EXE.II1.iInstruction0[`INST_SRC0_ADDR_RNG],`VP_TOP.EXE.II1.iFrameOffset);
|
313 |
|
|
end
|
314 |
|
|
|
315 |
|
|
$fwrite(VP_LOG,"\t\t\t\t");
|
316 |
|
|
case ( `VP_TOP.EXE.II1.oIssueBcast[`ISSUE_SRC1RS_RNG] )
|
317 |
|
|
`RS_ADD0: $fwrite(VP_LOG," ADD_0 ");
|
318 |
|
|
`RS_ADD1: $fwrite(VP_LOG," ADD_1 ");
|
319 |
|
|
`RS_DIV: $fwrite(VP_LOG," DIV ");
|
320 |
|
|
`RS_MUL: $fwrite(VP_LOG," MUL ");
|
321 |
|
|
`RS_SQRT: $fwrite(VP_LOG," SQRT ");
|
322 |
|
|
`RS_IO: $fwrite(VP_LOG," IO ");
|
323 |
|
|
default:
|
324 |
|
|
$fwrite(VP_LOG," %b ",`VP_TOP.EXE.II1.oIssueBcast[`ISSUE_SRC1RS_RNG]);
|
325 |
|
|
endcase
|
326 |
|
|
$fwrite(VP_LOG," | ");
|
327 |
|
|
|
328 |
|
|
case ( `VP_TOP.EXE.II1.oIssueBcast[`ISSUE_SRC0RS_RNG] )
|
329 |
|
|
`RS_ADD0: $fwrite(VP_LOG," ADD_0 ");
|
330 |
|
|
`RS_ADD1: $fwrite(VP_LOG," ADD_1 ");
|
331 |
|
|
`RS_DIV: $fwrite(VP_LOG," DIV ");
|
332 |
|
|
`RS_MUL: $fwrite(VP_LOG," MUL ");
|
333 |
|
|
`RS_SQRT: $fwrite(VP_LOG," SQRT ");
|
334 |
|
|
`RS_IO: $fwrite(VP_LOG," IO ");
|
335 |
|
|
default:
|
336 |
|
|
$fwrite(VP_LOG," %b ",`VP_TOP.EXE.II1.oIssueBcast[`ISSUE_SRC0RS_RNG]);
|
337 |
|
|
endcase
|
338 |
|
|
$fwrite(VP_LOG," | ");
|
339 |
|
|
|
340 |
|
|
$fwrite(VP_LOG," %h | %h",
|
341 |
|
|
`VP_TOP.EXE.wModIssue[`MOD_ISSUE_SRC1_DATA_RNG],
|
342 |
|
|
`VP_TOP.EXE.wModIssue[`MOD_ISSUE_SRC0_DATA_RNG]
|
343 |
|
|
);
|
344 |
|
|
end
|
345 |
|
|
|
346 |
|
|
|
347 |
|
|
|
348 |
|
|
|
349 |
|
|
|
350 |
|
|
|
351 |
|
|
////////////////////////// DUMP EXE UNITS!
|
352 |
|
|
|
353 |
|
|
if (`VP_TOP.EXE.II0.wCommitFromPendingStation)
|
354 |
|
|
begin
|
355 |
|
|
if ( `VP_TOP.EXE.II0.wBranchTaken)
|
356 |
|
|
$fwrite(VP_LOG,"\nTHREAD 0: BRANCH TAKEN ");
|
357 |
|
|
|
358 |
|
|
end
|
359 |
|
|
|
360 |
|
|
if (`VP_TOP.EXE.II1.wCommitFromPendingStation)
|
361 |
|
|
begin
|
362 |
|
|
if ( `VP_TOP.EXE.II1.wBranchTaken)
|
363 |
|
|
|
364 |
|
|
$fwrite(VP_LOG,"\nTHREAD 1: BRANCH TAKEN ");
|
365 |
|
|
|
366 |
|
|
end
|
367 |
|
|
//-----------------------------------------------------------------
|
368 |
|
|
if (`VP_TOP.EXE.LOGIC_STA.RS.iCommitGranted)
|
369 |
|
|
begin
|
370 |
|
|
$fwrite(VP_LOG,"\n%dns VP[%d]\t COMMIT LOGIC( ",$time,`VP_TOP.iVPID-1);
|
371 |
|
|
|
372 |
|
|
case (`VP_TOP.EXE.LOGIC_STA.wResultSelector)
|
373 |
|
|
0: $fwrite(VP_LOG,"AND");
|
374 |
|
|
1: $fwrite(VP_LOG,"OR");
|
375 |
|
|
2: $fwrite(VP_LOG,"NOT");
|
376 |
|
|
3: $fwrite(VP_LOG,"SHL");
|
377 |
|
|
4: $fwrite(VP_LOG,"SHR");
|
378 |
|
|
default:
|
379 |
|
|
$fwrite(VP_LOG,"UNKNOWN");
|
380 |
|
|
endcase
|
381 |
|
|
$fwrite(VP_LOG,") ");
|
382 |
|
|
$fwrite(VP_LOG," R[%d]",`VP_TOP.EXE.LOGIC_STA.oCommitData[`COMMIT_DST_RNG]);
|
383 |
|
|
|
384 |
|
|
case ( `VP_TOP.EXE.LOGIC_STA.oCommitData[`COMMIT_WE_RNG] )
|
385 |
|
|
3'b000: $fwrite(VP_LOG,".nowrite ");
|
386 |
|
|
3'b001: $fwrite(VP_LOG,".z ");
|
387 |
|
|
3'b010: $fwrite(VP_LOG,".y ");
|
388 |
|
|
3'b100: $fwrite(VP_LOG,".x ");
|
389 |
|
|
3'b111: $fwrite(VP_LOG,".xyz ");
|
390 |
|
|
default:
|
391 |
|
|
$fwrite(VP_LOG," %b ",`VP_TOP.EXE.LOGIC_STA.oCommitData[`COMMIT_WE_RNG]);
|
392 |
|
|
endcase
|
393 |
|
|
$fwrite(VP_LOG," %h %h %h\n",`VP_TOP.EXE.LOGIC_STA.oCommitData[`COMMIT_X_RNG],`VP_TOP.EXE.LOGIC_STA.oCommitData[`COMMIT_Y_RNG],`VP_TOP.EXE.LOGIC_STA.oCommitData[`COMMIT_Z_RNG]);
|
394 |
|
|
end
|
395 |
|
|
//-----------------------------------------------------------------
|
396 |
|
|
if (`VP_TOP.EXE.ADD_STA0.RS.iCommitGranted)
|
397 |
|
|
begin
|
398 |
|
|
$fwrite(VP_LOG,"\n%dns\t VP[%d] COMMIT ADD_0 R[%d]",$time,`VP_TOP.iVPID-1,`VP_TOP.EXE.ADD_STA0.oCommitData[`COMMIT_DST_RNG]);
|
399 |
|
|
|
400 |
|
|
case ( `VP_TOP.EXE.ADD_STA0.oCommitData[`COMMIT_WE_RNG] )
|
401 |
|
|
3'b000: $fwrite(VP_LOG,".nowrite ");
|
402 |
|
|
3'b001: $fwrite(VP_LOG,".z ");
|
403 |
|
|
3'b010: $fwrite(VP_LOG,".y ");
|
404 |
|
|
3'b100: $fwrite(VP_LOG,".x ");
|
405 |
|
|
3'b111: $fwrite(VP_LOG,".xyz ");
|
406 |
|
|
default:
|
407 |
|
|
$fwrite(VP_LOG," %b ",`VP_TOP.EXE.ADD_STA0.oCommitData[`COMMIT_WE_RNG]);
|
408 |
|
|
endcase
|
409 |
|
|
$fwrite(VP_LOG," %h %h %h\n",`VP_TOP.EXE.ADD_STA0.oCommitData[`COMMIT_X_RNG],`VP_TOP.EXE.ADD_STA0.oCommitData[`COMMIT_Y_RNG],`VP_TOP.EXE.ADD_STA0.oCommitData[`COMMIT_Z_RNG]);
|
410 |
|
|
end
|
411 |
|
|
//-----------------------------------------------------------------
|
412 |
|
|
if (`VP_TOP.EXE.ADD_STA1.RS.iCommitGranted)
|
413 |
|
|
begin
|
414 |
|
|
$fwrite(VP_LOG,"\n%dns\t VP[%d] COMMIT ADD_1 R[%d]",$time,`VP_TOP.iVPID-1,`VP_TOP.EXE.ADD_STA1.oCommitData[`COMMIT_DST_RNG]);
|
415 |
|
|
|
416 |
|
|
case ( `VP_TOP.EXE.ADD_STA1.oCommitData[`COMMIT_WE_RNG] )
|
417 |
|
|
3'b000: $fwrite(VP_LOG,".nowrite ");
|
418 |
|
|
3'b001: $fwrite(VP_LOG,".z ");
|
419 |
|
|
3'b010: $fwrite(VP_LOG,".y ");
|
420 |
|
|
3'b100: $fwrite(VP_LOG,".x ");
|
421 |
|
|
3'b111: $fwrite(VP_LOG,".xyz ");
|
422 |
|
|
default:
|
423 |
|
|
$fwrite(VP_LOG," %b ",`VP_TOP.EXE.ADD_STA1.oCommitData[`COMMIT_WE_RNG]);
|
424 |
|
|
endcase
|
425 |
|
|
$fwrite(VP_LOG," %h %h %h\n",`VP_TOP.EXE.ADD_STA1.oCommitData[`COMMIT_X_RNG],`VP_TOP.EXE.ADD_STA1.oCommitData[`COMMIT_Y_RNG],`VP_TOP.EXE.ADD_STA1.oCommitData[`COMMIT_Z_RNG]);
|
426 |
|
|
end
|
427 |
|
|
//-----------------------------------------------------------------
|
428 |
|
|
if (`VP_TOP.EXE.DIV_STA.RS.iCommitGranted)
|
429 |
|
|
begin
|
430 |
|
|
$fwrite(VP_LOG,"\n%dns\t VP[%d] COMMIT DIV R[%d]",$time,`VP_TOP.iVPID-1,`VP_TOP.EXE.DIV_STA.oCommitData[`COMMIT_DST_RNG]);
|
431 |
|
|
|
432 |
|
|
case ( `VP_TOP.EXE.DIV_STA.oCommitData[`COMMIT_WE_RNG] )
|
433 |
|
|
3'b000: $fwrite(VP_LOG,".nowrite ");
|
434 |
|
|
3'b001: $fwrite(VP_LOG,".z ");
|
435 |
|
|
3'b010: $fwrite(VP_LOG,".y ");
|
436 |
|
|
3'b100: $fwrite(VP_LOG,".x ");
|
437 |
|
|
3'b111: $fwrite(VP_LOG,".xyz ");
|
438 |
|
|
default:
|
439 |
|
|
$fwrite(VP_LOG," %b ",`VP_TOP.EXE.DIV_STA.oCommitData[`COMMIT_WE_RNG]);
|
440 |
|
|
endcase
|
441 |
|
|
$fwrite(VP_LOG," %h %h %h\n",`VP_TOP.EXE.DIV_STA.oCommitData[`COMMIT_X_RNG],`VP_TOP.EXE.DIV_STA.oCommitData[`COMMIT_Y_RNG],`VP_TOP.EXE.DIV_STA.oCommitData[`COMMIT_Z_RNG]);
|
442 |
|
|
end
|
443 |
|
|
//-----------------------------------------------------------------
|
444 |
|
|
if (`VP_TOP.EXE.MUL_STA.RS.iCommitGranted)
|
445 |
|
|
begin
|
446 |
|
|
$fwrite(VP_LOG,"\n%dns\t VP[%d] COMMIT MUL R[%d]",$time,`VP_TOP.iVPID-1, `VP_TOP.EXE.MUL_STA.oCommitData[`COMMIT_DST_RNG]);
|
447 |
|
|
|
448 |
|
|
case ( `VP_TOP.EXE.MUL_STA.oCommitData[`COMMIT_WE_RNG] )
|
449 |
|
|
3'b000: $fwrite(VP_LOG,".nowrite ");
|
450 |
|
|
3'b001: $fwrite(VP_LOG,".z ");
|
451 |
|
|
3'b010: $fwrite(VP_LOG,".y ");
|
452 |
|
|
3'b100: $fwrite(VP_LOG,".x ");
|
453 |
|
|
3'b111: $fwrite(VP_LOG,".xyz ");
|
454 |
|
|
default:
|
455 |
|
|
$fwrite(VP_LOG," %b ",`VP_TOP.EXE.MUL_STA.oCommitData[`COMMIT_WE_RNG]);
|
456 |
|
|
endcase
|
457 |
|
|
$fwrite(VP_LOG," %h %h %h\n",`VP_TOP.EXE.MUL_STA.oCommitData[`COMMIT_X_RNG],`VP_TOP.EXE.MUL_STA.oCommitData[`COMMIT_Y_RNG],`VP_TOP.EXE.MUL_STA.oCommitData[`COMMIT_Z_RNG]);
|
458 |
|
|
end
|
459 |
|
|
//-----------------------------------------------------------------
|
460 |
|
|
if (`VP_TOP.EXE.SQRT_STA.RS.iCommitGranted)
|
461 |
|
|
begin
|
462 |
|
|
$fwrite(VP_LOG,"\n%dns\t VP[%d] COMMIT SQRT R[%d]",$time,`VP_TOP.iVPID-1,`VP_TOP.EXE.SQRT_STA.oCommitData[`COMMIT_DST_RNG]);
|
463 |
|
|
|
464 |
|
|
case ( `VP_TOP.EXE.SQRT_STA.oCommitData[`COMMIT_WE_RNG] )
|
465 |
|
|
3'b000: $fwrite(VP_LOG,".nowrite ");
|
466 |
|
|
3'b001: $fwrite(VP_LOG,".z ");
|
467 |
|
|
3'b010: $fwrite(VP_LOG,".y ");
|
468 |
|
|
3'b100: $fwrite(VP_LOG,".x ");
|
469 |
|
|
3'b111: $fwrite(VP_LOG,".xyz ");
|
470 |
|
|
default:
|
471 |
|
|
$fwrite(VP_LOG," %b ",`VP_TOP.EXE.SQRT_STA.oCommitData[`COMMIT_WE_RNG]);
|
472 |
|
|
endcase
|
473 |
|
|
$fwrite(VP_LOG," %h %h %h \n",`VP_TOP.EXE.SQRT_STA.oCommitData[`COMMIT_X_RNG],`VP_TOP.EXE.SQRT_STA.oCommitData[`COMMIT_Y_RNG], `VP_TOP.EXE.SQRT_STA.oCommitData[`COMMIT_Z_RNG]);
|
474 |
|
|
end
|
475 |
|
|
//-----------------------------------------------------------------
|
476 |
|
|
|
477 |
|
|
end //always
|
478 |
|
|
|
479 |
|
|
|
480 |
|
|
endmodule
|