# Validation: the oracle ladder and the rungs ## The ladder (method: hardware > manufacturer > hardware-corrected community > HDL > emulators) A low tier is a detector, never a judge: it finds differences, it does not decide who is right. | Tier | Oracle | Licence, pin | Can decide | Cannot decide | | --- | --- | --- | --- | --- | | 1 | **ps2autotests**: 22 EE-core programs (`cpu/ee` 6, `cpu/ee_fpu` 9, `cpu/ee_simd` 6, `cpu/ee_cop0` 1) plus `cpu/vu0_macro` 2 and `vu/*` 7, each with an `.expected` output saved from a real PS2 | ISC, `97469ff` | the printed results of every case: ALU, branch and load delay behaviour, multiply/divide incl. the HI1/LO1 pair, every MMI group, FPU results and FCR31 flags, performance-counter readings | anything not printed; timing except where `performance` reads the counters; which console revision produced the outputs (not stated, **U21**) | | 1 | hardware probes on Aubrey's behalf | none on hand (the family owns no PS2) | anything, once possible | today: nothing | | 2 | Toshiba TX79 Rev. 2.0 (C790 core), Sony ECUM, ECISM, VU User's Manual 6.0 | Toshiba / Sony copyright; facts only; pins in `scripts/` | instruction semantics, encodings, registers, exceptions, TLB, caches, pipeline structure, latencies | the FPU's exact truncation, misprediction penalties, memory latency, errata beyond TX79 ยง1.5 | | 3 | ps2tek and its Markdown edition | no licence; facts only; `1c91660`, `295bc61` | register summaries, boot behaviour, where it says "tested" | anything it states without a hardware basis (its author's emulator may be its source) | | 4 | HDL reimplementations | **none found**: no FPGA PS2 core is known to us | - | - | | 5 | MAME 0.285 (`ps2`, preliminary), Play! (BSD-2-Clause, `1f27232`), PCSX2 and DobieStation (GPL-3.0, closed boxes from emu-tools-gpl if ever) | as listed | detect differences | judge anything | **Plainly:** no hardware-captured oracle exists for the EE beyond ps2autotests' outputs, and no die-level model exists at all. Where the tests and the manuals are silent the specification says HYPOTHESIS or FITTED. ## How a test program runs without a BIOS (decision E8) The ps2autotests ELFs are linked against ps2sdk's EE runtime: `main` creates a thread and a semaphore through the kernel (`CreateSema`, `CreateThread`, `StartThread`, `WaitSema`, `SignalSema`; `common/common-ee.cpp`) and prints through ps2sdk's `printf`. On hardware the kernel is the BIOS's. ee-python's rungs must not need a booted BIOS (it takes the board, the IOP and seconds of emulated time). The proposal: a **test harness shim** in `tests/`, not in the package, that loads the ELF, answers the handful of EE kernel syscalls these programs make with the minimal behaviour they need, and captures the program's output at the syscall or `printf` boundary. It is harness, not a BIOS model: it is never used by ps2-python, which always runs the real BIOS. Which syscalls each ELF makes is listed when rung 1 starts (by tracing the `syscall` instructions). ## Rungs (exit test for each) 0. **Tooling and decode.** `scripts/gen_decode.py` builds a committed `_decode.py` from ECISM ch. 7's encoding tables (facts typed in, with page references); a disassembler whose mnemonics and operands match MAME's text on `tests/mame_traces/ee-boot-head.trace` (20,000 lines) after a documented normalisation. Exit: zero differences. 1. **Integer core.** ps2autotests `cpu/ee/*` (6 programs) through the harness shim. Exit: output identical to `.expected`, byte for byte (after newline normalisation, as the README says). 2. **MMI and FPU.** `cpu/ee_simd/*` (6) and `cpu/ee_fpu/*` (9). Exit: identical. The FPU truncation rule (fpu.md U9) is FITTED here and stays tagged so. 3. **COP0, TLB, caches, scratchpad.** `cpu/ee_cop0/performance` and our own small test programs for TLB refill/invalid/modified, the scratchpad mapping, CACHE tag operations, uncached-accelerated loads (written from ECUM, assembled with the ps2dev EE toolchain: a tool, its output our own), judged against ECUM's stated behaviour. Exit: the ps2autotests program identical; our programs' expectations written from the manual before the run and each tagged DOC. 4. **MAME lockstep (detector).** The BIOS boot path from reset, every GPR write (128 bits via `h`), HI/LO and COP0 Status/Cause, compared per instruction over the 2-frame window (8.6 M instructions; most are a delay loop, so the comparison takes the first 50,000 and samples the rest). Exit: no difference, or each difference explained and recorded (a MAME difference is not a bug in ours by default). 5. **VU0 macro mode** through the COP2 socket (with vu-python, or a stub if decision E6 is deferred): `cpu/vu0_macro/*` (2). Exit: identical. 6. **Timing.** The issue-pairing and latency tables (pipeline-timing.md) against `cpu/ee_cop0/performance`'s counter readings, and `cpu/ee/branchdelay`/`lsudelay`. Exit: the counts identical, or FITTED constants recorded with what they fit. 7. **Seeded faults**, each caught by some rung: an MMI lane order swapped (PEXTLW); HI1 written to HI; FPU rounding to nearest instead of truncating; FCR31's sticky flag cleared by an operation; the upper 64 bits of a GPR cleared by ADDU; a branch-likely slot executed when not taken; LQ honouring the low four address bits; a TLB entry's S bit ignored; an LRF bit flipped on a hit; Status.EIE ignored by the interrupt check. For the board-level rungs (BIOS boot, games, slices) see ps2-python docs/validation.md.