# Operators: log-sine, exponent, modulation, feedback, connections Citation forms: [start-here.md](start-here.md). Line numbers are IKAOPM 08a5b40's. ## The operator pipeline Each of the 32 slots is computed once per sample (every 32 internal cycles), in slot order, through a pipeline several cycles deep; the sample rate is fM / 64. DOC (AM p.6: "32-slot time division"; DS p.3: the clock is halved inside); DIE (IKAOPM_op.v:41-554). | Step | Behaviour | Evidence | | --- | --- | --- | | Phase in | The top 10 bits of the slot's 20-bit phase plus the 10-bit modulation input, modulo 1024 | DIE (IKAOPM_op.v:60-61, IKAOPM_pg.v:754) | | Quarter wave | Bit 9 is the sign; bit 8 mirrors the quarter: the 8-bit address is bits 7-0 when bit 8 is set and their complement when it is clear | DIE (IKAOPM_op.v:73-77) | | Log-sine | A 256-entry quarter-wave table gives the attenuation of sin(), 12 bits in units of 1/256 of the exponent's octave (4.8 log) | DIE (IKAOPM_op.v:90-144, ROM :559-610) | | Envelope | The slot's 10-bit attenuation (envelope + TL + AM, [envelope.md](envelope.md)) shifted left 2 is added | DIE (IKAOPM_op.v:158-162) | | Clamp | A sum past 12 bits clamps to 4095 | DIE (IKAOPM_op.v:175-178) | | Exponent | The low 8 bits address a 256-entry mantissa table (10 bits, implied leading 1); the top 4 bits, inverted, are a right shift; the result is a 13-bit magnitude | DIE (IKAOPM_op.v:192-293, ROM :613-664) | | Sign | The magnitude becomes a 14-bit two's-complement value; test bit 4 adds an extra bit to the magnitude before the negation (an LSI test path) | DIE (IKAOPM_op.v:249-310) | **The tables.** `scripts/ikaopm_tables.py` expands IKAOPM's two traced ROMs (32 rows, two bit fields per entry) into 256-entry tables at run time and compares them with ymfm's tables, which its author describes as "extracted from the die" of an OPN (ymfm 81aec25, ymfm_fm.ipp:46-135). Result (`reference/ikaopm-tables.txt`): log-sine 256 of 256 equal (IKAOPM's address a holds quarter-wave position 255 - a, because of the mirror above), exponent mantissa 256 of 256 equal. Two independent die readings of related chips agree; the YM2151's tables are taken from IKAOPM (DIE) and the core's rung 0 checks them against `ikaopm_tables.py --dump`. **Closed-box check.** One carrier at TL 0 peaks at +8160 / -8176 in the referee's decoded output and halves per 8 TL steps (6 dB); below TL 112 the output is 0. OBSERVED (Nuked-OPM f209e6e, `reference/referee-probe.txt`). The decoded scale is the referee's own (see [output.md](output.md)), not a contract. ## Modulation and feedback | Rule | Evidence | | --- | --- | | A modulated slot's input is the sum of up to two stored operator outputs (14-bit, sign-extended, carry dropped), halved: bits 10-1 of the sum, in 10-bit phase units (1024 per turn) | DIE (IKAOPM_op.v:524-527, :553) | | M1's feedback input is the sum of M1's last two outputs, shifted right by 10 - FL (FL 1: >> 9 ... FL 7: >> 3); FL 0 is off | DIE (IKAOPM_op.v:401-424, :540-551) | | Feedback strength FL 1-7 is pi/16, pi/8, pi/4, pi/2, pi, 2 pi, 4 pi | DOC (AM p.19, Fig. 2.10); consistent with the shifts above: full-scale 2 x 8191 >> 3 = 2048 units = 2 turns = 4 pi | ## Connections (CON) The graphs are the manual's Fig. 2.9 (DOC, AM p.19). The column "takes the previous sample" comes from the die reading: the modulation for a slot is selected two slot groups (16 cycles) before the slot enters the pipeline, from the outputs available at that moment, so an edge whose source is computed later in the round, or not yet out, uses the value from the previous sample. DIE (IKAOPM_op.v:41-48, :388-509). | CON | Modulation inputs | Takes the previous sample | Summed to the output | | --- | --- | --- | --- | | 0 | M1 -> C1 -> M2 -> C2 | M2's input C1 | C2 | | 1 | (M1 + C1) -> M2 -> C2 | M2's inputs M1 and C1 | C2 | | 2 | M1 + (C1 -> M2) -> C2 | M2's input C1 | C2 | | 3 | (M1 -> C1) + M2 -> C2 | C2's input C1 | C2 | | 4 | M1 -> C1, M2 -> C2 | none | C1, C2 | | 5 | M1 -> each of C1, M2, C2 | M2's input M1 | C1, M2, C2 | | 6 | M1 -> C1; M2, C2 alone | none | C1, M2, C2 | | 7 | none (M1 keeps its feedback in every CON) | none | M1, C1, M2, C2 | The output sums are DOC (Fig. 2.9) and DIE (IKAOPM_op.v:375-382). The previous-sample column is DIE only: no document describes it, and the closed box has not yet been asked (owed to rung 3, which compares every CON with the referee pin for pin). ymfm (81aec25) builds the same graphs from its own operator order (ymfm_opm.cpp:117-136); it is a detector here, not a source for the delays.