• 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-modulelist-alwaysstyle
            • Skip-detection
            • Vl-lint-report
            • Vl-lintresult
            • Vl::vl-design-sv-use-set
            • Oddexpr-check
              • Vl-interfacelist-oddexpr-check
              • Vl-packagelist-oddexpr-check
              • Vl-modulelist-oddexpr-check
              • Vl-warn-odd-binary-expression-main
              • *vl-odd-binops-table*
              • Vl-oddinfo
              • Vl-warn-odd-binary-expression
              • Vl-expr-probable-selfsize
                • Vl-interface-oddexpr-check
                • Vl-package-oddexpr-check
                • Vl-odd-binop-class
                • Vl-module-oddexpr-check
                • Vl-expr-oddexpr-check
                • Vl-oddinfo-details
                • Vl-ctxexprlist-oddexpr-check
                • Vl-oddinfolist-details
                • Vl-design-oddexpr-check
                • Vl-ctxexprlist-oddexpr-check-nrev
                • Vl-oddinfolist
              • 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
    • Oddexpr-check

    Vl-expr-probable-selfsize

    Heuristically estimate an expression's size.

    Signature
    (vl-expr-probable-selfsize x ss) → size
    Arguments
    x — Guard (vl-expr-p x).
    ss — Guard (vl-scopestack-p ss).
    Returns
    size — The probable size of this expression, or nil for failure.
        Type (maybe-natp size).

    There's no reason to believe the size it returns will be the eventual size of the expression because size propagation hasn't been taken into account; in fact we may just fail and return nil for a number of reasons (for instance the wire ranges may not be resolved yet), there's no way to get the failure reason.

    On the other hand, I think it should be the case that the final size of the expression will always be at least as much as this selfsize, if it returns a non-nil value. And we can use this before resolving ranges, etc., which makes it useful for simple linting.

    Definitions and Theorems

    Function: vl-expr-probable-selfsize

    (defun vl-expr-probable-selfsize (x ss)
      (declare (xargs :guard (and (vl-expr-p x)
                                  (vl-scopestack-p ss))))
      (let ((__function__ 'vl-expr-probable-selfsize))
        (declare (ignorable __function__))
        (b* (((mv & size)
              (vl-expr-selfsize x ss (vl-elabscopes-init-ss ss))))
          size)))

    Theorem: maybe-natp-of-vl-expr-probable-selfsize

    (defthm maybe-natp-of-vl-expr-probable-selfsize
      (b* ((size (vl-expr-probable-selfsize x ss)))
        (maybe-natp size))
      :rule-classes :type-prescription)

    Theorem: vl-expr-probable-selfsize-of-vl-expr-fix-x

    (defthm vl-expr-probable-selfsize-of-vl-expr-fix-x
      (equal (vl-expr-probable-selfsize (vl-expr-fix x)
                                        ss)
             (vl-expr-probable-selfsize x ss)))

    Theorem: vl-expr-probable-selfsize-vl-expr-equiv-congruence-on-x

    (defthm vl-expr-probable-selfsize-vl-expr-equiv-congruence-on-x
      (implies (vl-expr-equiv x x-equiv)
               (equal (vl-expr-probable-selfsize x ss)
                      (vl-expr-probable-selfsize x-equiv ss)))
      :rule-classes :congruence)

    Theorem: vl-expr-probable-selfsize-of-vl-scopestack-fix-ss

    (defthm vl-expr-probable-selfsize-of-vl-scopestack-fix-ss
      (equal (vl-expr-probable-selfsize x (vl-scopestack-fix ss))
             (vl-expr-probable-selfsize x ss)))

    Theorem: vl-expr-probable-selfsize-vl-scopestack-equiv-congruence-on-ss

    (defthm
         vl-expr-probable-selfsize-vl-scopestack-equiv-congruence-on-ss
      (implies (vl-scopestack-equiv ss ss-equiv)
               (equal (vl-expr-probable-selfsize x ss)
                      (vl-expr-probable-selfsize x ss-equiv)))
      :rule-classes :congruence)