sonar/core/backends/sv_interfaces.py
def add_signal_endpoints(testbench_config, testbench):
    """
    Add signals' sources/sinks

    Args:
        testbench_config (Testbench): The testbench configuration
        testbench (str): The testbench being generated

    Returns:
        str: The testbench
    """
    endpoints_str = ""
    leading_spaces = include.get_indentation(
        "SONAR_INCLUDE_ENDPOINTS", testbench
    )
    all_endpoints = testbench_config.get_from_dut("endpoints")
    for signal_index, endpoint_dict in enumerate(all_endpoints.items()):
        signal, endpoints = endpoint_dict
        if endpoints_str != "":
            endpoints_str += leading_spaces
        endpoints_str = (
            f"logic [$$size-1:0] $$name_endpoint[{len(endpoints)}];\n"
        )
        endpoints_str += (
            leading_spaces
            + f"assign $$name = $$name_endpoint[{signal_index}];\n"
        )

        for endpoint in endpoints:
            endpoints_str += endpoint.instantiate(leading_spaces)
            endpoints_str = endpoints_str.replace(
                "$$size", str(endpoint.arguments["size"])
            )
        endpoints_str = endpoints_str.replace("$$name", signal)
        endpoints_str = endpoints_str.replace(
            "$$endpointIndex", str(signal_index)
        )

    testbench = include.replace_in_testbenches(
        testbench, "SONAR_INCLUDE_ENDPOINTS", endpoints_str[:-1]
    )
    return testbench

    Add signals' sources/sinks

    Args:
        testbench_config (Testbench): The testbench configuration
        testbench (str): The testbench being generated

    Returns:
        str: The testbench
    
Add signals' sources/sinks
Add signals ' sources / sinks
def add_signal_endpoints(testbench_config, testbench):
    endpoints_str = ""
    leading_spaces = include.get_indentation(
        "SONAR_INCLUDE_ENDPOINTS", testbench
    )
    all_endpoints = testbench_config.get_from_dut("endpoints")
    for signal_index, endpoint_dict in enumerate(all_endpoints.items()):
        signal, endpoints = endpoint_dict
        if endpoints_str != "":
            endpoints_str += leading_spaces
        endpoints_str = (
            f"logic [$$size-1:0] $$name_endpoint[{len(endpoints)}];\n"
        )
        endpoints_str += (
            leading_spaces
            + f"assign $$name = $$name_endpoint[{signal_index}];\n"
        )
        for endpoint in endpoints:
            endpoints_str += endpoint.instantiate(leading_spaces)
            endpoints_str = endpoints_str.replace(
                "$$size", str(endpoint.arguments["size"])
            )
        endpoints_str = endpoints_str.replace("$$name", signal)
        endpoints_str = endpoints_str.replace(
            "$$endpointIndex", str(signal_index)
        )
    testbench = include.replace_in_testbenches(
        testbench, "SONAR_INCLUDE_ENDPOINTS", endpoints_str[:-1]
    )
    return testbench
def add_signal_endpoints ( testbench_config , testbench ) : endpoints_str = "" leading_spaces = include . get_indentation ( "SONAR_INCLUDE_ENDPOINTS" , testbench ) all_endpoints = testbench_config . get_from_dut ( "endpoints" ) for signal_index , endpoint_dict in enumerate ( all_endpoints . items ( ) ) : signal , endpoints = endpoint_dict if endpoints_str != "" : endpoints_str += leading_spaces endpoints_str = ( f"logic [$$size-1:0] $$name_endpoint[{len(endpoints)}];\n" ) endpoints_str += ( leading_spaces + f"assign $$name = $$name_endpoint[{signal_index}];\n" ) for endpoint in endpoints : endpoints_str += endpoint . instantiate ( leading_spaces ) endpoints_str = endpoints_str . replace ( "$$size" , str ( endpoint . arguments [ "size" ] ) ) endpoints_str = endpoints_str . replace ( "$$name" , signal ) endpoints_str = endpoints_str . replace ( "$$endpointIndex" , str ( signal_index ) ) testbench = include . replace_in_testbenches ( testbench , "SONAR_INCLUDE_ENDPOINTS" , endpoints_str [ : - 1 ] ) return testbench
Add signals' sources/sinks
Add signals ' sources / sinks
"""
    Add signals' sources/sinks

    Args:
        testbench_config (Testbench): The testbench configuration
        testbench (str): The testbench being generated

    Returns:
        str: The testbench
    """
None
str
testbench_config
The testbench configuration
The testbench configuration
testbench
The testbench being generated
The testbench being generated