@classmethod
def _find_entity_references(cls, code):
    """
        Find all entity references from instantiations or block configurations
        """
    references = []
    for match in cls._entity_reference_re.finditer(code):
        if match.group('arch') is None:
            references.append(cls('entity', match.group('lib'), match.group
                ('ent')))
        else:
            references.append(cls('entity', match.group('lib'), match.group
                ('ent'), match.group('arch')))
    return references
