1
0

p9 bus emulation

This commit is contained in:
Aiden
2026-05-25 22:32:13 +10:00
parent c3eb09ddc8
commit 0c241877eb
12 changed files with 179 additions and 10 deletions

View File

@@ -430,6 +430,8 @@ class ProbeReport:
p9_fast_bytes: list[int] = field(default_factory=list)
p9_fast_events: int = 0
p9_accesses: list[str] = field(default_factory=list)
p9_trace: list[str] = field(default_factory=list)
p9_fast_trace: list[str] = field(default_factory=list)
sci_accesses: list[str] = field(default_factory=list)
sci1: SCI1Snapshot | None = None
sci1_txi: SCI1TXISummary | None = None
@@ -475,6 +477,12 @@ class ProbeReport:
if self.p9_accesses:
lines.append("recent_p9:")
lines.extend(" " + line for line in self.p9_accesses[-24:])
if self.p9_trace:
lines.append("recent_p9_trace:")
lines.extend(" " + line for line in self.p9_trace[-24:])
if self.p9_fast_trace:
lines.append("recent_p9_fast:")
lines.extend(" " + line for line in self.p9_fast_trace[-24:])
if self.sci_accesses:
lines.append("recent_sci:")
lines.extend(" " + line for line in self.sci_accesses[-16:])
@@ -905,6 +913,7 @@ def run_probe(
clock_hz: int = 10_000_000,
p9_fast_path: bool = False,
p9_fast_input: int = 0xFF,
p9_fast_optimistic_wrapper: bool = False,
sci_log_limit: int = 32,
watch_pcs: list[int] | tuple[int, ...] | None = None,
watch_snapshot_limit: int = 32,
@@ -933,6 +942,7 @@ def run_probe(
clock_hz=clock_hz,
p9_fast_path_enabled=p9_fast_path,
p9_fast_default_input_byte=p9_fast_input,
p9_fast_default_wrapper_success=p9_fast_optimistic_wrapper,
)
hot_pcs: Counter[int] = Counter()
p9_accesses: list[str] = []
@@ -1120,6 +1130,8 @@ def run_probe(
p9_fast_bytes=list(emulator.p9_fast_path.output_bytes),
p9_fast_events=len(emulator.p9_fast_path.events),
p9_accesses=p9_accesses,
p9_trace=emulator.memory.p9_bus.trace_lines(p9_log_limit),
p9_fast_trace=emulator.p9_fast_path.trace_lines(p9_log_limit),
sci_accesses=sci_accesses,
sci1=_sci1_snapshot(emulator),
sci1_txi=_sci1_txi_summary(emulator),
@@ -1158,6 +1170,7 @@ def build_arg_parser() -> argparse.ArgumentParser:
parser.add_argument("--stop-on-tx", action="store_true", help="stop when SCI1 TDR emits the first byte")
parser.add_argument("--p9-fast-path", action="store_true", help="shortcut known P9 bit-banged transfer routines for exploration")
parser.add_argument("--p9-fast-input", type=parse_int, default=0xFF)
parser.add_argument("--p9-fast-optimistic-wrapper", action="store_true", help="make P9 fast-path wrapper calls succeed when no modeled P9 response is queued")
parser.add_argument("--p9-log-limit", type=int, default=80)
parser.add_argument("--sci-log-limit", type=int, default=32)
parser.add_argument("--hot-limit", type=int, default=12)
@@ -1244,6 +1257,7 @@ def main(argv: list[str] | None = None) -> int:
p9_log_limit=args.p9_log_limit,
p9_fast_path=args.p9_fast_path,
p9_fast_input=args.p9_fast_input,
p9_fast_optimistic_wrapper=args.p9_fast_optimistic_wrapper,
sci_log_limit=args.sci_log_limit,
watch_pcs=tuple(dict.fromkeys((*DEFAULT_WATCH_PCS, *args.watch_pc))),
watch_snapshot_limit=args.watch_snapshot_limit,