• 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-parse-expr-from-str
          • Welltyped
          • Reordering-by-name
          • Flat-warnings
          • Genblob
          • Expr-building
          • Datatype-tools
          • Syscalls
          • Relocate
          • Expr-cleaning
          • Namemangle
          • Caremask
          • Port-tools
            • Port-expressions
              • Vl-atomicportexprlist->internalnames
              • Vl-port-direction
              • Vl-portlist->internalnames
              • Vl-portexpr->internalnames
              • Vl-portdecls-with-dir
              • Vl-plainarglist-blankfree-p
              • Vl-namedarglist-blankfree-p
              • Vl-modinstlist-blankfree-p
              • Vl-ports-from-portdecls
              • Vl-portlist-wellformed-p
              • Vl-maybe-portexpr-p
              • Vl-portexpr-p
              • Vl-atomicportexpr-p
              • Vl-atomicportexpr->internalname
              • Vl-port->internalnames
              • Vl-atomicportexprlist-p
              • Vl-port-wellformed-p
              • Vl-plainarg-blankfree-p
              • Vl-namedarg-blankfree-p
              • Vl-modinst-blankfree-p
              • Vl-arguments-blankfree-p
            • Vl-directionlist
          • Lvalues
        • Server
        • Kit
        • Printer
        • Esim-vl
        • Well-formedness
      • Sv
      • Fgl
      • Vwsim
      • Vl
      • X86isa
      • Svl
      • Rtl
    • Software-verification
    • Math
    • Testing-utilities
  • Port-tools

Port-expressions

Recognizers and functions for working with well-formed port expressions.

Our vl-port-p recognizer doesn't place any restrictions on a port's expression, except that it should satisfy vl-maybe-expr-p.

However, per Verilog-2005, Section 12.3.2, "the port reference for each port in the list of ports at the top of each module declaration can be one of the following:

  • A simple identifier or escaped identifier
  • A bit-select of a vector declared within the module
  • A part-select of a vector declared within the module
  • A concatenation of any of the above.

SystemVerilog-2012 presents identical rules in Section 23.2.2.1.

Note that nested concatenations are not permitted under these rules, e.g., whereas .a({b,c,d}) is a valid port, .a({b,{c,d}}) is not. Simple tests suggest that indeed none of Verilog-XL, NCVerilog, or VCS permits any nested concatenations here; see for instance failtest/port13.v.

We now introduce recognizers for the accepted expressions.

Portexprs. We recognize the set of expressions described above with vl-portexpr-p. Note that this function only checks the basic shape of its argument—it doesn't check that the names are unique or valid or that indices are sensible or anything like that.

Well-formed ports. We extend the idea of portexprs to check whole ports in vl-port-wellformed-p. This function accepts any interface ports or blank ports without complaint. However, for any regular ports with regular expressions, it insists that the expression is a portexpr.

Internalnames. Given a valid portexpr, we can easily collect up the identifiers that occur within it. The main function to do this for a portexpr is vl-portexpr->internalnames. This is a bit different than, e.g., just using vl-expr-names, because it omits any names that occur in index expressions.

Subtopics

Vl-atomicportexprlist->internalnames
(vl-atomicportexprlist->internalnames x) maps vl-atomicportexpr->internalname across a list.
Vl-port-direction
Attempt to determine the direction for a port.
Vl-portlist->internalnames
(vl-portlist->internalnames x) applies vl-port->internalnames to every member of the list x, and appends together all the resulting lists.
Vl-portexpr->internalnames
Collect the names of any internal wires that are connected to a well-formed port and return them as a list of strings.
Vl-portdecls-with-dir
Filter port declarations by direction.
Vl-plainarglist-blankfree-p
(vl-plainarglist-blankfree-p x) recognizes lists where every element satisfies vl-plainarg-blankfree-p.
Vl-namedarglist-blankfree-p
(vl-namedarglist-blankfree-p x) recognizes lists where every element satisfies vl-namedarg-blankfree-p.
Vl-modinstlist-blankfree-p
(vl-modinstlist-blankfree-p x) recognizes lists where every element satisfies vl-modinst-blankfree-p.
Vl-ports-from-portdecls
Construct basic ports corresponding to a list of portdecls.
Vl-portlist-wellformed-p
Recognizer for port lists whose expressions are well-formed.
Vl-maybe-portexpr-p
Recognizes all expressions that can validly occur in a (possibly blank) port.
Vl-portexpr-p
Recognizes all expressions that can validly occur in a (non-blank) port.
Vl-atomicportexpr-p
Recognize non-concatenations that can occur in port expressions.
Vl-atomicportexpr->internalname
Vl-port->internalnames
Vl-atomicportexprlist-p
(vl-atomicportexprlist-p x) recognizes lists where every element satisfies vl-atomicportexpr-p.
Vl-port-wellformed-p
Recognizer for ports whose expressions are well-formed.
Vl-plainarg-blankfree-p
Vl-namedarg-blankfree-p
Vl-modinst-blankfree-p
Vl-arguments-blankfree-p