module FIR where import Clash.Prelude -- Dot product? dotp :: SaturatingNum a => Vec (n + 1) a -> Vec (n + 1) a -> a dotp as bs = fold boundedAdd -- Sum up the resultant list (zipWith boundedMul as bs) -- Multiply corresponding values fir :: (HiddenClockResetEnable dom , Default a , KnownNat n , SaturatingNum a , NFDataX a) => Vec (n+1) a -> Signal dom a -> Signal dom a fir coeffs x_t = y_t where y_t = dotp coeffs <$> bundle xs xs = window x_t topEntity :: Clock System -> Reset System -> Enable System -> Signal System (Signed 16) -> Signal System (Signed 16) topEntity = exposeClockResetEnable (fir (2:>3:>(-2):>8:>Nil)) testBench :: Signal System Bool testBench = done where done = rst = tbsystemClockGen