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

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

CLaSH.Netlist.BlackBox

Description

Functions to create BlackBox Contexts and fill in BlackBox templates

Synopsis

Documentation

mkBlackBoxContext Source

Arguments

:: Id

Identifier binding the primitive/blackbox application

-> [Term]

Arguments of the primitive/blackbox application

-> NetlistMonad (BlackBoxContext, [Declaration]) 

Generate the context for a BlackBox instantiation.

mkArgument Source

Arguments

:: Identifier

LHS of the original let-binder

-> Term 
-> NetlistMonad ((SyncExpr, HWType, Bool), [Declaration]) 

mkPrimitive Source

Arguments

:: Bool

Put BlackBox expression in parenthesis

-> Bool

Treat BlackBox expression as declaration

-> Either Identifier Id

Id to assign the result to

-> Text 
-> [Either Term Type] 
-> Type 
-> NetlistMonad (Expr, [Declaration]) 

mkFunInput Source

Arguments

:: Id

Identifier binding the encompassing primitive/blackbox application

-> Term

The function argument term

-> NetlistMonad ((Either BlackBoxTemplate Declaration, BlackBoxContext), [Declaration]) 

Create an template instantiation text and a partial blackbox content for an argument term, given that the term is a function. Errors if the term is not a function

instantiateCompName :: BlackBoxTemplate -> NetlistMonad BlackBoxTemplate Source

Instantiate symbols references with a new symbol and increment symbol counter instantiateSym :: BlackBoxTemplate -> NetlistMonad BlackBoxTemplate instantiateSym l = do i <- Lens.use varCount ids <- Lens.use seenIds let (l',(ids',i')) = setSym ids i l varCount .= i' seenIds .= ids' return l'