| 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 | None |
| 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)
- 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
| Binary TemplateKind Source # | |||||
Defined in Clash.Netlist.BlackBox.Types Methods put :: TemplateKind -> Put Source # get :: Get TemplateKind Source # putList :: [TemplateKind] -> Put Source # | |||||
| NFData TemplateKind Source # | |||||
Defined in Clash.Netlist.BlackBox.Types Methods rnf :: TemplateKind -> () Source # | |||||
| Generic TemplateKind Source # | |||||
Defined in Clash.Netlist.BlackBox.Types Associated Types
Methods from :: TemplateKind -> Rep TemplateKind x Source # to :: Rep TemplateKind x -> TemplateKind Source # | |||||
| Show TemplateKind Source # | |||||
Defined in Clash.Netlist.BlackBox.Types | |||||
| Eq TemplateKind Source # | |||||
Defined in Clash.Netlist.BlackBox.Types Methods (==) :: TemplateKind -> TemplateKind -> Bool Source # (/=) :: TemplateKind -> TemplateKind -> Bool Source # | |||||
| Hashable TemplateKind Source # | |||||
Defined in Clash.Netlist.BlackBox.Types | |||||
| type Rep TemplateKind Source # | |||||
data TemplateFormat Source #
Instances
| FromJSON UnresolvedPrimitive Source # | |||||
Defined in Clash.Primitives.Types Methods parseJSON :: Value -> Parser UnresolvedPrimitive Source # parseJSONList :: Value -> Parser [UnresolvedPrimitive] Source # | |||||
| NFData TemplateFormat Source # | |||||
Defined in Clash.Primitives.Types Methods rnf :: TemplateFormat -> () Source # | |||||
| Generic TemplateFormat Source # | |||||
Defined in Clash.Primitives.Types Associated Types
Methods from :: TemplateFormat -> Rep TemplateFormat x Source # to :: Rep TemplateFormat x -> TemplateFormat Source # | |||||
| Show TemplateFormat Source # | |||||
Defined in Clash.Primitives.Types | |||||
| Eq TemplateFormat Source # | |||||
Defined in Clash.Primitives.Types Methods (==) :: TemplateFormat -> TemplateFormat -> Bool Source # (/=) :: TemplateFormat -> TemplateFormat -> Bool Source # | |||||
| Hashable TemplateFormat Source # | |||||
Defined in Clash.Primitives.Types | |||||
| type Rep TemplateFormat Source # | |||||
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
| FromJSON UnresolvedPrimitive Source # | |||||
Defined in Clash.Primitives.Types Methods parseJSON :: Value -> Parser UnresolvedPrimitive Source # parseJSONList :: Value -> Parser [UnresolvedPrimitive] Source # | |||||
| Binary BlackBoxFunctionName Source # | |||||
Defined in Clash.Primitives.Types Methods put :: BlackBoxFunctionName -> Put Source # get :: Get BlackBoxFunctionName Source # putList :: [BlackBoxFunctionName] -> Put Source # | |||||
| NFData BlackBoxFunctionName Source # | |||||
Defined in Clash.Primitives.Types Methods rnf :: BlackBoxFunctionName -> () Source # | |||||
| Generic BlackBoxFunctionName Source # | |||||
Defined in Clash.Primitives.Types Associated Types
Methods from :: BlackBoxFunctionName -> Rep BlackBoxFunctionName x Source # to :: Rep BlackBoxFunctionName x -> BlackBoxFunctionName Source # | |||||
| Show BlackBoxFunctionName Source # | |||||
Defined in Clash.Primitives.Types | |||||
| Eq BlackBoxFunctionName Source # | |||||
Defined in Clash.Primitives.Types Methods (==) :: BlackBoxFunctionName -> BlackBoxFunctionName -> Bool Source # (/=) :: BlackBoxFunctionName -> BlackBoxFunctionName -> Bool Source # | |||||
| Hashable BlackBoxFunctionName Source # | |||||
Defined in Clash.Primitives.Types | |||||
| type Rep BlackBoxFunctionName Source # | |||||
Defined in Clash.Primitives.Types type Rep BlackBoxFunctionName = D1 ('MetaData "BlackBoxFunctionName" "Clash.Primitives.Types" "clash-lib-1.8.4-Avs1lkPVzQY2EJC6aQfI6Y" 'False) (C1 ('MetaCons "BlackBoxFunctionName" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))) | |||||
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
| FromJSON UnresolvedPrimitive Source # | |||||
Defined in Clash.Primitives.Types Methods parseJSON :: Value -> Parser UnresolvedPrimitive Source # parseJSONList :: Value -> Parser [UnresolvedPrimitive] Source # | |||||
| Functor (Primitive a b c) Source # | |||||
| (Binary c, Binary a, Binary b, Binary d) => Binary (Primitive a b c d) Source # | |||||
| (NFData c, NFData a, NFData b, NFData d) => NFData (Primitive a b c d) Source # | |||||
Defined in Clash.Primitives.Types | |||||
| Generic (Primitive a b c d) Source # | |||||
Defined in Clash.Primitives.Types Associated Types
| |||||
| (Show c, Show a, Show b, Show d) => Show (Primitive a b c d) Source # | |||||
| (Eq c, Eq a, Eq b, Eq d) => Eq (Primitive a b c d) Source # | |||||
| (Hashable c, Hashable a, Hashable b, Hashable d) => Hashable (Primitive a b c d) Source # | |||||
Defined in Clash.Primitives.Types | |||||
| type Rep (Primitive a b c d) Source # | |||||
Defined in Clash.Primitives.Types type Rep (Primitive a b c d) = D1 ('MetaData "Primitive" "Clash.Primitives.Types" "clash-lib-1.8.4-Avs1lkPVzQY2EJC6aQfI6Y" 'False) (C1 ('MetaCons "BlackBox" 'PrefixI 'True) (((S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: (S1 ('MetaSel ('Just "workInfo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 WorkInfo) :*: S1 ('MetaSel ('Just "renderVoid") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RenderVoid))) :*: ((S1 ('MetaSel ('Just "multiResult") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "kind") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TemplateKind)) :*: (S1 ('MetaSel ('Just "warning") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 c) :*: S1 ('MetaSel ('Just "outputUsage") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Usage)))) :*: ((S1 ('MetaSel ('Just "libraries") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [a]) :*: (S1 ('MetaSel ('Just "imports") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [a]) :*: S1 ('MetaSel ('Just "functionPlurality") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(Int, Int)]))) :*: ((S1 ('MetaSel ('Just "includes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [((Text, Text), b)]) :*: S1 ('MetaSel ('Just "resultNames") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [b])) :*: (S1 ('MetaSel ('Just "resultInits") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [b]) :*: S1 ('MetaSel ('Just "template") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 b))))) :+: (C1 ('MetaCons "BlackBoxHaskell" 'PrefixI 'True) ((S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: (S1 ('MetaSel ('Just "workInfo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 WorkInfo) :*: S1 ('MetaSel ('Just "usedArguments") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UsedArguments))) :*: (S1 ('MetaSel ('Just "multiResult") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: (S1 ('MetaSel ('Just "functionName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BlackBoxFunctionName) :*: S1 ('MetaSel ('Just "function") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 d)))) :+: C1 ('MetaCons "Primitive" 'PrefixI 'True) (S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: (S1 ('MetaSel ('Just "workInfo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 WorkInfo) :*: S1 ('MetaSel ('Just "primSort") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text))))) | |||||
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
| Binary UsedArguments Source # | |||||
Defined in Clash.Primitives.Types Methods put :: UsedArguments -> Put Source # get :: Get UsedArguments Source # putList :: [UsedArguments] -> Put Source # | |||||
| NFData UsedArguments Source # | |||||
Defined in Clash.Primitives.Types Methods rnf :: UsedArguments -> () Source # | |||||
| Generic UsedArguments Source # | |||||
Defined in Clash.Primitives.Types Associated Types
Methods from :: UsedArguments -> Rep UsedArguments x Source # to :: Rep UsedArguments x -> UsedArguments Source # | |||||
| Show UsedArguments Source # | |||||
Defined in Clash.Primitives.Types | |||||
| Eq UsedArguments Source # | |||||
Defined in Clash.Primitives.Types Methods (==) :: UsedArguments -> UsedArguments -> Bool Source # (/=) :: UsedArguments -> UsedArguments -> Bool Source # | |||||
| Hashable UsedArguments Source # | |||||
Defined in Clash.Primitives.Types | |||||
| type Rep UsedArguments Source # | |||||
Defined in Clash.Primitives.Types type Rep UsedArguments = D1 ('MetaData "UsedArguments" "Clash.Primitives.Types" "clash-lib-1.8.4-Avs1lkPVzQY2EJC6aQfI6Y" 'False) (C1 ('MetaCons "UsedArguments" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Int])) :+: C1 ('MetaCons "IgnoredArguments" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Int]))) | |||||
type UnresolvedPrimitive = Primitive Text ((TemplateFormat, BlackBoxFunctionName), Maybe TemplateSource) (Maybe Text) (Maybe TemplateSource) Source #
An unresolved primitive still contains pointers to files.
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.