blob: 230e98da6b9682fe79ebcbb5b8ec833d0d7870a7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
#if !defined(COMMAND_NEW)
#error
#endif
void check_invariants(void) {
assert(g_cores->mall == ANC_SIZE);
assert(g_cores->muta[0] == 0);
assert(g_cores->muta[1] == 0);
assert(g_cores->muta[2] == 0);
assert(g_cores->muta[3] == 0);
assert(g_cores->pnum == 1);
assert(g_cores->pcap == 1);
assert(g_cores->pfst == 0);
assert(g_cores->plst == 0);
assert(g_cores->pcur == 0);
assert(g_cores->psli == 0);
for (uint64_t i = 0; i < SYNC_INTERVAL; i++) {
assert(g_cores->ivav[i] == 0);
assert(g_cores->iviv[i] == 0);
}
assert(g_cores->emb1 == 0);
assert(g_cores->eliv == 0);
assert(g_cores->edea == 0);
for (uint64_t i = 0; i < MVEC_SIZE; i++) {
assert(g_cores->aeva[i] == 0);
assert(g_cores->beva[i] == 0);
}
for (uint64_t i = 0; i < INST_COUNT; i++) {
assert(g_cores->ipop[i] == 0);
assert(g_cores->iwrt[i] == 0);
}
assert(g_cores->wmb0 == 0);
assert(g_cores->wmb1 == 0);
assert(g_cores->wdea == 0);
for (uint64_t i = 0; i < MVEC_SIZE; i++) {
assert(g_cores->weva[i] == 0);
assert(g_cores->xeva[i] == 0);
}
assert(g_cores->pvec->mb0a == 0);
assert(g_cores->pvec->mb0s == ANC_SIZE);
assert(g_cores->pvec->mb1a == 0);
assert(g_cores->pvec->mb1s == 0);
assert(g_cores->pvec->r0x == 0);
assert(g_cores->pvec->r1x == 0);
assert(g_cores->pvec->r2x == 0);
assert(g_cores->pvec->r3x == 0);
assert(g_cores->pvec->s0 == 0);
assert(g_cores->pvec->s1 == 0);
assert(g_cores->pvec->s2 == 0);
assert(g_cores->pvec->s3 == 0);
assert(g_cores->pvec->s4 == 0);
assert(g_cores->pvec->s5 == 0);
assert(g_cores->pvec->s6 == 0);
assert(g_cores->pvec->s7 == 0);
}
void check_variants(uint64_t step) {
assert(g_cores->cycl == step);
assert(g_cores->ivpt == step);
assert(g_cores->emb0 == step);
for (uint64_t i = 0; i < MVEC_SIZE; i++) {
assert(g_cores->eeva[i] == (i < step ? 1 : 0));
}
for (uint64_t i = 0; i < INST_COUNT; i++) {
uint64_t exed = 0;
for (uint64_t j = 0; j < step; j++) {
if (mvec_get_inst(g_cores, j) == i) {
exed = 1;
}
}
assert(g_cores->iexe[i] == exed);
}
assert(g_cores->pvec->ip == step);
assert(g_cores->pvec->sp == step);
}
void check_final(void) {
assert(g_cores->pvec->ip == ANC_SIZE);
assert(g_cores->pvec->sp == ANC_SIZE);
}
int main(void) {
uint64_t step = 0;
salis_init();
check_invariants();
check_variants(step);
while (mvec_is_proc_owner(g_cores, g_cores->pvec->ip, g_cores->pcur)) {
salis_step(1);
step++;
check_invariants();
check_variants(step);
}
check_final();
salis_free();
return 0;
}
|