exp package:clash-prelude

Type class implementing exponentiation with explicitly resizing results.
exponent corresponds to the second component of decodeFloat. exponent 0 = 0 and for finite nonzero x, exponent x = snd (decodeFloat x) + floatDigits x. If x is a finite floating-point number, it is equal in value to significand x * b ^^ exponent x, where b is the floating-point radix. The behaviour is unspecified on infinite or NaN values.
Expose a Hidden argument so that it can be applied normally, e.g.
f :: Hidden "foo" Int
=> Bool
-> Int
f = ...

g :: Int -> Bool -> Int
g = expose @"foo" f
Expose a hidden Clock argument of a component, so it can be applied explicitly. Click here to read more about hidden clocks, resets, and enables

Example

Usage with a polymorphic domain:
>>> reg = register 5 (reg + 1)

>>> sig = exposeClock reg clockGen

>>> sampleN @System 10 sig
[5,5,6,7,8,9,10,11,12,13]
Force exposeClock to work on System (hence sampleN not needing an explicit domain later):
>>> reg = register 5 (reg + 1)

>>> sig = exposeClock @System reg clockGen

>>> sampleN 10 sig
[5,5,6,7,8,9,10,11,12,13]
Expose hidden Clock, Reset, and Enable arguments of a component, so they can be applied explicitly. Click here to read more about hidden clocks, resets, and enables

Example

Usage with a polymorphic domain:
>>> reg = register 5 (reg + 1)

>>> sig = exposeClockResetEnable reg clockGen resetGen enableGen

>>> sampleN @System 10 sig
[5,5,6,7,8,9,10,11,12,13]
Force exposeClockResetEnable to work on System (hence sampleN not needing an explicit domain later):
>>> reg = register 5 (reg + 1)

>>> sig = exposeClockResetEnable @System reg clockGen resetGen enableGen

>>> sampleN 10 sig
[5,5,6,7,8,9,10,11,12,13]
Usage in a testbench context:
topEntity :: Vec 2 (Vec 3 (Unsigned 8)) -> Vec 6 (Unsigned 8)
topEntity = concat

testBench :: Signal System Bool
testBench = done
where
testInput      = pure ((1 :> 2 :> 3 :> Nil) :> (4 :> 5 :> 6 :> Nil) :> Nil)
expectedOutput = outputVerifier' ((1:>2:>3:>4:>5:>6:>Nil):>Nil)
done           = exposeClockResetEnable (expectedOutput (topEntity <$> testInput)) clk rst en
clk            = tbSystemClockGen (not <$> done)
rst            = systemResetGen
en             = enableGen
Expose a hidden Enable argument of a component, so it can be applied explicitly. Click here to read more about hidden clocks, resets, and enables

Example

Usage with a polymorphic domain:
>>> reg = register 5 (reg + 1)

>>> sig = exposeEnable reg enableGen

>>> sampleN @System 10 sig
[5,5,6,7,8,9,10,11,12,13]
Force exposeEnable to work on System (hence sampleN not needing an explicit domain later):
>>> reg = register 5 (reg + 1)

>>> sig = exposeEnable @System reg enableGen

>>> sampleN 10 sig
[5,5,6,7,8,9,10,11,12,13]
Expose a hidden Reset argument of a component, so it can be applied explicitly.

Example

Usage with a polymorphic domain:
>>> reg = register 5 (reg + 1)

>>> sig = exposeReset reg resetGen

>>> sampleN @System 10 sig
[5,5,6,7,8,9,10,11,12,13]
Force exposeReset to work on System (hence sampleN not needing an explicit domain later):
>>> reg = register 5 (reg + 1)

>>> sig = exposeReset @System reg resetGen

>>> sampleN 10 sig
[5,5,6,7,8,9,10,11,12,13]
DataReprAnn as template haskell expression