Copyright | (C) 2013-2016 University of Twente |
---|---|
License | BSD2 (see the file LICENSE) |
Maintainer | Christiaan Baaij <christiaan.baaij@gmail.com> |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
Extensions | MagicHash |
- type Signal a = Signal' SystemClock a
- signal :: Applicative f => a -> f a
- register :: a -> Signal a -> Signal a
- registerMaybe :: a -> Signal (Maybe a) -> Signal a
- regEn :: a -> Signal Bool -> Signal a -> Signal a
- mux :: Applicative f => f Bool -> f a -> f a -> f a
- (.&&.) :: Applicative f => f Bool -> f Bool -> f Bool
- (.||.) :: Applicative f => f Bool -> f Bool -> f Bool
- not1 :: Functor f => f Bool -> f Bool
- class Bundle a where
- type Unbundled' (clk :: Clock) a = res | res -> clk
- type Unbundled a = Unbundled' SystemClock a
- simulate :: (NFData a, NFData b) => (Signal' clk1 a -> Signal' clk2 b) -> [a] -> [b]
- simulateB :: (Bundle a, Bundle b, NFData a, NFData b) => (Unbundled' clk1 a -> Unbundled' clk2 b) -> [a] -> [b]
- simulate_lazy :: (Signal' clk1 a -> Signal' clk2 b) -> [a] -> [b]
- simulateB_lazy :: (Bundle a, Bundle b) => (Unbundled' clk1 a -> Unbundled' clk2 b) -> [a] -> [b]
- sample :: (Foldable f, NFData a) => f a -> [a]
- sampleN :: (Foldable f, NFData a) => Int -> f a -> [a]
- fromList :: NFData a => [a] -> Signal' clk a
- sample_lazy :: Foldable f => f a -> [a]
- sampleN_lazy :: Foldable f => Int -> f a -> [a]
- fromList_lazy :: [a] -> Signal' clk a
- testFor :: Foldable f => Int -> f Bool -> Property
- (.==.) :: (Eq a, Applicative f) => f a -> f a -> f Bool
- (./=.) :: (Eq a, Applicative f) => f a -> f a -> f Bool
- compare1 :: (Ord a, Applicative f) => f a -> f a -> f Ordering
- (.<.) :: (Ord a, Applicative f) => f a -> f a -> f Bool
- (.<=.) :: (Ord a, Applicative f) => f a -> f a -> f Bool
- (.>=.) :: (Ord a, Applicative f) => f a -> f a -> f Bool
- (.>.) :: (Ord a, Applicative f) => f a -> f a -> f Bool
- fromEnum1 :: (Enum a, Functor f) => f a -> f Int
- toRational1 :: (Real a, Functor f) => f a -> f Rational
- toInteger1 :: (Integral a, Functor f) => f a -> f Integer
- testBit1 :: (Bits a, Applicative f) => f a -> f Int -> f Bool
- popCount1 :: (Bits a, Functor f) => f a -> f Int
- shift1 :: (Bits a, Applicative f) => f a -> f Int -> f a
- rotate1 :: (Bits a, Applicative f) => f a -> f Int -> f a
- setBit1 :: (Bits a, Applicative f) => f a -> f Int -> f a
- clearBit1 :: (Bits a, Applicative f) => f a -> f Int -> f a
- shiftL1 :: (Bits a, Applicative f) => f a -> f Int -> f a
- unsafeShiftL1 :: (Bits a, Applicative f) => f a -> f Int -> f a
- shiftR1 :: (Bits a, Applicative f) => f a -> f Int -> f a
- unsafeShiftR1 :: (Bits a, Applicative f) => f a -> f Int -> f a
- rotateL1 :: (Bits a, Applicative f) => f a -> f Int -> f a
- rotateR1 :: (Bits a, Applicative f) => f a -> f Int -> f a
Implicitly clocked synchronous signal
type Signal a = Signal' SystemClock a Source #
Signal synchronised to the "system" clock, which has a period of 1000.
Basic circuit functions
signal :: Applicative f => a -> f a Source #
mux :: Applicative f => f Bool -> f a -> f a -> f a Source #
Boolean connectives
Product/Signal isomorphism
Isomorphism between a Signal
of a product type (e.g. a tuple) and a
product type of Signal'
s.
Instances of 'bundle must satisfy the following laws:
bundle
.unbundle
=id
unbundle
.bundle
=id
By default, bundle
and unbundle
, are defined as the identity, that is,
writing:
data D = A | B instance 'bundle D
is the same as:
data D = A | B instance 'bundle D where typeUnbundled'
clk D =Signal'
clk Dbundle
_ s = sunbundle
_ s = s
type Unbundled' (clk :: Clock) a = res | res -> clk Source #
bundle :: Unbundled' clk a -> Signal' clk a Source #
Example:
bundle :: (Signal'
clk a,Signal'
clk b) ->Signal'
clk (a,b)
However:
bundle ::Signal'
clkBit
->Signal'
clkBit
bundle :: Signal' clk a -> Signal' clk a Source #
Example:
bundle :: (Signal'
clk a,Signal'
clk b) ->Signal'
clk (a,b)
However:
bundle ::Signal'
clkBit
->Signal'
clkBit
unbundle :: Signal' clk a -> Unbundled' clk a Source #
Bundle Bool Source # | |
Bundle Double Source # | |
Bundle Float Source # | |
Bundle Int Source # | |
Bundle Integer Source # | |
Bundle () Source # | Note that: bundle :: () -> Signal' clk () unbundle :: Signal' clk () -> () |
Bundle (Maybe a) Source # | |
Bundle (Index n) Source # | |
Bundle (BitVector n) Source # | |
Bundle (Signed n) Source # | |
Bundle (Unsigned n) Source # | |
Bundle (Either a b) Source # | |
Bundle (a, b) Source # | |
KnownNat n => Bundle (Vec n a) Source # | |
KnownNat d => Bundle (RTree d a) Source # | |
Bundle (a, b, c) Source # | |
Bundle (Fixed rep int frac) Source # | |
Bundle (a, b, c, d) Source # | |
Bundle (a, b, c, d, e) Source # | |
Bundle (a, b, c, d, e, f) Source # | |
Bundle (a, b, c, d, e, f, g) Source # | |
Bundle (a, b, c, d, e, f, g, h) Source # | |
type Unbundled a = Unbundled' SystemClock a Source #
Simulation functions (not synthesisable)
simulateB :: (Bundle a, Bundle b, NFData a, NFData b) => (Unbundled' clk1 a -> Unbundled' clk2 b) -> [a] -> [b] Source #
lazy versions
simulate_lazy :: (Signal' clk1 a -> Signal' clk2 b) -> [a] -> [b] Source #
simulateB_lazy :: (Bundle a, Bundle b) => (Unbundled' clk1 a -> Unbundled' clk2 b) -> [a] -> [b] Source #
List <-> Signal conversion (not synthesisable)
fromList :: NFData a => [a] -> Signal' clk 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]
NB: This function is not synthesisable
lazy versions
sample_lazy :: Foldable f => f a -> [a] Source #
sampleN_lazy :: Foldable f => Int -> f a -> [a] Source #
fromList_lazy :: [a] -> Signal' clk 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]
NB: This function is not synthesisable
QuickCheck combinators
Type classes
Eq
-like
Ord
-like
Enum
-like
Rational
-like
toRational1 :: (Real a, Functor f) => f a -> f Rational Source #
Deprecated: toRational1
will be removed in clash-prelude-1.0, use "fmap toRational" instead.
The above type is a generalisation for:
toRational1 ::Real
a =>Signal
a ->Signal
Rational
It is a version of toRational
that returns a Signal
of Rational
Integral
-like
toInteger1 :: (Integral a, Functor f) => f a -> f Integer Source #
Deprecated: toInteger1
will be removed in clash-prelude-1.0, use "fmap toInteger" instead.
The above type is a generalisation for:
toInteger1 ::Integral
a =>Signal
a ->Signal
Integer
It is a version of toRational
that returns a Signal
of Integer
Bits
-like
unsafeShiftL1 :: (Bits a, Applicative f) => f a -> f Int -> f a Source #
Deprecated: unsafeShiftL1
will be removed in clash-prelude-1.0, use "liftA2 unsafeShiftL" instead.
The above type is a generalisation for:
unsafeShiftL1 ::Bits
a =>Signal
a ->Signal
Int
->Signal
a
It is a version of unsafeShiftL
that has a Signal
of Int
as indexing argument
unsafeShiftR1 :: (Bits a, Applicative f) => f a -> f Int -> f a Source #
Deprecated: unsafeShiftR1
will be removed in clash-prelude-1.0, use "liftA2 unsafeShiftR" instead.
The above type is a generalisation for:
unsafeShiftR1 ::Bits
a =>Signal
a ->Signal
Int
->Signal
a
It is a version of unsafeShiftR
that has a Signal
of Int
as indexing argument