• 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
          • Expression-sizing
          • Occform
          • Oprewrite
            • Vl-op-oprewrite
            • Vl-modulelist-oprewrite
            • Vl-expr-oprewrite
            • Vl-maybe-delayoreventcontrol-oprewrite
            • Vl-repeateventcontrol-oprewrite
            • Vl-plainarglist-oprewrite
            • Vl-namedarglist-oprewrite
            • Vl-gateinstlist-oprewrite
            • Vl-delayoreventcontrol-oprewrite
            • Vl-modinstlist-oprewrite
            • Vl-initiallist-oprewrite
            • Vl-replicate-constint-value
            • Vl-evatomlist-oprewrite
            • Vl-assignlist-oprewrite
            • Vl-arguments-oprewrite
            • Vl-alwayslist-oprewrite
            • Vl-eventcontrol-oprewrite
            • Vl-delaycontrol-oprewrite
            • Vl-plainarg-oprewrite
            • Vl-namedarg-oprewrite
            • Vl-modinst-oprewrite
            • Vl-maybe-expr-oprewrite
            • Vl-initial-oprewrite
            • Vl-gateinst-oprewrite
            • Vl-assign-oprewrite
            • Vl-goofymux-p
              • Vl-evatom-oprewrite
              • Vl-always-oprewrite
              • Vl-replicate-weirdint-bits
              • Vl-maybe-consolidate-multiconcat
              • Vl-qmark-p
              • Vl-goofymux-rewrite
              • Vl-module-oprewrite
              • Vl-design-oprewrite
            • Expand-functions
            • Delayredux
            • Unparameterization
            • Caseelim
            • Split
            • Selresolve
            • Weirdint-elim
            • Vl-delta
            • Replicate-insts
            • Rangeresolve
            • Propagate
            • Clean-selects
            • Clean-params
            • Blankargs
            • Inline-mods
            • Expr-simp
            • Trunc
            • Always-top
            • Gatesplit
            • Gate-elim
            • Expression-optimization
            • Elim-supplies
            • Wildelim
            • Drop-blankports
            • Clean-warnings
            • Addinstnames
            • Custom-transform-hooks
            • Annotate
            • Latchcode
            • Elim-unused-vars
            • Problem-modules
          • Lint
          • Mlib
          • Server
          • Kit
          • Printer
          • Esim-vl
          • Well-formedness
        • Sv
        • Fgl
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Oprewrite

    Vl-goofymux-p

    Recognize certain special muxes.

    Signature
    (vl-goofymux-p x) → (mv s i1 i2)
    Arguments
    x — Guard (vl-expr-p x).
    Returns
    s — Type (equal (vl-expr-p s) (if s t nil)).
    i1 — Type (equal (vl-expr-p i1) (if s t nil)).
    i2 — Type (equal (vl-expr-p i2) (if s t nil)).

    We match expressions of the following forms:

    1. (i1 === i2) ? i1 : (s ? i1 : i2)
    2. (i1 === i2) ? i2 : (s ? i1 : i2)
    3. (i1 === i2) ? i1 : (s ? i2 : i1)
    4. (i1 === i2) ? i2 : (s ? i2 : i1)

    Definitions and Theorems

    Function: vl-goofymux-p

    (defun vl-goofymux-p (x)
     (declare (xargs :guard (vl-expr-p x)))
     (let ((__function__ 'vl-goofymux-p))
      (declare (ignorable __function__))
      (b* (((mv equiv i1 mux) (vl-qmark-p x))
           ((unless equiv) (mv nil nil nil))
           ((unless (and (not (vl-fast-atom-p equiv))
                         (eq (vl-nonatom->op equiv)
                             :vl-binary-ceq)))
            (mv nil nil nil))
           (i1-fix (vl-expr-strip i1))
           (equiv-lhs (vl-expr-strip (first (vl-nonatom->args equiv))))
           (equiv-rhs (vl-expr-strip (second (vl-nonatom->args equiv))))
           ((unless (or (equal equiv-lhs i1-fix)
                        (equal equiv-rhs i1-fix)))
            (mv nil nil nil))
           ((mv sel mi1 mi2) (vl-qmark-p mux))
           ((unless sel) (mv nil nil nil))
           (mi1-fix (vl-expr-strip mi1))
           (mi2-fix (vl-expr-strip mi2))
           ((unless (or (and (equal equiv-lhs mi1-fix)
                             (equal equiv-rhs mi2-fix))
                        (and (equal equiv-lhs mi2-fix)
                             (equal equiv-rhs mi1-fix))))
            (mv nil nil nil)))
        (mv sel mi1 mi2))))

    Theorem: return-type-of-vl-goofymux-p.s

    (defthm return-type-of-vl-goofymux-p.s
      (b* (((mv ?s ?i1 ?i2) (vl-goofymux-p x)))
        (equal (vl-expr-p s) (if s t nil)))
      :rule-classes :rewrite)

    Theorem: return-type-of-vl-goofymux-p.i1

    (defthm return-type-of-vl-goofymux-p.i1
      (b* (((mv ?s ?i1 ?i2) (vl-goofymux-p x)))
        (equal (vl-expr-p i1) (if s t nil)))
      :rule-classes :rewrite)

    Theorem: return-type-of-vl-goofymux-p.i2

    (defthm return-type-of-vl-goofymux-p.i2
      (b* (((mv ?s ?i1 ?i2) (vl-goofymux-p x)))
        (equal (vl-expr-p i2) (if s t nil)))
      :rule-classes :rewrite)

    Theorem: vl-goofymux-p-of-vl-expr-fix-x

    (defthm vl-goofymux-p-of-vl-expr-fix-x
      (equal (vl-goofymux-p (vl-expr-fix x))
             (vl-goofymux-p x)))

    Theorem: vl-goofymux-p-vl-expr-equiv-congruence-on-x

    (defthm vl-goofymux-p-vl-expr-equiv-congruence-on-x
      (implies (vl-expr-equiv x x-equiv)
               (equal (vl-goofymux-p x)
                      (vl-goofymux-p x-equiv)))
      :rule-classes :congruence)