sonar/core/backends/include.py
def command_var_replace(
    target_string, interface, indent, language, action_type, endpoint
):
    """
    This function replaces the variables in an interface action block. There
    are two named variables: $$name (referring to the interface name) and
    $$signal (referring to a particular side signal). All other $$ variables
    must be keys in the interface declaration in the configuration file.

    Args:
        target_string (str): The preceding string to append to
        interface (Interface) An interface
        indent (str): String to add as leading indent for each line
        language (str): Language of the testbench
        action_type (str): Identifier for the list of actions to perform
        endpoint (Endpoint): The endpoint used to get the actions

    Returns:
        str: The updated target_string
    """
    actions = endpoint.actions[language][action_type]
    for action in actions:
        # check if there is a command to repeat for a set of signals
        if isinstance(action, dict):
            if "signals" in action:
                for command in action["commands"]:
                    regex_signal = re.compile(r"\$\$signal")
                    if re.findall(
                        regex_signal, command
                    ):  # if $$signal in command
                        target_string = replace_signals(
                            interface,
                            action,
                            command,
                            target_string,
                            indent,
                            interface.core.args[language],
                        )
                    else:
                        command_copy = copy.deepcopy(command)
                        target_string = replace_block(
                            target_string, command_copy, interface, indent
                        )
            else:
                for index, _entity in enumerate(
                    getattr(interface, action["foreach"])
                ):
                    for command in action["commands"]:
                        command_copy = copy.deepcopy(command)
                        target_string = replace_block(
                            target_string,
                            command_copy,
                            interface,
                            indent,
                            index,
                        )
        else:
            command_copy = copy.deepcopy(action)
            target_string = replace_block(
                target_string, command_copy, interface, indent
            )

    return target_string

    This function replaces the variables in an interface action block. There
    are two named variables: $$name (referring to the interface name) and
    $$signal (referring to a particular side signal). All other $$ variables
    must be keys in the interface declaration in the configuration file.

    Args:
        target_string (str): The preceding string to append to
        interface (Interface) An interface
        indent (str): String to add as leading indent for each line
        language (str): Language of the testbench
        action_type (str): Identifier for the list of actions to perform
        endpoint (Endpoint): The endpoint used to get the actions

    Returns:
        str: The updated target_string
    
This function replaces the variables in an interface action block. There
are two named variables: $$name (referring to the interface name) and
signal (referring to a particular side signal). All other $$ variables
must be keys in the interface declaration in the configuration file.




This function replaces the variables in an interface action block . There are two named variables : $$name ( referring to the interface name ) and signal ( referring to a particular side signal ) . All other $$ variables must be keys in the interface declaration in the configuration file .
def command_var_replace(
    target_string, interface, indent, language, action_type, endpoint
):
    actions = endpoint.actions[language][action_type]
    for action in actions:
        if isinstance(action, dict):
            if "signals" in action:
                for command in action["commands"]:
                    regex_signal = re.compile(r"\$\$signal")
                    if re.findall(
                        regex_signal, command
                    ):  
                        target_string = replace_signals(
                            interface,
                            action,
                            command,
                            target_string,
                            indent,
                            interface.core.args[language],
                        )
                    else:
                        command_copy = copy.deepcopy(command)
                        target_string = replace_block(
                            target_string, command_copy, interface, indent
                        )
            else:
                for index, _entity in enumerate(
                    getattr(interface, action["foreach"])
                ):
                    for command in action["commands"]:
                        command_copy = copy.deepcopy(command)
                        target_string = replace_block(
                            target_string,
                            command_copy,
                            interface,
                            indent,
                            index,
                        )
        else:
            command_copy = copy.deepcopy(action)
            target_string = replace_block(
                target_string, command_copy, interface, indent
            )
    return target_string
def command_var_replace ( target_string , interface , indent , language , action_type , endpoint ) : actions = endpoint . actions [ language ] [ action_type ] for action in actions : if isinstance ( action , dict ) : if "signals" in action : for command in action [ "commands" ] : regex_signal = re . compile ( r"\$\$signal" ) if re . findall ( regex_signal , command ) : target_string = replace_signals ( interface , action , command , target_string , indent , interface . core . args [ language ] , ) else : command_copy = copy . deepcopy ( command ) target_string = replace_block ( target_string , command_copy , interface , indent ) else : for index , _entity in enumerate ( getattr ( interface , action [ "foreach" ] ) ) : for command in action [ "commands" ] : command_copy = copy . deepcopy ( command ) target_string = replace_block ( target_string , command_copy , interface , indent , index , ) else : command_copy = copy . deepcopy ( action ) target_string = replace_block ( target_string , command_copy , interface , indent ) return target_string
This function replaces the variables in an interface action block.
This function replaces the variables in an interface action block .
"""
    This function replaces the variables in an interface action block. There
    are two named variables: $$name (referring to the interface name) and
    $$signal (referring to a particular side signal). All other $$ variables
    must be keys in the interface declaration in the configuration file.

    Args:
        target_string (str): The preceding string to append to
        interface (Interface) An interface
        indent (str): String to add as leading indent for each line
        language (str): Language of the testbench
        action_type (str): Identifier for the list of actions to perform
        endpoint (Endpoint): The endpoint used to get the actions

    Returns:
        str: The updated target_string
    """ # check if there is a command to repeat for a set of signals # if $$signal in command
target_string
interface
indent
language
action_type
endpoint