feat(cpu): account for source fetches in branch and IRQ refills

This commit is contained in:
0xrsydn 2026-10-06 16:27:45 +07:00
commit 2d7eb6e4eb
27 changed files with 638 additions and 87 deletions

View file

@ -3,6 +3,8 @@ use std::{cell::Cell, error::Error, fmt};
mod fetch;
#[cfg(test)]
mod fetch_tests;
#[cfg(test)]
mod irq_fetch_tests;
mod iwram_bus;
#[cfg(test)]
mod iwram_history_tests;
@ -432,6 +434,14 @@ impl Memory {
}
}
/// IRQ's discarded source fetch drives only its actual IWRAM lanes.
/// Do not invent cold fills or commit a BIOS instruction snapshot: none executed.
pub(crate) fn discarded_cpu_fetch(&mut self, fetch: &InstructionFetch) {
self.iwram_bus.begin();
self.drive_iwram_fetch(fetch);
self.iwram_bus.finish(true);
}
/// Successful IWRAM target fetches drive their lanes in order, in either CPU state.
/// Other-region and unavailable target fetches leave the local latch unchanged.
pub(crate) fn refill_cpu_bus_history(&mut self, fetches: &[InstructionFetch; 2]) {