# Validation: the oracle ladder, what the Python specification can be, and the milestones ## The ladder A low tier is a detector, never a judge. | Tier | Oracle | Licence, pin | Can decide | Cannot decide | | --- | --- | --- | --- | --- | | 1 | **ps2autotests** (`97469ff`): 78 programs with outputs saved from a real PS2: EE core 22, VU 9 (ee-python), IOP CPU 7, DMA 11 (`dma/dmac` 2, `dma/spr` 3, `dma/vif` 6), GS 2 (`label`, `signal`), EE kernel 10 (`interrupt` 2, `thread` 8), IOP kernel 16, memory 1 | ISC | the printed results: VIF unpack modes, interrupt-stall behaviour, MSKPATH3, scratchpad DMA modes, chain tags, GS SIGNAL/LABEL events, INTC/DMAC interrupt order, EE and IOP kernel behaviour (as the BIOS implements it) | pictures (no GS pixel judge), sound, the drive, SIO2, timing beyond what a test prints | | 1 | hardware probes | none possible: the family owns no PS2 | | | | 2 | Sony's EE, EE Core, VU, GS and SPU2 manuals 6.0 (facts only); Toshiba's TX79 | pins in `scripts/` | register maps, the DMAC, VIF, GIF, IPU, GS and SPU2 behaviour as described | the IOP's hardware (no Sony IOP manual in hand), SIO2, the CDVD and MechaCon, undocumented timings | | 3 | ps2tek and its Markdown edition; ps2sdk headers (AFL-2.0); [RO]man's pad notes | as listed | IOP, SIF, CDVD, SIO2 and BIOS facts where they say "tested" | facts that may come from an emulator (ps2tek's CDVD timings say they are PCSX2's) | | 4 | HDL | **none known** | | | | 5 | MAME 0.285 `ps2` (preliminary: stops at "Initialize GS ..."), Play! (BSD-2-Clause; HLE BIOS), PCSX2 and DobieStation (GPL-3.0, closed boxes from emu-tools-gpl if ever built) | | detect differences | judge anything | **Plainly:** no hardware-tier oracle exists for the GS's pixels, the SPU2's sound, the drive or SIO2. The GS's rules rest on Sony's manual (tier 2), and where it is silent the specification says FITTED and names what it was fitted against (a tier-5 detector's picture is a detector, not a judge). ## What the Python specification can be Numbers in execution-architecture.md: the EE at 1/500 to 1/12,000 of real time in PyPy, VU1 slower per instruction, the GS at perhaps 0.05-0.3 M pixels/s (HYPOTHESIS). **A single 60 Hz frame of a 3D game takes minutes; a BIOS boot to the browser takes hours.** So ps2-python validates on (late-era method L1, recommended there for the N64 and here without qualification): 1. **Test programs**: the ps2autotests ELFs and IRXs, started from a **booted-kernel state** written by ps2-rust (the BIOS run as itself up to the point where the kernel loads an ELF) and side-loaded through `LoadExecPS2` (bios.md). Each runs for seconds of wall time in Rust, minutes in Python. 2. **Component slices**, where Python is strong and the rest of the machine is not needed: - **GS slices**: 4 MB local memory, the GS register state and a GIF packet stream, captured from ps2-rust at a GIF boundary; Python's GS replays it and the local memory after every primitive (CRC) and the PCRTC picture must match ps2-rust's. - **VU slices**: VU1 micro and data memory, registers and pipeline state, and the VIF1 stream into it, captured at an MSCAL; the per-cycle trace must match. - **IPU slices**: the input FIFO stream and IPU state; output identical. 3. **Whole-machine slices**: a start state (SHA-256, the tier and commit that wrote it), an input script, a length of a few frames; per-cycle lockstep, chained slices for state equality (late-era L1-L3; the shared state format, L3, from M1). x-rust is the first tier that boots the BIOS, runs games and takes a sweep (L2). Its claim is "identical to the specification on N slices and M test programs", never more. ## Milestones (exit tests) - **M1 Bus and boot skeleton**: memory map, EE registers, INTC, timers, the RDRAM controller registers the BIOS initialises; ee-python running the BIOS from reset. Exit: the BIOS's console output on KPUTCHAR (1000F180h) equals the text MAME produces up to where MAME stops (`# Initialize memory (rev:3.17, ctm:393Mhz, cpuclk:295Mhz )`, `# Total accessable memory size: 32 MB (B:2:8:0)`, `# TLB spad=0 kernel=1:12 default=13:30 extended=31:38`, `# Initialize Start.`, `# Initialize GS ...`; mame-oracle.md), in Rust from M1's transcription; Python reaches it as a slice. The `cpuclk:295Mhz` line checks the time base (bios.md). - **M2 DMAC, VIF, GIF, GS front end and a software GS**: ps2autotests `dma/*` and `gs/*` identical; GS slices from M2 on. - **M3 VU0/VU1** (with vu-python): `cpu/vu0_macro/*`, `vu/*` identical; VU slices. - **M4 SIF and the IOP**: r3000a-python in its IOP configuration (decision P11), IOP DMA, timers, INTC; `cpu/iop/*` and `kernel/iop/*` identical; the BIOS boots both CPUs to the browser in Rust. - **M5 Kernel**: `kernel/ee/*` identical (the real BIOS kernel, not a shim). - **M6 CDVD (HLE) and discs**: DVD `.iso` and CD `.cue/.bin`; a disc boots to its first frame in Rust; slices around the first 3D frame of a few curated titles. - **M7 SIO2, pads, memory cards** (without MagicGate authentication: decision P8). - **M8 SPU2 and the IPU**: ADMA music, an FMV slice. - **M9 PS1 mode**: PS1DRV on ee-python, TBIN on the IOP, a PS1 disc to its first frame in Rust (iop.md). - **M10 Timing pass and seeded faults** (each caught): a VIF UNPACK format's lane order; PATH1 and PATH3 priority swapped; MSKPATH3 applied one packet late; an INTC edge treated as a level; D_STAT not raising INT1; a GS swizzle column swapped in PSMCT16; TEXFLUSH ignored; the SIF MSFLG write-to-clear semantics inverted; the IOP clock at 33.8688 MHz in PS2 mode; the SPU2's CORE0 not feeding CORE1. The curated slice list (the smoke rules: problem moments and representative ones; a sweep's failures become slices) starts at M6. **No library sweep in Python, ever**; the sweep runs in Rust.