• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • 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
          • Expand-functions
          • Delayredux
          • Unparameterization
          • Caseelim
          • Split
          • Selresolve
          • Weirdint-elim
          • Vl-delta
          • Replicate-insts
          • Rangeresolve
          • Propagate
          • Clean-selects
          • Clean-params
          • Blankargs
          • Inline-mods
          • Expr-simp
            • Vl-plainarglist-simp
            • Vl-modinstlist-simp
            • Vl-modulelist-simp
            • Vl-assignlist-simp
            • Vl-expr-simp-unary-bitnot
            • Vl-expr-simp-binary-bitor
            • Vl-expr-simp-binary-bitand
            • Vl-expr-simp-qmark
              • Vl-modinst-simp
              • Vl-plainarg-simp
              • Vl-module-simp
              • Vl-design-simp
              • Vl-assign-simp
              • Vl-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
    • Expr-simp

    Vl-expr-simp-qmark

    Signature
    (vl-expr-simp-qmark x args) → new-x
    Arguments
    x — Expression to rewrite, of the form FOO ? BAR : BAZ.
        Guard (vl-expr-p x).
    args — Its already-rewritten args.
        Guard (vl-exprlist-p args).
    Returns
    new-x — Type (vl-expr-p new-x).

    Definitions and Theorems

    Function: vl-expr-simp-qmark

    (defun vl-expr-simp-qmark (x args)
      (declare (xargs :guard (and (vl-expr-p x)
                                  (vl-exprlist-p args))))
      (declare (xargs :guard (and (not (vl-atom-p x))
                                  (equal (vl-nonatom->op x) :vl-qmark)
                                  (equal (len args) 3))))
      (let ((__function__ 'vl-expr-simp-qmark))
        (declare (ignorable __function__))
        (b* (((list a b c) args)
             ((when (and (not (vl-atom-p a))
                         (eq (vl-nonatom->op a)
                             :vl-unary-bitnot)))
              (b* (((list ~a b c) args)
                   (a (first (vl-nonatom->args ~a)))
                   (ans (change-vl-nonatom x
                                           :args (list a c b))))
                (vl-cw-ps-seq (vl-cw "QM~ Rewrite ~a0 to ~a1~%" x ans))
                ans))
             ((when (and (vl-expr-resolved-p a)
                         (eql (vl-resolved->val a) 1)
                         (equal (vl-expr->finalwidth x)
                                (vl-expr->finalwidth b))
                         (equal (vl-expr->finaltype x)
                                (vl-expr->finaltype b))))
              (b* ((ans (vl-expr-fix b)))
                (vl-cw-ps-seq (vl-cw "QM1 rewrite ~a0 to ~a1~%" x ans))
                ans))
             ((when (and (vl-expr-resolved-p a)
                         (eql (vl-resolved->val a) 0)
                         (equal (vl-expr->finalwidth x)
                                (vl-expr->finalwidth c))
                         (equal (vl-expr->finaltype x)
                                (vl-expr->finaltype c))))
              (b* ((ans (vl-expr-fix c)))
                (vl-cw-ps-seq (vl-cw "QM0 rewrite ~a0 to ~a1~%" x ans))
                ans)))
          (change-vl-nonatom x :args args))))

    Theorem: vl-expr-p-of-vl-expr-simp-qmark

    (defthm vl-expr-p-of-vl-expr-simp-qmark
      (b* ((new-x (vl-expr-simp-qmark x args)))
        (vl-expr-p new-x))
      :rule-classes :rewrite)

    Theorem: vl-expr-simp-qmark-of-vl-expr-fix-x

    (defthm vl-expr-simp-qmark-of-vl-expr-fix-x
      (equal (vl-expr-simp-qmark (vl-expr-fix x)
                                 args)
             (vl-expr-simp-qmark x args)))

    Theorem: vl-expr-simp-qmark-vl-expr-equiv-congruence-on-x

    (defthm vl-expr-simp-qmark-vl-expr-equiv-congruence-on-x
      (implies (vl-expr-equiv x x-equiv)
               (equal (vl-expr-simp-qmark x args)
                      (vl-expr-simp-qmark x-equiv args)))
      :rule-classes :congruence)

    Theorem: vl-expr-simp-qmark-of-vl-exprlist-fix-args

    (defthm vl-expr-simp-qmark-of-vl-exprlist-fix-args
      (equal (vl-expr-simp-qmark x (vl-exprlist-fix args))
             (vl-expr-simp-qmark x args)))

    Theorem: vl-expr-simp-qmark-vl-exprlist-equiv-congruence-on-args

    (defthm vl-expr-simp-qmark-vl-exprlist-equiv-congruence-on-args
      (implies (vl-exprlist-equiv args args-equiv)
               (equal (vl-expr-simp-qmark x args)
                      (vl-expr-simp-qmark x args-equiv)))
      :rule-classes :congruence)