clash-prelude-0.99.2: 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

Defined in Clash.Sized.Internal.Unsigned

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

Defined in Clash.Sized.Internal.Unsigned

KnownNat n => Enum (Unsigned n) Source #

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

Instance details

Defined in Clash.Sized.Internal.Unsigned

Eq (Unsigned n) Source # 
Instance details

Defined in Clash.Sized.Internal.Unsigned

Methods

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

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

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

Defined in Clash.Sized.Internal.Unsigned

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

Defined in Clash.Sized.Internal.Unsigned

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

Defined in Clash.Sized.Internal.Unsigned

Ord (Unsigned n) Source # 
Instance details

Defined in Clash.Sized.Internal.Unsigned

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

Defined in Clash.Sized.Internal.Unsigned

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

Defined in Clash.Sized.Internal.Unsigned

Methods

toRational :: Unsigned n -> Rational #

Show (Unsigned n) Source # 
Instance details

Defined in Clash.Sized.Internal.Unsigned

Methods

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

show :: Unsigned n -> String #

showList :: [Unsigned n] -> ShowS #

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

Defined in Clash.Sized.Internal.Unsigned

Methods

lift :: Unsigned n -> Q Exp #

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

Defined in Clash.Sized.Internal.Unsigned

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

Defined in Clash.Sized.Internal.Unsigned

NFData (Unsigned n) Source # 
Instance details

Defined in Clash.Sized.Internal.Unsigned

Methods

rnf :: Unsigned n -> () #

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

Defined in Clash.Sized.Internal.Unsigned

ShowX (Unsigned n) Source # 
Instance details

Defined in Clash.Sized.Internal.Unsigned

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

Defined in Clash.Sized.Internal.Unsigned

Methods

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

Default (Unsigned n) Source # 
Instance details

Defined in Clash.Sized.Internal.Unsigned

Methods

def :: Unsigned n

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

Defined in Clash.Sized.Internal.Unsigned

Methods

arbitrary :: Gen (Unsigned n)

shrink :: Unsigned n -> [Unsigned n]

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

Defined in Clash.Sized.Internal.Unsigned

Methods

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

BitPack (Unsigned n) Source # 
Instance details

Defined in Clash.Sized.Internal.Unsigned

Associated Types

type BitSize (Unsigned n) :: Nat Source #

Bundle (Unsigned n) Source # 
Instance details

Defined in Clash.Signal.Bundle

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

Defined in Clash.Sized.Internal.Unsigned

Associated Types

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

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

type Unbundled domain (Unsigned n) Source # 
Instance details

Defined in Clash.Signal.Bundle

type Unbundled domain (Unsigned n) = Signal domain (Unsigned n)
type Index (Unsigned n) Source # 
Instance details

Defined in Clash.Sized.Internal.Unsigned

type Index (Unsigned n) = Int
type IxValue (Unsigned n) Source # 
Instance details

Defined in Clash.Sized.Internal.Unsigned

type IxValue (Unsigned n) = Bit
type BitSize (Unsigned n) Source # 
Instance details

Defined in Clash.Sized.Internal.Unsigned

type BitSize (Unsigned n) = n
type AResult (Unsigned m) (Unsigned n) Source # 
Instance details

Defined in Clash.Sized.Internal.Unsigned

type AResult (Unsigned m) (Unsigned n) = Unsigned (Max m n + 1)
type MResult (Unsigned m) (Unsigned n) Source # 
Instance details

Defined in Clash.Sized.Internal.Unsigned

type MResult (Unsigned m) (Unsigned n) = Unsigned (m + n)