hwt/synthesizer/rtlLevel/optimalizator.py
def tryToMerge(procA: HWProcess, procB: HWProcess):
    """
    Try merge procB into procA

    :raise IncompatibleStructure: if merge is not possible
    :attention: procA is now result if merge has succeed
    :return: procA which is now result of merge
    """
    if (checkIfIsTooSimple(procA) or
            checkIfIsTooSimple(procB) or
            areSetsIntersets(procA.outputs, procB.sensitivityList) or
            areSetsIntersets(procB.outputs, procA.sensitivityList) or
            not HdlStatement._is_mergable_statement_list(procA.statements, procB.statements)):
        raise IncompatibleStructure()

    procA.statements = HdlStatement._merge_statement_lists(
        procA.statements, procB.statements)

    procA.outputs.extend(procB.outputs)
    procA.inputs.extend(procB.inputs)
    procA.sensitivityList.extend(procB.sensitivityList)

    return procA
def tryToMerge(procA: HWProcess, procB: HWProcess):
    if (checkIfIsTooSimple(procA) or
            checkIfIsTooSimple(procB) or
            areSetsIntersets(procA.outputs, procB.sensitivityList) or
            areSetsIntersets(procB.outputs, procA.sensitivityList) or
            not HdlStatement._is_mergable_statement_list(procA.statements, procB.statements)):
        raise IncompatibleStructure()

    procA.statements = HdlStatement._merge_statement_lists(
        procA.statements, procB.statements)

    procA.outputs.extend(procB.outputs)
    procA.inputs.extend(procB.inputs)
    procA.sensitivityList.extend(procB.sensitivityList)

    return procA
def tryToMerge ( procA : HWProcess , procB : HWProcess ) : if ( checkIfIsTooSimple ( procA ) or checkIfIsTooSimple ( procB ) or areSetsIntersets ( procA . outputs , procB . sensitivityList ) or areSetsIntersets ( procB . outputs , procA . sensitivityList ) or not HdlStatement . _is_mergable_statement_list ( procA . statements , procB . statements ) ) : raise IncompatibleStructure ( ) procA . statements = HdlStatement . _merge_statement_lists ( procA . statements , procB . statements ) procA . outputs . extend ( procB . outputs ) procA . inputs . extend ( procB . inputs ) procA . sensitivityList . extend ( procB . sensitivityList ) return procA
Try merge procB into procA

    :raise IncompatibleStructure: if merge is not possible
    :attention: procA is now result if merge has succeed
    :return: procA which is now result of merge
Try merge procB into procA