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

@@ -180,6 +180,7 @@ class ReplayConfig:
uart_baud: int = 38_400
p9_fast_path: bool = True
p9_fast_input: int = 0xFF
p9_fast_optimistic_wrapper: bool = False
def parse_bench_replay_log_text(text: str) -> BenchReplayLog:
@@ -242,6 +243,7 @@ def run_bench_replay(log_path: Path, *, rom_path: Path | None = None, config: Re
clock_hz=config.clock_hz,
p9_fast_path_enabled=config.p9_fast_path,
p9_fast_default_input_byte=config.p9_fast_input,
p9_fast_default_wrapper_success=config.p9_fast_optimistic_wrapper,
)
context = RunContext()
@@ -366,6 +368,7 @@ def build_arg_parser() -> argparse.ArgumentParser:
parser.add_argument("--frt2-ocia-steps", type=int, default=ReplayConfig.frt2_ocia_steps)
parser.add_argument("--no-p9-fast-path", action="store_true", help="disable shortcut handling for known P9 routines")
parser.add_argument("--p9-fast-input", type=lambda text: int(text, 0), default=ReplayConfig.p9_fast_input)
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("--assert-bench-parity", action="store_true", help="exit nonzero if emulator behavior diverges from the bench log")
parser.add_argument("--json", action="store_true", help="emit JSON")
return parser
@@ -388,6 +391,7 @@ def main(argv: list[str] | None = None) -> int:
uart_baud=args.uart_baud,
p9_fast_path=not args.no_p9_fast_path,
p9_fast_input=args.p9_fast_input,
p9_fast_optimistic_wrapper=args.p9_fast_optimistic_wrapper,
),
)
if args.json: