aboutsummaryrefslogtreecommitdiff
path: root/test/ui/v1/2rops/ui.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/ui/v1/2rops/ui.c')
-rw-r--r--test/ui/v1/2rops/ui.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/ui/v1/2rops/ui.c b/test/ui/v1/2rops/ui.c
new file mode 100644
index 0000000..5fcf65f
--- /dev/null
+++ b/test/ui/v1/2rops/ui.c
@@ -0,0 +1,46 @@
+#if !defined(COMMAND_NEW)
+#error
+#endif
+
+int main(void) {
+ salis_init();
+
+ 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);
+
+ if (inst != dupl && inst != swap) {
+ salis_step(1);
+ continue;
+ }
+
+ uint64_t *regs[2] = {
+ &g_cores->pvec->r0x,
+ &g_cores->pvec->r0x,
+ };
+
+ for (uint64_t i = 0; i < 2; i++) {
+ uint8_t rmod = mvec_get_inst(g_cores, g_cores->pvec->ip + 1 + i);
+ if (rmod == nop0) regs[i] = &g_cores->pvec->r0x;
+ else if (rmod == nop1) regs[i] = &g_cores->pvec->r1x;
+ else if (rmod == nop2) regs[i] = &g_cores->pvec->r2x;
+ else if (rmod == nop3) regs[i] = &g_cores->pvec->r3x;
+ else break;
+ }
+
+ uint64_t reg_vals[2] = {*regs[0], *regs[1]};
+ salis_step(1);
+
+ switch (inst) {
+ case dupl:
+ assert(*regs[1] == reg_vals[0]);
+ break;
+ case swap:
+ assert(*regs[0] == reg_vals[1]);
+ assert(*regs[1] == reg_vals[0]);
+ break;
+ }
+ }
+
+ salis_free();
+ return 0;
+}