feldspar-language-0.7: A functional embedded language for DSP and parallelism

Safe HaskellNone
LanguageHaskell2010

Feldspar.BitVector

Contents

Description

A Vector interface to packed sequences of bits

Synopsis

Types and classes

class (Type w, Numeric w, Bits w, Integral w) => Unit w where Source

A Unit is the internal representation of a BitVector

Methods

width :: Proxy w -> Length Source

data BitVector w Source

Constructors

BitVector 

Fields

segments :: [Segment w]
 

Instances

Unit a => Syntactic (BitVector a) 
(Unit w, (~) * (Size w) (Range w)) => Indexed (BitVector w) 
type Internal (BitVector a) = [a] 
type Domain (BitVector a) = FeldDomain 
type CollSize (BitVector w) = Data Length 
type CollIndex (BitVector w) = Data Index 
type Elem (BitVector w) = Data Bool 

data Segment w Source

Constructors

Segment 

Fields

numUnits :: Data Length
 
elements :: Data Index -> Data w
 

Feldspar integration of BitVector

Operations

length :: forall w. Unit w => BitVector w -> Data Length Source

freezeBitVector :: forall w. Unit w => BitVector w -> Data [w] Source

unfreezeBitVector :: forall w. Unit w => Data [w] -> BitVector w Source

fromVector :: forall w. (Unit w, Size w ~ Range w) => Vector (Data Bool) -> BitVector w Source

Transforms a bool vector to a bitvector. Length of the vector has to be divisible by the wordlength, otherwise booleans at the end will be dropped.

toVector :: forall w. (Unit w, Size w ~ Range w) => BitVector w -> Vector (Data Bool) Source

fromBits :: forall w. Unit w => [Bool] -> BitVector w Source

fromUnits :: Unit w => [w] -> BitVector w Source

map :: (Unit w, Size w ~ Range w) => (Data Bool -> Data Bool) -> BitVector w -> BitVector w Source

takeUnits :: forall w. Unit w => Data Length -> BitVector w -> BitVector w Source

dropUnits :: forall w. Unit w => Data Length -> BitVector w -> BitVector w Source

(++) :: forall w. Unit w => BitVector w -> BitVector w -> BitVector w Source

drop :: forall w. (Unit w, Size w ~ Range w) => Data Length -> Data w -> BitVector w -> BitVector w Source

fold :: forall w a. (Syntax a, Unit w, Size w ~ Range w) => (a -> Data Bool -> a) -> a -> BitVector w -> a Source

zipWith :: forall w. (Unit w, Size w ~ Range w) => (Data Bool -> Data Bool -> Data Bool) -> BitVector w -> BitVector w -> BitVector w Source

head :: (Unit w, Size w ~ Range w) => BitVector w -> Data Bool Source

tail :: forall w. (Unit w, Size w ~ Range w) => Data Bool -> BitVector w -> BitVector w Source

Boolean functions extended to words

boolFun1 :: (Syntax t, Unit w, Size w ~ Range w) => (Data Bool -> Data Bool) -> ((Data w -> Data w) -> t) -> t Source

boolFun2 :: (Syntax t, Unit w, Size w ~ Range w) => (Data Bool -> Data Bool -> Data Bool) -> ((Data w -> Data w -> Data w) -> t) -> t Source

Patch combinators for bitvectors