clash-ghc-1.0.1: CAES Language for Synchronous Hardware
Copyright(C) 2013-2016 University of Twente
2016-2017 Myrtle Software Ltd
2017 QBayLogic Google Inc.
LicenseBSD2 (see the file LICENSE)
MaintainerChristiaan Baaij <christiaan.baaij@gmail.com>
Safe HaskellNone
LanguageHaskell2010

Clash.GHC.Evaluator

Description

 
Synopsis

Documentation

newtype PrimEvalMonad a Source #

Constructors

PEM 

Fields

Instances

Instances details
Monad PrimEvalMonad Source # 
Instance details

Defined in Clash.GHC.Evaluator

Functor PrimEvalMonad Source # 
Instance details

Defined in Clash.GHC.Evaluator

Methods

fmap :: (a -> b) -> PrimEvalMonad a -> PrimEvalMonad b #

(<$) :: a -> PrimEvalMonad b -> PrimEvalMonad a #

Applicative PrimEvalMonad Source # 
Instance details

Defined in Clash.GHC.Evaluator

MonadUnique PrimEvalMonad Source # 
Instance details

Defined in Clash.GHC.Evaluator

reduceConstant :: PrimEvaluator Source #

typedLiterals' :: (Value -> Maybe a) -> [Value] -> [a] Source #

intLiterals' :: [Value] -> [Integer] Source #

intCLiterals' :: [Value] -> [Integer] Source #

mkIntCLiteral Source #

Arguments

:: HasCallStack 
=> Value

Some existing intC literal. To construct a new intC literal, this function needs the dataconstructor.

-> Integer

New value of intC literal

-> Term 

wordLiterals' :: [Value] -> [Integer] Source #

charLiterals :: [Value] -> Maybe (Char, Char) Source #

charLiterals' :: [Value] -> [Char] Source #

sizedLiterals' :: Text -> [Value] -> [Integer] Source #

bitLiterals :: [Value] -> [(Integer, Integer)] Source #

indexLiterals' :: [Value] -> [Integer] Source #

toBV :: (Integer, Integer) -> BitVector n Source #

splitBV :: BitVector n -> (Integer, Integer) Source #

valArgs :: Value -> Maybe [Term] Source #

sizedLitIntLit :: Text -> TyConMap -> [Type] -> [Value] -> Maybe (Type, Integer, Integer, Integer) Source #

signedLitIntLit :: TyConMap -> [Type] -> [Value] -> Maybe (Type, Integer, Integer, Integer) Source #

unsignedLitIntLit :: TyConMap -> [Type] -> [Value] -> Maybe (Type, Integer, Integer, Integer) Source #

bitVectorLitIntLit :: TyConMap -> [Type] -> [Value] -> Maybe (Type, Integer, (Integer, Integer), Integer) Source #

extractKnownNat :: TyConMap -> [Type] -> Maybe (Type, Integer) Source #

extractKnownNatVal :: TyConMap -> [Type] -> Maybe Integer Source #

extractKnownNats :: TyConMap -> [Type] -> [(Type, Integer)] Source #

extractKnownNatVals :: TyConMap -> [Type] -> [Integer] Source #

mkSizedLit Source #

Arguments

:: (Type -> Term)

Type constructor?

-> Type

Result type

-> Type

forall n.

-> Integer

KnownNat n

-> Integer

Value to construct

-> Term 

mkBitLit Source #

Arguments

:: Type

Result type

-> Integer

Mask

-> Integer

Value

-> Term 

mkSignedLit :: Type -> Type -> Integer -> Integer -> Term Source #

mkUnsignedLit :: Type -> Type -> Integer -> Integer -> Term Source #

mkBitVectorLit Source #

Arguments

:: Type

Result type

-> Type

forall n.

-> Integer

KnownNat n

-> Integer

mask

-> Integer

Value to construct

-> Term 

mkIndexLitE Source #

Arguments

:: Type

Result type

-> Type

forall n.

-> Integer

KnownNat n

-> Integer

Value to construct

-> Either Term Term

Either undefined (if given value is out of bounds of given type) or term representing literal

mkIndexLit Source #

Arguments

:: Type

Result type

-> Type

forall n.

-> Integer

KnownNat n

-> Integer

Value to construct

-> Term 

mkSizedLit' Source #

Arguments

:: (Type -> Term)

Type constructor?

-> (Type, Type, Integer)

(result type, forall n., KnownNat n)

-> Integer

Value to construct

-> Term 

Construct a constant term of a sized type

mkSignedLit' Source #

Arguments

:: (Type, Type, Integer)

(result type, forall n., KnownNat n)

-> Integer

Value to construct

-> Term 

mkUnsignedLit' Source #

Arguments

:: (Type, Type, Integer)

(result type, forall n., KnownNat n)

-> Integer

Value to construct

-> Term 

mkBitVectorLit' Source #

Arguments

:: (Type, Type, Integer)

(result type, forall n., KnownNat n)

-> Integer

Mask

-> Integer

Value

-> Term 

mkIndexLit' Source #

Arguments

:: (Type, Type, Integer)

(result type, forall n., KnownNat n)

-> Integer

value

-> Term 

mkVecCons Source #

Arguments

:: DataCon

The Cons (:>) constructor

-> Type

Element type

-> Integer

Length of the vector

-> Term

head of the vector

-> Term

tail of the vector

-> Term 

Create a vector of supplied elements

mkVecNil Source #

Arguments

:: DataCon

The Nil constructor

-> Type

The element type

-> Term 

Create an empty vector

boolToBoolLiteral :: TyConMap -> Type -> Bool -> Term Source #

bConPrim :: Type -> Term Source #

bvConPrim :: Type -> Term Source #

indexConPrim :: Type -> Term Source #

signedConPrim :: Type -> Term Source #

unsignedConPrim :: Type -> Term Source #

liftUnsigned2 :: KnownNat n => (Unsigned n -> Unsigned n -> Unsigned n) -> Type -> TyConMap -> [Type] -> [Value] -> Proxy n -> Maybe Term Source #

Lift a binary function over Unsigned values to be used as literal Evaluator

liftSigned2 :: KnownNat n => (Signed n -> Signed n -> Signed n) -> Type -> TyConMap -> [Type] -> [Value] -> Proxy n -> Maybe Term Source #

liftBitVector2 :: KnownNat n => (BitVector n -> BitVector n -> BitVector n) -> Type -> TyConMap -> [Type] -> [Value] -> Proxy n -> Maybe Term Source #

liftBitVector2Bool :: KnownNat n => (BitVector n -> BitVector n -> Bool) -> Type -> TyConMap -> [Value] -> Proxy n -> Maybe Term Source #

liftSized2 Source #

Arguments

:: (KnownNat n, Integral (sized n)) 
=> ([Value] -> [Integer])

literal argument extraction function

-> (Type -> Type -> Integer -> Integer -> Term)

literal contruction function

-> (sized n -> sized n -> sized n) 
-> Type 
-> TyConMap 
-> [Type] 
-> [Value] 
-> Proxy n -> Maybe Term 

runSizedF Source #

Arguments

:: (KnownNat n, Integral (sized n)) 
=> (sized n -> sized n -> sized n)

function to run

-> Integer

first argument

-> Integer

second argument

-> Proxy n -> Integer 

Helper to run a function over sized types on integers

This only works on function of type (sized n -> sized n -> sized n) The resulting function must be executed with reifyNat

extractTySizeInfo :: TyConMap -> Type -> [Type] -> (Type, Type, Integer) Source #

getResultTy :: TyConMap -> Type -> [Type] -> Type Source #

liftDDI :: (Double# -> Double# -> Int#) -> [Value] -> Maybe Term Source #

liftDDD :: (Double# -> Double# -> Double#) -> [Value] -> Maybe Term Source #

liftDD :: (Double# -> Double#) -> [Value] -> Maybe Term Source #

runDDI :: (Double# -> Double# -> Int#) -> Rational -> Rational -> Term Source #

runDD :: (Double# -> Double#) -> Rational -> Term Source #

liftFFI :: (Float# -> Float# -> Int#) -> [Value] -> Maybe Term Source #

liftFFF :: (Float# -> Float# -> Float#) -> [Value] -> Maybe Term Source #

liftFF :: (Float# -> Float#) -> [Value] -> Maybe Term Source #

runFFI :: (Float# -> Float# -> Int#) -> Rational -> Rational -> Term Source #

runFFF :: (Float# -> Float# -> Float#) -> Rational -> Rational -> Term Source #

runFF :: (Float# -> Float#) -> Rational -> Term Source #

vecHeadPrim Source #

Arguments

:: TyConName

Vec TyCon name

-> Term 

vecLastPrim Source #

Arguments

:: TyConName

Vec TyCon name

-> Term 

vecHeadTy Source #

Arguments

:: TyConName

Vec TyCon name

-> Type 

vecTailPrim Source #

Arguments

:: TyConName

Vec TyCon name

-> Term 

vecInitPrim Source #

Arguments

:: TyConName

Vec TyCon name

-> Term 

vecTailTy Source #

Arguments

:: TyConName

Vec TyCon name

-> Type 

splitAtPrim Source #

Arguments

:: TyConName

SNat TyCon name

-> TyConName

Vec TyCon name

-> Term 

splitAtTy Source #

Arguments

:: TyConName

SNat TyCon name

-> TyConName

Vec TyCon name

-> Type 

foldSplitAtTy Source #

Arguments

:: TyConName

Vec TyCon name

-> Type 

vecAppendPrim Source #

Arguments

:: TyConName

Vec TyCon name

-> Term 

vecAppendTy Source #

Arguments

:: TyConName

Vec TyCon name

-> Type 

vecZipWithPrim Source #

Arguments

:: TyConName

Vec TyCon name

-> Term 

vecZipWithTy Source #

Arguments

:: TyConName

Vec TyCon name

-> Type 

vecImapGoTy Source #

Arguments

:: TyConName

Vec TyCon name

-> TyConName

Index TyCon name

-> Type 

indexAddTy Source #

Arguments

:: TyConName

Index TyCon name

-> Type 

bvAppendPrim Source #

Arguments

:: TyConName

BitVector TyCon Name

-> Term 

bvAppendTy Source #

Arguments

:: TyConName

BitVector TyCon Name

-> Type 

bvSplitPrim Source #

Arguments

:: TyConName

BitVector TyCon Name

-> Term 

bvSplitTy Source #

Arguments

:: TyConName

BitVector TyCon Name

-> Type 

typeNatAdd :: TyConName Source #

typeNatMul :: TyConName Source #

typeNatSub :: TyConName Source #