• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • 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
            • Vl-exprlist-clean-selects
            • Vl-expr-clean-selects1
            • Vl-maybe-merge-selects-aux
            • Vl-merge-consts
            • Vl-maybe-merge-selects
            • Vl-expr-clean-selects
              • Vl-elim-nested-concats
              • Vl-expr-clean-concats
            • Namemangle
            • Caremask
            • Port-tools
            • Lvalues
          • Server
          • Kit
          • Printer
          • Esim-vl
          • Well-formedness
        • Sv
        • Fgl
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Expr-cleaning

    Vl-expr-clean-selects

    Simplify concatenations and selects in an expression.

    Signature
    (vl-expr-clean-selects x ss) → new-x
    Arguments
    x — An expression that occurs somewhere in mod.
        Guard (vl-expr-p x).
    ss — Containing scope stack.
        Guard (vl-scopestack-p ss).
    Returns
    new-x — Simplified version of x.
        Type (vl-expr-p new-x).

    We try to simplify x in a fairly advanced way, and return the simplified expression x'. There are two phases to the simplification:

    • We clean up the concatenations using vl-expr-clean-concats, in order to eliminate nested concatenations and merge together expressions like {foo[3:1], foo[0]} info foo[3:0].
    • We walk over the reduced expression, trying to notice any unnecessary selects, e.g., if we have wire [3:0] w, then we will replace occurrences of w[3:0] with just w.

    Definitions and Theorems

    Function: vl-expr-clean-selects

    (defun vl-expr-clean-selects (x ss)
      (declare (xargs :guard (and (vl-expr-p x)
                                  (vl-scopestack-p ss))))
      (let ((__function__ 'vl-expr-clean-selects))
        (declare (ignorable __function__))
        (vl-expr-clean-selects1 (vl-expr-clean-concats x ss)
                                ss)))

    Theorem: vl-expr-p-of-vl-expr-clean-selects

    (defthm vl-expr-p-of-vl-expr-clean-selects
      (b* ((new-x (vl-expr-clean-selects x ss)))
        (vl-expr-p new-x))
      :rule-classes :rewrite)

    Theorem: vl-expr-clean-selects-of-vl-expr-fix-x

    (defthm vl-expr-clean-selects-of-vl-expr-fix-x
      (equal (vl-expr-clean-selects (vl-expr-fix x)
                                    ss)
             (vl-expr-clean-selects x ss)))

    Theorem: vl-expr-clean-selects-vl-expr-equiv-congruence-on-x

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

    Theorem: vl-expr-clean-selects-of-vl-scopestack-fix-ss

    (defthm vl-expr-clean-selects-of-vl-scopestack-fix-ss
      (equal (vl-expr-clean-selects x (vl-scopestack-fix ss))
             (vl-expr-clean-selects x ss)))

    Theorem: vl-expr-clean-selects-vl-scopestack-equiv-congruence-on-ss

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