From 6edade339744b6631717242b0111f5dc1ae79194 Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Fri, 13 Sep 2024 15:14:30 -0700 Subject: Allow cloning ancestor multiple times on each core --- salis | 2 ++ src/arch/salis-v1.c | 19 +++++++++++++------ src/salis.c | 14 ++++++++++---- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/salis b/salis index b02daa2..a493861 100755 --- a/salis +++ b/salis @@ -75,6 +75,7 @@ options=( "A|anc-def|ANC|`anc_def_desc`|||bench:new" "a|arch|ARCH|VM architecture|${arches}|dummy|bench:new" "b|steps|N|number of steps to run in benchmark||0x1000000|bench" + "C|clones|N|number of ancestor clones on each core||1|bench:new" "c|cores|N|number of simulator cores||2|bench:new" "F|muta-flip||cosmic rays flip bits instead of randomizing whole bytes||false|bench:new" "f|force||overwrite existing simulation of given name||false|new" @@ -325,6 +326,7 @@ bench|new) bcmd="${bcmd} -DANC_LIST=`fquote "${anc_list::-1}"`" bcmd="${bcmd} -DANC_HALF=`[[ ${opt_half} == true ]] && echo 1 || echo 0`" + bcmd="${bcmd} -DANC_CLONES=${opt_clones}" ;; esac diff --git a/src/arch/salis-v1.c b/src/arch/salis-v1.c index 9268d50..1085883 100644 --- a/src/arch/salis-v1.c +++ b/src/arch/salis-v1.c @@ -200,15 +200,22 @@ void arch_on_proc_kill(Core *core) { void arch_anc_init(Core *core, u64 size) { assert(core); - Proc *panc = proc_fetch(core, 0); - #if ANC_HALF == 1 - panc->mb0a = U64_HALF; - panc->ip = U64_HALF; - panc->sp = U64_HALF; + u64 addr = U64_HALF; +#else + u64 addr = 0; #endif - panc->mb0s = size; + for (int i = 0; i < ANC_CLONES; ++i) { + u64 addr_clone = addr + ((MVEC_SIZE / ANC_CLONES) * i); + + Proc *panc = proc_fetch(core, i); + + panc->mb0a = addr_clone; + panc->mb0s = size; + panc->ip = addr_clone; + panc->sp = addr_clone; + } } #endif diff --git a/src/salis.c b/src/salis.c index 24f3966..814dd0d 100644 --- a/src/salis.c +++ b/src/salis.c @@ -316,8 +316,13 @@ u64 core_assemble_ancestor(int cix, const char *anc) { for (int i = 0; i < 0x100; ++i) { if (strcmp(line, g_mnemo_table[i]) == 0) { - mvec_alloc(core, addr); - mvec_set_inst(core, addr, i); + for (u64 j = 0; j < ANC_CLONES; ++j) { + u64 addr_clone = addr + ((MVEC_SIZE / ANC_CLONES) * j); + + mvec_alloc(core, addr_clone); + mvec_set_inst(core, addr_clone, i); + } + #ifndef NDEBUG line_ok = true; #endif @@ -347,8 +352,9 @@ void core_init(int cix, u64 *seed, const char *anc) { core->muta[3] = muta_smix(seed); } - core->pnum = 1; - core->pcap = 1; + core->pnum = ANC_CLONES; + core->pcap = ANC_CLONES; + core->plst = ANC_CLONES - 1; core->iviv = calloc(SYNC_INTERVAL, sizeof(u8)); core->ivav = calloc(SYNC_INTERVAL, sizeof(u64)); core->pvec = calloc(core->pcap, sizeof(Proc)); -- cgit v1.2.1