Copyright | (C) 2012-2016 University of Twente 2017 Myrtle Software Ltd 2017-2018 Google Inc. 2020-2023 QBayLogic B.V. 2022-2023 Google Inc. |
---|---|
License | BSD2 (see the file LICENSE) |
Maintainer | QBayLogic B.V. <devops@qbaylogic.com> |
Safe Haskell | None |
Language | Haskell2010 |
Type and instance definitions for Netlist modules
Synopsis
- data Declaration where
- Assignment !Identifier !Usage !Expr
- CondAssignment !Identifier !HWType !Expr !HWType [(Maybe Literal, Expr)]
- InstDecl EntityOrComponent (Maybe Text) [Attr Text] !Identifier !Identifier [(Expr, HWType, Expr)] PortMap
- BlackBoxD !Text [BlackBoxTemplate] [BlackBoxTemplate] [((Text, Text), BlackBox)] !BlackBox BlackBoxContext
- CompDecl !Text [(Text, PortDirection, HWType)]
- NetDecl' (Maybe Comment) !Identifier HWType (Maybe Expr)
- TickDecl CommentOrDirective
- Seq [Seq]
- ConditionalDecl !Text [Declaration]
- pattern NetDecl :: Maybe Comment -> Identifier -> HWType -> Declaration
- type UsageMap = Map Text Usage
- data Usage
- data Blocking
- data PreserveCase
- newtype NetlistMonad a = NetlistMonad {
- runNetlist :: StateT NetlistState (ReaderT NetlistEnv IO) a
- class HasIdentifierSet s where
- class Monad m => IdentifierSetMonad m where
- identifierSetM :: (IdentifierSet -> IdentifierSet) -> m IdentifierSet
- data TopEntityT = TopEntityT {
- topId :: Id
- topAnnotation :: Maybe TopEntity
- topIsTestBench :: Bool
- data BlackBox
- data Expr
- = Literal !(Maybe (HWType, Size)) !Literal
- | DataCon !HWType !Modifier [Expr]
- | Identifier !Identifier !(Maybe Modifier)
- | DataTag !HWType !(Either Identifier Identifier)
- | BlackBoxE !Text [BlackBoxTemplate] [BlackBoxTemplate] [((Text, Text), BlackBox)] !BlackBox !BlackBoxContext !Bool
- | ToBv (Maybe Identifier) HWType Expr
- | FromBv (Maybe Identifier) HWType Expr
- | IfThenElse Expr Expr Expr
- | Noop
- data Component = Component {
- componentName :: !Identifier
- inputs :: [(Identifier, HWType)]
- outputs :: [(Usage, (Identifier, HWType), Maybe Expr)]
- declarations :: [Declaration]
- data Declaration
- = Assignment !Identifier !Usage !Expr
- | CondAssignment !Identifier !HWType !Expr !HWType [(Maybe Literal, Expr)]
- | InstDecl EntityOrComponent (Maybe Text) [Attr Text] !Identifier !Identifier [(Expr, HWType, Expr)] PortMap
- | BlackBoxD !Text [BlackBoxTemplate] [BlackBoxTemplate] [((Text, Text), BlackBox)] !BlackBox BlackBoxContext
- | CompDecl !Text [(Text, PortDirection, HWType)]
- | NetDecl' (Maybe Comment) !Identifier HWType (Maybe Expr)
- | TickDecl CommentOrDirective
- | Seq [Seq]
- | ConditionalDecl !Text [Declaration]
- data HWType
- = Void (Maybe HWType)
- | String
- | Integer
- | Bool
- | Bit
- | BitVector !Size
- | Index !Integer
- | Signed !Size
- | Unsigned !Size
- | Vector !Size !HWType
- | MemBlob !Size !Size
- | RTree !Size !HWType
- | Sum !Text [Text]
- | Product !Text (Maybe [Text]) [HWType]
- | SP !Text [(Text, [HWType])]
- | Clock !DomainName
- | ClockN !DomainName
- | Reset !DomainName
- | Enable !DomainName
- | BiDirectional !PortDirection !HWType
- | CustomSP !Text !DataRepr' !Size [(ConstrRepr', Text, [HWType])]
- | CustomSum !Text !DataRepr' !Size [(ConstrRepr', Text)]
- | CustomProduct !Text !DataRepr' !Size (Maybe [Text]) [(FieldAnn, HWType)]
- | Annotated [Attr Text] !HWType
- | KnownDomain !DomainName !Integer !ActiveEdge !ResetKind !InitBehavior !ResetPolarity
- | FileType
- data IdentifierSet = IdentifierSet {
- is_allowEscaped :: !Bool
- is_lowerCaseBasicIds :: !PreserveCase
- is_hdl :: !HDL
- is_freshCache :: !FreshCache
- is_store :: !(HashSet Identifier)
- data Identifier
- = RawIdentifier !Text (Maybe Identifier) !CallStack
- | UniqueIdentifier {
- i_baseName :: !Text
- i_baseNameCaseFold :: !Text
- i_extensionsRev :: [Word]
- i_idType :: !IdentifierType
- i_hdl :: !HDL
- i_provenance :: !CallStack
- data IdentifierType
- data DeclarationType
- data NetlistId
- data TemplateFunction where
- TemplateFunction :: [Int] -> (BlackBoxContext -> Bool) -> (forall s. Backend s => BlackBoxContext -> State s Doc) -> TemplateFunction
- type BBHash = Int
- type BBName = String
- data BlackBoxContext = Context {
- bbName :: Text
- bbResults :: [(Expr, HWType)]
- bbInputs :: [(Expr, HWType, Bool)]
- bbFunctions :: IntMap [(Either BlackBox (Identifier, [Declaration]), Usage, [BlackBoxTemplate], [BlackBoxTemplate], [((Text, Text), BlackBox)], BlackBoxContext)]
- bbQsysIncName :: [IdentifierText]
- bbLevel :: Int
- bbCompName :: Identifier
- bbCtxName :: Maybe IdentifierText
- data Bit
- data Literal
- data Modifier
- data PortDirection
- data EntityOrComponent
- data Seq
- = AlwaysClocked ActiveEdge Expr [Seq]
- | Initial [Seq]
- | AlwaysComb [Seq]
- | SeqDecl Declaration
- | Branch !Expr !HWType [(Maybe Literal, [Seq])]
- data PortMap
- = IndexedPortMap [(PortDirection, HWType, Expr)]
- | NamedPortMap [(Expr, PortDirection, HWType, Expr)]
- type DomainName = Text
- data FilteredHWType = FilteredHWType HWType [[(IsVoid, FilteredHWType)]]
- type IsVoid = Bool
- type Size = Int
- data CommentOrDirective
- type Directive = Text
- type Comment = Text
- data SomeBackend where
- SomeBackend :: Backend backend => backend -> SomeBackend
- data ComponentPrefix = ComponentPrefix {}
- data NetlistState = NetlistState {
- _bindings :: BindingMap
- _components :: ComponentMap
- _typeTranslator :: CustomReprs -> TyConMap -> Type -> State HWMap (Maybe (Either String FilteredHWType))
- _curCompNm :: !(Identifier, SrcSpan)
- _seenIds :: IdentifierSet
- _seenComps :: IdentifierSet
- _seenPrimitives :: Set Text
- _componentNames :: VarEnv Identifier
- _topEntityAnns :: VarEnv TopEntityT
- _hdlDir :: FilePath
- _curBBlvl :: Int
- _isTestBench :: Bool
- _backEndITE :: Bool
- _backend :: SomeBackend
- _htyCache :: HWMap
- _usages :: UsageMap
- type ComponentMap = OMap Unique (ComponentMeta, Component)
- data ComponentMeta = ComponentMeta {
- cmWereVoids :: [Bool]
- cmLoc :: SrcSpan
- cmScope :: IdentifierSet
- cmUsage :: UsageMap
- data NetlistEnv = NetlistEnv {
- _clashEnv :: ClashEnv
- _prefixName :: Text
- _suffixName :: Text
- _setName :: Maybe Text
- type IdentifierText = Text
- type FreshCache = HashMap Text (IntMap Word)
- type HWMap = Map Type (Either String FilteredHWType)
- data ExpandedPortName a
- data ExpandedTopEntity a = ExpandedTopEntity {
- et_inputs :: [Maybe (ExpandedPortName a)]
- et_output :: Maybe (ExpandedPortName a)
- pattern NetDecl :: Maybe Comment -> Identifier -> HWType -> Declaration
- identifierKey# :: Identifier -> ((Text, Bool), [Word])
- isBiDirectional :: (Identifier, HWType) -> Bool
- findClocks :: Component -> [(Text, Text)]
- annotated :: [Attr Text] -> HWType -> HWType
- hwTypeDomain :: HWType -> Maybe DomainName
- hwTypeAttrs :: HWType -> [Attr Text]
- lookupUsage :: Identifier -> UsageMap -> Maybe Usage
- isConstExpr :: Expr -> Bool
- toBit :: Integer -> Integer -> Bit
- netlistId1 :: HasCallStack => (Identifier -> r) -> (Id -> r) -> NetlistId -> r
- netlistTypes :: NetlistId -> [Type]
- netlistTypes1 :: HasCallStack => NetlistId -> Type
- emptyBBContext :: Text -> BlackBoxContext
- clashEnv :: Lens' NetlistEnv ClashEnv
- prefixName :: Lens' NetlistEnv Text
- setName :: Lens' NetlistEnv (Maybe Text)
- suffixName :: Lens' NetlistEnv Text
- backEndITE :: Lens' NetlistState Bool
- backend :: Lens' NetlistState SomeBackend
- bindings :: Lens' NetlistState BindingMap
- componentNames :: Lens' NetlistState (VarEnv Identifier)
- components :: Lens' NetlistState ComponentMap
- curBBlvl :: Lens' NetlistState Int
- curCompNm :: Lens' NetlistState (Identifier, SrcSpan)
- hdlDir :: Lens' NetlistState FilePath
- htyCache :: Lens' NetlistState HWMap
- isTestBench :: Lens' NetlistState Bool
- seenComps :: Lens' NetlistState IdentifierSet
- seenIds :: Lens' NetlistState IdentifierSet
- seenPrimitives :: Lens' NetlistState (Set Text)
- topEntityAnns :: Lens' NetlistState (VarEnv TopEntityT)
- typeTranslator :: Lens' NetlistState (CustomReprs -> TyConMap -> Type -> State HWMap (Maybe (Either String FilteredHWType)))
- usages :: Lens' NetlistState UsageMap
- intWidth :: Getter NetlistEnv Int
- customReprs :: Getter NetlistEnv CustomReprs
- tcCache :: Getter NetlistEnv TyConMap
- primitives :: Getter NetlistEnv CompiledPrimMap
- clashOpts :: Getter NetlistEnv ClashOpts
Documentation
data Declaration Source #
Internals of a Component
Assignment | Signal assignment |
| |
CondAssignment | Conditional signal assignment: |
InstDecl | Instantiation of another component: |
| |
BlackBoxD | Instantiation of blackbox declaration |
| |
CompDecl !Text [(Text, PortDirection, HWType)] |
See this tutorial; refer to §4.5 of IEEE 1076-1993 |
NetDecl' | Signal declaration |
TickDecl CommentOrDirective | HDL tick corresponding to a Core tick |
Seq [Seq] | Sequential statement |
ConditionalDecl | Compilation conditional on some preprocessor symbol, note that declarations here are ignored for VHDL. See here for a discussion https://github.com/clash-lang/clash-compiler/pull/1798#discussion_r648571862 |
|
pattern NetDecl | |
|
Instances
Show Declaration Source # | |
Defined in Clash.Netlist.Types | |
NFData Declaration Source # | |
Defined in Clash.Netlist.Types rnf :: Declaration -> () Source # |
The usage of a signal refers to how the signal is written to in netlist.
This is used to determine if the signal should be a wire
or reg
in
(System)Verilog, or a signal
or variable
in VHDL.
Cont | Continuous assignment, which occurs in a concurrent context. |
Proc Blocking | Procedural assignment, which occurs in a sequential context. |
Instances
Eq Usage Source # | |
Show Usage Source # | |
Generic Usage Source # | |
Semigroup Usage Source # | |
Hashable Usage Source # | |
FromJSON Usage Source # | |
Binary Usage Source # | |
NFData Usage Source # | |
Defined in Clash.Netlist.Types | |
type Rep Usage Source # | |
Defined in Clash.Netlist.Types type Rep Usage = D1 ('MetaData "Usage" "Clash.Netlist.Types" "clash-lib-1.8.1-inplace" 'False) (C1 ('MetaCons "Cont" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Proc" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Blocking))) |
Procedural assignment in HDL can be blocking or non-blocking. This determines when the assignment takes place in simulation. The name refers to whether evaluation of the remaining statements in a process is blocked until the assignment is performed or not.
See Also:
IEEE 1364-2001, sections 9.2.1 and 9.2.2 IEEE 1076-1993, sections 8.4 and 8.5
NonBlocking | A non-blocking assignment means the new value is not observed until the next time step in simulation. Using the signal later in the process will continue to return the old value. |
Blocking | A blocking assignment means the new value is observed immediately. Using the signal later in the process will return the new value. |
data PreserveCase Source #
Whether to preserve casing in ids or converted everything to lowercase. Influenced by '-fclash-lower-case-basic-identifiers'
Instances
Eq PreserveCase Source # | |
Defined in Clash.Netlist.Types (==) :: PreserveCase -> PreserveCase -> Bool Source # (/=) :: PreserveCase -> PreserveCase -> Bool Source # | |
Show PreserveCase Source # | |
Defined in Clash.Netlist.Types | |
Generic PreserveCase Source # | |
Defined in Clash.Netlist.Types from :: PreserveCase -> Rep PreserveCase x Source # to :: Rep PreserveCase x -> PreserveCase Source # | |
Hashable PreserveCase Source # | |
Defined in Clash.Netlist.Types hashWithSalt :: Int -> PreserveCase -> Int Source # hash :: PreserveCase -> Int Source # | |
Binary PreserveCase Source # | |
Defined in Clash.Netlist.Types put :: PreserveCase -> Put Source # get :: Get PreserveCase Source # putList :: [PreserveCase] -> Put Source # | |
NFData PreserveCase Source # | |
Defined in Clash.Netlist.Types rnf :: PreserveCase -> () Source # | |
type Rep PreserveCase Source # | |
newtype NetlistMonad a Source #
Monad that caches generated components (StateT) and remembers hidden inputs of components that are being generated (WriterT)
Instances
class HasIdentifierSet s where Source #
Structures that hold an IdentifierSet
Instances
HasIdentifierSet IdentifierSet Source # | |
Defined in Clash.Netlist.Types | |
HasIdentifierSet VerilogState Source # | |
Defined in Clash.Backend.Verilog | |
HasIdentifierSet VHDLState Source # | |
Defined in Clash.Backend.VHDL | |
HasIdentifierSet SystemVerilogState Source # | |
Backend backend => HasIdentifierSet (BlockState backend) Source # | |
Defined in Clash.Primitives.DSL identifierSet :: Lens' (BlockState backend) IdentifierSet Source # | |
HasIdentifierSet s => HasIdentifierSet (s, a) Source # | |
Defined in Clash.Netlist.Types identifierSet :: Lens' (s, a) IdentifierSet Source # |
class Monad m => IdentifierSetMonad m where Source #
An IdentifierSetMonad supports unique name generation for Clash Netlist
identifierSetM :: (IdentifierSet -> IdentifierSet) -> m IdentifierSet Source #
Instances
IdentifierSetMonad NetlistMonad Source # | |
Defined in Clash.Netlist.Types | |
HasIdentifierSet s => IdentifierSetMonad (State s) Source # | |
Defined in Clash.Netlist.Types identifierSetM :: (IdentifierSet -> IdentifierSet) -> State s IdentifierSet Source # | |
HasIdentifierSet s => IdentifierSetMonad (State s) Source # | |
Defined in Clash.Netlist.Types identifierSetM :: (IdentifierSet -> IdentifierSet) -> State s IdentifierSet Source # | |
IdentifierSetMonad m => IdentifierSetMonad (Ap m) Source # | |
Defined in Clash.Netlist.Types identifierSetM :: (IdentifierSet -> IdentifierSet) -> Ap m IdentifierSet Source # |
data TopEntityT Source #
Structure describing a top entity: it's id and its port annotations.
TopEntityT | |
|
Instances
Instances
Show BlackBox Source # | |
Generic BlackBox Source # | |
Binary BlackBox Source # | |
NFData BlackBox Source # | |
Defined in Clash.Netlist.Types | |
type Rep BlackBox Source # | |
Defined in Clash.Netlist.Types type Rep BlackBox = D1 ('MetaData "BlackBox" "Clash.Netlist.Types" "clash-lib-1.8.1-inplace" 'False) (C1 ('MetaCons "BBTemplate" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BlackBoxTemplate)) :+: C1 ('MetaCons "BBFunction" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BBName) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BBHash) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TemplateFunction)))) |
Expression used in RHS of a declaration
Literal !(Maybe (HWType, Size)) !Literal | Literal expression |
DataCon !HWType !Modifier [Expr] | DataCon application |
Identifier !Identifier !(Maybe Modifier) | Signal reference |
DataTag !HWType !(Either Identifier Identifier) |
|
BlackBoxE | Instantiation of a BlackBox expression |
| |
ToBv | Convert some type to a BitVector. |
| |
FromBv | Convert BitVector to some type. |
| |
IfThenElse Expr Expr Expr | |
Noop | Do nothing |
Component: base unit of a Netlist
Component | |
|
Instances
Show Component Source # | |
Generic Component Source # | |
NFData Component Source # | |
Defined in Clash.Netlist.Types | |
type Rep Component Source # | |
Defined in Clash.Netlist.Types type Rep Component = D1 ('MetaData "Component" "Clash.Netlist.Types" "clash-lib-1.8.1-inplace" 'False) (C1 ('MetaCons "Component" 'PrefixI 'True) ((S1 ('MetaSel ('Just "componentName") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Identifier) :*: S1 ('MetaSel ('Just "inputs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(Identifier, HWType)])) :*: (S1 ('MetaSel ('Just "outputs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(Usage, (Identifier, HWType), Maybe Expr)]) :*: S1 ('MetaSel ('Just "declarations") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Declaration])))) |
data Declaration Source #
Internals of a Component
Assignment | Signal assignment |
| |
CondAssignment | Conditional signal assignment: |
InstDecl | Instantiation of another component: |
| |
BlackBoxD | Instantiation of blackbox declaration |
| |
CompDecl !Text [(Text, PortDirection, HWType)] |
See this tutorial; refer to §4.5 of IEEE 1076-1993 |
NetDecl' | Signal declaration |
TickDecl CommentOrDirective | HDL tick corresponding to a Core tick |
Seq [Seq] | Sequential statement |
ConditionalDecl | Compilation conditional on some preprocessor symbol, note that declarations here are ignored for VHDL. See here for a discussion https://github.com/clash-lang/clash-compiler/pull/1798#discussion_r648571862 |
|
Instances
Show Declaration Source # | |
Defined in Clash.Netlist.Types | |
NFData Declaration Source # | |
Defined in Clash.Netlist.Types rnf :: Declaration -> () Source # |
Representable hardware types
Void (Maybe HWType) | Empty type. |
String | String type |
Integer | Integer type (for parameters only) |
Bool | Boolean type |
Bit | Bit type |
BitVector !Size | BitVector of a specified size |
Index !Integer | Unsigned integer with specified (exclusive) upper bounder |
Signed !Size | Signed integer of a specified size |
Unsigned !Size | Unsigned integer of a specified size |
Vector !Size !HWType | Vector type |
MemBlob !Size !Size | MemBlob type |
RTree !Size !HWType | RTree type |
Sum !Text [Text] | Sum type: Name and Constructor names |
Product !Text (Maybe [Text]) [HWType] | Product type: Name, field names, and field types. Field names will be populated when using records. |
SP !Text [(Text, [HWType])] | Sum-of-Product type: Name and Constructor names + field types |
Clock !DomainName | Clock type corresponding to domain DomainName |
ClockN !DomainName | ClockN type corresponding to domain DomainName |
Reset !DomainName | Reset type corresponding to domain DomainName |
Enable !DomainName | Enable type corresponding to domain DomainName |
BiDirectional !PortDirection !HWType | Tagging type indicating a bidirectional (inout) port |
CustomSP !Text !DataRepr' !Size [(ConstrRepr', Text, [HWType])] | Same as Sum-Of-Product, but with a user specified bit representation. For more info, see: Clash.Annotations.BitRepresentations. |
CustomSum !Text !DataRepr' !Size [(ConstrRepr', Text)] | Same as Sum, but with a user specified bit representation. For more info, see: Clash.Annotations.BitRepresentations. |
CustomProduct !Text !DataRepr' !Size (Maybe [Text]) [(FieldAnn, HWType)] | Same as Product, but with a user specified bit representation. For more info, see: Clash.Annotations.BitRepresentations. |
Annotated [Attr Text] !HWType | Annotated with HDL attributes |
KnownDomain !DomainName !Integer !ActiveEdge !ResetKind !InitBehavior !ResetPolarity | Domain name, period, active edge, reset kind, initial value behavior |
FileType | File type for simulation-level I/O |
Instances
data IdentifierSet Source #
A collection of unique identifiers. Allows for fast fresh identifier generation.
NB: use the functions in Clash.Netlist.Id. Don't use the constructor directly.
IdentifierSet | |
|
Instances
data Identifier Source #
HDL identifier. Consists of a base name and a number of extensions. An identifier with a base name of "foo" and a list of extensions [1, 2] will be rendered as "foo_1_2".
Note: The Eq instance of Identifier is case insensitive! E.g., two
identifiers with base names fooBar
and FoObAR
are considered the same.
However, identifiers are stored case preserving. This means Clash won't
generate two identifiers with differing case, but it will try to keep
capitalization.
The goal of this data structure is to greatly simplify how Clash deals with identifiers internally. Any Identifier should be trivially printable to any HDL.
NB: use the functions in Clash.Netlist.Id. Don't use these constructors directly.
RawIdentifier | Unparsed identifier. Used for things such as port names, which should appear in the HDL exactly as the user specified. |
| |
UniqueIdentifier | Parsed and sanitized identifier. See various fields for more information on its invariants. |
|
Instances
data IdentifierType Source #
Basic | A basic identifier: does not have to be escaped in order to be a valid identifier in HDL. |
Extended | An extended identifier: has to be escaped, wrapped, or otherwise postprocessed before writhing it to HDL. |
Instances
Eq IdentifierType Source # | |
Defined in Clash.Netlist.Types (==) :: IdentifierType -> IdentifierType -> Bool Source # (/=) :: IdentifierType -> IdentifierType -> Bool Source # | |
Show IdentifierType Source # | |
Defined in Clash.Netlist.Types | |
Generic IdentifierType Source # | |
Defined in Clash.Netlist.Types from :: IdentifierType -> Rep IdentifierType x Source # to :: Rep IdentifierType x -> IdentifierType Source # | |
NFData IdentifierType Source # | |
Defined in Clash.Netlist.Types rnf :: IdentifierType -> () Source # | |
type Rep IdentifierType Source # | |
Netlist-level identifier
NetlistId Identifier Type | Identifier generated in the NetlistMonad, always derived from another
|
CoreId Id | An original Core identifier |
MultiId [Id] | A split identifier (into several sub-identifiers), needed to assign expressions of types that have to be split apart (e.g. tuples of Files) |
data TemplateFunction where Source #
TemplateFunction | |
|
Instances
Binary TemplateFunction Source # | NB: serialisation doesn't preserve the embedded function |
Defined in Clash.Netlist.Types put :: TemplateFunction -> Put Source # get :: Get TemplateFunction Source # putList :: [TemplateFunction] -> Put Source # | |
NFData TemplateFunction Source # | |
Defined in Clash.Netlist.Types rnf :: TemplateFunction -> () Source # |
data BlackBoxContext Source #
Context used to fill in the holes of a BlackBox template
Context | |
|
Instances
Show BlackBoxContext Source # | |
Defined in Clash.Netlist.Types |
Literals used in an expression
NumLit !Integer | Number literal |
BitLit !Bit | Bit literal |
BitVecLit !Integer !Integer | BitVector literal |
BoolLit !Bool | Boolean literal |
VecLit [Literal] | Vector literal |
StringLit !String | String literal |
Expression Modifier
Indexed (HWType, Int, Int) | Index the expression: (Type of expression, DataCon tag, Field Tag). Note that the type of the expression is the type we are slicing from, not the type returned by the index operation. |
DC (HWType, Int) | See expression in a DataCon context: (Type of the expression, DataCon tag) |
VecAppend | See the expression in the context of a Vector append operation |
RTreeAppend | See the expression in the context of a Tree append operation |
Sliced (HWType, Int, Int) | Slice the identifier of the given type from start to end |
Nested Modifier Modifier |
data PortDirection Source #
Instances
data EntityOrComponent Source #
Instances
Show EntityOrComponent Source # | |
Defined in Clash.Netlist.Types |
Sequential statements
AlwaysClocked | Clocked sequential statements |
Initial [Seq] | Statements to run at simulator start | Statements to run always |
AlwaysComb [Seq] | Statements to run always | Declaration in sequential form |
SeqDecl Declaration | The declaration | Branching statement |
Branch | |
Specifies how to wire up a component instance
IndexedPortMap [(PortDirection, HWType, Expr)] | Port map based on port positions (port direction, type, assignment) HDL Example: bytemaster bytemaster_ds ( clk_1 , rst_1 , bitCtrl_0 ); |
NamedPortMap [(Expr, PortDirection, HWType, Expr)] | Port map based on port names (port name, port direction, type, assignment) HDL Example: bytemaster bytemaster_ds ( .clk (clk_1) , .rst (rst_1) , .bitCtrl (bitCtrl_0) ); |
type DomainName = Text Source #
data FilteredHWType Source #
Tree structure indicating which constructor fields were filtered from a type due to them being void. We need this information to generate stable and/or user-defined port mappings.
FilteredHWType HWType [[(IsVoid, FilteredHWType)]] |
Instances
Eq FilteredHWType Source # | |
Defined in Clash.Netlist.Types (==) :: FilteredHWType -> FilteredHWType -> Bool Source # (/=) :: FilteredHWType -> FilteredHWType -> Bool Source # | |
Show FilteredHWType Source # | |
Defined in Clash.Netlist.Types |
data CommentOrDirective Source #
Instances
Show CommentOrDirective Source # | |
Defined in Clash.Netlist.Types |
data SomeBackend where Source #
Existentially quantified backend
SomeBackend :: Backend backend => backend -> SomeBackend |
data ComponentPrefix Source #
ComponentPrefix | |
|
Instances
Show ComponentPrefix Source # | |
Defined in Clash.Netlist.Types |
data NetlistState Source #
State of the NetlistMonad
NetlistState | |
|
Instances
HasUsageMap NetlistState Source # | |
Defined in Clash.Netlist.Types | |
MonadState NetlistState NetlistMonad Source # | |
Defined in Clash.Netlist.Types get :: NetlistMonad NetlistState Source # put :: NetlistState -> NetlistMonad () Source # state :: (NetlistState -> (a, NetlistState)) -> NetlistMonad a Source # |
type ComponentMap = OMap Unique (ComponentMeta, Component) Source #
data ComponentMeta Source #
ComponentMeta | |
|
Instances
Show ComponentMeta Source # | |
Defined in Clash.Netlist.Types | |
Generic ComponentMeta Source # | |
Defined in Clash.Netlist.Types from :: ComponentMeta -> Rep ComponentMeta x Source # to :: Rep ComponentMeta x -> ComponentMeta Source # | |
NFData ComponentMeta Source # | |
Defined in Clash.Netlist.Types rnf :: ComponentMeta -> () Source # | |
type Rep ComponentMeta Source # | |
Defined in Clash.Netlist.Types type Rep ComponentMeta = D1 ('MetaData "ComponentMeta" "Clash.Netlist.Types" "clash-lib-1.8.1-inplace" 'False) (C1 ('MetaCons "ComponentMeta" 'PrefixI 'True) ((S1 ('MetaSel ('Just "cmWereVoids") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Bool]) :*: S1 ('MetaSel ('Just "cmLoc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SrcSpan)) :*: (S1 ('MetaSel ('Just "cmScope") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 IdentifierSet) :*: S1 ('MetaSel ('Just "cmUsage") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UsageMap)))) |
data NetlistEnv Source #
Environment of the NetlistMonad
NetlistEnv | |
|
Instances
MonadReader NetlistEnv NetlistMonad Source # | |
Defined in Clash.Netlist.Types ask :: NetlistMonad NetlistEnv Source # local :: (NetlistEnv -> NetlistEnv) -> NetlistMonad a -> NetlistMonad a Source # reader :: (NetlistEnv -> a) -> NetlistMonad a Source # |
type IdentifierText = Text Source #
type FreshCache = HashMap Text (IntMap Word) Source #
See is_freshCache
data ExpandedPortName a Source #
ExpandedPortName HWType a | Same as PortName, but fully expanded |
ExpandedPortProduct | Same as PortProduct, but fully expanded |
|
Instances
data ExpandedTopEntity a Source #
Same as TopEntity, but with all port names that end up in HDL specified
ExpandedTopEntity | |
|
Instances
:: Maybe Comment | Note; will be inserted as a comment in target hdl |
-> Identifier | Name of signal |
-> HWType | Type of signal |
-> Declaration |
identifierKey# :: Identifier -> ((Text, Bool), [Word]) Source #
isBiDirectional :: (Identifier, HWType) -> Bool Source #
Check if an input port is really an inout port.
findClocks :: Component -> [(Text, Text)] Source #
Find the name and domain name of each clock argument of a component.
This will not consider ClockN
to be a clock argument, which means only the
positive phase of a differential pair will be added to sdcClock
.
hwTypeDomain :: HWType -> Maybe DomainName Source #
hwTypeAttrs :: HWType -> [Attr Text] Source #
Extract hardware attributes from Annotated. Returns an empty list if non-Annotated given or if Annotated has an empty list of attributes.
lookupUsage :: Identifier -> UsageMap -> Maybe Usage Source #
isConstExpr :: Expr -> Bool Source #
:: HasCallStack | |
=> (Identifier -> r) | Eliminator for Identifiers generated in the NetlistMonad |
-> (Id -> r) | Eliminator for original Core Identifiers |
-> NetlistId | |
-> r |
netlistTypes :: NetlistId -> [Type] Source #
Return the type(s) of a NetListId
, returns multiple types when given a
MultiId
netlistTypes1 :: HasCallStack => NetlistId -> Type Source #
emptyBBContext :: Text -> BlackBoxContext Source #
typeTranslator :: Lens' NetlistState (CustomReprs -> TyConMap -> Type -> State HWMap (Maybe (Either String FilteredHWType))) Source #
customReprs :: Getter NetlistEnv CustomReprs Source #