Copyright | (C) 2012-2016 University of Twente 2016-2017 Myrtle Software Ltd |
---|---|
License | BSD2 (see the file LICENSE) |
Maintainer | Christiaan Baaij <christiaan.baaij@gmail.com> |
Safe Haskell | None |
Language | Haskell2010 |
Utilties to verify blackbox contexts against templates and rendering filled in templates
Synopsis
- verifyBlackBoxContext :: BlackBoxContext -> BlackBoxTemplate -> Bool
- extractLiterals :: BlackBoxContext -> [Expr]
- setSym :: BlackBoxContext -> BlackBoxTemplate -> NetlistMonad (BlackBoxTemplate, [Declaration])
- setCompName :: Identifier -> BlackBoxTemplate -> BlackBoxTemplate
- findAndSetDataFiles :: BlackBoxContext -> [(String, FilePath)] -> BlackBoxTemplate -> ([(String, FilePath)], BlackBoxTemplate)
- renderFilePath :: [(String, FilePath)] -> String -> ([(String, FilePath)], Element)
- renderTemplate :: Backend backend => BlackBoxContext -> BlackBoxTemplate -> State backend (Int -> Text)
- renderBlackBox :: Backend backend => [BlackBoxTemplate] -> [BlackBoxTemplate] -> Maybe ((Text, Text), BlackBoxTemplate) -> BlackBoxTemplate -> BlackBoxContext -> State backend (Int -> Doc)
- setSimpleVar :: BlackBoxContext -> BlackBoxTemplate -> BlackBoxTemplate
- renderElem :: Backend backend => BlackBoxContext -> Element -> State backend (Int -> Text)
- parseFail :: Text -> BlackBoxTemplate
- idToExpr :: (Text, HWType) -> (Expr, HWType, Bool)
- lineToIdentifier :: Backend backend => BlackBoxContext -> BlackBoxTemplate -> State backend Text
- lineToType :: BlackBoxContext -> BlackBoxTemplate -> HWType
- renderTag :: Backend backend => BlackBoxContext -> Element -> State backend Text
- exprToText :: Expr -> Maybe Text
- prettyBlackBox :: Monad m => BlackBoxTemplate -> Mon m Text
- prettyElem :: Monad m => Element -> Mon m Text
- usedArguments :: BlackBoxTemplate -> [Int]
Documentation
verifyBlackBoxContext Source #
:: BlackBoxContext | Blackbox to verify |
-> BlackBoxTemplate | Template to check against |
-> Bool |
Determine if the number of normalliteralfunction inputs of a blackbox context at least matches the number of argument that is expected by the template.
extractLiterals :: BlackBoxContext -> [Expr] Source #
setSym :: BlackBoxContext -> BlackBoxTemplate -> NetlistMonad (BlackBoxTemplate, [Declaration]) Source #
Update all the symbol references in a template, and increment the symbol counter for every newly encountered symbol.
findAndSetDataFiles :: BlackBoxContext -> [(String, FilePath)] -> BlackBoxTemplate -> ([(String, FilePath)], BlackBoxTemplate) Source #
:: Backend backend | |
=> BlackBoxContext | Context used to fill in the hole |
-> BlackBoxTemplate | Blackbox template |
-> State backend (Int -> Text) |
Render a blackbox given a certain context. Returns a filled out template
and a list of hidden
inputs that must be added to the encompassing component.
renderBlackBox :: Backend backend => [BlackBoxTemplate] -> [BlackBoxTemplate] -> Maybe ((Text, Text), BlackBoxTemplate) -> BlackBoxTemplate -> BlackBoxContext -> State backend (Int -> Doc) Source #
setSimpleVar :: BlackBoxContext -> BlackBoxTemplate -> BlackBoxTemplate Source #
Assign Var
holes in the context of a primitive HDL template that is
passed as an argument of a higher-order HDL template. For the general case,
use setSym
This functions errors when the Var
hole cannot be filled with a variable,
as it is (currently) impossible to create unique names this late in the
pipeline.
renderElem :: Backend backend => BlackBoxContext -> Element -> State backend (Int -> Text) Source #
Render a single template element
parseFail :: Text -> BlackBoxTemplate Source #
lineToIdentifier :: Backend backend => BlackBoxContext -> BlackBoxTemplate -> State backend Text Source #
Fill out the template corresponding to an output/input assignment of a component instantiation, and turn it into a single identifier so it can be used for a new blackbox context.
lineToType :: BlackBoxContext -> BlackBoxTemplate -> HWType Source #
renderTag :: Backend backend => BlackBoxContext -> Element -> State backend Text Source #
Give a context and a tagged hole (of a template), returns part of the context that matches the tag of the hole.
prettyBlackBox :: Monad m => BlackBoxTemplate -> Mon m Text Source #
usedArguments :: BlackBoxTemplate -> [Int] Source #