hwt/synthesizer/rtlLevel/optimalizator.py
def reduceProcesses(processes):
    """
    Try to merge processes as much is possible

    :param processes: list of processes instances
    """
    # sort to make order of merging same deterministic
    processes.sort(key=lambda x: (x.name, maxStmId(x)), reverse=True)
    # now try to reduce processes with nearly same structure of statements into one
    # to minimize number of processes
    for _, procs in groupedby(processes, lambda p: p.rank):
        for iA, pA in enumerate(procs):
            if pA is None:
                continue
            for iB, pB in enumerate(islice(procs, iA + 1, None)):
                if pB is None:
                    continue

                try:
                    pA = tryToMerge(pA, pB)
                except IncompatibleStructure:
                    continue
                procs[iA + 1 + iB] = None
                # procs[iA] = pA

        for p in procs:
            if p is not None:
                yield p
def reduceProcesses(processes):
    """
    Try to merge processes as much is possible

    :param processes: list of processes instances
    """
    # sort to make order of merging same deterministic
    processes.sort(key=lambda x: (x.name, maxStmId(x)), reverse=True)
    # now try to reduce processes with nearly same structure of statements into one
    # to minimize number of processes
    for _, procs in groupedby(processes, lambda p: p.rank):
        for iA, pA in enumerate(procs):
            if pA is None:
                continue
            for iB, pB in enumerate(islice(procs, iA + 1, None)):
                if pB is None:
                    continue

                try:
                    pA = tryToMerge(pA, pB)
                except IncompatibleStructure:
                    continue
                procs[iA + 1 + iB] = None
                # procs[iA] = pA

        for p in procs:
            if p is not None:
                yield p
def reduceProcesses ( processes ) : # sort to make order of merging same deterministic processes . sort ( key = lambda x : ( x . name , maxStmId ( x ) ) , reverse = True ) # now try to reduce processes with nearly same structure of statements into one # to minimize number of processes for _ , procs in groupedby ( processes , lambda p : p . rank ) : for iA , pA in enumerate ( procs ) : if pA is None : continue for iB , pB in enumerate ( islice ( procs , iA + 1 , None ) ) : if pB is None : continue try : pA = tryToMerge ( pA , pB ) except IncompatibleStructure : continue procs [ iA + 1 + iB ] = None # procs[iA] = pA for p in procs : if p is not None : yield p
Try to merge processes as much is possible

    :param processes: list of processes instances
Try to merge processes as much is possible