elasticai.creator.ir2vhdl#

Package Contents#

Classes#

Ir2Vhdl

Signal

Instance

Represents an entity that we can/want instantiate.

InstanceFactory

Automatically creates Instances from VhdlNodes based on their type field.

LogicSignal

LogicVectorSignal

NullDefinedLogicSignal

PluginLoader

PluginLoader for Ir2Vhdl passes.

PluginSpec

PluginSymbol

PortMap

EntityTemplateParameter

Find the entity in vhdl code and make its name available as a template paramter.

ValueTemplateParameter

Find a value definition and make it settable via a template parameter.

EntityTemplateDirector

Functions#

Data#

API#

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

Initialization

__call__(root: elasticai.creator.hdl_ir.DataGraph, registry: elasticai.creator.hdl_ir.Registry, default_root_name='root') collections.abc.Iterable[elasticai.creator.hdl_ir.Code][source]#
register_static(name: str | None, fn: collections.abc.Callable[[], str]) collections.abc.Callable[[], str][source]#
register(name: str | None, fn: elasticai.creator.hdl_ir.TypeHandler) elasticai.creator.hdl_ir.TypeHandler[source]#
override(name: str | None, fn: elasticai.creator.hdl_ir.TypeHandler) elasticai.creator.hdl_ir.TypeHandler[source]#
class elasticai.creator.ir2vhdl.Signal[source]#

Bases: abc.ABC

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

‘set(…)’

abstractmethod define() collections.abc.Iterator[str][source]#
abstract property name: str#
classmethod from_code(code: str) elasticai.creator.ir2vhdl.language.Signal[source]#
abstractmethod classmethod can_create_from_code(code: str) bool[source]#
classmethod register_type(t: type[elasticai.creator.ir2vhdl.language.Signal]) None[source]#
abstractmethod make_instance_specific(instance: str) elasticai.creator.ir2vhdl.language.Signal[source]#
class elasticai.creator.ir2vhdl.Instance(node: elasticai.creator.hdl_ir.Node, generic_map: dict[str, str], port_map: dict[str, elasticai.creator.ir2vhdl.language.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.hdl_ir.Shape#
property output_shape: elasticai.creator.hdl_ir.Shape#
property name: str#
property implementation: str#
define_signals() collections.abc.Iterator[str][source]#
instantiate() collections.abc.Iterator[str][source]#
elasticai.creator.ir2vhdl.factory#

‘IrFactory(…)’

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

Automatically creates Instances from VhdlNodes based on their type field.

register(type: str | None, fn: collections.abc.Callable[[elasticai.creator.hdl_ir.Node], elasticai.creator.ir2vhdl.language.Instance]) collections.abc.Callable[[elasticai.creator.hdl_ir.Node], elasticai.creator.ir2vhdl.language.Instance][source]#
__call__(node: elasticai.creator.hdl_ir.Node) elasticai.creator.ir2vhdl.language.Instance[source]#
class elasticai.creator.ir2vhdl.LogicSignal(name: str)[source]#

Bases: elasticai.creator.ir2vhdl.language.Signal

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

Bases: elasticai.creator.ir2vhdl.language.Signal

define() collections.abc.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.language.Signal[source]#
make_instance_specific(instance: str) elasticai.creator.ir2vhdl.language.Signal[source]#
__eq__(other) bool[source]#
class elasticai.creator.ir2vhdl.NullDefinedLogicSignal(name)[source]#

Bases: elasticai.creator.ir2vhdl.language.Signal

define() collections.abc.Iterator[str][source]#
property name: str#
classmethod can_create_from_code(code: str) bool[source]#
classmethod from_code(code: str) elasticai.creator.ir2vhdl.language.Signal[source]#
make_instance_specific(instance: str) elasticai.creator.ir2vhdl.language.Signal[source]#
class elasticai.creator.ir2vhdl.PluginLoader(lowering: elasticai.creator.ir2vhdl.ir2vhdl.Ir2Vhdl)[source]#

Bases: elasticai.creator.plugin.PluginLoaderBase

PluginLoader for Ir2Vhdl passes.

Initialization

filter_plugin_dicts(plugins: collections.abc.Iterable[dict[str, Any]]) collections.abc.Iterable[dict[str, Any]][source]#
get_symbols(specs: collections.abc.Iterable[elasticai.creator.ir2vhdl.ir2vhdl.PluginSpec]) collections.abc.Iterable[elasticai.creator.ir2vhdl.ir2vhdl.PluginSymbol][source]#
load_symbol(symbol: elasticai.creator.ir2vhdl.ir2vhdl.PluginSymbol) None[source]#
class elasticai.creator.ir2vhdl.PluginSpec[source]#

Bases: elasticai.creator.plugin.PluginSpec

generated: tuple[str, ...]#

None

static_files: tuple[str, ...]#

None

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

Bases: typing.Protocol

load_vhdl(receiver: elasticai.creator.ir2vhdl.ir2vhdl.Ir2Vhdl) None[source]#
class elasticai.creator.ir2vhdl.PortMap(map: dict[str, elasticai.creator.ir2vhdl.language.Signal])[source]#

Initialization

as_dict() dict[str, str][source]#
classmethod from_dict(data: dict[str, str]) elasticai.creator.ir2vhdl.language.PortMap[source]#
__eq__(other: object) bool[source]#
elasticai.creator.ir2vhdl.type_handler(name: str | None, fn: elasticai.creator.hdl_ir.NonIterableTypeHandler) elasticai.creator.hdl_ir.NonIterableTypeHandler[source]#
elasticai.creator.ir2vhdl.type_handler_iterable(name: str | None, fn: elasticai.creator.hdl_ir.TypeHandler) elasticai.creator.hdl_ir.TypeHandler[source]#
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-' or skeleton. will remain unaltered. IMPORTANT: This detail is likely to change in the future.

Initialization

analyse(match: dict[str, str]) None[source]#
replace(match: dict[str, str]) str[source]#
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 or identifier : type := and transforms them into identifier : type := $identifier.

Essentially allows to replace generics as well as variable or signal initializations.

Initialization

replace(match: dict[str, str]) str[source]#
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]#
build() string.Template[source]#