clash-prelude-1.8.4: Clash: a functional hardware description language - Prelude library

Safe Haskell | None
Language | Haskell2010

Clash.Num.Zeroing

Synopsis

- data Zeroing a
- fromZeroing :: Zeroing a -> a
- toZeroing :: SaturatingNum a => a -> Zeroing a

# Documentation

data Zeroing a Source #

A zeroing number type is one where all operations return zero if they go out of bounds for the underlying type.

Numbers can be converted to zero by default using `toZeroing`.

#### Instances

Instances details

Arbitrary a => Arbitrary (Zeroing a) Source # |
Instance details Defined in Clash.Num.Zeroing Methods arbitrary :: Gen (Zeroing a) Source # shrink :: Zeroing a -> [Zeroing a] Source #
Binary a => Binary (Zeroing a) Source # |
Instance details Defined in Clash.Num.Zeroing Methods put :: Zeroing a -> Put Source # get :: Get (Zeroing a) Source # putList :: [Zeroing a] -> Put Source #
BitPack a => BitPack (Zeroing a) Source # |

Instance details

Defined in Clash.Num.Zeroing

Associated Types

type BitSize (Zeroing a) |
Instance details Defined in Clash.Num.Zeroing type BitSize (Zeroing a) = BitSize a

Methods

pack :: Zeroing a -> BitVector (BitSize (Zeroing a)) Source #

unpack :: BitVector (BitSize (Zeroing a)) -> Zeroing a Source #

Parity a => Parity (Zeroing a) Source # |
Instance details Defined in Clash.Num.Zeroing Methods even :: Zeroing a -> Bool Source # odd :: Zeroing a -> Bool Source #
NFDataX a => NFDataX (Zeroing a) Source # |
Instance details Defined in Clash.Num.Zeroing Methods deepErrorX :: String -> Zeroing a Source # hasUndefined :: Zeroing a -> Bool Source # ensureSpine :: Zeroing a -> Zeroing a Source # rnfX :: Zeroing a -> () Source #
ShowX a => ShowX (Zeroing a) Source # |
Instance details Defined in Clash.Num.Zeroing Methods showsPrecX :: Int -> Zeroing a -> ShowS Source # showX :: Zeroing a -> String Source # showListX :: [Zeroing a] -> ShowS Source #
NFData a => NFData (Zeroing a) Source # |
Instance details Defined in Clash.Num.Zeroing Methods rnf :: Zeroing a -> () Source #
Bits a => Bits (Zeroing a) Source # |

Instance details

Defined in Clash.Num.Zeroing

Methods

(.&.) :: Zeroing a -> Zeroing a -> Zeroing a Source #

(.|.) :: Zeroing a -> Zeroing a -> Zeroing a Source #

xor :: Zeroing a -> Zeroing a -> Zeroing a Source #

complement :: Zeroing a -> Zeroing a Source #

shift :: Zeroing a -> Int -> Zeroing a Source #

rotate :: Zeroing a -> Int -> Zeroing a Source #

zeroBits :: Zeroing a Source #

bit :: Int -> Zeroing a Source #

setBit :: Zeroing a -> Int -> Zeroing a Source #

clearBit :: Zeroing a -> Int -> Zeroing a Source #

complementBit :: Zeroing a -> Int -> Zeroing a Source #

testBit :: Zeroing a -> Int -> Bool Source #

bitSizeMaybe :: Zeroing a -> Maybe Int Source #

bitSize :: Zeroing a -> Int Source #

isSigned :: Zeroing a -> Bool Source #

shiftL :: Zeroing a -> Int -> Zeroing a Source #

unsafeShiftL :: Zeroing a -> Int -> Zeroing a Source #

shiftR :: Zeroing a -> Int -> Zeroing a Source #

unsafeShiftR :: Zeroing a -> Int -> Zeroing a Source #

rotateL :: Zeroing a -> Int -> Zeroing a Source #

rotateR :: Zeroing a -> Int -> Zeroing a Source #

popCount :: Zeroing a -> Int Source #

FiniteBits a => FiniteBits (Zeroing a) Source # |
Instance details Defined in Clash.Num.Zeroing Methods finiteBitSize :: Zeroing a -> Int Source # countLeadingZeros :: Zeroing a -> Int Source # countTrailingZeros :: Zeroing a -> Int Source #
Bounded a => Bounded (Zeroing a) Source # |
Instance details Defined in Clash.Num.Zeroing Methods minBound :: Zeroing a Source # maxBound :: Zeroing a Source #
(Enum a, SaturatingNum a) => Enum (Zeroing a) Source # |

Instance details

Defined in Clash.Num.Zeroing

Methods

succ :: Zeroing a -> Zeroing a Source #

pred :: Zeroing a -> Zeroing a Source #

toEnum :: Int -> Zeroing a Source #

fromEnum :: Zeroing a -> Int Source #

enumFrom :: Zeroing a -> [Zeroing a] Source #

enumFromThen :: Zeroing a -> Zeroing a -> [Zeroing a] Source #

enumFromTo :: Zeroing a -> Zeroing a -> [Zeroing a] Source #

enumFromThenTo :: Zeroing a -> Zeroing a -> Zeroing a -> [Zeroing a] Source #

(Bounded a, Ord a, SaturatingNum a) => Num (Zeroing a) Source # |
Instance details Defined in Clash.Num.Zeroing Methods (+) :: Zeroing a -> Zeroing a -> Zeroing a Source # (-) :: Zeroing a -> Zeroing a -> Zeroing a Source # (*) :: Zeroing a -> Zeroing a -> Zeroing a Source # negate :: Zeroing a -> Zeroing a Source # abs :: Zeroing a -> Zeroing a Source # signum :: Zeroing a -> Zeroing a Source # fromInteger :: Integer -> Zeroing a Source #
(Fractional a, Ord a, SaturatingNum a) => Fractional (Zeroing a) Source # |
Instance details Defined in Clash.Num.Zeroing Methods (/) :: Zeroing a -> Zeroing a -> Zeroing a Source # recip :: Zeroing a -> Zeroing a Source # fromRational :: Rational -> Zeroing a Source #
(Integral a, SaturatingNum a) => Integral (Zeroing a) Source # |

Instance details

Defined in Clash.Num.Zeroing

Methods

quot :: Zeroing a -> Zeroing a -> Zeroing a Source #

rem :: Zeroing a -> Zeroing a -> Zeroing a Source #

div :: Zeroing a -> Zeroing a -> Zeroing a Source #

mod :: Zeroing a -> Zeroing a -> Zeroing a Source #

quotRem :: Zeroing a -> Zeroing a -> (Zeroing a, Zeroing a) Source #

divMod :: Zeroing a -> Zeroing a -> (Zeroing a, Zeroing a) Source #

toInteger :: Zeroing a -> Integer Source #

(Real a, SaturatingNum a) => Real (Zeroing a) Source # |
Instance details Defined in Clash.Num.Zeroing Methods toRational :: Zeroing a -> Rational Source #
(RealFrac a, SaturatingNum a) => RealFrac (Zeroing a) Source # |
Instance details Defined in Clash.Num.Zeroing Methods properFraction :: Integral b => Zeroing a -> (b, Zeroing a) Source # truncate :: Integral b => Zeroing a -> b Source # round :: Integral b => Zeroing a -> b Source # ceiling :: Integral b => Zeroing a -> b Source # floor :: Integral b => Zeroing a -> b Source #
Show a => Show (Zeroing a) Source # |
Instance details Defined in Clash.Num.Zeroing Methods showsPrec :: Int -> Zeroing a -> ShowS Source # show :: Zeroing a -> String Source # showList :: [Zeroing a] -> ShowS Source #
Eq a => Eq (Zeroing a) Source # |
Instance details Defined in Clash.Num.Zeroing Methods (==) :: Zeroing a -> Zeroing a -> Bool Source # (/=) :: Zeroing a -> Zeroing a -> Bool Source #
Ord a => Ord (Zeroing a) Source # |

Instance details

Defined in Clash.Num.Zeroing

Methods

compare :: Zeroing a -> Zeroing a -> Ordering Source #

(<) :: Zeroing a -> Zeroing a -> Bool Source #

(<=) :: Zeroing a -> Zeroing a -> Bool Source #

(>) :: Zeroing a -> Zeroing a -> Bool Source #

(>=) :: Zeroing a -> Zeroing a -> Bool Source #

max :: Zeroing a -> Zeroing a -> Zeroing a Source #

min :: Zeroing a -> Zeroing a -> Zeroing a Source #

Hashable a => Hashable (Zeroing a) Source # |
Instance details Defined in Clash.Num.Zeroing Methods hashWithSalt :: Int -> Zeroing a -> Int Source # hash :: Zeroing a -> Int Source #
Resize f => Resize (Compose Zeroing f) Source # |

Instance details

Defined in Clash.Num.Zeroing

Methods

resize :: forall (a :: Nat) (b :: Nat). (KnownNat a, KnownNat b) => Compose Zeroing f a -> Compose Zeroing f b Source #

extend :: forall (a :: Nat) (b :: Nat). (KnownNat a, KnownNat b) => Compose Zeroing f a -> Compose Zeroing f (b + a) Source #

zeroExtend :: forall (a :: Nat) (b :: Nat). (KnownNat a, KnownNat b) => Compose Zeroing f a -> Compose Zeroing f (b + a) Source #

signExtend :: forall (a :: Nat) (b :: Nat). (KnownNat a, KnownNat b) => Compose Zeroing f a -> Compose Zeroing f (b + a) Source #

truncateB :: forall (a :: Nat) (b :: Natural). KnownNat a => Compose Zeroing f (a + b) -> Compose Zeroing f a Source #

type BitSize (Zeroing a) Source # |
Instance details Defined in Clash.Num.Zeroing type BitSize (Zeroing a) = BitSize a

fromZeroing :: Zeroing a -> a Source #

toZeroing :: SaturatingNum a => a -> Zeroing a Source #