clash-lib-0.4.1: CAES Language for Synchronous Hardware - As a Library

Safe HaskellNone



Utilties to verify blackbox contexts against templates and rendering filled in templates



verifyBlackBoxContext Source


:: BlackBoxTemplate

Template to check against

-> BlackBoxContext

Blackbox to verify

-> 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.

countArgs :: BlackBoxTemplate -> Int Source

Count the number of argument tags/holes in a blackbox template

countLits :: BlackBoxTemplate -> Int Source

Counter the number of literal tags/holes in a blackbox template

countFuns :: BlackBoxTemplate -> Int Source

Count the number of function instantiations in a blackbox template

setSym :: Int -> BlackBoxTemplate -> (BlackBoxTemplate, Int) Source

Update all the symbol references in a template, and increment the symbol counter for every newly encountered symbol.

clkSyncId :: SyncIdentifier -> (Identifier, Int) Source

Get the name of the clock of an identifier

renderBlackBox Source


:: BlackBoxTemplate

Blackbox template

-> BlackBoxContext

Context used to fill in the hole

-> VHDLState 
-> ((Text, [(Identifier, HWType)]), VHDLState) 

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.

renderElem :: BlackBoxContext -> Element -> BlackBoxMonad Text Source

Render a single template element

lineToIdentifier :: BlackBoxContext -> BlackBoxTemplate -> BlackBoxMonad SyncIdentifier 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.

mkSyncIdentifier :: BlackBoxContext -> Element -> BlackBoxMonad SyncIdentifier Source

Give a context and a tagged hole (of a template), returns part of the context that matches the tag of the hole.