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

Copyright | (C) 2021-2022 QBayLogic B.V.
License | BSD2 (see the file LICENSE)
Maintainer | QBayLogic B.V. <devops@qbaylogic.com>
Safe Haskell | None
Language | Haskell2010

Clash.Num.Overflowing

Description

Synopsis

- data Overflowing a
- fromOverflowing :: Overflowing a -> a
- hasOverflowed :: Overflowing a -> Bool
- toOverflowing :: a -> Overflowing a
- clearOverflow :: Overflowing a -> Overflowing a

# Documentation

data Overflowing a Source #

An overflowing number behaves similarly to a `Wrapping` number, but also includes an overflow status flag which can be used to more easily check if an overflow has occurred.

Numbers can be converted to be `Overflowing` using `toOverflowing`.

#### Instances

Instances details

Binary a => Binary (Overflowing a) Source # |
Instance details Defined in Clash.Num.Overflowing Methods put :: Overflowing a -> Put Source # get :: Get (Overflowing a) Source # putList :: [Overflowing a] -> Put Source #
(BitPack a, KnownNat (BitSize a + 1)) => BitPack (Overflowing a) Source # |

Instance details

Defined in Clash.Num.Overflowing

Associated Types

type BitSize (Overflowing a) |
Instance details Defined in Clash.Num.Overflowing type BitSize (Overflowing a) = BitSize a + 1

Methods

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

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

Parity a => Parity (Overflowing a) Source # |
Instance details Defined in Clash.Num.Overflowing Methods even :: Overflowing a -> Bool Source # odd :: Overflowing a -> Bool Source #
NFDataX a => NFDataX (Overflowing a) Source # |
Instance details Defined in Clash.Num.Overflowing Methods deepErrorX :: String -> Overflowing a Source # hasUndefined :: Overflowing a -> Bool Source # ensureSpine :: Overflowing a -> Overflowing a Source # rnfX :: Overflowing a -> () Source #
ShowX a => ShowX (Overflowing a) Source # |
Instance details Defined in Clash.Num.Overflowing Methods showsPrecX :: Int -> Overflowing a -> ShowS Source # showX :: Overflowing a -> String Source # showListX :: [Overflowing a] -> ShowS Source #
NFData a => NFData (Overflowing a) Source # |
Instance details Defined in Clash.Num.Overflowing Methods rnf :: Overflowing a -> () Source #
Bounded a => Bounded (Overflowing a) Source # |
Instance details Defined in Clash.Num.Overflowing Methods minBound :: Overflowing a Source # maxBound :: Overflowing a Source #
(Enum a, Eq a, SaturatingNum a) => Enum (Overflowing a) Source # |

Instance details

Defined in Clash.Num.Overflowing

Methods

succ :: Overflowing a -> Overflowing a Source #

pred :: Overflowing a -> Overflowing a Source #

toEnum :: Int -> Overflowing a Source #

fromEnum :: Overflowing a -> Int Source #

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

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

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

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

Generic (Overflowing a) Source # |

Instance details

Defined in Clash.Num.Overflowing

Associated Types

type Rep (Overflowing a) |

Instance details

Defined in Clash.Num.Overflowing

type Rep (Overflowing a) = D1 ('MetaData "Overflowing" "Clash.Num.Overflowing" "clash-prelude-1.8.4-1CKHk9HHRNIGPqhYHQsmcW" 'False) (C1 ('MetaCons "Overflowing" 'PrefixI 'True) (S1 ('MetaSel ('Just "fromOverflowing") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Just "hasOverflowed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))

Methods

from :: Overflowing a -> Rep (Overflowing a) x Source #

to :: Rep (Overflowing a) x -> Overflowing a Source #

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

Instance details

Defined in Clash.Num.Overflowing

Methods

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

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

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

negate :: Overflowing a -> Overflowing a Source #

abs :: Overflowing a -> Overflowing a Source #

signum :: Overflowing a -> Overflowing a Source #

fromInteger :: Integer -> Overflowing a Source #

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

Instance details

Defined in Clash.Num.Overflowing

Methods

quot :: Overflowing a -> Overflowing a -> Overflowing a Source #

rem :: Overflowing a -> Overflowing a -> Overflowing a Source #

div :: Overflowing a -> Overflowing a -> Overflowing a Source #

mod :: Overflowing a -> Overflowing a -> Overflowing a Source #

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

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

toInteger :: Overflowing a -> Integer Source #

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

Instance details

Defined in Clash.Num.Overflowing

Methods

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

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

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

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

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

max :: Overflowing a -> Overflowing a -> Overflowing a Source #

min :: Overflowing a -> Overflowing a -> Overflowing a Source #

Hashable a => Hashable (Overflowing a) Source # |
Instance details Defined in Clash.Num.Overflowing Methods hashWithSalt :: Int -> Overflowing a -> Int Source # hash :: Overflowing a -> Int Source #
type BitSize (Overflowing a) Source # |
Instance details Defined in Clash.Num.Overflowing type BitSize (Overflowing a) = BitSize a + 1
type Rep (Overflowing a) Source # |

Instance details

Defined in Clash.Num.Overflowing

type Rep (Overflowing a) = D1 ('MetaData "Overflowing" "Clash.Num.Overflowing" "clash-prelude-1.8.4-1CKHk9HHRNIGPqhYHQsmcW" 'False) (C1 ('MetaCons "Overflowing" 'PrefixI 'True) (S1 ('MetaSel ('Just "fromOverflowing") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Just "hasOverflowed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))

fromOverflowing :: Overflowing a -> a Source #

Retrieve the value

hasOverflowed :: Overflowing a -> Bool Source #

`True` when a computation has overflowed

toOverflowing :: a -> Overflowing a Source #

clearOverflow :: Overflowing a -> Overflowing a Source #

Reset the overflow status flag to False.