aboutsummaryrefslogtreecommitdiff
path: root/riscv
diff options
context:
space:
mode:
authorChih-Min Chao <chihmin.chao@sifive.com>2020-10-06 09:07:09 -0700
committerChih-Min Chao <chihmin.chao@sifive.com>2020-10-06 09:09:59 -0700
commitf37ebaca770d91a90b83fe2be1ae61028ae69152 (patch)
treec5b920b70b17d84891b94aedf645ec34d0d0589c /riscv
parent77030fe8c29e108bd2828bf11337859509fd0ea6 (diff)
downloadspike-f37ebaca770d91a90b83fe2be1ae61028ae69152.zip
spike-f37ebaca770d91a90b83fe2be1ae61028ae69152.tar.gz
spike-f37ebaca770d91a90b83fe2be1ae61028ae69152.tar.bz2
rvv: commitlog: get hartid directly
To avoid handling inconsistent csr status when running with reference design Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
Diffstat (limited to 'riscv')
-rw-r--r--riscv/execute.cc3
-rw-r--r--riscv/processor.h1
2 files changed, 2 insertions, 2 deletions
diff --git a/riscv/execute.cc b/riscv/execute.cc
index 7313c51..9a91ce6 100644
--- a/riscv/execute.cc
+++ b/riscv/execute.cc
@@ -76,8 +76,7 @@ static void commit_log_print_insn(processor_t *p, reg_t pc, insn_t insn)
int flen = p->get_state()->last_inst_flen;
// print core id on all lines so it is easy to grep
- uint64_t id = p->get_csr(CSR_MHARTID);
- fprintf(log_file, "core%4" PRId64 ": ", id);
+ fprintf(log_file, "core%4" PRId64 ": ", p->get_id());
fprintf(log_file, "%1d ", priv);
commit_log_print_value(log_file, xlen, pc);
diff --git a/riscv/processor.h b/riscv/processor.h
index 87df69f..2187608 100644
--- a/riscv/processor.h
+++ b/riscv/processor.h
@@ -272,6 +272,7 @@ public:
void reset();
void step(size_t n); // run for n cycles
void set_csr(int which, reg_t val);
+ uint32_t get_id() const { return id; }
reg_t get_csr(int which, insn_t insn, bool write, bool peek = 0);
reg_t get_csr(int which) { return get_csr(which, insn_t(0), false, true); }
mmu_t* get_mmu() { return mmu; }