# Validation: the oracles and what they said Citation forms and tags: [start-here.md](start-here.md). Every run below was made on 2026-11-19 at this repository's restart (commit noted per script), from the pins in `scripts/fetch_references.py`; outputs are kept in `reference/` (git-ignored). ## The oracles | Oracle | Tier | Pin | Licence | How it may be used | | --- | --- | --- | --- | --- | | Yamaha YM2151 catalogue (LSI-2121512, 1991) | 1, manufacturer document | `YM2151_199112.pdf` | facts only | read; cite page (DS p.N) | | Yamaha YM2151 application manual | 1, manufacturer document | `yamaha_ym2151_synthesis.pdf` (scan; `am-pages/` per page) | facts only | read; cite PDF page (AM p.N); the OCR is poor for tables, read the scan | | IKAOPM (Sehyeon Kim / Raki) | 2, die-derived model with a traced schematic | 08a5b40 | BSD-2-Clause | **read**: tables and formulas may be taken with the notice (NOTICE); describe behaviour, do not translate statement by statement; run under Verilator before rung 4 (decision 5) | | Nuked-OPM (nukeykt) | 3, die-derived model, the referee | at f209e6e (not fetched here since 2026-11-24, Aubrey) | LGPL-2.1 | **closed box only**: driven through `opm.h` by nuked-harness's `opm-events` (a GPL tool kept outside this repository since 2026-11-22, built in emu-tools-gpl, `$EMU_TOOLS_GPL/tools/nuked/build/opm-events`); its `.c` is never opened; values tagged OBSERVED and overruled by any document or hardware number | | ymfm (Aaron Giles) | 5, emulator | 81aec25 | BSD-3-Clause | read; a detector and cross-check; several of its numbers were checked against Nuked-OPM by its author, so they are not independent evidence | | MAME 0.285 (`/usr/games/mame`), `ymopm.*`, `ymfm_mame.h` | 5, emulator run headless | 0.285 | BSD-3 for these files; drivers per file | run for stimulus (tap logs, [mame-oracle.md](mame-oracle.md)); BSD-3 drivers read for wiring ([users.md](users.md)) | | jt51 (Jose Tejada) | die-informed model | https://github.com/jotego/jt51 @ 2ca6601 | GPL-3.0 | not used in this restart; closed box only, its source not fetched since 2026-11-24 (Aubrey); its README's prose about silicon captures was a cross-check only | | MAME 0.228 `ym2151.cpp` (Burczynski), fmgen | emulators | not fetched | GPL / own licence | not used | Hardware: none. We have no YM2151 board recordings; vgmrips packs (decision 10) are a stimulus when Aubrey fetches them, not a judge. ## Frequency and DT1 `scripts/referee_freq.py` (commit d2617d1), output `reference/referee-freq.txt`. One sine carrier per run; the step is the unique integer consistent with every sign change of the referee's decoded output (method in the script's docstring). 8,640 runs, every one resolved to exactly one integer; no output sample was exactly 0. | Comparison | Result | | --- | --- | | Closed box against IKAOPM's ROM and rules, every KC (0x00-0x7F) x KF (0-63), MUL 1, DT1 0 | **8192 of 8192 equal** | | Closed box against ymfm's `s_phase_step` | 8192 of 8192 equal | | IKAOPM against ymfm (computed, no run) | 8192 of 8192 equal | | Unused note codes (low bits 11) sound as the next code | 1984 of 1984; KC 0x7F gives 82976 at every KF, the same as 0x7E KF 63 | | Octave o (3-7) exactly twice octave o - 1 | 3840 of 3840 valid pairs | | Against equal temperament from 440 Hz (the manual's anchor and Fig. 2.4) | 6,144 valid codes: mean -1.20 cents, worst -5.86 cents (KC 0x01 KF 63: low-octave truncation) | | DT1 displacement, 32 KC' x KF 0 and 63 x DT1 1-7 (448 cases) against IKAOPM's rule | **448 of 448 equal** | | The same against ymfm's `s_detune_adjustment` | 448 of 448 | | The same against the manual's Fig. 2.6 | 428 of 448: the 20 that differ are five table cells (KC' 29 with DT1 2; KC' 30 and 31 with DT1 1 and 2), each with its negative, at both KF (C3) | | Negative DT1 (5-7) the exact negative of 1-3 | 32 of 32 KC' | | DT1 independent of KF (0 against 63) | 224 of 224 | So the closed box, the die reading and ymfm agree on every phase step and every DT1 displacement; the manual's Fig. 2.6 differs from all three in its last three rows for DT1 1 and 2. The core takes IKAOPM's ROM and rule (DIE), now confirmed by the closed box. ## The sine and exponent tables `scripts/ikaopm_tables.py` (commit 449c7db), output `reference/ikaopm-tables.txt`: IKAOPM's log-sine ROM expanded, 256 of 256 equal to ymfm's OPN die table (IKAOPM address a = quarter-wave position 255 - a); exponent mantissa 256 of 256 equal. ## The survey (`scripts/referee_survey.py`, output `reference/referee-survey.txt`) | Question | Closed box | Verdict | | --- | --- | --- | | LFO period for LFRQ 0x0F against 0x1F | half periods 17,301,419 and 8,650,667 samples, ratio 2.0000 | manual (Fig. 2.16) and ymfm; IKAOPM's 7/8 is C6 | | CSM key-on at the timer A start | a never-keyed carrier sounds 6 samples after a LOAD with CSM, silent without CSM | agrees with IKAOPM's reading | | YM2164 mode against YM2151 mode | identical output and pins on four sound streams; status differs with timer B running | [ym2164.md](ym2164.md) | | Which SO word is which side | right word under SH1 (cycle phases 8-23), left under SH2 (24-7) | agrees with Fig. 2.17 | ## Earlier closed-box runs (carried, 2026-11-11 to 2026-11-13) `scripts/referee_probe.py` (`reference/referee-probe.txt`): SH1/SH2 timing, BUSY after address and data writes, timer A and B first flags and period in both modes, CT lines by register bit, one carrier's peak by TL. `scripts/referee_measure.py` (`reference/referee-measure.txt`): noise rate by NFRQ, the 2^17 - 1 noise period, noise readout by TL, LFO periods and AM depth by AMS, envelope rates 12, 26 and 63, D1L behaviour, attack times, rates 62/63, the unused key codes (KC 0x43 = 0x44), the KON latch. `scripts/replay_tap.py`: three MAME tap logs replayed ([mame-oracle.md](mame-oracle.md)): CPS-1 `ghouls` status reads 7,988 of 7,988 and 23,969 of 23,969 equal to MAME's; `ddragon` 33,817 of 35,030, the difference being BUSY (C2) and timer-flag edges. These outputs are quoted in the specification documents where they are evidence. ## Owed - IKAOPM under Verilator (decision 5), before rung 4: its own pins against the referee's for the streams above, to vote on C5, C6 and the CON delays. - The pipeline offsets at the pins (where in the 32-cycle round each event lands after a write, U2, U6): rung 1-2 gates against the referee. - The manual's attack/decay time tables (Fig. 2.11) read from the scan and compared.