Skip to content

Instantly share code, notes, and snippets.

@nlhans
Created February 1, 2018 09:39
Show Gist options
  • Save nlhans/5a7a8f5c49c3be13ab28055aac078fc4 to your computer and use it in GitHub Desktop.
Save nlhans/5a7a8f5c49c3be13ab28055aac078fc4 to your computer and use it in GitHub Desktop.
module Constants where
import CLaSH.Prelude
type MyValue = SFixed 5 13
type MyValues = Vec 2 MyValue
coefficients :: [MyValue]
coefficients = [0.5, 0.25]
module Filter where
import CLaSH.Prelude
import Constants
fir :: MyValues -> MyValues -> MyValue
fir coeffs xs = dotp coeffs xs
where
dotp as bs = sum (zipWith (*) as bs)
topEntity xs = fir hs xs
where
hs = $(listToVecTH coefficients)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment