@@ -514,7 +514,7 @@ template <typename BASE = logging::disass> struct riscv_hart_common : public BAS
514514 if (enable)
515515 this ->disass_func = util::delegate<void (uint64_t , std::string const &, bool )>::from<this_class, &this_class::print_disass_output>(this );
516516 else
517- this ->disass_func = util::delegate<void (uint64_t , std::string const &, bool )>::from<this_class, &this_class::print_disass_output> (nullptr );
517+ this ->disass_func = util::delegate<void (uint64_t , std::string const &, bool )>(nullptr );
518518 }
519519
520520 void set_semihosting_callback (semihosting_cb_t <reg_t > cb) { semihosting_cb = cb; };
@@ -1011,7 +1011,12 @@ template <typename BASE = logging::disass> struct riscv_hart_common : public BAS
10111011
10121012 void set_next (mem::memory_if mem_if) override { memory = mem_if; };
10131013
1014- void set_irq_num (unsigned i) { mcause_max_irq = std::max (1u << util::ilog2 (i), 16u ); }
1014+ void set_max_irq_num (unsigned i) { mcause_max_irq = std::max (1u << util::ilog2 (i), 16u ); }
1015+
1016+ void set_clint_custom_irq_num (unsigned num) {
1017+ assert (num<=traits<BASE>::XLEN);
1018+ clint_custom_irq_mask=std::numeric_limits<reg_t >::max ()>>(traits<BASE>::XLEN-num);
1019+ }
10151020
10161021protected:
10171022 util::InstanceLogger<logging::dbt_rise_iss> isslogger;
@@ -1060,7 +1065,7 @@ template <typename BASE = logging::disass> struct riscv_hart_common : public BAS
10601065 instrumentation_if* get_instrumentation_if () override { return &instr_if; };
10611066
10621067 using csr_type = std::array<typename traits<BASE>::reg_t , 1ULL << 12 >;
1063- csr_type csr;
1068+ csr_type csr{ 0 } ;
10641069
10651070 std::unordered_map<unsigned , rd_csr_f> csr_rd_cb;
10661071 std::unordered_map<unsigned , wr_csr_f> csr_wr_cb;
@@ -1074,6 +1079,7 @@ template <typename BASE = logging::disass> struct riscv_hart_common : public BAS
10741079 int64_t instret_offset{0 };
10751080 semihosting_cb_t <reg_t > semihosting_cb;
10761081 unsigned mcause_max_irq{traits<BASE>::XLEN};
1082+ reg_t clint_custom_irq_mask{0xffff };
10771083};
10781084
10791085} // namespace arch
0 commit comments