Exemple #1
0
def process_subtype_indication(subtype_indication):
    '''
    Takes an array type produced by 'inner_vhdl_parser' and returns one from'typs'.
    '''
    constraint = subtype_indication.constraint
    type_mark = subtype_indication.type_mark
    if constraint:
        size = get_constraint_size(constraint)
    else:
        size = None
    if (not constraint):
        subtype = type_mark
    else:
        if type_mark == 'std_logic_vector':
            subtype = typs.UnresolvedConstrainedStdLogicVector(
                identifier=None,
                size=size,
                )
        elif type_mark == 'unsigned':
            subtype = typs.UnresolvedConstrainedUnsigned(
                identifier=None,
                size=size,
            )
        elif type_mark == 'signed':
            subtype = typs.UnresolvedConstrainedSigned(
                identifier=None,
                size=size,
            )
        else:
            subtype = typs.UnresolvedConstrainedArray(
                identifier=None,
                unconstrained_type_identifier=type_mark,
                size=size,
                )
    return subtype
Exemple #2
0
def process_subtype_indication(subtype_indication):
    constraint = subtype_indication.constraint
    type_mark = subtype_indication.type_mark
    if constraint:
        size = get_constraint_size(constraint)
    else:
        size = None
    if (not constraint):
        subtype = type_mark
    else:
        if type_mark == 'std_logic_vector':
            subtype = typs.UnresolvedConstrainedStdLogicVector(
                identifier=None,
                size=size,
            )
        elif type_mark == 'unsigned':
            subtype = typs.UnresolvedConstrainedUnsigned(
                identifier=None,
                size=size,
            )
        elif type_mark == 'signed':
            subtype = typs.UnresolvedConstrainedSigned(
                identifier=None,
                size=size,
            )
        else:
            subtype = typs.UnresolvedConstrainedArray(
                identifier=None,
                unconstrained_type_identifier=type_mark,
                size=size,
            )
    return subtype
Exemple #3
0
def process_subtype(typ):
    '''
    Takes a type produced by 'inner_vhdl_parser' and returns one from 'typs'.
    '''
    subtype_mark = typ.subtype_indication.type_mark
    size = get_size(typ)
    if size is None:
        # Failed to process subtype.
        processed = None
    else:
        if subtype_mark == 'std_logic_vector':
            processed = typs.UnresolvedConstrainedStdLogicVector(
                identifier=typ.identifier,
                size=size,
            )
        elif subtype_mark == 'unsigned':
            processed = typs.UnresolvedConstrainedUnsigned(
                identifier=typ.identifier,
                size=size,
            )
        elif subtype_mark == 'signed':
            processed = typs.UnresolvedConstrainedSigned(
                identifier=typ.identifier,
                size=size,
            )
        else:
            processed = typs.UnresolvedConstrainedArray(
                identifier=typ.identifier,
                unconstrained_type_identifier=subtype_mark,
                size=size,
                )
    return processed
Exemple #4
0
def process_subtype(typ):
    subtype_mark = typ.subtype_indication.type_mark
    size = get_size(typ)
    if size is None:
        # Failed to process subtype.
        processed = None
    else:
        if subtype_mark == 'std_logic_vector':
            processed = typs.UnresolvedConstrainedStdLogicVector(
                identifier=typ.identifier,
                size=size,
            )
        elif subtype_mark == 'unsigned':
            processed = typs.UnresolvedConstrainedUnsigned(
                identifier=typ.identifier,
                size=size,
            )
        elif subtype_mark == 'signed':
            processed = typs.UnresolvedConstrainedSigned(
                identifier=typ.identifier,
                size=size,
            )
        else:
            processed = typs.UnresolvedConstrainedArray(
                identifier=typ.identifier,
                unconstrained_type_identifier=subtype_mark,
                size=size,
            )
    return processed