1 |
209 |
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 |
|
|
|
23 |
|
|
|
24 |
|
|
module Dumper;
|
25 |
|
|
|
26 |
|
|
always @ (posedge uut.Clock)
|
27 |
|
|
begin
|
28 |
|
|
//-----------------------------------------------------------------
|
29 |
|
|
if (uut.II.iInstruction0[`INST_EOF_RNG])
|
30 |
|
|
$display("End of flow instruction detected");
|
31 |
|
|
|
32 |
|
|
if (uut.II.rIssueNow && uut.II.oIssueBcast[`ISSUE_RSID_RNG] != 0)
|
33 |
|
|
begin
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
//Issue state dump
|
37 |
|
|
$write("%dns IP %d ISSUE ",$time,uut.II.oIP0);
|
38 |
|
|
|
39 |
|
|
if (uut.II.iInstruction0[`INST_BRANCH_BIT])
|
40 |
|
|
$write(" BRANCH ");
|
41 |
|
|
|
42 |
|
|
case ( uut.II.oIssueBcast[`ISSUE_RSID_RNG] )
|
43 |
|
|
`RS_ADD0: $write(" ADD_0 ");
|
44 |
|
|
`RS_ADD1: $write(" ADD_1 ");
|
45 |
|
|
`RS_DIV: $write(" DIV ");
|
46 |
|
|
`RS_MUL: $write(" MUL ");
|
47 |
|
|
`RS_SQRT: $write(" SQRT ");
|
48 |
|
|
default:
|
49 |
|
|
$write(" %b ",uut.II.oIssueBcast[`ISSUE_RSID_RNG]);
|
50 |
|
|
endcase
|
51 |
|
|
|
52 |
|
|
if ( uut.II.iInstruction0[`INST_IMM] == 0 && uut.II.iInstruction0[`INST_DEST_ZERO])
|
53 |
|
|
$write( "R[%d + %d]", uut.II.iInstruction0[`INST_DST_RNG],uut.II.iFrameOffset);
|
54 |
|
|
else
|
55 |
|
|
$write( "R[%d]", uut.II.iInstruction0[`INST_DST_RNG]);
|
56 |
|
|
|
57 |
|
|
case ( uut.II.oIssueBcast[`ISSUE_WE_RNG] )
|
58 |
|
|
3'b000: $write(".nowrite ");
|
59 |
|
|
3'b001: $write(".z ");
|
60 |
|
|
3'b010: $write(".y ");
|
61 |
|
|
3'b100: $write(".x ");
|
62 |
|
|
3'b111: $write(".xyz ");
|
63 |
|
|
default:
|
64 |
|
|
$write(" %b ",uut.II.oIssueBcast[`ISSUE_WE_RNG]);
|
65 |
|
|
endcase
|
66 |
|
|
if (uut.II.iInstruction0[`INST_IMM])
|
67 |
|
|
$write( "I(%h)",uut.II.iInstruction0[`INST_IMM_RNG]);
|
68 |
|
|
else
|
69 |
|
|
begin
|
70 |
|
|
if (uut.II.iInstruction0[`INST_SRC1_DISPLACED] == 0)
|
71 |
|
|
$write( "R[%d] ",uut.II.oSourceAddress1);
|
72 |
|
|
else
|
73 |
|
|
$write( "R[%d + %d] ", uut.II.iInstruction0[`INST_SCR1_ADDR_RNG],uut.II.iFrameOffset);
|
74 |
|
|
|
75 |
|
|
if (uut.II.iInstruction0[`INST_SRC0_DISPLACED] == 0)
|
76 |
|
|
$write( "R[%d] ",uut.II.oSourceAddress0);
|
77 |
|
|
else
|
78 |
|
|
$write( "R[%d + %d] ", uut.II.iInstruction0[`INST_SRC0_ADDR_RNG],uut.II.iFrameOffset);
|
79 |
|
|
end
|
80 |
|
|
|
81 |
|
|
$write("\t\t\t\t");
|
82 |
|
|
case ( uut.II.oIssueBcast[`ISSUE_SRC1RS_RNG] )
|
83 |
|
|
`RS_ADD0: $write(" ADD_0 ");
|
84 |
|
|
`RS_ADD1: $write(" ADD_1 ");
|
85 |
|
|
`RS_DIV: $write(" DIV ");
|
86 |
|
|
`RS_MUL: $write(" MUL ");
|
87 |
|
|
`RS_SQRT: $write(" SQRT ");
|
88 |
|
|
default:
|
89 |
|
|
$write(" %b ",uut.II.oIssueBcast[`ISSUE_SRC1RS_RNG]);
|
90 |
|
|
endcase
|
91 |
|
|
$write(" | ");
|
92 |
|
|
|
93 |
|
|
case ( uut.II.oIssueBcast[`ISSUE_SRC0RS_RNG] )
|
94 |
|
|
`RS_ADD0: $write(" ADD_0 ");
|
95 |
|
|
`RS_ADD1: $write(" ADD_1 ");
|
96 |
|
|
`RS_DIV: $write(" DIV ");
|
97 |
|
|
`RS_MUL: $write(" MUL ");
|
98 |
|
|
`RS_SQRT: $write(" SQRT ");
|
99 |
|
|
default:
|
100 |
|
|
$write(" %b ",uut.II.oIssueBcast[`ISSUE_SRC0RS_RNG]);
|
101 |
|
|
endcase
|
102 |
|
|
$write(" | ");
|
103 |
|
|
|
104 |
|
|
$display(" %h | %h",
|
105 |
|
|
uut.wModIssue[`MOD_ISSUE_SRC1_DATA_RNG],
|
106 |
|
|
uut.wModIssue[`MOD_ISSUE_SRC0_DATA_RNG]
|
107 |
|
|
);
|
108 |
|
|
end
|
109 |
|
|
|
110 |
|
|
//-----------------------------------------------------------------
|
111 |
|
|
if (uut.ADD_STA0.RS.iCommitGranted)
|
112 |
|
|
begin
|
113 |
|
|
$write("%dns\t COMMIT ADD_0 R[%d]",$time,uut.ADD_STA0.oCommitData[`COMMIT_DST_RNG]);
|
114 |
|
|
|
115 |
|
|
case ( uut.ADD_STA0.oCommitData[`COMMIT_WE_RNG] )
|
116 |
|
|
3'b000: $write(".nowrite ");
|
117 |
|
|
3'b001: $write(".z ");
|
118 |
|
|
3'b010: $write(".y ");
|
119 |
|
|
3'b100: $write(".x ");
|
120 |
|
|
3'b111: $write(".xyz ");
|
121 |
|
|
default:
|
122 |
|
|
$write(" %b ",uut.ADD_STA0.oCommitData[`COMMIT_WE_RNG]);
|
123 |
|
|
endcase
|
124 |
|
|
$write(" %h %h %h\n",uut.ADD_STA0.oCommitData[`COMMIT_X_RNG],uut.ADD_STA0.oCommitData[`COMMIT_Y_RNG],uut.ADD_STA0.oCommitData[`COMMIT_Z_RNG]);
|
125 |
|
|
end
|
126 |
|
|
//-----------------------------------------------------------------
|
127 |
|
|
if (uut.ADD_STA1.RS.iCommitGranted)
|
128 |
|
|
begin
|
129 |
|
|
$write("%dns\t COMMIT ADD_1 R[%d]",$time,uut.ADD_STA1.oCommitData[`COMMIT_DST_RNG]);
|
130 |
|
|
|
131 |
|
|
case ( uut.ADD_STA1.oCommitData[`COMMIT_WE_RNG] )
|
132 |
|
|
3'b000: $write(".nowrite ");
|
133 |
|
|
3'b001: $write(".z ");
|
134 |
|
|
3'b010: $write(".y ");
|
135 |
|
|
3'b100: $write(".x ");
|
136 |
|
|
3'b111: $write(".xyz ");
|
137 |
|
|
default:
|
138 |
|
|
$write(" %b ",uut.ADD_STA1.oCommitData[`COMMIT_WE_RNG]);
|
139 |
|
|
endcase
|
140 |
|
|
$write(" %h %h %h\n",uut.ADD_STA1.oCommitData[`COMMIT_X_RNG],uut.ADD_STA1.oCommitData[`COMMIT_Y_RNG],uut.ADD_STA1.oCommitData[`COMMIT_Z_RNG]);
|
141 |
|
|
end
|
142 |
|
|
//-----------------------------------------------------------------
|
143 |
|
|
if (uut.DIV_STA.RS.iCommitGranted)
|
144 |
|
|
begin
|
145 |
|
|
$write("%dns\t COMMIT DIV R[%d]",$time,uut.DIV_STA.oCommitData[`COMMIT_DST_RNG]);
|
146 |
|
|
|
147 |
|
|
case ( uut.DIV_STA.oCommitData[`COMMIT_WE_RNG] )
|
148 |
|
|
3'b000: $write(".nowrite ");
|
149 |
|
|
3'b001: $write(".z ");
|
150 |
|
|
3'b010: $write(".y ");
|
151 |
|
|
3'b100: $write(".x ");
|
152 |
|
|
3'b111: $write(".xyz ");
|
153 |
|
|
default:
|
154 |
|
|
$write(" %b ",uut.DIV_STA.oCommitData[`COMMIT_WE_RNG]);
|
155 |
|
|
endcase
|
156 |
|
|
$write(" %h %h %h\n",uut.DIV_STA.oCommitData[`COMMIT_X_RNG],uut.DIV_STA.oCommitData[`COMMIT_Y_RNG],uut.DIV_STA.oCommitData[`COMMIT_Z_RNG]);
|
157 |
|
|
end
|
158 |
|
|
//-----------------------------------------------------------------
|
159 |
|
|
if (uut.MUL_STA.RS.iCommitGranted)
|
160 |
|
|
begin
|
161 |
|
|
$write("%dns\t COMMIT MUL R[%d]",$time,uut.MUL_STA.oCommitData[`COMMIT_DST_RNG]);
|
162 |
|
|
|
163 |
|
|
case ( uut.MUL_STA.oCommitData[`COMMIT_WE_RNG] )
|
164 |
|
|
3'b000: $write(".nowrite ");
|
165 |
|
|
3'b001: $write(".z ");
|
166 |
|
|
3'b010: $write(".y ");
|
167 |
|
|
3'b100: $write(".x ");
|
168 |
|
|
3'b111: $write(".xyz ");
|
169 |
|
|
default:
|
170 |
|
|
$write(" %b ",uut.MUL_STA.oCommitData[`COMMIT_WE_RNG]);
|
171 |
|
|
endcase
|
172 |
|
|
$write(" %h %h %h\n",uut.MUL_STA.oCommitData[`COMMIT_X_RNG],uut.MUL_STA.oCommitData[`COMMIT_Y_RNG],uut.MUL_STA.oCommitData[`COMMIT_Z_RNG]);
|
173 |
|
|
end
|
174 |
|
|
//-----------------------------------------------------------------
|
175 |
|
|
if (uut.SQRT_STA.RS.iCommitGranted)
|
176 |
|
|
begin
|
177 |
|
|
$write("%dns\t COMMIT SQRT R[%d]",$time,uut.SQRT_STA.oCommitData[`COMMIT_DST_RNG]);
|
178 |
|
|
|
179 |
|
|
case ( uut.SQRT_STA.oCommitData[`COMMIT_WE_RNG] )
|
180 |
|
|
3'b000: $write(".nowrite ");
|
181 |
|
|
3'b001: $write(".z ");
|
182 |
|
|
3'b010: $write(".y ");
|
183 |
|
|
3'b100: $write(".x ");
|
184 |
|
|
3'b111: $write(".xyz ");
|
185 |
|
|
default:
|
186 |
|
|
$write(" %b ",uut.SQRT_STA.oCommitData[`COMMIT_WE_RNG]);
|
187 |
|
|
endcase
|
188 |
|
|
$write(" %h \n",uut.SQRT_STA.oCommitData[`COMMIT_DATA_RNG]);
|
189 |
|
|
end
|
190 |
|
|
//-----------------------------------------------------------------
|
191 |
|
|
|
192 |
|
|
end //always
|
193 |
|
|
|
194 |
|
|
endmodule
|