use thiserror::Error;
#[derive(Debug, Error)]
pub enum SimError {
#[error("could not read file '{path}': {source}")]
FileRead {
path: String,
source: std::io::Error,
},
#[error(
"potential hang: PC {pc:#x} unchanged for {cycle_count} cycles \
(instruction word: {inst:#010x})"
)]
HangDetected {
pc: u64,
inst: u32,
cycle_count: u64,
},
#[error("not an ELF image")]
NotAnElf,
#[error("kernel panic detected at cycle {cycle}; check serial output for details")]
KernelPanic {
cycle: u64,
},
#[error("cache invariant broken at cycle {cycle}, line {line:#x}: {what}")]
CacheInvariant {
cycle: u64,
line: u64,
what: String,
},
}