clash-prelude-0.99.3: CAES Language for Synchronous Hardware - Prelude library

Copyright(C) 2013-2016 University of Twente
LicenseBSD2 (see the file LICENSE)
MaintainerChristiaan Baaij <christiaan.baaij@gmail.com>
Safe HaskellTrustworthy
LanguageHaskell2010

Clash.Sized.Unsigned

Description

 
Synopsis

Documentation

data Unsigned (n :: Nat) Source #

Arbitrary-width unsigned integer represented by n bits

Given n bits, an Unsigned n number has a range of: [0 .. 2^n-1]

NB: The Num operators perform wrap-around on overflow. If you want saturation on overflow, check out the SaturatingNum class.

>>> maxBound :: Unsigned 3
7
>>> minBound :: Unsigned 3
0
>>> read (show (maxBound :: Unsigned 3)) :: Unsigned 3
7
>>> 1 + 2 :: Unsigned 3
3
>>> 2 + 6 :: Unsigned 3
0
>>> 1 - 3 :: Unsigned 3
6
>>> 2 * 3 :: Unsigned 3
6
>>> 2 * 4 :: Unsigned 3
0
>>> (2 :: Unsigned 3) `times` (4 :: Unsigned 3) :: Unsigned 6
8
>>> (2 :: Unsigned 3) `plus` (6 :: Unsigned 3) :: Unsigned 4
8
>>> satPlus SatSymmetric 2 6 :: Unsigned 3
7
>>> satMin SatSymmetric 2 3 :: Unsigned 3
0
Instances
Resize Unsigned Source # 
Instance details
KnownNat n => Bounded (Unsigned n) Source # 
Instance details
KnownNat n => Enum (Unsigned n) Source #

The functions: enumFrom, enumFromThen, enumFromTo, and enumFromThenTo, are not synthesisable.

Instance details
Eq (Unsigned n) Source # 
Instance details

Methods

(==) :: Unsigned n -> Unsigned n -> Bool #

(/=) :: Unsigned n -> Unsigned n -> Bool #

KnownNat n => Integral (Unsigned n) Source # 
Instance details
KnownNat n => Data (Unsigned n) Source # 
Instance details

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Unsigned n -> c (Unsigned n) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Unsigned n) #

toConstr :: Unsigned n -> Constr #

dataTypeOf :: Unsigned n -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Unsigned n)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Unsigned n)) #

gmapT :: (forall b. Data b => b -> b) -> Unsigned n -> Unsigned n #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Unsigned n -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Unsigned n -> r #

gmapQ :: (forall d. Data d => d -> u) -> Unsigned n -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Unsigned n -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Unsigned n -> m (Unsigned n) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Unsigned n -> m (Unsigned n) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Unsigned n -> m (Unsigned n) #

KnownNat n => Num (Unsigned n) Source # 
Instance details
Ord (Unsigned n) Source # 
Instance details

Methods

compare :: Unsigned n -> Unsigned n -> Ordering #

(<) :: Unsigned n -> Unsigned n -> Bool #

(<=) :: Unsigned n -> Unsigned n -> Bool #

(>) :: Unsigned n -> Unsigned n -> Bool #

(>=) :: Unsigned n -> Unsigned n -> Bool #

max :: Unsigned n -> Unsigned n -> Unsigned n #

min :: Unsigned n -> Unsigned n -> Unsigned n #

KnownNat n => Read (Unsigned n) Source #

None of the Read class' methods are synthesisable.

Instance details
KnownNat n => Real (Unsigned n) Source # 
Instance details

Methods

toRational :: Unsigned n -> Rational #

Show (Unsigned n) Source # 
Instance details

Methods

showsPrec :: Int -> Unsigned n -> ShowS #

show :: Unsigned n -> String #

showList :: [Unsigned n] -> ShowS #

KnownNat n => Lift (Unsigned n) Source # 
Instance details

Methods

lift :: Unsigned n -> Q Exp #

KnownNat n => Arbitrary (Unsigned n) Source # 
Instance details

Methods

arbitrary :: Gen (Unsigned n) #

shrink :: Unsigned n -> [Unsigned n] #

KnownNat n => CoArbitrary (Unsigned n) Source # 
Instance details

Methods

coarbitrary :: Unsigned n -> Gen b -> Gen b #

KnownNat n => Bits (Unsigned n) Source # 
Instance details
KnownNat n => FiniteBits (Unsigned n) Source # 
Instance details
Default (Unsigned n) Source # 
Instance details

Methods

def :: Unsigned n #

NFData (Unsigned n) Source # 
Instance details

Methods

rnf :: Unsigned n -> () #

KnownNat n => Ixed (Unsigned n) Source # 
Instance details

Methods

ix :: Index (Unsigned n) -> Traversal' (Unsigned n) (IxValue (Unsigned n)) #

KnownNat n => SaturatingNum (Unsigned n) Source # 
Instance details
ShowX (Unsigned n) Source # 
Instance details
BitPack (Unsigned n) Source # 
Instance details

Associated Types

type BitSize (Unsigned n) :: Nat Source #

Bundle (Unsigned n) Source # 
Instance details

Associated Types

type Unbundled domain (Unsigned n) = (res :: *) Source #

Methods

bundle :: Unbundled domain (Unsigned n) -> Signal domain (Unsigned n) Source #

unbundle :: Signal domain (Unsigned n) -> Unbundled domain (Unsigned n) Source #

(KnownNat m, KnownNat n) => ExtendingNum (Unsigned m) (Unsigned n) Source # 
Instance details

Associated Types

type AResult (Unsigned m) (Unsigned n) :: * Source #

type MResult (Unsigned m) (Unsigned n) :: * Source #

type Unbundled domain (Unsigned n) Source # 
Instance details
type Unbundled domain (Unsigned n) = Signal domain (Unsigned n)
type Index (Unsigned n) Source # 
Instance details
type Index (Unsigned n) = Int
type IxValue (Unsigned n) Source # 
Instance details
type IxValue (Unsigned n) = Bit
type BitSize (Unsigned n) Source # 
Instance details
type BitSize (Unsigned n) = n
type AResult (Unsigned m) (Unsigned n) Source # 
Instance details
type AResult (Unsigned m) (Unsigned n) = Unsigned (Max m n + 1)
type MResult (Unsigned m) (Unsigned n) Source # 
Instance details
type MResult (Unsigned m) (Unsigned n) = Unsigned (m + n)