sonar/core/backends/sv.py
def calculate_seeks(
    data_file, max_repeat, update_str, seek_str, count_str, converged
):
    """
    This function repeats over the generated data file for systemverilog and
    calculates the character counts for the different packets/parallel sections
    so the fseek function can work properly during readback. It's repeated
    until all the values converge to a static value.

    Args:
        data_file (list): List of commands
        max_repeat (int): Maximum number of times to repeat without convergence
        update_str (str): ???
        seek_str (str): ???
        count_str (str): ???
        converged (bool): True if the sizes converge

    Returns:
        tuple(list, bool): The data file and converged state
    """
    # pylint: disable=too-many-locals
    i = 0
    while i < max_repeat:
        char_count = 0
        continue_count = 0
        section_found = False
        continue_count_2 = 0
        index_to_edit = 0
        old_size = 0
        updated = False
        curr_section_count = 0
        cumulative_section_count = 0
        for index, line in enumerate(data_file, 0):
            char_count += len(line)
            if update_str is not None and line.startswith(update_str):
                curr_section_count = int(
                    line.split()[2]
                )  # store the # of sections
                cumulative_section_count += curr_section_count
            elif line.startswith(seek_str) and not section_found:
                if continue_count_2 < i:
                    continue_count_2 += 1
                else:
                    old_size = int(line.split()[2])
                    section_found = True
                    updated = True
                    index_to_edit = index
            elif line.startswith(count_str) and section_found and updated:
                # This is needed to handle that there will be multiple parallel
                # sections for each test vector and to ignore the first set(s)
                # when looking at the next set
                # if cumulative_section_count - curr_section_count > 0:
                #     modulo = cumulative_section_count - curr_section_count
                # else:
                #     modulo = max_repeat

                # if continue_count < i % (modulo):
                #     continue_count += 1
                if cumulative_section_count - curr_section_count > 0:
                    modulo = i - cumulative_section_count + curr_section_count
                else:
                    modulo = i

                if continue_count < modulo:
                    continue_count += 1
                else:
                    # account for new line characters and remove current line
                    size_diff = index - len(line) + char_count
                    if old_size != size_diff:
                        converged = False
                    data_file[index_to_edit] = seek_str + " " + str(size_diff)
                    i += 1
                    continue_count = 0
                    updated = False
                    # break
    return data_file, converged

    This function repeats over the generated data file for systemverilog and
    calculates the character counts for the different packets/parallel sections
    so the fseek function can work properly during readback. It's repeated
    until all the values converge to a static value.

    Args:
        data_file (list): List of commands
        max_repeat (int): Maximum number of times to repeat without convergence
        update_str (str): ???
        seek_str (str): ???
        count_str (str): ???
        converged (bool): True if the sizes converge

    Returns:
        tuple(list, bool): The data file and converged state
    
This function repeats over the generated data file for systemverilog and
calculates the character counts for the different packets/parallel sections
so the fseek function can work properly during readback. It's repeated
until all the values converge to a static value.
This function repeats over the generated data file for systemverilog and calculates the character counts for the different packets / parallel sections so the fseek function can work properly during readback . It ' s repeated until all the values converge to a static value .
def calculate_seeks(
    data_file, max_repeat, update_str, seek_str, count_str, converged
):
    i = 0
    while i < max_repeat:
        char_count = 0
        continue_count = 0
        section_found = False
        continue_count_2 = 0
        index_to_edit = 0
        old_size = 0
        updated = False
        curr_section_count = 0
        cumulative_section_count = 0
        for index, line in enumerate(data_file, 0):
            char_count += len(line)
            if update_str is not None and line.startswith(update_str):
                curr_section_count = int(
                    line.split()[2]
                )  
                cumulative_section_count += curr_section_count
            elif line.startswith(seek_str) and not section_found:
                if continue_count_2 < i:
                    continue_count_2 += 1
                else:
                    old_size = int(line.split()[2])
                    section_found = True
                    updated = True
                    index_to_edit = index
            elif line.startswith(count_str) and section_found and updated:
                if cumulative_section_count - curr_section_count > 0:
                    modulo = i - cumulative_section_count + curr_section_count
                else:
                    modulo = i
                if continue_count < modulo:
                    continue_count += 1
                else:
                    size_diff = index - len(line) + char_count
                    if old_size != size_diff:
                        converged = False
                    data_file[index_to_edit] = seek_str + " " + str(size_diff)
                    i += 1
                    continue_count = 0
                    updated = False
    return data_file, converged
def calculate_seeks ( data_file , max_repeat , update_str , seek_str , count_str , converged ) : i = 0 while i < max_repeat : char_count = 0 continue_count = 0 section_found = False continue_count_2 = 0 index_to_edit = 0 old_size = 0 updated = False curr_section_count = 0 cumulative_section_count = 0 for index , line in enumerate ( data_file , 0 ) : char_count += len ( line ) if update_str is not None and line . startswith ( update_str ) : curr_section_count = int ( line . split ( ) [ 2 ] ) cumulative_section_count += curr_section_count elif line . startswith ( seek_str ) and not section_found : if continue_count_2 < i : continue_count_2 += 1 else : old_size = int ( line . split ( ) [ 2 ] ) section_found = True updated = True index_to_edit = index elif line . startswith ( count_str ) and section_found and updated : if cumulative_section_count - curr_section_count > 0 : modulo = i - cumulative_section_count + curr_section_count else : modulo = i if continue_count < modulo : continue_count += 1 else : size_diff = index - len ( line ) + char_count if old_size != size_diff : converged = False data_file [ index_to_edit ] = seek_str + " " + str ( size_diff ) i += 1 continue_count = 0 updated = False return data_file , converged
This function repeats over the generated data file for systemverilog and
calculates the character counts for the different packets/parallel sections
so the fseek function can work properly during readback.
This function repeats over the generated data file for systemverilog and calculates the character counts for the different packets / parallel sections so the fseek function can work properly during readback .
"""
    This function repeats over the generated data file for systemverilog and
    calculates the character counts for the different packets/parallel sections
    so the fseek function can work properly during readback. It's repeated
    until all the values converge to a static value.

    Args:
        data_file (list): List of commands
        max_repeat (int): Maximum number of times to repeat without convergence
        update_str (str): ???
        seek_str (str): ???
        count_str (str): ???
        converged (bool): True if the sizes converge

    Returns:
        tuple(list, bool): The data file and converged state
    """ # pylint: disable=too-many-locals # store the # of sections # This is needed to handle that there will be multiple parallel # sections for each test vector and to ignore the first set(s) # when looking at the next set # if cumulative_section_count - curr_section_count > 0: #     modulo = cumulative_section_count - curr_section_count # else: #     modulo = max_repeat # if continue_count < i % (modulo): #     continue_count += 1 # account for new line characters and remove current line # break
tuple(list, bool): The data file and converged state
tuple ( list bool ) : The data file and converged state
data_file
List of commands
List of commands
max_repeat
Maximum number of times to repeat without convergence
Maximum number of times to repeat without convergence
update_str
None
seek_str
None
count_str
None
converged
True if the sizes converge
True if the sizes converge