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

void check_found(uint64_t addr, uint64_t lok, uint64_t regi) {
    assert(mvec_get_inst(g_cores, addr - 1) == (regi % 2 == 0 ? adrf : adrb));
    assert(mvec_get_inst(g_cores, (&g_cores->pvec->r0x)[regi]) == lok);
}

int main(void) {
    salis_init();
    uint64_t regi = 0;

    while (mvec_is_proc_owner(g_cores, g_cores->pvec->ip, g_cores->pcur)) {
        uint8_t inst = mvec_get_inst(g_cores, g_cores->pvec->ip);

        switch (inst) {
#define CASE(id) \
        case key##id: \
            check_found(g_cores->pvec->ip, lok##id, regi); \
            regi = (regi + 1) % 4; \
            break;
        CASE(a)
        CASE(b)
        CASE(c)
        CASE(d)
        CASE(e)
        CASE(f)
        CASE(g)
        CASE(h)
        CASE(i)
        CASE(j)
        CASE(k)
        CASE(l)
        CASE(m)
        CASE(n)
        CASE(o)
        CASE(p)
#undef CASE
        }

        salis_step(1);
    }

    salis_free();
    return 0;
}