fix: RESET pin active-LOW and clock edge state reset
This commit is contained in:
parent
1cf2cd6e2b
commit
c9f39aa600
12 changed files with 520 additions and 327 deletions
|
|
@ -118,25 +118,32 @@ impl GuiState {
|
|||
}
|
||||
|
||||
/// Update component running states
|
||||
/// Uses try_lock() to avoid potential deadlocks when multiple threads
|
||||
/// access components in different orders
|
||||
fn update_component_states(&mut self, system: &ConfigurableSystem) {
|
||||
let components = system.get_components();
|
||||
|
||||
self.component_states.cpu_running = components
|
||||
.get("CPU_4004")
|
||||
.map_or(false, |comp| comp.lock().map_or(false, |c| c.is_running()));
|
||||
// Use try_lock() to avoid blocking - if we can't get the lock immediately,
|
||||
// just assume the component is not running (safe default for GUI display)
|
||||
self.component_states.cpu_running = components.get("CPU_4004").map_or(false, |comp| {
|
||||
comp.try_lock().map_or(false, |c| c.is_running())
|
||||
});
|
||||
|
||||
self.component_states.ram_running = components
|
||||
.get("RAM_4002")
|
||||
.map_or(false, |comp| comp.lock().map_or(false, |c| c.is_running()));
|
||||
self.component_states.ram_running = components.get("RAM_4002").map_or(false, |comp| {
|
||||
comp.try_lock().map_or(false, |c| c.is_running())
|
||||
});
|
||||
|
||||
self.component_states.rom_running = components
|
||||
.get("ROM_4001_1")
|
||||
.or_else(|| components.get("ROM_4001_2"))
|
||||
.map_or(false, |comp| comp.lock().map_or(false, |c| c.is_running()));
|
||||
.map_or(false, |comp| {
|
||||
comp.try_lock().map_or(false, |c| c.is_running())
|
||||
});
|
||||
|
||||
self.component_states.clock_running = components
|
||||
.get("SYSTEM_CLOCK")
|
||||
.map_or(false, |comp| comp.lock().map_or(false, |c| c.is_running()));
|
||||
self.component_states.clock_running =
|
||||
components.get("SYSTEM_CLOCK").map_or(false, |comp| {
|
||||
comp.try_lock().map_or(false, |c| c.is_running())
|
||||
});
|
||||
}
|
||||
|
||||
/// Set an error message
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue