• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • 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
          • Vl-lint
            • Vl-lintconfig-p
            • Condcheck
            • Lint-warning-suppression
            • Lucid
            • Lvaluecheck
            • Vl-interfacelist-alwaysstyle
            • Truncation-warnings
              • Vl-maybe-warn-about-implicit-truncation
              • Vl-struct-assignpat-keyval-type-err-warn
              • Vl-maybe-warn-about-implicit-extension
              • Vl-check-datatype-compatibility
              • Vl-subexpr-type-error-list-combine
              • Vl-datatype-compatibility-type-error
              • Vl-type-error-qmark-combine
              • Vl-type-error
              • Vl-subexpr-type-error-list-warn
              • Vl-assignpat-cast-type-error-warn
              • Vl-typecast-type-error-warn
              • Vl-check-datatype-assignment-compatibility
              • Vl-okay-to-truncate-expr
              • Vl-check-datatype-equivalence
              • Vl-maybe-type-error
              • Vl-classify-extension-warning-hook
                • Vl-classify-extension-warning-default
                • Vl-subexpr-type-error
                • Vl-collect-toobig-constant-atoms
                • Vl-dimensionlist-compare-sizes
                • Vl-dimension-compare-sizes
                • Vl-unsized-atom-p
                • Vl-toobig-constant-atom-p
                • Vl-some-unsized-atom-p
                • Vl-expr-is-{'0, ...}-p
                • Vl-expr-is-{n{0}}-p
                • Vl-subexpr-type-error-list
                • Vl-typecompat-p
              • 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
    • Vl-classify-extension-warning-hook

    Vl-classify-extension-warning-default

    Default heuristic for filtering extension warnings.

    Signature
    (vl-classify-extension-warning-default lhs-size x-selfsize x ss) 
      → 
    *
    Arguments
    lhs-size — Guard (natp lhs-size).
    x-selfsize — Guard (natp x-selfsize).
    x — Guard (vl-expr-p x).
    ss — Guard (vl-scopestack-p ss).

    We found that extension warnings were frequently triggered by things like assign {carry,sum} = a + b where the designer seems to explicitly intend to get the carry bit. We therefore only cause a minor warning if the right-hand side is composed only of additions. Later it turned out we need to permit selects, too. And later we decided to also add subtraction as a permitted operation.

    Another kind of extension warning that is stupidly minor is when we just have assignments like assign foo[127:0] = 0;. We now do not even create a minor warning for assignments where the rhs is a constant.

    Definitions and Theorems

    Function: vl-classify-extension-warning-default

    (defun vl-classify-extension-warning-default
           (lhs-size x-selfsize x ss)
     (declare (xargs :guard (and (natp lhs-size)
                                 (natp x-selfsize)
                                 (vl-expr-p x)
                                 (vl-scopestack-p ss))))
     (declare (ignorable lhs-size x-selfsize ss))
     (declare (xargs :guard (> lhs-size x-selfsize)))
     (let ((__function__ 'vl-classify-extension-warning-default))
      (declare (ignorable __function__))
      (vl-expr-case
       x :vl-literal
       (vl-value-case x.val
                      :vl-extint nil
                      :vl-constint (cond (x.val.wasunsized nil)
                                         ((eql x.val.value 0) nil)
                                         (t :vl-warn-extension))
                      :otherwise :vl-warn-extension)
       :vl-concat
       (if (|VL-EXPR-IS-{'0, ...}-P| x)
           nil
         :vl-warn-extension)
       :vl-multiconcat
       (if (vl-expr-is-{n{0}}-p x)
           nil
         :vl-warn-extension)
       :otherwise
       (b*
        ((ops (vl-expr-ops x))
         (minorp
          (and
           (or (member-equal :vl-binary-plus ops)
               (member-equal :vl-binary-minus ops)
               (member-equal :vl-binary-times ops))
           (subsetp-equal
               ops
               '(:vl-binary-plus :vl-binary-minus
                                 :vl-partselect-colon :vl-bitselect)))))
        (if minorp :vl-warn-extension-minor
          :vl-warn-extension)))))

    Theorem: vl-classify-extension-warning-default-of-nfix-lhs-size

    (defthm vl-classify-extension-warning-default-of-nfix-lhs-size
     (equal
      (vl-classify-extension-warning-default (nfix lhs-size)
                                             x-selfsize x ss)
      (vl-classify-extension-warning-default lhs-size x-selfsize x ss)))

    Theorem: vl-classify-extension-warning-default-nat-equiv-congruence-on-lhs-size

    (defthm
     vl-classify-extension-warning-default-nat-equiv-congruence-on-lhs-size
     (implies
      (acl2::nat-equiv lhs-size lhs-size-equiv)
      (equal
        (vl-classify-extension-warning-default lhs-size x-selfsize x ss)
        (vl-classify-extension-warning-default
             lhs-size-equiv x-selfsize x ss)))
     :rule-classes :congruence)

    Theorem: vl-classify-extension-warning-default-of-nfix-x-selfsize

    (defthm vl-classify-extension-warning-default-of-nfix-x-selfsize
     (equal
      (vl-classify-extension-warning-default lhs-size (nfix x-selfsize)
                                             x ss)
      (vl-classify-extension-warning-default lhs-size x-selfsize x ss)))

    Theorem: vl-classify-extension-warning-default-nat-equiv-congruence-on-x-selfsize

    (defthm
     vl-classify-extension-warning-default-nat-equiv-congruence-on-x-selfsize
     (implies
      (acl2::nat-equiv x-selfsize x-selfsize-equiv)
      (equal
        (vl-classify-extension-warning-default lhs-size x-selfsize x ss)
        (vl-classify-extension-warning-default
             lhs-size x-selfsize-equiv x ss)))
     :rule-classes :congruence)

    Theorem: vl-classify-extension-warning-default-of-vl-expr-fix-x

    (defthm vl-classify-extension-warning-default-of-vl-expr-fix-x
     (equal
      (vl-classify-extension-warning-default
           lhs-size x-selfsize (vl-expr-fix x)
           ss)
      (vl-classify-extension-warning-default lhs-size x-selfsize x ss)))

    Theorem: vl-classify-extension-warning-default-vl-expr-equiv-congruence-on-x

    (defthm
     vl-classify-extension-warning-default-vl-expr-equiv-congruence-on-x
     (implies
      (vl-expr-equiv x x-equiv)
      (equal
        (vl-classify-extension-warning-default lhs-size x-selfsize x ss)
        (vl-classify-extension-warning-default
             lhs-size x-selfsize x-equiv ss)))
     :rule-classes :congruence)

    Theorem: vl-classify-extension-warning-default-of-vl-scopestack-fix-ss

    (defthm
          vl-classify-extension-warning-default-of-vl-scopestack-fix-ss
     (equal
      (vl-classify-extension-warning-default
           lhs-size
           x-selfsize x (vl-scopestack-fix ss))
      (vl-classify-extension-warning-default lhs-size x-selfsize x ss)))

    Theorem: vl-classify-extension-warning-default-vl-scopestack-equiv-congruence-on-ss

    (defthm
     vl-classify-extension-warning-default-vl-scopestack-equiv-congruence-on-ss
     (implies
      (vl-scopestack-equiv ss ss-equiv)
      (equal
        (vl-classify-extension-warning-default lhs-size x-selfsize x ss)
        (vl-classify-extension-warning-default
             lhs-size x-selfsize x ss-equiv)))
     :rule-classes :congruence)