aboutsummaryrefslogtreecommitdiff
path: root/arch/v1/arch.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/v1/arch.c')
-rw-r--r--arch/v1/arch.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/arch/v1/arch.c b/arch/v1/arch.c
index 49d9db5..6c01407 100644
--- a/arch/v1/arch.c
+++ b/arch/v1/arch.c
@@ -40,14 +40,16 @@ void arch_core_save(FILE *f, const struct Core *core) {
assert(f);
assert(core);
+#if defined(DATA_PUSH_PATH)
fwrite(core->iexe, sizeof(uint64_t), INST_COUNT, f);
fwrite(core->iwrt, sizeof(uint64_t), INST_COUNT, f);
fwrite(&core->wmb0, sizeof(uint64_t), 1, f);
fwrite(&core->wmb1, sizeof(uint64_t), 1, f);
fwrite(&core->wdea, sizeof(uint64_t), 1, f);
-
-#if defined(DATA_PUSH_PATH)
fwrite(core->weva, sizeof(uint64_t), MVEC_SIZE, f);
+#else
+ (void)f;
+ (void)core;
#endif
}
#endif
@@ -57,14 +59,16 @@ void arch_core_load(FILE *f, struct Core *core) {
assert(f);
assert(core);
+#if defined(DATA_PUSH_PATH)
fread(core->iexe, sizeof(uint64_t), INST_COUNT, f);
fread(core->iwrt, sizeof(uint64_t), INST_COUNT, f);
fread(&core->wmb0, sizeof(uint64_t), 1, f);
fread(&core->wmb1, sizeof(uint64_t), 1, f);
fread(&core->wdea, sizeof(uint64_t), 1, f);
-
-#if defined(DATA_PUSH_PATH)
fread(core->weva, sizeof(uint64_t), MVEC_SIZE, f);
+#else
+ (void)f;
+ (void)core;
#endif
}
#endif
@@ -624,10 +628,11 @@ void _write(struct Core *core, uint64_t pix) {
proc->sp--;
} else {
if (_is_writeable_by(core, *regs[0], pix)) {
+ uint64_t addr = *regs[0];
+
+#if defined(DATA_PUSH_PATH)
// Store write event
uint8_t inst = *regs[1] % INST_COUNT;
- uint8_t inst_rep = *regs[1] % INST_CAP;
- uint64_t addr = *regs[0];
++core->iwrt[inst];
++core->weva[addr];
@@ -639,8 +644,10 @@ void _write(struct Core *core, uint64_t pix) {
} else {
++core->wdea;
}
+#endif
// Write instruction
+ uint8_t inst_rep = *regs[1] % INST_CAP;
mvec_set_inst(core, addr, inst_rep);
}
@@ -682,8 +689,10 @@ void arch_proc_step(struct Core *core, uint64_t pix) {
struct Proc *proc = proc_fetch(core, pix);
uint8_t inst = _get_inst(core, proc->ip);
+#if defined(DATA_PUSH_PATH)
// Store specific instruction execution event in database
++core->iexe[inst];
+#endif
// Execute instruction
switch (inst) {