• 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
          • Finding-by-name
          • Expr-tools
          • Expr-slicing
          • Stripping-functions
          • Stmt-tools
          • Modnamespace
            • Vl-find-moduleitem
            • Vl-make-moditem-alist
            • Vl-module->modnamespace
            • Vl-moditem
            • Vl-fast-find-moduleitem
            • Vl-moditem-alist
            • Vl-moditemlist
          • 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

Modnamespace

Functions related to a module's namespace.

BOZO this is generally obviated by scopestack. New code shouldn't be written using modnamespace.

Namespaces are discussed in Section 4.11 of the Verilog-2005 standard. In particular, note that ports and port declarations are given special treatment: they are said to be in a separate namespace which "overlaps" the regular module namespace.

I think this distinction is only made so that you can refer to both ports and to items in the regular module namespace from expressions, etc. The important consequence of this is that it is legal to write things such as:

input x ;
wire x ;

Even though it would be illegal to declare x to be a wire twice, or as both a wire and a reg, and so on.

At any rate, in this file we introduce a number of routines for extracting the names from lists of port declarations, net declarations, and so on. These culminate in

(VL-MODULE->MODNAMESPACE X) : MODULE -> STRING LIST

Which returns a list of all names found in the module's namespace. Note that any reasonable module is required to have a unique modnamespace.

BOZO this does not get named blocks. Unclear how nested blocks are supposed to be handled. We do at least get function and task names, and names from events.

Subtopics

Vl-find-moduleitem
Legacy -- Use scopestack instead. A (naive) lookup operation that can find any name in the module's namespace.
Vl-make-moditem-alist
Legacy -- Use scopestack instead. Main routine for building an fast alist for looking up module items.
Vl-module->modnamespace
Main function for gathering up the names that are declared as parameters, wires, variables, registers, and so on.
Vl-moditem
Legacy -- Use scopestack instead. Module items are basically any named object that can occur within a module (except that we don't support, e.g., named blocks.)
Vl-fast-find-moduleitem
Legacy -- Use scopestack instead. Alternative to vl-find-moduleitem using fast alist lookups.
Vl-moditem-alist
An alist mapping stringp to vl-moditem-p.
Vl-moditemlist
A list of vl-moditem-p objects.