Safe Haskell | None |
---|---|

Language | Haskell2010 |

- data Signal a
- sample :: Signal a -> [a]
- sampleN :: Int -> Signal a -> [a]
- fromList :: [a] -> Signal a
- signal :: a -> Signal a
- register :: a -> Signal a -> Signal a
- simulate :: (Signal a -> Signal b) -> [a] -> [b]
- class Pack a where
- simulateP :: (Pack a, Pack b) => (SignalP a -> SignalP b) -> [a] -> [b]
- (<^) :: Applicative f => f a -> (a -> b -> c) -> f b -> f c
- (^>) :: Applicative f => (f a -> f b) -> f a -> f b

# Documentation

A synchronized signal with elements of type `a`

fromList :: [a] -> Signal a Source

Create a `Signal`

from a list

Every element in the list will correspond to a value of the signal for one clock cycle.

sampleN 2 (fromList [1,2,3,4,5]) == [1,2]

signal :: a -> Signal a Source

Create a constant `Signal`

from a combinational value

sample (signal 4) == [4, 4, 4, 4, ...

pack :: SignalP a -> Signal a Source

pack :: (Signal a, Signal b) -> Signal (a,b)

However:

pack :: Signal Bit -> Signal Bit

unpack :: Signal a -> SignalP a Source

unpack :: Signal (a,b) -> (Signal a, Signal b)

However:

unpack :: Signal Bit -> Signal Bit

Pack Bool | |

Pack Double | |

Pack Float | |

Pack Int | |

Pack Integer | |

Pack () | |

Pack Bit | |

Pack (Signed n) | |

Pack (Unsigned n) | |

Pack (a, b) | |

Pack (Vec n a) | |

Pack (UFixed i f) | |

Pack (SFixed i f) | |

Pack (a, b, c) | |

Pack (a, b, c, d) | |

Pack (a, b, c, d, e) | |

Pack (a, b, c, d, e, f) | |

Pack (a, b, c, d, e, f, g) | |

Pack (a, b, c, d, e, f, g, h) |

(<^) :: Applicative f => f a -> (a -> b -> c) -> f b -> f c Source

Operator lifting, use in conjunction with '(^>)'

add2 :: Signal Int -> Signal Int add2 x = x <^(+)^> (signal 2) simulate add2 [1,2,3,... == [3,4,5,...

(^>) :: Applicative f => (f a -> f b) -> f a -> f b Source

Operator lifting, use in conjunction with '(<^)'

add2 :: Signal Int -> Signal Int add2 x = x <^(+)^> (signal 2) simulate add2 [1,2,3,... == [3,4,5,...