elasticai.creator.hdl_generator.protocols#
Protocol definitions for HDL abstraction.
This module defines the protocols (interfaces) that all HDL implementations must follow. Using Protocol classes allows for structural subtyping (duck typing with type checking).
Module Contents#
Classes#
Protocol for HDL signals/wires. |
|
Protocol for HDL module/entity instances. |
|
Protocol for HDL template directors. |
API#
- class elasticai.creator.hdl_generator.protocols.HDLSignal[source]#
Bases:
typing.ProtocolProtocol for HDL signals/wires.
Represents either a VHDL signal or a Verilog wire.
- abstract property name: str#
The name of the signal/wire.
- abstractmethod define() collections.abc.Iterator[str][source]#
Generate HDL code lines to define this signal/wire.
- abstractmethod make_instance_specific(instance: str) elasticai.creator.hdl_generator.protocols.HDLSignal[source]#
Create a signal/wire with an instance-specific name.
Args: instance: The instance name to append to the signal name.
Returns: A new signal with the modified name.
- class elasticai.creator.hdl_generator.protocols.HDLInstance[source]#
Bases:
typing.ProtocolProtocol for HDL module/entity instances.
Represents either a VHDL entity instance or a Verilog module instance.
- abstract property name: str#
The instance name.
- abstract property implementation: str#
The name of the module/entity being instantiated.
- class elasticai.creator.hdl_generator.protocols.HDLTemplateDirector[source]#
Bases:
typing.ProtocolProtocol for HDL template directors.
Provides a builder interface for creating HDL templates from prototype code.
- abstractmethod set_prototype(prototype: str) elasticai.creator.hdl_generator.protocols.HDLTemplateDirector[source]#
Set the prototype HDL code to use as a template base.
Args: prototype: The HDL code to convert into a template.
Returns: Self for method chaining.
- abstractmethod add_parameter(name: str) elasticai.creator.hdl_generator.protocols.HDLTemplateDirector[source]#
Add a template parameter (generic/parameter).
Args: name: The name of the parameter to make templatable.
Returns: Self for method chaining.
- abstractmethod build() elasticai.creator.hdl_generator.protocols.Template[source]#
Build the final template.
Returns: A string.Template that can be used to generate code.