aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/dummy/arch.c2
-rw-r--r--arch/v1/arch.c37
2 files changed, 8 insertions, 31 deletions
diff --git a/arch/dummy/arch.c b/arch/dummy/arch.c
index 6f4d098..aaf0f9d 100644
--- a/arch/dummy/arch.c
+++ b/arch/dummy/arch.c
@@ -144,7 +144,6 @@ const char *arch_mnemonic(uint8_t inst) {
return NULL;
}
-#if defined(DATA_PUSH)
#if defined(COMMAND_NEW)
void arch_push_data_header(void) {
assert(g_sim_db);
@@ -154,4 +153,3 @@ void arch_push_data_header(void) {
void arch_push_data_line(void) {
assert(g_sim_db);
}
-#endif
diff --git a/arch/v1/arch.c b/arch/v1/arch.c
index 3a43b43..e0203cb 100644
--- a/arch/v1/arch.c
+++ b/arch/v1/arch.c
@@ -1,13 +1,6 @@
// Based on the original salis-v1 VM architecture:
// https://git.pauloliver.dev/salis-v1/about/
-enum {
-#define INST(core, pref, index, label, mnemonic, symbol) label,
- INST_SET(core, pref)
-#undef INST
-};
-
-#if defined(DATA_PUSH)
#define INST_EVENT_ARRAYS(core) \
INST_EVENT_ARRAY(core, 0, pop) /* instruction population */ \
INST_EVENT_ARRAY(core, 1, exe) /* instruction executions */ \
@@ -19,9 +12,14 @@ enum {
ARCH_EVENT_ARRAY(core, 1, xev) /* memory block swap events array */
#define ARCH_EVENT_ARRAYS_COUNT 2
+enum {
+#define INST(core, pref, index, label, mnemonic, symbol) label,
+ INST_SET(core, pref)
+#undef INST
+};
+
thrd_t g_arch_eva_thrds[CORES][ARCH_EVENT_ARRAYS_COUNT];
struct DeflateParams g_arch_eva_deflate_params[CORES][ARCH_EVENT_ARRAYS_COUNT];
-#endif
#if defined(COMMAND_NEW)
void arch_core_init(struct Core *core) {
@@ -56,7 +54,6 @@ void arch_core_save(FILE *f, const struct Core *core) {
assert(f);
assert(core);
-#if defined(DATA_PUSH)
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);
@@ -66,10 +63,6 @@ void arch_core_save(FILE *f, const struct Core *core) {
fwrite(core->ev##a, sizeof(uint64_t), MVEC_SIZE, f);
ARCH_EVENT_ARRAYS(core)
#undef ARCH_EVENT_ARRAY
-#else
- (void)f;
- (void)core;
-#endif
}
#endif
@@ -78,7 +71,6 @@ void arch_core_load(FILE *f, struct Core *core) {
assert(f);
assert(core);
-#if defined(DATA_PUSH)
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);
@@ -88,10 +80,6 @@ void arch_core_load(FILE *f, struct Core *core) {
fread(core->ev##a, sizeof(uint64_t), MVEC_SIZE, f);
ARCH_EVENT_ARRAYS(core)
#undef ARCH_EVENT_ARRAY
-#else
- (void)f;
- (void)core;
-#endif
}
#endif
@@ -438,7 +426,6 @@ void _bswap(struct Core *core, uint64_t pix) {
proc->mb1a = tmpa;
proc->mb1s = tmps;
-#if defined(DATA_PUSH)
// Memory block swap events mark all addresses within both blocks
for (uint64_t i = 0; i < proc->mb0s; i++) {
uint64_t addr = proc->mb0a + i;
@@ -459,7 +446,6 @@ void _bswap(struct Core *core, uint64_t pix) {
++core->xeva[addr];
#endif
}
-#endif
}
_increment_ip(core, pix);
@@ -674,8 +660,6 @@ void _write(struct Core *core, uint64_t pix) {
} else {
if (_is_writeable_by(core, *regs[0], pix)) {
uint64_t addr = *regs[0];
-
-#if defined(DATA_PUSH)
uint8_t inst = *regs[1] % INST_COUNT;
// Store write event
@@ -689,7 +673,6 @@ void _write(struct Core *core, uint64_t pix) {
} else {
++core->wdea;
}
-#endif
// Write instruction
uint8_t inst_rep = *regs[1] % INST_CAP;
@@ -734,10 +717,8 @@ 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)
// Store specific instruction execution event in database
++core->iexe[inst];
-#endif
// Execute instruction
switch (inst) {
@@ -873,12 +854,11 @@ const char *arch_mnemonic(uint8_t inst) {
// ----------------------------------------------------------------------------
// Data aggregation functions
// ----------------------------------------------------------------------------
-#if defined(DATA_PUSH)
#if defined(COMMAND_NEW)
void arch_push_data_header(void) {
assert(g_sim_db);
- g_info("Creating arch table in SQLite database");
+ log_info("Creating arch table in SQLite database");
sql_exec(
0, NULL, NULL,
"create table arch ("
@@ -966,7 +946,7 @@ void arch_push_data_line(void) {
}
}
- g_info("Pushing row to arch table in SQLite database");
+ log_info("Pushing row to arch table in SQLite database");
sql_exec(
CORES * ARCH_EVENT_ARRAYS_COUNT, (const void **)blobs, (int *)blob_sizes,
"insert into arch ("
@@ -1055,4 +1035,3 @@ void arch_push_data_line(void) {
#undef ARCH_EVENT_ARRAY
}
}
-#endif