• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • Proof-automation
    • ACL2
    • Macro-libraries
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
      • Sv
      • Fgl
      • Vwsim
      • Vl
        • Syntax
        • Loader
        • Warnings
        • Getting-started
        • Utilities
        • Printer
        • Kit
          • Vl-lint
            • Vl-lintconfig-p
            • Condcheck
            • Lint-warning-suppression
            • Lucid
              • Typo-detection
              • Vl-lucid-dissect-pair
              • Vl-lucidstate
              • Vl-lucid-dissect-var-main
                • Vl-lucidstate-init
                • Vl-lucid-check-uses-are-spurious-instances
                • Vl-hidslice-mark
                • Vl-namedarglist-lucidcheck
                • Vl-lucidst-mark-modport
                • Vl-lucid-multidrive-detect
                • Vl-namedarg-lucidcheck
                • Vl-lucid-filter-merges
                • Vl-hidsolo-mark
                • Vl-arguments-lucidcheck
                • Vl-lucid-dissect-database
                • Vl-design-lucid
                • Vl-maybe-delayoreventcontrol-lucidcheck
                • Vl-lucid-valid-bits-for-datatype
                • Vl-delayoreventcontrol-lucidcheck
                • Vl-repeateventcontrol-lucidcheck
                • Vl-namedparamvaluelist-lucidcheck
                • Vl-scopeexprlist-mark-solo
                • Vl-plainarg-lucidcheck
                • Vl-maybe-rhsexprlist-lucidcheck
                • Vl-maybe-paramvalue-lucidcheck
                • Vl-paramvaluelist-lucidcheck
                • Vl-namedparamvalue-lucidcheck
                • Vl-maybe-gatedelay-lucidcheck
                • Vl-plainarglist-lucidcheck
                • Vl-lucidstate-mark
                • Vl-lucid-mark-simple
                • Vl-eventcontrol-lucidcheck
                • Vl-enumitemlist-lucidcheck
                • Vl-delaycontrol-lucidcheck
                • Vl-paramvalue-lucidcheck
                • Vl-paramargs-lucidcheck
                • Vl-maybe-rhsexpr-lucidcheck
                • Vl-maybe-range-lucidcheck
                • Vl-lucid-typo-detect1
                • Vl-gatedelay-lucidcheck
                • Vl-evatomlist-lucidcheck
                • Vl-rangelist-lucidcheck
                • Vl-pps-lucidstate
                • Vl-enumitem-lucidcheck
                • Vl-custom-suppress-multidrive-p
                • Vl-evatom-lucidcheck
                • Vl-rhs-lucidcheck
                • Vl-range-lucidcheck
                • Vl-lucidocclist-drop-bad-modinsts
                • Vl-hidtrace-mark-interfaces
                • Vl-hidstep-mark-interfaces
                • Vl-add-typo-candidate
                • Vl-paramdecl-lucidcheck
                • Vl-interfaceportlist-lucidcheck
                • Vl-interfaceport-lucidcheck
                • Vl-fundecl-lucidcheck
                • Vl-design-lucidcheck-main
                • Vl-taskdecllist-lucidcheck
                • Vl-taskdecl-lucidcheck
                • Vl-portdecllist-lucidcheck
                • Vl-paramdecllist-lucidcheck
                • Vl-package-lucidcheck
                • Vl-modinst-lucidcheck
                • Vl-interfacelist-lucidcheck
                • Vl-gateinstlist-lucidcheck
                • Vl-dpiimportlist-lucidcheck
                • Vl-dpiexportlist-lucidcheck
                • Vl-vardecllist-lucidcheck
                • Vl-vardecl-lucidcheck
                • Vl-typedeflist-lucidcheck
                • Vl-portdecl-lucidcheck
                • Vl-packagelist-lucidcheck
                • Vl-modulelist-lucidcheck
                • Vl-modportlist-lucidcheck
                • Vl-modinstlist-lucidcheck
                • Vl-interface-lucidcheck
                • Vl-initiallist-lucidcheck
                • Vl-gateinst-lucidcheck
                • Vl-fundecllist-lucidcheck
                • Vl-dpiimport-lucidcheck
                • Vl-dpiexport-lucidcheck
                • Vl-assignlist-lucidcheck
                • Vl-alwayslist-lucidcheck
                • Vl-typedef-lucidcheck
                • Vl-modport-lucidcheck
                • Vl-initial-lucidcheck
                • Vl-finallist-lucidcheck
                • Vl-assign-lucidcheck
                • Vl-always-lucidcheck
                • Vl-aliaslist-lucidcheck
                • Vl-module-lucidcheck
                • Vl-lucid-typo-detect
                • Vl-final-lucidcheck
                • Vl-alias-lucidcheck
                • Vl-lucidocclist-drop-foreign-writes
                • Vl-lucid-pp-multibits
                • Vl-lucid-slices-append-bits
                • Vl-scopestack-is-portdecl-p
                • Vl-lucid-valid-bits-for-decl
                • Vl-lucid-resolved-slices->bits
                • Vl-lucid-resolved-slice->bits
                • Vl-lucid-instmod-find-port-dir
                • Vl-custom-suppress-multidrive-p-default
                • Vl-lucidmergealist-count
                • Vl-lucid-scopestack-subscope-p
                • Vl-lucid-range->bits
                • Vl-lucidocclist-drop-initials/finals
                • Vl-lucid-collect-solo-occs
                • Vl-lucid-collect-resolved-slices
                • Vl-basic-lucidctx
                • Vl-scopestack->flat-transitive-names-slow
                • Vl-lucidocclist-drop-generates
                • Vl-lucid-dissect
                • Vl-lucid-first-solo-occ
                • Vl-lucid-do-merges1
                • Vl-lucid-do-merges
                • Vl-lucidocclist-remove-tails
                • Vl-lucid-some-solo-occp
                • Vl-scopestack-top-level-name
                • Vl-normalize-scopestack
                • Vl-lucid-resolved-slice-p
                • Vl-lucid-all-slices-resolved-p
                • Vl-lucid-warning-type
                • Vl-lucid-plainarglist-nicely-resolved-p
                • Vl-lucid-multidrive-summary
                • Vl-string-expr->value
                • Vl-scopestack->topname
                • Vl-pp-lucid-multidrive-summary
                • Vl-lucid-all-slices-p
                • Vl-lucidocclist-some-transistory-p
                • Vl-lucidocc-transistory-p
                • Vl-lucid-plainarg-nicely-resolved-p
                • Vl-inside-true-generate-p
                • Vl-possible-typo-warnings
                • Vl-lucid-z-gateinst-p
                • Vl-lucid-modinst-nicely-resolved-p
                • Vl-inside-interface-p
                • Vl-inside-blockscope-p
                • Vl-typocandidates
                • Vl-lucid-z-expr-p
                • Vl-lucid-z-assign-p
                • Vl-lucidmergealist
                • Vl-lucid-summarize-bits
                • Vl-pp-merged-index-list
                • Vl-pp-merged-index
                • Vl-lucid-pp-bits
              • Lvaluecheck
              • Vl-interfacelist-alwaysstyle
              • Truncation-warnings
              • Vl-modulelist-alwaysstyle
              • Skip-detection
              • Vl-lint-report
              • Vl-lintresult
              • Vl::vl-design-sv-use-set
              • Oddexpr-check
              • Leftright-check
              • Duplicate-detect
              • Selfassigns
              • *vl-lint-help*
              • Arith-compare-check
              • Dupeinst-check
              • Qmarksize-check
              • Lint-whole-file-suppression
              • Run-vl-lint-main
              • Logicassign
              • Run-vl-lint
              • Vl-print-certain-warnings
              • Duperhs-check
              • Vl-lint-top
              • Sd-filter-problems
              • Vl-modulelist-add-svbad-warnings
              • Vl-module-add-svbad-warnings
              • Check-case
              • Vl-lint-extra-actions
              • Drop-lint-stubs
              • Vl-lint-print-warnings
              • Drop-user-submodules
              • Check-namespace
              • Vl-lintconfig-loadconfig
              • Vl-lint-design->svex-modalist-wrapper
              • Vl-delete-sd-problems-for-modnames-aux
              • Vl-collect-new-names-from-orignames
              • Vl-lint-print-all-warnings
              • Vl-design-remove-unnecessary-modules
              • Vl-delete-sd-problems-for-modnames
              • Vl-always-check-style
              • Vl-vardecllist-svbad-warnings
              • Vl-vardecl-svbad-warnings
              • Vl-reportcard-remove-suppressed
              • Vl-reportcard-keep-suppressed
              • Vl-alwayslist-check-style
              • Vl-remove-nameless-descriptions
              • Vl-lint-apply-quiet
              • Vl-warninglist-remove-suppressed
              • Vl-warninglist-keep-suppressed
              • Vl-print-eliminated-descs
              • Vl-module-alwaysstyle
              • Vl-jp-reportcard-aux
              • Vl-interface-alwaysstyle
              • Vl-design-alwaysstyle
              • Vl-jp-description-locations
              • Vl-jp-reportcard
              • Vl-pp-stringlist-lines
              • Vl-jp-design-locations
              • Vl-datatype-svbad-p
              • Unpacked-range-check
              • Sd-problem-major-p
              • Vl-alwaysstyle
            • Vl-server
            • Vl-gather
            • Vl-zip
            • Vl-main
            • Split-plusargs
            • Vl-shell
            • Vl-json
          • Mlib
          • Transforms
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Lucid

    Vl-lucid-dissect-var-main

    Signature
    (vl-lucid-dissect-var-main ss item used set db genp) 
      → 
    (mv warnings possible-typop)
    Arguments
    ss — Guard (vl-scopestack-p ss).
    item — Guard (or (vl-paramdecl-p item) (vl-vardecl-p item)).
    used — Guard (vl-lucidocclist-p used).
    set — Guard (vl-lucidocclist-p set).
    db — Guard (vl-luciddb-p db).
    genp — Guard (booleanp genp).
    Returns
    warnings — Type (vl-warninglist-p warnings).
    possible-typop — Is this wire a typo-detection candidate? (Our idea is to focus on wires that are introduced implicitly and either unset or unused.).
        Type (booleanp possible-typop).

    Definitions and Theorems

    Function: vl-lucid-dissect-var-main

    (defun vl-lucid-dissect-var-main (ss item used set db genp)
     (declare (xargs :guard (and (vl-scopestack-p ss)
                                 (or (vl-paramdecl-p item)
                                     (vl-vardecl-p item))
                                 (vl-lucidocclist-p used)
                                 (vl-lucidocclist-p set)
                                 (vl-luciddb-p db)
                                 (booleanp genp))))
     (let ((__function__ 'vl-lucid-dissect-var-main))
      (declare (ignorable __function__))
      (b*
       ((used (vl-lucidocclist-fix used))
        (set (vl-lucidocclist-fix set))
        (tag (tag item))
        (vartype
            (if (eq tag :vl-vardecl)
                (if (vl-scopestack-is-portdecl-p (vl-vardecl->name item)
                                                 ss)
                    "Port"
                  "Variable")
              "Parameter"))
        (name (if (eq tag :vl-vardecl)
                  (vl-vardecl->name item)
                (vl-paramdecl->name item)))
        (warnings (vl-lucid-multidrive-detect ss item set genp))
        ((when (and (atom used) (atom set)))
         (mv
          (warn :type (vl-lucid-warning-type :vl-lucid-spurious)
                :msg "~s0 ~w1 is never used or set anywhere. (~s2)"
                :args (list vartype name
                            (with-local-ps (vl-pp-scopestack-path ss))))
          nil))
        (used-solop (vl-lucid-some-solo-occp used))
        (set-solop (vl-lucid-some-solo-occp set))
        ((when (and used-solop set-solop))
         (mv warnings nil))
        ((mv simplep valid-bits)
         (vl-lucid-valid-bits-for-decl item ss))
        (warnings
         (b*
          (((when (atom used))
            (warn :type (vl-lucid-warning-type :vl-lucid-unused)
                  :msg "~s0 ~w1 is set but is never used. (~s2)"
                  :args (list vartype name
                              (with-local-ps (vl-pp-scopestack-path ss))
                              item)))
           ((when used-solop) warnings)
           ((unless (and simplep (vl-lucid-all-slices-p used)
                         (vl-lucid-all-slices-resolved-p used)))
            warnings)
           (used-bits (vl-lucid-resolved-slices->bits used item))
           (unused-bits (difference valid-bits used-bits))
           ((unless unused-bits) warnings))
          (warn
            :type (vl-lucid-warning-type :vl-lucid-unused)
            :msg "~s0 ~w1 has some bits that are never used: ~s2. (~s3)"
            :args (list vartype name
                        (vl-lucid-summarize-bits unused-bits)
                        (with-local-ps (vl-pp-scopestack-path ss))
                        item))))
        (warnings
         (b*
          (((when (atom set))
            (b*
             (((wmv just-passed-to-spurious-instances
                    warnings)
               (vl-lucid-check-uses-are-spurious-instances
                    name used db 100))
              ((when just-passed-to-spurious-instances)
               (warn
                :type :vl-lucid-spurious-port
                :msg
                "~s0 ~w1 is never set and is only passed to module instances where it is not used. (~s2)"
                :args (list vartype name
                            (with-local-ps (vl-pp-scopestack-path ss))
                            item))))
             (warn
                  :type (vl-lucid-warning-type :vl-lucid-unset)
                  :msg "~s0 ~w1 is used but is never initialized. (~s2)"
                  :args (list vartype name
                              (with-local-ps (vl-pp-scopestack-path ss))
                              item))))
           ((when set-solop) warnings)
           ((unless (and simplep (vl-lucid-all-slices-p set)
                         (vl-lucid-all-slices-resolved-p set)))
            warnings)
           (set-bits (vl-lucid-resolved-slices->bits set item))
           (unset-bits (difference valid-bits set-bits))
           ((unless unset-bits) warnings))
          (warn
             :type (vl-lucid-warning-type :vl-lucid-unset)
             :msg "~s0 ~w1 has some bits that are never set: ~s2. (~s3)"
             :args (list vartype name
                         (vl-lucid-summarize-bits unset-bits)
                         (with-local-ps (vl-pp-scopestack-path ss))
                         item))))
        (typop (and (or (atom used) (atom set))
                    (eq (tag item) :vl-vardecl)
                    (consp (assoc-equal "VL_IMPLICIT"
                                        (vl-vardecl->atts item))))))
       (mv warnings typop))))

    Theorem: vl-warninglist-p-of-vl-lucid-dissect-var-main.warnings

    (defthm vl-warninglist-p-of-vl-lucid-dissect-var-main.warnings
      (b* (((mv ?warnings ?possible-typop)
            (vl-lucid-dissect-var-main ss item used set db genp)))
        (vl-warninglist-p warnings))
      :rule-classes :rewrite)

    Theorem: booleanp-of-vl-lucid-dissect-var-main.possible-typop

    (defthm booleanp-of-vl-lucid-dissect-var-main.possible-typop
      (b* (((mv ?warnings ?possible-typop)
            (vl-lucid-dissect-var-main ss item used set db genp)))
        (booleanp possible-typop))
      :rule-classes :type-prescription)

    Theorem: vl-lucid-dissect-var-main-of-vl-scopestack-fix-ss

    (defthm vl-lucid-dissect-var-main-of-vl-scopestack-fix-ss
      (equal (vl-lucid-dissect-var-main (vl-scopestack-fix ss)
                                        item used set db genp)
             (vl-lucid-dissect-var-main ss item used set db genp)))

    Theorem: vl-lucid-dissect-var-main-vl-scopestack-equiv-congruence-on-ss

    (defthm
         vl-lucid-dissect-var-main-vl-scopestack-equiv-congruence-on-ss
     (implies
       (vl-scopestack-equiv ss ss-equiv)
       (equal
            (vl-lucid-dissect-var-main ss item used set db genp)
            (vl-lucid-dissect-var-main ss-equiv item used set db genp)))
     :rule-classes :congruence)

    Theorem: vl-lucid-dissect-var-main-of-vl-lucidocclist-fix-used

    (defthm vl-lucid-dissect-var-main-of-vl-lucidocclist-fix-used
      (equal
           (vl-lucid-dissect-var-main ss item (vl-lucidocclist-fix used)
                                      set db genp)
           (vl-lucid-dissect-var-main ss item used set db genp)))

    Theorem: vl-lucid-dissect-var-main-vl-lucidocclist-equiv-congruence-on-used

    (defthm
     vl-lucid-dissect-var-main-vl-lucidocclist-equiv-congruence-on-used
     (implies
       (vl-lucidocclist-equiv used used-equiv)
       (equal
            (vl-lucid-dissect-var-main ss item used set db genp)
            (vl-lucid-dissect-var-main ss item used-equiv set db genp)))
     :rule-classes :congruence)

    Theorem: vl-lucid-dissect-var-main-of-vl-lucidocclist-fix-set

    (defthm vl-lucid-dissect-var-main-of-vl-lucidocclist-fix-set
     (equal
       (vl-lucid-dissect-var-main ss item used (vl-lucidocclist-fix set)
                                  db genp)
       (vl-lucid-dissect-var-main ss item used set db genp)))

    Theorem: vl-lucid-dissect-var-main-vl-lucidocclist-equiv-congruence-on-set

    (defthm
      vl-lucid-dissect-var-main-vl-lucidocclist-equiv-congruence-on-set
     (implies
       (vl-lucidocclist-equiv set set-equiv)
       (equal
            (vl-lucid-dissect-var-main ss item used set db genp)
            (vl-lucid-dissect-var-main ss item used set-equiv db genp)))
     :rule-classes :congruence)

    Theorem: vl-lucid-dissect-var-main-of-vl-luciddb-fix-db

    (defthm vl-lucid-dissect-var-main-of-vl-luciddb-fix-db
     (equal
         (vl-lucid-dissect-var-main ss item used set (vl-luciddb-fix db)
                                    genp)
         (vl-lucid-dissect-var-main ss item used set db genp)))

    Theorem: vl-lucid-dissect-var-main-vl-luciddb-equiv-congruence-on-db

    (defthm vl-lucid-dissect-var-main-vl-luciddb-equiv-congruence-on-db
     (implies
       (vl-luciddb-equiv db db-equiv)
       (equal
            (vl-lucid-dissect-var-main ss item used set db genp)
            (vl-lucid-dissect-var-main ss item used set db-equiv genp)))
     :rule-classes :congruence)

    Theorem: vl-lucid-dissect-var-main-of-bool-fix-genp

    (defthm vl-lucid-dissect-var-main-of-bool-fix-genp
     (equal
      (vl-lucid-dissect-var-main ss
                                 item used set db (acl2::bool-fix genp))
      (vl-lucid-dissect-var-main ss item used set db genp)))

    Theorem: vl-lucid-dissect-var-main-iff-congruence-on-genp

    (defthm vl-lucid-dissect-var-main-iff-congruence-on-genp
     (implies
       (iff genp genp-equiv)
       (equal
            (vl-lucid-dissect-var-main ss item used set db genp)
            (vl-lucid-dissect-var-main ss item used set db genp-equiv)))
     :rule-classes :congruence)