hdl - Replace glitch filter with dual threshold FSM
Currently installed glitch filter (installed on the output of the trigger comparator process) introduces unnecessary trigger latency and could possibly filter out valid trigger events if configured incorrectly.
It is proposed to replace the glitch filter (which is more suited for debouncing, protection against metastability effects etc) and the comparator process itself with a small FSM which will implement a dual-threshold algorithm ("Schmitt trigger"-like hysterisis) for faster, noise-immune triggering.
Basic principle of operation is that there will be two configurable threshold levels, "upper" and "lower". When the input (ADC sample) is higher than the upper threshold, the output (trigger) is high. When the input is below the "lower" threshold the output is low, and when the input is between the two levels the output retains its value.
By selecting the two threshold levels in such a way that their difference is larger than the expected signal noise, the output will immediately follow the input, while at the same time remain protected for input noise around the upper threshold value.
To this end, it will be necessary to introduce another configuration value, which will probably break backwards compatibility with existing software.
Note: another possibility is to simply remove the glitch filter and leave the trigger signal unfiltered. The acquisition FSM will anyway transition to the next state and all subsequent triggers will be ignored until the acquisition is complete and the FSM is "armed" again.