| Copyright | © Edward Kmett 2010-2015 © Eric Mertens 2014 Johan Kiviniemi 2013 |
|---|---|
| License | BSD3 |
| Maintainer | Edward Kmett <ekmett@gmail.com> |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | Safe |
| Language | Haskell2010 |
Ersatz.Bits
Description
Bits is an arbitrary length natural number type
Synopsis
- newtype Bit1 = Bit1 Bit
- data Bit2 = Bit2 !Bit !Bit
- data Bit3 = Bit3 !Bit !Bit !Bit
- data Bit4 = Bit4 !Bit !Bit !Bit !Bit
- data Bit5 = Bit5 !Bit !Bit !Bit !Bit !Bit
- data Bit6 = Bit6 !Bit !Bit !Bit !Bit !Bit !Bit
- data Bit7 = Bit7 !Bit !Bit !Bit !Bit !Bit !Bit !Bit
- data Bit8 = Bit8 !Bit !Bit !Bit !Bit !Bit !Bit !Bit !Bit
- newtype Bits = Bits [Bit]
- class HasBits a where
- isEven :: HasBits b => b -> Bit
- isOdd :: HasBits b => b -> Bit
- sumBit :: Foldable t => t Bit -> Bits
- sumBits :: (Foldable t, HasBits a) => t a -> Bits
- fullAdder :: Bit -> Bit -> Bit -> (Bit, Bit)
- halfAdder :: Bit -> Bit -> (Bit, Bit)
Fixed length bit vectors
Instances
| Num Bit1 # | |
| Show Bit1 # | |
| Generic Bit1 # | |
| Codec Bit1 # | |
| Variable Bit1 # | |
Defined in Ersatz.Bits | |
| Boolean Bit1 # | |
Defined in Ersatz.Bits Methods (&&) :: Bit1 -> Bit1 -> Bit1 # (||) :: Bit1 -> Bit1 -> Bit1 # (==>) :: Bit1 -> Bit1 -> Bit1 # and :: Foldable t => t Bit1 -> Bit1 # or :: Foldable t => t Bit1 -> Bit1 # nand :: Foldable t => t Bit1 -> Bit1 # nor :: Foldable t => t Bit1 -> Bit1 # all :: Foldable t => (a -> Bit1) -> t a -> Bit1 # | |
| Equatable Bit1 # | |
| Orderable Bit1 # | |
| HasBits Bit1 # | |
Defined in Ersatz.Bits | |
| type Rep Bit1 # | |
Defined in Ersatz.Bits | |
| type Decoded Bit1 # | |
Defined in Ersatz.Bits | |
Instances
| Num Bit2 # | |
| Show Bit2 # | |
| Generic Bit2 # | |
| Codec Bit2 # | |
| Variable Bit2 # | |
Defined in Ersatz.Bits | |
| Boolean Bit2 # | |
Defined in Ersatz.Bits Methods (&&) :: Bit2 -> Bit2 -> Bit2 # (||) :: Bit2 -> Bit2 -> Bit2 # (==>) :: Bit2 -> Bit2 -> Bit2 # and :: Foldable t => t Bit2 -> Bit2 # or :: Foldable t => t Bit2 -> Bit2 # nand :: Foldable t => t Bit2 -> Bit2 # nor :: Foldable t => t Bit2 -> Bit2 # all :: Foldable t => (a -> Bit2) -> t a -> Bit2 # | |
| Equatable Bit2 # | |
| Orderable Bit2 # | |
| HasBits Bit2 # | |
Defined in Ersatz.Bits | |
| type Rep Bit2 # | |
Defined in Ersatz.Bits type Rep Bit2 = D1 (MetaData "Bit2" "Ersatz.Bits" "ersatz-0.4.4-JY309SKjHonJMKsg94Ylmv" False) (C1 (MetaCons "Bit2" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Bit) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Bit))) | |
| type Decoded Bit2 # | |
Defined in Ersatz.Bits | |
Instances
Instances
Instances
Instances
Instances
Instances
Variable length bit vectors
HasBits provides the bits method for embedding
fixed with numeric encoding types into the arbitrary width
Bits type.
Instances
| HasBits Bit # | |
Defined in Ersatz.Bits | |
| HasBits Bits # | |
Defined in Ersatz.Bits | |
| HasBits Bit8 # | |
Defined in Ersatz.Bits | |
| HasBits Bit7 # | |
Defined in Ersatz.Bits | |
| HasBits Bit6 # | |
Defined in Ersatz.Bits | |
| HasBits Bit5 # | |
Defined in Ersatz.Bits | |
| HasBits Bit4 # | |
Defined in Ersatz.Bits | |
| HasBits Bit3 # | |
Defined in Ersatz.Bits | |
| HasBits Bit2 # | |
Defined in Ersatz.Bits | |
| HasBits Bit1 # | |
Defined in Ersatz.Bits | |
Adders
Compute the sum and carry bit from adding three bits.