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

Copyright(C) 2012-2016 University of Twente
2016-2017 Myrtle Software Ltd
LicenseBSD2 (see the file LICENSE)
MaintainerChristiaan Baaij <christiaan.baaij@gmail.com>
Safe HaskellNone
LanguageHaskell2010

Clash.Netlist.BlackBox.Util

Description

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

Synopsis

Documentation

verifyBlackBoxContext Source #

Arguments

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

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.

renderTemplate Source #

Arguments

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

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

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.

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.

prettyElem :: Monad m => Element -> Mon m Text Source #