From e422518afc868a1ad783c4208ea3a44f89f07687 Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Sun, 28 Jun 2026 02:58:56 +0200 Subject: Renames dummy VM architecture --- anc/dummy/0123.asm | 4 -- anc/null/0123.asm | 4 ++ arch/dummy/arch.c | 159 --------------------------------------------------- arch/dummy/plots.cpp | 5 -- arch/dummy/vars.py | 19 ------ arch/null/arch.c | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++ arch/null/plots.cpp | 5 ++ arch/null/vars.py | 19 ++++++ salis.py | 2 +- test/test_build.py | 16 +++--- 10 files changed, 196 insertions(+), 196 deletions(-) delete mode 100644 anc/dummy/0123.asm create mode 100644 anc/null/0123.asm delete mode 100644 arch/dummy/arch.c delete mode 100644 arch/dummy/plots.cpp delete mode 100644 arch/dummy/vars.py create mode 100644 arch/null/arch.c create mode 100644 arch/null/plots.cpp create mode 100644 arch/null/vars.py diff --git a/anc/dummy/0123.asm b/anc/dummy/0123.asm deleted file mode 100644 index d52a6a6..0000000 --- a/anc/dummy/0123.asm +++ /dev/null @@ -1,4 +0,0 @@ -dummy 00 -dummy 01 -dummy 02 -dummy 03 diff --git a/anc/null/0123.asm b/anc/null/0123.asm new file mode 100644 index 0000000..396e572 --- /dev/null +++ b/anc/null/0123.asm @@ -0,0 +1,4 @@ +null 00 +null 01 +null 02 +null 03 diff --git a/arch/dummy/arch.c b/arch/dummy/arch.c deleted file mode 100644 index 1fcfbc3..0000000 --- a/arch/dummy/arch.c +++ /dev/null @@ -1,159 +0,0 @@ -#if defined(COMMAND_NEW) -void arch_core_init(struct Core *core) { - assert(core); - -#if defined(MVEC_LOOP) - uint64_t addr = UINT64_HALF; -#else - uint64_t addr = 0; -#endif - - for (uint64_t i = 0; i < CLONES; ++i) { - uint64_t addr_clone = addr + (MVEC_SIZE / CLONES) * i; - - struct Proc *panc = proc_fetch(core, i); - - panc->mb0a = addr_clone; - panc->mb0s = ANC_SIZE; - panc->ip = addr_clone; - panc->sp = addr_clone; - } -} -#endif - -void arch_core_free(struct Core *core) { - assert(core); - - (void)core; -} - -#if defined(COMMAND_NEW) || defined(COMMAND_LOAD) -void arch_core_save(FILE *f, const struct Core *core) { - assert(f); - assert(core); - - (void)f; - (void)core; -} -#endif - -#if defined(COMMAND_LOAD) -void arch_core_load(FILE *f, struct Core *core) { - assert(f); - assert(core); - - (void)f; - (void)core; -} -#endif - -uint64_t arch_proc_mb0_addr(const struct Core *core, uint64_t pix) { - assert(core); - assert(mvec_proc_is_live(core, pix)); - return proc_get(core, pix)->mb0a; -} - -uint64_t arch_proc_mb0_size(const struct Core *core, uint64_t pix) { - assert(core); - assert(mvec_proc_is_live(core, pix)); - return proc_get(core, pix)->mb0s; -} - -uint64_t arch_proc_mb1_addr(const struct Core *core, uint64_t pix) { - assert(core); - assert(mvec_proc_is_live(core, pix)); - return proc_get(core, pix)->mb1a; -} - -uint64_t arch_proc_mb1_size(const struct Core *core, uint64_t pix) { - assert(core); - assert(mvec_proc_is_live(core, pix)); - return proc_get(core, pix)->mb1s; -} - -uint64_t arch_proc_ip_addr(const struct Core *core, uint64_t pix) { - assert(core); - assert(mvec_proc_is_live(core, pix)); - return proc_get(core, pix)->ip; -} - -uint64_t arch_proc_sp_addr(const struct Core *core, uint64_t pix) { - assert(core); - assert(mvec_proc_is_live(core, pix)); - return proc_get(core, pix)->sp; -} - -uint64_t arch_proc_slice(const struct Core *core, uint64_t pix) { - assert(core); - assert(mvec_proc_is_live(core, pix)); - - (void)core; - (void)pix; - - return 1; -} - -void arch_on_proc_kill(struct Core *core) { - assert(core); - assert(core->pnum > 1); - - (void)core; -} - -void arch_proc_step(struct Core *core, uint64_t pix) { - assert(core); - assert(mvec_proc_is_live(core, pix)); - - (void)core; - (void)pix; - - return; -} - -#if !defined(NDEBUG) -void arch_validate_proc(const struct Core *core, uint64_t pix) { - assert(core); - assert(mvec_proc_is_live(core, pix)); - - (void)core; - (void)pix; - - assert(true); -} -#endif - -wchar_t arch_symbol(uint8_t inst) { - switch (inst) { -#define INST(core, pref, index, label, mnemonic, symbol) case index: return symbol; - INST_SET(core, pref) -#undef INST - } - - assert(false); - return L'\0'; -} - -const char *arch_mnemonic(uint8_t inst) { - switch (inst) { -#define INST(core, pref, index, label, mnemonic, symbol) case index: return mnemonic; - INST_SET(core, pref) -#undef INST - } - - assert(false); - return NULL; -} - -#if defined(COMMAND_NEW) -void arch_push_data_header(void) { - assert(g_sim_db); - log_info("Creating arch table in SQLite database"); - sql_exec(0, NULL, NULL, NULL, NULL, "create table arch (step int not null);"); -} -#endif - -void arch_push_data_line(void) { - assert(g_sim_db); - log_info("Pushing row to arch table in SQLite database"); - sql_exec(0, NULL, NULL, NULL, NULL, "insert into arch (step) values (%ld);", g_steps); -} diff --git a/arch/dummy/plots.cpp b/arch/dummy/plots.cpp deleted file mode 100644 index 8cece2f..0000000 --- a/arch/dummy/plots.cpp +++ /dev/null @@ -1,5 +0,0 @@ -std::array, 0> g_arch_traces = {}; -std::array, 0> g_arch_traces_heatmaps = {}; -std::array g_arch_plots = {}; -std::array g_arch_plots_stacked = {}; -std::array g_arch_plots_heatmaps = {}; diff --git a/arch/dummy/vars.py b/arch/dummy/vars.py deleted file mode 100644 index fce888a..0000000 --- a/arch/dummy/vars.py +++ /dev/null @@ -1,19 +0,0 @@ -inst_set = [(["dummy", f"{i:02x}"], symbol) for i, symbol in enumerate( - "⠀⠁⠂⠃⠄⠅⠆⠇⡀⡁⡂⡃⡄⡅⡆⡇⠈⠉⠊⠋⠌⠍⠎⠏⡈⡉⡊⡋⡌⡍⡎⡏⠐⠑⠒⠓⠔⠕⠖⠗⡐⡑⡒⡓⡔⡕⡖⡗⠘⠙⠚⠛⠜⠝⠞⠟⡘⡙⡚⡛⡜⡝⡞⡟" - "⠠⠡⠢⠣⠤⠥⠦⠧⡠⡡⡢⡣⡤⡥⡦⡧⠨⠩⠪⠫⠬⠭⠮⠯⡨⡩⡪⡫⡬⡭⡮⡯⠰⠱⠲⠳⠴⠵⠶⠷⡰⡱⡲⡳⡴⡵⡶⡷⠸⠹⠺⠻⠼⠽⠾⠿⡸⡹⡺⡻⡼⡽⡾⡿" - "⢀⢁⢂⢃⢄⢅⢆⢇⣀⣁⣂⣃⣄⣅⣆⣇⢈⢉⢊⢋⢌⢍⢎⢏⣈⣉⣊⣋⣌⣍⣎⣏⢐⢑⢒⢓⢔⢕⢖⢗⣐⣑⣒⣓⣔⣕⣖⣗⢘⢙⢚⢛⢜⢝⢞⢟⣘⣙⣚⣛⣜⣝⣞⣟" - "⢠⢡⢢⢣⢤⢥⢦⢧⣠⣡⣢⣣⣤⣥⣦⣧⢨⢩⢪⢫⢬⢭⢮⢯⣨⣩⣪⣫⣬⣭⣮⣯⢰⢱⢲⢳⢴⢵⢶⢷⣰⣱⣲⣳⣴⣵⣶⣷⢸⢹⢺⢻⢼⢽⢾⢿⣸⣹⣺⣻⣼⣽⣾⣿" -)] - -core_data_fields = [] -core_fields = [] -muta_flip = False -mvec_loop = True -proc_fields = [ - ("uint64_t", "ip"), - ("uint64_t", "sp"), - ("uint64_t", "mb0a"), - ("uint64_t", "mb0s"), - ("uint64_t", "mb1a"), - ("uint64_t", "mb1s"), -] diff --git a/arch/null/arch.c b/arch/null/arch.c new file mode 100644 index 0000000..1fcfbc3 --- /dev/null +++ b/arch/null/arch.c @@ -0,0 +1,159 @@ +#if defined(COMMAND_NEW) +void arch_core_init(struct Core *core) { + assert(core); + +#if defined(MVEC_LOOP) + uint64_t addr = UINT64_HALF; +#else + uint64_t addr = 0; +#endif + + for (uint64_t i = 0; i < CLONES; ++i) { + uint64_t addr_clone = addr + (MVEC_SIZE / CLONES) * i; + + struct Proc *panc = proc_fetch(core, i); + + panc->mb0a = addr_clone; + panc->mb0s = ANC_SIZE; + panc->ip = addr_clone; + panc->sp = addr_clone; + } +} +#endif + +void arch_core_free(struct Core *core) { + assert(core); + + (void)core; +} + +#if defined(COMMAND_NEW) || defined(COMMAND_LOAD) +void arch_core_save(FILE *f, const struct Core *core) { + assert(f); + assert(core); + + (void)f; + (void)core; +} +#endif + +#if defined(COMMAND_LOAD) +void arch_core_load(FILE *f, struct Core *core) { + assert(f); + assert(core); + + (void)f; + (void)core; +} +#endif + +uint64_t arch_proc_mb0_addr(const struct Core *core, uint64_t pix) { + assert(core); + assert(mvec_proc_is_live(core, pix)); + return proc_get(core, pix)->mb0a; +} + +uint64_t arch_proc_mb0_size(const struct Core *core, uint64_t pix) { + assert(core); + assert(mvec_proc_is_live(core, pix)); + return proc_get(core, pix)->mb0s; +} + +uint64_t arch_proc_mb1_addr(const struct Core *core, uint64_t pix) { + assert(core); + assert(mvec_proc_is_live(core, pix)); + return proc_get(core, pix)->mb1a; +} + +uint64_t arch_proc_mb1_size(const struct Core *core, uint64_t pix) { + assert(core); + assert(mvec_proc_is_live(core, pix)); + return proc_get(core, pix)->mb1s; +} + +uint64_t arch_proc_ip_addr(const struct Core *core, uint64_t pix) { + assert(core); + assert(mvec_proc_is_live(core, pix)); + return proc_get(core, pix)->ip; +} + +uint64_t arch_proc_sp_addr(const struct Core *core, uint64_t pix) { + assert(core); + assert(mvec_proc_is_live(core, pix)); + return proc_get(core, pix)->sp; +} + +uint64_t arch_proc_slice(const struct Core *core, uint64_t pix) { + assert(core); + assert(mvec_proc_is_live(core, pix)); + + (void)core; + (void)pix; + + return 1; +} + +void arch_on_proc_kill(struct Core *core) { + assert(core); + assert(core->pnum > 1); + + (void)core; +} + +void arch_proc_step(struct Core *core, uint64_t pix) { + assert(core); + assert(mvec_proc_is_live(core, pix)); + + (void)core; + (void)pix; + + return; +} + +#if !defined(NDEBUG) +void arch_validate_proc(const struct Core *core, uint64_t pix) { + assert(core); + assert(mvec_proc_is_live(core, pix)); + + (void)core; + (void)pix; + + assert(true); +} +#endif + +wchar_t arch_symbol(uint8_t inst) { + switch (inst) { +#define INST(core, pref, index, label, mnemonic, symbol) case index: return symbol; + INST_SET(core, pref) +#undef INST + } + + assert(false); + return L'\0'; +} + +const char *arch_mnemonic(uint8_t inst) { + switch (inst) { +#define INST(core, pref, index, label, mnemonic, symbol) case index: return mnemonic; + INST_SET(core, pref) +#undef INST + } + + assert(false); + return NULL; +} + +#if defined(COMMAND_NEW) +void arch_push_data_header(void) { + assert(g_sim_db); + log_info("Creating arch table in SQLite database"); + sql_exec(0, NULL, NULL, NULL, NULL, "create table arch (step int not null);"); +} +#endif + +void arch_push_data_line(void) { + assert(g_sim_db); + log_info("Pushing row to arch table in SQLite database"); + sql_exec(0, NULL, NULL, NULL, NULL, "insert into arch (step) values (%ld);", g_steps); +} diff --git a/arch/null/plots.cpp b/arch/null/plots.cpp new file mode 100644 index 0000000..8cece2f --- /dev/null +++ b/arch/null/plots.cpp @@ -0,0 +1,5 @@ +std::array, 0> g_arch_traces = {}; +std::array, 0> g_arch_traces_heatmaps = {}; +std::array g_arch_plots = {}; +std::array g_arch_plots_stacked = {}; +std::array g_arch_plots_heatmaps = {}; diff --git a/arch/null/vars.py b/arch/null/vars.py new file mode 100644 index 0000000..edc5b66 --- /dev/null +++ b/arch/null/vars.py @@ -0,0 +1,19 @@ +inst_set = [(["null", f"{i:02x}"], symbol) for i, symbol in enumerate( + "⠀⠁⠂⠃⠄⠅⠆⠇⡀⡁⡂⡃⡄⡅⡆⡇⠈⠉⠊⠋⠌⠍⠎⠏⡈⡉⡊⡋⡌⡍⡎⡏⠐⠑⠒⠓⠔⠕⠖⠗⡐⡑⡒⡓⡔⡕⡖⡗⠘⠙⠚⠛⠜⠝⠞⠟⡘⡙⡚⡛⡜⡝⡞⡟" + "⠠⠡⠢⠣⠤⠥⠦⠧⡠⡡⡢⡣⡤⡥⡦⡧⠨⠩⠪⠫⠬⠭⠮⠯⡨⡩⡪⡫⡬⡭⡮⡯⠰⠱⠲⠳⠴⠵⠶⠷⡰⡱⡲⡳⡴⡵⡶⡷⠸⠹⠺⠻⠼⠽⠾⠿⡸⡹⡺⡻⡼⡽⡾⡿" + "⢀⢁⢂⢃⢄⢅⢆⢇⣀⣁⣂⣃⣄⣅⣆⣇⢈⢉⢊⢋⢌⢍⢎⢏⣈⣉⣊⣋⣌⣍⣎⣏⢐⢑⢒⢓⢔⢕⢖⢗⣐⣑⣒⣓⣔⣕⣖⣗⢘⢙⢚⢛⢜⢝⢞⢟⣘⣙⣚⣛⣜⣝⣞⣟" + "⢠⢡⢢⢣⢤⢥⢦⢧⣠⣡⣢⣣⣤⣥⣦⣧⢨⢩⢪⢫⢬⢭⢮⢯⣨⣩⣪⣫⣬⣭⣮⣯⢰⢱⢲⢳⢴⢵⢶⢷⣰⣱⣲⣳⣴⣵⣶⣷⢸⢹⢺⢻⢼⢽⢾⢿⣸⣹⣺⣻⣼⣽⣾⣿" +)] + +core_data_fields = [] +core_fields = [] +muta_flip = False +mvec_loop = True +proc_fields = [ + ("uint64_t", "ip"), + ("uint64_t", "sp"), + ("uint64_t", "mb0a"), + ("uint64_t", "mb0s"), + ("uint64_t", "mb1a"), + ("uint64_t", "mb1s"), +] diff --git a/salis.py b/salis.py index f86cd2e..4fe102b 100755 --- a/salis.py +++ b/salis.py @@ -92,7 +92,7 @@ options = { (("u", "ui"), (new, load), fmt_id): {"metavar": "UI", "help": "user interface", "default": "curses", "required": False, "type": str}, (("U", "ui-path"), (new, load), fmt_id): {"metavar": "PATH", "help": "path to search for UIs", "default": "ui", "required": False, "type": str}, (("v", "no-vsync"), (client,), fmt_id): {"action": "store_true", "help": "disable vsync", "required": False}, - (("v", "vm-arch"), (new,), fmt_id): {"metavar": "ARCH", "help": "VM architecture", "default": "dummy", "required": False, "type": str}, + (("v", "vm-arch"), (new,), fmt_id): {"metavar": "ARCH", "help": "VM architecture", "default": "null", "required": False, "type": str}, (("x", "cpp-compiler"), (client,), fmt_id): {"metavar": "CXX", "help": "C++ compiler to use", "default": "g++", "required": False, "type": str}, (("X", "cpp-compiler-flags"), (client,), fmt_id): {"metavar": "FLAGS", "help": "base set of flags to pass to C++ compiler", "default": "-Wall -Wextra -Werror -pedantic -std=c++20 -lstdc++", "required": False, "type": str}, (("y", "sync-pow"), (new,), fmt_id): {"metavar": "POW", "help": "core sync interval exponent; sync events occur every N steps, where N = 2^{POW}", "default": 20, "required": False, "type": pos}, diff --git a/test/test_build.py b/test/test_build.py index e0fecef..a57c09d 100644 --- a/test/test_build.py +++ b/test/test_build.py @@ -12,8 +12,8 @@ class TestBuild(SalisTest): for ui in ["curses", "daemon"] ) - def cmds_new_dummy(self): - return self.cmds_new("0123", "dummy") + def cmds_new_null(self): + return self.cmds_new("0123", "null") def cmds_new_v1(self): return self.cmds_new("55a", "v1") @@ -41,16 +41,16 @@ class TestBuild(SalisTest): for optimized in ["", "-o"] ) - def test_dummy_new(self): - for cmd in self.cmds_new_dummy(): + def test_null_new(self): + for cmd in self.cmds_new_null(): SalisTest.run_subprocess(cmd) def test_v1_new(self): for cmd in self.cmds_new_v1(): SalisTest.run_subprocess(cmd) - def test_dummy_load(self): - SalisTest.run_subprocess(next(self.cmds_new_dummy())) + def test_null_load(self): + SalisTest.run_subprocess(next(self.cmds_new_null())) for cmd in self.cmds_load(): SalisTest.run_subprocess(cmd) @@ -62,12 +62,12 @@ class TestBuild(SalisTest): SalisTest.run_subprocess(cmd) def test_server(self): - SalisTest.run_subprocess(next(self.cmds_new_dummy())) + SalisTest.run_subprocess(next(self.cmds_new_null())) for cmd in self.cmds_server(): SalisTest.run_subprocess(cmd) - @SalisTest.run_ui_test(anc="0123", anc_path="anc", name="def.sim", ui="null", ui_path="test/ui", vm_arch="dummy") + @SalisTest.run_ui_test(anc="0123", anc_path="anc", name="def.sim", ui="null", ui_path="test/ui", vm_arch="null") def test_client(self): with SalisTest.run_pipe(f"./salis.py server -H{self.tempdir.name}") as server_proc: for line in server_proc.stdout: -- cgit v1.2.1