• 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
        • Lint
        • Mlib
          • Scopestack
          • Filtering-by-name
          • Vl-namefactory
          • Substitution
          • Allexprs
          • Hid-tools
          • Vl-consteval
            • Vl-consteval-$bits
            • Vl-consteval-shiftop
              • Vl-consteval-concat
              • Vl-consteval-ans
              • Vl-consteval-unary-reduxop
              • Vl-consteval-binop
              • Vl-consteval-cmpop
              • Vl-consteval-usertype-bits
              • Vl-consteval-binlogic
              • Vl-clog2
              • Vl-consteval-basictype-bits
              • Vl-consteval-wideunary
              • Vl-consteval-main
              • *vl-fake-elem-for-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
            • Namemangle
            • Caremask
            • Port-tools
            • Lvalues
          • Server
          • Kit
          • Printer
          • Esim-vl
          • Well-formedness
        • Sv
        • Fgl
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Vl-consteval

    Vl-consteval-shiftop

    Signature
    (vl-consteval-shiftop op aval bval awidth atype) → ans
    Arguments
    op — Guard (member op '(:vl-binary-shr :vl-binary-shl :vl-binary-ashr :vl-binary-ashl :vl-binary-power)) .
    aval — Guard (natp aval).
    bval — Guard (natp bval).
    awidth — Guard (posp awidth).
    atype — Guard (vl-exprtype-p atype).
    Returns
    ans — Type (integerp ans).

    Definitions and Theorems

    Function: vl-consteval-shiftop

    (defun vl-consteval-shiftop (op aval bval awidth atype)
     (declare
      (xargs
        :guard
        (and (member op
                     '(:vl-binary-shr :vl-binary-shl :vl-binary-ashr
                                      :vl-binary-ashl :vl-binary-power))
             (natp aval)
             (natp bval)
             (posp awidth)
             (vl-exprtype-p atype))))
     (let ((__function__ 'vl-consteval-shiftop))
       (declare (ignorable __function__))
       (b* ((aval (lnfix aval))
            (bval (lnfix bval))
            (awidth (lposfix awidth))
            (ainterp (if (eq (vl-exprtype-fix atype) :vl-signed)
                         (acl2::fast-logext awidth aval)
                       aval)))
         (case op (:vl-binary-shr (ash aval (- bval)))
               (:vl-binary-shl (ash aval bval))
               (:vl-binary-ashr (ash ainterp (- bval)))
               (:vl-binary-ashl (ash ainterp bval))
               (:vl-binary-power (expt ainterp bval))
               (otherwise (progn$ (impossible) 0))))))

    Theorem: integerp-of-vl-consteval-shiftop

    (defthm integerp-of-vl-consteval-shiftop
      (b* ((ans (vl-consteval-shiftop op aval bval awidth atype)))
        (integerp ans))
      :rule-classes :rewrite)

    Theorem: vl-consteval-shiftop-of-nfix-aval

    (defthm vl-consteval-shiftop-of-nfix-aval
      (equal (vl-consteval-shiftop op (nfix aval)
                                   bval awidth atype)
             (vl-consteval-shiftop op aval bval awidth atype)))

    Theorem: vl-consteval-shiftop-nat-equiv-congruence-on-aval

    (defthm vl-consteval-shiftop-nat-equiv-congruence-on-aval
     (implies
         (acl2::nat-equiv aval aval-equiv)
         (equal (vl-consteval-shiftop op aval bval awidth atype)
                (vl-consteval-shiftop op aval-equiv bval awidth atype)))
     :rule-classes :congruence)

    Theorem: vl-consteval-shiftop-of-nfix-bval

    (defthm vl-consteval-shiftop-of-nfix-bval
      (equal (vl-consteval-shiftop op aval (nfix bval)
                                   awidth atype)
             (vl-consteval-shiftop op aval bval awidth atype)))

    Theorem: vl-consteval-shiftop-nat-equiv-congruence-on-bval

    (defthm vl-consteval-shiftop-nat-equiv-congruence-on-bval
     (implies
         (acl2::nat-equiv bval bval-equiv)
         (equal (vl-consteval-shiftop op aval bval awidth atype)
                (vl-consteval-shiftop op aval bval-equiv awidth atype)))
     :rule-classes :congruence)

    Theorem: vl-consteval-shiftop-of-pos-fix-awidth

    (defthm vl-consteval-shiftop-of-pos-fix-awidth
      (equal (vl-consteval-shiftop op aval bval (pos-fix awidth)
                                   atype)
             (vl-consteval-shiftop op aval bval awidth atype)))

    Theorem: vl-consteval-shiftop-pos-equiv-congruence-on-awidth

    (defthm vl-consteval-shiftop-pos-equiv-congruence-on-awidth
     (implies
         (acl2::pos-equiv awidth awidth-equiv)
         (equal (vl-consteval-shiftop op aval bval awidth atype)
                (vl-consteval-shiftop op aval bval awidth-equiv atype)))
     :rule-classes :congruence)

    Theorem: vl-consteval-shiftop-of-vl-exprtype-fix-atype

    (defthm vl-consteval-shiftop-of-vl-exprtype-fix-atype
      (equal (vl-consteval-shiftop op aval
                                   bval awidth (vl-exprtype-fix atype))
             (vl-consteval-shiftop op aval bval awidth atype)))

    Theorem: vl-consteval-shiftop-vl-exprtype-equiv-congruence-on-atype

    (defthm vl-consteval-shiftop-vl-exprtype-equiv-congruence-on-atype
     (implies
         (vl-exprtype-equiv atype atype-equiv)
         (equal (vl-consteval-shiftop op aval bval awidth atype)
                (vl-consteval-shiftop op aval bval awidth atype-equiv)))
     :rule-classes :congruence)