Copyright | (C) 2012-2016 University of Twente 2016-2017 Myrtle Software Ltd 2017-2018 Google Inc. |
---|---|
License | BSD2 (see the file LICENSE) |
Maintainer | Christiaan Baaij <christiaan.baaij@gmail.com> |
Safe Haskell | None |
Language | Haskell2010 |
Create Netlists out of normalized CoreHW Terms
Synopsis
- genNetlist :: Bool -> ClashOpts -> CustomReprs -> BindingMap -> [(Id, Maybe TopEntity, Maybe Id)] -> CompiledPrimMap -> TyConMap -> (CustomReprs -> TyConMap -> Type -> State HWMap (Maybe (Either String FilteredHWType))) -> Int -> (IdType -> Identifier -> Identifier) -> (IdType -> Identifier -> Identifier -> Identifier) -> Bool -> HashMap Identifier Word -> FilePath -> (Maybe Identifier, Maybe Identifier) -> Id -> IO ([([Bool], SrcSpan, HashMap Identifier Word, Component)], HashMap Identifier Word)
- runNetlistMonad :: Bool -> ClashOpts -> CustomReprs -> BindingMap -> VarEnv (Type, Maybe TopEntity) -> CompiledPrimMap -> TyConMap -> (CustomReprs -> TyConMap -> Type -> State HWMap (Maybe (Either String FilteredHWType))) -> Int -> (IdType -> Identifier -> Identifier) -> (IdType -> Identifier -> Identifier -> Identifier) -> Bool -> HashMap Identifier Word -> FilePath -> (Maybe Identifier, Maybe Identifier) -> NetlistMonad a -> IO (a, NetlistState)
- genNames :: Bool -> (IdType -> Identifier -> Identifier) -> (Maybe Identifier, Maybe Identifier) -> HashMap Identifier Word -> VarEnv Identifier -> BindingMap -> (HashMap Identifier Word, VarEnv Identifier)
- genComponent :: HasCallStack => Id -> NetlistMonad ([Bool], SrcSpan, HashMap Identifier Word, Component)
- genComponentT :: HasCallStack => Id -> Term -> NetlistMonad ([Bool], SrcSpan, HashMap Identifier Word, Component)
- mkNetDecl :: (Id, Term) -> NetlistMonad (Maybe Declaration)
- isWriteToBiSignalPrimitive :: Term -> Bool
- mkDeclarations :: HasCallStack => Id -> Term -> NetlistMonad [Declaration]
- mkDeclarations' :: HasCallStack => Id -> Term -> NetlistMonad [Declaration]
- mkSelection :: Either Identifier Id -> Term -> Type -> [Alt] -> [Declaration] -> NetlistMonad [Declaration]
- reorderDefault :: [(Pat, Term)] -> [(Pat, Term)]
- reorderCustom :: TyConMap -> CustomReprs -> Type -> [(Pat, Term)] -> [(Pat, Term)]
- patPos :: CustomReprs -> Pat -> Int
- mkFunApp :: HasCallStack => Identifier -> Id -> [Term] -> [Declaration] -> NetlistMonad [Declaration]
- toSimpleVar :: Identifier -> (Expr, Type) -> NetlistMonad (Expr, [Declaration])
- mkExpr :: HasCallStack => Bool -> Either Identifier Id -> Type -> Term -> NetlistMonad (Expr, [Declaration])
- mkProjection :: Bool -> Either Identifier Id -> Term -> Type -> Alt -> NetlistMonad (Expr, [Declaration])
- mkDcApplication :: HasCallStack => HWType -> Either Identifier Id -> DataCon -> [Term] -> NetlistMonad (Expr, [Declaration])
Documentation
:: Bool | Whether this we're compiling a testbench (suppresses certain warnings) |
-> ClashOpts | Options Clash was called with |
-> CustomReprs | Custom bit representations for certain types |
-> BindingMap | Global binders |
-> [(Id, Maybe TopEntity, Maybe Id)] | All the TopEntities |
-> CompiledPrimMap | Primitive definitions |
-> TyConMap | TyCon cache |
-> (CustomReprs -> TyConMap -> Type -> State HWMap (Maybe (Either String FilteredHWType))) | Hardcoded Type -> HWType translator |
-> Int | IntWordInteger bit-width |
-> (IdType -> Identifier -> Identifier) | valid identifiers |
-> (IdType -> Identifier -> Identifier -> Identifier) | extend valid identifiers |
-> Bool | Whether the backend supports ifThenElse expressions |
-> HashMap Identifier Word | Seen components |
-> FilePath | HDL dir |
-> (Maybe Identifier, Maybe Identifier) | Component name prefix |
-> Id | Name of the |
-> IO ([([Bool], SrcSpan, HashMap Identifier Word, Component)], HashMap Identifier Word) |
Generate a hierarchical netlist out of a set of global binders with
topEntity
at the top.
:: Bool | Whether this we're compiling a testbench (suppresses certain warnings) |
-> ClashOpts | Options Clash was called with |
-> CustomReprs | Custom bit representations for certain types |
-> BindingMap | Global binders |
-> VarEnv (Type, Maybe TopEntity) | TopEntity annotations |
-> CompiledPrimMap | Primitive Definitions |
-> TyConMap | TyCon cache |
-> (CustomReprs -> TyConMap -> Type -> State HWMap (Maybe (Either String FilteredHWType))) | Hardcode Type -> HWType translator |
-> Int | IntWordInteger bit-width |
-> (IdType -> Identifier -> Identifier) | valid identifiers |
-> (IdType -> Identifier -> Identifier -> Identifier) | extend valid identifiers |
-> Bool | Whether the backend supports ifThenElse expressions |
-> HashMap Identifier Word | Seen components |
-> FilePath | HDL dir |
-> (Maybe Identifier, Maybe Identifier) | Component name prefix |
-> NetlistMonad a | Action to run |
-> IO (a, NetlistState) |
Run a NetlistMonad action in a given environment
genNames :: Bool -> (IdType -> Identifier -> Identifier) -> (Maybe Identifier, Maybe Identifier) -> HashMap Identifier Word -> VarEnv Identifier -> BindingMap -> (HashMap Identifier Word, VarEnv Identifier) Source #
:: HasCallStack | |
=> Id | Name of the function |
-> NetlistMonad ([Bool], SrcSpan, HashMap Identifier Word, Component) |
Generate a component for a given function (caching)
:: HasCallStack | |
=> Id | Name of the function |
-> Term | Corresponding term |
-> NetlistMonad ([Bool], SrcSpan, HashMap Identifier Word, Component) |
Generate a component for a given function
mkNetDecl :: (Id, Term) -> NetlistMonad (Maybe Declaration) Source #
:: HasCallStack | |
=> Id | LHS of the let-binder |
-> Term | RHS of the let-binder |
-> NetlistMonad [Declaration] |
Generate a list of Declarations for a let-binder, return an empty list if the bound expression is represented by 0 bits
:: HasCallStack | |
=> Id | LHS of the let-binder |
-> Term | RHS of the let-binder |
-> NetlistMonad [Declaration] |
Generate a list of Declarations for a let-binder
mkSelection :: Either Identifier Id -> Term -> Type -> [Alt] -> [Declaration] -> NetlistMonad [Declaration] Source #
Generate a declaration that selects an alternative based on the value of the scrutinee
:: HasCallStack | |
=> Identifier | LHS of the let-binder |
-> Id | Name of the applied function |
-> [Term] | Function arguments |
-> [Declaration] | Tick declarations |
-> NetlistMonad [Declaration] |
Generate a list of Declarations for a let-binder where the RHS is a function application
toSimpleVar :: Identifier -> (Expr, Type) -> NetlistMonad (Expr, [Declaration]) Source #
:: HasCallStack | |
=> Bool | Treat BlackBox expression as declaration |
-> Either Identifier Id | Id to assign the result to |
-> Type | Type of the LHS of the let-binder |
-> Term | Term to convert to an expression |
-> NetlistMonad (Expr, [Declaration]) | Returned expression and a list of generate BlackBox declarations |
Generate an expression for a term occurring on the RHS of a let-binder
:: Bool | Projection must bind to a simple variable |
-> Either Identifier Id | The signal to which the projection is (potentially) assigned |
-> Term | The subject/scrutinee of the projection |
-> Type | The type of the result |
-> Alt | The field to be projected |
-> NetlistMonad (Expr, [Declaration]) |
Generate an expression that projects a field out of a data-constructor.
Works for both product types, as sum-of-product types.
:: HasCallStack | |
=> HWType | HWType of the LHS of the let-binder |
-> Either Identifier Id | Id to assign the result to |
-> DataCon | Applied DataCon |
-> [Term] | DataCon Arguments |
-> NetlistMonad (Expr, [Declaration]) | Returned expression and a list of generate BlackBox declarations |
Generate an expression for a DataCon application occurring on the RHS of a let-binder