Skip to content

Commit

Permalink
Merge pull request #1864 from riscv-software-src/ext_csr_reset
Browse files Browse the repository at this point in the history
Add extension_t csrs in reset(), not register_extension()
  • Loading branch information
jerryz123 authored Jan 3, 2025
2 parents 4cf4915 + a10dfd0 commit b81b5a0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions riscv/processor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,11 @@ void processor_t::reset()
put_csr(CSR_PMPCFG0, PMP_R | PMP_W | PMP_X | PMP_NAPOT);
}

for (auto e : custom_extensions) // reset any extensions
for (auto e : custom_extensions) { // reset any extensions
for (auto &csr: e.second->get_csrs(*this))
state.add_csr(csr->address, csr);
e.second->reset();
}

if (sim)
sim->proc_reset(id);
Expand Down Expand Up @@ -711,8 +714,6 @@ void processor_t::register_extension(extension_t *x) {
fprintf(stderr, "extensions must have unique names (got two named \"%s\"!)\n", x->name());
abort();
}
for (auto &csr: x->get_csrs(*this))
state.add_csr(csr->address, csr);
x->set_processor(this);
}

Expand Down

0 comments on commit b81b5a0

Please sign in to comment.