forsyde-shallow-3.4.0.0: ForSyDe's Haskell-embedded Domain Specific Language.

Copyright(c) ForSyDe Group KTH 2007-2008
LicenseBSD-style (see the file LICENSE)
Maintainerforsyde-dev@ict.kth.se
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell98

ForSyDe.Shallow.Utility.BitVector

Contents

Description

It defines the bit vector operations from/to integer.

Synopsis

Polynomial data type

data Parity Source #

Constructors

Even 
Odd 
Instances
Eq Parity Source # 
Instance details

Defined in ForSyDe.Shallow.Utility.BitVector

Methods

(==) :: Parity -> Parity -> Bool #

(/=) :: Parity -> Parity -> Bool #

Show Parity Source # 
Instance details

Defined in ForSyDe.Shallow.Utility.BitVector

Bit-vector and integer transformations

intToBitVector Source #

Arguments

:: Int

Num of the bits

-> Integer

The input integer

-> BitVector

The output bit-vector

To transform the input integer to a bit-vector with specified number of bits.

bitVectorToInt :: BitVector -> Integer Source #

To transform the input bit-vecotr to an integer.

Add even/odd parity bit

addEvenParityBit :: (Num a, Eq a) => Vector a -> Vector a Source #

To add even parity bit on the bit-vector in the tail.

addOddParityBit :: (Num a, Eq a) => Vector a -> Vector a Source #

To add odd parity bit on the bit-vector in the tail.

addParityBit :: (Num a, Eq a) => Parity -> Vector a -> Vector a Source #

Remove parity bit

removeParityBit :: (Num t, Eq t) => Vector t -> Vector t Source #

To remove the parity bit in the tail.

Check the even/odd parity of the bit-vector

isEvenParity :: (Num t, Eq t) => Vector t -> Bool Source #

To check the even parity of the bit-vector.

isOddParity :: (Num t, Eq t) => Vector t -> Bool Source #

To check the odd parity of the bit-vector.

Judge the form sanity of the bit-vector

isBitVector Source #

Arguments

:: (Num t, Eq t) 
=> Vector t

Input bit-vector

-> Bool

Output boolean value

To judge whether the input bit-vector is in a proper form.