# Notes: SpritesMind thread 386, part 4 (posts p27124 to p38015, 2015-10-05 to 2023-06-22) Source file: `reference/scratch/t386-part4.txt` (pages t386-720 to t386-855). Read in full, 3,578 lines. Thread URL: https://gendev.spritesmind.net/forum/viewtopic.php?t=386&start=720 ... &start=855. Only what the posts say; nothing added. "internal clock/cycle" = master clock / 6 (Sauraen's term). "FM tick" (jotego) = the same thing. 24 internal cycles = one sample = 144 master clocks. Basis labels: **HW** measured on hardware; **DIE** read from a die photograph; **MAN** from a manual; **EMU** the poster is repeating what an emulator or HDL model does; **SPEC** speculation / inference. Who is who in this part: - **Sauraen**: traced the YM2612 die (photographs by HardWareMan) and the YM2203 die; owns a synth ("MIDIbox Quad Genesis") with four discrete DIP **YM3438** (and built one earlier with four YM2612) on which he ran test-register read-back tests. Published a VHDL operator unit at https://github.com/sauraen/YM2612 (licence not stated in the thread; described by him as "untested"). - **Eke**: author of Genesis Plus GX; ran BUSY tests on a VA4 MD1 and VA0 MD2 in 2017. - **Stef**: SGDK author; ran write-timing tests in 2023 on MD1 VA0, Nomad, an MD3 clone. - **TmEE**, **Sik**, **Kabuto**: driver/demo authors reporting hardware experience. - **jotego**: author of JT12/JT51 (GPL Verilog). **nukeykt**: author of the Nuked models. Their statements are kept under their own heading (section 16). --- ## 1. Clocking, sample rate, the 144 divider 1.1 The chip divides its input clock by 6 internally; all units run on that internal clock; one full pass over everything takes 24 internal cycles = 144 external clocks. - Sauraen p29513 (2016-04-22), DIE: "Yup, this has been known for a while. It takes 24 INTERNAL clock cycles to evaluate everything, which is 144 external clock cycles." - Sauraen p27124 (2015-10-05): sample rate is "external clock / (6*24)"; p27155: "exactly (68000 clock) / (24*6), or exactly 144x 68000 [cycles] per sample". - HardWareMan p30920 (2017-02-27), DIE: near the clock buffer there is "some kind divider or counter (notice: with 6 steps)" and "some kind shift register right below it. I believe this is main sync circuit". - The chip has clocks of both polarities throughout (Sauraen p27124); logic uses latches gated by each clock phase, not edge-triggered flip-flops (p27319, p29553). DIE. 1.2 In the Mega Drive the YM2612's clock is the 68000's clock, not the Z80's (Stef p27133; Sauraen agrees p27138). Sauraen's synth clocks the chips at 8 MHz, "not at 7.67MHz" (p29443). 1.3 nukeykt p34277: in Genesis Plus GX his model's clock function "is called 1.27(7.67/6) million times per second (for comparison MAME code works at 53.267 KHz)". EMU. ## 2. Bus interface: address and data latches, part selection 2.1 There is one address register and one data register for all non-$2x writes; the $2x registers sit at the same level. Sauraen p27124, DIE: "when you write $78 to $52, it immediately stores $52 in the address register and $78 in the data register, and then when that operator--determined by the current address register--comes around in the circular buffers, it actually changes the value to whatever's in the data register." 2.2 Writing data does not unlatch the address: "you can keep writing data over and over to the last address" (Sauraen p27124, DIE). 2.3 The operator/channel address register is enabled by any address that is not $0X, so a $2X address write also overwrites it. Sauraen p27138 (DIE), retracting his p27124 statement that a $2X register can be written while an operator write is pending: "the operator/channel address register is enabled by any address which is not $0X ... if you write another $2X register the operator/channel address register will get overwritten with that value as well." 2.4 A pending operator/channel write is lost if another is written before it lands; and a wrong write can happen: Sauraen p27124 (DIE): "if you write one address and data, and then you write a new address and data, but between writing the new address and writing the new data the new address's register comes along, it will write the old data in the new address (and then 24 cycles later the new data at that address...)". (The "24 cycles" is superseded by section 3.4: the registers have two write points.) 2.5 Part selection (A1). Eke p34279 (2018-11-25) quotes Nemesis's earlier HW test (from the post at `t=386&start=410`): "writing to an address register stores both the written address, and the part number of the address register you wrote to. You can then write to either the data port at $A00001, or the data port at $A00003, and the write will go to the register number you wrote, within the part of the address register you wrote to. This means you can, for example, write an address to $A00000, then write the data to $A00003, and the data will in fact be written to the part 1 register block, not the part 2 register block." Eke: "Not sure if he tested also with global registers ($2x) though". - Stef p37836 (2023), HW: "both address ports share the same register (it doesn't make any difference writing the address to $4001 or $4003)". NOTE: this wording conflicts with Nemesis's result above as quoted (Stef names the data-port addresses $4001/$4003 as "address ports"; unclear what he tested). Leave as an open contradiction. - nukeykt's account of A1 for global registers: see 16.6. ## 3. Write timing and the register file 3.1 Registers are held in circular shift registers; a write lands when the addressed entry comes round. Operator parameters: 24 stages. Channel ("voice-level") parameters: "5-6 units/layers deep" (Sauraen p34255, DIE). Early statement (Sauraen p27138, "Haven't checked yet"): "All $2X registers will update within one internal clock. All operator registers update once every 24 internal clocks... Some channel registers are like the operator registers and only update once every 24 clocks. Others update every 6 clocks." 3.2 Yamaha's stated wait times (YM3438 application notes, page 10, in Japanese), as reported by jotego p34249 (2018-11-22), MAN: ``` Address register: 17 master clock cycles -> 2.8 = 1 + 1.8 FM clock cycles Data on global or operator register: 83 master clock cycles -> 13.8 = 12 + 1.8 FM clock cycles Data on channel-wide register: 47 master clock cycles -> 7.8 = 6 + 1.8 FM clock cycles ``` jotego's reading (SPEC): a fixed delay equivalent to about 2 master clocks through the input latches, leaving 12 FM cycles for global ($2x) and operator registers and 6 for channel registers. Stef p37832 (2023) gives the same official figures as: ``` - 17 YM cycles (8 Z80 cycles) between writing the address and data - no wait between writes to addresses $21-$2F - 83 YM cycles (39 Z80 cycles) between writes to addresses $30-$9E - 47 YM cycles (22 Z80 cycles) between writes to addresses $A0-$B6 ``` (Note the two reports differ on the $2x registers: jotego says 83 for "global or operator", Stef says no wait for $21-$2F. Check the manual page itself.) 3.3 Stef's hardware test of those figures, p37832 (2023-01-17), HW. Method: writes from the 68000, assuming no extra bus delay; tested on a YM2612 (MD1 VA0) and the ASIC YM3438 (Nomad, and an "MD3 clone"); "I can confirm that timings are identical" between the two. Results: - address to data: "I couldn't got any problems using 12 cycles (5-6 Z80 cycles). With 10 cycles or less you indeed got some missed or corrupted writes quickly". - $2x registers need no wait, "except for the $28 register (key on/off)": chained key writes on the same channel too quickly give "completely missed writes or even altered envelop phase (!?!) ... (note play but quieter than expected). The minimum delay for safe operation is about 112-116 cycles (52-54 Z80 cycles)". - "The 83 cycles / 47 cycles for $30-$9E / $A0-$B6 registers seems to perfectly matches what i measured." (Cycles here are YM master-clock cycles.) - TmEE p37833: needed "a larger than normal delay on key on/off registers"; the envelope oddity "is because the 4bits react differently and sometimes one or more won't do same as others". HW experience. - Stef p37836: agrees it "maybe caused by only having part of the operators key ON/OFF state being properly updated". - Sik p34247 (2018): "I got reports that it's possible for a write to register $28 to go missing and you need to do key-on twice as a workaround." 3.4 The 24-stage operator register is two groups of 12 with a write point at each. Sequence: - Sauraen p34246 (2018-11-21) first said there was "no way to write to the middle" (later marked by him "[EDIT: this is wrong]"). - jotego p34243/p34249 proposed (SPEC, from Kabuto's Overdrive 2 experience that 12 FM cycles suffice, Sik's Echo experience, and the manual's 83-clock figure) a second multiplexer in front of stage 13. - Sauraen p34255 (2018-11-22), DIE, YM2612: "Surprise surprise, I was wrong. I thought I remembered them being 24 units/layers deep, and they are, but they're broken up to two groups of 12, with logic in between and at the beginning and the end. I don't have time right now to fully transcribe it, but given the other findings here, it seems reasonable that this allows a write to be made to the end or the middle. ... the two values that could be updated would be subsequent operators in the same voice (e.g. voice 5 operator 3 is in the middle and operator 2 is at the end)." Not fully transcribed by him: the write-at-both-points behaviour is "reasonable", not read gate by gate. - jotego p34263: data flows in the order ``` Operator (binary) 00 01 10 11 Channel (decimal) 0-1-2-3-4-5-0-1-2-3-4-5-0-1-2-3-4-5-0-1-2-3-4-5 ``` so entries 12 stages apart differ only in the operator's top bit. (His own numbering; SPEC as to whether the chip shares the logic.) 3.5 Practical driver timings reported (HW experience, not controlled measurement): - Stef p27133 (2015): "some registers requires no more than ~25 Z80 cycles to be processed but others can take ... ~70-80 Z80 cycles". - TmEE p27127: TL writes and the L/R flags register seemed to need longer delays than others. - Sik p29438: "You need to wait 33.6 Z80 cycles after you write to $4001/3 (the second write)... you don't need any delay after $4000/2". Echo "just assumes 19 Z80 cycles is enough" (p27178) and works on both chips (p29442). - Sauraen p29443: his VGM driver waits "25us or 200 external OPN2 cycles at 8 MHz ... or 33.3 internal cycles"; "works on both YM2612 and YM3438 with no audible dropped commands". - Stef p27145 (2015): "I observed than write processing time on YM3438 is actually *slower* than YM2612"; p29440 repeats it. **Corrected by Stef himself** in p37832 (2023): timings "roughly identical", then "identical". - jotego p34243: "Kabuto's Titan 2 Overdrive demo does not work well with a 24-stage circular shift register. His experimentation tells him that 12 FM cycles are enough to get a good write." ## 4. BUSY flag and status read 4.1 BUSY is a plain timer, started by a data write, 32 internal cycles long. - Sauraen p27124 (2015-10-05), DIE (YM2612): the BUSY bit "comes from a small timer/counter whose only inputs are the two clocks ..., system reset, and the 'please read data off bus into registers' signal. The counter has 5 or 6 stages and is probably an asynchronous counter rather than a shift register, meaning it counts 32 or 64 cycles (of the internal clock...)". He guessed 5 bits / 32. - Sauraen p27138: "it's triggered by data write, you can write addresses all day and the BUSY flag won't be affected." - Eke p31026 (2017-04-02), HW: tests "on VA4 MD1 (with discrete YM2612) and VA0 MD2 (with 315-5660 ASIC)": ``` 1) BUSY flag can only be read from port 0 (A0=A1=0) on discrete YM2612 while it can be read from any port on ASIC-integrated version 2) BUSY flag is only set on DATA port writes (A0=1) 2) BUSY flag duration is constant and does not depend on the written register 3) BUSY flag duration seems to be 32 internal clocks (32*6 68k clocks): this was tested with my emulator against real hardware using a test program that counts number of status read with BUSY flag being set. Results were identical to real hardware on emulator with busy wait set to 32*6 68k cycles, other values (like 24, 48 or even 30) give too much different values than real hardware 4) BUSY flag duration is the same on discrete YM2612 and ASIC-integrated chip ``` Method note: the 32 is inferred by matching an emulator's count of BUSY-set status reads to the console's, not timed directly. - Sauraen p31154 (2017-04-18), DIE: "whenever you write a data value, BUSY gets set, and gets cleared exactly 32 cycles later. On the die shot it's just a 5-stage counter, not connected to anything else." - Sauraen p31240 (2017-04-21), DIE: "The BUSY timer's only inputs are chip reset and a signal indicating a data address was written, and it has one output. This output goes to a unit which puts values on the output bus. The connections to this unit are: the two timer overflow signals, the BUSY signal, test register 21:6 (which disables this unit and enables another unit to put test data on the output bus), a signal to teh actual /IRQ pin, a Bus Write timing control signal, and bits 7, 0, and 1 of the output bus." No signal from the key-on logic. 4.2 Which port returns status: **contradiction between two hardware reports.** - Eke p31026 (2017, HW): discrete YM2612: only port 0; ASIC: any port. - Stef p37832 (2023, HW): "unlike the YM2612 the status can only be read on the port #0" on the ASIC YM3438 (i.e. ASIC: port 0 only; YM2612: any port). The opposite assignment. - Supporting Eke's direction: Eke's Hellfire explanation (p31026): the game reads status from the data port it writes; on MD1 BUSY "always appears to be cleared", on MD2 it is read correctly, so the game waits and its music is slower on MD2 (TmEE p27153: "Hellfire has 2x slower music on MD2 than on MD1"). Stef p27161 (2015): on his driver he "was trying to read the busy flag from port 1/2/3 instead of port 0" and it failed. - Eke p27159 (2015): Hellfire "sometimes reads the FM status ... from $4001-$4003 instead of just $4000". 4.3 Status byte layout implied by 4.1: BUSY on bit 7, the two timer overflow flags on bits 0 and 1 (Sauraen p31240, DIE). 4.4 Delay before BUSY reads as set. - Sauraen p27155 (SPEC from DIE): BUSY "should get set on the same cycle as the data register gets loaded internally (which is probably the cycle after the I/O bus was written), and it should be externally readable on the cycle after that. So that could be up to 18 68000 cycles". - Stef p37832 (2023, HW), ASIC YM3438: "the busy bit isn't immediately set to 1 when writing register. I dunno how much time it takes exactly to be set but waiting 20 YM cycles after the register write is enough". 4.5 BUSY is not the TEST pin's signal: Sauraen p27124 (DIE): "The signal that appears in bit 7 of the default read register is NOT the same as the signal that appears on the Test pin". Later (p30065, HW on YM3438) the TEST pin output is identified as SYNC, see 12. 4.6 Sauraen p27138 (SPEC): the YM3438 might have a different BUSY length; contradicted by Eke's measurement (4.1 item 4) for the ASIC. No measurement of a discrete YM3438's BUSY length in this part. ## 5. Operator unit (YM2203/YM2612, from the die) 5.1 Pipeline. Sauraen p29477, p29525, p34246, DIE (mostly read from the YM2203 die and cross-checked on the YM2612: "blocks from the YM2203 were copied-and-pasted onto the YM2612", p27319): - Six stages in the YM2203: ``` Pipeline stage 1, the creation of the feedback/modulation signal Pipeline stage 2, the feedback shifter and adder of the PG phase Pipeline stage 3, the logsin table and adder of the EG attenuation Pipeline stage 4, the exponential table Pipeline stage 5, the floating-point-to-integer conversion Pipeline stage 6, which doesn't do any processing ``` - "the YM2612 pipeline contains a 6-stage-long shift register with the sole purpose of delaying the operator evaluation so that it's actually 12 cycles, not 6" (p29480). "There are five stages that actually do work, one that just stores the value, and an additional six-stage delay unit in the YM2612 only which lengthens the pipeline to 12 stages. The PG and EG have their own pipelines." (p29525) - At one pipeline stage, the same channel's next operator arrives every 6 internal cycles on the YM2612 (every 3 on the YM2203): cycles 0-6-12-18 (p29480). 5.2 Order of evaluation. **Confirmed on hardware** by Sauraen p30063 (2016-07-29) and p30065, HW on discrete DIP YM3438 using the test-register read-back (section 12): "for operator processing, it's in the order 1324, with all channels' same operator processed next to each other, and the channels in the order 123456." ``` Operator output: Ch 456123456123456123456123 Op 444111111333333222222444 ``` (as first captured, aligned on bit 15; after syncing on the TEST pin, p30065: first sample is Ch 1 Op 1, then channels 1-6 op 1, then 1-6 op 3, then 1-6 op 2, then 1-6 op 4.) Operator numbering: "the ones from the OPNA datasheet, not the Sega docs. The numbering is such that in algorithm 0, the four operators modulate each other in the order 1->2->3->4, and the registers are in the order 1-3-2-4." Earlier guesses that it might be 1423, or channel order 1-4-2-5-3-6, are marked wrong by his own edits (p29471, p29477, p29480, p29513). 5.3 Which stored value modulates which operator. Sauraen p29471 (2016-04-19), DIE, "directly from the YM2203, not the YM2612, but the results should be equivalent"; from the control unit generating the algorithm control signals: - The unit stores three values: "Old 1" (operator 1 two evaluations ago), "1" (most recent operator 1), "2" (most recent operator 2), plus the result just leaving the pipeline. - When operator 1 begins, the just-finished result is operator 2's; when 3 begins, it is 4's; when 2 begins, it is 1's; when 4 begins, it is 3's. - Operator 1 (feedback): X is always "Old 1", Y is always "1". - Operator 3: uses stored "2" and/or stored "1" as the algorithm needs. - Operator 2: uses the just-finished operator 1 result ("consider this confirmed"), not the stored ones. - Operator 4: uses stored "1", stored "2" and the just-finished operator 3 as needed. - His recipe for a per-sample software model (order 1324 confirmed later): ``` Each operator has a variable for its most recent output, op[n].output. (n is 1-indexed) Three other variables are available: outOld1, out1, out2 Evaluate operator 1 using outOld1 and out1. Also copy op[2].output to out2. Evaluate operator 3 using out1 and out2. Evaluate operator 2 using op[1].output. Also copy out1 to outOld1 and op[1].output to out1. Evaluate operator 4 using out1, out2, and op[3].output. ``` - His conclusion: "operator 2 gets evaluated with the most recent output from operator 1, and similarly operator 4 uses the most recent output from operator 3. ... operator 4 is evaluated with the result of operator 2 which was calculated 5 phases ago, not the one from last phase (on the chip it's still not done yet). Similarly, operator 3 is evaluated with the 5-phase-old operator 1 value, not the one from 1 phase ago." I.e. in per-sample terms: op 3 sees op 1's and op 2's outputs from the previous sample; op 4 sees op 2's output from the previous sample; op 2 sees op 1's current; op 4 sees op 3's current. - This supersedes his earlier summary quoted by Eke in p29470 (from part 3), which read: ``` Op 1: Op 1 Cycle 0, Op 1 Cycle -1 Op 2: Op 1 Cycle 1 Op 3: Op 1 Cycle 0, Op 2 Cycle 0 Op 4: Op 1 Cycle 1, Op 2 Cycle 0, Op 3 Cycle 1 ``` (the two agree in content; what he retracted was "processing the operators in the order 3, 1, 4, 2" as an equivalent.) Eke p29476 argues orders 3142 / 1342 with the three stored registers give the same result; not resolved between them. - "Steve Snake's" claim that the chip processes operators 1 and 3 together then 2 and 4 "is functionally correct ... though it's not strictly how the chip behaves" (Sauraen, quoted in p29470). - Sauraen p29480: "I can't even think of a test sound that would sound audibly different whether modulators were delayed by a cycle or not." - Sauraen p34246 (2018): the extra buffers "store the last value of op 0, the last value of op 1, and the last-last value of op 0. (These are only 6 layers deep, because there are 6 voices.)" (0-indexed.) 5.4 Feedback sum. Sauraen p27319 (2015-10-17), DIE: "the two selection outputs are sign-extended to 15 (from 14) bits before being added (just means the MSB is copied to the new MSB); the 15-bit result is sent to the shifter; and the carry-out of the last bit is discarded. The carry-in is fixed to zero." The shifter is controlled by the FEEDBACK register. 5.5 Operator output is 14-bit signed. Sauraen p30088 (2016-08-10), HW (YM3438 test read-back): "Yes, definitely 14-bit signed." 5.6 Sine table: Sauraen p27321: "Nemesis probably already has it 100% correct, and I can read it from the die shot just fine." His VHDL "will include the table exactly as it is in the chip, with the additional logic that modifies its output". p28164: the VHDL is untested; "it is very likely there will be a couple bit errors in the logsin and exponential tables, and also it's possible a signal should be inverted". No table values are given in this part. 5.7 Eke p29470/p29508 (EMU, about MAME): MAME's model uses op 1's previous-sample output for op 2 and op 4 and op 1's two-samples-old output for op 3; Eke concludes this is an error in MAME given Sauraen's die reading. Mask of Destiny p29512: BlastEm avoided the "MEM" delay; Eke: Exodus does not emulate it. ## 6. Accumulator, channel output, DAC 6.1 Top 9 bits of the 14-bit operator output go to the accumulator. Sauraen p29516 (DIE): "the 14-bit operator outputs are lopped off to 9 bits before this unit, no rounding or anything, and the adder which adds the operator input to the stored value also must be only 9 bits." p30098: "it just takes the top 9 bits and discards the bottom 5 ... The correct one here would indeed be an arithmetic shift ... these are signed numbers". "The YM2612 DAC is 9 bit." - Eke p30102: Genesis Plus GX at that time masked bits 0-4 after summing, "while it should be done on each operator carrier". 6.2 The accumulator unit (YM2612 only, absent in the YM2203): Sauraen p29516 (DIE): "looks at first glance like it contains 2 sets of 6-stage shift registers, plus some other stuff, all 9 bits wide. This is also where the DAC value bits and some relevant control wires enter." Not reverse engineered by him (p30088). 6.3 Clipping: the sum clips rather than overflows ("which we know it does rather than overflowing", Sauraen p30088). Whether a clipped sum can reach +256 (513 levels, reported earlier in the thread at `start=550`): "I don't know at this point" (p30088). Open. - jotego p30919 quotes (via Eke) the manual's advice: algorithms 0-3 do not distort even at TL=0; "When con. = 4, set the TL of the second individual carrier so that it will be negative six (-6) [dB] or more"; con. 5 or 6: third carrier -9.5 dB or more; con. 7: all TLs -12 or more. MAN (quoted second hand). 6.4 Channel output format: 9-bit signed; idle value 0. Sauraen p30088, HW (YM3438): "after power-up, the values is 0--it would be 0x100 if it was unsigned ... basically confirmed." 6.5 Channel output order and slots. Sauraen p30063, HW (YM3438 test read-back): ``` Channel output: S 111110111000000000000000 Ch 226666444411115555333322 or if the S signal should actually be one more step right S 011111011100000000000000 Ch 222666644441111555533332 (though from some attempts at measuring channel 4 output, I believe it's probably the first one) ``` "For channel output, it's in the order 153264 (which was found earlier by someone else by measuring the output with a scope)." Each channel value is held for four internal cycles in the read-back (p29513 edit: "channels are output in the order 153264, with each channel value held for four cycles"). - From Nemesis's earlier scope capture as re-read by Sauraen p29513: at the analogue pin it is "3 internal clocks of zero and 1 of a value"; "18 master clocks (3 internal) between the beginning of the falling edge and the rising edge, and 6 master clocks (1 internal) between the beginning of the rising edge and the falling edge." (Eke p29508 had said "4 FM cycles between each channel output, with output remaining available during 1 FM cycle".) "the text there is meaningless, because they're talking about an embedded serial DAC which has long since been disproven." - Sauraen p32648: normally "channel values are output in an 'impulse-like' fashion, for a fraction of their time slot (I think it should be 1/4 ...)". SPEC. 6.6 Analogue output pin: one transistor to AVCC; it can only source current; an external resistor is required (HardWareMan, quoted p30919, and p30920; Sauraen p30921 confirms "the one between OUT and AVCC is the driver for the output pin"). DIE. 6.7 DAC channel (register $2A, enable $2B). - The DAC data register updates as soon as written; it is used once per sample. Sauraen p34255: "the register holding the DAC (PCM) value should update immediately (as soon as the data is in the internal data register), it just only gets used once per complete FM cycle (unless you have the DAC Loud bit turned on)." DIE ("If I remember correctly"). - 9th bit: $2C bit 3 is bit 0 of the channel 6 DAC value (Sauraen p31285; nukeykt p34274: "LSB bit of PCM is mapped to $2C:3"). nukeykt p34272: "9 bits of PCM data are directly fed to YM2612's 9-bit DAC just like FM channels." jotego p34275: "MSB is inverted in order to get correct sign for addition with other channels". - Maximum useful rate, HW experience: TmEE p27127/p27153 first reported that above about 26 kHz the sound gets worse and inferred missed writes; Sik p34253 repeats "can't be faster than ~26KHz". **Corrected**: TmEE p31027 (2017) and p34262 (2018), HW: with the YM and Z80 made to share a clock and one write every 144 clocks, "I got all writes intact"; rates between half and full sample rate sound bad from the resampling effect, "which is why I originally thought samples get missed". Stef p34259: 32 kHz works on MD1 and MD2. jotego p34263: any PCM rate that is not an integer multiple of 24 FM ticks has artifacts (arithmetic). - Sik p34271: "DAC seems to sound too quiet compared to what FM channels can do". No measurement. ## 7. The "ladder effect" (discrete YM2612 DAC) 7.1 GManiac p30097 (2016-08-13): "Ladder effect is a large step between DAC levels -1 and 0. AFAIR, It is 3-4x times larger than usual step between other levels". With arithmetic truncation an operator oscillating between -1 and +1 gives DAC codes -1, 0, -1, 0; "Because of ladder effect DAC analogue output will be: -3.5; 0; -3.5; 0". He simulated it in his own emulator and "After Burner sounded correctly" (track "Super Stripe"). Basis: his recollection of measurements made earlier in the thread plus listening. 7.2 Sauraen p30098 (DIE, qualitative): "The ladder effect is a result of the resistor string DAC--when the MSB is 0 and the string is between VDD and the midpoint, it pulls up the midpoint voltage slightly, and vice versa when the MSB is 1 and the string is between GND and the midpoint. Basically, the two halves of the range have decent linearity in themselves, but they don't quite meet in the middle. A decent way of emulating this would be to offset negative values by a constant amount ... Determining what that amount is ... I can't do an effective job of that just by reading the die." 7.3 Eke p30102 (2016-08-15): "no precise measures/tests have been made on DAC output to actually emulate it accurately"; proposes a test ROM that mutes everything but channel 6 and steps the DAC through all 512 levels using $2C bit 3. 7.4 Eke p32605 (2017-10-24), **EMU**: reporting what the Nuked YM3438 model's author found (Eke's summary of that model, not a measurement): - "the resistor array would not exactly reach Vcc/2 on either negative or positive side ... which causes a gap 2x larger than expected between 0 and -1 steps: 0 and -1 actually corresponds to same amount of resistance in DAC array ... => a way to emulate this is to add a +1 offset on positive or zero channel output (so 0 corresponds to +1 and so on)." - "the sign bit also has an impact when the DAC output is silenced, which can happen on one of the stereo analog output when muted but also between channels output ... when 'silence' is needed, the output is actually forced to either +1 or -1 ... => a way to emulate this is to add a +3/-3 offset (+4/-4 when channel is muted) on channel output depending on sign bit". - Effects named: low-volume instruments much louder (After Burner 2 "Super Stripe"); background noise when a channel fades out (Konami logo sound). These constants come from the excluded model via Eke's prose: treat as tainted/emulator-tier. 7.5 Kabuto p32647 (2017-11-09), **HW**: "I can confirm this large ladder gap from measurements of DAC output levels" (document linked, see section 17; diagrams under "YM2612"). "further discontinuities exist, especially for test bit $2C:3=0, where when DAC register bits 0 to 3 are 0 and register value is > 128. I tested multiple MD1s, all of them had this odd behaviour. I did not spot this on MD2, too bad that the seemingly better DAC performance is crippled by a poor amplifier circuit." ## 8. Phase generator and LFO vibrato (from the die) 8.1 Key code. Sauraen p31049 (2017-04-06), DIE (YM2612): a unit at the start of the PG takes the 3 BLOCK bits plus two bits "definitely being computed from the top 4 bits of the raw FNUM value, pre-LFO", delays them 1 or 2 cycles and sends the 5 bits to the PG and the EG. "this value is the FNUM for the current operator, including the cases of the operators of voice 3 with their own frequencies." "So unless the key code value is modified later ..., it's not affected by the LFO at all." - Hence (Eke p31050): detune and rate scaling use the key code of the unmodulated F-number. Eke's premise (p30935, EMU): MAME and Exodus both recompute key code after vibrato for detune but not for the EG rates. 8.2 Width of the frequency path. Sauraen p31049, DIE: "11 bits enter the LFO multiplier thing, 12 bits leave and go to the PG. In fact, the first unit in the PG (unknown function) where these 12 bits enter is actually 16 bits wide: the three LSBs are zero, then the 12 bits from the LFO, then the MSB is also zero. This is followed by another unit which actually has a 17-bit output. These two units ... appear to be shifters; the second one appears to shift right four bits depending on bit 2 of BLOCK, and I think the first one shifts one or two bits based on bits 0 or 1 of BLOCK. The unit after this, which looks like it's adding something (Detune?), is also 17 bits, with no carry-out as far as I can tell. The unit after that is 18 bits and the unit after that is 20 bits, both of which look like more elaborate shifters. Then comes what appears to be the PG state shift register addition and control unit." p31053: the 18- and 20-bit units together are probably the multiple unit; "still not quite sure". - Eke's reading (p31050, SPEC): equivalent to pre-shifting by 3 then: 1-bit right shift if BLOCK bit 0 clear; 2-bit left shift if BLOCK bit 1 set; 4-bit right shift if BLOCK bit 2 clear. "Detune addition result can indeed overflow and output is 17 bit". The 20-bit phase counter is consistent with the 20-bit unit. 8.3 LFO structure. Sauraen p30937 (2017-03-14), DIE (YM2612; "I never did a full reverse engineering of it"), three sections: - "7-bit linear prescaler. The test bit 0x21:1 goes into what looks like the carry-in or something similar; it could go into the reset ... The 7-bit output (plus maybe carry-out) gets logiced together into 8 lines (evidently perform '== N' with N hardcoded for each line), and these go into a little selector unit which is also fed by the LFO Speed and LFO Enable bits. ... there's some sort of feedback to the prescaler's reset. So this clearly seems like a divide-by-N prescaler." The eight N values were not read. - "7-bit linear counter, with an 8-bit unit after the output (possibly inverts the output after each cycle to make a triangle wave?). Bits 1:6 of the output of this go to the EG, and stick into its pipeline at the same place where the LFO->Amplitude two bits go. (Elsewhere the operator LFO enable flag simply forces these two bits to zero for operators not affected by the LFO.)" - "Highly complex unit which modifies the frequency data as it goes from the channel registers to the PG. The block bits bypass this, but all the frequency bits get modified by it. ... bits 4:A of the frequency data go into the bitslices 0:6. ... bit 4 only gets used once, bit 5 gets used in bitslice 1 and 0, bit 6 gets used in bitslices 2:0, and so on so that bit A gets used in all of them. I'm guessing this whole unit is basically a multiplier, multiplying bits 4:A of the frequency value by bits 0:7 of the LFO state, and then adding the result to bits 0:6 of the frequency value (with carry up to the higher bits). It looks like, between the multiplied output and the adder, there's another shifter whose value is based on the the LFO->Frequency bits." - "The upshot is that the LFO is definitely doing frequency modulation, not phase modulation." - Sauraen p28164 (2015-12-19), DIE: the LFO "is absolutely not a sine wave LFO, it must be a triangle wave--there's no other logic interfacing to the operator unit's sine table for the LFO, and there's no other table that would be large enough". 8.4 LFO numbers offered by Eke (p30935, p30938), **EMU (MAME) and MAN arithmetic**, not die: - LFO step periods "According to MAME implementation, values are {108, 77, 71, 67, 62, 44, 8, 5} 'sample clocks'". Eke's own arithmetic from the manual's frequencies: "assuming a 8Mhz input clock and 128 LFO clocks per period, 3.98 hz for speed 0 would give 8000000/6/24/3.98/128 = 109 samples between each LFO clock, which is one above MAME specified value. All other speed values give also one additional sample value (72.2 for speed 7 gives 8000000/6/24/72.2/128 = 6 samples)". - 7-bit LFO step counter (0-127), incremented each LFO clock and "reset when LFO enable bit is cleared"; "LFO AM value indeed corresponds to LFO step counter bits 0:5 shifted left by one and XORed with inversion of bit 6 (to generate an inverted triangle waveform)"; "LFO AM sensitivity (2 bits) indicates to EG how much LFO AM value is shifted before adding to EG output"; LFO PM step (0-31) is bits 2:6 of the step counter. (Eke's description of the emulator's model, matched by him to Sauraen's blocks.) - Vibrato formulae as Eke describes two emulators (inline prose, see Slips): MAME: `for (i = 4 to 10) LFO_PM += (FNUM & (1<> (10 - i)) : 0` Exodus: `for (i = 0 to 10) LFO_PM += (FNUM & (1<> 9`. Eke: Sauraen's bit-slice description "seems to match with MAME implementation (more than Exodus implementation)": only F-number bits 4 to 10 contribute, bit 10 with the largest weight ("max offset value per FNUM bit is 96 (0x60) for when bit 10 is set", 0x30 for bit 9, 0x18 for bit 8, ..., 0x03 for bit 5, 0x01 for bit 4). The table `LFO_TAB` itself is not given in this part. - Eke p30938: test bit $21:1 presumably halts the LFO clock, as on the YM2151. SPEC. ## 9. Envelope generator Little in this part. - LFO AM enters the EG pipeline as described in 8.3 (Sauraen, DIE). - Sauraen p28164 asks not to be asked to reverse the EG; it was not done in this thread. - Sauraen p30065, HW (YM3438): read-back of operator outputs in SSG-EG mode "always matches the sound"; he found no difference between the YM3438 and what is described for the YM2612 "even on undocumented features like the test bits and SSG-EG mode" (p30063). - Key on/off writes ($28) landing on only some of a channel's operators when written too fast: see 3.3. - TmEE p31160: "You get clicks and whatnot on note ons, they didn't try to do anything about it". ## 10. Key-on ordering question (jotego vs Sauraen) - jotego p31153 (2017-04-17): on the **YM2151** (digital output, "thousands of chip measurements", HW on that chip, not the YM2612) modulation of the carrier is present from the first sample after key-on, so key-on must reach the modulator's operator before the carrier's. He asks whether the YM2612 does the same and whether BUSY is longer for $28. - Sauraen p31154, p31240 (DIE): no; BUSY is a fixed 32-cycle timer with no key-on input. He proposes a test: key on all four operators, key them off exactly 24 cycles later, and see whether each gives exactly one sample. Not run in the thread. Open. ## 11. Timers, CSM, channel 3 - $21 bit 2: "Timers increment once every internal clock rather than once every sample. (Untested by me)" (Sauraen p31285). So in normal operation the timers step once per sample (24 internal cycles). - Channel 3: the key code is computed per operator from that operator's own F-number in special mode (Sauraen p31049, DIE; see 8.1). - nukeykt on CSM and the channel-3 F-number latch: see 16. ## 12. Test registers $21 and $2C Sauraen p31285 (2017-04-26), "the most up-to-date information", from DIE plus HW tests on discrete YM3438s. Copied in full: ``` Test Bit Functions $21:0: Select which of two unknown signals is read as bit 14 of the test read output. $21:1: Some LFO control, unknown function. $21:2: Timers increment once every internal clock rather than once every sample. (Untested by me) $21:3: Freezes PG. Presumably disables writebacks to the phase register. $21:4: Ugly bit. Inverts MSB of operators. $21:5: Freezes EG. Presumably disables writebacks to the envelope counter register. Unknown whether this affects the other EG state bits. $21:6: Enable reading test data from OPN2 rather than status flags. $21:7: Select LSB (1) or MSB (0) of read test data. (Yes, it's backwards.) $2C:2 downto 0: Ignored by OPN2, confirmed by die shot. $2C:3: Bit 0 of Channel 6 DAC value $2C:4: Read 9-bit channel output (1) instead of 14-bit operator output (0) $2C:5: Play DAC output over all channels (possibly except for Channel 5--in my testing the DAC is the only thing you hear and it's much louder, you do not get any output from Channel 5; but someone else supposedly found that the pan flags for Channel 5 don't affect the panning of this sound, which is only possible if it's not being output during that time slot for some reason. I don't have any other reason to believe this is true though). $2C:6: Select function of TEST pin input--both unknown functions. $2C:7: Set the TEST pin to be an output (1) instead of input (0). Test Read Data Format ABPPPPPP PPPPPPPP (if $2C:4 is 0) AB00000C CCCCCCCC (if $2C:4 is 1) A: Unknown signal. B: One of two unknown signals; which one is read is selected by $21:0. C: 9-bit channel output. P: 14-bit operator output. ``` - TEST pin as output = SYNC (p30065, p31285, HW on YM3438): "This signal goes high for one internal cycle every sample (24 cycles). Its falling edge occurs just after an internal clock pulse, so wait half an internal cycle before sampling the OPN2's output. Then, four cycles after that, the data on the output will be for Ch 1 Op 1." (p30065 gives the same as "Wait 5-and-a-half OPN2 internal cycles" from the falling edge.) Corrects his earlier belief that the TEST pin outputs BUSY and that $2C:7 = 0 meant output. - Bit 15 of the read-back ("A"/"S"), p30063, HW: after reset it shows, over the 24 cycles, ``` Operator output: 111111111100000000000000 Channel output: 111110111000000000000000 ``` and once any operator of channel 4 has played, the first 10 bits become "random" and stay so even after the note dies. Unexplained. - MSB and LSB of one value cannot both be read: nothing stops the operator pipeline (p31285). - $2C:5 ("DAC loud"): Kabuto p32647, HW (an MD1): "roughly 30-fold increase of DAC levels when all channels are on", causing distortion. Sauraen p32648 (SPEC): the DAC value is output constantly instead of in impulse-like slots, "So it would be 24x as loud." - The 2015 statement "The 9th bit of the DAC which is actually present in the test register" is Sauraen's finding (Stef's quote in p27124). - Superseded list (quoted by jotego p31283 from an older Sauraen post): "21:D1 Goes to unknown control unit (large block above PG). 21:D0 Goes to parallel data output unit. ... 2C:6 - Goes to the same unit as the TEST pin's input wire, which is a small control unit at the upper right of the EG." ## 13. Reset - After reset and with nothing played the channel outputs read 0 (6.4) and the bit-15 patterns of section 12 appear. BUSY's counter has chip reset as an input (4.1). Nothing else on reset in this part. ## 14. YM2612 vs YM3438 vs the ASIC - YM2612: depletion-load NMOS with dynamic gates; blocks copied from the YM2203 layout. YM3438: a complete re-implementation in CMOS, layout "almost unrecognizable" (Sauraen p27138, p27197, p27319, DIE/inspection). - TmEE p27193: "Service manuals say 'YM3438' in the ASIC diagram." - Sik p27198: "I thought the ASIC variant was somewhere between the YM2612 and YM3438 (since it has quirks from both)". mikejmoffitt p27188: "the discrete YM3438 has different behavior than the ASIC one". No specifics given in this part. - TmEE p27153: a discrete YM3438 fitted to a console did not show Hellfire's slowdown but "has issues in other games (I recall Sonic Spinball being one)". HW recollection. - Sauraen p30063: on discrete YM3438s he found no difference from what the thread describes for the YM2612, including test bits and SSG-EG. His driver worked unchanged on both (p29443). - BUSY length the same on discrete YM2612 and the 315-5660 ASIC (Eke, 4.1). Write timings the same (Stef, 3.3). Status-port behaviour differs between them, direction disputed (4.2). On the ASIC, BUSY is not set immediately (4.4). - DAC: Kabuto p32647 saw the mid-scale gap and the extra discontinuities on MD1s, "did not spot this on MD2". - Sauraen had a broken US Genesis 2 VA1.8 with ASIC 315-5660-02 for decapping (p27306); the laser decap failed (p27333). The decap discussion moved to thread `viewtopic.php?f=13&t=2191` (p27387). - HardWareMan p38014 (2023): an MD decapping project exists; a YM2612/YM3438 branch produced "almost die perfect verilog model" (Nuked-OPN2-FPGA). Not read here. ## 15. Open questions left by this part 1. Which port(s) return status on the discrete YM2612 and on the ASIC (Eke 2017 vs Stef 2023, opposite). 2. Whether the accumulator can output +256 on a clipped sum. 3. What $21 bits 0 and 1, $2C bit 6 and the TEST pin input do; what bit 15 of the read-back is and why channel 4 disturbs it. 4. Whether $2C:5 silences channel 5's slot. 5. Whether the key-on bits of a channel's four operators can land in different samples (jotego's question; Stef's and TmEE's symptoms suggest partial updates occur when written fast). 6. Exact write-point logic of the split 24-stage registers (Sauraen did not transcribe it); exact delay before BUSY reads set on the ASIC. 7. The eight LFO prescaler values and the vibrato table as read from the die (never read by Sauraen). 8. The EG as read from the YM2612 die (not done in the thread). 9. Per-register minimum write delays ($2x registers one by one), promised by TmEE (p31027), not posted. 10. A measured table of all 512 (or 513) DAC levels on a discrete YM2612 (Kabuto's document has plots; whether numbers are published there was not checked here). 11. Does Stef's "both address ports share the same register" contradict Nemesis's part-latch finding? 12. BUSY length on a discrete YM3438 (never measured here). ## 16. Statements by `jotego` and `nukeykt` (kept apart) **jotego** (JT12 / JT51, GPL Verilog; his operator unit "is pretty much a copy of Sauraen's VHDL file", p30919): - 16.1 p30919 (2017-02-26): the YM3438 application notes contain a table of BUSY/wait time by register. His JT12 at that time took a full 24-cycle pass to land a write. EMU/MAN. - 16.2 p31153: YM2151 measurements (HW on a YM2151): with algorithm 7, operator "M2" (= S3) "gets output one sample ahead of time" after key-on; modulation of C1 by M1 is present from the first sample. He cannot say the YM2612 matches. - 16.3 p34249: the wait-time table in 3.2 (MAN) and the two-write-point hypothesis (later supported by Sauraen's die look). - 16.4 p34249: "PCM data gets taken into account in the accumulator and the accumulator will exactly add each operator once every 24 FM ticks"; some $2x registers take effect at once "like the frequency of the LFOSC", others go through the pipeline. EMU/SPEC. - 16.5 p34275: DAC data's MSB is inverted to make a signed value. EMU (his Verilog). - His questions to nukeykt (p34276, p34281, p34289) describe the Nuked source's structure and function names in prose; nothing of behaviour is asserted by jotego there beyond the questions. **nukeykt** (Nuked-OPN2; "basically translation of YM3438 schematic to C code", p34268; based on a YM3438 die photograph, p34270: "YM3438 die shot is pretty clean, so just labeling certain bits was enough to understand it's logic"): - 16.6 p34277 (2018-11-24), from his model, "I'm not 100% sure": "For global registers(0x21-0x2C) A1 of data write matters, but for register and channel registers A1 from address write matters instead. Would be cool if someone could perform hardware tests. EDIT: Looks like for global registers both address and data writes must have zero A1 pin state in order to work properly." - 16.7 p34277: the MSB of the F-number has a separate latch for channel 3's special-mode values and for the rest; "confirmed by inspecting the die shot?" - "Yes". - 16.8 p34277: his model "updates registers within 12 FM ticks", "Like real hardware". - 16.9 p34272/p34274: 9 bits of PCM data feed the 9-bit DAC like an FM channel; the LSB is $2C:3. - 16.10 p34277, on CSM: jotego asked why the model, on a CSM key-on, ORs something involving a TL bit into a value rather than simply keying on for a cycle; nukeykt: "This behavior should be consistent with real hardware. Not sure why Yamaha implemented it in that way though." (The code line itself was withheld; no behaviour can be stated from this.) - 16.11 p34283: the phase-increment calculation "actually take[s] 4 cycles on real hardware"; the write data latch "actually is register and it does exist on YM3438". - 16.12 p34290: "YM3438 actually has internal cycle counter which outputs 24 signals for each cycle value. Cycle counter is actively used throughout entire chip. For example operator unit uses it to determine channel's operator number which further used for FM algorithm control." jotego had noted (from the source) that the timers act on particular cycles of the 24. - 16.13 p34277: "In theory my code should be 1:1 to real hardware. But in practice i could make some mistakes in implementation." ## 17. Files, recordings, images, links named in this part | Post | What | URL as it appears (many are shortened by the forum with "...") | Maker / basis | |---|---|---|---| | p28164, p29525, p34246 | VHDL "equivalent description" of the YM2203/YM2612 operator unit; untested; licence not stated in the thread | https://github.com/sauraen/YM2612 (file `...erator.vhd`, link shortened) | Sauraen, from die photographs | | p29525 | Overall annotated YM2612 die picture (blocks labelled) | http://i.imgur.com/jQnlY70.jpg | Sauraen; die photographs by HardWareMan (jotego p30919 credits him) | | p30919, p30920 | Die crops: bidirectional pin, analogue output pin, clock drivers | http://savepic.su/1643350.png, http://savepic.su/1699689.png, http://savepic.su/1684328.png | HardWareMan | | p29508 | Pipeline spreadsheet and picture, configurable channel/operator order | forum attachments `YM2612-pipeline.zip`, `ym2612_pipeline.png` (`./download/file.php?id=48`) | Eke | | p30065 | Photo/video still of the synth's VU meters driven by read-back | http://i.imgur.com/BKdqEXa.jpg | Sauraen | | p29443 | MIDIbox Quad Genesis VGM driver source (timing: 2100 ticks at 84 MHz per write) | http://svnmios.midibox.org/filedetails. ... gmplayer.h / .c (shortened) | Sauraen; licence not stated | | p32647 | Kabuto's hardware notes with measured YM2612 DAC level plots | https://docs.google.com/document/d/e/2P ... cbCvlG/pub (shortened; megadrive-python pins a mirror as `reference/docs/kabuto-hardware-notes.html`) | Kabuto, measured on several MD1s and an MD2 | | p34249 | YM3438 application notes (Japanese), page 10 wait times | link text only ("application notes for YM3438") | Yamaha | | p30938 | YM2151 test-register notes | http://www.msxarchive.nl/pub/msx/mirror ... ym2151.txt (shortened) | not stated | | p27387 | Decapping thread | viewtopic.php?f=13&t=2191 | Sauraen | | p29508, p34279, p30087, p30935 | Earlier posts of this thread referred to | `t=386&start=369` (Nemesis: channel output order/spacing on a scope), `start=410` (Nemesis: address/part latch), `start=550` (513 DAC levels), `start=480` (LFO PM discussion) | - | | p30919 | JT12 repository, wiki (GPL Verilog) | link text only | jotego: **not to be read** | | p32605 | Genesis Plus GX pull request adding the Nuked YM3438 core | https://github.com/ekeeke/Genesis-Plus-GX/pull/179 | **not to be read** | | p38014 | Nuked-OPN2-FPGA Verilog; testbench and usage images; three SoundCloud recordings "test11/13/14" ("YM only (no PSG)", work in progress) | https://github.com/nukeykt/Nuked-OPN2-FPGA/..., https://soundcloud.com/user-656259515/test11 (13, 14) | HardWareMan / nukeykt; recordings are of the FPGA model, not of a real chip: **not to be read** | | p28067, p28111 | Links into Genesis Plus GX, gens-rerecording, MAME fm2612.cpp, emu-ex-plus | - | **not to be read** | | p27344, p27343 | Decapping how-to articles (hackaday, t4f.org, eag.com) | - | irrelevant to behaviour | No test ROM is published in this part. Eke's 2017 BUSY test program and Stef's 2023 write-timing test program are described but not linked. No audio recording of a real chip is linked in this part. Licensing remarks in the thread (p28077, p29458): MAME's OPL/OPN cores by Jarek Burczynski forbade commercial use until January 2016, when "ym2151.c in mame is now GPL" by his request. ## 18. Slips and skips - No code block in a Nemesis or Sauraen post in this part was presented as emulator source; none skipped for that reason. Sauraen's own blocks (p30063 data formats and capture rows) were read. - Nothing in this part is credited to "furrtek"; the name does not occur. - **Emulator formulas read in running prose (not in code blocks, so not withheld):** - p30935 (Eke): MAME's and Exodus's vibrato formulae, MAME's handling of block/key code, written inline. Recorded in 8.4, labelled EMU. - p30938 (Eke): MAME's LFO period list `{108, 77, 71, 67, 62, 44, 8, 5}` and per-bit vibrato maxima. - p31050 (Eke): MAME's phase-increment expression "(freqnum << 5) >> (7 - BLOCK) where freqnum = (FNUM<<1) + lfo_offset". - p29476, p29508 (Eke): prose description of MAME's connection/"MEM" scheme and of where he believes it is wrong. - p32605 (Eke): the Nuked model's ladder offsets (+1; +3/-3; +4/-4) in prose. - p34276, p34281, p34289 (jotego): names of functions and variables in the Nuked source and the cycles on which its timers act, in prose. These were read before their nature was clear; they are marked EMU above so the parent can leave them out. MAME's FM core is one of the excluded GPL sources, so 8.4's MAME constants and 7.4's offsets should be treated as tainted. - Withheld code blocks (not seen): p29458 (275 chars, a MAME commit quote), p29470 (two, Genesis Plus GX source), p29490 and p29523 (r57shell's toy scheduling tables), p29508 (two, Genesis Plus GX source), p34275 (36 chars, jotego's Verilog), p34276/p34277/p34281/p34283 (Nuked source lines quoted by jotego). ## 19. Withheld blocks that look like measurements None. Every withheld block in this part is, by its surrounding prose, emulator or HDL source or an illustrative table (r57shell's worker analogy in p29490/p29523), not hardware data.