Chargement…
Chargement…
On each active edge with i_ce='1', calculate delta = i_pixel - q_prev. If abs(delta) < threshold, then q_next = i_pixel. Otherwise, q_next = q_prev + (k * delta) / 256. i_k is an unsigned Q0.8 coefficient. Integer division truncates toward zero.
q_prev is stored as an unsigned 8-bit value and drives o_pixel. Saturate any intermediate value outside 0 through 255. Hold the output when i_ce='0'. Synchronous active-high reset clears the stored pixel. A difference equal to the threshold uses the smoothing branch.
The testbench checks rising and falling changes, the follow branch, equality at the threshold, clock-enable hold, and reset.