# Undocumented behaviour, open items, and where sources contradict Items **U1–U24** are behaviours the manuals leave unsaid, ambiguous, or say only in passing, that a core must still decide. **C1–C21** are places where sources contradict each other. Each says what is known, from which tier, and what the build should do; "open" means nothing above emulator tier settles it. Source names as in [start-here.md](start-here.md). ## U1 — PC-relative addressing in a delay slot PM 6.x (`MOV.W/MOV.L @(disp,PC)`, `MOVA`) and SWM: "If this instruction is placed immediately after a delayed branch instruction, the PC must point to an address specified by (the starting address of the branch destination) + 2." MAME sets PC to the target before executing the slot (`sh2.cpp` `execute_run`), so its `MOVLI` reads `((target + 2) & ~3) + disp × 4`: the manual's rule. **Build**: follow the manual; a rung-0 unit test per form. ## U2 — `BT/S`/`BF/S` not taken PM 6.7/6.13 say, without distinguishing taken from not taken, that no interrupt or address error is accepted between the instruction and the next and that a branch in the next position is an illegal slot. HM table 4.10 lists `BF/S`/`BT/S` among delayed branches. MAME (BSD-3-Clause) and ares (`BFS`, ISC) treat a not-taken `BF/S` as an ordinary instruction: the next instruction is not a slot, interrupts may be taken before it, a branch there is legal. **Open** (emulator tier only). **Build**: follow them; record it as unverified. ## U3 — Saved PC of an illegal slot exception HM 4.5.3: the saved PC is "the jump address of the delayed branch instruction immediately before the undefined code or the instruction that rewrites the PC". So `RTE` from the handler resumes at the branch target, not at the slot. **Build**: follow HM; check MAME and jgenesis (run as closed boxes) do the same before rung 1 relies on them. ## U4 — Interrupt acceptance and the instructions that block it HM 4.6: after a delayed branch neither interrupts nor address errors are accepted; after `LDC`, `LDC.L`, `STC`, `STC.L`, `LDS`, `LDS.L`, `STS`, `STS.L` interrupts are not accepted but address errors are. HM 5.6: IRL is sampled "between executing instructions" after a noise canceller ("1011 for 1 clock due to noise" is filtered in figure 5.9). HM's interrupt usage notes (figures 5.11–5.14) ask for a synchronising read after clearing a source (the write sits in the write buffer) and then 1 instruction before `RTE`, or 4 before an `LDC` that lowers the mask, for external sources; for on-chip sources the read alone before `RTE`, and 2 instructions before the `LDC`. How many clocks the noise canceller needs is not stated. **Build**: sample at the ID of the next instruction per PM 7.7.7; a noise-canceller latency of 0 until a measurement exists; record it open. ## U5 — The SH-2 "2.5 cut" interrupt bug Toshiyasu Morita's "Programming the 32x FAQ" (quoted in the 32XDK wiki, Bugs-and-quirks): "The early revisions of the 32x use the 2.5 cut of the SH2, which has a problem with interrupts. Specifically, if a low priority interrupt occurs, and within a 3-cycle window a higher priority interrupt occurs, then the 2.5 revision of the SH2 will jump to the low priority interrupt vector and lose the high priority interrupt. The SR will still be set to the number of the higher priority interrupt, however." Sega's 32X software works around it with a unified handler that dispatches on SR, and with "FRT bumping" (FTOA toggling IRL0 every 16 clocks to re-trigger). Tier: a developer's FAQ, no measurement and no Hitachi erratum found. **Open decision** (handoff brief): a silicon-revision option, default off. ## U6 — Double acknowledgement of one 32X interrupt Sega 32X Technical Bulletin #27 (1994-12-08, `reference/src/32XDK/bulletins/`): with two interrupt sources, a CMD interrupt can be taken twice (level 8, then level 9 when FTOA changes the IRL level before SR is masked), "this problem only occurs on the 32X. It does not occur on the Saturn." This follows from correct IRL sampling plus the 32X's FTOA→IRL0 wiring; the core needs no special case, but the board test that shows it is a good rung-6 check. Manufacturer bulletin tier. ## U7 — MAC saturation details PM `MAC.W`: with S = 1 the addition saturates to 32 bits in MACL (H'80000000–H'7FFFFFFF); with S = 0 the full 64-bit sum. PM `MAC.L`: with S = 1 the sum saturates at 48 bits. Whether a `MAC.W` overflow also sets MACH's LSB is a contradiction inside the manuals (C11): the prose of PM 6.31 and SWM says "if an overflow occurs, the LSB of the MACH register is set to 1", but the code on the same pages marks the two lines that do it "For SH-1 CPU (these 2 lines not needed for SH-2 CPU)". MAME and jgenesis leave MACH alone (rung 1 corpus). Ymir's MAC test vectors are part of a GPL-3.0 program and of unstated origin (validation.md): since the 2026-11 provenance rewrite they are not read; Ymir may only be run as a closed box (its own tests, or a harness here). **Build**: the code's SH-2 annotation for `MAC.W` (MACH unchanged); PM's prose for `MAC.L`'s range (C11); a disagreement on the MACH bit stays open until hardware shows it. ## U8 — Cache: multiple ways with one tag, two-way mode, ID/OD - A tag present in two ways at once can be created through the address array. Hardware behaviour unknown. **Build**: first match in way order 0–3, recorded as a choice. - Two-way mode compares tags in all four ways, so ways 0 and 1 must be invalidated before use (HM 8.4.5); replacement is limited to ways 2 and 3. - CCR.ID/OD: misses read directly to the CPU without replacing (HM 8.2, 8.4.5). The MiSTer Saturn core added these bits in 2025 (segasaturnshiro.com report). ## U9 — Purge ordering behind a pending store (hardware) DN section 2, measured on a CPS3: a cache-through store, a CCR purge request, a cached read, another store, another cached read, four repetitions, gave `1111, 1122, 2222, 2222`; with a second purge before the second read, `2222` four times. "An ordering rule fits all eight data values: the CCR write waits behind the pending store while hits can still use the old line." Executing code written through the cache-through alias after a purge trapped on the stale line's contents. Every emulator checked (Mednafen, Ymir, jgenesis) purges inside the CCR write; srg320's RTL latches CCR without a pending-store guard (DN section 5). Hardware-captured, one board, one author, not replicated on a 32X or Saturn. **Build**: model the CCR write as a write through the BSC's write buffer, so it completes after a pending store, and let hits proceed meanwhile; rung 4 checks DN's eight values. **Built at rung 4** (`cache.py` `write8`, `_core.py` `_settle_ccr`): a CCR write made while the write buffer holds an external write is kept and lands when that write's cycles end; the CPU goes on and its cache hits use the old lines; a miss waits for the write and so lands the CCR write before its fill. With P2's routines rebuilt at P2's addresses (validation/rung4/dn.py) the core gives DN's eight values exactly, and an immediate purge on the same code gives the emulators' pattern DN predicted (1111 and 1122 on every repetition): tests/test_rung4.py. The values do not depend on the CPS3-like bus's speed (1 to 4 board waits on work RAM give the same eight), but they depend on where P2's literals sit: the CCR-address load right after the store hits only because the load of U filled the same line before the store (DN: "inspect the emitted instructions and alignment"); the rebuild matches P2's instruction map. Test 187 (the stale fetch that trapped at H'0202AA00) is **not** reproduced by the rebuild: there the purge lands before the call's fetch unless a work-RAM word write takes 6 states or more; P2's routine (24 instructions, five literals) is not published, and DN calls the trap's explanation an inference. Open. ## U10 — Associative purge space read; the reserved spaces HM 8.4.7 and table 8.2 describe only **writes** to $40000000– (A31–A29 = 010): each purges one line. A read there is undocumented, and $A0000000–$BFFFFFFF (A31–A29 = 101) is reserved (HM table 7.3; absent from table 8.2). DN: "Associative purge was never tested." MAME 0.285 (`sh7604.cpp`, BSD-3-Clause) maps reads of $40000000–$BFFFFFFF to a constant and purges nothing on them. **Open**. **Build** (2026-11-19 rewrite, HYPOTHESIS, own choice): a read of the purge space purges nothing and reads 0; $A0000000– behaves as reserved (reads 0, writes do nothing), like $80000000–. The earlier build took a different rule from an emulator's source; it was removed (docs/provenance.md). ## U11 — Overrun fetches are real accesses PM 7.7.5 and 7.7.7: taken branches and exceptions fetch instructions that are discarded, and "SH-2 always fetches instructions with a long word". In the cache area those fetches can miss and fill lines; in cache-through space they are bus cycles the board sees. MAME fetches only what executes (`sh2.cpp` `execute_run`); the other emulators were not checked. **Build**: make them, per PM; it changes cache contents and bus timing, and the 32xspd and DN loops were expected to need them (rung 4 found one DN loop that does, below). **Built at rung 3** (decided by Aubrey: always on): the scheduler places every fetch PM's figures draw, discarded ones included — taken `BT`/`BF` (two, figure 7.78), taken `BT/S`/`BF/S` (one after the slot, figure 7.80; C13), TRAPA and illegal instructions (two, figures 7.93, 7.97; U21), interrupts and address errors (the replaced instruction's and the next, figures 7.95, 7.96). Each is a `FETCH` cycle on the bus (or a line fill in the cache area) when it opens a new longword; tests/test_pipeline.py `test_overrun_fetches_reach_the_bus`, `test_overrun_fetch_fills_a_cache_line`. The pipeline also fetches two instructions ahead of execution, as figure 7.1 draws: a store to the next two instructions' addresses does not change what runs (the hardware's behaviour, if PM's pipeline is right; MAME executes the new code). Rung 4 (hardware, a CPS3): every P2 loop closes with a taken `BF`. With the two fetches it discards removed, one CPU-resident loop leaves the board's warm samples (p1_02_ramrd_l, eight cached loads a pass, where a discarded fetch meets the last load's MA); the other 66 are unchanged. Modest support for the overrun fetches, one loop deep; 32xspd's `BF/S` loop does not show them (C13). ## U12 — DIVU overflow results HM 10.3.3: on overflow OVF is set and the operation ends after 6 cycles, "the first three ... for flag setting within the division unit and the next three for division". With OVFIE = 1 DVDNTH and DVDNTL hold "the result after 6 cycles of operation"; with OVFIE = 0 DVDNTH holds it and DVDNTL H'7FFFFFFF (positive quotient) or H'80000000 (negative); table 10.2 gives DVDNT the DVDNTL column. MAME 0.285 (`sh7604.cpp`, BSD-3-Clause) sets both registers to H'7FFFFFFF whatever the sign and finishes instantly. jgenesis (`d41e2d9`, run as a closed box through the jgenesis harness, 2026-11-19) saturates DVDNTL by the quotient's sign but keeps no early state in DVDNTH, and its harness panics on H'80000000 ÷ −1. What "the result after 6 cycles" is: Hitachi does not publish the unit's algorithm, no closed box at hand models it, and no SH-2 hardware is here. **Build** (2026-11-19 rewrite, **HYPOTHESIS**, provisional): the state after the first three steps of the PM's own signed division routine (PM 6.19, example 4: a negative dividend decremented, DIV0S, then ROTCL low / DIV1 per step), on DVDNTH:DVDNTL and DVSR (`divu.py` `early_state`). The routine run to 32 steps gives the quotient (tests/test_modules.py), which is why it was chosen; whether the hardware's divider is that routine is unknown. A hardware capture (a 32X or Saturn program reading DVDNTH after an overflow) would settle it. The earlier build's partial result came from an emulator's source and was removed unread (docs/provenance.md). ## U13 — DIVU edge cases - Writing DVDNT also sets DVDNTL and sign-extends into DVDNTH (HM 10.2.2), so a 32 ÷ 32 division is the 64 ÷ 32 operation on the sign-extended dividend. **Build**: one path for both (DOC). - The overflow condition (HM 10.3.3): "When the results of operations exceed the ranges expressed as signed 32 bits (when, in division between two negative numbers, the quotient is the maximum value and a remainder (negative number) is generated) or when the divisor is 0". **Build** (DOC, read literally): a quotient outside −2^31..2^31−1, a divisor of 0, or both operands negative with quotient H'7FFFFFFF and a non-zero remainder. That last case is what the PM's example-4 routine would meet: it divides a negative dividend minus one, and (−H'FFFFFFFF − 1) ÷ −2 = 2^31 does not fit. A quotient of exactly H'80000000 fits and does not overflow. - H'80000000 ÷ H'FFFFFFFF in 32 ÷ 32: the quotient +2^31 does not fit, so it overflows (DOC); with OVFIE = 0 DVDNTL = DVDNT = H'7FFFFFFF. MAME computes `INT_MIN / -1` in C++, which is undefined (on x86 a trap); the jgenesis harness panics. - Division by zero: an overflow (DOC). Which saturated value DVDNTL takes with OVFIE = 0 depends on "the quotient's sign", which a zero divisor leaves undefined. **Build** (HYPOTHESIS): the dividend's sign (a divisor of 0 counts as positive, as DIV0S's M bit would take it); jgenesis `d41e2d9` (closed box) does the same on every case tried. DVDNTH (and DVDNTL with OVFIE = 1) hold the early state of U12. - Non-overflowing results: the quotient rounds toward zero and the remainder takes the dividend's sign. HM says only "signed". **Build**: as MAME 0.285 (BSD-3-Clause, read) and jgenesis (closed box) both give, OBSERVED. ## U14 — DIVU access rules All DIVU registers except DVCR and VCRDIV must be accessed as longwords; word accesses read or write "undefined values" (HM 10.4.1). MAME maps DIVU "64-bit plus mirrors" (`sh7604.cpp`). **Build**: longword semantics, mirrors as MAME maps them, undefined word access returns the longword's matching half and records it as a choice. ## U15 — Address errors HM 4.3: misaligned word/longword data accesses, odd instruction fetches and some forbidden-space accesses raise the CPU address error (vector 9); DMA address errors use vector 10. ares (ISC, notice in NOTICE): "unemulated: access of Purge, Address, or IO areas by PC-relative addressing; unemulated: address errors caused by stacking of address error exception handling". **Build**: HM's list; what the misaligned access itself does on the bus before the exception is open. **DMA address errors** (built 2026-11-25, sh2-rust's request R2; before, a misaligned DMA access was made as if aligned, and a longword from the data array at H'FFD-H'FFF raised `IndexError`). DOC: HM table 4.6 applies its misalignment and on-chip size rows to "CPU or DMAC" (a 16-byte unit is four longword accesses, note 2); HM 9.2.7 (DMAOR.AE: "Operation is performed up to the DMAC transfer being executed when the address error occurred"; no transfer while AE = 1; AE clears by reading 1 and writing 0); HM 9.3.8 ("all channels stop their transfers"; "In dual address mode, DMA transfer will be halted after the completion of the following write cycle even when the address error occurs in the initial read cycle. SAR, DAR and TCR are updated by the final transfer"; TE = 1 only if that was the last transfer); HM 9.2.4 (TE stays 0 when an address error ends the transfer early); HM table 4.1 (the DMA address error ranks below the CPU's and above every interrupt), table 4.2 and 4.3.2 (taken when the instruction under way ends, the next instruction's address saved), HM 4.6.1 (not between a delayed branch and its slot), HM 14.3.2 (it ends SLEEP). **HYPOTHESIS** (U15's open half, taken the way this core takes the CPU's misaligned accesses): the faulting access makes no bus cycle, a faulting read gives 0 to the write, and a faulting write is not made. A probe that DMAs from a misaligned source into RAM (and to a misaligned destination) with the bus on a logic analyser would settle it; nothing in the family's evidence does (`dmac.py` `_transfer`, tests/test_state.py). ## U16 — On-chip module register quirks - WDT: WTCSR and WTCNT are written with a word write to H'FFFFFE80 whose upper byte is H'A5 (WTCSR) or H'5A (WTCNT); RSTCSR through H'FFFFFE82 (H'A5 with H'00 to clear WOVF); they read at FE80, FE81 and FE83 (HM 12.2.4, appendix B note). - Byte-only modules at $FFFFFE00–$FFFFFEFF, 16/32-bit at $FFFFFF00– (HM appendix B). - H'FFFFFE82 has no register to read (RSTCSR reads at FE83). **Build** (HYPOTHESIS, own choice since the 2026-11-19 rewrite): reads 0. - FRT's 16-bit registers are read and written a byte at a time through an 8-bit TEMP register, upper byte first (HM 11.3). - **Build**: HM; unknowns recorded as choices. ## U17 — FTOA/FTOB and the 32X's IRL0 The 32X wires FTOA to IRL0 on both SH-2s; its boot code runs the FRT so FTOA toggles every 16 clocks ("FRT bumping", 32XDK wiki). The core must expose FTOA as an output the board can see change, with the clock at which it changed. ## U18 — Power-down `SLEEP` (3 states, then sleep until an interrupt or reset), standby (SBYCR.SBY = 1 before `SLEEP`), module stop bits MSTP0–4. The MiSTer Saturn core added standby in 2025 (segasaturnshiro.com report). **Build**: HM chapter 14. ## U19 — Undefined register values HM table 2.1: R0–R14, GBR, MACH, MACL, PR and SR's M, Q, S, T are undefined after reset; the cache contents are not initialised by reset (HM 8.5.1). No measurement exists. **Build**: zero, and a constructor option to fill them, so that software depending on them shows up. ## U20 — Which revision is the 32X's / the Saturn's SH-2 HM Rev. 4.0 (2001) is the newest SH7604 manual; it describes no revisions. The "2.5 cut" (U5) implies at least one earlier silicon revision with a bug. No document lists revision differences. **Open.** ## U21 — Which fetches the illegal instruction sequences make PM figure 7.97 draws the next instruction's IF and, in parentheses, the third's, and says "Whether there is an IF only in the next instruction or in the one after that as well depends on the instruction that was to be executed." Undefined code has no "instruction that was to be executed". **Build**: both, as TRAPA (figure 7.93, the same nine stages); for a slot illegal, the branch target's fetch (already made in the slot's ID) and the one after it. Choice, manual-silent; it changes one overrun fetch. ## U22 — The write buffer's timing (HM 7.11.2) HM 7.11.2: "the bus state controller has one level of write buffer"; a write is reported complete to the CPU "without waiting for the actual writing ... to end" when the internal bus is free; "During reads, the CPU always has to wait for the end of the operation"; on-chip module accesses need not wait for a buffered external write. HM does not say how many states the CPU spends handing a write over, when exactly a second write is taken, or how a DMA write uses the buffer beyond the dual-address rule. **Build (rung 4)**: a CPU write's access (its MA) lasts until the buffer is empty plus one state; the buffered write's cycles start in the state the buffer takes it; a second write and every external read (cache-through, fill, fetch miss, DMA read) wait until the cycles end; on-chip accesses never wait (CCR aside, U9); DMA writes are not buffered (their cycles hold the bus, rung 5). DN's store-overlap loops (hardware, a CPS3, bus-crossing: detector) have this shape: a long store with 0 or 2 independent ADDs after it costs the same per group, 8.00 on the core's CPS3-like bus and 8.46 on the board, and with 8 ADDs 10.00 and 10.14, where the CPU's own instructions take over (validation.md "What ran, rung 4"). ## U23 — Synchronous DRAM cycles: what HM 7.5 leaves to the reader HM 7.5 gives each SDRAM cycle as a timing figure with named states (Tr, Trw, Tc, Tw, Td, Tap, Tp, Tnop, Trwl) and the MCR/WCR fields that add or remove them; it gives no cycle counts and no figure for every combination. What the build reads into them (bsc.py's table, docs/timing.md "Synchronous DRAM"): - **The tail is the bank's, not the bus's.** An auto-precharge read's Tap and a write's Trwl + Tap are drawn inside the cycle (figures 7.15-7.18), but HM 7.5.3 says that during Tap "no new access commands are issued to the same bank. Accesses of the other bank ... by another CS space are possible", and HM 7.5.6 that the precharge wait becomes "invisible" when the next access comes later than tAP (reads) or tRWL + tAP (writes). **Build**: they hold back only the next command to that bank. - **Tap's count**: "When the CAS latency is 1, a Tap cycle of 1 or 2 cycles is generated. When the CAS latency is 2 or more, a Tap cycle equal to the TRP specification - 1" (HM 7.5.3), for reads. For writes HM names Tap without a count; **build**: TRP cycles (the precharge starts after Trwl, so nothing of it overlaps the cycle). - **TRWL in bank-active mode** "specifies the period for which the precharge command is disabled after the write command" (HM 7.2.4). **Build**: a Tp to that bank may not start before the write's end + TRWL; it shows only when a row change follows a write at once. - **A row change**: figure 7.21/7.24 draw Tp then Tr; TRP sets "the number of cycles between the issue of the precharge command and the row address strobe command" (HM 7.5.6), so with TRP = 2 cycles a Tnop sits between them, as HM 7.5.7 says for refresh. - **Rows and banks**: HM table 7.4 gives the pins, not the row. **Build**: the bank is the address bit table 7.4's note 2 marks; the row is every address bit from the one the row phase puts on the device's A0 (the chip's A1 with SZ = 0, A2 with SZ = 1, HM 7.5.2) up to the bank bit. For the 32X (SZ = 0, AMX = 111): bank A17, row A16-A9. - **A burst's callbacks**: HM 7.5.4 says a cache-through or DMA read of SDRAM still makes the 8-cycle burst and fetches data only in Td1 (word, byte) or Td1-Td2 (longword on 16 bits). **Build**: one call per cycle that fetches data, the first carrying the command states and the last the unused data cycles; a line fill is 8 (or 4) calls, all its cycles data. - **Bus release**: "Both banks will become inactive ... after the bus is released by bus arbitration" (HM 7.5.6). The core does not see arbitration (the board does), so the board calls `chip.bsc.bus_released()`; the precharge's own states are not modelled. Manual tier, read; the 32X's figures agree with jgenesis #493's reading of the same pages (research) and fall inside Sega's 32X Manual's (C21). ## U24 — The refresh timer and the refresh cycle - **Period**: "RTCNT is cleared to 0 at that time [the match] and the count up starts again" (HM 7.5.7), and RTCNT "Returns to 0 after it counts up to 255" (HM 7.2.6). **Build**: the count that would reach RTCOR clears it and makes the request, so a request comes every RTCOR counts of CKIO / CKS (the 32X: 89 × 4 = 356 states); RTCNT never reads as RTCOR. Counts fall on multiples of the divider from reset, as the WDT's. - **The cycle's length**: figure 7.25 draws Tp, Trr, then Trc Trc Trc Tre (TRAS + 2 with TRAS's reset value 2 cycles); HM 7.2.4 calls the last part a time in which "the synchronous DRAM does not issue a bank active command". Whether other areas' cycles may run during it is not said. **Build**: the whole cycle holds the bus (the figure), Tp [Tnop] Trr + TRAS + 2: 7 states on the 32X; one `read(..., REFRESH)` call at the first SDRAM area's base. - **When**: "When a refresh request occurs while a bus cycle is executing, the refresh will not be executed until the bus cycle is completed" (HM 7.5.7). **Build**: a line fill, a burst and a longword's port cycles are one access, never split; a request during one is made when it ends; one made while the bus is idle is made at the request (reported at a step boundary or before the next access, with ``chip.clock`` set to its start for the call). A refresh does not delay the CPU unless the CPU wants the bus while it runs. - **CMF/CMI**: CMF is set at each match whatever RFSH says; CMI is requested with CMIE at IPRA's WDT level and VCRWDT's BCMV vector (HM table 5.4 orders it after the WDT). - **Self-refresh** (RMD = 1) is not modelled: no refresh is made and the SDRAM stays accessible. ## Contradictions ### C1 — `TRAPA` takes 8 or 6 states 8 in PM, PM95, HM chapter 2 and SWM's own `TRAPA` page (6.1.69); 6 in SWM's summary table. PM's pipeline figure for `TRAPA` has 9 stages (SWM table 7.1: "8 cycles, 9 stages"). **Build**: 8. ### C2 — Cache line fill order HM 8.4.1/figure 8.4: the fill starts at the requested address + 4 and wraps, the requested longword last. ares reads offsets 0, 4, 8, C in order and charges a flat 12 cycles (`sh7604/cache.cpp`). The order matters only to a board that sees it (a 32X SDRAM burst; side-effect reads). **Build**: HM. ### C3 — When a CCR purge takes effect HM 8.4.6: "Cache purges are completed in 1 cycle, but additional time is required for writing to CCR", and the cache keeps serving fetches while CCR is written. DN (hardware): the purge waits behind a pending store while hits use the old line (U9). Emulators: immediate. **Build**: DN. ### C4 — DIVU overflow results HM vs MAME (U12). **Build**: HM, with the early state a HYPOTHESIS (U12). ### C5 — How long an ordinary instruction takes PM/SWM: the pipeline model above. jgenesis' `sh2-emu` README: "does not attempt to track timing. Almost all instructions take 1 cycle plus memory access delays" (since tuned for branches, jgenesis #493). MAME's interpreter: one cycle per instruction plus fixed extras (`sh2.cpp` `execute_run` decrements `icount` once per instruction). Hardware (32xspd's cached-read loop at 11 cycles per 8 instructions; DN's 1.49–1.50 clocks per cached load) agrees with the pipeline model, not with one cycle per instruction. **Build**: the pipeline model. ### C6 — HM chapter 2's branch rows HM's instruction table prints `BT` with the description "Delayed branch, if T = 1 ..." and `BT/S` with "If T = 1, disp × 2 + PC → PC; if T = 0, nop", the two descriptions swapped (the codes and states are right: `BT` 3/1, `BT/S` 2/1). PM and SWM are correct. **Build**: PM. ### C7 — CCR in HM - HM 8.2 CP: "When 1 is written to CP, all cache entries ... are initialized"; HM 8.4.6: "Purges of the entire cache area can only be carried out by writing 0 to the CP bit". HM figure 8.12's code writes 1 (`OR #H'10,R0`). Writing 1 purges. - Bit 2 is "OD" in HM 8.2 and "OC" in HM appendix B. - HM figure 8.12 has two typos (`MOV.B #R0,@R1`, `MOV.B R0,R1`). ### C8 — Mednafen's timing reputation Mednafen's SH-2 is often called the accurate one for cache and timing; its own documentation does not claim cycle accuracy for the SH-2. It is GPL-2.0: since the 2026-11 provenance rewrite it may only be run as a closed box (built by `scripts/build_referees.py`, driven by a harness here), never read. Use it as a judge of nothing; at most as a closed-box detector. ### C9 — When an interrupt is taken HM/PM: an interrupt is received in the ID stage of an instruction and replaces it (PM 7.7.7; HM figure 5.7). Emulators take interrupts at other points (C12 for MAME). **Build**: HM/PM; emulator acceptance points are detectors only. ### C10 — Read width on the external bus HM 7.4.1: a read's size is not on the pins; it is always the device's full width. Emulators (MAME, jgenesis) hand their boards the CPU's access size. The board-facing contract has to pick one (handoff brief, open decision). ### C11 — `MAC.W` and `MAC.L` with S = 1: the manuals' prose against their code - `MAC.W` (PM 6.31, SWM): the prose sets MACH's LSB on overflow; the code says those lines are SH-1 only (U7). Followed: the code's SH-2 annotation. - `MAC.L` (PM 6.29): the prose limits the result to H'FFFF8000_00000000 .. H'00007FFF_FFFFFFFF using "only the lower 48 bits" of MAC; the code adds MACH's low 16 bits unsigned and saturates the negative side to H'00008000_00000000 (the sign bits clear, outside the prose's range). MAME transcribes the code; jgenesis clamps the full 64-bit sum. Followed: the prose (MAC's low 48 bits sign-extended, the sum clamped to 48 bits and stored sign-extended). Rung 1 rules its 45 disagreeing cases this way (validation/rung1/overrides.json, `mac-l-saturation`). ### C12 — MAME 0.285 accepts interrupts where HM 4.6 says none are accepted HM 4.6.2 and table 4.10: after `LDC`, `LDC.L`, `STC`, `STC.L`, `LDS`, `LDS.L`, `STS`, `STS.L` an interrupt is not accepted before the next instruction. MAME's interpreter checks pending interrupts whenever a line changes or SR is loaded (`sh2.cpp` `execute_set_input`, `LDCSR`'s `m_test_irq`), with no such rule: in the rung-2 trace of BC Racers it took 58 interrupts right after an `LDS`/`STS` class instruction in the first 20.6 M master instructions (the first after `LDS R1,MACL` at H'0206A4EE, instruction 5,292,129). Its `SLEEP` also loops on the instruction (`pc -= 2`) instead of stopping the CPU, so a trace shows SLEEP repeated until the interrupt. **Build**: HM. The rung-2 replay counts these as MAME's (`mame-interrupt-after-ldc`, `mame-sleep`) and takes MAME's interrupt at MAME's boundary so the comparison can continue. ### C13 — Does a taken delayed branch fetch the instruction after its slot? PM figure 7.80 (`BT/S`/`BF/S` taken) draws the instruction after the slot fetched in the branch's EX slot and discarded; figure 7.82 (`BRA`, `BRAF`, `BSR`, `BSRF`, `JMP`, `JSR`, `RTS`) draws no fetch there, the target's IF in the next slot. The two are the same kind of branch once taken. The notes under figures 7.79 and 7.81 speak of overrun fetches for the conditional branches only. **Build**: each figure as drawn — a conditional branch fetches on before its condition redirects the stream, an unconditional one does not. It matters only when the branch's EX slot holds an MA (the extra fetch splits it) or the fetch is slow or opens a new cache line. tests/test_pipeline.py figures 7.80, 7.82. Rung 4 does not decide it. 32xspd's cached-read loop ends in a taken `BF/S`, but its EX slot holds no MA and the discarded fetch is a one-state cache hit: the loop takes 11 states with the fetch and without it (checked by removing it). No DN loop uses `BT/S` or `BF/S`. **Open**; a cold or cache-through `BF/S` loop timed on hardware would decide it. ### C14 — Figures 7.4-7.6 draw a bus fetch for every instruction PM figures 7.5 and 7.6 give each consecutive instruction its own bus fetch (7.5: three 2-cycle IFs in a row; 7.6: the IFs of instructions 4 and 5 both split their slots). On the SH-2 a fetch is a longword, so of two consecutive instructions one is an `if` with no bus cycle (PM 7.4.2, figure 7.7; figure 7.8 is the SH-2 version of figure 7.6). Figure 7.4 draws two instructions only; the third one's fetch falls in the slot of the first one's three-cycle MA and splits it (PM 7.4.1). **Build**: the SH-2's longword rule. The tests reproduce the figures with the cycle counts they state and SH-2 fetches: 7.4 with the split (its second instruction's EX one column later), 7.5 with the third fetch an `if` (6 states from the first EX to the fourth, not 7), 7.6 with slot E unsplit. ### C15 — Where a one-state stage sits in a longer slot Most figures draw a one-state stage at the start of a slot that an extended MA makes longer (`ID EX — — MA` in figures 7.35, 7.38, 7.40, 7.64-7.66, 7.68), as figure 7.4 draws `EX — —` in its three-cycle slot ("the instruction with the longest stage stalls others", PM 7.2.3). Figure 7.39 draws the third instruction's EX at the end of that slot (`ID — — EX MA`), twice. Where EX sits changes how the states are split between two instructions (PM 7.3), not their sum. **Build**: the slot's start (figure 7.4, PM 7.2.3). ### C16 — Figure 7.26's slot arrows Figure 7.26 (MAC.W after MAC.W with IF contention) draws the second split's long arrow one column to the right of the stages it splits: the second MAC.W's second MA is under a short arrow and the long one covers the next instruction's EX and MA, which cannot share a slot (PM 7.2.1). Its stage columns follow PM 7.4.1 (MA, then EX/ID/IF together). **Build**: the columns. ### C17 — Figures 7.40, 7.67 and 7.68 with impossible rows - Figure 7.40, first case (MULS.W right after MAC.L): MAC.L has five `mm` and MULS.W an MA followed by an extended MA. MAC.L has four (PM 7.7.2, figure 7.34) and MULS.W one MA (figure 7.53); the same figure's other three cases draw both correctly. - Figure 7.67 (DMULS.L after DMULS.L with IF contention): the second DMULS.L's row is `if — EX — ID MA M—A`, EX before ID. - Figure 7.68, second case: MULS.W has two MAs, its second in the same column as the next instruction's MA (PM 7.2.2 forbids it). **Build**: the rules every other multiplier figure follows; the tests use figure 7.68's first case for 7.40's, figure 7.37's layout (MAC.L after MAC.L, same stages) for 7.67, and one MA for 7.68's MULS.W. ### C18 — MAC.W and MAC.L: 3 states or 2 PM table 7.2 and table A.50 give MAC.W and MAC.L "3/(2)" and "3/(2 to 4)"; figures 7.23 and 7.34 draw 2 states from their EX to the next instruction's when nothing contends. In a sequential stream from on-chip memory fetches alternate `IF` and `if`, so one of the MAC's two consecutive MAs always meets a bus `IF`; the split adds a state, and both MA slots end before the next instruction's EX (which follows the second MA's split). **Ruling**: no contradiction in effect — the figures are the model, and the table's 3 is what they give in a real stream (tests/test_pipeline.py `test_c18_mac_is_three_states_in_a_sequential_stream`, both alignments). ### C19 — SWM section 7 (the SH-DSP's pipeline) against PM SWM section 7 describes the SH-DSP, whose pipeline has a WB/DSP stage; it agrees with PM everywhere the scheduler was checked except two places: - SWM figure 7.14: a load followed by a store of the loaded register does not contend ("the same data is simultaneously output again to the internal bus"). PM 7.5 lists two exceptions to the load-use split and not this one, so on PM's rule the store uses the register and splits the slot. - SWM figure 7.16: an STS after MAC.W waits with stalls and then makes a one-state MA after the `mm` ends; PM figure 7.30 extends the MA over the `mm`, one state sooner. **Build**: PM, the SH-1/SH-2 manual (SH7604 is an SH-2). Open: DN's CPS3 loops (rung 4) include stores after loads and could show the forwarding; a hardware result there would decide it. Rung 4 does not decide it. The only P2 loops that store a just-loaded register are the copy loops (`MOV.L @R12+,R0` then `MOV.L R0,@R13`), and their stores go to the CPS3's work RAM: each waits for the write buffer, which hides the one state the split costs. Run with SWM's forwarding instead of PM's split, ten of the twelve copy loops give the same totals and the other two differ by 2-3% in loops the core misses by 20-30% for bus reasons (detectors). **Still PM**; deciding it needs a load-then-store loop that stays off the external bus, timed on hardware: a store to the data array (H'C0000000-, the cache bus only, HM 8.4.8) of the register a cached load just wrote. ### C20 — HM 7.11.2 says on-chip accesses do not wait for a buffered write; DN's CCR does HM 7.11.2: "After a write has been performed to low-speed memory off the chip, performing a read or write with an on-chip peripheral module enables an access to the on-chip peripheral module without having to wait for the completion of the write". CCR is an on-chip register (H'FFFFFE92). DN's eight purge-order values (hardware, a CPS3) fit only a CCR write that takes effect after the buffered store (U9); an immediate one gives a different pattern. The two can both hold if the CPU's CCR write itself does not wait (the CPU goes on, as HM says) but the purge it requests is ordered behind the buffered write. **Build**: that (U9): every other on-chip access follows HM; CCR's effect is ordered behind a buffered external write. Hardware-captured on one board, the judge for purge ordering (decision 7). ### C21 — Sega's 32X Manual against HM 7.5 on the 32X's SDRAM Sega's 32X hardware manual (32XDK wiki, section 4.1): SDRAM "8 words are read in 12 cycles", writes 2 a word. HM 7.5 with the boot ROMs' BCR1/WCR/MCR (bank active, CAS latency 2, TRP = RCD = 1): a burst 11 to an idle bank, 10 on its open row, 12 on another row; a word write 2, 1 or 3. Sega's figures are HM's cases for a row change (reads) and an idle bank (writes): the Manual gives one number where HM's depends on the row state. jgenesis #493 (research) read HM the same way and matched the 32xspd photograph better with it. **Build**: HM (manual, the chip's own document); Sega's numbers are what a programmer may assume in the worst common case.