elasticai.creator.ir2vhdl.ir2vhdl#

Module Contents#

Classes#

PluginSpec

Shape

ShapeField

VhdlNode

Extending ir.core.Node to a vhdl specific node.

Edge

Implementation

Ir2Vhdl

Signal

LogicSignal

LogicVectorSignal

NullDefinedLogicSignal

PortMap

Instance

Represents an entity that we can/want instantiate.

InstanceFactory

Automatically creates Instances from VhdlNodes based on their type field.

PluginLoader

Plugin loader for ir2vhdl translation.

Functions#

is_shape_tuple

vhdl_node

Convenience method for creating new vhdl nodes.

edge

Data#

API#

class elasticai.creator.ir2vhdl.ir2vhdl.PluginSpec[source]#

Bases: elasticai.creator.plugin.PluginSpec

generated: tuple[str, ...]#

None

static_files: tuple[str, ...]#

None

elasticai.creator.ir2vhdl.ir2vhdl.ShapeTuple: TypeAlias#

None

elasticai.creator.ir2vhdl.ir2vhdl.is_shape_tuple(values) TypeGuard[elasticai.creator.ir2vhdl.ir2vhdl.ShapeTuple][source]#
class elasticai.creator.ir2vhdl.ir2vhdl.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.ir2vhdl.ir2vhdl.ShapeTuple | list[int]) elasticai.creator.ir2vhdl.ir2vhdl.Shape[source]#
to_tuple() elasticai.creator.ir2vhdl.ir2vhdl.ShapeTuple[source]#
to_list() list[int][source]#
__getitem__(item)[source]#
size() int[source]#
ndim() int[source]#
property depth: int#
__eq__(other)[source]#
property width: int#
property height: int#
__repr__() str[source]#
class elasticai.creator.ir2vhdl.ir2vhdl.ShapeField[source]#

Bases: elasticai.creator.ir.RequiredField[list[int], elasticai.creator.ir2vhdl.ir2vhdl.Shape]

class elasticai.creator.ir2vhdl.ir2vhdl.VhdlNode(name: str, data: dict[str, elasticai.creator.ir.base.Attribute])[source]#

Bases: elasticai.creator.ir.Node

Extending ir.core.Node to a vhdl specific node.

VhdlNode contains all knowledge that we need to create and use an instance of a vhdl entity. However, this becomes a little bit complicated because vhdl differentiates between the entity and the architecture of a component. The entity is similar to an interface while the architecture is similar to the implementation. However, to instantiate components, we need to know both names.

Attributes:

implementation:: The name of the implementation will be used to derive the architecture name. E.g., if the implementation is "adder", we will instantiate the entity work.adder(rtl). CAUTION: This behaviour is subject to change. Future versions might require the full entity name

Initialization

implementation: str#

None

input_shape: elasticai.creator.ir.RequiredField[list[int], elasticai.creator.ir2vhdl.ir2vhdl.Shape]#

‘ShapeField(…)’

output_shape: elasticai.creator.ir.RequiredField[list[int], elasticai.creator.ir2vhdl.ir2vhdl.Shape]#

‘ShapeField(…)’

elasticai.creator.ir2vhdl.ir2vhdl.vhdl_node(name: str, type: str, implementation: str, input_shape: elasticai.creator.ir2vhdl.ir2vhdl.Shape | elasticai.creator.ir2vhdl.ir2vhdl.ShapeTuple, output_shape: elasticai.creator.ir2vhdl.ir2vhdl.Shape | elasticai.creator.ir2vhdl.ir2vhdl.ShapeTuple, attributes: dict | None = None) elasticai.creator.ir2vhdl.ir2vhdl.VhdlNode[source]#

Convenience method for creating new vhdl nodes.

class elasticai.creator.ir2vhdl.ir2vhdl.Edge(src: str, dst: str, data: dict[str, elasticai.creator.ir.base.Attribute])[source]#

Bases: elasticai.creator.ir.Edge

src_dst_indices: tuple[tuple[int, int] | tuple[str, str], ...]#

None

__hash__() int[source]#
elasticai.creator.ir2vhdl.ir2vhdl.edge(src: str, dst: str, src_dst_indices: collections.abc.Iterable[tuple[int, int]] | tuple[str, str]) elasticai.creator.ir2vhdl.ir2vhdl.Edge[source]#
elasticai.creator.ir2vhdl.ir2vhdl.N#

‘TypeVar(…)’

elasticai.creator.ir2vhdl.ir2vhdl.E#

‘TypeVar(…)’

class elasticai.creator.ir2vhdl.ir2vhdl.Implementation(*, name: str | None = None, type: str | None = None, node_fn=VhdlNode, edge_fn=Edge, data: dict[str, Any] | None = None, attributes: dict[str, Any] | None = None, graph: elasticai.creator.graph.BaseGraph | None = None)[source]#

Bases: elasticai.creator.ir.Implementation[elasticai.creator.ir2vhdl.ir2vhdl.N, elasticai.creator.ir2vhdl.ir2vhdl.E]

name: str#

None

type: str#

None

elasticai.creator.ir2vhdl.ir2vhdl.Code: TypeAlias#

None

class elasticai.creator.ir2vhdl.ir2vhdl.Ir2Vhdl[source]#

Bases: elasticai.creator.ir.LoweringPass[elasticai.creator.ir2vhdl.ir2vhdl.Implementation, elasticai.creator.ir2vhdl.ir2vhdl.Code]

register_static(name: str, fn: collections.abc.Callable[[], str]) None[source]#
__call__(args: collections.abc.Iterable[elasticai.creator.ir2vhdl.ir2vhdl.Implementation]) Iterator[elasticai.creator.ir2vhdl.ir2vhdl.Code][source]#
class elasticai.creator.ir2vhdl.ir2vhdl.Signal[source]#

Bases: abc.ABC

types: set[type[elasticai.creator.ir2vhdl.ir2vhdl.Signal]]#

‘set(…)’

abstract define() Iterator[str][source]#
abstract property name: str#
classmethod from_code(code: str) elasticai.creator.ir2vhdl.ir2vhdl.Signal[source]#
abstract classmethod can_create_from_code(code: str) bool[source]#
classmethod register_type(t: type[elasticai.creator.ir2vhdl.ir2vhdl.Signal]) None[source]#
abstract make_instance_specific(instance: str) elasticai.creator.ir2vhdl.ir2vhdl.Signal[source]#
class elasticai.creator.ir2vhdl.ir2vhdl.LogicSignal(name: str)[source]#

Bases: elasticai.creator.ir2vhdl.ir2vhdl.Signal

define() Iterator[str][source]#
property name: str#
classmethod can_create_from_code(code: str) bool[source]#
classmethod from_code(code: str) elasticai.creator.ir2vhdl.ir2vhdl.Signal[source]#
make_instance_specific(instance: str) elasticai.creator.ir2vhdl.ir2vhdl.Signal[source]#
__eq__(other: object) bool[source]#
class elasticai.creator.ir2vhdl.ir2vhdl.LogicVectorSignal(name: str, width: int)[source]#

Bases: elasticai.creator.ir2vhdl.ir2vhdl.Signal

define() Iterator[str][source]#
property name: str#
property width: int#
classmethod can_create_from_code(code: str) bool[source]#
classmethod from_code(code: str) elasticai.creator.ir2vhdl.ir2vhdl.Signal[source]#
make_instance_specific(instance: str) elasticai.creator.ir2vhdl.ir2vhdl.Signal[source]#
__eq__(other) bool[source]#
class elasticai.creator.ir2vhdl.ir2vhdl.NullDefinedLogicSignal(name)[source]#

Bases: elasticai.creator.ir2vhdl.ir2vhdl.Signal

define() Iterator[str][source]#
property name: str#
classmethod can_create_from_code(code: str) bool[source]#
classmethod from_code(code: str) elasticai.creator.ir2vhdl.ir2vhdl.Signal[source]#
make_instance_specific(instance: str) elasticai.creator.ir2vhdl.ir2vhdl.Signal[source]#
class elasticai.creator.ir2vhdl.ir2vhdl.PortMap(map: dict[str, elasticai.creator.ir2vhdl.ir2vhdl.Signal])[source]#

Initialization

as_dict() dict[str, str][source]#
classmethod from_dict(data: dict[str, str]) elasticai.creator.ir2vhdl.ir2vhdl.PortMap[source]#
__eq__(other: object) bool[source]#
class elasticai.creator.ir2vhdl.ir2vhdl.Instance(node: elasticai.creator.ir2vhdl.ir2vhdl.VhdlNode, generic_map: dict[str, str], port_map: dict[str, elasticai.creator.ir2vhdl.ir2vhdl.Signal])[source]#

Represents an entity that we can/want instantiate.

The aggregates all the knowledge that is necessary to instantiate and use the corresponding entity programmatically, when generating vhdl code.

Initialization

property input_shape: elasticai.creator.ir2vhdl.ir2vhdl.Shape#
property output_shape: elasticai.creator.ir2vhdl.ir2vhdl.Shape#
property name: str#
property implementation: str#
define_signals() Iterator[str][source]#
instantiate() Iterator[str][source]#
class elasticai.creator.ir2vhdl.ir2vhdl.InstanceFactory[source]#

Bases: elasticai.creator.function_utils.KeyedFunctionDispatcher[elasticai.creator.ir2vhdl.ir2vhdl.VhdlNode, elasticai.creator.ir2vhdl.ir2vhdl.Instance]

Automatically creates Instances from VhdlNodes based on their type field.

Initialization

elasticai.creator.ir2vhdl.ir2vhdl.PluginSymbol: TypeAlias[source]#

None

class elasticai.creator.ir2vhdl.ir2vhdl.PluginLoader(lowering: elasticai.creator.ir2vhdl.ir2vhdl.Ir2Vhdl)[source]#

Bases: elasticai.creator.plugin.PluginLoader[elasticai.creator.ir2vhdl.ir2vhdl.Ir2Vhdl]

Plugin loader for ir2vhdl translation.

Initialization

load_from_package(package: str) None[source]#
elasticai.creator.ir2vhdl.ir2vhdl.TypeHandlerFn: TypeAlias#

None

elasticai.creator.ir2vhdl.ir2vhdl.type_handler#

‘FunctionDecorator(…)’

elasticai.creator.ir2vhdl.ir2vhdl.type_handler_iterable#

‘FunctionDecorator(…)’