• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
      • Sv
        • Svex-stvs
        • Svex-decomposition-methodology
        • Sv-versus-esim
        • Svex-decomp
        • Svex-compose-dfs
        • Svex-compilation
        • Moddb
        • Svmods
        • Svstmt
        • Sv-tutorial
        • Expressions
        • Symbolic-test-vector
        • Vl-to-svex
          • Vl-to-sv
          • Vl-design->sv-design
            • Vl-simpconfig
            • Vl-hierarchy-sv-translation
            • Vl-expr-svex-translation
              • Sv::vl-expr.lisp
                • Vl-scopecontext-to-addr
                • Vl-binaryop-to-svex
                • Vl-expr-to-svex-maybe-typed
                • Vl-datatype-syscall-to-svex
                • Vl-operandinfo-to-svex-preproc
                • Vl-structmemberlist->types
                • Vl-seltrace-to-svex-select
                • Vl-portdecllist->types
                • Vl-operandinfo-to-svex-select
                • Vl-plusminus-partselect->svex
                • Vl-arrayrange->rel-lsb-and-width
                • Vl-unaryop-to-svex
                  • Vl-funcall-args-to-ordered
                  • Vl-expr-to-svex-lhs
                  • Vl-operandinfo-to-svex
                  • Vl-array-assignpat-keyval-resolve
                  • Vl-err->vfatal
                  • Vl-datatypelist-usertype-resolve
                  • Vl-upscope-to-svex-upscope
                  • Vl-err->fatal
                  • Vl-streaming-concat-trunc/extend
                  • Vl-operandinfo-base-svar
                  • Vl-index-shift-amount
                  • Vttree->constraints
                  • Vl-slicesize-resolve
                  • Vl-function-map-find-matching-aux
                  • Vl-funname-lookup
                  • Vl-datatype-size-warn
                  • Svex-repeat-aux
                  • Vl-$test$plusargs-to-svex
                  • Svex-extend
                  • Vl-structmemberlist-shift-bits
                  • Vl-datatype-slot-width/range
                  • Vl-datatype-index-shift-amount
                  • Vl-datatype-field-shift-amount
                  • 4vec-extend
                  • Vl-function-pair-inputs-with-actuals
                  • Vl-expr-to-svex-untyped
                  • Vl-function-map-check-matching
                  • Vl-datatype-syscall-remove-dims
                  • Svex-concat-list-aux
                  • Vttree-add-constraints
                  • Vttree-add-warnings
                  • Vl-check-struct-assignpat-keys
                  • Vl-check-array-assignpat-keys
                  • Sv::constraintlist-subst-memo
                  • Vl-svex-keyval-index-lookup
                  • Vl-function-map-find-matching
                  • Vl-convert-dollarsign-to-expr
                  • Vttree->constraints-acc
                  • Vl-seltrace-type
                  • Vl-seltrace-to-path
                  • Vl-keyval-member-lookup
                  • Svex-repeat
                  • Vttree->warnings-acc
                  • Vl-trunc/extend-type-err
                  • Constraintlist-add-ctx
                  • Vl-hidtrace-add-to-path
                  • Svex-multiconcat
                  • Vttree-join
                  • Vl-value-to-string-aux
                  • Vl-seltrace-add-to-path
                  • Vl-value-to-4vec
                  • Vl-expr-to-svex-selfdet
                  • Vl-svex-keyval-default-lookup
                  • Vl-$test$plusargs-p
                  • Vl-value-to-svex
                  • Vl-value-in-range
                  • Vl-keyval-default-lookup
                  • Sv::svexlist-args-extract-constants
                  • Vl-string->bits
                  • Vl-size-to-unsigned-logic
                  • Vl-hidtrace-to-path
                  • Svex-concat-list
                  • Vttree->warnings
                  • Vl-seltrace-unres-count
                  • Vl-datatype-index-is-bitselect
                  • Vl-bitlist->4vec
                  • Vl-svex-keyvallist-vars
                  • Vl-hidstep->svex-index
                  • Vl-selstep->svex-name
                  • Vl-datatypelist-resolved-p
                  • Vl-datatype-$unpacked_dimensions
                  • Vl-datatype-$dimensions
                  • Vl-bitlist->offset
                  • Vl-bitlist->onset
                  • Vl-streamexprlist-has-with
                  • Vl-hidstep-resolved-p
                  • Vl-expr-needs-type-context
                  • Vl-streamexprlist->exprs
                  • Vl-integer-to-string
                  • Vl-hidtrace-resolved-p
                  • Vl-selstep-resolved-p
                  • Vl-select-resolved-p
                  • Vl-svex-keyvallist
                  • Vl-datatypelist
                  • Svex-x
                • Vttree
              • Vl-design->svex-modalist
              • Vl-svstmt
            • Vl-to-sv-main
            • Vl-simplify-sv
            • Vl-user-paramsettings->unparam-names
            • Vl-user-paramsettings->modnames
        • Fgl
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Sv::vl-expr.lisp

    Vl-unaryop-to-svex

    Signature
    (vl-unaryop-to-svex op arg arg-size size signedness) 
      → 
    (mv err svex)
    Arguments
    op — Guard (vl-unaryop-p op).
    arg — Guard (sv::svex-p arg).
    arg-size — Guard (natp arg-size).
    size — Guard (natp size).
    signedness — Guard (vl-exprsign-p signedness).
    Returns
    err — Type (iff (vl-msg-p err) err).
    svex — Type (sv::svex-p svex).

    Definitions and Theorems

    Function: vl-unaryop-to-svex

    (defun vl-unaryop-to-svex (op arg arg-size size signedness)
     (declare (xargs :guard (and (vl-unaryop-p op)
                                 (sv::svex-p arg)
                                 (natp arg-size)
                                 (natp size)
                                 (vl-exprsign-p signedness))))
     (let ((__function__ 'vl-unaryop-to-svex))
      (declare (ignorable __function__))
      (b*
       ((op (vl-unaryop-fix op))
        (body
         (case
          op
          (:vl-unary-plus (sv::svcall sv::xdet arg))
          (:vl-unary-minus (sv::svcall sv::u- arg))
          (:vl-unary-bitnot (sv::svcall sv::bitnot arg))
          (:vl-unary-lognot
               (sv::svcall sv::bitnot (sv::svcall sv::uor arg)))
          (:vl-unary-bitand
               (sv::svcall sv::uand (sv::svex-signx arg-size arg)))
          (:vl-unary-nand
               (sv::svcall sv::bitnot
                           (sv::svcall sv::uand
                                       (sv::svex-signx arg-size arg))))
          (:vl-unary-bitor (sv::svcall sv::uor arg))
          (:vl-unary-nor
               (sv::svcall sv::bitnot (sv::svcall sv::uor arg)))
          (:vl-unary-xor
               (sv::svcall sv::uxor (sv::svex-zerox arg-size arg)))
          (:vl-unary-xnor
             (sv::svcall sv::bitnot
                         (sv::svcall sv::uxor
                                     (sv::svex-zerox arg-size arg)))))))
       (mv (and (not body)
                (vmsg "Operator not implemented: ~s0"
                      (vl-unaryop-string op)))
           (if body (svex-extend signedness size body)
             (svex-x))))))

    Theorem: return-type-of-vl-unaryop-to-svex.err

    (defthm return-type-of-vl-unaryop-to-svex.err
      (b* (((mv ?err ?svex)
            (vl-unaryop-to-svex op arg arg-size size signedness)))
        (iff (vl-msg-p err) err))
      :rule-classes :rewrite)

    Theorem: svex-p-of-vl-unaryop-to-svex.svex

    (defthm svex-p-of-vl-unaryop-to-svex.svex
      (b* (((mv ?err ?svex)
            (vl-unaryop-to-svex op arg arg-size size signedness)))
        (sv::svex-p svex))
      :rule-classes :rewrite)

    Theorem: vars-of-vl-unaryop-to-svex

    (defthm vars-of-vl-unaryop-to-svex
      (b* (((mv ?err ?svex)
            (vl-unaryop-to-svex op arg arg-size size signedness)))
        (implies (not (member v (sv::svex-vars arg)))
                 (not (member v (sv::svex-vars svex))))))

    Theorem: vl-unaryop-to-svex-of-vl-unaryop-fix-op

    (defthm vl-unaryop-to-svex-of-vl-unaryop-fix-op
      (equal (vl-unaryop-to-svex (vl-unaryop-fix op)
                                 arg arg-size size signedness)
             (vl-unaryop-to-svex op arg arg-size size signedness)))

    Theorem: vl-unaryop-to-svex-vl-unaryop-equiv-congruence-on-op

    (defthm vl-unaryop-to-svex-vl-unaryop-equiv-congruence-on-op
     (implies
       (vl-unaryop-equiv op op-equiv)
       (equal
            (vl-unaryop-to-svex op arg arg-size size signedness)
            (vl-unaryop-to-svex op-equiv arg arg-size size signedness)))
     :rule-classes :congruence)

    Theorem: vl-unaryop-to-svex-of-svex-fix-arg

    (defthm vl-unaryop-to-svex-of-svex-fix-arg
      (equal (vl-unaryop-to-svex op (sv::svex-fix arg)
                                 arg-size size signedness)
             (vl-unaryop-to-svex op arg arg-size size signedness)))

    Theorem: vl-unaryop-to-svex-svex-equiv-congruence-on-arg

    (defthm vl-unaryop-to-svex-svex-equiv-congruence-on-arg
     (implies
       (sv::svex-equiv arg arg-equiv)
       (equal
            (vl-unaryop-to-svex op arg arg-size size signedness)
            (vl-unaryop-to-svex op arg-equiv arg-size size signedness)))
     :rule-classes :congruence)

    Theorem: vl-unaryop-to-svex-of-nfix-arg-size

    (defthm vl-unaryop-to-svex-of-nfix-arg-size
      (equal (vl-unaryop-to-svex op arg (nfix arg-size)
                                 size signedness)
             (vl-unaryop-to-svex op arg arg-size size signedness)))

    Theorem: vl-unaryop-to-svex-nat-equiv-congruence-on-arg-size

    (defthm vl-unaryop-to-svex-nat-equiv-congruence-on-arg-size
     (implies
       (acl2::nat-equiv arg-size arg-size-equiv)
       (equal
            (vl-unaryop-to-svex op arg arg-size size signedness)
            (vl-unaryop-to-svex op arg arg-size-equiv size signedness)))
     :rule-classes :congruence)

    Theorem: vl-unaryop-to-svex-of-nfix-size

    (defthm vl-unaryop-to-svex-of-nfix-size
      (equal (vl-unaryop-to-svex op arg arg-size (nfix size)
                                 signedness)
             (vl-unaryop-to-svex op arg arg-size size signedness)))

    Theorem: vl-unaryop-to-svex-nat-equiv-congruence-on-size

    (defthm vl-unaryop-to-svex-nat-equiv-congruence-on-size
     (implies
       (acl2::nat-equiv size size-equiv)
       (equal
            (vl-unaryop-to-svex op arg arg-size size signedness)
            (vl-unaryop-to-svex op arg arg-size size-equiv signedness)))
     :rule-classes :congruence)

    Theorem: vl-unaryop-to-svex-of-vl-exprsign-fix-signedness

    (defthm vl-unaryop-to-svex-of-vl-exprsign-fix-signedness
      (equal (vl-unaryop-to-svex op arg arg-size
                                 size (vl-exprsign-fix signedness))
             (vl-unaryop-to-svex op arg arg-size size signedness)))

    Theorem: vl-unaryop-to-svex-vl-exprsign-equiv-congruence-on-signedness

    (defthm
          vl-unaryop-to-svex-vl-exprsign-equiv-congruence-on-signedness
     (implies
       (vl-exprsign-equiv signedness signedness-equiv)
       (equal
            (vl-unaryop-to-svex op arg arg-size size signedness)
            (vl-unaryop-to-svex op arg arg-size size signedness-equiv)))
     :rule-classes :congruence)