Skip to content

Commit

Permalink
Update FIR example
Browse files Browse the repository at this point in the history
  • Loading branch information
christiaanb committed Oct 3, 2015
1 parent c7e9962 commit 33fb25f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions examples/FIR.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ module FIR where
import CLaSH.Prelude

dotp :: SaturatingNum a
=> Vec n a
-> Vec n a
=> Vec (n + 1) a
-> Vec (n + 1) a
-> a
dotp as bs = foldl boundedPlus 0 (zipWith boundedMult as bs)
dotp as bs = fold boundedPlus (zipWith boundedMult as bs)

fir :: (Default a, KnownNat n, SaturatingNum a)
=> Vec (n + 1) (Signal a) -> Signal a -> Signal a
Expand All @@ -16,10 +16,10 @@ fir coeffs x_t = y_t
xs = window x_t

topEntity :: Signal (Signed 16) -> Signal (Signed 16)
topEntity = fir $(v [2::Signal (Signed 16),3,-2,8])
topEntity = fir (2:>3:>(-2):>8:>Nil)

testInput :: Signal (Signed 16)
testInput = stimuliGenerator $(v [2::Signed 16,3,-2,8])
testInput = stimuliGenerator (2:>3:>(-2):>8:>Nil)

expectedOutput :: Signal (Signed 16) -> Signal Bool
expectedOutput = outputVerifier $(v [4::Signed 16,12,1,20])
expectedOutput = outputVerifier (4:>12:>1:>20:>Nil)

0 comments on commit 33fb25f

Please sign in to comment.