CIRCT 24.0.0git
Loading...
Searching...
No Matches
esiaccel.codegen.ports.CppPortKind Class Reference
Collaboration diagram for esiaccel.codegen.ports.CppPortKind:

Public Member Functions

str member_type (self, Optional[str] alias_prefix=None)
str indexed_elem_type (self, Optional[str] alias_prefix=None)
str scalar_find_code (self, str v, str appid_expr)
str indexed_find_code (self, str map_var, str appid_expr)

Public Attributes

str find_style = "ptr":
str indexed_find = "as_ptr":

Static Public Attributes

Optional service_type
Optional member_template
Optional member_ref [str]
Optional indexed_elem
Optional alias_kind [str]
list CPP_PORT_KINDS

Detailed Description

Per-port-kind constants for generating a module's typed port slots.

Holds everything that varies between port kinds in one record.
`member_template` (typed channel/func ports) and `member_ref` (service /
bundle ports) are mutually exclusive. `find_style` / `indexed_find` select
the `connect()` resolution snippet for scalar and indexed ports
respectively; `alias_kind` selects which `using` aliases to emit for the
typed template parameters.

Definition at line 37 of file ports.py.

Member Function Documentation

◆ indexed_elem_type()

str esiaccel.codegen.ports.CppPortKind.indexed_elem_type ( self,
Optional[str] alias_prefix = None )
Return the storage type used inside an `IndexedPorts<T>` for this kind.

Typed ports use the same `TypedFunction<...>` / `TypedReadPort<...>` etc.
that `member_type` produces. MMIO regions, telemetry metrics, and plain
bundle ports are stored as raw pointers because `std::map<int, T&>` is
ill-formed.

Definition at line 81 of file ports.py.

References indexed_elem, and member_type().

◆ indexed_find_code()

str esiaccel.codegen.ports.CppPortKind.indexed_find_code ( self,
str map_var,
str appid_expr )
Render the per-index `try_emplace` body for an `IndexedPorts<T>` group.
Pure function of the kind (golden-tested alongside `scalar_find_code`).

Definition at line 118 of file ports.py.

◆ member_type()

str esiaccel.codegen.ports.CppPortKind.member_type ( self,
Optional[str] alias_prefix = None )
Return the C++ member type string for this kind (no member name).

For typed ports (function/callback/to-host/from-host channels)
`alias_prefix` is required; the returned template parameters are written
using the alias names (`<prefix>Args`, `<prefix>Result`, `<prefix>Data`)
that should be emitted at module-class scope. For non-typed ports (MMIO
regions, telemetry metrics, plain bundles) `alias_prefix` is ignored and
the runtime reference/pointer type is returned directly.

Definition at line 61 of file ports.py.

References member_ref, and member_template.

Referenced by indexed_elem_type().

◆ scalar_find_code()

str esiaccel.codegen.ports.CppPortKind.scalar_find_code ( self,
str v,
str appid_expr )
Render the connect()-body snippet that resolves one scalar port into the
local `v`. Pure function of the kind so it can be golden-tested without a
live accelerator (see `test_port_find_code_golden`).

Definition at line 93 of file ports.py.

Member Data Documentation

◆ alias_kind

Optional esiaccel.codegen.ports.CppPortKind.alias_kind [str]
static

Definition at line 58 of file ports.py.

◆ CPP_PORT_KINDS

list esiaccel.codegen.ports.CppPortKind.CPP_PORT_KINDS
static

Definition at line 149 of file ports.py.

◆ find_style

str esiaccel.codegen.ports.CppPortKind.find_style = "ptr":

Definition at line 97 of file ports.py.

◆ indexed_elem

Optional esiaccel.codegen.ports.CppPortKind.indexed_elem
static
Initial value:
[
str]

Definition at line 56 of file ports.py.

Referenced by indexed_elem_type().

◆ indexed_find

str esiaccel.codegen.ports.CppPortKind.indexed_find = "as_ptr":

Definition at line 121 of file ports.py.

◆ member_ref

Optional esiaccel.codegen.ports.CppPortKind.member_ref [str]
static

Definition at line 55 of file ports.py.

Referenced by member_type().

◆ member_template

Optional esiaccel.codegen.ports.CppPortKind.member_template
static
Initial value:
[
str]

Definition at line 53 of file ports.py.

Referenced by member_type().

◆ service_type

Optional esiaccel.codegen.ports.CppPortKind.service_type
static
Initial value:
[
str]

Definition at line 47 of file ports.py.


The documentation for this class was generated from the following file: