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.c40
1 files changed, 16 insertions, 24 deletions
diff --git a/arch/v1/arch.c b/arch/v1/arch.c
index 152a97d..49d9db5 100644
--- a/arch/v1/arch.c
+++ b/arch/v1/arch.c
@@ -47,7 +47,7 @@ void arch_core_save(FILE *f, const struct Core *core) {
fwrite(&core->wdea, sizeof(uint64_t), 1, f);
#if defined(DATA_PUSH_PATH)
- //fwrite(core->weva, sizeof(uint64_t), MVEC_SIZE, f);
+ fwrite(core->weva, sizeof(uint64_t), MVEC_SIZE, f);
#endif
}
#endif
@@ -64,7 +64,7 @@ void arch_core_load(FILE *f, struct Core *core) {
fread(&core->wdea, sizeof(uint64_t), 1, f);
#if defined(DATA_PUSH_PATH)
- //fread(core->weva, sizeof(uint64_t), MVEC_SIZE, f);
+ fread(core->weva, sizeof(uint64_t), MVEC_SIZE, f);
#endif
}
#endif
@@ -626,19 +626,22 @@ void _write(struct Core *core, uint64_t pix) {
if (_is_writeable_by(core, *regs[0], pix)) {
// 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];
- if (mvec_is_in_mb0_of_proc(core, *regs[0], pix)) {
+ if (mvec_is_in_mb0_of_proc(core, addr, pix)) {
++core->wmb0;
- } else if (mvec_is_in_mb1_of_proc(core, *regs[0], pix)) {
+ } else if (mvec_is_in_mb1_of_proc(core, addr, pix)) {
++core->wmb1;
} else {
++core->wdea;
}
// Write instruction
- mvec_set_inst(core, *regs[0], *regs[1] % INST_CAP);
+ mvec_set_inst(core, addr, inst_rep);
}
_increment_ip(core, pix);
@@ -860,7 +863,7 @@ void arch_push_data_header() {
}
// Memory events
- char *eprefs[] = { /* "wev" */ };
+ char *eprefs[] = { "wev" };
int eprefs_cnt = sizeof(eprefs) / sizeof(eprefs[0]);
for (int i = 0; i < CORES; ++i) {
@@ -984,16 +987,16 @@ void arch_push_data_line() {
}
// TODO: insert write memory events
- char *eprefs[] = { /* "wev" */ };
+ char *eprefs[] = { "wev" };
int eprefs_cnt = sizeof(eprefs) / sizeof(eprefs[0]);
for (int i = 0; i < CORES; ++i) {
for (int j = 0; j < eprefs_cnt; ++j) {
uint64_t *in = NULL;
- //if (!strcmp("wev", eprefs[j])) {
- // in = g_cores[i].weva;
- //}
+ if (!strcmp("wev", eprefs[j])) {
+ in = g_cores[i].weva;
+ }
// Compress event data
size_t size = sizeof(uint64_t) * MVEC_SIZE;
@@ -1001,18 +1004,7 @@ void arch_push_data_line() {
assert(out);
z_stream strm = { 0 };
- strm.zalloc = NULL;
- strm.zfree = NULL;
- strm.opaque = NULL;
-
- deflateInit(&strm, Z_DEFAULT_COMPRESSION);
-
- strm.avail_in = size;
- strm.avail_out = size;
- strm.next_in = (Bytef *)in;
- strm.next_out = (Bytef *)out;
-
- deflate(&strm, Z_FINISH);
+ salis_deflate(&strm, size, (Bytef *)in, (Bytef *)out);
// Insert blob
const void *blob = out;
@@ -1039,7 +1031,7 @@ void arch_push_data_line() {
blob_size, g_steps
);
- deflateEnd(&strm);
+ salis_deflate_end(&strm);
free(out);
}
}
@@ -1055,7 +1047,7 @@ void arch_push_data_line() {
core->wmb1 = 0;
core->wdea = 0;
- //memset(core->weva, 0, sizeof(uint64_t) * MVEC_SIZE);
+ memset(core->weva, 0, sizeof(uint64_t) * MVEC_SIZE);
}
}
#endif