Copyright | (C) 2012-2016 University of Twente 2017 Myrtle Software Ltd 2021-2022 QBayLogic B.V. 2022 LUMI GUIDE FIETSDETECTIE B.V. 2022 Google Inc. |
---|---|
License | BSD2 (see the file LICENSE) |
Maintainer | QBayLogic B.V. <devops@qbaylogic.com> |
Safe Haskell | None |
Language | Haskell2010 |
Types used in BlackBox modules
Synopsis
- data BlackBoxMeta = BlackBoxMeta {
- bbOutputUsage :: Usage
- bbKind :: TemplateKind
- bbLibrary :: [BlackBoxTemplate]
- bbImports :: [BlackBoxTemplate]
- bbFunctionPlurality :: [(Int, Int)]
- bbIncludes :: [((Text, Text), BlackBox)]
- bbRenderVoid :: RenderVoid
- bbResultNames :: [BlackBox]
- bbResultInits :: [BlackBox]
- emptyBlackBoxMeta :: BlackBoxMeta
- type BlackBoxFunction = Bool -> Text -> [Either Term Type] -> [Type] -> NetlistMonad (Either String (BlackBoxMeta, BlackBox))
- type BlackBoxTemplate = [Element]
- data TemplateKind
- data Element
- = Text !Text
- | Component !Decl
- | Result
- | Arg !Int
- | ArgGen !Int !Int
- | Const !Int
- | Lit !Int
- | Name !Int
- | ToVar [Element] !Int
- | Sym !Text !Int
- | Typ !(Maybe Int)
- | TypM !(Maybe Int)
- | Err !(Maybe Int)
- | TypElem !Element
- | CompName
- | IncludeName !Int
- | IndexType !Element
- | Size !Element
- | Length !Element
- | Depth !Element
- | MaxIndex !Element
- | FilePath !Element
- | Template [Element] [Element]
- | Gen !Bool
- | IF !Element [Element] [Element]
- | And [Element]
- | IW64
- | CmpLE !Element !Element
- | HdlSyn HdlSyn
- | BV !Bool [Element] !Element
- | Sel !Element !Int
- | IsLit !Int
- | IsVar !Int
- | IsScalar !Int
- | IsActiveHigh !Int
- | Tag !Int
- | Period !Int
- | LongestPeriod
- | ActiveEdge !ActiveEdge !Int
- | IsSync !Int
- | IsInitDefined !Int
- | IsActiveEnable !Int
- | IsUndefined !Int
- | StrCmp [Element] !Int
- | OutputUsage !Int
- | Vars !Int
- | GenSym [Element] !Int
- | Repeat [Element] [Element]
- | DevNull [Element]
- | SigD [Element] !(Maybe Int)
- | CtxName
- data Decl = Decl !Int !Int [(BlackBoxTemplate, BlackBoxTemplate)]
- data HdlSyn
- data RenderVoid
Documentation
data BlackBoxMeta Source #
See Clash.Primitives.Types.BlackBox
for documentation on this record's
fields. (They are intentionally renamed to prevent name clashes.)
BlackBoxMeta | |
|
emptyBlackBoxMeta :: BlackBoxMeta Source #
Use this value in your blackbox template function if you do want to
accept the defaults as documented in Clash.Primitives.Types.BlackBox
.
type BlackBoxFunction Source #
= Bool | Indicates whether caller needs a declaration. If set, the function is still free to return an expression, but the caller will convert it to a declaration. |
-> Text | Name of primitive |
-> [Either Term Type] | Arguments |
-> [Type] | Result types |
-> NetlistMonad (Either String (BlackBoxMeta, BlackBox)) |
A BlackBox function generates a blackbox template, given the inputs and result type of the function it should provide a blackbox for. This is useful when having a need for blackbox functions, ... TODO: docs
type BlackBoxTemplate = [Element] Source #
A BlackBox Template is a List of Elements TODO: Add name of function for better error messages
data TemplateKind Source #
Instances
Eq TemplateKind Source # | |
Defined in Clash.Netlist.BlackBox.Types (==) :: TemplateKind -> TemplateKind -> Bool # (/=) :: TemplateKind -> TemplateKind -> Bool # | |
Show TemplateKind Source # | |
Defined in Clash.Netlist.BlackBox.Types showsPrec :: Int -> TemplateKind -> ShowS # show :: TemplateKind -> String # showList :: [TemplateKind] -> ShowS # | |
Generic TemplateKind Source # | |
Defined in Clash.Netlist.BlackBox.Types type Rep TemplateKind :: Type -> Type # from :: TemplateKind -> Rep TemplateKind x # to :: Rep TemplateKind x -> TemplateKind # | |
Hashable TemplateKind Source # | |
Defined in Clash.Netlist.BlackBox.Types hashWithSalt :: Int -> TemplateKind -> Int # hash :: TemplateKind -> Int # | |
Binary TemplateKind Source # | |
Defined in Clash.Netlist.BlackBox.Types | |
NFData TemplateKind Source # | |
Defined in Clash.Netlist.BlackBox.Types rnf :: TemplateKind -> () # | |
type Rep TemplateKind Source # | |
Elements of a blackbox context. If you extend this list, make sure to update the following functions:
- Clash.Netlist.BlackBox.Types.prettyElem
- Clash.Netlist.BlackBox.Types.renderElem
- Clash.Netlist.BlackBox.Types.renderTag
- Clash.Netlist.BlackBox.Types.setSym
- Clash.Netlist.BlackBox.Util.inputHole
- Clash.Netlist.BlackBox.Types.getUsedArguments
- Clash.Netlist.BlackBox.Types.usedVariables
- Clash.Netlist.BlackBox.Types.verifyBlackBoxContext
- Clash.Netlist.BlackBox.Types.walkElement
Text !Text | Dumps given text without processing in HDL |
Component !Decl | Component instantiation hole |
Result | Output hole; |
Arg !Int | Input hole |
ArgGen !Int !Int | Like Arg, but its first argument is the scoping level. For use in in generated code only. |
Const !Int | Like Arg, but input hole must be a constant. |
Lit !Int | Like Arg, but input hole must be a literal |
Name !Int | Name hole |
ToVar [Element] !Int | Like Arg but only insert variable reference (creating an assignment elsewhere if necessary). |
Sym !Text !Int | Symbol hole |
Typ !(Maybe Int) | Type declaration hole |
TypM !(Maybe Int) | Type root hole |
Err !(Maybe Int) | Error value hole |
TypElem !Element | Select element type from a vector-like type |
CompName | Hole for the name of the component in which the blackbox is instantiated |
IncludeName !Int | |
IndexType !Element | Index data type hole, the field is the (exclusive) maximum index |
Size !Element | Size of a type hole |
Length !Element | Length of a vector-like hole |
Depth !Element | Depth of a tree hole |
MaxIndex !Element | Max index into a vector-like type |
FilePath !Element | Hole containing a filepath for a data file |
Template [Element] [Element] | |
Gen !Bool | Hole marking beginning (True) or end (False) of a generative construct |
IF !Element [Element] [Element] | |
And [Element] | |
IW64 | Hole indicating whether IntWordInteger are 64-Bit |
CmpLE !Element !Element | Compare less-or-equal |
HdlSyn HdlSyn | Hole indicating which synthesis tool we're generating HDL for |
BV !Bool [Element] !Element | Convert to (True)/from(False) a bit-vector |
Sel !Element !Int | Record selector of a type |
IsLit !Int | |
IsVar !Int | |
IsScalar !Int | Whether element is scalar |
IsActiveHigh !Int | Whether a domain's reset lines are active high. Errors if not applied to
a |
Tag !Int | Tag of a domain. |
Period !Int | Period of a domain. Errors if not applied to a |
LongestPeriod | Longest period of all known domains. The minimum duration returned is 100 ns, see https://github.com/clash-lang/clash-compiler/issues/2455. |
ActiveEdge !ActiveEdge !Int | Test active edge of memory elements in a certain domain. Errors if not
applied to a |
IsSync !Int | Whether a domain's reset lines are synchronous. Errors if not applied to
a |
IsInitDefined !Int | Whether the initial (or "power up") value of memory elements in a domain
are configurable to a specific value rather than unknown/undefined. Errors
if not applied to a |
IsActiveEnable !Int | Whether given enable line is active. More specifically, whether the
enable line is NOT set to a constant |
IsUndefined !Int | Whether argument is undefined. E.g., an XException, error call, removed argument, or primitive that is undefined. This template tag will always return 0 (False) if `-fclash-aggressive-x-optimization-blackboxes` is NOT set. |
StrCmp [Element] !Int | |
OutputUsage !Int | |
Vars !Int | |
GenSym [Element] !Int | |
Repeat [Element] [Element] | Repeat hole n times |
DevNull [Element] | Evaluate hole but swallow output |
SigD [Element] !(Maybe Int) | |
CtxName | The "context name", name set by |
Instances
Component instantiation hole. First argument indicates which function argument to instantiate. Third argument corresponds to output and input assignments, where the first element is the output assignment, and the subsequent elements are the consecutive input assignments.
The LHS of the tuple is the name of the signal, while the RHS of the tuple is the type of the signal
Decl | |
|
Instances
Eq Decl Source # | |
Show Decl Source # | |
Generic Decl Source # | |
Hashable Decl Source # | |
Defined in Clash.Netlist.BlackBox.Types | |
Binary Decl Source # | |
NFData Decl Source # | |
Defined in Clash.Netlist.BlackBox.Types | |
type Rep Decl Source # | |
Defined in Clash.Netlist.BlackBox.Types type Rep Decl = D1 ('MetaData "Decl" "Clash.Netlist.BlackBox.Types" "clash-lib-1.7.0-inplace" 'False) (C1 ('MetaCons "Decl" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(BlackBoxTemplate, BlackBoxTemplate)])))) |
Instances
Eq HdlSyn Source # | |
Read HdlSyn Source # | |
Show HdlSyn Source # | |
Generic HdlSyn Source # | |
Hashable HdlSyn Source # | |
Defined in Clash.Netlist.BlackBox.Types | |
Binary HdlSyn Source # | |
NFData HdlSyn Source # | |
Defined in Clash.Netlist.BlackBox.Types | |
type Rep HdlSyn Source # | |
Defined in Clash.Netlist.BlackBox.Types type Rep HdlSyn = D1 ('MetaData "HdlSyn" "Clash.Netlist.BlackBox.Types" "clash-lib-1.7.0-inplace" 'False) (C1 ('MetaCons "Vivado" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Quartus" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Other" 'PrefixI 'False) (U1 :: Type -> Type))) |
data RenderVoid Source #
Whether this primitive should be rendered when its result type is void.
Defaults to NoRenderVoid
.
RenderVoid | Render blackbox, even if result type is void |
NoRenderVoid | Don't render blackbox result type is void. Default for all blackboxes. |
Instances
Eq RenderVoid Source # | |
Defined in Clash.Netlist.BlackBox.Types (==) :: RenderVoid -> RenderVoid -> Bool # (/=) :: RenderVoid -> RenderVoid -> Bool # | |
Show RenderVoid Source # | |
Defined in Clash.Netlist.BlackBox.Types showsPrec :: Int -> RenderVoid -> ShowS # show :: RenderVoid -> String # showList :: [RenderVoid] -> ShowS # | |
Generic RenderVoid Source # | |
Defined in Clash.Netlist.BlackBox.Types type Rep RenderVoid :: Type -> Type # from :: RenderVoid -> Rep RenderVoid x # to :: Rep RenderVoid x -> RenderVoid # | |
Hashable RenderVoid Source # | |
Defined in Clash.Netlist.BlackBox.Types hashWithSalt :: Int -> RenderVoid -> Int # hash :: RenderVoid -> Int # | |
FromJSON RenderVoid Source # | |
Defined in Clash.Netlist.BlackBox.Types parseJSON :: Value -> Parser RenderVoid # parseJSONList :: Value -> Parser [RenderVoid] # | |
Binary RenderVoid Source # | |
Defined in Clash.Netlist.BlackBox.Types | |
NFData RenderVoid Source # | |
Defined in Clash.Netlist.BlackBox.Types rnf :: RenderVoid -> () # | |
type Rep RenderVoid Source # | |