-- line 232-234
when SAMPLE_ERROR =>
v.state := SAMPLE_IDLE;
bit_count and data_bits are not reset. If the sampler overflows and then re-enters SAMPLE_START → SAMPLE_DATA, the old bit_count is still 7 and the playback comparison in PLAY_STORED_DATA will immediately think we've caught up. The SAMPLE_IDLE reset case in SAMPLE_START clears bit_count, but only if there's a new start detected before we re-enter SAMPLE_DATA.
Possible Fix: reset bit_count and data_bits in SAMPLE_ERROR.
Again by analysis and simulation. I think this is extremely unlikely to actually occur in a real system as we'll see a new start typically but the fix is easy.
bit_countanddata_bitsare not reset. If the sampler overflows and then re-entersSAMPLE_START→SAMPLE_DATA, the oldbit_countis still 7 and the playback comparison inPLAY_STORED_DATAwill immediately think we've caught up. TheSAMPLE_IDLEreset case inSAMPLE_STARTclearsbit_count, but only if there's a new start detected before we re-enterSAMPLE_DATA.Possible Fix: reset
bit_countanddata_bitsinSAMPLE_ERROR.Again by analysis and simulation. I think this is extremely unlikely to actually occur in a real system as we'll see a new start typically but the fix is easy.