Skip to content

Commit 7fc35ab

Browse files
author
Saad Khalid
committed
fixed misa cosim override for different Ibex configs
1 parent 5693d7d commit 7fc35ab

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

dv/cosim/spike_cosim.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -712,8 +712,13 @@ void SpikeCosim::fixup_csr(int csr_num, uint32_t csr_val) {
712712
break;
713713
}
714714
case CSR_MISA: {
715-
// For Ibex, misa is hardwired
716-
reg_t new_val = 0x40901104;
715+
// For Ibex, misa is hardwired,
716+
// so applying mask to bits other then variable
717+
// bits in different Ibex configs
718+
719+
uint32_t misa_and_mask = 0x40901114;
720+
uint32_t misa_or_mask = 0x100004;
721+
reg_t new_val = (csr_val & misa_and_mask) | misa_or_mask;
717722
#ifdef OLD_SPIKE
718723
processor->set_csr(csr_num, new_val);
719724
#else

0 commit comments

Comments
 (0)