clash-lib-0.9999: CAES Language for Synchronous Hardware - As a Library
Copyright(C) 2012-2016 University of Twente
2016-2017 Myrtle Software Ltd
2017 Google Inc.
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

warn :: ClashOpts -> String -> IO () Source #

Emits (colorized) warning to stderr

mkBlackBoxContext Source #

Arguments

:: Text

Blackbox function name

-> Id

Identifier binding the primitive/blackbox application

-> [Term]

Arguments of the primitive/blackbox application

-> NetlistMonad (BlackBoxContext, [Declaration]) 

Generate the context for a BlackBox instantiation.

isLiteral :: Term -> Bool Source #

Determine if a term represents a literal

mkArgument Source #

Arguments

:: Identifier

LHS of the original let-binder

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

extractPrimWarnOrFail Source #

Arguments

:: Text

Name of primitive

-> NetlistMonad CompiledPrimitive 

Extract a compiled primitive from a guarded primitive. Emit a warning if the guard wants to, or fail entirely.

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

Name of primitive

-> [Either Term Type]

Arguments

-> Type

Result type

-> [Declaration]

Tick declarations

-> NetlistMonad (Expr, [Declaration]) 

mkFunInput Source #

Arguments

:: HasCallStack 
=> Id

Identifier binding the encompassing primitive/blackbox application

-> Term

The function argument term

-> NetlistMonad ((Either BlackBox (Identifier, [Declaration]), WireOrReg, [BlackBoxTemplate], [BlackBoxTemplate], [((Text, Text), BlackBox)], 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