| 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 {
- name :: !Text
- workInfo :: WorkInfo
- usedArguments :: UsedArguments
- multiResult :: Bool
- functionName :: BlackBoxFunctionName
- function :: d
- | 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
| FromJSON UnresolvedPrimitive Source # | |||||
Defined in Clash.Primitives.Types Methods parseJSON :: Value -> Parser UnresolvedPrimitive Source # parseJSONList :: Value -> Parser [UnresolvedPrimitive] Source # | |||||
| NFData TemplateSource Source # | |||||
Defined in Clash.Primitives.Types Methods rnf :: TemplateSource -> () | |||||
| Generic TemplateSource Source # | |||||
Defined in Clash.Primitives.Types Associated Types
| |||||
| Show TemplateSource Source # | |||||
Defined in Clash.Primitives.Types Methods showsPrec :: Int -> TemplateSource -> ShowS # show :: TemplateSource -> String # showList :: [TemplateSource] -> ShowS # | |||||
| Eq TemplateSource Source # | |||||
Defined in Clash.Primitives.Types Methods (==) :: TemplateSource -> TemplateSource -> Bool # (/=) :: TemplateSource -> TemplateSource -> Bool # | |||||
| Hashable TemplateSource Source # | |||||
Defined in Clash.Primitives.Types | |||||
| type Rep TemplateSource Source # | |||||
Defined in Clash.Primitives.Types type Rep TemplateSource = D1 ('MetaData "TemplateSource" "Clash.Primitives.Types" "clash-lib-1.8.4-LRerWkkgeHOGhsvLM5mWaX" 'False) (C1 ('MetaCons "TFile" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath)) :+: C1 ('MetaCons "TInline" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))) | |||||
data TemplateKind Source #
Instances
| Binary TemplateKind Source # | |||||
Defined in Clash.Netlist.BlackBox.Types | |||||
| NFData TemplateKind Source # | |||||
Defined in Clash.Netlist.BlackBox.Types Methods rnf :: TemplateKind -> () | |||||
| Generic TemplateKind Source # | |||||
Defined in Clash.Netlist.BlackBox.Types Associated Types
| |||||
| Show TemplateKind Source # | |||||
Defined in Clash.Netlist.BlackBox.Types Methods showsPrec :: Int -> TemplateKind -> ShowS # show :: TemplateKind -> String # showList :: [TemplateKind] -> ShowS # | |||||
| Eq TemplateKind Source # | |||||
Defined in Clash.Netlist.BlackBox.Types | |||||
| Hashable TemplateKind Source # | |||||
Defined in Clash.Netlist.BlackBox.Types | |||||
| type Rep TemplateKind Source # | |||||
Defined in Clash.Netlist.BlackBox.Types | |||||
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 -> () | |||||
| Generic TemplateFormat Source # | |||||
Defined in Clash.Primitives.Types Associated Types
| |||||
| Show TemplateFormat Source # | |||||
Defined in Clash.Primitives.Types Methods showsPrec :: Int -> TemplateFormat -> ShowS # show :: TemplateFormat -> String # showList :: [TemplateFormat] -> ShowS # | |||||
| Eq TemplateFormat Source # | |||||
Defined in Clash.Primitives.Types Methods (==) :: TemplateFormat -> TemplateFormat -> Bool # (/=) :: TemplateFormat -> TemplateFormat -> Bool # | |||||
| Hashable TemplateFormat Source # | |||||
Defined in Clash.Primitives.Types | |||||
| type Rep TemplateFormat Source # | |||||
Defined in Clash.Primitives.Types | |||||
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
| 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 # | |||||
| 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-LRerWkkgeHOGhsvLM5mWaX" '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 | |||||
| NFData UsedArguments Source # | |||||
Defined in Clash.Primitives.Types Methods rnf :: UsedArguments -> () | |||||
| Generic UsedArguments Source # | |||||
Defined in Clash.Primitives.Types Associated Types
| |||||
| Show UsedArguments Source # | |||||
Defined in Clash.Primitives.Types Methods showsPrec :: Int -> UsedArguments -> ShowS # show :: UsedArguments -> String # showList :: [UsedArguments] -> ShowS # | |||||
| Eq UsedArguments Source # | |||||
Defined in Clash.Primitives.Types Methods (==) :: UsedArguments -> UsedArguments -> Bool # (/=) :: UsedArguments -> UsedArguments -> Bool # | |||||
| 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-LRerWkkgeHOGhsvLM5mWaX" '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.