示例#1
0
 def compute_anti_dependences(self):
     """Return a dictionnary of anti dependencies for design unit"""
     res = {}
     lib = libraries.Get_Libraries_Chain()
     while lib != nodes.Null_Iir:
         files = nodes.Get_Design_File_Chain(lib)
         while files != nodes.Null_Iir:
             units = nodes.Get_First_Design_Unit(files)
             while units != nodes.Null_Iir:
                 if nodes.Get_Date_State(units) == nodes.Date_State.Analyze:
                     # The unit has been analyzed, so the dependencies are know.
                     deps = nodes.Get_Dependence_List(units)
                     assert deps != nodes.Null_Iir_List
                     deps_it = lists.Iterate(deps)
                     while lists.Is_Valid(byref(deps_it)):
                         el = lists.Get_Element(byref(deps_it))
                         if nodes.Get_Kind(
                                 el) == nodes.Iir_Kind.Design_Unit:
                             if res.get(el, None):
                                 res[el].append(units)
                             else:
                                 res[el] = [units]
                         else:
                             assert False
                         lists.Next(byref(deps_it))
                 units = nodes.Get_Chain(units)
             files = nodes.Get_Chain(files)
         lib = nodes.Get_Chain(lib)
     return res
示例#2
0
def list_iter(lst) -> Generator[Any, None, None]:
    """Iterate all element of Iir_List :obj:`lst`."""
    if lst <= nodes.Iir_List_All:
        return
    iter = lists.Iterate(lst)
    while lists.Is_Valid(byref(iter)):
        yield lists.Get_Element(byref(iter))
        lists.Next(byref(iter))