sonar/core/generate.py
def finalize_waits(testbench_config):
    """
    Using the test vectors in the testbench, this method aggregates all the
    wait conditions as required for the Sonar backend

    Args:
        testbench_config (Testbench): The user-defined testbench configuration

    Returns:
        Testbench: Updated testbench configuration
    """

    def update_waits(index, temp_key):
        if temp_key.isdigit():
            if int(temp_key) >= index:
                raise Exception
            return None, index
        if temp_key not in conditions:
            new_key = str(index)
            waits.append({"condition": temp_key, "key": new_key})
            conditions.append(temp_key)
            index += 1
            return new_key, index
        for wait in waits:
            if wait["condition"] == temp_key:
                key = wait["key"]
                break
        return key, index

    waits = []
    conditions = []
    flag_present = False
    index = 0
    for vector in testbench_config.vectors:
        for thread in vector.threads:
            for command in thread.commands:
                if "wait" in command:
                    temp_key = command["wait"]["key"]
                    if temp_key == "flag":
                        flag_present = True
                        continue
                    updated_key, index = update_waits(index, temp_key)
                    if updated_key:
                        command["wait"]["key"] = updated_key
    if flag_present:
        waits.append({"condition": "wait(flags[args[0]]);", "key": "flag"})
    testbench_config.wait_conditions = waits
    return testbench_config

    Using the test vectors in the testbench, this method aggregates all the
    wait conditions as required for the Sonar backend

    Args:
        testbench_config (Testbench): The user-defined testbench configuration

    Returns:
        Testbench: Updated testbench configuration
    
Using the test vectors in the testbench, this method aggregates all the
wait conditions as required for the Sonar backend
Using the test vectors in the testbench this method aggregates all the wait conditions as required for the Sonar backend
def finalize_waits(testbench_config):
    def update_waits(index, temp_key):
        if temp_key.isdigit():
            if int(temp_key) >= index:
                raise Exception
            return None, index
        if temp_key not in conditions:
            new_key = str(index)
            waits.append({"condition": temp_key, "key": new_key})
            conditions.append(temp_key)
            index += 1
            return new_key, index
        for wait in waits:
            if wait["condition"] == temp_key:
                key = wait["key"]
                break
        return key, index
    waits = []
    conditions = []
    flag_present = False
    index = 0
    for vector in testbench_config.vectors:
        for thread in vector.threads:
            for command in thread.commands:
                if "wait" in command:
                    temp_key = command["wait"]["key"]
                    if temp_key == "flag":
                        flag_present = True
                        continue
                    updated_key, index = update_waits(index, temp_key)
                    if updated_key:
                        command["wait"]["key"] = updated_key
    if flag_present:
        waits.append({"condition": "wait(flags[args[0]]);", "key": "flag"})
    testbench_config.wait_conditions = waits
    return testbench_config
def finalize_waits ( testbench_config ) : def update_waits ( index , temp_key ) : if temp_key . isdigit ( ) : if int ( temp_key ) >= index : raise Exception return None , index if temp_key not in conditions : new_key = str ( index ) waits . append ( { "condition" : temp_key , "key" : new_key } ) conditions . append ( temp_key ) index += 1 return new_key , index for wait in waits : if wait [ "condition" ] == temp_key : key = wait [ "key" ] break return key , index waits = [ ] conditions = [ ] flag_present = False index = 0 for vector in testbench_config . vectors : for thread in vector . threads : for command in thread . commands : if "wait" in command : temp_key = command [ "wait" ] [ "key" ] if temp_key == "flag" : flag_present = True continue updated_key , index = update_waits ( index , temp_key ) if updated_key : command [ "wait" ] [ "key" ] = updated_key if flag_present : waits . append ( { "condition" : "wait(flags[args[0]]);" , "key" : "flag" } ) testbench_config . wait_conditions = waits return testbench_config
Using the test vectors in the testbench, this method aggregates all the
wait conditions as required for the Sonar backend
Using the test vectors in the testbench this method aggregates all the wait conditions as required for the Sonar backend
"""
    Using the test vectors in the testbench, this method aggregates all the
    wait conditions as required for the Sonar backend

    Args:
        testbench_config (Testbench): The user-defined testbench configuration

    Returns:
        Testbench: Updated testbench configuration
    """
Updated testbench configuration
Updated testbench configuration
Testbench
testbench_config
The user-defined testbench configuration
The user - defined testbench configuration