Skip to content

AnalogDevice register

from_coords(register_transform)

Function to transform the coordinates into appropriate register layout.

PARAMETER DESCRIPTION
register_transform

Register transform instance containing the coordinates and register-related data

TYPE: RegisterTransform

RETURNS DESCRIPTION
RegisterLayout

RegisterLayout data

Source code in qadence2_platforms/backends/analog/register.py
def from_coords(register_transform: RegisterTransform) -> RegisterLayout:
    """
    Function to transform the coordinates into appropriate register layout.

    Args:
        register_transform (RegisterTransform): Register transform instance containing
            the coordinates and register-related data

    Returns:
        `RegisterLayout` data
    """
    register = Register.from_coordinates(register_transform.coords)
    return register  # type: ignore

from_model(model)

Gets information from IR model data to generate a register/register layout.

PARAMETER DESCRIPTION
model

IR model data

TYPE: Model

RETURNS DESCRIPTION
RegisterLayout

RegisterLayout data

Source code in qadence2_platforms/backends/analog/register.py
def from_model(model: Model) -> RegisterLayout:
    """
    Gets information from IR model data to generate a register/register layout.

    Args:
        model (Model): IR model data

    Returns:
        `RegisterLayout` data
    """

    register = RegisterResolver.resolve_from_model(
        model=model,
        device_settings=AnalogSettings,
        grid_scale_fn=check_grid_scale,
        grid_type_fn=check_grid_type,
        directives_fn=check_directives,
        register_transform_fn=from_coords,
    )

    return register