1 |
2 |
alfik |
/*
|
2 |
|
|
* Copyright (c) 2014, Aleksander Osman
|
3 |
|
|
* All rights reserved.
|
4 |
|
|
*
|
5 |
|
|
* Redistribution and use in source and binary forms, with or without
|
6 |
|
|
* modification, are permitted provided that the following conditions are met:
|
7 |
|
|
*
|
8 |
|
|
* * Redistributions of source code must retain the above copyright notice, this
|
9 |
|
|
* list of conditions and the following disclaimer.
|
10 |
|
|
*
|
11 |
|
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
12 |
|
|
* this list of conditions and the following disclaimer in the documentation
|
13 |
|
|
* and/or other materials provided with the distribution.
|
14 |
|
|
*
|
15 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
16 |
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
17 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
18 |
|
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
19 |
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
20 |
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
21 |
|
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
22 |
|
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
23 |
|
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
24 |
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
25 |
|
|
*/
|
26 |
|
|
|
27 |
|
|
package ao486.test;
|
28 |
|
|
|
29 |
|
|
import java.io.File;
|
30 |
|
|
import java.io.FileOutputStream;
|
31 |
|
|
import java.util.LinkedList;
|
32 |
|
|
|
33 |
|
|
public class RunRaport {
|
34 |
|
|
static boolean compare(LinkedList<Object> log_bochs, LinkedList<Object> log_verilog, File output_directory) throws Exception {
|
35 |
|
|
|
36 |
|
|
StringBuilder bochs_build = new StringBuilder();
|
37 |
|
|
StringBuilder verilog_build = new StringBuilder();
|
38 |
|
|
|
39 |
|
|
boolean test_failed = false;
|
40 |
|
|
String header_line = "--------------------------------------------------------";
|
41 |
|
|
|
42 |
|
|
//---------------------------------------------------------------------- CMD_start_shutdown
|
43 |
|
|
bochs_build .append(header_line).append(" shutdown\n");
|
44 |
|
|
verilog_build.append(header_line).append(" shutdown\n");
|
45 |
|
|
|
46 |
|
|
StringBuilder bochs_shutdown = new StringBuilder();
|
47 |
|
|
StringBuilder verilog_shutdown = new StringBuilder();
|
48 |
|
|
|
49 |
|
|
for(Object obj : log_bochs) {
|
50 |
|
|
if(obj instanceof Runner.CMD_start_shutdown) {
|
51 |
|
|
String s = String.format("shutdown\n"); bochs_build.append(s); bochs_shutdown.append(s);
|
52 |
|
|
}
|
53 |
|
|
}
|
54 |
|
|
for(Object obj : log_verilog) {
|
55 |
|
|
if(obj instanceof Runner.CMD_start_shutdown) {
|
56 |
|
|
String s = String.format("shutdown\n"); verilog_build.append(s); verilog_shutdown.append(s);
|
57 |
|
|
}
|
58 |
|
|
}
|
59 |
|
|
if(bochs_shutdown.toString().equals(verilog_shutdown.toString()) == false) {
|
60 |
|
|
System.out.println("FAILED: shutdown");
|
61 |
|
|
test_failed = true;
|
62 |
|
|
}
|
63 |
|
|
|
64 |
|
|
//---------------------------------------------------------------------- CMD_start_completed
|
65 |
|
|
bochs_build .append(header_line).append(" completed\n");
|
66 |
|
|
verilog_build.append(header_line).append(" completed\n");
|
67 |
|
|
|
68 |
|
|
StringBuilder bochs_completed = new StringBuilder();
|
69 |
|
|
StringBuilder verilog_completed = new StringBuilder();
|
70 |
|
|
|
71 |
|
|
int i = 0;
|
72 |
|
|
for(Object obj : log_bochs) {
|
73 |
|
|
if(obj instanceof Runner.CMD_start_completed) {
|
74 |
|
|
Runner.CMD_start_completed completed = (Runner.CMD_start_completed)obj;
|
75 |
|
|
String s;
|
76 |
|
|
|
77 |
|
|
bochs_build.append(++i).append(".\n");
|
78 |
|
|
s = String.format("rep: %x\n", completed.rep); bochs_build.append(s); bochs_completed.append(s);
|
79 |
|
|
s = String.format("lock: %x\n", completed.lock); bochs_build.append(s); bochs_completed.append(s);
|
80 |
|
|
s = String.format("seg: %x\n", completed.seg); bochs_build.append(s);
|
81 |
|
|
s = String.format("as32: %x\n", completed.as32); bochs_build.append(s); bochs_completed.append(s);
|
82 |
|
|
s = String.format("os32: %x\n", completed.os32); bochs_build.append(s); bochs_completed.append(s);
|
83 |
|
|
s = String.format("cons: %x\n", completed.consumed); bochs_build.append(s); bochs_completed.append(s);
|
84 |
|
|
bochs_build.append("\n");
|
85 |
|
|
}
|
86 |
|
|
}
|
87 |
|
|
i=0;
|
88 |
|
|
for(Object obj : log_verilog) {
|
89 |
|
|
if(obj instanceof Runner.CMD_start_completed) {
|
90 |
|
|
Runner.CMD_start_completed completed = (Runner.CMD_start_completed)obj;
|
91 |
|
|
String s;
|
92 |
|
|
|
93 |
|
|
verilog_build.append(++i).append(".\n");
|
94 |
|
|
s = String.format("rep: %x\n", completed.rep); verilog_build.append(s); verilog_completed.append(s);
|
95 |
|
|
s = String.format("lock: %x\n", completed.lock); verilog_build.append(s); verilog_completed.append(s);
|
96 |
|
|
s = String.format("seg: --\n"); verilog_build.append(s);
|
97 |
|
|
s = String.format("as32: %x\n", completed.as32); verilog_build.append(s); verilog_completed.append(s);
|
98 |
|
|
s = String.format("os32: %x\n", completed.os32); verilog_build.append(s); verilog_completed.append(s);
|
99 |
|
|
s = String.format("cons: %x\n", completed.consumed); verilog_build.append(s); verilog_completed.append(s);
|
100 |
|
|
verilog_build.append("\n");
|
101 |
|
|
}
|
102 |
|
|
}
|
103 |
|
|
if(bochs_completed.toString().equals(verilog_completed.toString()) == false) {
|
104 |
|
|
System.out.println("FAILED: completed");
|
105 |
|
|
test_failed = true;
|
106 |
|
|
}
|
107 |
|
|
|
108 |
|
|
//---------------------------------------------------------------------- CMD_start_output
|
109 |
|
|
bochs_build .append(header_line).append(" output\n");
|
110 |
|
|
verilog_build.append(header_line).append(" output\n");
|
111 |
|
|
|
112 |
|
|
StringBuilder bochs_output = new StringBuilder();
|
113 |
|
|
StringBuilder verilog_output = new StringBuilder();
|
114 |
|
|
|
115 |
|
|
i = 0;
|
116 |
|
|
for(Object obj : log_bochs) {
|
117 |
|
|
if(obj instanceof Runner.CMD_start_output) {
|
118 |
|
|
Runner.CMD_start_output output = (Runner.CMD_start_output)obj;
|
119 |
|
|
String s;
|
120 |
|
|
|
121 |
|
|
bochs_build.append(++i).append(".\n");
|
122 |
|
|
prepare_output(output, bochs_build, bochs_output);
|
123 |
|
|
bochs_build.append("\n");
|
124 |
|
|
s = String.format("tb_wr_cmd_last: --\n"); bochs_build.append(s);
|
125 |
|
|
s = String.format("tb_can_ignore: %x\n", output.tb_can_ignore); bochs_build.append(s); bochs_output.append(s);
|
126 |
|
|
bochs_build.append("\n");
|
127 |
|
|
}
|
128 |
|
|
}
|
129 |
|
|
int bochs_output_count = i;
|
130 |
|
|
i = 0;
|
131 |
|
|
for(Object obj : log_verilog) {
|
132 |
|
|
if(obj instanceof Runner.CMD_start_output) {
|
133 |
|
|
Runner.CMD_start_output output = (Runner.CMD_start_output)obj;
|
134 |
|
|
String s;
|
135 |
|
|
|
136 |
|
|
if(i == bochs_output_count && output.tb_can_ignore == 1) {
|
137 |
|
|
System.out.println("[RunRaport]: ignored output.");
|
138 |
|
|
continue;
|
139 |
|
|
}
|
140 |
|
|
|
141 |
|
|
verilog_build.append(++i).append(".\n");
|
142 |
|
|
prepare_output(output, verilog_build, verilog_output);
|
143 |
|
|
verilog_build.append("\n");
|
144 |
|
|
s = String.format("tb_wr_cmd_last: %x\n", output.tb_wr_cmd_last); verilog_build.append(s);
|
145 |
|
|
s = String.format("tb_can_ignore: %x\n", output.tb_can_ignore); verilog_build.append(s); verilog_output.append(s);
|
146 |
|
|
verilog_build.append("\n");
|
147 |
|
|
}
|
148 |
|
|
}
|
149 |
|
|
if(bochs_output.toString().equals(verilog_output.toString()) == false) {
|
150 |
|
|
System.out.println("FAILED: output");
|
151 |
|
|
test_failed = true;
|
152 |
|
|
}
|
153 |
|
|
|
154 |
|
|
//---------------------------------------------------------------------- CMD_start_interrupt
|
155 |
|
|
bochs_build .append(header_line).append(" interrupt\n");
|
156 |
|
|
verilog_build.append(header_line).append(" interrupt\n");
|
157 |
|
|
|
158 |
|
|
StringBuilder bochs_interrupt = new StringBuilder();
|
159 |
|
|
StringBuilder verilog_interrupt = new StringBuilder();
|
160 |
|
|
|
161 |
|
|
i = 0;
|
162 |
|
|
for(Object obj : log_bochs) {
|
163 |
|
|
if(obj instanceof Runner.CMD_start_interrupt) {
|
164 |
|
|
Runner.CMD_start_interrupt interrupt = (Runner.CMD_start_interrupt)obj;
|
165 |
|
|
String s;
|
166 |
|
|
|
167 |
|
|
bochs_build.append(++i).append(".\n");
|
168 |
|
|
s = String.format("vector: %02x\n", interrupt.vector); bochs_build.append(s); bochs_interrupt.append(s);
|
169 |
|
|
bochs_build.append("\n");
|
170 |
|
|
}
|
171 |
|
|
}
|
172 |
|
|
i = 0;
|
173 |
|
|
for(Object obj : log_verilog) {
|
174 |
|
|
if(obj instanceof Runner.CMD_start_interrupt) {
|
175 |
|
|
Runner.CMD_start_interrupt interrupt = (Runner.CMD_start_interrupt)obj;
|
176 |
|
|
String s;
|
177 |
|
|
|
178 |
|
|
verilog_build.append(++i).append(".\n");
|
179 |
|
|
s = String.format("vector: %02x\n", interrupt.vector); verilog_build.append(s); verilog_interrupt.append(s);
|
180 |
|
|
verilog_build.append("\n");
|
181 |
|
|
}
|
182 |
|
|
}
|
183 |
|
|
if(bochs_interrupt.toString().equals(verilog_interrupt.toString()) == false) {
|
184 |
|
|
System.out.println("FAILED: interrupt");
|
185 |
|
|
test_failed = true;
|
186 |
|
|
}
|
187 |
|
|
|
188 |
|
|
//---------------------------------------------------------------------- CMD_start_exception
|
189 |
|
|
bochs_build .append(header_line).append(" exception\n");
|
190 |
|
|
verilog_build.append(header_line).append(" exception\n");
|
191 |
|
|
|
192 |
|
|
StringBuilder bochs_exception = new StringBuilder();
|
193 |
|
|
StringBuilder verilog_exception = new StringBuilder();
|
194 |
|
|
|
195 |
|
|
i = 0;
|
196 |
|
|
for(Object obj : log_bochs) {
|
197 |
|
|
if(obj instanceof Runner.CMD_start_exception) {
|
198 |
|
|
Runner.CMD_start_exception exception = (Runner.CMD_start_exception)obj;
|
199 |
|
|
String s;
|
200 |
|
|
|
201 |
|
|
bochs_build.append(++i).append(".\n");
|
202 |
|
|
s = String.format("vector: %02x\n", exception.vector); bochs_build.append(s); bochs_exception.append(s);
|
203 |
|
|
s = String.format("push_error: %x\n", exception.push_error); bochs_build.append(s); bochs_exception.append(s);
|
204 |
|
|
s = String.format("error_code: %x\n", exception.error_code); bochs_build.append(s); bochs_exception.append(s);
|
205 |
|
|
bochs_build.append("\n");
|
206 |
|
|
}
|
207 |
|
|
}
|
208 |
|
|
i = 0;
|
209 |
|
|
for(Object obj : log_verilog) {
|
210 |
|
|
if(obj instanceof Runner.CMD_start_exception) {
|
211 |
|
|
Runner.CMD_start_exception exception = (Runner.CMD_start_exception)obj;
|
212 |
|
|
String s;
|
213 |
|
|
|
214 |
|
|
verilog_build.append(++i).append(".\n");
|
215 |
|
|
s = String.format("vector: %02x\n", exception.vector); verilog_build.append(s); verilog_exception.append(s);
|
216 |
|
|
s = String.format("push_error: %x\n", exception.push_error); verilog_build.append(s); verilog_exception.append(s);
|
217 |
|
|
s = String.format("error_code: %x\n", exception.error_code); verilog_build.append(s); verilog_exception.append(s);
|
218 |
|
|
verilog_build.append("\n");
|
219 |
|
|
}
|
220 |
|
|
}
|
221 |
|
|
if(bochs_exception.toString().equals(verilog_exception.toString()) == false) {
|
222 |
|
|
System.out.println("FAILED: exception");
|
223 |
|
|
test_failed = true;
|
224 |
|
|
}
|
225 |
|
|
|
226 |
|
|
//---------------------------------------------------------------------- CMD_start_read
|
227 |
|
|
bochs_build .append(header_line).append(" read\n");
|
228 |
|
|
verilog_build.append(header_line).append(" read\n");
|
229 |
|
|
|
230 |
|
|
StringBuilder bochs_read = new StringBuilder();
|
231 |
|
|
StringBuilder verilog_read = new StringBuilder();
|
232 |
|
|
|
233 |
|
|
i = 0;
|
234 |
|
|
for(Object obj : log_bochs) {
|
235 |
|
|
if(obj instanceof Runner.CMD_start_read) {
|
236 |
|
|
Runner.CMD_start_read read = (Runner.CMD_start_read)obj;
|
237 |
|
|
String s;
|
238 |
|
|
|
239 |
|
|
bochs_build.append(++i).append(".\n");
|
240 |
|
|
s = String.format("address: %02x\n", read.address); bochs_build.append(s); bochs_read.append(s);
|
241 |
|
|
s = String.format("byteena: %x\n", read.byteena & 0xFL); bochs_build.append(s); bochs_read.append(s);
|
242 |
|
|
s = String.format("data: %08x\n", read.byteena >> 8); bochs_build.append(s); bochs_read.append(s);
|
243 |
|
|
s = String.format("can_ignore: %x\n", read.can_ignore); bochs_build.append(s); bochs_read.append(s);
|
244 |
|
|
bochs_build.append("\n");
|
245 |
|
|
}
|
246 |
|
|
}
|
247 |
|
|
int bochs_read_count = i;
|
248 |
|
|
i = 0;
|
249 |
|
|
for(Object obj : log_verilog) {
|
250 |
|
|
if(obj instanceof Runner.CMD_start_read) {
|
251 |
|
|
Runner.CMD_start_read read = (Runner.CMD_start_read)obj;
|
252 |
|
|
String s;
|
253 |
|
|
|
254 |
|
|
if(i == bochs_read_count && read.can_ignore == 1) {
|
255 |
|
|
System.out.println("[RunRaport]: ignored read.");
|
256 |
|
|
continue;
|
257 |
|
|
}
|
258 |
|
|
|
259 |
|
|
verilog_build.append(++i).append(".\n");
|
260 |
|
|
s = String.format("address: %02x\n", read.address); verilog_build.append(s); verilog_read.append(s);
|
261 |
|
|
s = String.format("byteena: %x\n", read.byteena & 0xFL); verilog_build.append(s); verilog_read.append(s);
|
262 |
|
|
s = String.format("data: %08x\n", read.byteena >> 8); verilog_build.append(s); verilog_read.append(s);
|
263 |
|
|
s = String.format("can_ignore: %x\n", read.can_ignore); verilog_build.append(s); verilog_read.append(s);
|
264 |
|
|
verilog_build.append("\n");
|
265 |
|
|
}
|
266 |
|
|
}
|
267 |
|
|
if(bochs_read.toString().equals(verilog_read.toString()) == false) {
|
268 |
|
|
System.out.println("FAILED: read");
|
269 |
|
|
test_failed = true;
|
270 |
|
|
}
|
271 |
|
|
|
272 |
|
|
//---------------------------------------------------------------------- CMD_start_io_read
|
273 |
|
|
bochs_build .append(header_line).append(" io_read\n");
|
274 |
|
|
verilog_build.append(header_line).append(" io_read\n");
|
275 |
|
|
|
276 |
|
|
StringBuilder bochs_io_read = new StringBuilder();
|
277 |
|
|
StringBuilder verilog_io_read = new StringBuilder();
|
278 |
|
|
|
279 |
|
|
i = 0;
|
280 |
|
|
for(Object obj : log_bochs) {
|
281 |
|
|
if(obj instanceof Runner.CMD_start_io_read) {
|
282 |
|
|
Runner.CMD_start_io_read io_read = (Runner.CMD_start_io_read)obj;
|
283 |
|
|
String s;
|
284 |
|
|
|
285 |
|
|
bochs_build.append(++i).append(".\n");
|
286 |
|
|
s = String.format("address: %02x\n", io_read.address); bochs_build.append(s); bochs_io_read.append(s);
|
287 |
|
|
s = String.format("byteena: %x\n", io_read.byteena & 0xFL); bochs_build.append(s); bochs_io_read.append(s);
|
288 |
|
|
s = String.format("data: %08x\n", io_read.byteena >> 8); bochs_build.append(s); bochs_io_read.append(s);
|
289 |
|
|
s = String.format("can_ignore: %x\n", io_read.can_ignore); bochs_build.append(s); bochs_io_read.append(s);
|
290 |
|
|
bochs_build.append("\n");
|
291 |
|
|
}
|
292 |
|
|
}
|
293 |
|
|
int bochs_io_read_count = i;
|
294 |
|
|
i = 0;
|
295 |
|
|
for(Object obj : log_verilog) {
|
296 |
|
|
if(obj instanceof Runner.CMD_start_io_read) {
|
297 |
|
|
Runner.CMD_start_io_read io_read = (Runner.CMD_start_io_read)obj;
|
298 |
|
|
String s;
|
299 |
|
|
|
300 |
|
|
if(i == bochs_io_read_count && io_read.can_ignore == 1) {
|
301 |
|
|
System.out.println("[RunRaport]: io_read ignored.");
|
302 |
|
|
continue;
|
303 |
|
|
}
|
304 |
|
|
|
305 |
|
|
verilog_build.append(++i).append(".\n");
|
306 |
|
|
s = String.format("address: %02x\n", io_read.address); verilog_build.append(s); verilog_io_read.append(s);
|
307 |
|
|
s = String.format("byteena: %x\n", io_read.byteena & 0xFL); verilog_build.append(s); verilog_io_read.append(s);
|
308 |
|
|
s = String.format("data: %08x\n", io_read.byteena >> 8); verilog_build.append(s); verilog_io_read.append(s);
|
309 |
|
|
s = String.format("can_ignore: %x\n", io_read.can_ignore); verilog_build.append(s); verilog_io_read.append(s);
|
310 |
|
|
verilog_build.append("\n");
|
311 |
|
|
}
|
312 |
|
|
}
|
313 |
|
|
if(bochs_io_read.toString().equals(verilog_io_read.toString()) == false) {
|
314 |
|
|
System.out.println("FAILED: io_read");
|
315 |
|
|
test_failed = true;
|
316 |
|
|
}
|
317 |
|
|
|
318 |
|
|
//---------------------------------------------------------------------- CMD_start_write
|
319 |
|
|
bochs_build .append(header_line).append(" write\n");
|
320 |
|
|
verilog_build.append(header_line).append(" write\n");
|
321 |
|
|
|
322 |
|
|
StringBuilder bochs_write = new StringBuilder();
|
323 |
|
|
StringBuilder verilog_write = new StringBuilder();
|
324 |
|
|
|
325 |
|
|
i = 0;
|
326 |
|
|
for(Object obj : log_bochs) {
|
327 |
|
|
if(obj instanceof Runner.CMD_start_write) {
|
328 |
|
|
Runner.CMD_start_write write = (Runner.CMD_start_write)obj;
|
329 |
|
|
String s;
|
330 |
|
|
|
331 |
|
|
bochs_build.append(++i).append(".\n");
|
332 |
|
|
s = String.format("address: %02x\n", write.address); bochs_build.append(s); bochs_write.append(s);
|
333 |
|
|
s = String.format("byteena: %x\n", write.byteena & 0xFL); bochs_build.append(s); bochs_write.append(s);
|
334 |
|
|
s = String.format("data: %08x\n", write.data); bochs_build.append(s); bochs_write.append(s);
|
335 |
|
|
s = String.format("can_ignore: %x\n", write.can_ignore); bochs_build.append(s);
|
336 |
|
|
bochs_build.append("\n");
|
337 |
|
|
}
|
338 |
|
|
}
|
339 |
|
|
int bochs_write_count = i;
|
340 |
|
|
i = 0;
|
341 |
|
|
for(Object obj : log_verilog) {
|
342 |
|
|
if(obj instanceof Runner.CMD_start_write) {
|
343 |
|
|
Runner.CMD_start_write write = (Runner.CMD_start_write)obj;
|
344 |
|
|
String s;
|
345 |
|
|
|
346 |
|
|
if(i == bochs_write_count && write.can_ignore == 1) {
|
347 |
|
|
System.out.println("[RunRaport]: ignored write.");
|
348 |
|
|
continue;
|
349 |
|
|
}
|
350 |
|
|
|
351 |
|
|
verilog_build.append(++i).append(".\n");
|
352 |
|
|
s = String.format("address: %02x\n", write.address); verilog_build.append(s); verilog_write.append(s);
|
353 |
|
|
s = String.format("byteena: %x\n", write.byteena & 0xFL); verilog_build.append(s); verilog_write.append(s);
|
354 |
|
|
s = String.format("data: %08x\n", write.data); verilog_build.append(s); verilog_write.append(s);
|
355 |
|
|
s = String.format("can_ignore: %x\n", write.can_ignore); verilog_build.append(s);
|
356 |
|
|
verilog_build.append("\n");
|
357 |
|
|
}
|
358 |
|
|
}
|
359 |
|
|
if(bochs_write.toString().equals(verilog_write.toString()) == false) {
|
360 |
|
|
System.out.println("FAILED: write");
|
361 |
|
|
test_failed = true;
|
362 |
|
|
}
|
363 |
|
|
|
364 |
|
|
//---------------------------------------------------------------------- CMD_start_io_write
|
365 |
|
|
bochs_build .append(header_line).append(" io_write\n");
|
366 |
|
|
verilog_build.append(header_line).append(" io_write\n");
|
367 |
|
|
|
368 |
|
|
StringBuilder bochs_io_write = new StringBuilder();
|
369 |
|
|
StringBuilder verilog_io_write = new StringBuilder();
|
370 |
|
|
|
371 |
|
|
i = 0;
|
372 |
|
|
for(Object obj : log_bochs) {
|
373 |
|
|
if(obj instanceof Runner.CMD_start_io_write) {
|
374 |
|
|
Runner.CMD_start_io_write io_write = (Runner.CMD_start_io_write)obj;
|
375 |
|
|
String s;
|
376 |
|
|
|
377 |
|
|
bochs_build.append(++i).append(".\n");
|
378 |
|
|
s = String.format("address: %02x\n", io_write.address); bochs_build.append(s); bochs_io_write.append(s);
|
379 |
|
|
s = String.format("byteena: %x\n", io_write.byteena & 0xFL); bochs_build.append(s); bochs_io_write.append(s);
|
380 |
|
|
s = String.format("data: %08x\n", io_write.data); bochs_build.append(s); bochs_io_write.append(s);
|
381 |
|
|
s = String.format("can_ignore: %x\n", io_write.can_ignore); bochs_build.append(s);
|
382 |
|
|
bochs_build.append("\n");
|
383 |
|
|
}
|
384 |
|
|
}
|
385 |
|
|
int bochs_io_write_count = i;
|
386 |
|
|
i = 0;
|
387 |
|
|
for(Object obj : log_verilog) {
|
388 |
|
|
if(obj instanceof Runner.CMD_start_io_write) {
|
389 |
|
|
Runner.CMD_start_io_write io_write = (Runner.CMD_start_io_write)obj;
|
390 |
|
|
String s;
|
391 |
|
|
|
392 |
|
|
if(i == bochs_io_write_count && io_write.can_ignore == 1) {
|
393 |
|
|
System.out.println("[RunRaport]: ignored io_write.");
|
394 |
|
|
continue;
|
395 |
|
|
}
|
396 |
|
|
|
397 |
|
|
verilog_build.append(++i).append(".\n");
|
398 |
|
|
s = String.format("address: %02x\n", io_write.address); verilog_build.append(s); verilog_io_write.append(s);
|
399 |
|
|
s = String.format("byteena: %x\n", io_write.byteena & 0xFL); verilog_build.append(s); verilog_io_write.append(s);
|
400 |
|
|
s = String.format("data: %08x\n", io_write.data); verilog_build.append(s); verilog_io_write.append(s);
|
401 |
|
|
s = String.format("can_ignore: %x\n", io_write.can_ignore); verilog_build.append(s);
|
402 |
|
|
verilog_build.append("\n");
|
403 |
|
|
}
|
404 |
|
|
}
|
405 |
|
|
if(bochs_io_write.toString().equals(verilog_io_write.toString()) == false) {
|
406 |
|
|
System.out.println("FAILED: io_write");
|
407 |
|
|
test_failed = true;
|
408 |
|
|
}
|
409 |
|
|
|
410 |
|
|
//----------------------------------------------------------------------
|
411 |
|
|
FileOutputStream fos = new FileOutputStream(output_directory.getCanonicalPath() + "/output_bochs.txt");
|
412 |
|
|
fos.write(bochs_build.toString().getBytes());
|
413 |
|
|
fos.close();
|
414 |
|
|
|
415 |
|
|
fos = new FileOutputStream(output_directory.getCanonicalPath() + "/output_verilog.txt");
|
416 |
|
|
fos.write(verilog_build.toString().getBytes());
|
417 |
|
|
fos.close();
|
418 |
|
|
|
419 |
|
|
//----------------------------------------------------------------------
|
420 |
|
|
|
421 |
|
|
return test_failed;
|
422 |
|
|
}
|
423 |
|
|
|
424 |
|
|
static void prepare_output(Runner.CMD_start_output output, StringBuilder build, StringBuilder compare) {
|
425 |
|
|
String s;
|
426 |
|
|
|
427 |
|
|
s = String.format("eax(%08x) ebx(%08x) ecx(%08x) edx(%08x)\n", output.eax, output.ebx, output.ecx, output.edx);
|
428 |
|
|
build.append(s); compare.append(s);
|
429 |
|
|
s = String.format("esi(%08x) edi(%08x) ebp(%08x) esp(%08x)\n", output.esi, output.edi, output.ebp, output.esp);
|
430 |
|
|
build.append(s); compare.append(s);
|
431 |
|
|
|
432 |
|
|
build.append("\n");
|
433 |
|
|
|
434 |
|
|
s = String.format("eip(%08x)\n", output.eip); build.append(s); compare.append(s);
|
435 |
|
|
|
436 |
|
|
build.append("\n");
|
437 |
|
|
|
438 |
|
|
s = String.format("cflag(%x) pflag(%x) aflag(%x) zflag(%x)\n", output.cflag, output.pflag, output.aflag, output.zflag);
|
439 |
|
|
build.append(s); compare.append(s);
|
440 |
|
|
s = String.format("sflag(%x) tflag(%x) iflag(%x) dflag(%x)\n", output.sflag, output.tflag, output.iflag, output.dflag);
|
441 |
|
|
build.append(s); compare.append(s);
|
442 |
|
|
s = String.format("oflag(%x) iopl(%x) ntflag(%x) rflag(%x)\n", output.oflag, output.iopl, output.ntflag, output.rflag);
|
443 |
|
|
build.append(s); compare.append(s);
|
444 |
|
|
s = String.format("vmflag(%x) acflag(%x) idflag(%x)\n", output.vmflag, output.acflag, output.idflag);
|
445 |
|
|
build.append(s); compare.append(s);
|
446 |
|
|
|
447 |
|
|
build.append("\n");
|
448 |
|
|
|
449 |
|
|
s = String.format("cs(%04x) cs_rpl(%x) cs_cache_valid(%x)\n", output.cs, output.cs_rpl, output.cs_cache_valid);
|
450 |
|
|
build.append(s); compare.append(s);
|
451 |
|
|
s = String.format("cs_base(%08x) cs_limit(%08x) cs_g(%x) cs_d_b(%x)\n",
|
452 |
|
|
output.cs_base, output.cs_limit, output.cs_g, output.cs_d_b); build.append(s); compare.append(s);
|
453 |
|
|
s = String.format("cs_avl(%x) cs_p(%x) cs_dpl(%x) cs_s(%x) cs_type(%x)\n",
|
454 |
|
|
output.cs_avl, output.cs_p, output.cs_dpl, output.cs_s, output.cs_type); build.append(s); compare.append(s);
|
455 |
|
|
|
456 |
|
|
build.append("\n");
|
457 |
|
|
|
458 |
|
|
s = String.format("ds(%04x) ds_rpl(%x) ds_cache_valid(%x)\n", output.ds, output.ds_rpl, output.ds_cache_valid);
|
459 |
|
|
build.append(s); compare.append(s);
|
460 |
|
|
s = String.format("ds_base(%08x) ds_limit(%08x) ds_g(%x) ds_d_b(%x)\n",
|
461 |
|
|
output.ds_base, output.ds_limit, output.ds_g, output.ds_d_b); build.append(s); compare.append(s);
|
462 |
|
|
s = String.format("ds_avl(%x) ds_p(%x) ds_dpl(%x) ds_s(%x) ds_type(%x)\n",
|
463 |
|
|
output.ds_avl, output.ds_p, output.ds_dpl, output.ds_s, output.ds_type); build.append(s); compare.append(s);
|
464 |
|
|
|
465 |
|
|
build.append("\n");
|
466 |
|
|
|
467 |
|
|
s = String.format("es(%04x) es_rpl(%x) es_cache_valid(%x)\n", output.es, output.es_rpl, output.es_cache_valid);
|
468 |
|
|
build.append(s); compare.append(s);
|
469 |
|
|
s = String.format("es_base(%08x) es_limit(%08x) es_g(%x) es_d_b(%x)\n",
|
470 |
|
|
output.es_base, output.es_limit, output.es_g, output.es_d_b); build.append(s); compare.append(s);
|
471 |
|
|
s = String.format("es_avl(%x) es_p(%x) es_dpl(%x) es_s(%x) es_type(%x)\n",
|
472 |
|
|
output.es_avl, output.es_p, output.es_dpl, output.es_s, output.es_type); build.append(s); compare.append(s);
|
473 |
|
|
|
474 |
|
|
build.append("\n");
|
475 |
|
|
|
476 |
|
|
s = String.format("fs(%04x) fs_rpl(%x) fs_cache_valid(%x)\n", output.fs, output.fs_rpl, output.fs_cache_valid);
|
477 |
|
|
build.append(s); compare.append(s);
|
478 |
|
|
s = String.format("fs_base(%08x) fs_limit(%08x) fs_g(%x) fs_d_b(%x)\n",
|
479 |
|
|
output.fs_base, output.fs_limit, output.fs_g, output.fs_d_b); build.append(s); compare.append(s);
|
480 |
|
|
s = String.format("fs_avl(%x) fs_p(%x) fs_dpl(%x) fs_s(%x) fs_type(%x)\n",
|
481 |
|
|
output.fs_avl, output.fs_p, output.fs_dpl, output.fs_s, output.fs_type); build.append(s); compare.append(s);
|
482 |
|
|
|
483 |
|
|
build.append("\n");
|
484 |
|
|
|
485 |
|
|
s = String.format("gs(%04x) gs_rpl(%x) gs_cache_valid(%x)\n", output.gs, output.gs_rpl, output.gs_cache_valid);
|
486 |
|
|
build.append(s); compare.append(s);
|
487 |
|
|
s = String.format("gs_base(%08x) gs_limit(%08x) gs_g(%x) gs_d_b(%x)\n",
|
488 |
|
|
output.gs_base, output.gs_limit, output.gs_g, output.gs_d_b); build.append(s); compare.append(s);
|
489 |
|
|
s = String.format("gs_avl(%x) gs_p(%x) gs_dpl(%x) gs_s(%x) gs_type(%x)\n",
|
490 |
|
|
output.gs_avl, output.gs_p, output.gs_dpl, output.gs_s, output.gs_type); build.append(s); compare.append(s);
|
491 |
|
|
|
492 |
|
|
build.append("\n");
|
493 |
|
|
|
494 |
|
|
s = String.format("ld(%04x) ld_rpl(%x) ld_cache_valid(%x)\n", output.ldtr, output.ldtr_rpl, output.ldtr_cache_valid);
|
495 |
|
|
build.append(s); compare.append(s);
|
496 |
|
|
s = String.format("ld_base(%08x) ld_limit(%08x) ld_g(%x) ld_d_b(%x)\n",
|
497 |
|
|
output.ldtr_base, output.ldtr_limit, output.ldtr_g, output.ldtr_d_b); build.append(s); compare.append(s);
|
498 |
|
|
s = String.format("ld_avl(%x) ld_p(%x) ld_dpl(%x) ld_s(%x) ld_type(%x)\n",
|
499 |
|
|
output.ldtr_avl, output.ldtr_p, output.ldtr_dpl, output.ldtr_s, output.ldtr_type);
|
500 |
|
|
build.append(s); compare.append(s);
|
501 |
|
|
|
502 |
|
|
build.append("\n");
|
503 |
|
|
|
504 |
|
|
s = String.format("tr(%04x) tr_rpl(%x) tr_cache_valid(%x)\n", output.tr, output.tr_rpl, output.tr_cache_valid);
|
505 |
|
|
build.append(s); compare.append(s);
|
506 |
|
|
s = String.format("tr_base(%08x) tr_limit(%08x) tr_g(%x) tr_d_b(%x)\n",
|
507 |
|
|
output.tr_base, output.tr_limit, output.tr_g, output.tr_d_b); build.append(s); compare.append(s);
|
508 |
|
|
s = String.format("tr_avl(%x) tr_p(%x) tr_dpl(%x) tr_s(%x) tr_type(%x)\n",
|
509 |
|
|
output.tr_avl, output.tr_p, output.tr_dpl, output.tr_s, output.tr_type); build.append(s); compare.append(s);
|
510 |
|
|
|
511 |
|
|
build.append("\n");
|
512 |
|
|
|
513 |
|
|
s = String.format("gdtr_base(%08x) gdtr_limit(%04x) idtr_base(%08x) idtr_limit(%04x)",
|
514 |
|
|
output.gdtr_base, output.gdtr_limit, output.idtr_base, output.idtr_limit);
|
515 |
|
|
build.append(s); compare.append(s);
|
516 |
|
|
|
517 |
|
|
build.append("\n");
|
518 |
|
|
|
519 |
|
|
s = String.format("cr0_pe(%x) cr0_mp(%x) cr0_em(%x) cr0_ts(%x)\n", output.cr0_pe, output.cr0_mp, output.cr0_em, output.cr0_ts);
|
520 |
|
|
build.append(s); compare.append(s);
|
521 |
|
|
s = String.format("cr0_ne(%x) cr0_wp(%x) cr0_am(%x) cr0_nw(%x)\n", output.cr0_ne, output.cr0_wp, output.cr0_am, output.cr0_nw);
|
522 |
|
|
build.append(s); compare.append(s);
|
523 |
|
|
s = String.format("cr0_cd(%x) cr0_pg(%x)\n", output.cr0_cd, output.cr0_pg);
|
524 |
|
|
build.append(s); compare.append(s);
|
525 |
|
|
|
526 |
|
|
build.append("\n");
|
527 |
|
|
|
528 |
|
|
s = String.format("cr2(%08x) cr3(%08x)\n", output.cr2, output.cr3); build.append(s); compare.append(s);
|
529 |
|
|
|
530 |
|
|
build.append("\n");
|
531 |
|
|
|
532 |
|
|
s = String.format("dr0(%08x) dr1(%08x) dr2(%08x) dr3(%08x)\n", output.dr0, output.dr1, output.dr2, output.dr3);
|
533 |
|
|
build.append(s); compare.append(s);
|
534 |
|
|
s = String.format("dr6(%08x) dr7(%08x)\n", output.dr6, output.dr7);
|
535 |
|
|
build.append(s); compare.append(s);
|
536 |
|
|
}
|
537 |
|
|
|
538 |
|
|
}
|