From 2926c3a39d579f8e8ea9bf617600c35aee1de53b Mon Sep 17 00:00:00 2001 From: Eugene Cohen Date: Fri, 16 Jan 2026 10:54:47 -0800 Subject: [PATCH 1/2] core_complex: add CSR callback regististration Add functions to register callbacks for custom CSR access. Must be used at end_of_elaboration or later. --- src/sysc/core_complex.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/sysc/core_complex.h b/src/sysc/core_complex.h index 33d78d1..fa6c72b 100644 --- a/src/sysc/core_complex.h +++ b/src/sysc/core_complex.h @@ -216,6 +216,16 @@ class core_complex : public sc_core::sc_module, public scc::traceable, public co return finish_evt; } + void register_csr_rd(unsigned csr_addr, sc2core_if::rd_csr_f &func) { + assert(core != nullptr); + core->register_csr_rd(csr_addr, func); + } + + void register_csr_wr(unsigned csr_addr, sc2core_if::wr_csr_f &func) { + assert(core != nullptr); + core->register_csr_wr(csr_addr, func); + } + protected: void create_cpu(std::string const& type, std::string const& backend, unsigned gdb_port, uint32_t hart_id); int cmd_sysc(int argc, char* argv[], iss::debugger::out_func, iss::debugger::data_func, iss::debugger::target_adapter_if*); From f921e487c75107c4e1c77967aa761a3d94349ce7 Mon Sep 17 00:00:00 2001 From: Eugene Cohen Date: Thu, 22 Jan 2026 07:47:19 -0800 Subject: [PATCH 2/2] core_complex: add register_unknown_instr_handler --- src/sysc/core_complex.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/sysc/core_complex.h b/src/sysc/core_complex.h index fa6c72b..5288a09 100644 --- a/src/sysc/core_complex.h +++ b/src/sysc/core_complex.h @@ -226,6 +226,11 @@ class core_complex : public sc_core::sc_module, public scc::traceable, public co core->register_csr_wr(csr_addr, func); } + void register_unknown_instr_handler(util::delegate handler) { + assert(core != nullptr); + core->register_unknown_instr_handler(handler); + } + protected: void create_cpu(std::string const& type, std::string const& backend, unsigned gdb_port, uint32_t hart_id); int cmd_sysc(int argc, char* argv[], iss::debugger::out_func, iss::debugger::data_func, iss::debugger::target_adapter_if*);