|
CIRCT 23.0.0git
|


Public Member Functions | |
| __init__ (self, AcceleratorConnection conn) | |
| str | get_consts_str (self, ModuleInfo module_info) |
| write_modules (self, Path output_dir, str system_name) | |
| generate (self, Path output_dir, str system_name) | |
Public Attributes | |
| type_planner | |
| type_emitter | |
Public Attributes inherited from esiaccel.codegen.Generator | |
| manifest | |
Static Public Attributes | |
| str | language = "C++" |
Static Public Attributes inherited from esiaccel.codegen.Generator | |
| Optional | language = None |
Protected Member Functions | |
| Dict[str, object] | _build_module_instance_map (self) |
| str | _cpp_member_type (self, port, Optional[str] alias_prefix=None) |
| List[Tuple[str, str]] | _port_using_aliases (self, str alias_prefix, port) |
| str | _cpp_indexed_elem_type (self, port, Optional[str] alias_prefix=None) |
| str | _cpp_ctor_param_type (self, port) |
| str | _port_find_code (self, str member_name, port, appid) |
| _PortGroup | _scalar_port_group (self, str member_name, port, appid) |
| _PortGroup | _indexed_ports_group (self, str member_name, str appid_name, port_list) |
| _PortGroup | _mixed_struct_group (self, str member_name, str appid_name, port_list) |
| List[_PortGroup] | _collect_port_groups (self, dict ports) |
| None | _emit_module_class (self, str name, str system_name, ModuleInfo module_info, List[_PortGroup] port_groups, TextIO out) |
Static Protected Member Functions | |
| str | _sanitize_id (str name) |
| str | _cpp_ctor_param_suffix (port) |
| str | _appid_expr (appid) |
| str | _port_make_unique_arg (str member_name, port) |
| bool | _port_is_connectable (port) |
Protected Attributes | |
| _conn | |
Generate C++ headers from an ESI manifest.
Definition at line 58 of file codegen.py.
| esiaccel.codegen.CppGenerator.__init__ | ( | self, | |
| AcceleratorConnection | conn | ||
| ) |
Reimplemented from esiaccel.codegen.Generator.
Definition at line 63 of file codegen.py.
References esiaccel.codegen.CppGenerator.__init__().
Referenced by esiaccel.codegen.CppGenerator.__init__(), synth.LongestPathCollection.drop_non_critical_paths(), and synth.LongestPathCollection.merge().
|
staticprotected |
Return `esi::AppID(...)` expression for an AppID.
Definition at line 206 of file codegen.py.
Referenced by esiaccel.codegen.CppGenerator._port_find_code().
|
protected |
Walk the live hierarchy and return {module_name: first Instance}.
Definition at line 94 of file codegen.py.
References esiaccel.codegen.CppGenerator._conn.
Referenced by esiaccel.codegen.CppGenerator.write_modules().
|
protected |
Group `ports` (AppID → BundlePort) into _PortGroup list.
Definition at line 452 of file codegen.py.
References esiaccel.codegen.CppGenerator._indexed_ports_group(), esiaccel.codegen.CppGenerator._mixed_struct_group(), esiaccel.codegen.CppGenerator._sanitize_id(), esiaccel.codegen.CppGenerator._scalar_port_group(), and append().
Referenced by esiaccel.codegen.CppGenerator.write_modules().
|
staticprotected |
Return the parameter name suffix ('_chan', '_svc', or '_port').
Definition at line 197 of file codegen.py.
Referenced by esiaccel.codegen.CppGenerator._mixed_struct_group(), and esiaccel.codegen.CppGenerator._scalar_port_group().
|
protected |
Return the C++ constructor parameter type for a port.
Definition at line 180 of file codegen.py.
Referenced by esiaccel.codegen.CppGenerator._mixed_struct_group(), and esiaccel.codegen.CppGenerator._scalar_port_group().
|
protected |
Return the storage type used inside an `IndexedPorts<T>` for `port`. Typed ports use the same `TypedFunction<...>` / `TypedReadPort<...>` etc. that `_cpp_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 161 of file codegen.py.
References esiaccel.codegen.CppGenerator._cpp_member_type().
Referenced by esiaccel.codegen.CppGenerator._indexed_ports_group().
|
protected |
Return the C++ member type string for a port (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 via `_port_using_aliases`. 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 109 of file codegen.py.
Referenced by esiaccel.codegen.CppGenerator._cpp_indexed_elem_type(), esiaccel.codegen.CppGenerator._mixed_struct_group(), and esiaccel.codegen.CppGenerator._scalar_port_group().
|
protected |
Emit the full module class to `out`.
Definition at line 496 of file codegen.py.
References esiaccel.codegen.CppGenerator.get_consts_str().
Referenced by esiaccel.codegen.CppGenerator.write_modules().
|
protected |
Build a _PortGroup for a same-name, same-type indexed port array.
Definition at line 303 of file codegen.py.
References esiaccel.codegen.CppGenerator._cpp_indexed_elem_type(), esiaccel.codegen.CppGenerator._port_is_connectable(), and esiaccel.codegen.CppGenerator._port_using_aliases().
Referenced by esiaccel.codegen.CppGenerator._collect_port_groups().
|
protected |
Build a _PortGroup for a same-name, mixed-type indexed port group.
Definition at line 401 of file codegen.py.
References esiaccel.codegen.CppGenerator._cpp_ctor_param_suffix(), esiaccel.codegen.CppGenerator._cpp_ctor_param_type(), esiaccel.codegen.CppGenerator._cpp_member_type(), esiaccel.codegen.CppGenerator._port_find_code(), esiaccel.codegen.CppGenerator._port_is_connectable(), esiaccel.codegen.CppGenerator._port_make_unique_arg(), and esiaccel.codegen.CppGenerator._port_using_aliases().
Referenced by esiaccel.codegen.CppGenerator._collect_port_groups().
|
protected |
Return the code snippet that resolves a scalar port in connect().
Definition at line 214 of file codegen.py.
References esiaccel.codegen.CppGenerator._appid_expr().
Referenced by esiaccel.codegen.CppGenerator._mixed_struct_group(), and esiaccel.codegen.CppGenerator._scalar_port_group().
|
staticprotected |
True if the generated connect() should call .connect() on this port. CallbackPort.connect() requires a user-supplied callback — skip. MMIORegion, BundlePort — no .connect() method.
Definition at line 266 of file codegen.py.
Referenced by esiaccel.codegen.CppGenerator._indexed_ports_group(), esiaccel.codegen.CppGenerator._mixed_struct_group(), and esiaccel.codegen.CppGenerator._scalar_port_group().
|
staticprotected |
Return the argument expression for make_unique<Connected>(...).
Definition at line 257 of file codegen.py.
Referenced by esiaccel.codegen.CppGenerator._mixed_struct_group(), and esiaccel.codegen.CppGenerator._scalar_port_group().
|
protected |
Return (alias_name, type_id) pairs to emit as `using` declarations at module-class scope for the typed-port template parameters.
Definition at line 145 of file codegen.py.
References esiaccel.codegen.CppGenerator.type_emitter.
Referenced by esiaccel.codegen.CppGenerator._indexed_ports_group(), esiaccel.codegen.CppGenerator._mixed_struct_group(), and esiaccel.codegen.CppGenerator._scalar_port_group().
|
staticprotected |
Return a C++-safe identifier from an AppID name.
Definition at line 83 of file codegen.py.
References isdigit.
Referenced by esiaccel.codegen.CppGenerator._collect_port_groups().
|
protected |
Build a _PortGroup for a single scalar (non-indexed) port.
Definition at line 274 of file codegen.py.
References esiaccel.codegen.CppGenerator._cpp_ctor_param_suffix(), esiaccel.codegen.CppGenerator._cpp_ctor_param_type(), esiaccel.codegen.CppGenerator._cpp_member_type(), esiaccel.codegen.CppGenerator._port_find_code(), esiaccel.codegen.CppGenerator._port_is_connectable(), esiaccel.codegen.CppGenerator._port_make_unique_arg(), and esiaccel.codegen.CppGenerator._port_using_aliases().
Referenced by esiaccel.codegen.CppGenerator._collect_port_groups().
| esiaccel.codegen.CppGenerator.generate | ( | self, | |
| Path | output_dir, | ||
| str | system_name | ||
| ) |
Reimplemented from esiaccel.codegen.Generator.
Definition at line 678 of file codegen.py.
References esiaccel.codegen.CppGenerator.type_emitter, and esiaccel.codegen.CppGenerator.write_modules().
| str esiaccel.codegen.CppGenerator.get_consts_str | ( | self, | |
| ModuleInfo | module_info | ||
| ) |
Get the C++ code for a constant in a module.
Definition at line 69 of file codegen.py.
Referenced by esiaccel.codegen.CppGenerator._emit_module_class().
| esiaccel.codegen.CppGenerator.write_modules | ( | self, | |
| Path | output_dir, | ||
| str | system_name | ||
| ) |
Write the C++ header. One for each module in the manifest.
Definition at line 652 of file codegen.py.
References esiaccel.codegen.CppGenerator._build_module_instance_map(), esiaccel.codegen.CppGenerator._collect_port_groups(), esiaccel.codegen.CppGenerator._emit_module_class(), esi::backends::cosim::RpcClient::Impl.manifest, esiaccel.accelerator.AcceleratorConnection.manifest(), and esiaccel.codegen.Generator.manifest.
Referenced by esiaccel.codegen.CppGenerator.generate().
|
protected |
Definition at line 65 of file codegen.py.
Referenced by esiaccel.codegen.CppGenerator._build_module_instance_map().
|
static |
Definition at line 61 of file codegen.py.
| esiaccel.codegen.CppGenerator.type_emitter |
Definition at line 67 of file codegen.py.
Referenced by esiaccel.codegen.CppGenerator._port_using_aliases(), and esiaccel.codegen.CppGenerator.generate().
| esiaccel.codegen.CppGenerator.type_planner |
Definition at line 66 of file codegen.py.