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 ao486.test.layers.Layer;
|
30 |
|
|
import java.io.File;
|
31 |
|
|
import java.util.LinkedList;
|
32 |
|
|
import java.util.Random;
|
33 |
|
|
|
34 |
|
|
public class VerilogFreeRun extends TestUnit {
|
35 |
|
|
|
36 |
|
|
@Override public int get_test_count() throws Exception { throw new UnsupportedOperationException("Not supported yet."); }
|
37 |
|
|
|
38 |
|
|
@Override public void init() throws Exception {
|
39 |
|
|
random = new Random(10);
|
40 |
|
|
|
41 |
|
|
layers.clear();
|
42 |
|
|
|
43 |
|
|
final Random random_final = random;
|
44 |
|
|
layers.addFirst(new Layer() {
|
45 |
|
|
Byte get_memory(long address) {
|
46 |
|
|
if(address == 0xFFFFFFF0L) return (byte)0xEA;
|
47 |
|
|
if(address == 0xFFFFFFF1L) return (byte)0x00;
|
48 |
|
|
if(address == 0xFFFFFFF2L) return (byte)0xFF;
|
49 |
|
|
if(address == 0xFFFFFFF3L) return (byte)0x00;
|
50 |
|
|
if(address == 0xFFFFFFF4L) return (byte)0xF0;
|
51 |
|
|
|
52 |
|
|
/*
|
53 |
|
|
if(address == 0x000FFF00L) return (byte)0x66;
|
54 |
|
|
if(address == 0x000FFF01L) return (byte)0xB8;
|
55 |
|
|
if(address == 0x000FFF02L) return (byte)0x00;
|
56 |
|
|
if(address == 0x000FFF03L) return (byte)0x00;
|
57 |
|
|
if(address == 0x000FFF04L) return (byte)0x00;
|
58 |
|
|
if(address == 0x000FFF05L) return (byte)0x00;
|
59 |
|
|
if(address == 0x000FFF06L) return (byte)0x66;
|
60 |
|
|
if(address == 0x000FFF07L) return (byte)0xE7;
|
61 |
|
|
if(address == 0x000FFF08L) return (byte)0x04;
|
62 |
|
|
if(address == 0x000FFF09L) return (byte)0x66;
|
63 |
|
|
if(address == 0x000FFF0AL) return (byte)0xB8;
|
64 |
|
|
if(address == 0x000FFF0BL) return (byte)0x61;
|
65 |
|
|
if(address == 0x000FFF0CL) return (byte)0x00;
|
66 |
|
|
if(address == 0x000FFF0DL) return (byte)0x00;
|
67 |
|
|
if(address == 0x000FFF0EL) return (byte)0x00;
|
68 |
|
|
if(address == 0x000FFF0FL) return (byte)0x66;
|
69 |
|
|
if(address == 0x000FFF10L) return (byte)0xE7;
|
70 |
|
|
if(address == 0x000FFF11L) return (byte)0x00;
|
71 |
|
|
if(address == 0x000FFF12L) return (byte)0xEB;
|
72 |
|
|
if(address == 0x000FFF13L) return (byte)0xFE;
|
73 |
|
|
*/
|
74 |
|
|
|
75 |
|
|
/*
|
76 |
|
|
if(address == 0x000FFF00L) return (byte)0x89;
|
77 |
|
|
if(address == 0x000FFF01L) return (byte)0x87;
|
78 |
|
|
if(address == 0x000FFF02L) return (byte)0x58;
|
79 |
|
|
if(address == 0x000FFF03L) return (byte)0x01;
|
80 |
|
|
if(address == 0x000FFF04L) return (byte)0x89;
|
81 |
|
|
if(address == 0x000FFF05L) return (byte)0xB7;
|
82 |
|
|
if(address == 0x000FFF06L) return (byte)0x5A;
|
83 |
|
|
if(address == 0x000FFF07L) return (byte)0x01;
|
84 |
|
|
if(address == 0x000FFF08L) return (byte)0x8A;
|
85 |
|
|
if(address == 0x000FFF09L) return (byte)0x46;
|
86 |
|
|
if(address == 0x000FFF0AL) return (byte)0xFD;
|
87 |
|
|
if(address == 0x000FFF0BL) return (byte)0x30;
|
88 |
|
|
if(address == 0x000FFF0CL) return (byte)0xE4;
|
89 |
|
|
if(address == 0x000FFF0DL) return (byte)0xB9;
|
90 |
|
|
if(address == 0x000FFF0EL) return (byte)0x1E;
|
91 |
|
|
if(address == 0x000FFF0FL) return (byte)0x00;
|
92 |
|
|
*/
|
93 |
|
|
|
94 |
|
|
|
95 |
|
|
if(address == 0x000FFF00L) return (byte)0xEA;
|
96 |
|
|
if(address == 0x000FFF01L) return (byte)0x00;
|
97 |
|
|
if(address == 0x000FFF02L) return (byte)0x00;
|
98 |
|
|
if(address == 0x000FFF03L) return (byte)0x70;
|
99 |
|
|
if(address == 0x000FFF04L) return (byte)0x00;
|
100 |
|
|
|
101 |
|
|
|
102 |
|
|
if(address == 0x00000700L) return (byte)0x2E;
|
103 |
|
|
if(address == 0x00000701L) return (byte)0x89;
|
104 |
|
|
if(address == 0x00000702L) return (byte)0x1E;
|
105 |
|
|
if(address == 0x00000703L) return (byte)0x23;
|
106 |
|
|
if(address == 0x00000704L) return (byte)0x01;
|
107 |
|
|
if(address == 0x00000705L) return (byte)0x2E;
|
108 |
|
|
if(address == 0x00000706L) return (byte)0x88;
|
109 |
|
|
if(address == 0x00000707L) return (byte)0x2E;
|
110 |
|
|
if(address == 0x00000708L) return (byte)0x2F;
|
111 |
|
|
if(address == 0x00000709L) return (byte)0x01;
|
112 |
|
|
if(address == 0x0000070AL) return (byte)0x2E;
|
113 |
|
|
if(address == 0x0000070BL) return (byte)0x88;
|
114 |
|
|
if(address == 0x0000070CL) return (byte)0x16;
|
115 |
|
|
if(address == 0x0000070DL) return (byte)0x2D;
|
116 |
|
|
if(address == 0x0000070EL) return (byte)0x01;
|
117 |
|
|
if(address == 0x0000070FL) return (byte)0x00;
|
118 |
|
|
|
119 |
|
|
return (byte)(random_final.nextInt() & 0xFFL);
|
120 |
|
|
}
|
121 |
|
|
});
|
122 |
|
|
}
|
123 |
|
|
|
124 |
|
|
public static void main(String args[]) throws Exception {
|
125 |
|
|
|
126 |
|
|
Class test_class = VerilogFreeRun.class;
|
127 |
|
|
|
128 |
|
|
File output_directory = new File(".");
|
129 |
|
|
File directory;
|
130 |
|
|
LinkedList<String> command_line = new LinkedList<>();
|
131 |
|
|
|
132 |
|
|
Runner runner = new Runner();
|
133 |
|
|
|
134 |
|
|
//run verilog
|
135 |
|
|
TestUnit test_verilog = (TestUnit)test_class.newInstance();
|
136 |
|
|
|
137 |
|
|
test_verilog.init();
|
138 |
|
|
|
139 |
|
|
directory = new File("./../sim/ao486_run");
|
140 |
|
|
command_line.clear();
|
141 |
|
|
command_line.add("/opt/iverilog/bin/vvp");
|
142 |
|
|
command_line.add("tb_ao486_run.vvp");
|
143 |
|
|
//command_line.add("-lxt");
|
144 |
|
|
|
145 |
|
|
runner.execute(command_line, directory, test_verilog);
|
146 |
|
|
}
|
147 |
|
|
}
|