aboutsummaryrefslogtreecommitdiff
path: root/test/ui/v1/mbops/ui.c
blob: 8a92d6f085c4bdde6027778cac8863f8de52d2fb (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
#if !defined(COMMAND_NEW)
#error
#endif

int main(void) {
    salis_init();

    while (g_cores->pvec->ip < ANC_SIZE) {
        bool on_swap = mvec_get_inst(g_cores, g_cores->pvec->ip) == bswp;
        bool on_clear = mvec_get_inst(g_cores, g_cores->pvec->ip) == bclr;

        uint64_t mb0a = g_cores->pvec->mb0a;
        uint64_t mb0s = g_cores->pvec->mb0s;
        uint64_t mb1a = g_cores->pvec->mb1a;
        uint64_t mb1s = g_cores->pvec->mb1s;

        salis_step(1);

        if (on_swap) {
            if (mb1s) {
                assert(g_cores->pvec->mb0a == mb1a);
                assert(g_cores->pvec->mb0s == mb1s);
                assert(g_cores->pvec->mb1a == mb0a);
                assert(g_cores->pvec->mb1s == mb0s);
            }
        }

        if (on_clear) {
            assert(g_cores->pvec->mb1a == 0);
            assert(g_cores->pvec->mb1s == 0);
        }
    }

    salis_free();
    return 0;
}