Copyright  (C) 20132015, University of Twente 

License  BSD2 (see the file LICENSE) 
Maintainer  Christiaan Baaij <christiaan.baaij@gmail.com> 
Safe Haskell  Trustworthy 
Language  Haskell2010 
Extensions 

 data DSignal delay a
 delay :: forall a n d. KnownNat d => Vec d a > DSignal n a > DSignal (n + d) a
 delayI :: (Default a, KnownNat d) => DSignal n a > DSignal (n + d) a
 feedback :: (DSignal n a > (DSignal n a, DSignal ((n + m) + 1) a)) > DSignal n a
 fromSignal :: Signal a > DSignal 0 a
 toSignal :: DSignal delay a > Signal a
 dfromList :: [a] > DSignal 0 a
 unsafeFromSignal :: Signal a > DSignal n a
 antiDelay :: SNat d > DSignal (n + d) a > DSignal n a
Delayannotated synchronous signals
A synchronized signal with samples of type a
, synchronized to "system"
clock (period 1000), that has accumulated delay
amount of samples delay
along its path.
feedback :: (DSignal n a > (DSignal n a, DSignal ((n + m) + 1) a)) > DSignal n a Source
Feed the delayed result of a function back to its input:
mac ::DSignal
0 Int >DSignal
0 Int >DSignal
0 Int mac x y =feedback
(mac' x y) where mac' ::DSignal
0 Int >DSignal
0 Int >DSignal
0 Int > (DSignal
0 Int,DSignal
1 Int) mac' a b acc = let acc' = a * b + acc in (acc,delay
(singleton
0) acc')
>>>
sampleN 6 (mac (dfromList [1..]) (dfromList [1..]))
[0,1,5,14,30,55]
Signal <> DSignal conversion
fromSignal :: Signal a > DSignal 0 a Source
Signal
s are not delayed
sample s == dsample (fromSignal s)
List <> DSignal conversion (not synthesisable)
dfromList :: [a] > DSignal 0 a Source
Create a DSignal
from a list
Every element in the list will correspond to a value of the signal for one clock cycle.
>>>
sampleN 2 (dfromList [1,2,3,4,5])
[1,2]
NB: This function is not synthesisable
Experimental
unsafeFromSignal :: Signal a > DSignal n a Source