clash-prelude-1.6.6: Clash: a functional hardware description language - Prelude library
Copyright(C) 2021-2022 QBayLogic B.V.
LicenseBSD2 (see the file LICENSE)
MaintainerQBayLogic B.V. <devops@qbaylogic.com>
Safe HaskellNone
LanguageHaskell2010

Clash.Num.Overflowing

Description

 
Synopsis

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
Bounded a => Bounded (Overflowing a) Source # 
Instance details

Defined in Clash.Num.Overflowing

(Enum a, Eq a, SaturatingNum a) => Enum (Overflowing a) Source # 
Instance details

Defined in Clash.Num.Overflowing

Eq a => Eq (Overflowing a) Source # 
Instance details

Defined in Clash.Num.Overflowing

(Fractional a, Ord a, SaturatingNum a) => Fractional (Overflowing a) Source # 
Instance details

Defined in Clash.Num.Overflowing

(Integral a, SaturatingNum a) => Integral (Overflowing a) Source # 
Instance details

Defined in Clash.Num.Overflowing

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

Defined in Clash.Num.Overflowing

Ord a => Ord (Overflowing a) Source # 
Instance details

Defined in Clash.Num.Overflowing

(Real a, SaturatingNum a) => Real (Overflowing a) Source # 
Instance details

Defined in Clash.Num.Overflowing

(RealFrac a, SaturatingNum a) => RealFrac (Overflowing a) Source # 
Instance details

Defined in Clash.Num.Overflowing

Methods

properFraction :: Integral b => Overflowing a -> (b, Overflowing a) #

truncate :: Integral b => Overflowing a -> b #

round :: Integral b => Overflowing a -> b #

ceiling :: Integral b => Overflowing a -> b #

floor :: Integral b => Overflowing a -> b #

Show a => Show (Overflowing a) Source # 
Instance details

Defined in Clash.Num.Overflowing

Generic (Overflowing a) Source # 
Instance details

Defined in Clash.Num.Overflowing

Associated Types

type Rep (Overflowing a) :: Type -> Type #

Methods

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

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

Binary a => Binary (Overflowing a) Source # 
Instance details

Defined in Clash.Num.Overflowing

Methods

put :: Overflowing a -> Put #

get :: Get (Overflowing a) #

putList :: [Overflowing a] -> Put #

NFData a => NFData (Overflowing a) Source # 
Instance details

Defined in Clash.Num.Overflowing

Methods

rnf :: Overflowing a -> () #

Hashable a => Hashable (Overflowing a) Source # 
Instance details

Defined in Clash.Num.Overflowing

Methods

hashWithSalt :: Int -> Overflowing a -> Int #

hash :: Overflowing a -> Int #

NFDataX a => NFDataX (Overflowing a) Source # 
Instance details

Defined in Clash.Num.Overflowing

ShowX a => ShowX (Overflowing a) Source # 
Instance details

Defined in Clash.Num.Overflowing

(BitPack a, KnownNat (BitSize a + 1)) => BitPack (Overflowing a) Source # 
Instance details

Defined in Clash.Num.Overflowing

Associated Types

type BitSize (Overflowing a) :: Nat Source #

Parity a => Parity (Overflowing a) Source # 
Instance details

Defined in Clash.Num.Overflowing

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.6.6-inplace" 'False) (C1 ('MetaCons "Overflowing" 'PrefixI 'True) (S1 ('MetaSel ('Just "fromOverflowing") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Just "hasOverflowed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))
type BitSize (Overflowing a) Source # 
Instance details

Defined in Clash.Num.Overflowing

type BitSize (Overflowing a) = BitSize a + 1

fromOverflowing :: Overflowing a -> a Source #

Retrieve the value

hasOverflowed :: Overflowing a -> Bool Source #

True when a computation has overflowed

clearOverflow :: Overflowing a -> Overflowing a Source #

Reset the overflow status flag to False.