• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
        • Warnings
        • Primitives
        • Use-set
        • Syntax
        • Getting-started
        • Utilities
        • Loader
        • Transforms
        • Lint
        • Mlib
          • Scopestack
          • Filtering-by-name
          • Vl-namefactory
          • Substitution
          • Allexprs
          • Hid-tools
          • Vl-consteval
          • Range-tools
          • Lvalexprs
          • Hierarchy
            • Vl-remove-unnecessary-elements
            • Vl-necessary-elements-transitive
            • Vl-dependent-elements-transitive
            • Vl-necessary-elements-direct
            • Vl-modulelist-everinstanced
            • Vl-dependent-elements-direct
            • Vl-modulelist-toplevel
            • Vl-design-deporder-modules
            • Vl-design-check-complete
            • Vl-design-upgraph
            • Immdeps
            • Vl-design-downgraph
            • Vl-collect-dependencies
            • Vl-hierarchy-free
          • Finding-by-name
          • Expr-tools
          • Expr-slicing
          • Stripping-functions
          • Stmt-tools
          • Modnamespace
          • Vl-parse-expr-from-str
          • Welltyped
          • Reordering-by-name
          • Flat-warnings
          • Genblob
          • Expr-building
          • Datatype-tools
          • Syscalls
          • Relocate
          • Expr-cleaning
          • Namemangle
          • Caremask
          • Port-tools
          • Lvalues
        • Server
        • Kit
        • Printer
        • Esim-vl
        • Well-formedness
      • Sv
      • Fgl
      • Vwsim
      • Vl
      • X86isa
      • Svl
      • Rtl
    • Software-verification
    • Math
    • Testing-utilities
  • Mlib

Hierarchy

Functions for working with the hierarchy of dependencies between Verilog descriptions.

In Verilog-2005, the modules in a design form a hierarchy. Here is some terminology we'll use regarding this hierarchy:

  • We say that superior modules depend on the modules they instantiate.
  • We say that submodules are necessary for the modules that instantiate them.
  • We say that modules are missing if they are instantiated but never defined.
  • We say that a module list is complete if every module that is ever instantiated has a definition.

SystemVerilog adds many kinds of top-level descriptions besides modules. For instance, we may have interfaces, packages, programs, and so forth. There may also be top-level declarations of parameters, functions, etc., that are not embedded within any containing package, module, etc.

We can imagine a similar, expanded notion of hierarchy that can be applied to designs with these other kinds of descriptions.

In the functions below, we take a rather inclusive view of the dependencies between design elements. We view the design as containing a directed graph of dependencies:

  • The nodes are any top-level design elements. For instance, a node might be a top-level container such as a module, interface, or package; it also might be a top-level function declaration, parameter, etc.
  • The edges in the graph are dependencies from one node to another. For instance, we will say a superior module depends on the submodule it instantiates, an interface depends on any packages it imports, a parameter depends on the data type it refers to, and so forth.

This inclusive view makes collecting dependencies somewhat involved. We have to walk through the expressions and check for references to items from other packages. We also have to examine the data type of every variable. The work of extracting the core dependency graph is done by the immdeps functions.

Once we have collected a dependency graph, we can use it for many purposes.

Subtopics

Vl-remove-unnecessary-elements
Throws away whatever part of the design is not necessary for particular design elements.
Vl-necessary-elements-transitive
Gathers the names of all design elements that particular descriptions transitively depend on.
Vl-dependent-elements-transitive
Gather the names of all design elements that transitively depend on particular descriptions.
Vl-necessary-elements-direct
Gathers the names of all design elements that particular descriptions directly depend on.
Vl-modulelist-everinstanced
Gather the names of every module and interface ever instanced in a module list or used in an interface port.
Vl-dependent-elements-direct
Gathers the names of all design elements that directly depend on particular descriptions.
Vl-modulelist-toplevel
(vl-modulelist-toplevel x) gathers the names of any modules that are defined in the module list x but are never instantiated in x, and returns them as an ordered set.
Vl-design-deporder-modules
Dependency-order sort the modules of a design.
Vl-design-check-complete
Check whether we have definitions for all of the descriptions used throughout the design.
Vl-design-upgraph
Graph of upward dependencies. Fast alist.
Immdeps
Functions for collecting the immediate dependencies for various kinds of descriptions, i.e., for collecting the edges of the hierarchy graph.
Vl-design-downgraph
Graph of downward dependencies. Fast alist.
Vl-collect-dependencies
Vl-hierarchy-free
Free memoize tables associated with hierarchy functions.