Пример #1
0
    def x_get_entity_interface(self, library, name):
        def create_interfaces(inters):
            res = []
            while inters != nodes.Null_Iir:
                res.append({
                    'name':
                    name_table.Get_Name_Ptr(
                        nodes.Get_Identifier(inters)).decode('latin-1')
                })
                inters = nodes.Get_Chain(inters)
            return res

        # Find library
        lib_id = name_table.Get_Identifier(library.encode('utf-8'))
        lib = libraries.Get_Library_No_Create(lib_id)
        if lib == name_table.Null_Identifier:
            return None
        # Find entity
        ent_id = name_table.Get_Identifier(name.encode('utf-8'))
        unit = libraries.Find_Primary_Unit(lib, ent_id)
        if unit == nodes.Null_Iir:
            return None
        ent = nodes.Get_Library_Unit(unit)
        return {
            'library': library,
            'entity': name,
            'generics': create_interfaces(nodes.Get_Generic_Chain(ent)),
            'ports': create_interfaces(nodes.Get_Port_Chain(ent))
        }
Пример #2
0
    def x_get_entity_interface(self, library, name):
        def create_interfaces(inters):
            res = []
            while inters != nodes.Null_Iir:
                res.append(
                    {
                        "name": name_table.Get_Name_Ptr(
                            nodes.Get_Identifier(inters)
                        ).decode("latin-1")
                    }
                )
                inters = nodes.Get_Chain(inters)
            return res

        # Find library
        lib_id = name_table.Get_Identifier(library.encode("utf-8"))
        lib = libraries.Get_Library_No_Create(lib_id)
        if lib == name_table.Null_Identifier:
            return None
        # Find entity
        ent_id = name_table.Get_Identifier(name.encode("utf-8"))
        unit = libraries.Find_Primary_Unit(lib, ent_id)
        if unit == nodes.Null_Iir:
            return None
        ent = nodes.Get_Library_Unit(unit)
        return {
            "library": library,
            "entity": name,
            "generics": create_interfaces(nodes.Get_Generic_Chain(ent)),
            "ports": create_interfaces(nodes.Get_Port_Chain(ent)),
        }