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

Safe Haskell | None
Language | Haskell2010

Clash.Num.Wrapping

Synopsis

- newtype Wrapping a = Wrapping {
  - fromWrapping :: a
  }
- toWrapping :: SaturatingNum a => a -> Wrapping a

# Documentation

newtype Wrapping a Source #

A wrapping number type is one where all operations wrap between minBound and maxBound (and vice-versa) if the result goes out of bounds for the underlying type.

Numbers can be converted to wrap by default using `toWrapping`.

Constructors

Wrapping |

Fields

- fromWrapping :: a

#### Instances

Instances details

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

Instance details

Defined in Clash.Num.Wrapping

Associated Types

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

Methods

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

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

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

Instance details

Defined in Clash.Num.Wrapping

Methods

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

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

xor :: Wrapping a -> Wrapping a -> Wrapping a Source #

complement :: Wrapping a -> Wrapping a Source #

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

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

zeroBits :: Wrapping a Source #

bit :: Int -> Wrapping a Source #

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

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

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

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

bitSizeMaybe :: Wrapping a -> Maybe Int Source #

bitSize :: Wrapping a -> Int Source #

isSigned :: Wrapping a -> Bool Source #

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

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

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

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

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

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

popCount :: Wrapping a -> Int Source #

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

Instance details

Defined in Clash.Num.Wrapping

Methods

succ :: Wrapping a -> Wrapping a Source #

pred :: Wrapping a -> Wrapping a Source #

toEnum :: Int -> Wrapping a Source #

fromEnum :: Wrapping a -> Int Source #

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

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

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

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

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

Instance details

Defined in Clash.Num.Wrapping

Methods

quot :: Wrapping a -> Wrapping a -> Wrapping a Source #

rem :: Wrapping a -> Wrapping a -> Wrapping a Source #

div :: Wrapping a -> Wrapping a -> Wrapping a Source #

mod :: Wrapping a -> Wrapping a -> Wrapping a Source #

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

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

toInteger :: Wrapping a -> Integer Source #

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

Instance details

Defined in Clash.Num.Wrapping

Methods

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

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

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

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

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

max :: Wrapping a -> Wrapping a -> Wrapping a Source #

min :: Wrapping a -> Wrapping a -> Wrapping a Source #

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

Instance details

Defined in Clash.Num.Wrapping

Methods

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

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

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

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

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

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

toWrapping :: SaturatingNum a => a -> Wrapping a Source #