elasticai.creator.ir2vhdl
#
Package Contents#
Classes#
Represents an entity that we can/want instantiate. |
|
Automatically creates Instances from VhdlNodes based on their |
|
Plugin loader for ir2vhdl translation. |
|
Extending ir.core.Node to a vhdl specific node. |
|
Find the entity in vhdl code and make its name available as a template paramter. |
|
Find a value definition and make it settable via a template parameter. |
|
Functions#
Data#
API#
- class elasticai.creator.ir2vhdl.Ir2Vhdl[source]#
Bases:
elasticai.creator.ir.LoweringPass
[elasticai.creator.ir2vhdl.ir2vhdl.Implementation
,elasticai.creator.ir2vhdl.ir2vhdl.Code
]- __call__(args: collections.abc.Iterable[elasticai.creator.ir2vhdl.ir2vhdl.Implementation]) Iterator[elasticai.creator.ir2vhdl.ir2vhdl.Code] [source]#
- class elasticai.creator.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
- elasticai.creator.ir2vhdl.Code: TypeAlias#
None
- class elasticai.creator.ir2vhdl.Signal[source]#
Bases:
abc.ABC
- types: set[type[elasticai.creator.ir2vhdl.ir2vhdl.Signal]]#
‘set(…)’
- abstract property name: str#
- classmethod from_code(code: str) elasticai.creator.ir2vhdl.ir2vhdl.Signal [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.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#
- class elasticai.creator.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
- class elasticai.creator.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
- class elasticai.creator.ir2vhdl.LogicSignal(name: str)[source]#
Bases:
elasticai.creator.ir2vhdl.ir2vhdl.Signal
- property name: str#
- 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.LogicVectorSignal(name: str, width: int)[source]#
Bases:
elasticai.creator.ir2vhdl.ir2vhdl.Signal
- property name: str#
- property width: int#
- 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.NullDefinedLogicSignal(name)[source]#
Bases:
elasticai.creator.ir2vhdl.ir2vhdl.Signal
- property name: str#
- 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.PluginLoader(lowering: elasticai.creator.ir2vhdl.ir2vhdl.Ir2Vhdl)[source]#
Bases:
elasticai.creator.plugin.PluginLoader
[elasticai.creator.ir2vhdl.ir2vhdl.Ir2Vhdl
]Plugin loader for ir2vhdl translation.
Initialization
- class elasticai.creator.ir2vhdl.PluginSpec[source]#
Bases:
elasticai.creator.plugin.PluginSpec
- generated: tuple[str, ...]#
None
- static_files: tuple[str, ...]#
None
- class elasticai.creator.ir2vhdl.PortMap(map: dict[str, elasticai.creator.ir2vhdl.ir2vhdl.Signal])[source]#
Initialization
- classmethod from_dict(data: dict[str, str]) elasticai.creator.ir2vhdl.ir2vhdl.PortMap [source]#
- class elasticai.creator.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]#
- property depth: int#
- property width: int#
- property height: int#
- elasticai.creator.ir2vhdl.ShapeTuple: TypeAlias#
None
- elasticai.creator.ir2vhdl.TypeHandlerFn: TypeAlias#
None
- class elasticai.creator.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 entitywork.adder(rtl)
. CAUTION: This behaviour is subject to change. Future versions might require the full entity nameInitialization
- 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.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.type_handler#
‘FunctionDecorator(…)’
- elasticai.creator.ir2vhdl.type_handler_iterable#
‘FunctionDecorator(…)’
- elasticai.creator.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.EntityTemplateParameter[source]#
Bases:
elasticai.creator.template.AnalysingTemplateParameter
Find the entity in vhdl code and make its name available as a template paramter.
Assumes that there is only one entity in the provided prototype.
NOTE: Will only replace occurences where
name
is followed and preceded by a non-word character, ie. for an entity named'skeleton'
the occurence'architecture rtl of skeleton is'
will be replaced by'architecture rtl of $entity is'
but the occurences'skeleton_pkg'
,'skeleton;'
,'skeleton-'
orskeleton.
will remain unaltered. IMPORTANT: This detail is likely to change in the future.Initialization
- class elasticai.creator.ir2vhdl.ValueTemplateParameter(name: str)[source]#
Bases:
elasticai.creator.template.TemplateParameter
Find a value definition and make it settable via a template parameter.
Searches for vhdl value definitions of the form
identifier : type
oridentifier : type :=
and transforms them intoidentifier : type := $identifier
.Essentially allows to replace generics as well as variable or signal initializations.
Initialization
- class elasticai.creator.ir2vhdl.EntityTemplateDirector[source]#
Initialization
- set_prototype(prototype: str) elasticai.creator.ir2vhdl.vhdl_template.EntityTemplateDirector [source]#
- add_generic(name: str) elasticai.creator.ir2vhdl.vhdl_template.EntityTemplateDirector [source]#