@@ -597,18 +597,31 @@ reg_t mstatus_csr_t::compute_mstatus_initial_value() const noexcept {
597597 | (proc->extension_enabled_const (' U' ) && (proc->get_const_xlen () != 32 ) ? set_field ((reg_t )0 , MSTATUS_UXL, xlen_to_uxl (proc->get_const_xlen ())) : 0 )
598598 | (proc->extension_enabled_const (' S' ) && (proc->get_const_xlen () != 32 ) ? set_field ((reg_t )0 , MSTATUS_SXL, xlen_to_uxl (proc->get_const_xlen ())) : 0 )
599599 | (proc->get_mmu ()->is_target_big_endian () ? big_endian_bits : 0 )
600+ #if defined(DIFFTEST) && defined(CPU_XIANGSHAN)
601+ | 0
602+ #else
600603 | (proc->extension_enabled (EXT_SMDBLTRP) ? MSTATUS_MDT : 0 )
604+ #endif
601605 | 0 ; // initial value for mstatus
602606}
603607
604608// implement class mnstatus_csr_t
605609mnstatus_csr_t ::mnstatus_csr_t (processor_t * const proc, const reg_t addr):
606- basic_csr_t (proc, addr, 0 ) {
610+ #if defined(DIFFTEST) && defined(CPU_XIANGSHAN)
611+ basic_csr_t (proc, addr, MNSTATUS_NMIE)
612+ #else
613+ basic_csr_t (proc, addr, 0 )
614+ #endif
615+ {
607616}
608617
609618bool mnstatus_csr_t::unlogged_write (const reg_t val) noexcept {
610619 // NMIE can be set but not cleared
620+ #if defined(DIFFTEST) && defined(CPU_XIANGSHAN)
621+ const reg_t mask = MNSTATUS_NMIE
622+ #else
611623 const reg_t mask = (~read () & MNSTATUS_NMIE)
624+ #endif
612625 | (proc->extension_enabled (' H' ) ? MNSTATUS_MNPV : 0 )
613626 | MNSTATUS_MNPP;
614627
@@ -619,6 +632,10 @@ bool mnstatus_csr_t::unlogged_write(const reg_t val) noexcept {
619632 return basic_csr_t::unlogged_write (new_mnstatus);
620633}
621634
635+ bool mnstatus_csr_t::bare_write (const reg_t val) noexcept {
636+ return basic_csr_t::unlogged_write (val);
637+ }
638+
622639// implement class rv32_low_csr_t
623640rv32_low_csr_t ::rv32_low_csr_t (processor_t * const proc, const reg_t addr, csr_t_p orig):
624641 csr_t (proc, addr),
0 commit comments