Unified the 400x state machine for address latching

Fixed timing issues
This commit is contained in:
Jan-Peter von Hunnius 2025-11-14 18:51:10 +01:00
parent e17d6ad177
commit 633463e370
26 changed files with 11904 additions and 2471 deletions

View file

@ -141,15 +141,15 @@ impl Component for TwoPhaseClock {
if self.should_transition() {
// Reduced debug output - only show occasional transitions
static mut TRANSITION_COUNT: u32 = 0;
unsafe {
TRANSITION_COUNT += 1;
if TRANSITION_COUNT % 1000 == 0 {
println!(
"DEBUG: [CLOCK] Transitioning - PHI1: {:?} -> PHI2: {:?} (cycle {})",
self.phi1_state, self.phi2_state, TRANSITION_COUNT
);
}
// Use atomic counter instead of static mutable for thread safety
use std::sync::atomic::{AtomicU32, Ordering};
static TRANSITION_COUNT: AtomicU32 = AtomicU32::new(0);
let count = TRANSITION_COUNT.fetch_add(1, Ordering::Relaxed);
if count % 1000 == 0 {
println!(
"DEBUG: [CLOCK] Transitioning - PHI1: {:?} -> PHI2: {:?} (cycle {})",
self.phi1_state, self.phi2_state, count
);
}
self.perform_transition();
}