def check(self, input, unit): libunit = iirs.Get_Library_Unit(unit) k = iirs.Get_Kind(libunit) if k == iirs.Iir_Kind.Architecture_Body: self._used = set() ent = thin.Iirs_Utils.Get_Entity(libunit) self.mark(ent) self.mark(libunit) self.report_unused(ent) self.report_unused(libunit) elif k == iirs.Iir_Kind.Package_Body: self._used = set() self.mark(libunit) self.report_unused(libunit)
def sequential_iter(n): """Iterator on sequential statements. The first node must be either a process or a subprogram body.""" if n == thin.Null_Iir: return k = iirs.Get_Kind(n) if k in [ iirs.Iir_Kind.Process_Statement, iirs.Iir_Kind.Sensitized_Process_Statement, iirs.Iir_Kind.Function_Body, iirs.Iir_Kind.Procedure_Body ]: for n1 in chain_iter(iirs.Get_Sequential_Statement_Chain(n)): yield n1 for n2 in sequential_iter(n1): yield n2 elif k == iirs.Iir_Kind.If_Statement: while True: n = iirs.Get_Chain(n) if n == thin.Null_Iir: break yield n for n1 in sequential_iter(n): yield n1 elif k == iirs.Iir_Kind.Case_Statement: for ch in chain_iter(iirs.Get_Case_Statement_Alternative_Chain(n)): stmt = iirs.Get_Associated_Chain(ch) if stmt != thin.Null_Iir: for n1 in chain_iter(stmt): yield n1 for n2 in sequential_iter(n1): yield n2 elif k in [ iirs.Iir_Kind.For_Loop_Statement, iirs.Iir_Kind.While_Loop_Statement ]: for n1 in chain_iter(iirs.Get_Sequential_Statement_Chain(n)): yield n1 for n2 in sequential_iter(n1): yield n2 elif k in [ iirs.Iir_Kind.Assertion_Statement, iirs.Iir_Kind.Wait_Statement, iirs.Iir_Kind.Null_Statement, iirs.Iir_Kind.Exit_Statement, iirs.Iir_Kind.Next_Statement, iirs.Iir_Kind.Return_Statement, iirs.Iir_Kind.Variable_Assignment_Statement, iirs.Iir_Kind.Simple_Signal_Assignment_Statement, iirs.Iir_Kind.Procedure_Call_Statement ]: return else: assert False, "unknown node of kind {}".format(kind_image(k))
def is_edge_condition(self, cond): k = iirs.Get_Kind(cond) if k != iirs.Iir_Kind.Function_Call: # TODO: allow 'event ? return (None, None) imp = iirs.Get_Implementation(cond) if imp == thin.Ieee.Rising_Edge.value: edge = True elif imp == thin.Ieee.Falling_Edge.value: edge = False else: return (None, None) assoc = iirs.Get_Parameter_Association_Chain(cond) return (iirs.Get_Actual(assoc), edge)
def in_sensitivity(self, lst, sig): sig = thin.Iirs_Utils.Strip_Denoting_Name(sig) for el in thinutils.list_iter(lst): el = thin.Iirs_Utils.Strip_Denoting_Name(el) # FIXME: handle suffix if el == sig: return True k = iirs.Get_Kind(sig) if k == iirs.Iir_Kind.Slice_Name \ or k == iirs.Iir_Kind.Indexed_Name \ or k == iirs.Iir_Kind.Selected_Element: if self.in_sensitivity(lst, iirs.Get_Prefix(sig)): return True return False
def check(self, input, node): k = iirs.Get_Kind(node) if k == iirs.Iir_Kind.Simple_Name \ or k == iirs.Iir_Kind.Selected_Name: self.check_identifier(node, iirs.Get_Named_Entity(node)) elif k == iirs.Iir_Kind.Selected_Element: self.check_identifier(node, iirs.Get_Selected_Element(node)) elif k == iirs.Iir_Kind.Library_Clause: self.check_identifier(node, iirs.Get_Library_Declaration(node)) elif k == iirs.Iir_Kind.Attribute_Name: attr_val = iirs.Get_Named_Entity(node) attr_spec = iirs.Get_Attribute_Specification(attr_val) attr_name = iirs.Get_Attribute_Designator(attr_spec) self.check_identifier(node, iirs.Get_Named_Entity(attr_name))
def check(self, input, file): for unit in thinutils.chain_iter(iirs.Get_First_Design_Unit(file)): # Extract the list of clauses clauses = [] for cl in thinutils.chain_iter(iirs.Get_Context_Items(unit)): k = iirs.Get_Kind(cl) if k == iirs.Iir_Kind.Library_Clause: clauses.extend(self.extract_library(cl)) elif k == iirs.Iir_Kind.Use_Clause: clauses.extend(self.extract_use(cl)) else: assert False, "unknown context clause" if clauses: self.check_group(clauses)
def check(self, input, ast): # Build the list of use'd packages. pkgs = [] for n in thinutils.chain_iter(iirs.Get_Context_Items(ast)): if iirs.Get_Kind(n) != iirs.Iir_Kind.Use_Clause: continue cl = n while cl != thin.Null_Iir: name = iirs.Get_Selected_Name(cl) if iirs.Get_Kind(name) == iirs.Iir_Kind.Selected_By_All_Name: name = iirs.Get_Prefix(name) p = iirs.Get_Named_Entity(name) if iirs.Get_Kind(p) == iirs.Iir_Kind.Package_Declaration: pkgs.append(p) cl = iirs.Get_Use_Clause_Chain(cl) # Check dependences for du in thinutils.list_iter(iirs.Get_Dependence_List(ast)): lu = iirs.Get_Library_Unit(du) if iirs.Get_Kind(lu) == iirs.Iir_Kind.Package_Declaration: if lu != thin.Standard_Package.value and lu not in pkgs: self.error( Location.from_node(ast), "unit depends on '{}' but not by a use clause".format( nodeutils.get_identifier_str(lu)))
def check_process(self, proc): stmt = iirs.Get_Sequential_Statement_Chain(proc) if nodeutils.is_one_stmt(stmt) \ and iirs.Get_Kind(stmt) == iirs.Iir_Kind.If_Statement: (clk, rst) = self.is_register(stmt) if clk is not None: self.check_register(proc, clk, rst) return slist = iirs.Get_Sensitivity_List(proc) clist = thin.Lists.Create_Iir_List() thin.Canon.Extract_Sequential_Statement_Chain_Sensitivity( iirs.Get_Sequential_Statement_Chain(proc), clist) for el in thinutils.list_iter(clist): if not self.in_sensitivity(slist, el): self.error(Location.from_node(el), "signal not in sensitivity list") thin.Lists.Destroy_Iir_List(clist)
def check_parenthesis(self, expr): if expr == thin.Null_Iir: # For else clause. return if iirs.Get_Kind(expr) != iirs.Iir_Kind.Parenthesis_Expression: return left_loc = iirs.Get_Location(expr) right_loc = elocations.Get_Right_Paren_Location(expr) fe = thin.Location_To_File(left_loc) assert fe == thin.Location_To_File(right_loc) left_line = thin.Location_File_To_Line(left_loc, fe) right_line = thin.Location_File_To_Line(right_loc, fe) if left_line != right_line: # Assume that's for grouping return self.error(Location.from_node(expr), "useless parenthesis around expression")
def check(self, input, ast): for du in thinutils.chain_iter(iirs.Get_First_Design_Unit(ast)): ent = iirs.Get_Library_Unit(du) if iirs.Get_Kind(ent) != iirs.Iir_Kind.Entity_Declaration: continue gen = iirs.Get_Generic_Chain(ent) if gen != thin.Null_Iir: self.check_declarations(gen) ports = iirs.Get_Port_Chain(ent) if ports != thin.Null_Iir: self.check_declarations(ports) port = ports while port != thin.Null_Iir: if not iirs.Get_Has_Mode(port): self.error(Location.from_node(port), "in/out/inout required for port") port = iirs.Get_Chain(port)
def check(self, input, node): k = iirs.Get_Kind(node) if k in [iirs.Iir_Kind.If_Statement, iirs.Iir_Kind.Elsif, iirs.Iir_Kind.While_Loop_Statement, iirs.Iir_Kind.Exit_Statement, iirs.Iir_Kind.Next_Statement, iirs.Iir_Kind.If_Generate_Statement, iirs.Iir_Kind.If_Generate_Else_Clause, iirs.Iir_Kind.Conditional_Waveform, iirs.Iir_Kind.Conditional_Expression]: self.check_parenthesis(iirs.Get_Condition(node)) elif k in [iirs.Iir_Kind.Case_Generate_Statement, iirs.Iir_Kind.Case_Statement, iirs.Iir_Kind.Concurrent_Selected_Signal_Assignment, iirs.Iir_Kind.Selected_Waveform_Assignment_Statement, iirs.Iir_Kind.Return_Statement]: self.check_parenthesis(iirs.Get_Expression(node))
def check_identifier(self, node, dfn): if dfn == 0: # Can happen for architecture in entity aspect return ref_str = nodeutils.get_identifier_str(node) handler = self.find_handler(dfn) def_str = handler(dfn, ref_str) if ref_str == def_str: # OK! return if iirs.Get_Kind(dfn) == iirs.Iir_Kind.Guard_Signal_Declaration: # Guard signals are implicitely declared def_str = "GUARD" if ref_str == def_str: return self.error( Location.from_node(node), "{} is not the correct spelling for '{}'".format(ref_str, def_str))
def chk_concurrent(self, head, level): nlevel = level + self._l for n in thinutils.chain_iter(head): self.chk_level(n, iirs.Get_Location(n), level) k = iirs.Get_Kind(n) if k == iirs.Iir_Kind.Component_Instantiation_Statement: # TODO pass elif (k == iirs.Iir_Kind.Concurrent_Assertion_Statement or k == iirs.Iir_Kind.Concurrent_Simple_Signal_Assignment or k == iirs.Iir_Kind.Concurrent_Conditional_Signal_Assignment or k == iirs.Iir_Kind.Concurrent_Selected_Signal_Assignment): pass elif k == iirs.Iir_Kind.Concurrent_Procedure_Call_Statement: pass elif k == iirs.Iir_Kind.Block_Statement: self.chk_declarations(iirs.Get_Declaration_Chain(n), nlevel) self.chk_level(n, elocs.Get_Begin_Location(n), level) self.chk_concurrent( iirs.Get_Concurrent_Statement_Chain(n), nlevel) self.chk_level(n, elocs.Get_End_Location(n), level) elif k == iirs.Iir_Kind.For_Generate_Statement: self.chk_line_or_col( n, iirs.Get_Location(n), elocs.Get_Generate_Location(n)) self.chk_generate_body( iirs.Get_Generate_Statement_Body(n), level) self.chk_level(n, elocs.Get_End_Location(n), level) elif k == iirs.Iir_Kind.If_Generate_Statement: self.chk_line_or_col( n, iirs.Get_Location(n), elocs.Get_Generate_Location(n)) self.chk_generate_body( iirs.Get_Generate_Statement_Body(n), level) self.chk_level(n, elocs.Get_End_Location(n), level) elif (k == iirs.Iir_Kind.Sensitized_Process_Statement or k == iirs.Iir_Kind.Process_Statement): self.chk_declarations(iirs.Get_Declaration_Chain(n), nlevel) self.chk_level(n, elocs.Get_Begin_Location(n), level) self.chk_sequential( iirs.Get_Sequential_Statement_Chain(n), nlevel) self.chk_level(n, elocs.Get_End_Location(n), level)
def chk_declarations(self, head, level): nlevel = level + self._l for n in thinutils.chain_iter(head): k = iirs.Get_Kind(n) if k == iirs.Iir_Kind.Constant_Declaration \ or k == iirs.Iir_Kind.Signal_Declaration \ or k == iirs.Iir_Kind.Variable_Declaration \ or k == iirs.Iir_Kind.File_Declaration \ or k == iirs.Iir_Kind.Object_Alias_Declaration \ or k == iirs.Iir_Kind.Attribute_Declaration \ or k == iirs.Iir_Kind.Attribute_Specification: self.chk_level(n, elocs.Get_Start_Location(n), level) elif (k == iirs.Iir_Kind.Configuration_Specification or k == iirs.Iir_Kind.Disconnection_Specification): self.chk_level(n, iirs.Get_Location(n), level) elif (k == iirs.Iir_Kind.Subtype_Declaration or k == iirs.Iir_Kind.Type_Declaration or k == iirs.Iir_Kind.Anonymous_Type_Declaration): self.chk_level(n, elocs.Get_Start_Location(n), level) elif k == iirs.Iir_Kind.Component_Declaration: self.chk_level(n, elocs.Get_Start_Location(n), level) self.chk_level(n, elocs.Get_Generic_Location(n), nlevel) self.chk_level(n, elocs.Get_Port_Location(n), nlevel) self.chk_level(n, elocs.Get_End_Location(n), level) elif (k == iirs.Iir_Kind.Function_Declaration or k == iirs.Iir_Kind.Procedure_Declaration): self.chk_level(n, elocs.Get_Start_Location(n), level) elif (k == iirs.Iir_Kind.Function_Body or k == iirs.Iir_Kind.Procedure_Body): self.chk_declarations(iirs.Get_Declaration_Chain(n), nlevel) self.chk_level(n, elocs.Get_Begin_Location(n), level) self.chk_sequential( iirs.Get_Sequential_Statement_Chain(n), nlevel) self.chk_level(n, elocs.Get_End_Location(n), level) # check start elif k == iirs.Iir_Kind.Use_Clause: self.chk_level(n, iirs.Get_Location(n), level) else: assert False, "unhandled declaration {}".format( thinutils.kind_image(k))
def find_handler(self, n): """Return the function to comparse the definition with the reference.""" dfn_loc = iirs.Get_Location(n) dfn_file = thin.Location_To_File(dfn_loc) handler = self._handlers.get(dfn_file, None) if handler: return handler if dfn_loc == thin.Library_Location.value: handler = self.get_lower else: while iirs.Get_Kind(n) != iirs.Iir_Kind.Library_Declaration: n = iirs.Get_Parent(n) lib_id = iirs.Get_Identifier(n) if lib_id == std_names.Name.Std: handler = self.get_standard elif lib_id == std_names.Name.Ieee: handler = self.get_lower else: handler = self.get_user self._handlers[dfn_file] = handler return handler
def chk_library_unit(self, n, level): k = iirs.Get_Kind(n) nlevel = level + self._l self.chk_level(n, elocs.Get_Start_Location(n), level) if k == iirs.Iir_Kind.Package_Declaration \ or k == iirs.Iir_Kind.Package_Body: self.chk_declarations(iirs.Get_Declaration_Chain(n), nlevel) elif k == iirs.Iir_Kind.Entity_Declaration: self.chk_level(n, elocs.Get_Generic_Location(n), nlevel) self.chk_level(n, elocs.Get_Port_Location(n), nlevel) self.chk_declarations(iirs.Get_Declaration_Chain(n), nlevel) self.chk_level(n, elocs.Get_Begin_Location(n), level) self.chk_concurrent(iirs.Get_Concurrent_Statement_Chain(n), nlevel) elif k == iirs.Iir_Kind.Architecture_Body: self.chk_declarations(iirs.Get_Declaration_Chain(n), nlevel) self.chk_level(n, elocs.Get_Begin_Location(n), level) self.chk_concurrent(iirs.Get_Concurrent_Statement_Chain(n), nlevel) elif k == iirs.Iir_Kind.Configuration_Declaration: self.chk_declarations(iirs.Get_Declaration_Chain(n), nlevel) # TODO: block configuration else: assert False, "unhandled unit {}".format(thinutils.kind_image(k)) self.chk_level(n, elocs.Get_End_Location(n), level)
def _is_interface_port_generic(node): parent_kind = iirs.Get_Kind(iirs.Get_Parent(node)) return (parent_kind in [ iirs.Iir_Kind.Entity_Declaration, iirs.Iir_Kind.Component_Declaration, iirs.Iir_Kind.Block_Header ])
def check(self, input, node): if iirs.Get_Kind(node) == iirs.Iir_Kind.Attribute_Name: s = nodeutils.get_identifier_str(node) if string.lower(s) not in self.predefined: self.error(Location.from_node(node), "attribute name '{0}' not allowed".format(s))
def is_second_subprogram(self, decl): return iirs.Get_Kind(decl) in iirs.Iir_Kinds.Subprogram_Declaration \ and thin.Iirs_Utils.Is_Second_Subprogram_Specification(decl)
def is_generic(node): """Return True iff argument node is a generic.""" if iirs.Get_Kind(node) != iirs.Iir_Kind.Interface_Constant_Declaration: return False return _is_interface_port_generic(node)
def constructs_iter(n): """Iterator on library unit, concurrent statements and declarations that appear directly within a declarative part.""" if n == thin.Null_Iir: return k = iirs.Get_Kind(n) if k == iirs.Iir_Kind.Design_File: for n1 in chain_iter(iirs.Get_First_Design_Unit(n)): for n2 in constructs_iter(n1): yield n2 elif k == iirs.Iir_Kind.Design_Unit: n1 = iirs.Get_Library_Unit(n) yield n1 for n2 in constructs_iter(n1): yield n2 elif k in [ iirs.Iir_Kind.Entity_Declaration, iirs.Iir_Kind.Architecture_Body, iirs.Iir_Kind.Block_Statement, iirs.Iir_Kind.Generate_Statement_Body ]: for n1 in chain_iter(iirs.Get_Declaration_Chain(n)): yield n1 for n2 in constructs_iter(n1): yield n2 for n1 in chain_iter(iirs.Get_Concurrent_Statement_Chain(n)): yield n1 for n2 in constructs_iter(n1): yield n2 elif k in [ iirs.Iir_Kind.Configuration_Declaration, iirs.Iir_Kind.Package_Declaration, iirs.Iir_Kind.Package_Body, iirs.Iir_Kind.Function_Body, iirs.Iir_Kind.Procedure_Body, iirs.Iir_Kind.Protected_Type_Declaration, iirs.Iir_Kind.Protected_Type_Body, iirs.Iir_Kind.Process_Statement, iirs.Iir_Kind.Sensitized_Process_Statement ]: for n1 in chain_iter(iirs.Get_Declaration_Chain(n)): yield n1 for n2 in constructs_iter(n1): yield n2 elif k == iirs.Iir_Kind.For_Generate_Statement: n1 = iirs.Get_Generate_Statement_Body(n) yield n1 for n2 in constructs_iter(n1): yield n2 elif k == iirs.Iir_Kind.If_Generate_Statement: while n != Null_Iir: n1 = iirs.Get_Generate_Statement_Body(n) yield n1 for n2 in constructs_iter(n1): yield n2 n = iirs.Get_Generate_Else_Clause(n) elif k == iirs.Iir_Kind.Case_Generate_Statement: alt = iirs.Get_Case_Statement_Alternative_Chain(n) for n1 in chain_iter(alt): blk = iirs.Get_Associated_Block(n1) if blk != Null_Iir: n2 = iirs.Get_Generate_Statement_Body(blk) yield n2 for n3 in constructs_iter(n2): yield n3
def declarations_iter(n): """Iterator on all declarations in n.""" k = iirs.Get_Kind(n) if nodes_meta.Has_Generic_Chain(k): for n1 in chain_iter(iirs.Get_Generic_Chain(n)): yield n1 if nodes_meta.Has_Port_Chain(k): for n1 in chain_iter(iirs.Get_Port_Chain(n)): yield n1 if nodes_meta.Has_Interface_Declaration_Chain(k): for n1 in chain_iter(iirs.Get_Interface_Declaration_Chain(n)): yield n1 if nodes_meta.Has_Declaration_Chain(k): for n1 in chain_iter(iirs.Get_Declaration_Chain(n)): k1 = iirs.Get_Kind(n1) if k1 in iirs.Iir_Kinds.Specification \ or k1 == iirs.Iir_Kind.Use_Clause: # Not a declaration pass elif k1 == iirs.Iir_Kind.Signal_Attribute_Declaration: # Not a declaration pass elif k1 in [ iirs.Iir_Kind.Type_Declaration, iirs.Iir_Kind.Anonymous_Type_Declaration ]: yield n1 # Handle nested declarations: record elements, physical units, # enumeration literals... typ = iirs.Get_Type_Definition(n1) for n2 in declarations_iter(n1): yield n2 else: yield n1 # There can be nested declarations (subprograms) for n2 in declarations_iter(n1): yield n2 if nodes_meta.Has_Concurrent_Statement_Chain(k): for n1 in chain_iter(iirs.Get_Concurrent_Statement_Chain(n)): for n2 in declarations_iter(n1): yield n2 if nodes_meta.Has_Sequential_Statement_Chain(k): for n1 in chain_iter(iirs.Get_Sequential_Statement_Chain(n)): for n2 in declarations_iter(n1): yield n2 if nodes_meta.Has_Parameter_Specification(k): yield iirs.Get_Parameter_Specification(n) if nodes_meta.Has_Generate_Statement_Body(k): for n1 in declarations_iter(iirs.Get_Generate_Statement_Body(n)): yield n1 if nodes_meta.Has_Else_Clause(k): n1 = iirs.Get_Else_Clause(n) if n1 != Null_Iir: for n2 in declarations_iter(n1): yield n2 if nodes_meta.Has_Generate_Else_Clause(k): n1 = iirs.Get_Generate_Else_Clause(n) if n1 != Null_Iir: for n2 in declarations_iter(n1): yield n2 if nodes_meta.Has_Block_Header(k): n1 = iirs.Get_Block_Header(n) if n1 != Null_Iir: for n2 in declarations_iter(n1): yield n2 # All these nodes are handled: if k in [ iirs.Iir_Kind.Entity_Declaration, iirs.Iir_Kind.Architecture_Body, iirs.Iir_Kind.Package_Declaration, iirs.Iir_Kind.Package_Body, iirs.Iir_Kind.Process_Statement, iirs.Iir_Kind.Sensitized_Process_Statement, iirs.Iir_Kind.Concurrent_Assertion_Statement, iirs.Iir_Kind.Concurrent_Simple_Signal_Assignment, iirs.Iir_Kind.Concurrent_Selected_Signal_Assignment, iirs.Iir_Kind.Concurrent_Conditional_Signal_Assignment, iirs.Iir_Kind.Concurrent_Procedure_Call_Statement, iirs.Iir_Kind.Block_Statement, iirs.Iir_Kind.Block_Header, iirs.Iir_Kind.For_Generate_Statement, iirs.Iir_Kind.If_Generate_Statement, iirs.Iir_Kind.Generate_Statement_Body, iirs.Iir_Kind.Assertion_Statement, iirs.Iir_Kind.Wait_Statement, iirs.Iir_Kind.Simple_Signal_Assignment_Statement, iirs.Iir_Kind.Variable_Assignment_Statement, iirs.Iir_Kind.For_Loop_Statement, iirs.Iir_Kind.While_Loop_Statement, iirs.Iir_Kind.Case_Statement, iirs.Iir_Kind.Null_Statement, iirs.Iir_Kind.Exit_Statement, iirs.Iir_Kind.Next_Statement, iirs.Iir_Kind.Procedure_Call_Statement, iirs.Iir_Kind.Signal_Declaration, iirs.Iir_Kind.Constant_Declaration, iirs.Iir_Kind.Variable_Declaration, iirs.Iir_Kind.File_Declaration, iirs.Iir_Kind.Object_Alias_Declaration, iirs.Iir_Kind.Attribute_Declaration, iirs.Iir_Kind.Component_Declaration, iirs.Iir_Kind.Use_Clause, iirs.Iir_Kind.If_Statement, iirs.Iir_Kind.Elsif, iirs.Iir_Kind.Return_Statement, iirs.Iir_Kind.Type_Declaration, iirs.Iir_Kind.Anonymous_Type_Declaration, iirs.Iir_Kind.Subtype_Declaration, iirs.Iir_Kind.Function_Declaration, iirs.Iir_Kind.Function_Body, iirs.Iir_Kind.Procedure_Declaration, iirs.Iir_Kind.Procedure_Body, iirs.Iir_Kind.Component_Instantiation_Statement, ]: return assert False, "unknown node of kind {}".format(kind_image(k))
def check(self, input, ast): assert iirs.Get_Kind(ast) == iirs.Iir_Kind.Design_File for u in thinutils.chain_iter(iirs.Get_First_Design_Unit(ast)): self.chk_context_clauses(u, 1) lib_unit = iirs.Get_Library_Unit(u) self.chk_library_unit(lib_unit, 1)
def check(self, input, node): if iirs.Get_Kind(node) == iirs.Iir_Kind.Enumeration_Literal: if iirs.Get_Identifier(node) <= std_names.Name.Last_Character: self.error( Location.from_node(node), "character not allowed in enumeration declaration")
def chk_generate_body(self, bod, level): nlevel = level + self._l assert iirs.Get_Kind(bod) == iirs.Iir_Kind.Generate_Statement_Body self.chk_concurrent(iirs.Get_Concurrent_Statement_Chain(bod), nlevel)
def is_port(node): """Return True iff argument node is a port.""" if iirs.Get_Kind(node) != iirs.Iir_Kind.Interface_Signal_Declaration: return False return _is_interface_port_generic(node)
def check(self, input, node): k = iirs.Get_Kind(node) if k == iirs.Iir_Kind.Disconnection_Specification: self.error(Location.from_node(node), "disconnection specification not allowed")
def check(self, input, ast): assert iirs.Get_Kind(ast) == iirs.Iir_Kind.Design_File for u in thinutils.chain_iter(iirs.Get_First_Design_Unit(ast)): lu = iirs.Get_Library_Unit(u) if iirs.Get_Kind(lu) == iirs.Iir_Kind.Entity_Declaration: self.check_entity(lu)