• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
      • Sv
      • Fgl
      • Vwsim
      • Vl
        • Syntax
        • Loader
        • Warnings
        • Getting-started
        • Utilities
        • Printer
        • Kit
        • Mlib
        • Transforms
          • Unparameterization
          • Elaborate
          • Addnames
          • Annotate
            • Increment-elim
            • Make-implicit-wires
              • Shadowcheck
                • Vl-shadowcheck-genelement
                • Vl-shadowcheck-reference-name
                • Vl-shadowcheck-declare-name
                • Deltemps
                • Vl-shadowcheck-modelement
                • Vl-lexscope
                • Vl-shadowcheck-reference-scopeexpr
                • Vl-shadowcheck-reference-names
                • Vl-shadowcheck-declare-names
                • Vl-shadowcheck-paramtype
                • Vl-shadowcheck-fun/task-loaditems
                • Vl-shadowcheck-fun/task-loaditem
                • Vl-shadowcheck-fundecl
                • Vl-shadowcheck-declare-typedefs
                • Vl-shadowcheck-blockitemlist
                • Vl-shadowcheck-portdecllist
                • Vl-shadowcheck-paramdecls
                • Vl-shadowcheck-dpiimports
                • Vl-shadowcheck-taskdecls
                • Vl-shadowcheck-taskdecl
                • Vl-shadowcheck-push-scope
                • Vl-shadowcheck-blockitem
                • Vl-shadowcheck-vardecls
                • Vl-shadowcheck-vardecl
                • Vl-shadowcheck-typedef
                • Vl-shadowcheck-portdecl
                • Vl-shadowcheck-paramdecl
                • Vl-shadowcheck-modport
                • Vl-shadowcheck-modinst
                • Vl-shadowcheck-imports
                • Vl-shadowcheck-import
                • Vl-shadowcheck-gateinst
                • Vl-shadowcheck-fundecls
                • Vl-shadowcheck-dpiimport
                • Vl-shadowcheck-ports
                • Vl-shadowcheck-port
                • Vl-shadowcheck-initial
                • Vl-shadowcheck-assign
                • Vl-shadowcheck-always
                • Vl-shadowcheck-final
                • Vl-shadowcheck-alias
                • Vl-shadowcheck-state
                • Vl-shadowcheck-module
                • Vl-shadowcheck-interface
                • Vl-shadowcheck-interfaces
                • Vl-shadowcheck-modules
                • Vl-packagemap-find-packages-for-name
                • Vl-shadowcheck-design
                • Vl-lexscopes
                • Vl-expr->maybe-subtype
                • Vl-shadowcheck-pop-scope
                • Nameclash
                • Vl-portdecl-or-blockitem
                • Vl-lexscope-decls
                • Vl-packagemap
                • Vl-portdecl-or-blockitem-list
              • Implicit-wires-minutia
              • Implicit-wires-generate-scoping
              • Vl-genbase-make-implicit-wires
              • Vl-expr-names-for-implicit
              • Vl-make-implicit-wires-main
              • Vl-implicitst
              • Vl-make-port-implicit-wires
              • Vl-import-update-implicit
              • Vl-blockitemlist-update-implicit
              • Vl-blockitem-update-implicit
              • Vl-make-ordinary-implicit-wires
              • Vl-remove-declared-wires
              • Vl-implicitsts-restore-fast-alists
              • Vl-genblock-under-cond-make-implicit-wires
              • Vl-collect-exprs-for-implicit-wires-from-namedargs
              • Vl-genblock-make-implicit-wires
              • Vl-collect-exprs-for-implicit-wires-from-portargs
              • Vl-collect-exprs-for-implicit-wires-from-namedarg
              • Vl-gateinst-exprs-for-implicit-wires
              • Vl-modinst-exprs-for-implicit-wires
              • Vl-genelementlist-make-implicit-wires
              • Vl-packagemap-find-name
            • Basic-bind-elim
            • Argresolve
            • Basicsanity
            • Portdecl-sign
            • Enum-names
            • Port-resolve
            • Udp-elim
            • Vl-annotate-design
            • Vl-annotate-module
          • Clean-warnings
          • Eliminitial
          • Custom-transform-hooks
          • Problem-modules
      • X86isa
      • Svl
      • Rtl
    • Software-verification
    • Math
    • Testing-utilities
  • Make-implicit-wires

Shadowcheck

Sanity check to detect undeclared identifiers, name clashes, and tricky kinds of global name shadowing that we don't support.

In some Verilog tools, top-level and imported declarations can sometimes be shadowed by local declarations for only part of a module. For instance,

parameter foo = 1;

module m ();
  logic [3:0] a = foo;     // references the global foo
  parameter foo = 2;
  logic [3:0] b = foo;     // references the local foo
endmodule

Throughout VL we generally abstract away from the parse order and expect to be able to traverse scopes in a simple set-like way; see scopestack. This approach makes supporting this kind of lexical shadowing a challenge. To avoid any problems due to this kind of shadowing, we implement a special check to prohibit globals from being used before they are locally declared.

This checking depends on the parse order. It occurs as part of the make-implicit-wires transform. Note that we do this checking after we have already introduced implicit wires, so we can assume that implicit wires have explicit declarations.

Subtopics

Vl-shadowcheck-genelement
Main function for checking name shadowing.
Vl-shadowcheck-reference-name
Vl-shadowcheck-declare-name
Deltemps
Delete the loaditems and parse-temps fields from parsed structures. This is a final cleaning step in shadowcheck.
Vl-shadowcheck-modelement
Vl-lexscope
Representation of a single partial lexical scope.
Vl-shadowcheck-reference-scopeexpr
Vl-shadowcheck-reference-names
Vl-shadowcheck-declare-names
Vl-shadowcheck-paramtype
Vl-shadowcheck-fun/task-loaditems
Vl-shadowcheck-fun/task-loaditem
Vl-shadowcheck-fundecl
Vl-shadowcheck-declare-typedefs
Vl-shadowcheck-blockitemlist
Vl-shadowcheck-portdecllist
Vl-shadowcheck-paramdecls
Vl-shadowcheck-dpiimports
Vl-shadowcheck-taskdecls
Vl-shadowcheck-taskdecl
Vl-shadowcheck-push-scope
Vl-shadowcheck-blockitem
Vl-shadowcheck-vardecls
Vl-shadowcheck-vardecl
Vl-shadowcheck-typedef
Vl-shadowcheck-portdecl
Vl-shadowcheck-paramdecl
Vl-shadowcheck-modport
Vl-shadowcheck-modinst
Vl-shadowcheck-imports
Vl-shadowcheck-import
Vl-shadowcheck-gateinst
Vl-shadowcheck-fundecls
Vl-shadowcheck-dpiimport
Vl-shadowcheck-ports
Vl-shadowcheck-port
Vl-shadowcheck-initial
Vl-shadowcheck-assign
Vl-shadowcheck-always
Vl-shadowcheck-final
Vl-shadowcheck-alias
Vl-shadowcheck-state
Vl-shadowcheck-module
Vl-shadowcheck-interface
Vl-shadowcheck-interfaces
Vl-shadowcheck-modules
Vl-packagemap-find-packages-for-name
Vl-shadowcheck-design
Vl-lexscopes
A stack of lexical scopes.
Vl-expr->maybe-subtype
Vl-shadowcheck-pop-scope
Nameclash
Check scopes for name clashes.
Vl-portdecl-or-blockitem
Goofy structure for representing the loaditems of functions/tasks.
Vl-lexscope-decls
Main part of a vl-lexscope, mapping names to lexscope entries.
Vl-packagemap
An alist mapping stringp to vl-scopeitem-alist-p.
Vl-portdecl-or-blockitem-list
A list of vl-portdecl-or-blockitem-p objects.