elasticai.creator.ir2verilog#
Package Contents#
Classes#
PluginLoader for Ir2Verilog passes. |
|
PluginLoader for Ir2Verilog passes. |
|
Extending ir.core.Node to an hdl specific node. |
|
Director for building verilog templates. |
|
Functions#
Data#
API#
- class elasticai.creator.ir2verilog.Ir2Verilog[source]#
Initialization
- __call__(root: elasticai.creator.hdl_ir.DataGraph, registry: elasticai.creator.hdl_ir.Registry, default_root_name='root') collections.abc.Iterable[elasticai.creator.ir2verilog.ir2verilog.Code][source]#
- register_static(name: str | None, fn: collections.abc.Callable[[], str]) collections.abc.Callable[[], str][source]#
- elasticai.creator.ir2verilog.type_handler(name: str | None, fn: elasticai.creator.hdl_ir.NonIterableTypeHandler) elasticai.creator.hdl_ir.NonIterableTypeHandler[source]#
- elasticai.creator.ir2verilog.type_handler_iterable(name: str | None, fn: elasticai.creator.hdl_ir.TypeHandler) elasticai.creator.hdl_ir.TypeHandler[source]#
- class elasticai.creator.ir2verilog.Shape(*values: int)[source]#
Initialization
values are interpreted as one of the following:
width
depth, width
depth, width, height
Usually width is kernel_size, depth is channels
- classmethod from_tuple(values: elasticai.creator.hdl_ir.ShapeTuple | list[int]) elasticai.creator.hdl_ir.Shape[source]#
- property depth: int#
- property width: int#
- property height: int#
- elasticai.creator.ir2verilog.factory#
‘IrFactory(…)’
- class elasticai.creator.ir2verilog.PluginLoader(lowering: elasticai.creator.ir2verilog.ir2verilog.Ir2Verilog)[source]#
Bases:
elasticai.creator.plugin.PluginLoaderBasePluginLoader for Ir2Verilog passes.
Initialization
- filter_plugin_dicts(plugins: collections.abc.Iterable[dict[str, Any]]) collections.abc.Iterable[dict[str, Any]][source]#
- load_symbol(symbol: elasticai.creator.ir2verilog.ir2verilog.PluginSymbol) None[source]#
- get_symbols(specs: collections.abc.Iterable[elasticai.creator.ir2verilog.ir2verilog.PluginSpec]) collections.abc.Iterable[elasticai.creator.ir2verilog.ir2verilog.PluginSymbol][source]#
- class elasticai.creator.ir2verilog.PluginLoader(lowering: elasticai.creator.ir2verilog.ir2verilog.Ir2Verilog)[source]#
Bases:
elasticai.creator.plugin.PluginLoaderBasePluginLoader for Ir2Verilog passes.
Initialization
- filter_plugin_dicts(plugins: collections.abc.Iterable[dict[str, Any]]) collections.abc.Iterable[dict[str, Any]][source]#
- load_symbol(symbol: elasticai.creator.ir2verilog.ir2verilog.PluginSymbol) None[source]#
- get_symbols(specs: collections.abc.Iterable[elasticai.creator.ir2verilog.ir2verilog.PluginSpec]) collections.abc.Iterable[elasticai.creator.ir2verilog.ir2verilog.PluginSymbol][source]#
- elasticai.creator.ir2verilog.factory#
‘IrFactory(…)’
- class elasticai.creator.ir2verilog.Node[source]#
Bases:
elasticai.creator.ir.ir_v2.Node,typing.ProtocolExtending ir.core.Node to an hdl specific node.
This node contains all knowledge that we need to create and use an instance of an hdl component. However, this becomes a little bit complicated because vhdl differentiates between
Attributes:
implementation:: The name of the implementation, e.g., entity name in vhdl or module name for verilog, will be used to derive the architecture name. E.g., if the implementation is
"adder", we will instantiate the entitywork.adder(rtl). CAUTION: This behaviour is subject to change. Future versions might require the full entity name- property implementation: str#
- property input_shape: elasticai.creator.hdl_ir.Shape#
- property output_shape: elasticai.creator.hdl_ir.Shape#
- class elasticai.creator.ir2verilog.Edge[source]#
Bases:
elasticai.creator.ir.ir_v2.Edge,typing.Protocol- property src_dst_indices: tuple[tuple[int | str, int | str], ...]#
- elasticai.creator.ir2verilog.Code: TypeAlias#
None
- class elasticai.creator.ir2verilog.TemplateDirector[source]#
Director for building verilog templates.
Most methods correspond to verilog language constructs. Building the final template can be expensive! Typically you only want to do this once. E.g.:
from string import Template from elasticai.creator.ir2verilog import type_handler, Code, TemplateDirector, Implementation class _ExplodingTemplate: def substitute(self, params): raise RuntimeError("Template not initialized!") _template = None @type_handler def fir_filter(impl: Implementation) -> Code: global _template if _template is None: _template = ( TemplateDirector() .define_scoped_switch("USE_EXT_WEIGHTS", False) .define_scoped_switch("USE_EXT_MAC", False) .parameter("BITWIDTH") .parameter("LENGTH") .localparam("FILT_COEFFS") .localparam("NUM_MULT_UNIT") .add_module_name() .set_prototype(res.read_text(package_path, "verilog/filter_fir_full.v")) .build() ) return _template.substitute(impl.attributes)
Initialization
- define_scoped_switch(name: str, default: bool) Self[source]#
Add a switch for a define that is scoped to the module name.
The switch will be prefixed with the value that users provide as
module_nameto the render call.- Parameters:
name – String with name of the switch/define name
default – Setting switch for defining output state (True=set, False=undefine)