Copyright | (C) 2013-2016 University of Twente 2016 Myrtle Software Ltd |
---|---|
License | BSD2 (see the file LICENSE) |
Maintainer | Christiaan Baaij <christiaan.baaij@gmail.com> |
Safe Haskell | Unsafe |
Language | Haskell2010 |
Extensions |
|
Synopsis
- newtype Bit = Bit {}
- high :: Bit
- low :: Bit
- eq## :: Bit -> Bit -> Bool
- neq## :: Bit -> Bit -> Bool
- lt## :: Bit -> Bit -> Bool
- ge## :: Bit -> Bit -> Bool
- gt## :: Bit -> Bit -> Bool
- le## :: Bit -> Bit -> Bool
- fromInteger## :: Integer -> Bit
- and## :: Bit -> Bit -> Bit
- or## :: Bit -> Bit -> Bit
- xor## :: Bit -> Bit -> Bit
- complement## :: Bit -> Bit
- pack# :: Bit -> BitVector 1
- unpack# :: BitVector 1 -> Bit
- newtype BitVector (n :: Nat) = BV {}
- size# :: KnownNat n => BitVector n -> Int
- maxIndex# :: KnownNat n => BitVector n -> Int
- bLit :: KnownNat n => String -> Q (TExp (BitVector n))
- (++#) :: KnownNat m => BitVector n -> BitVector m -> BitVector (n + m)
- reduceAnd# :: KnownNat n => BitVector n -> Bit
- reduceOr# :: BitVector n -> Bit
- reduceXor# :: BitVector n -> Bit
- index# :: KnownNat n => BitVector n -> Int -> Bit
- replaceBit# :: KnownNat n => BitVector n -> Int -> Bit -> BitVector n
- setSlice# :: BitVector ((m + 1) + i) -> SNat m -> SNat n -> BitVector ((m + 1) - n) -> BitVector ((m + 1) + i)
- slice# :: BitVector ((m + 1) + i) -> SNat m -> SNat n -> BitVector ((m + 1) - n)
- split# :: forall n m. KnownNat n => BitVector (m + n) -> (BitVector m, BitVector n)
- msb# :: forall n. KnownNat n => BitVector n -> Bit
- lsb# :: BitVector n -> Bit
- eq# :: BitVector n -> BitVector n -> Bool
- neq# :: BitVector n -> BitVector n -> Bool
- lt# :: BitVector n -> BitVector n -> Bool
- ge# :: BitVector n -> BitVector n -> Bool
- gt# :: BitVector n -> BitVector n -> Bool
- le# :: BitVector n -> BitVector n -> Bool
- enumFrom# :: KnownNat n => BitVector n -> [BitVector n]
- enumFromThen# :: KnownNat n => BitVector n -> BitVector n -> [BitVector n]
- enumFromTo# :: BitVector n -> BitVector n -> [BitVector n]
- enumFromThenTo# :: BitVector n -> BitVector n -> BitVector n -> [BitVector n]
- minBound# :: BitVector n
- maxBound# :: forall n. KnownNat n => BitVector n
- (+#) :: forall n. KnownNat n => BitVector n -> BitVector n -> BitVector n
- (-#) :: forall n. KnownNat n => BitVector n -> BitVector n -> BitVector n
- (*#) :: forall n. KnownNat n => BitVector n -> BitVector n -> BitVector n
- negate# :: forall n. KnownNat n => BitVector n -> BitVector n
- fromInteger# :: KnownNat n => Integer -> BitVector n
- plus# :: BitVector m -> BitVector n -> BitVector (Max m n + 1)
- minus# :: forall m n. (KnownNat m, KnownNat n) => BitVector m -> BitVector n -> BitVector (Max m n + 1)
- times# :: BitVector m -> BitVector n -> BitVector (m + n)
- quot# :: BitVector n -> BitVector n -> BitVector n
- rem# :: BitVector n -> BitVector n -> BitVector n
- toInteger# :: BitVector n -> Integer
- and# :: BitVector n -> BitVector n -> BitVector n
- or# :: BitVector n -> BitVector n -> BitVector n
- xor# :: BitVector n -> BitVector n -> BitVector n
- complement# :: KnownNat n => BitVector n -> BitVector n
- shiftL# :: KnownNat n => BitVector n -> Int -> BitVector n
- shiftR# :: KnownNat n => BitVector n -> Int -> BitVector n
- rotateL# :: KnownNat n => BitVector n -> Int -> BitVector n
- rotateR# :: KnownNat n => BitVector n -> Int -> BitVector n
- popCountBV :: forall n. KnownNat n => BitVector (n + 1) -> Index (n + 2)
- countLeadingZerosBV :: KnownNat n => BitVector n -> Index (n + 1)
- countTrailingZerosBV :: KnownNat n => BitVector n -> Index (n + 1)
- resize# :: forall n m. KnownNat m => BitVector n -> BitVector m
- shrinkSizedUnsigned :: (KnownNat n, Integral (p n)) => p n -> [p n]
Bit
Bit
Bit | The constructor, |
Instances
Bounded Bit Source # | |
Enum Bit Source # | |
Eq Bit Source # | |
Integral Bit Source # | |
Data Bit Source # | |
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Bit -> c Bit # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Bit # dataTypeOf :: Bit -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Bit) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Bit) # gmapT :: (forall b. Data b => b -> b) -> Bit -> Bit # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Bit -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Bit -> r # gmapQ :: (forall d. Data d => d -> u) -> Bit -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Bit -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Bit -> m Bit # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Bit -> m Bit # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Bit -> m Bit # | |
Num Bit Source # | |
Ord Bit Source # | |
Real Bit Source # | |
toRational :: Bit -> Rational # | |
Show Bit Source # | |
Lift Bit Source # | |
Bits Bit Source # | |
FiniteBits Bit Source # | |
Default Bit Source # | |
NFData Bit Source # | |
ShowX Bit Source # | |
BitPack Bit Source # | |
Bundle Bit Source # | |
type BitSize Bit Source # | |
type Unbundled domain Bit Source # | |
Construction
Type classes
Eq
Ord
Num
fromInteger## :: Integer -> Bit Source #
Bits
complement## :: Bit -> Bit Source #
BitPack
BitVector
newtype BitVector (n :: Nat) Source #
A vector of bits.
- Bit indices are descending
Num
instance performs unsigned arithmetic.
BV | The constructor, |
Instances
Accessors
Construction
bLit :: KnownNat n => String -> Q (TExp (BitVector n)) Source #
Create a binary literal
>>>
$$(bLit "1001") :: BitVector 4
1001>>>
$$(bLit "1001") :: BitVector 3
001
NB: You can also just write:
>>>
0b1001 :: BitVector 4
1001
The advantage of bLit
is that you can use computations to create the
string literal:
>>>
import qualified Data.List as List
>>>
$$(bLit (List.replicate 4 '1')) :: BitVector 4
1111
Concatenation
(++#) :: KnownNat m => BitVector n -> BitVector m -> BitVector (n + m) Source #
Concatenate two BitVector
s
Reduction
reduceXor# :: BitVector n -> Bit Source #
Indexing
setSlice# :: BitVector ((m + 1) + i) -> SNat m -> SNat n -> BitVector ((m + 1) - n) -> BitVector ((m + 1) + i) Source #
Type classes
Eq
Ord
Enum (not synthesisable)
Bounded
Num
ExtendingNum
minus# :: forall m n. (KnownNat m, KnownNat n) => BitVector m -> BitVector n -> BitVector (Max m n + 1) Source #
Integral
toInteger# :: BitVector n -> Integer Source #