How spike exit normally

Anyone can explain the spike how to exit in baremental mode,

I would suggest asking questions someplace more appropriate, such as a mailing list. This forum is for discussing SiFive hardware.

I would suggest looking at how works. Since spike is simulating a cpu, and a cpu doesn’t “exit”, I think there is some trickery with the htif (host-target interface?) where writing a value to a special location tells htif to shutdown the cpu.

Yeah it seems to just write an exit code to “tohost” in a loop (I presume because Spike only checks every N instructions).