Safe Haskell | None |
---|
Utilities for converting Core Type/Term to Netlist datatypes
- splitNormalized :: (Fresh m, Functor m) => Term -> m (Either String ([Id], [LetBinding], Id))
- unsafeCoreTypeToHWType :: (Type -> Maybe (Either String HWType)) -> Type -> HWType
- unsafeCoreTypeToHWTypeM :: Type -> NetlistMonad HWType
- synchronizedClk :: Type -> Maybe Identifier
- coreTypeToHWType :: (Type -> Maybe (Either String HWType)) -> Type -> Either String HWType
- mkADT :: (Type -> Maybe (Either String HWType)) -> String -> TyCon -> [Type] -> Either String HWType
- isRecursiveTy :: TyCon -> Bool
- representableType :: (Type -> Maybe (Either String HWType)) -> Type -> Bool
- typeSize :: HWType -> Int
- conSize :: HWType -> Int
- typeLength :: HWType -> Int
- termHWType :: Term -> NetlistMonad HWType
- varToExpr :: Term -> Expr
- mkUniqueNormalized :: ([Id], [LetBinding], Id) -> NetlistMonad ([Id], [LetBinding], TmName)
- appendToName :: TmName -> String -> TmName
- preserveVarEnv :: NetlistMonad a -> NetlistMonad a
Documentation
splitNormalized :: (Fresh m, Functor m) => Term -> m (Either String ([Id], [LetBinding], Id))Source
Split a normalized term into: a list of arguments, a list of let-bindings, and a variable reference that is the body of the let-binding. Returns a String containing the error is the term was not in a normalized form.
unsafeCoreTypeToHWType :: (Type -> Maybe (Either String HWType)) -> Type -> HWTypeSource
Converts a Core type to a HWType given a function that translates certain builtin types. Errors if the Core type is not translatable.
unsafeCoreTypeToHWTypeM :: Type -> NetlistMonad HWTypeSource
Converts a Core type to a HWType within the NetlistMonad
synchronizedClk :: Type -> Maybe IdentifierSource
Returns the name of the clock corresponding to a type
coreTypeToHWType :: (Type -> Maybe (Either String HWType)) -> Type -> Either String HWTypeSource
Converts a Core type to a HWType given a function that translates certain builtin types. Returns a string containing the error message when the Core type is not translatable.
:: (Type -> Maybe (Either String HWType)) | Hardcoded Type -> HWType translator |
-> String | String representation of the Core type for error messages |
-> TyCon | The TyCon |
-> [Type] | Its applied arguments |
-> Either String HWType |
Converts an algebraic Core type (split into a TyCon and its argument) to a HWType.
isRecursiveTy :: TyCon -> BoolSource
Simple check if a TyCon is recursively defined.
representableType :: (Type -> Maybe (Either String HWType)) -> Type -> BoolSource
Determines if a Core type is translatable to a HWType given a function that translates certain builtin types.
typeLength :: HWType -> IntSource
Gives the length of length-indexed types
termHWType :: Term -> NetlistMonad HWTypeSource
Gives the HWType corresponding to a term. Returns an error if the term has a Core type that is not translatable to a HWType.
varToExpr :: Term -> ExprSource
Turns a Core variable reference to a Netlist expression. Errors if the term is not a variable.
mkUniqueNormalized :: ([Id], [LetBinding], Id) -> NetlistMonad ([Id], [LetBinding], TmName)Source
Uniquely rename all the variables and their references in a normalized term
appendToName :: TmName -> String -> TmNameSource
Append a string to a name
preserveVarEnv :: NetlistMonad a -> NetlistMonad aSource