1 |
2 |
alfik |
/*
|
2 |
|
|
* This file is subject to the terms and conditions of the BSD License. See
|
3 |
|
|
* the file "LICENSE" in the main directory of this archive for more details.
|
4 |
|
|
*
|
5 |
|
|
* Copyright (C) 2014 Aleksander Osman
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
#include <cstdio>
|
9 |
|
|
#include <cstdlib>
|
10 |
|
|
#include <cstring>
|
11 |
|
|
|
12 |
|
|
#include <sys/mman.h>
|
13 |
|
|
#include <sys/types.h>
|
14 |
|
|
#include <sys/stat.h>
|
15 |
|
|
#include <sys/wait.h>
|
16 |
|
|
#include <fcntl.h>
|
17 |
|
|
#include <signal.h>
|
18 |
|
|
#include <unistd.h>
|
19 |
|
|
|
20 |
|
|
#include "shared_mem.h"
|
21 |
|
|
#include "tests.h"
|
22 |
|
|
|
23 |
|
|
//------------------------------------------------------------------------------
|
24 |
|
|
|
25 |
|
|
volatile shared_mem_t *shared_ptr = NULL;
|
26 |
|
|
|
27 |
|
|
//------------------------------------------------------------------------------
|
28 |
|
|
//------------------------------------------------------------------------------
|
29 |
|
|
//------------------------------------------------------------------------------
|
30 |
|
|
|
31 |
|
|
tst_t tst_instr_fetch_tlb_invalid_exc = { .init = NULL };
|
32 |
|
|
tst_t tst_arith_logic_till_exc = { .init = arith_logic_till_exc_init };
|
33 |
|
|
tst_t tst_exception_till_exc = { .init = exception_till_exc_init };
|
34 |
|
|
tst_t tst_tlb_commands_till_exc = { .init = tlb_commands_till_exc_init};
|
35 |
|
|
tst_t tst_branch_till_exc = { .init = branch_till_exc_init };
|
36 |
|
|
tst_t tst_data_till_exc = { .init = data_till_exc_init };
|
37 |
|
|
tst_t tst_interrupt_till_exc = { .init = interrupt_till_exc_init };
|
38 |
|
|
tst_t tst_tlb_fetch_till_exc = { .init = tlb_fetch_till_exc_init };
|
39 |
|
|
tst_t tst_tlb_data_till_exc = { .init = tlb_data_till_exc_init };
|
40 |
|
|
|
41 |
|
|
//------------------------------------------------------------------------------
|
42 |
|
|
|
43 |
|
|
tst_t *tst_current = &tst_tlb_data_till_exc;
|
44 |
|
|
|
45 |
|
|
//------------------------------------------------------------------------------
|
46 |
|
|
//------------------------------------------------------------------------------
|
47 |
|
|
//------------------------------------------------------------------------------
|
48 |
|
|
|
49 |
|
|
bool is_diff(volatile report_t *vmips, volatile report_t *ao) {
|
50 |
|
|
char buf[65536];
|
51 |
|
|
memset(buf, 0, sizeof(buf));
|
52 |
|
|
char *ptr = buf;
|
53 |
|
|
|
54 |
|
|
bool diff;
|
55 |
|
|
bool show = false;
|
56 |
|
|
|
57 |
|
|
ptr += sprintf(ptr, "name |d| vmips | ao \n");
|
58 |
|
|
ptr += sprintf(ptr, "------------------------------------------\n");
|
59 |
|
|
|
60 |
|
|
diff = vmips->counter != ao->counter; show = show || diff;
|
61 |
|
|
ptr += sprintf(ptr, "counter |%c| %08x | %08x \n", (diff)? '*' : ' ', vmips->counter, ao->counter);
|
62 |
|
|
|
63 |
|
|
diff = vmips->exception != ao->exception; show = show || diff;
|
64 |
|
|
ptr += sprintf(ptr, "exception |%c| %08x | %08x \n", (diff)? '*' : ' ', vmips->exception, ao->exception);
|
65 |
|
|
|
66 |
|
|
for(int i=1; i<32; i++) {
|
67 |
|
|
diff = vmips->state.reg[i-1] != ao->state.reg[i-1]; show = show || diff;
|
68 |
|
|
ptr += sprintf(ptr, "reg[%02d] |%c| %08x | %08x \n", i, (diff)? '*' : ' ', vmips->state.reg[i-1], ao->state.reg[i-1]);
|
69 |
|
|
}
|
70 |
|
|
|
71 |
|
|
diff = vmips->state.pc != ao->state.pc; show = show || diff;
|
72 |
|
|
ptr += sprintf(ptr, "pc |%c| %08x | %08x \n", (diff)? '*' : ' ', vmips->state.pc, ao->state.pc);
|
73 |
|
|
|
74 |
|
|
//not comapred: diff = vmips->state.lo != ao->state.lo; show = show || diff;
|
75 |
|
|
//not comapred: ptr += sprintf(ptr, "lo |%c| %08x | %08x \n", (diff)? '*' : ' ', vmips->state.lo, ao->state.lo);
|
76 |
|
|
|
77 |
|
|
//not comapred: diff = vmips->state.hi != ao->state.hi; show = show || diff;
|
78 |
|
|
//not comapred: ptr += sprintf(ptr, "hi |%c| %08x | %08x \n", (diff)? '*' : ' ', vmips->state.hi, ao->state.hi);
|
79 |
|
|
|
80 |
|
|
diff = vmips->state.index_p != ao->state.index_p; show = show || diff;
|
81 |
|
|
ptr += sprintf(ptr, "index_p |%c| %01x | %01x \n", (diff)? '*' : ' ', vmips->state.index_p, ao->state.index_p);
|
82 |
|
|
|
83 |
|
|
diff = vmips->state.index_index != ao->state.index_index; show = show || diff;
|
84 |
|
|
ptr += sprintf(ptr, "index_index |%c| %02x | %02x \n", (diff)? '*' : ' ', vmips->state.index_index, ao->state.index_index);
|
85 |
|
|
|
86 |
|
|
diff = vmips->state.random != ao->state.random; show = show || diff;
|
87 |
|
|
ptr += sprintf(ptr, "random |%c| %02x | %02x \n", (diff)? '*' : ' ', vmips->state.random, ao->state.random);
|
88 |
|
|
|
89 |
|
|
diff = vmips->state.entrylo_pfn != ao->state.entrylo_pfn; show = show || diff;
|
90 |
|
|
ptr += sprintf(ptr, "entrylo_pfn |%c| %05x | %05x \n", (diff)? '*' : ' ', vmips->state.entrylo_pfn, ao->state.entrylo_pfn);
|
91 |
|
|
|
92 |
|
|
diff = vmips->state.entrylo_n != ao->state.entrylo_n; show = show || diff;
|
93 |
|
|
ptr += sprintf(ptr, "entrylo_n |%c| %01x | %01x \n", (diff)? '*' : ' ', vmips->state.entrylo_n, ao->state.entrylo_n);
|
94 |
|
|
|
95 |
|
|
diff = vmips->state.entrylo_d != ao->state.entrylo_d; show = show || diff;
|
96 |
|
|
ptr += sprintf(ptr, "entrylo_d |%c| %01x | %01x \n", (diff)? '*' : ' ', vmips->state.entrylo_d, ao->state.entrylo_d);
|
97 |
|
|
|
98 |
|
|
diff = vmips->state.entrylo_v != ao->state.entrylo_v; show = show || diff;
|
99 |
|
|
ptr += sprintf(ptr, "entrylo_v |%c| %01x | %01x \n", (diff)? '*' : ' ', vmips->state.entrylo_v, ao->state.entrylo_v);
|
100 |
|
|
|
101 |
|
|
diff = vmips->state.entrylo_g != ao->state.entrylo_g; show = show || diff;
|
102 |
|
|
ptr += sprintf(ptr, "entrylo_g |%c| %01x | %01x \n", (diff)? '*' : ' ', vmips->state.entrylo_g, ao->state.entrylo_g);
|
103 |
|
|
|
104 |
|
|
diff = vmips->state.context_ptebase != ao->state.context_ptebase; show = show || diff;
|
105 |
|
|
ptr += sprintf(ptr, "context_ptebase |%c| %03x | %03x \n", (diff)? '*' : ' ', vmips->state.context_ptebase, ao->state.context_ptebase);
|
106 |
|
|
|
107 |
|
|
diff = vmips->state.context_badvpn != ao->state.context_badvpn; show = show || diff;
|
108 |
|
|
ptr += sprintf(ptr, "context_badvpn |%c| %05x | %05x \n", (diff)? '*' : ' ', vmips->state.context_badvpn, ao->state.context_badvpn);
|
109 |
|
|
|
110 |
|
|
diff = vmips->state.bad_vaddr != ao->state.bad_vaddr; show = show || diff;
|
111 |
|
|
ptr += sprintf(ptr, "bad_vaddr |%c| %08x | %08x \n", (diff)? '*' : ' ', vmips->state.bad_vaddr, ao->state.bad_vaddr);
|
112 |
|
|
|
113 |
|
|
diff = vmips->state.entryhi_vpn != ao->state.entryhi_vpn; show = show || diff;
|
114 |
|
|
ptr += sprintf(ptr, "entryhi_vpn |%c| %05x | %05x \n", (diff)? '*' : ' ', vmips->state.entryhi_vpn, ao->state.entryhi_vpn);
|
115 |
|
|
|
116 |
|
|
diff = vmips->state.entryhi_asid != ao->state.entryhi_asid; show = show || diff;
|
117 |
|
|
ptr += sprintf(ptr, "entryhi_asid |%c| %02x | %02x \n", (diff)? '*' : ' ', vmips->state.entryhi_asid, ao->state.entryhi_asid);
|
118 |
|
|
|
119 |
|
|
diff = vmips->state.sr_cp_usable != ao->state.sr_cp_usable; show = show || diff;
|
120 |
|
|
ptr += sprintf(ptr, "sr_cp_usable |%c| %01x | %01x \n", (diff)? '*' : ' ', vmips->state.sr_cp_usable, ao->state.sr_cp_usable);
|
121 |
|
|
|
122 |
|
|
diff = vmips->state.sr_rev_endian != ao->state.sr_rev_endian; show = show || diff;
|
123 |
|
|
ptr += sprintf(ptr, "sr_rev_endian |%c| %01x | %01x \n", (diff)? '*' : ' ', vmips->state.sr_rev_endian, ao->state.sr_rev_endian);
|
124 |
|
|
|
125 |
|
|
diff = vmips->state.sr_bootstrap_vec != ao->state.sr_bootstrap_vec; show = show || diff;
|
126 |
|
|
ptr += sprintf(ptr, "sr_bootstrap_vec |%c| %01x | %01x \n", (diff)? '*' : ' ', vmips->state.sr_bootstrap_vec, ao->state.sr_bootstrap_vec);
|
127 |
|
|
|
128 |
|
|
diff = vmips->state.sr_tlb_shutdown != ao->state.sr_tlb_shutdown; show = show || diff;
|
129 |
|
|
ptr += sprintf(ptr, "sr_tlb_shutdown |%c| %01x | %01x \n", (diff)? '*' : ' ', vmips->state.sr_tlb_shutdown, ao->state.sr_tlb_shutdown);
|
130 |
|
|
|
131 |
|
|
diff = vmips->state.sr_parity_err != ao->state.sr_parity_err; show = show || diff;
|
132 |
|
|
ptr += sprintf(ptr, "sr_parity_err |%c| %01x | %01x \n", (diff)? '*' : ' ', vmips->state.sr_parity_err, ao->state.sr_parity_err);
|
133 |
|
|
|
134 |
|
|
diff = vmips->state.sr_cache_miss != ao->state.sr_cache_miss; show = show || diff;
|
135 |
|
|
ptr += sprintf(ptr, "sr_cache_miss |%c| %01x | %01x \n", (diff)? '*' : ' ', vmips->state.sr_cache_miss, ao->state.sr_cache_miss);
|
136 |
|
|
|
137 |
|
|
diff = vmips->state.sr_parity_zero != ao->state.sr_parity_zero; show = show || diff;
|
138 |
|
|
ptr += sprintf(ptr, "sr_parity_zero |%c| %01x | %01x \n", (diff)? '*' : ' ', vmips->state.sr_parity_zero, ao->state.sr_parity_zero);
|
139 |
|
|
|
140 |
|
|
diff = vmips->state.sr_switch_cache != ao->state.sr_switch_cache; show = show || diff;
|
141 |
|
|
ptr += sprintf(ptr, "sr_switch_cache |%c| %01x | %01x \n", (diff)? '*' : ' ', vmips->state.sr_switch_cache, ao->state.sr_switch_cache);
|
142 |
|
|
|
143 |
|
|
diff = vmips->state.sr_isolate_cache != ao->state.sr_isolate_cache; show = show || diff;
|
144 |
|
|
ptr += sprintf(ptr, "sr_isolate_cache |%c| %01x | %01x \n", (diff)? '*' : ' ', vmips->state.sr_isolate_cache, ao->state.sr_isolate_cache);
|
145 |
|
|
|
146 |
|
|
diff = vmips->state.sr_irq_mask != ao->state.sr_irq_mask; show = show || diff;
|
147 |
|
|
ptr += sprintf(ptr, "sr_irq_mask |%c| %02x | %02x \n", (diff)? '*' : ' ', vmips->state.sr_irq_mask, ao->state.sr_irq_mask);
|
148 |
|
|
|
149 |
|
|
diff = vmips->state.sr_ku_ie != ao->state.sr_ku_ie; show = show || diff;
|
150 |
|
|
ptr += sprintf(ptr, "sr_ku_ie |%c| %02x | %02x \n", (diff)? '*' : ' ', vmips->state.sr_ku_ie, ao->state.sr_ku_ie);
|
151 |
|
|
|
152 |
|
|
diff = vmips->state.cause_branch_delay != ao->state.cause_branch_delay; show = show || diff;
|
153 |
|
|
ptr += sprintf(ptr, "cause_branch_delay |%c| %01x | %01x \n", (diff)? '*' : ' ', vmips->state.cause_branch_delay, ao->state.cause_branch_delay);
|
154 |
|
|
|
155 |
|
|
diff = vmips->state.cause_cp_error != ao->state.cause_cp_error; show = show || diff;
|
156 |
|
|
ptr += sprintf(ptr, "cause_cp_error |%c| %01x | %01x \n", (diff)? '*' : ' ', vmips->state.cause_cp_error, ao->state.cause_cp_error);
|
157 |
|
|
|
158 |
|
|
diff = vmips->state.cause_irq_pending != ao->state.cause_irq_pending; show = show || diff;
|
159 |
|
|
ptr += sprintf(ptr, "cause_irq_pending |%c| %01x | %01x \n", (diff)? '*' : ' ', vmips->state.cause_irq_pending, ao->state.cause_irq_pending);
|
160 |
|
|
|
161 |
|
|
diff = vmips->state.cause_exc_code != ao->state.cause_exc_code; show = show || diff;
|
162 |
|
|
ptr += sprintf(ptr, "cause_exc_code |%c| %02x | %02x \n", (diff)? '*' : ' ', vmips->state.cause_exc_code, ao->state.cause_exc_code);
|
163 |
|
|
|
164 |
|
|
diff = vmips->state.epc != ao->state.epc; show = show || diff;
|
165 |
|
|
ptr += sprintf(ptr, "epc |%c| %08x | %08x \n", (diff)? '*' : ' ', vmips->state.epc, ao->state.epc);
|
166 |
|
|
|
167 |
|
|
for(int i=0; i<64; i++) {
|
168 |
|
|
diff = vmips->state.tlb[i].vpn != ao->state.tlb[i].vpn; show = show || diff;
|
169 |
|
|
ptr += sprintf(ptr, "tlb[%02d].vpn |%c| %05x | %05x \n", i, (diff)? '*' : ' ', vmips->state.tlb[i].vpn, ao->state.tlb[i].vpn);
|
170 |
|
|
|
171 |
|
|
diff = vmips->state.tlb[i].asid != ao->state.tlb[i].asid; show = show || diff;
|
172 |
|
|
ptr += sprintf(ptr, "tlb[%02d].asid |%c| %02x | %02x \n", i, (diff)? '*' : ' ', vmips->state.tlb[i].asid, ao->state.tlb[i].asid);
|
173 |
|
|
|
174 |
|
|
diff = vmips->state.tlb[i].pfn != ao->state.tlb[i].pfn; show = show || diff;
|
175 |
|
|
ptr += sprintf(ptr, "tlb[%02d].pfn |%c| %05x | %05x \n", i, (diff)? '*' : ' ', vmips->state.tlb[i].pfn, ao->state.tlb[i].pfn);
|
176 |
|
|
|
177 |
|
|
diff = vmips->state.tlb[i].n != ao->state.tlb[i].n; show = show || diff;
|
178 |
|
|
ptr += sprintf(ptr, "tlb[%02d].n |%c| %01x | %01x \n", i, (diff)? '*' : ' ', vmips->state.tlb[i].n, ao->state.tlb[i].n);
|
179 |
|
|
|
180 |
|
|
diff = vmips->state.tlb[i].d != ao->state.tlb[i].d; show = show || diff;
|
181 |
|
|
ptr += sprintf(ptr, "tlb[%02d].d |%c| %01x | %01x \n", i, (diff)? '*' : ' ', vmips->state.tlb[i].d, ao->state.tlb[i].d);
|
182 |
|
|
|
183 |
|
|
diff = vmips->state.tlb[i].v != ao->state.tlb[i].v; show = show || diff;
|
184 |
|
|
ptr += sprintf(ptr, "tlb[%02d].v |%c| %01x | %01x \n", i, (diff)? '*' : ' ', vmips->state.tlb[i].v, ao->state.tlb[i].v);
|
185 |
|
|
|
186 |
|
|
diff = vmips->state.tlb[i].g != ao->state.tlb[i].g; show = show || diff;
|
187 |
|
|
ptr += sprintf(ptr, "tlb[%02d].g |%c| %01x | %01x \n", i, (diff)? '*' : ' ', vmips->state.tlb[i].g, ao->state.tlb[i].g);
|
188 |
|
|
}
|
189 |
|
|
|
190 |
|
|
if(show) {
|
191 |
|
|
printf("%s", buf);
|
192 |
|
|
return true;
|
193 |
|
|
}
|
194 |
|
|
return false;
|
195 |
|
|
}
|
196 |
|
|
|
197 |
|
|
//------------------------------------------------------------------------------
|
198 |
|
|
|
199 |
|
|
//------------------------------------------------------------------------------
|
200 |
|
|
|
201 |
|
|
int main(int argc, char **argv) {
|
202 |
|
|
|
203 |
|
|
int int_ret;
|
204 |
|
|
|
205 |
|
|
//open file with truncate
|
206 |
|
|
FILE *fp = fopen("shared_mem.dat", "wb");
|
207 |
|
|
if(fp == NULL) {
|
208 |
|
|
perror("Can not truncate file shared_mem.dat");
|
209 |
|
|
return -1;
|
210 |
|
|
}
|
211 |
|
|
uint8 *buf = new uint8[sizeof(shared_mem_t)];
|
212 |
|
|
memset(buf, 0, sizeof(shared_mem_t));
|
213 |
|
|
|
214 |
|
|
int_ret = fwrite(buf, sizeof(shared_mem_t), 1, fp);
|
215 |
|
|
delete buf;
|
216 |
|
|
if(int_ret != 1) {
|
217 |
|
|
perror("Can not zero-fill file shared_mem.dat");
|
218 |
|
|
fclose(fp);
|
219 |
|
|
return -2;
|
220 |
|
|
}
|
221 |
|
|
fclose(fp);
|
222 |
|
|
|
223 |
|
|
//--------------------------------------------------------------------------
|
224 |
|
|
|
225 |
|
|
//map shared memory
|
226 |
|
|
int fd = open("./shared_mem.dat", O_RDWR, S_IRUSR | S_IWUSR);
|
227 |
|
|
|
228 |
|
|
if(fd == -1) {
|
229 |
|
|
perror("open() failed for shared_mem.dat");
|
230 |
|
|
return -3;
|
231 |
|
|
}
|
232 |
|
|
|
233 |
|
|
shared_ptr = (shared_mem_t *)mmap(NULL, sizeof(shared_mem_t), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
234 |
|
|
|
235 |
|
|
if(shared_ptr == MAP_FAILED) {
|
236 |
|
|
perror("mmap() failed");
|
237 |
|
|
close(fd);
|
238 |
|
|
return -4;
|
239 |
|
|
}
|
240 |
|
|
|
241 |
|
|
//--------------------------------------------------------------------------
|
242 |
|
|
|
243 |
|
|
srand(0);
|
244 |
|
|
|
245 |
|
|
while(true) {
|
246 |
|
|
//----------------------------------------------------------------------
|
247 |
|
|
memset((void *)shared_ptr, 0, sizeof(shared_mem_t));
|
248 |
|
|
|
249 |
|
|
//---------------------------------------------------------------------- run init function
|
250 |
|
|
|
251 |
|
|
if(tst_current->init != NULL) tst_current->init(tst_current, (shared_mem_t *)shared_ptr);
|
252 |
|
|
|
253 |
|
|
//----------------------------------------------------------------------
|
254 |
|
|
|
255 |
|
|
pid_t proc_vmips = fork();
|
256 |
|
|
if(proc_vmips == 0) {
|
257 |
|
|
system("cd ./../vmips && ./main_tester > ./vmips_output.txt");
|
258 |
|
|
return 0;
|
259 |
|
|
}
|
260 |
|
|
|
261 |
|
|
pid_t proc_ao = fork();
|
262 |
|
|
if(proc_ao == 0) {
|
263 |
|
|
system("cd ./../aoR3000 && ./obj_dir/VaoR3000 > ./ao_output.txt");
|
264 |
|
|
return 0;
|
265 |
|
|
}
|
266 |
|
|
|
267 |
|
|
//----------------------------------------------------------------------
|
268 |
|
|
|
269 |
|
|
printf("Waiting for init of vmips..."); fflush(stdout);
|
270 |
|
|
shared_ptr->proc_vmips.initialize_do = true;
|
271 |
|
|
|
272 |
|
|
while(shared_ptr->proc_vmips.initialize_do) usleep(1);
|
273 |
|
|
printf("done\n");
|
274 |
|
|
|
275 |
|
|
printf("Waiting for init of aoR3000..."); fflush(stdout);
|
276 |
|
|
shared_ptr->proc_ao.initialize_do = true;
|
277 |
|
|
|
278 |
|
|
while(shared_ptr->proc_ao.initialize_do) usleep(1);
|
279 |
|
|
printf("done\n");
|
280 |
|
|
|
281 |
|
|
while(true) {
|
282 |
|
|
if(shared_ptr->proc_vmips.report_do && shared_ptr->proc_ao.report_do) {
|
283 |
|
|
bool diff = is_diff(&(shared_ptr->proc_vmips.report), &(shared_ptr->proc_ao.report));
|
284 |
|
|
if(diff) {
|
285 |
|
|
printf("\nTEST FAILED. DIFF.\n");
|
286 |
|
|
shared_ptr->test_finished = true;
|
287 |
|
|
return -1;
|
288 |
|
|
}
|
289 |
|
|
if(shared_ptr->proc_vmips.report.exception == 1 && shared_ptr->proc_ao.report.exception == 1) {
|
290 |
|
|
printf("\nTEST OK.\n");
|
291 |
|
|
shared_ptr->test_finished = true;
|
292 |
|
|
break;
|
293 |
|
|
}
|
294 |
|
|
|
295 |
|
|
shared_ptr->proc_vmips.report_do = shared_ptr->proc_ao.report_do = false;
|
296 |
|
|
printf("check ok\n");
|
297 |
|
|
}
|
298 |
|
|
|
299 |
|
|
while(shared_ptr->proc_vmips.write_do || shared_ptr->proc_ao.write_do) {
|
300 |
|
|
if(shared_ptr->proc_vmips.write_do && shared_ptr->proc_ao.write_do) {
|
301 |
|
|
|
302 |
|
|
if( shared_ptr->proc_vmips.write_address == shared_ptr->proc_ao.write_address &&
|
303 |
|
|
shared_ptr->proc_vmips.write_byteenable == shared_ptr->proc_ao.write_byteenable &&
|
304 |
|
|
shared_ptr->proc_vmips.write_data == shared_ptr->proc_ao.write_data)
|
305 |
|
|
{
|
306 |
|
|
printf("write: %08x %01x %08x\n", shared_ptr->proc_vmips.write_address, shared_ptr->proc_vmips.write_byteenable, shared_ptr->proc_vmips.write_data);
|
307 |
|
|
|
308 |
|
|
uint32 byteena = shared_ptr->proc_vmips.write_byteenable;
|
309 |
|
|
uint32 value = shared_ptr->proc_vmips.write_data;
|
310 |
|
|
|
311 |
|
|
for(uint32 i=0; i<4; i++) {
|
312 |
|
|
if(byteena & 1) shared_ptr->mem.bytes[shared_ptr->proc_vmips.write_address + i] = value & 0xFF;
|
313 |
|
|
value >>= 8;
|
314 |
|
|
byteena >>= 1;
|
315 |
|
|
}
|
316 |
|
|
|
317 |
|
|
shared_ptr->proc_vmips.write_do = false;
|
318 |
|
|
shared_ptr->proc_ao.write_do = false;
|
319 |
|
|
}
|
320 |
|
|
else {
|
321 |
|
|
printf("vmips: %08x %01x %08x\n", shared_ptr->proc_vmips.write_address, shared_ptr->proc_vmips.write_byteenable, shared_ptr->proc_vmips.write_data);
|
322 |
|
|
printf("ao: %08x %01x %08x\n", shared_ptr->proc_ao.write_address, shared_ptr->proc_ao.write_byteenable, shared_ptr->proc_ao.write_data);
|
323 |
|
|
|
324 |
|
|
printf("\nTEST FAILED. MEM WRITE DIFF.\n");
|
325 |
|
|
shared_ptr->test_finished = true;
|
326 |
|
|
return -1;
|
327 |
|
|
}
|
328 |
|
|
}
|
329 |
|
|
}
|
330 |
|
|
}
|
331 |
|
|
|
332 |
|
|
//---------------------------------------------------------------------- wait for process end
|
333 |
|
|
waitpid(proc_vmips, NULL, 0);
|
334 |
|
|
waitpid(proc_ao, NULL, 0);
|
335 |
|
|
}
|
336 |
|
|
return 0;
|
337 |
|
|
}
|
338 |
|
|
|
339 |
|
|
//------------------------------------------------------------------------------
|