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 | Safe-Inferred |
Language | Haskell2010 |
Clash.Netlist.Types
Description
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 Size = Int
- data Bit
- data Seq
- = AlwaysClocked ActiveEdge Expr [Seq]
- | Initial [Seq]
- | AlwaysComb [Seq]
- | SeqDecl Declaration
- | Branch !Expr !HWType [(Maybe Literal, [Seq])]
- 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 Usage
- data Literal
- type Comment = Text
- 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 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)
- class HasIdentifierSet s where
- type UsageMap = Map Text Usage
- type IdentifierText = Text
- data BlackBox
- data FilteredHWType = FilteredHWType HWType [[(IsVoid, FilteredHWType)]]
- type HWMap = Map Type (Either String FilteredHWType)
- data SomeBackend where
- SomeBackend :: Backend backend => backend -> SomeBackend
- data TopEntityT = TopEntityT {
- topId :: Id
- topAnnotation :: Maybe TopEntity
- topIsTestBench :: Bool
- data TemplateFunction where
- TemplateFunction :: [Int] -> (BlackBoxContext -> Bool) -> (forall s. Backend s => BlackBoxContext -> State s Doc) -> TemplateFunction
- type ComponentMap = OMap Unique (ComponentMeta, Component)
- data ComponentMeta = ComponentMeta {
- cmWereVoids :: [Bool]
- cmLoc :: SrcSpan
- cmScope :: IdentifierSet
- cmUsage :: UsageMap
- data PreserveCase
- newtype NetlistMonad a = NetlistMonad {
- runNetlist :: StateT NetlistState (ReaderT NetlistEnv IO) a
- 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 Modifier
- class Monad m => IdentifierSetMonad m where
- identifierSetM :: (IdentifierSet -> IdentifierSet) -> m IdentifierSet
- data IdentifierType
- type FreshCache = HashMap Text (IntMap Word)
- data NetlistId
- data DeclarationType
- data CommentOrDirective
- data Blocking
- data ExpandedTopEntity a = ExpandedTopEntity {
- et_inputs :: [Maybe (ExpandedPortName a)]
- et_output :: Maybe (ExpandedPortName a)
- data ExpandedPortName a
- 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
- data NetlistEnv = NetlistEnv {
- _clashEnv :: ClashEnv
- _prefixName :: Text
- _suffixName :: Text
- _setName :: Maybe Text
- data ComponentPrefix = ComponentPrefix {}
- type Directive = Text
- type IsVoid = Bool
- type DomainName = Text
- data PortDirection
- data PortMap
- = IndexedPortMap [(PortDirection, HWType, Expr)]
- | NamedPortMap [(Expr, PortDirection, HWType, Expr)]
- data EntityOrComponent
- type BBName = String
- type BBHash = Int
- pattern NetDecl :: Maybe Comment -> Identifier -> HWType -> Declaration
- backend :: Lens' NetlistState SomeBackend
- prefixName :: Lens' NetlistEnv Text
- suffixName :: Lens' NetlistEnv Text
- setName :: Lens' NetlistEnv (Maybe Text)
- components :: Lens' NetlistState ComponentMap
- intWidth :: Getter NetlistEnv Int
- usages :: Lens' NetlistState UsageMap
- findClocks :: Component -> [(Text, Text)]
- hwTypeDomain :: HWType -> Maybe DomainName
- bindings :: Lens' NetlistState BindingMap
- tcCache :: Getter NetlistEnv TyConMap
- customReprs :: Getter NetlistEnv CustomReprs
- typeTranslator :: Lens' NetlistState (CustomReprs -> TyConMap -> Type -> State HWMap (Maybe (Either String FilteredHWType)))
- primitives :: Getter NetlistEnv CompiledPrimMap
- toBit :: Integer -> Integer -> Bit
- curCompNm :: Lens' NetlistState (Identifier, SrcSpan)
- emptyBBContext :: Text -> BlackBoxContext
- identifierKey# :: Identifier -> ((Text, Bool), [Word])
- isBiDirectional :: (Identifier, HWType) -> Bool
- annotated :: [Attr Text] -> HWType -> HWType
- hwTypeAttrs :: HWType -> [Attr Text]
- lookupUsage :: Identifier -> UsageMap -> Maybe Usage
- isConstExpr :: Expr -> Bool
- netlistId1 :: HasCallStack => (Identifier -> r) -> (Id -> r) -> NetlistId -> r
- netlistTypes :: NetlistId -> [Type]
- netlistTypes1 :: HasCallStack => NetlistId -> Type
- clashEnv :: Lens' NetlistEnv ClashEnv
- clashOpts :: Getter NetlistEnv ClashOpts
- seenIds :: Lens' NetlistState IdentifierSet
- backEndITE :: Lens' NetlistState Bool
- componentNames :: Lens' NetlistState (VarEnv Identifier)
- curBBlvl :: Lens' NetlistState Int
- hdlDir :: Lens' NetlistState FilePath
- htyCache :: Lens' NetlistState HWMap
- isTestBench :: Lens' NetlistState Bool
- seenComps :: Lens' NetlistState IdentifierSet
- seenPrimitives :: Lens' NetlistState (Set Text)
- topEntityAnns :: Lens' NetlistState (VarEnv TopEntityT)
Documentation
data Declaration Source #
Internals of a Component
Constructors
Assignment | Signal assignment |
Fields
| |
CondAssignment | Conditional signal assignment: |
InstDecl | Instantiation of another component: |
Fields
| |
BlackBoxD | Instantiation of blackbox declaration |
Fields
| |
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 |
Fields
|
Bundled Patterns
pattern NetDecl | |
Fields
|
Instances
Show Declaration Source # | |
Defined in Clash.Netlist.Types | |
NFData Declaration Source # | |
Defined in Clash.Netlist.Types Methods rnf :: Declaration -> () Source # |
Sequential statements
Constructors
AlwaysClocked | Clocked sequential statements |
Fields
| |
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 | |
Expression used in RHS of a declaration
Constructors
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 |
Fields
| |
ToBv | Convert some type to a BitVector. |
Fields
| |
FromBv | Convert BitVector to some type. |
Fields
| |
IfThenElse Expr Expr Expr | |
Noop | Do nothing |
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.
Constructors
Cont | Continuous assignment, which occurs in a concurrent context. |
Proc Blocking | Procedural assignment, which occurs in a sequential context. |
Instances
FromJSON Usage Source # | |
Semigroup Usage Source # | |
Generic Usage Source # | |
Show Usage Source # | |
Binary Usage Source # | |
NFData Usage Source # | |
Defined in Clash.Netlist.Types | |
Eq Usage Source # | |
Hashable Usage Source # | |
type Rep Usage Source # | |
Defined in Clash.Netlist.Types type Rep Usage = D1 ('MetaData "Usage" "Clash.Netlist.Types" "clash-lib-1.8.1-2YrsOtauO5B4MB9KvGiYOL" 'False) (C1 ('MetaCons "Cont" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Proc" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Blocking))) |
Literals used in an expression
Constructors
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 |
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.
Constructors
RawIdentifier | Unparsed identifier. Used for things such as port names, which should appear in the HDL exactly as the user specified. |
Fields
| |
UniqueIdentifier | Parsed and sanitized identifier. See various fields for more information on its invariants. |
Fields
|
Instances
Component: base unit of a Netlist
Constructors
Component | |
Fields
|
Instances
Generic Component Source # | |
Show 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-2YrsOtauO5B4MB9KvGiYOL" '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
Constructors
Assignment | Signal assignment |
Fields
| |
CondAssignment | Conditional signal assignment: |
InstDecl | Instantiation of another component: |
Fields
| |
BlackBoxD | Instantiation of blackbox declaration |
Fields
| |
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 |
Fields
|
Instances
Show Declaration Source # | |
Defined in Clash.Netlist.Types | |
NFData Declaration Source # | |
Defined in Clash.Netlist.Types Methods rnf :: Declaration -> () Source # |
Representable hardware types
Constructors
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.
Constructors
IdentifierSet | |
Fields
|
Instances
class HasIdentifierSet s where Source #
Structures that hold an IdentifierSet
Methods
Instances
HasIdentifierSet SystemVerilogState Source # | |
Defined in Clash.Backend.SystemVerilog Methods identifierSet :: Lens' SystemVerilogState IdentifierSet Source # | |
HasIdentifierSet VHDLState Source # | |
Defined in Clash.Backend.VHDL Methods | |
HasIdentifierSet VerilogState Source # | |
Defined in Clash.Backend.Verilog Methods | |
HasIdentifierSet IdentifierSet Source # | |
Defined in Clash.Netlist.Types Methods | |
Backend backend => HasIdentifierSet (BlockState backend) Source # | |
Defined in Clash.Primitives.DSL Methods identifierSet :: Lens' (BlockState backend) IdentifierSet Source # | |
HasIdentifierSet s => HasIdentifierSet (s, a) Source # | |
Defined in Clash.Netlist.Types Methods identifierSet :: Lens' (s, a) IdentifierSet Source # |
type IdentifierText = Text Source #
Constructors
BBTemplate BlackBoxTemplate | |
BBFunction BBName BBHash TemplateFunction |
Instances
Generic BlackBox Source # | |
Show 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-2YrsOtauO5B4MB9KvGiYOL" '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)))) |
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.
Constructors
FilteredHWType HWType [[(IsVoid, FilteredHWType)]] |
Instances
Show FilteredHWType Source # | |
Defined in Clash.Netlist.Types | |
Eq FilteredHWType Source # | |
Defined in Clash.Netlist.Types Methods (==) :: FilteredHWType -> FilteredHWType -> Bool Source # (/=) :: FilteredHWType -> FilteredHWType -> Bool Source # |
data SomeBackend where Source #
Existentially quantified backend
Constructors
SomeBackend :: Backend backend => backend -> SomeBackend |
data TopEntityT Source #
Structure describing a top entity: it's id and its port annotations.
Constructors
TopEntityT | |
Fields
|
Instances
data TemplateFunction where Source #
Constructors
TemplateFunction | |
Fields
|
Instances
Binary TemplateFunction Source # | NB: serialisation doesn't preserve the embedded function |
Defined in Clash.Netlist.Types Methods put :: TemplateFunction -> Put Source # get :: Get TemplateFunction Source # putList :: [TemplateFunction] -> Put Source # | |
NFData TemplateFunction Source # | |
Defined in Clash.Netlist.Types Methods rnf :: TemplateFunction -> () Source # |
type ComponentMap = OMap Unique (ComponentMeta, Component) Source #
data ComponentMeta Source #
Constructors
ComponentMeta | |
Fields
|
Instances
data PreserveCase Source #
Whether to preserve casing in ids or converted everything to lowercase. Influenced by '-fclash-lower-case-basic-identifiers'
Constructors
PreserveCase | |
ToLower |
Instances
Generic PreserveCase Source # | |
Defined in Clash.Netlist.Types Methods from :: PreserveCase -> Rep PreserveCase x Source # to :: Rep PreserveCase x -> PreserveCase Source # | |
Show PreserveCase Source # | |
Defined in Clash.Netlist.Types | |
Binary PreserveCase Source # | |
Defined in Clash.Netlist.Types Methods put :: PreserveCase -> Put Source # get :: Get PreserveCase Source # putList :: [PreserveCase] -> Put Source # | |
NFData PreserveCase Source # | |
Defined in Clash.Netlist.Types Methods rnf :: PreserveCase -> () Source # | |
Eq PreserveCase Source # | |
Defined in Clash.Netlist.Types Methods (==) :: PreserveCase -> PreserveCase -> Bool Source # (/=) :: PreserveCase -> PreserveCase -> Bool Source # | |
Hashable PreserveCase Source # | |
Defined in Clash.Netlist.Types | |
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)
Constructors
NetlistMonad | |
Fields
|
Instances
data BlackBoxContext Source #
Context used to fill in the holes of a BlackBox template
Constructors
Context | |
Fields
|
Instances
Show BlackBoxContext Source # | |
Defined in Clash.Netlist.Types |
Expression Modifier
Constructors
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 |
class Monad m => IdentifierSetMonad m where Source #
An IdentifierSetMonad supports unique name generation for Clash Netlist
Methods
identifierSetM :: (IdentifierSet -> IdentifierSet) -> m IdentifierSet Source #
Instances
IdentifierSetMonad NetlistMonad Source # | |
Defined in Clash.Netlist.Types Methods identifierSetM :: (IdentifierSet -> IdentifierSet) -> NetlistMonad IdentifierSet Source # | |
HasIdentifierSet s => IdentifierSetMonad (State s) Source # | |
Defined in Clash.Netlist.Types Methods identifierSetM :: (IdentifierSet -> IdentifierSet) -> State s IdentifierSet Source # | |
HasIdentifierSet s => IdentifierSetMonad (State s) Source # | |
Defined in Clash.Netlist.Types Methods identifierSetM :: (IdentifierSet -> IdentifierSet) -> State s IdentifierSet Source # | |
IdentifierSetMonad m => IdentifierSetMonad (Ap m) Source # | |
Defined in Clash.Netlist.Types Methods identifierSetM :: (IdentifierSet -> IdentifierSet) -> Ap m IdentifierSet Source # |
data IdentifierType Source #
Constructors
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
Generic IdentifierType Source # | |
Defined in Clash.Netlist.Types Methods from :: IdentifierType -> Rep IdentifierType x Source # to :: Rep IdentifierType x -> IdentifierType Source # | |
Show IdentifierType Source # | |
Defined in Clash.Netlist.Types | |
NFData IdentifierType Source # | |
Defined in Clash.Netlist.Types Methods rnf :: IdentifierType -> () Source # | |
Eq IdentifierType Source # | |
Defined in Clash.Netlist.Types Methods (==) :: IdentifierType -> IdentifierType -> Bool Source # (/=) :: IdentifierType -> IdentifierType -> Bool Source # | |
type Rep IdentifierType Source # | |
type FreshCache = HashMap Text (IntMap Word) Source #
See is_freshCache
Netlist-level identifier
Constructors
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 DeclarationType Source #
Type of declaration, concurrent or sequential
Constructors
Concurrent | |
Sequential |
data CommentOrDirective Source #
Instances
Show CommentOrDirective Source # | |
Defined in Clash.Netlist.Types |
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
Constructors
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 ExpandedTopEntity a Source #
Same as TopEntity, but with all port names that end up in HDL specified
Constructors
ExpandedTopEntity | |
Fields
|
Instances
data ExpandedPortName a Source #
Constructors
ExpandedPortName HWType a | Same as PortName, but fully expanded |
ExpandedPortProduct | Same as PortProduct, but fully expanded |
Fields
|
Instances
data NetlistState Source #
State of the NetlistMonad
Constructors
NetlistState | |
Fields
|
Instances
HasUsageMap NetlistState Source # | |
Defined in Clash.Netlist.Types | |
MonadState NetlistState NetlistMonad Source # | |
Defined in Clash.Netlist.Types Methods get :: NetlistMonad NetlistState Source # put :: NetlistState -> NetlistMonad () Source # state :: (NetlistState -> (a, NetlistState)) -> NetlistMonad a Source # |
data NetlistEnv Source #
Environment of the NetlistMonad
Constructors
NetlistEnv | |
Fields
|
Instances
MonadReader NetlistEnv NetlistMonad Source # | |
Defined in Clash.Netlist.Types Methods ask :: NetlistMonad NetlistEnv Source # local :: (NetlistEnv -> NetlistEnv) -> NetlistMonad a -> NetlistMonad a Source # reader :: (NetlistEnv -> a) -> NetlistMonad a Source # |
data ComponentPrefix Source #
Constructors
ComponentPrefix | |
Fields
|
Instances
Show ComponentPrefix Source # | |
Defined in Clash.Netlist.Types |
type DomainName = Text Source #
data PortDirection Source #
Instances
Specifies how to wire up a component instance
Constructors
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) ); |
data EntityOrComponent Source #
Instances
Show EntityOrComponent Source # | |
Defined in Clash.Netlist.Types |
Arguments
:: Maybe Comment | Note; will be inserted as a comment in target hdl |
-> Identifier | Name of signal |
-> HWType | Type of signal |
-> Declaration |
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 #
typeTranslator :: Lens' NetlistState (CustomReprs -> TyConMap -> Type -> State HWMap (Maybe (Either String FilteredHWType))) Source #
emptyBBContext :: Text -> BlackBoxContext Source #
identifierKey# :: Identifier -> ((Text, Bool), [Word]) Source #
isBiDirectional :: (Identifier, HWType) -> Bool Source #
Check if an input port is really an inout port.
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 #
Arguments
:: 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 #