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

Safe Haskell | None
Language | Haskell2010

Clash.Num.Saturating

Synopsis

- data Saturating a
- fromSaturating :: Saturating a -> a
- toSaturating :: SaturatingNum a => a -> Saturating a

# Documentation

data Saturating a Source #

A saturating number type is one where all operations saturate at the bounds of the underlying type, i.e. operations which overflow return `maxBound` and operations that underflow return `minBound`.

Numbers can be converted to saturate by default using `toSaturating`.

#### Instances

Instances details

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

Instance details

Defined in Clash.Num.Saturating

Associated Types

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

Methods

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

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

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

Instance details

Defined in Clash.Num.Saturating

Methods

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

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

xor :: Saturating a -> Saturating a -> Saturating a Source #

complement :: Saturating a -> Saturating a Source #

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

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

zeroBits :: Saturating a Source #

bit :: Int -> Saturating a Source #

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

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

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

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

bitSizeMaybe :: Saturating a -> Maybe Int Source #

bitSize :: Saturating a -> Int Source #

isSigned :: Saturating a -> Bool Source #

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

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

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

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

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

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

popCount :: Saturating a -> Int Source #

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

Instance details

Defined in Clash.Num.Saturating

Methods

succ :: Saturating a -> Saturating a Source #

pred :: Saturating a -> Saturating a Source #

toEnum :: Int -> Saturating a Source #

fromEnum :: Saturating a -> Int Source #

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

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

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

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

(Ord a, SaturatingNum a) => Num (Saturating a) Source # |

Instance details

Defined in Clash.Num.Saturating

Methods

(+) :: Saturating a -> Saturating a -> Saturating a Source #

(-) :: Saturating a -> Saturating a -> Saturating a Source #

(*) :: Saturating a -> Saturating a -> Saturating a Source #

negate :: Saturating a -> Saturating a Source #

abs :: Saturating a -> Saturating a Source #

signum :: Saturating a -> Saturating a Source #

fromInteger :: Integer -> Saturating a Source #

(Fractional a, Ord a, SaturatingNum a) => Fractional (Saturating a) Source # |
Instance details Defined in Clash.Num.Saturating Methods (/) :: Saturating a -> Saturating a -> Saturating a Source # recip :: Saturating a -> Saturating a Source # fromRational :: Rational -> Saturating a Source #
(Integral a, SaturatingNum a) => Integral (Saturating a) Source # |

Instance details

Defined in Clash.Num.Saturating

Methods

quot :: Saturating a -> Saturating a -> Saturating a Source #

rem :: Saturating a -> Saturating a -> Saturating a Source #

div :: Saturating a -> Saturating a -> Saturating a Source #

mod :: Saturating a -> Saturating a -> Saturating a Source #

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

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

toInteger :: Saturating a -> Integer Source #

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

Instance details

Defined in Clash.Num.Saturating

Methods

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

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

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

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

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

max :: Saturating a -> Saturating a -> Saturating a Source #

min :: Saturating a -> Saturating a -> Saturating a Source #

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

Instance details

Defined in Clash.Num.Saturating

Methods

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

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

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

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

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

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

fromSaturating :: Saturating a -> a Source #

toSaturating :: SaturatingNum a => a -> Saturating a Source #