• 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
    • Modnamespace

    Vl-find-moduleitem

    Legacy -- Use scopestack instead. A (naive) lookup operation that can find any name in the module's namespace.

    Signature
    (vl-find-moduleitem name x) → item?
    Arguments
    name — Guard (stringp name).
    x — Guard (vl-module-p x).

    This is our main, naive spec for what it means to look up a name in a module's namespace. Note that we don't look for port declarations! (But typically this will find the corresponding net/reg declaration for a port.)

    Typically you will want to use vl-fast-find-moduleitem when looking up multiple items.

    Definitions and Theorems

    Function: vl-find-moduleitem

    (defun vl-find-moduleitem (name x)
      (declare (xargs :guard (and (stringp name) (vl-module-p x))))
      (let ((__function__ 'vl-find-moduleitem))
        (declare (ignorable __function__))
        (b* (((vl-module x) x)
             (name (string-fix name)))
          (or (vl-find-vardecl name x.vardecls)
              (vl-find-paramdecl name x.paramdecls)
              (vl-find-fundecl name x.fundecls)
              (vl-find-taskdecl name x.taskdecls)
              (vl-find-modinst name x.modinsts)
              (vl-find-gateinst name x.gateinsts)))))

    Theorem: vl-find-moduleitem-type-when-nothing-else

    (defthm vl-find-moduleitem-type-when-nothing-else
      (implies (and (vl-find-moduleitem name x)
                    (not (vl-vardecl-p (vl-find-moduleitem name x)))
                    (not (vl-paramdecl-p (vl-find-moduleitem name x)))
                    (not (vl-fundecl-p (vl-find-moduleitem name x)))
                    (not (vl-taskdecl-p (vl-find-moduleitem name x)))
                    (not (vl-modinst-p (vl-find-moduleitem name x))))
               (vl-gateinst-p (vl-find-moduleitem name x)))
      :rule-classes ((:rewrite :backchain-limit-lst 1)))

    Theorem: type-of-vl-find-moduleitem

    (defthm type-of-vl-find-moduleitem
      (and (equal (equal (tag (vl-find-moduleitem name x))
                         :vl-vardecl)
                  (vl-vardecl-p (vl-find-moduleitem name x)))
           (equal (equal (tag (vl-find-moduleitem name x))
                         :vl-paramdecl)
                  (vl-paramdecl-p (vl-find-moduleitem name x)))
           (equal (equal (tag (vl-find-moduleitem name x))
                         :vl-fundecl)
                  (vl-fundecl-p (vl-find-moduleitem name x)))
           (equal (equal (tag (vl-find-moduleitem name x))
                         :vl-taskdecl)
                  (vl-taskdecl-p (vl-find-moduleitem name x)))
           (equal (equal (tag (vl-find-moduleitem name x))
                         :vl-modinst)
                  (vl-modinst-p (vl-find-moduleitem name x)))
           (equal (equal (tag (vl-find-moduleitem name x))
                         :vl-gateinst)
                  (vl-gateinst-p (vl-find-moduleitem name x)))))

    Theorem: consp-of-vl-find-moduleitem

    (defthm consp-of-vl-find-moduleitem
      (equal (consp (vl-find-moduleitem name x))
             (if (vl-find-moduleitem name x) t nil)))

    Theorem: vl-find-moduleitem-when-in-namespace

    (defthm vl-find-moduleitem-when-in-namespace
      (implies (member-equal name (vl-module->modnamespace x))
               (vl-find-moduleitem name x)))

    Theorem: vl-find-moduleitem-of-str-fix-name

    (defthm vl-find-moduleitem-of-str-fix-name
      (equal (vl-find-moduleitem (str-fix name) x)
             (vl-find-moduleitem name x)))

    Theorem: vl-find-moduleitem-streqv-congruence-on-name

    (defthm vl-find-moduleitem-streqv-congruence-on-name
      (implies (streqv name name-equiv)
               (equal (vl-find-moduleitem name x)
                      (vl-find-moduleitem name-equiv x)))
      :rule-classes :congruence)

    Theorem: vl-find-moduleitem-of-vl-module-fix-x

    (defthm vl-find-moduleitem-of-vl-module-fix-x
      (equal (vl-find-moduleitem name (vl-module-fix x))
             (vl-find-moduleitem name x)))

    Theorem: vl-find-moduleitem-vl-module-equiv-congruence-on-x

    (defthm vl-find-moduleitem-vl-module-equiv-congruence-on-x
      (implies (vl-module-equiv x x-equiv)
               (equal (vl-find-moduleitem name x)
                      (vl-find-moduleitem name x-equiv)))
      :rule-classes :congruence)