| Copyright | (C) 2012-2016 University of Twente 2016-2017 Myrtle Software Ltd 2018 Google Inc. 2021 QBayLogic B.V. 2022 Google Inc. |
|---|---|
| License | BSD2 (see the file LICENSE) |
| Maintainer | QBayLogic B.V. <devops@qbaylogic.com> |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Clash.Primitives.Types
Description
Type and instance definitions for Primitive
Synopsis
- data TemplateSource
- data TemplateKind
- data TemplateFormat
- data BlackBoxFunctionName = BlackBoxFunctionName [String] String
- data Primitive a b c d
- = BlackBox {
- name :: !Text
- workInfo :: WorkInfo
- renderVoid :: RenderVoid
- multiResult :: Bool
- kind :: TemplateKind
- warning :: c
- outputUsage :: Usage
- libraries :: [a]
- imports :: [a]
- functionPlurality :: [(Int, Int)]
- includes :: [((Text, Text), b)]
- resultNames :: [b]
- resultInits :: [b]
- template :: b
- | BlackBoxHaskell { }
- | Primitive { }
- = BlackBox {
- data UsedArguments
- = UsedArguments [Int]
- | IgnoredArguments [Int]
- type GuardedCompiledPrimitive = PrimitiveGuard CompiledPrimitive
- type GuardedResolvedPrimitive = PrimitiveGuard ResolvedPrimitive
- type PrimMap a = HashMap Text a
- type UnresolvedPrimitive = Primitive Text ((TemplateFormat, BlackBoxFunctionName), Maybe TemplateSource) (Maybe Text) (Maybe TemplateSource)
- newtype UnresolvedPrimitiveEntry = UnresolvedPrimitiveEntry {}
- type ResolvedPrimitive = Primitive Text ((TemplateFormat, BlackBoxFunctionName), Maybe Text) () (Maybe Text)
- type ResolvedPrimMap = PrimMap GuardedResolvedPrimitive
- type CompiledPrimitive = Primitive BlackBoxTemplate BlackBox () (Int, BlackBoxFunction)
- type CompiledPrimMap = PrimMap GuardedCompiledPrimitive
Documentation
data TemplateSource Source #
Constructors
| TFile FilePath | Template source stored in file on filesystem |
| TInline Text | Template stored inline |
Instances
data TemplateKind Source #
Instances
| Generic TemplateKind Source # | |
Defined in Clash.Netlist.BlackBox.Types Associated Types type Rep TemplateKind :: Type -> Type # | |
| Show TemplateKind Source # | |
Defined in Clash.Netlist.BlackBox.Types Methods showsPrec :: Int -> TemplateKind -> ShowS # show :: TemplateKind -> String # showList :: [TemplateKind] -> ShowS # | |
| Binary TemplateKind Source # | |
Defined in Clash.Netlist.BlackBox.Types | |
| NFData TemplateKind Source # | |
Defined in Clash.Netlist.BlackBox.Types Methods rnf :: TemplateKind -> () # | |
| Eq TemplateKind Source # | |
Defined in Clash.Netlist.BlackBox.Types | |
| Hashable TemplateKind Source # | |
Defined in Clash.Netlist.BlackBox.Types | |
| type Rep TemplateKind Source # | |
data TemplateFormat Source #
Instances
data BlackBoxFunctionName Source #
A BBFN is a parsed version of a fully qualified function name. It is guaranteed to have at least one module name which is not Main.
Constructors
| BlackBoxFunctionName [String] String |
Instances
data Primitive a b c d Source #
Externally defined primitive
Constructors
| BlackBox | Primitive template written in a Clash specific templating language |
Fields
| |
| BlackBoxHaskell | Primitive template rendered by a Haskell function (given as raw source code) |
Fields
| |
| Primitive | A primitive that carries additional information. These are "real"
primitives, hardcoded in the compiler. For example: |
Instances
data UsedArguments Source #
Data type to indicate what arguments are in use by a BlackBox
Constructors
| UsedArguments [Int] | Only these are used |
| IgnoredArguments [Int] | All but these are used |
Instances
type GuardedCompiledPrimitive = PrimitiveGuard CompiledPrimitive Source #
type GuardedResolvedPrimitive = PrimitiveGuard ResolvedPrimitive Source #
type UnresolvedPrimitive = Primitive Text ((TemplateFormat, BlackBoxFunctionName), Maybe TemplateSource) (Maybe Text) (Maybe TemplateSource) Source #
An unresolved primitive still contains pointers to files.
newtype UnresolvedPrimitiveEntry Source #
A single YAML/JSON primitive entry. Unlike UnresolvedPrimitive, this
newtype can represent multiple primitive records emitted from a single
YAML entry whose name field is a list of names rather than a single
string. For example
- Primitive:
name: [GHC.Num.Integer.IS, GHC.Internal.Bignum.Integer.IS]
primType: Constructor
workInfo: Never
yields two UnresolvedPrimitives with the same body but different
names. This lets us register one primitive under multiple qualified
names without duplicating the YAML body — useful when GHC moves
wired-in symbols between modules across versions (e.g. Integer
on GHC 9.12 vs 'GHC.Internal.Bignum.Integer' on GHC= 9.14).
The single-string form name: "foo" still parses; it produces a
NonEmpty of length one.
Constructors
| UnresolvedPrimitiveEntry | |
Instances
| FromJSON UnresolvedPrimitiveEntry Source # | |
Defined in Clash.Primitives.Types Methods parseJSON :: Value -> Parser UnresolvedPrimitiveEntry # parseJSONList :: Value -> Parser [UnresolvedPrimitiveEntry] # | |
type ResolvedPrimitive = Primitive Text ((TemplateFormat, BlackBoxFunctionName), Maybe Text) () (Maybe Text) Source #
A parsed primitive does not contain pointers to filesystem files anymore,
but holds uncompiled BlackBoxTemplates and BlackBoxFunctions.
type CompiledPrimitive = Primitive BlackBoxTemplate BlackBox () (Int, BlackBoxFunction) Source #
A compiled primitive has compiled all templates and functions from its
ResolvedPrimitive counterpart. The Int in the tuple is a hash of the
(uncompiled) BlackBoxFunction.