FIR Filter
Hard · Sequential · SystemVerilog
Design a direct-form FIR filter.
A finite impulse response (FIR) filter's output is a weighted sum of the most recent input samples, y[n] = Σ_k h[k] · x[n-k], where the weights h[k] are its coefficients. A single non-zero sample affects only as many outputs as there are coefficients, which is where the name comes from: the response to an impulse is the coefficient sequence itself.
A cycle with x_valid high presents a sample, x_in. In the cycle after each sample y_valid is high and y_out is the sum, over k = 0 to NUM_TAPS-1, of coeffs[k] times the k-th most recent sample, counting the sample just presented as k = 0. Samples from before the last reset count as 0. In every other cycle y_valid is low and y_out may take any value. Samples, coefficients and y_out are two's-complement; NUM_TAPS is at most 16, so y_out holds the sum exactly.
coeffs changes only during reset or before the first sample.
rst_n is a synchronous, active-low reset; it clears y_out and y_valid.
- Arithmetic