Copyright | (C) 2013-2016 University of Twente 2017 Google Inc. |
---|---|

License | BSD2 (see the file LICENSE) |

Maintainer | Christiaan Baaij <christiaan.baaij@gmail.com> |

Safe Haskell | Trustworthy |

Language | Haskell2010 |

- data DSignal (domain :: Domain) (delay :: Nat) a
- delayed :: (KnownNat d, HiddenClockReset domain gated synchronous) => Vec d a -> DSignal domain n a -> DSignal domain (n + d) a
- delayedI :: (Default a, KnownNat d, HiddenClockReset domain gated synchronous) => DSignal domain n a -> DSignal domain (n + d) a
- feedback :: (DSignal domain n a -> (DSignal domain n a, DSignal domain ((n + m) + 1) a)) -> DSignal domain n a
- fromSignal :: Signal domain a -> DSignal domain 0 a
- toSignal :: DSignal domain delay a -> Signal domain a
- dfromList :: NFData a => [a] -> DSignal domain 0 a
- dfromList_lazy :: [a] -> DSignal domain 0 a
- unsafeFromSignal :: Signal domain a -> DSignal domain n a
- antiDelay :: SNat d -> DSignal domain (n + d) a -> DSignal domain n a

# Delay-annotated synchronous signals

data DSignal (domain :: Domain) (delay :: Nat) a Source #

A synchronized signal with samples of type `a`

, synchronized to clock
`clk`

, that has accumulated `delay`

amount of samples delay along its path.

Functor (DSignal domain delay) Source # | |

Applicative (DSignal domain delay) Source # | |

Foldable (DSignal domain delay) Source # | |

Traversable (DSignal domain delay) Source # | |

Fractional a => Fractional (DSignal domain delay a) Source # | |

Num a => Num (DSignal domain delay a) Source # | |

Show a => Show (DSignal domain delay a) Source # | |

Lift a => Lift (DSignal domain delay a) Source # | |

Arbitrary a => Arbitrary (DSignal domain delay a) Source # | |

CoArbitrary a => CoArbitrary (DSignal domain delay a) Source # | |

Default a => Default (DSignal domain delay a) Source # | |

delayed :: (KnownNat d, HiddenClockReset domain gated synchronous) => Vec d a -> DSignal domain n a -> DSignal domain (n + d) a Source #

delayedI :: (Default a, KnownNat d, HiddenClockReset domain gated synchronous) => DSignal domain n a -> DSignal domain (n + d) a Source #

feedback :: (DSignal domain n a -> (DSignal domain n a, DSignal domain ((n + m) + 1) a)) -> DSignal domain n a Source #

Feed the delayed result of a function back to its input:

mac :: Clock domain gated -> Reset domain synchronous ->`DSignal`

domain 0 Int ->`DSignal`

domain 0 Int ->`DSignal`

domain 0 Int mac clk rst x y =`feedback`

(mac' x y) where mac' ::`DSignal`

domain 0 Int ->`DSignal`

domain 0 Int ->`DSignal`

domain 0 Int -> (`DSignal`

domain 0 Int,`DSignal`

domain 1 Int) mac' a b acc = let acc' = a * b + acc in (acc,`delay`

clk rst (`singleton`

0) acc')

`>>>`

[0,1,5,14,30,55]`sampleN 6 (mac systemClockGen systemResetGen (dfromList [1..]) (dfromList [1..]))`

# Signal <-> DSignal conversion

fromSignal :: Signal domain a -> DSignal domain 0 a Source #

`Signal`

s are not delayed

sample s == dsample (fromSignal s)

toSignal :: DSignal domain delay a -> Signal domain a Source #

Strip a `DSignal`

from its delay information.

# List <-> DSignal conversion (not synthesisable)

dfromList :: NFData a => [a] -> DSignal domain 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.

`>>>`

[1,2]`sampleN 2 (dfromList [1,2,3,4,5])`

**NB**: This function is not synthesisable

## lazy versions

dfromList_lazy :: [a] -> DSignal domain 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.

`>>>`

[1,2]`sampleN 2 (dfromList [1,2,3,4,5])`

**NB**: This function is not synthesisable

# Experimental

unsafeFromSignal :: Signal domain a -> DSignal domain n a Source #