-> (HscTypes.CoreModule -> Ghc (Maybe CoreBndr)) -- ^ The TopEntity finder
-> (HscTypes.CoreModule -> Ghc (Maybe CoreBndr)) -- ^ The InitState finder
-> (HscTypes.CoreModule -> Ghc (Maybe CoreExpr)) -- ^ The TestInput finder
- -> IO ( [HscTypes.CoreModule] -- ^ The loaded modules
- , [Maybe CoreBndr] -- ^ The TopEntity
- , [Maybe CoreBndr] -- ^ The InitState
- , [Maybe CoreExpr] -- ^ The TestInput
- , HscTypes.HscEnv -- ^ The Environment corresponding ot the loaded modules
- )
+ -> IO ( [HscTypes.CoreModule]
+ , [Maybe CoreBndr]
+ , [Maybe CoreBndr]
+ , [Maybe CoreExpr]
+ , HscTypes.HscEnv
+ ) -- ^ (The loaded modules , The TopEntity , The InitState, The TestInput, The Environment corresponding ot the loaded modules)
loadModules libdir filenames topEntLoc initSLoc testLoc =
defaultErrorHandler defaultDynFlags $ do
runGhc (Just libdir) $ do
-- | Find a binder in module according to a certain criteria
findBind ::
- GhcMonad m => -- ^ Expected to be run in some kind of GHC Monad
+ GhcMonad m =>
(Var.Var -> m Bool) -- ^ The criteria to filter the binds on
-> HscTypes.CoreModule -- ^ The module to be inspected
-> m (Maybe CoreBndr) -- ^ The (first) bind to meet the criteria
-- | Find an expresion in module according to a certain criteria
findExpr ::
- GhcMonad m => -- ^ Expected to be run in some kind off GHC Monad
+ GhcMonad m =>
(Var.Var -> m Bool) -- ^ The criteria to filter the binds on
-> HscTypes.CoreModule -- ^ The module to be inspected
-> m (Maybe CoreExpr) -- ^ The (first) expr to meet the criteria
-- | Determine if a binder has an Annotation meeting a certain criteria
hasCLasHAnnotation ::
- GhcMonad m => -- ^ Expected to be run in some kind of GHC Monad
+ GhcMonad m =>
(CLasHAnn -> Bool) -- ^ The criteria the Annotation has to meet
-> Var.Var -- ^ The Binder
-> m Bool -- ^ Indicates if binder has the Annotation
-- | Determine if a binder has a certain name
hasVarName ::
- GhcMonad m => -- ^ Exprected to be run in some kind of GHC Monad
+ GhcMonad m =>
String -- ^ The name the binder has to have
-> Var.Var -- ^ The Binder
-> m Bool -- ^ Indicate if the binder has the name
-- | Create an entity for a given function
createEntity ::
- (CoreSyn.CoreBndr, CoreSyn.CoreExpr) -- | The function
- -> VHDLSession AST.EntityDec -- | The resulting entity
+ (CoreSyn.CoreBndr, CoreSyn.CoreExpr) -- ^ The function
+ -> VHDLSession AST.EntityDec -- ^ The resulting entity
createEntity (fname, expr) = do
-- Strip off lambda's, these will be arguments
return (id, type_mark)
)
- -- | Create the VHDL AST for an entity
+-- | Create the VHDL AST for an entity
createEntityAST ::
- AST.VHDLId -- | The name of the function
- -> [Port] -- | The entity's arguments
- -> Port -- | The entity's result
- -> AST.EntityDec -- | The entity with the ent_decl filled in as well
+ AST.VHDLId -- ^ The name of the function
+ -> [Port] -- ^ The entity's arguments
+ -> Port -- ^ The entity's result
+ -> AST.EntityDec -- ^ The entity with the ent_decl filled in as well
createEntityAST vhdl_id args res =
AST.EntityDec vhdl_id ports
-- | Create a port declaration
mkIfaceSigDec ::
- AST.Mode -- | The mode for the port (In / Out)
- -> (AST.VHDLId, AST.TypeMark) -- | The id and type for the port
- -> AST.IfaceSigDec -- | The resulting port declaration
+ AST.Mode -- ^ The mode for the port (In / Out)
+ -> (AST.VHDLId, AST.TypeMark) -- ^ The id and type for the port
+ -> AST.IfaceSigDec -- ^ The resulting port declaration
mkIfaceSigDec mode (id, ty) = AST.IfaceSigDec id mode ty
-- Create a conditional or unconditional assignment statement
mkAssign ::
- Either CoreBndr AST.VHDLName -> -- ^ The signal to assign to
- Maybe (AST.Expr , AST.Expr) -> -- ^ Optionally, the condition to test for
+ Either CoreBndr AST.VHDLName -- ^ The signal to assign to
+ -> Maybe (AST.Expr , AST.Expr) -- ^ Optionally, the condition to test for
-- and the value to assign when true.
- AST.Expr -> -- ^ The value to assign when false or no condition
- AST.ConcSm -- ^ The resulting concurrent statement
+ -> AST.Expr -- ^ The value to assign when false or no condition
+ -> AST.ConcSm -- ^ The resulting concurrent statement
mkAssign dst cond false_expr =
let
-- I'm not 100% how this assignment AST works, but this gets us what we
AST.CSSASm assign
mkAssocElems ::
- [AST.Expr] -- | The argument that are applied to function
- -> AST.VHDLName -- | The binder in which to store the result
- -> Entity -- | The entity to map against.
- -> [AST.AssocElem] -- | The resulting port maps
+ [AST.Expr] -- ^ The argument that are applied to function
+ -> AST.VHDLName -- ^ The binder in which to store the result
+ -> Entity -- ^ The entity to map against.
+ -> [AST.AssocElem] -- ^ The resulting port maps
mkAssocElems args res entity =
-- Create the actual AssocElems
zipWith mkAssocElem ports sigs