diff options
| author | Paul Oliver <contact@pauloliver.dev> | 2026-02-24 01:33:45 +0100 |
|---|---|---|
| committer | Paul Oliver <contact@pauloliver.dev> | 2026-02-24 01:33:45 +0100 |
| commit | 9f7e70904e6c0fa650323ac5e50ebf6003da333c (patch) | |
| tree | 3015be498d36e8d5c960cf55667c6c825f7de493 /arch/dummy/arch.j2.c | |
| parent | 0fb1497a62332e0db45f94b4f195cb37183678cb (diff) | |
Removes usage of Jinja templates
Use CPP to pre-process C files instead
Diffstat (limited to 'arch/dummy/arch.j2.c')
| -rw-r--r-- | arch/dummy/arch.j2.c | 156 |
1 files changed, 0 insertions, 156 deletions
diff --git a/arch/dummy/arch.j2.c b/arch/dummy/arch.j2.c deleted file mode 100644 index f51494f..0000000 --- a/arch/dummy/arch.j2.c +++ /dev/null @@ -1,156 +0,0 @@ -// Author: Paul Oliver <contact@pauloliver.dev> -// Project: salis-v3 - -// Defines a minimal viable architecture for the Salis VM. -// Useful for debugging and benchmarking. May be used as a template when -// implementing a new architecture. - -{% if args.command in ["bench", "new"] and anc_bytes is defined %} -void arch_core_init(struct Core *core) { - assert(core); - - {% if arch_vars.mvec_loop %} - uint64_t addr = {{ uint64_half }}; - {% else %} - uint64_t addr = 0; - {% endif %} - - for (uint64_t i = 0; i < {{ args.clones }}; ++i) { - uint64_t addr_clone = addr + (({{ mvec_size }} / {{ args.clones }})) * i; - - struct Proc *panc = proc_fetch(core, i); - - panc->mb0a = addr_clone; - panc->mb0s = {{ anc_bytes|length }}; - panc->ip = addr_clone; - panc->sp = addr_clone; - } -} -{% endif %} - -void arch_core_free(struct Core *core) { - assert(core); - - (void)core; -} - -{% if args.command in ["load", "new"] %} -void arch_core_save(FILE *f, const struct Core *core) { - assert(f); - assert(core); - - (void)f; - (void)core; -} -{% endif %} - -{% if args.command in ["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 not args.optimized %} -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) { - {% for i in arch_vars.inst_set %} - case {{ loop.index0 }}: return L'{{ i[1] }}'; - {% endfor %} - } -} - -const char *arch_mnemonic(uint8_t inst) { - switch (inst) { - {% for i in arch_vars.inst_set %} - case {{ loop.index0 }}: return "{{ i[0]|join(' ') }}"; - {% endfor %} - } -} - -{% if data_push_path is defined %} -void arch_push_data_header() { - assert(g_sim_data); -} - -void arch_push_data_line() { - assert(g_sim_data); -} -{% endif %} |
