diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-10-29 14:38:33 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-10-29 14:38:33 +0200 |
| commit | 5d29afb530ffdaab4b5032b7422da988b31c0867 (patch) | |
| tree | 0135976b951fa4c860a043f07e6d555e40c60d1f /triscv/src/mem.c | |
| parent | 80d78c5589d42f81b04e671b28c103a2112458d1 (diff) | |
| download | tri-5d29afb530ffdaab4b5032b7422da988b31c0867.tar.gz tri-5d29afb530ffdaab4b5032b7422da988b31c0867.zip | |
initial working compiled program on simulator
Diffstat (limited to 'triscv/src/mem.c')
| -rw-r--r-- | triscv/src/mem.c | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/triscv/src/mem.c b/triscv/src/mem.c index 5d70896..84bd71f 100644 --- a/triscv/src/mem.c +++ b/triscv/src/mem.c @@ -20,17 +20,7 @@ void mem_destroy(struct mem *mem) void mem_init(struct mem *mem, const void *buf, size_t len) { - assert((len * 3) < mem->size); - for (size_t i = 0; i < len * 3; i += 3) { - tri_t t = ((tri_t *)buf)[i / 3]; - mem->buf[i + 0] = tri_mask(t, 9); - t = tri_sr(t, 9); - - mem->buf[i + 1] = tri_mask(t, 9); - t = tri_sr(t, 9); - - mem->buf[i + 2] = tri_mask(t, 9); - } + memcpy(mem->buf, buf, len); } static void mem_write1(struct cpu *cpu, struct mem *mem, pm_t addr, tri_t t) |
