Safe Haskell | None |
---|---|
Language | Haskell2010 |
Utilities for converting Core Type/Term to Netlist datatypes
- splitNormalized :: (Fresh m, Functor m) => HashMap TyConName TyCon -> Term -> m (Either String ([Id], [LetBinding], Id))
- unsafeCoreTypeToHWType :: String -> (HashMap TyConName TyCon -> Type -> Maybe (Either String HWType)) -> HashMap TyConName TyCon -> Type -> HWType
- unsafeCoreTypeToHWTypeM :: String -> Type -> NetlistMonad HWType
- coreTypeToHWTypeM :: Type -> NetlistMonad (Maybe HWType)
- synchronizedClk :: HashMap TyConName TyCon -> Type -> Maybe (Identifier, Int)
- coreTypeToHWType :: (HashMap TyConName TyCon -> Type -> Maybe (Either String HWType)) -> HashMap TyConName TyCon -> Type -> Either String HWType
- mkADT :: (HashMap TyConName TyCon -> Type -> Maybe (Either String HWType)) -> HashMap TyConName TyCon -> String -> TyConName -> [Type] -> Either String HWType
- isRecursiveTy :: HashMap TyConName TyCon -> TyConName -> Bool
- representableType :: (HashMap TyConName TyCon -> Type -> Maybe (Either String HWType)) -> HashMap TyConName TyCon -> Type -> Bool
- typeSize :: HWType -> Int
- conSize :: HWType -> Int
- typeLength :: HWType -> Int
- termHWType :: String -> Term -> NetlistMonad HWType
- termHWTypeM :: Term -> NetlistMonad (Maybe HWType)
- varToExpr :: Term -> Expr
- mkUniqueNormalized :: ([Id], [LetBinding], Id) -> NetlistMonad ([Id], [LetBinding], TmName)
- appendToName :: TmName -> String -> TmName
- preserveVarEnv :: NetlistMonad a -> NetlistMonad a
- dcToLiteral :: HWType -> Int -> Expr
Documentation
splitNormalized :: (Fresh m, Functor m) => HashMap TyConName TyCon -> 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 :: String -> (HashMap TyConName TyCon -> Type -> Maybe (Either String HWType)) -> HashMap TyConName TyCon -> Type -> HWType Source
Converts a Core type to a HWType given a function that translates certain builtin types. Errors if the Core type is not translatable.
unsafeCoreTypeToHWTypeM :: String -> Type -> NetlistMonad HWType Source
Converts a Core type to a HWType within the NetlistMonad; errors on failure
coreTypeToHWTypeM :: Type -> NetlistMonad (Maybe HWType) Source
Converts a Core type to a HWType within the NetlistMonad; Nothing
on failure
Returns the name and period of the clock corresponding to a type
coreTypeToHWType :: (HashMap TyConName TyCon -> Type -> Maybe (Either String HWType)) -> HashMap TyConName TyCon -> Type -> Either String HWType Source
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.
:: (HashMap TyConName TyCon -> Type -> Maybe (Either String HWType)) | Hardcoded Type -> HWType translator |
-> HashMap TyConName TyCon | TyCon cache |
-> String | String representation of the Core type for error messages |
-> TyConName | 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 :: HashMap TyConName TyCon -> TyConName -> Bool Source
Simple check if a TyCon is recursively defined.
representableType :: (HashMap TyConName TyCon -> Type -> Maybe (Either String HWType)) -> HashMap TyConName TyCon -> Type -> Bool Source
Determines if a Core type is translatable to a HWType given a function that translates certain builtin types.
typeLength :: HWType -> Int Source
Gives the length of length-indexed types
termHWType :: String -> Term -> NetlistMonad HWType Source
Gives the HWType corresponding to a term. Returns an error if the term has a Core type that is not translatable to a HWType.
termHWTypeM :: Term -> NetlistMonad (Maybe HWType) Source
Gives the HWType corresponding to a term. Returns Nothing
if the term has
a Core type that is not translatable to a HWType.
varToExpr :: Term -> Expr Source
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 -> TmName Source
Append a string to a name
preserveVarEnv :: NetlistMonad a -> NetlistMonad a Source
dcToLiteral :: HWType -> Int -> Expr Source