aboutsummaryrefslogtreecommitdiff
path: root/bench.j2.c
blob: e78861fbb42912d691c2f5a7d3e2c37197e8403b (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
// Author:  Paul Oliver <contact@pauloliver.dev>
// Project: Salis

// Simple benchmark test helps measure simulation speed.
// Steps the simulation N times and prints part of the simulator's state.

void log_impl(const char *format, ...) {
    va_list args;
    va_start(args, format);
    vprintf(format, args);
    va_end(args);
}

int main() {
    g_info = log_impl;
    g_warn = log_impl;

    g_info("Salis Benchmark Test\n\n");

    salis_init();
    salis_step({{ args.steps }});

    g_info("seed        => %#lx\n", {{ args.seed }});
    g_info("g_steps     => %#lx\n", g_steps);
    g_info("g_syncs     => %#lx\n", g_syncs);

    for (int i = 0; i < {{ args.cores }}; ++i) {
        g_info("\n");
        g_info("core %d mall => %#lx\n", i, g_cores[i].mall);
        g_info("core %d mut0 => %#lx\n", i, g_cores[i].muta[0]);
        g_info("core %d mut1 => %#lx\n", i, g_cores[i].muta[1]);
        g_info("core %d mut2 => %#lx\n", i, g_cores[i].muta[2]);
        g_info("core %d mut3 => %#lx\n", i, g_cores[i].muta[3]);
        g_info("core %d pnum => %#lx\n", i, g_cores[i].pnum);
        g_info("core %d pcap => %#lx\n", i, g_cores[i].pcap);
        g_info("core %d pfst => %#lx\n", i, g_cores[i].pfst);
        g_info("core %d plst => %#lx\n", i, g_cores[i].plst);
        g_info("core %d pcur => %#lx\n", i, g_cores[i].pcur);
        g_info("core %d psli => %#lx\n", i, g_cores[i].psli);
        g_info("core %d cycl => %#lx\n", i, g_cores[i].cycl);
        g_info("core %d ivpt => %#lx\n", i, g_cores[i].ivpt);
        g_info("\n");

        for (int j = 0; j < 32; ++j) {
            g_info("%02x ", g_cores[i].mvec[j]);
        }

        g_info("\n");
    }

    salis_free();
}