API reference

class hdl_block_design.Block(name: str, parameters: dict[str, Parameter], pins: dict[str, Pin])[source]

Class representing an available block in a block design.

classmethod from_dict(dct: YAMLMapping) Self[source]

Create a Block from a dictionary.

classmethod from_vhdl_file(path: PathLike) Self[source]

Create a Block from a VHDL file.

classmethod from_vhdl_string(s: str | bytes) Self[source]

Create a Block from a VHDL string or bytes string.

Raises:

RuntimeError – If s contains 0 or > 1 entity declarations.

classmethod from_yaml_file(path: PathLike) Self

Create an object from a YAML file.

classmethod from_yaml_string(string: str) Self

Create an object from a YAML string.

Raises:

TypeError – If yaml returns a non-dict.

__eq__(other)

Return self==value.

__init__(name: str, parameters: dict[str, Parameter], pins: dict[str, Pin]) None
__repr__()

Return repr(self).

to_dict() YAMLMapping[source]

Convert a Block to a dictionary.

to_yaml_string() str

Write an object to a YAML file.

write_yaml_file(path: PathLike) None

Write an object to a YAML file.

name: str

The name of the block.

parameters: dict[str, Parameter]

The parameters on the block.

pins: dict[str, Pin]

The pins on the block.

enum hdl_block_design.Direction(value)[source]

Class representing the direction of a pin.

Member Type:

str

Valid values are as follows:

IN = Direction.IN

The pin is an input.

OUT = Direction.OUT

The pin is an output.

INOUT = Direction.INOUT

The pin is an input and an output.

class hdl_block_design.Pin(name: str, type: str, direction: Direction | str)[source]

Class representing a pin on a block.

classmethod from_dict(dct: YAMLMapping) Self[source]

Create a Pin from a dictionary.

classmethod from_yaml_file(path: PathLike) Self

Create an object from a YAML file.

classmethod from_yaml_string(string: str) Self

Create an object from a YAML string.

Raises:

TypeError – If yaml returns a non-dict.

__eq__(other)

Return self==value.

__init__(name: str, type: str, direction: Direction | str) None
__repr__()

Return repr(self).

to_dict() YAMLMapping[source]

Convert a Pin to a dictionary.

to_vhdl_entity_port_definition(prefix: str | None = None, prefix_separator: str = '_') str[source]

Return the VHDL entity port definition for this pin.

to_yaml_string() str

Write an object to a YAML file.

write_yaml_file(path: PathLike) None

Write an object to a YAML file.

direction: Direction | str

The direction of the pin.

name: str

The name of the pin.

type: str

The type of the pin. This maps to the VHDL type.