# Output: clocks, the serial frame, the floating format, the YM3012, the contract Citation forms: [start-here.md](start-here.md). Line numbers are IKAOPM 08a5b40's `IKAOPM_acc.v` unless another file is named. ## Mixing | Rule | Evidence | | --- | --- | | Per channel, RL bit 7 enables the right sum and bit 6 the left; the carriers of the CON are added to the enabled sums | DOC (AM p.15); DIE (:63-71) | | With NE = 1 the noise slot's value replaces the operator value at channel 7 C2's turn | DIE (:63-67) | | Two accumulators (right, left), 18 bits; the right one is taken and restarted at one point of the 32-cycle round, the left one 16 cycles later, so each side's sum spans a different window of slots ("uneven mixing" in IKAOPM's README) | DIE (:75-92) | | A sum outside 16 bits clamps to the 16-bit limit | DIE (:237-264) | ## The serial frame (SO, SH1, SH2) The manual's Fig. 2.17 (AM p.22): per sample, a right word then a left word, each of 13 bits sent LSB first on SO, one bit per phi1 cycle: mantissa B0-B8, Sign, exponent S0-S2, then three idle bits; SH1 is high for the second half of the right word and falls at its end, SH2 likewise for the left word. DOC (AM p.15, p.22). | Rule | Evidence | | --- | --- | | Word = 16 cycles: 9 mantissa bits, the sign, 3 exponent bits, 3 bits of no meaning | DOC (Fig. 2.17); DIE (:303-354) | | SH1 and SH2 are each high for 8 cycles, 16 cycles apart | DIE (IKAOPM_timinggen.v:275-295); OBSERVED (Nuked-OPM f209e6e, `referee-probe.txt`: SH1 cycles 13-20, SH2 29-36 of each 32) | | The right word ends under SH1, the left under SH2 | DOC (Fig. 2.17); OBSERVED (Nuked-OPM f209e6e, `scripts/referee_survey.py so`: a carrier panned right changes SO at cycle phases 8-23, SH1 high 13-20; panned left 24-7, SH2 high 29-4) | | Silence (sum 0) is sent as mantissa 0, sign 1, exponent 1 (S0 1, S1 0, S2 0). The idle referee's SO from cycle 32 reads 0110000100000000 per 16 cycles: read cyclically from its ninth bit, that is nine 0s, then 1 (sign), 1, 0, 0 (exponent) and three idle bits | DIE (:100-112, :322-340); OBSERVED (Nuked-OPM f209e6e, `referee-probe.txt`) | ## The floating format "Alternately output to the serial in mantissa 10-bit (including the sign bit) and index 3-bit offset binary format from the LSB." DOC (AM p.15). | Rule | Evidence | | --- | --- | | The 16-bit clamped sum is put in offset binary (sign bit inverted: 1 for zero and positive) | DIE (:100-125) | | Exponent e = 1 to 7: the number of leading bits (below the sign) that equal the sign decides it; 1 for the smallest values, 7 when the value uses the top bits | DIE (:322-341) | | Mantissa = the 9 bits starting at bit e - 1, sent with the sign: a 10-bit offset-binary mantissa; lower bits are lost | DIE (:344-353) | | Decoding: value = (mantissa10 - 512) x 2^(e - 1), exact for e = 1 | follows from the two rules above (DIE) | ## The YM3012 The YM3012 is the matching D/A converter: it takes SO, SH1, SH2 and phi1 and produces two analog outputs. DOC (DS p.3, p.5; AM p.22, p.25, Figs. 4.1-4.2). We have no YM3012 data sheet: its exact transfer (offset of the mantissa, any half-LSB, the analog stage) is unknown here (U1). The referee's own decoded `left`/`right` (`opm-events`, `EMU_TOOLS_GPL`) are Nuked-OPM's model of the converter: with one carrier at TL 0 they peak at +8160 / -8176 (`referee-probe.txt`), not the integer the formula above gives, so they are a convenience for comparisons, never the contract. ## The output contract (decision 3) 1. **Pins per cycle are the contract.** For every internal cycle the core exposes SO, SH1, SH2, /IRQ and the 2-bit `ct` (decision 8), bit-exact against the referee's pins. 2. `take_samples()` gives decoded `(left, right)` integers, one pair per sample, by the decoding rule above (DIE); the board may ignore it and decode the pins itself. 3. The YM3012, its analog stage and any filters belong to the board. 4. Time is counted in input clocks; the core never assumes a rate (fM 2.0-4.0 MHz occurs in MAME's drivers, [users.md](users.md)).