[cosim] Fix cosim mcycle update

This resolves an off by one issue
This commit is contained in:
Greg Chadwick 2022-03-18 17:25:05 +00:00 committed by Greg Chadwick
parent f44ae90040
commit 4fa6329c58

View file

@ -351,7 +351,11 @@ void SpikeCosim::set_mcycle(uint64_t mcycle) {
#ifdef OLD_SPIKE
processor->get_state()->mcycle = mcycle;
#else
processor->get_state()->mcycle->write(mcycle);
// TODO: Spike decrements mcycle on write to hack around an issue it has with
// correctly writing minstret. Preferably this write would use a backdoor
// access and avoid that decrement but backdoor access isn't part of the
// public CSR interface.
processor->get_state()->mcycle->write(mcycle + 1);
#endif
}