Copyright | (C) 2013-2016 University of Twente 2016-2017 Myrtle Software Ltd 2017 QBayLogic Google Inc. |
---|---|
License | BSD2 (see the file LICENSE) |
Maintainer | Christiaan Baaij <christiaan.baaij@gmail.com> |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- newtype PrimEvalMonad a = PEM {}
- reduceConstant :: PrimEvaluator
- typedLiterals' :: (Value -> Maybe a) -> [Value] -> [a]
- doubleLiterals' :: [Value] -> [Rational]
- floatLiterals' :: [Value] -> [Rational]
- integerLiterals :: [Value] -> Maybe (Integer, Integer)
- naturalLiterals :: [Value] -> Maybe (Integer, Integer)
- integerLiterals' :: [Value] -> [Integer]
- naturalLiterals' :: [Value] -> [Integer]
- intLiterals :: [Value] -> Maybe (Integer, Integer)
- intLiterals' :: [Value] -> [Integer]
- intCLiteral :: Value -> Maybe Integer
- intCLiterals :: [Value] -> Maybe (Integer, Integer)
- intCLiterals' :: [Value] -> [Integer]
- mkIntCLiteral :: HasCallStack => Value -> Integer -> Term
- wordLiterals :: [Value] -> Maybe (Integer, Integer)
- wordLiterals' :: [Value] -> [Integer]
- charLiterals :: [Value] -> Maybe (Char, Char)
- charLiterals' :: [Value] -> [Char]
- sizedLiterals :: Text -> [Value] -> Maybe (Integer, Integer)
- sizedLiterals' :: Text -> [Value] -> [Integer]
- sizedLiteral :: Text -> Value -> Maybe Integer
- bitLiterals :: [Value] -> [(Integer, Integer)]
- indexLiterals :: [Value] -> Maybe (Integer, Integer)
- signedLiterals :: [Value] -> Maybe (Integer, Integer)
- unsignedLiterals :: [Value] -> Maybe (Integer, Integer)
- bitVectorLiterals :: [Value] -> Maybe ((Integer, Integer), (Integer, Integer))
- indexLiterals' :: [Value] -> [Integer]
- signedLiterals' :: [Value] -> [Integer]
- unsignedLiterals' :: [Value] -> [Integer]
- bitVectorLiterals' :: [Value] -> [(Integer, Integer)]
- toBV :: (Integer, Integer) -> BitVector n
- splitBV :: BitVector n -> (Integer, Integer)
- valArgs :: Value -> Maybe [Term]
- sizedLitIntLit :: Text -> TyConMap -> [Type] -> [Value] -> Maybe (Type, Integer, Integer, Integer)
- signedLitIntLit :: TyConMap -> [Type] -> [Value] -> Maybe (Type, Integer, Integer, Integer)
- unsignedLitIntLit :: TyConMap -> [Type] -> [Value] -> Maybe (Type, Integer, Integer, Integer)
- bitVectorLitIntLit :: TyConMap -> [Type] -> [Value] -> Maybe (Type, Integer, (Integer, Integer), Integer)
- extractKnownNat :: TyConMap -> [Type] -> Maybe (Type, Integer)
- extractKnownNatVal :: TyConMap -> [Type] -> Maybe Integer
- extractKnownNats :: TyConMap -> [Type] -> [(Type, Integer)]
- extractKnownNatVals :: TyConMap -> [Type] -> [Integer]
- mkSizedLit :: (Type -> Term) -> Type -> Type -> Integer -> Integer -> Term
- mkBitLit :: Type -> Integer -> Integer -> Term
- mkSignedLit :: Type -> Type -> Integer -> Integer -> Term
- mkUnsignedLit :: Type -> Type -> Integer -> Integer -> Term
- mkBitVectorLit :: Type -> Type -> Integer -> Integer -> Integer -> Term
- mkIndexLitE :: Type -> Type -> Integer -> Integer -> Either Term Term
- mkIndexLit :: Type -> Type -> Integer -> Integer -> Term
- mkSizedLit' :: (Type -> Term) -> (Type, Type, Integer) -> Integer -> Term
- mkSignedLit' :: (Type, Type, Integer) -> Integer -> Term
- mkUnsignedLit' :: (Type, Type, Integer) -> Integer -> Term
- mkBitVectorLit' :: (Type, Type, Integer) -> Integer -> Integer -> Term
- mkIndexLit' :: (Type, Type, Integer) -> Integer -> Term
- mkVecCons :: DataCon -> Type -> Integer -> Term -> Term -> Term
- mkVecNil :: DataCon -> Type -> Term
- boolToIntLiteral :: Bool -> Term
- boolToBoolLiteral :: TyConMap -> Type -> Bool -> Term
- charToCharLiteral :: Char -> Term
- integerToIntLiteral :: Integer -> Term
- integerToWordLiteral :: Integer -> Term
- integerToIntegerLiteral :: Integer -> Term
- naturalToNaturalLiteral :: Natural -> Term
- bConPrim :: Type -> Term
- bvConPrim :: Type -> Term
- indexConPrim :: Type -> Term
- signedConPrim :: Type -> Term
- unsignedConPrim :: Type -> Term
- liftUnsigned2 :: KnownNat n => (Unsigned n -> Unsigned n -> Unsigned n) -> Type -> TyConMap -> [Type] -> [Value] -> Proxy n -> Maybe Term
- liftSigned2 :: KnownNat n => (Signed n -> Signed n -> Signed n) -> Type -> TyConMap -> [Type] -> [Value] -> Proxy n -> Maybe Term
- liftBitVector2 :: KnownNat n => (BitVector n -> BitVector n -> BitVector n) -> Type -> TyConMap -> [Type] -> [Value] -> Proxy n -> Maybe Term
- liftBitVector2Bool :: KnownNat n => (BitVector n -> BitVector n -> Bool) -> Type -> TyConMap -> [Value] -> Proxy n -> Maybe Term
- liftSized2 :: (KnownNat n, Integral (sized n)) => ([Value] -> [Integer]) -> (Type -> Type -> Integer -> Integer -> Term) -> (sized n -> sized n -> sized n) -> Type -> TyConMap -> [Type] -> [Value] -> Proxy n -> Maybe Term
- runSizedF :: (KnownNat n, Integral (sized n)) => (sized n -> sized n -> sized n) -> Integer -> Integer -> Proxy n -> Integer
- extractTySizeInfo :: TyConMap -> Type -> [Type] -> (Type, Type, Integer)
- getResultTy :: TyConMap -> Type -> [Type] -> Type
- liftDDI :: (Double# -> Double# -> Int#) -> [Value] -> Maybe Term
- liftDDD :: (Double# -> Double# -> Double#) -> [Value] -> Maybe Term
- liftDD :: (Double# -> Double#) -> [Value] -> Maybe Term
- runDDI :: (Double# -> Double# -> Int#) -> Rational -> Rational -> Term
- runDDD :: (Double# -> Double# -> Double#) -> Rational -> Rational -> Term
- runDD :: (Double# -> Double#) -> Rational -> Term
- liftFFI :: (Float# -> Float# -> Int#) -> [Value] -> Maybe Term
- liftFFF :: (Float# -> Float# -> Float#) -> [Value] -> Maybe Term
- liftFF :: (Float# -> Float#) -> [Value] -> Maybe Term
- runFFI :: (Float# -> Float# -> Int#) -> Rational -> Rational -> Term
- runFFF :: (Float# -> Float# -> Float#) -> Rational -> Rational -> Term
- runFF :: (Float# -> Float#) -> Rational -> Term
- vecHeadPrim :: TyConName -> Term
- vecLastPrim :: TyConName -> Term
- vecHeadTy :: TyConName -> Type
- vecTailPrim :: TyConName -> Term
- vecInitPrim :: TyConName -> Term
- vecTailTy :: TyConName -> Type
- splitAtPrim :: TyConName -> TyConName -> Term
- splitAtTy :: TyConName -> TyConName -> Type
- foldSplitAtTy :: TyConName -> Type
- vecAppendPrim :: TyConName -> Term
- vecAppendTy :: TyConName -> Type
- vecZipWithPrim :: TyConName -> Term
- vecZipWithTy :: TyConName -> Type
- vecImapGoTy :: TyConName -> TyConName -> Type
- indexAddTy :: TyConName -> Type
- bvAppendPrim :: TyConName -> Term
- bvAppendTy :: TyConName -> Type
- bvSplitPrim :: TyConName -> Term
- bvSplitTy :: TyConName -> Type
- typeNatAdd :: TyConName
- typeNatMul :: TyConName
- typeNatSub :: TyConName
- ghcTyconToTyConName :: TyCon -> TyConName
- svoid :: (State# RealWorld -> State# RealWorld) -> IO ()
Documentation
newtype PrimEvalMonad a Source #
Instances
Monad PrimEvalMonad Source # | |
Defined in Clash.GHC.Evaluator (>>=) :: PrimEvalMonad a -> (a -> PrimEvalMonad b) -> PrimEvalMonad b # (>>) :: PrimEvalMonad a -> PrimEvalMonad b -> PrimEvalMonad b # return :: a -> PrimEvalMonad a # | |
Functor PrimEvalMonad Source # | |
Defined in Clash.GHC.Evaluator fmap :: (a -> b) -> PrimEvalMonad a -> PrimEvalMonad b # (<$) :: a -> PrimEvalMonad b -> PrimEvalMonad a # | |
Applicative PrimEvalMonad Source # | |
Defined in Clash.GHC.Evaluator pure :: a -> PrimEvalMonad a # (<*>) :: PrimEvalMonad (a -> b) -> PrimEvalMonad a -> PrimEvalMonad b # liftA2 :: (a -> b -> c) -> PrimEvalMonad a -> PrimEvalMonad b -> PrimEvalMonad c # (*>) :: PrimEvalMonad a -> PrimEvalMonad b -> PrimEvalMonad b # (<*) :: PrimEvalMonad a -> PrimEvalMonad b -> PrimEvalMonad a # | |
MonadUnique PrimEvalMonad Source # | |
Defined in Clash.GHC.Evaluator |
reduceConstant :: PrimEvaluator Source #
typedLiterals' :: (Value -> Maybe a) -> [Value] -> [a] Source #
doubleLiterals' :: [Value] -> [Rational] Source #
floatLiterals' :: [Value] -> [Rational] Source #
integerLiterals' :: [Value] -> [Integer] Source #
naturalLiterals' :: [Value] -> [Integer] Source #
intLiterals' :: [Value] -> [Integer] Source #
intCLiteral :: Value -> Maybe Integer Source #
intCLiterals' :: [Value] -> [Integer] Source #
:: 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] -> [Char] Source #
sizedLiterals' :: Text -> [Value] -> [Integer] Source #
bitLiterals :: [Value] -> [(Integer, Integer)] Source #
indexLiterals' :: [Value] -> [Integer] Source #
signedLiterals' :: [Value] -> [Integer] Source #
unsignedLiterals' :: [Value] -> [Integer] Source #
bitVectorLiterals' :: [Value] -> [(Integer, Integer)] 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 #
mkSignedLit :: Type -> Type -> Integer -> Integer -> Term Source #
mkUnsignedLit :: Type -> Type -> Integer -> Integer -> Term Source #
:: (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
:: 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
boolToIntLiteral :: Bool -> Term Source #
boolToBoolLiteral :: TyConMap -> Type -> Bool -> Term Source #
charToCharLiteral :: Char -> Term Source #
integerToIntLiteral :: Integer -> Term Source #
integerToWordLiteral :: Integer -> Term Source #
integerToIntegerLiteral :: Integer -> Term Source #
naturalToNaturalLiteral :: Natural -> 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 #
:: (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 #
:: TyConName | Vec TyCon name |
-> Term |
:: TyConName | Vec TyCon name |
-> Term |
:: TyConName | Vec TyCon name |
-> Term |
:: TyConName | Vec TyCon name |
-> Term |
:: TyConName | SNat TyCon name |
-> TyConName | Vec TyCon name |
-> Term |
:: TyConName | Vec TyCon name |
-> Type |
:: TyConName | Vec TyCon name |
-> Term |
:: TyConName | Vec TyCon name |
-> Type |
:: TyConName | Vec TyCon name |
-> Term |
:: TyConName | Vec TyCon name |
-> Type |
:: TyConName | Vec TyCon name |
-> TyConName | Index TyCon name |
-> Type |
:: TyConName | Index TyCon name |
-> Type |
:: TyConName | BitVector TyCon Name |
-> Term |
:: TyConName | BitVector TyCon Name |
-> Type |
:: TyConName | BitVector TyCon Name |
-> Term |
typeNatAdd :: TyConName Source #
typeNatMul :: TyConName Source #
typeNatSub :: TyConName Source #
ghcTyconToTyConName :: TyCon -> TyConName Source #