• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • 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
          • Rewriting
          • Svex
          • Bit-blasting
          • Functions
          • 4vmask
          • Why-infinite-width
          • Svex-vars
          • Evaluation
          • Values
            • 4vec
              • 4vec-operations
                • 4vec-bit?
                • 4vec-part-install
                • 4vec-concat
                • 4vec-?
                • 4vec-rsh
                • 4vec-bit?!
                • 4vec-===*
                • 4vec-reduction-and
                • 4vec-bit-extract
                • 4vec-rev-blocks
                • 4vec-lsh
                • 4vec-resor
                • 4vec-resand
                • 4vec-parity
                • 4vec-plus
                • 4vec-<
                • 4vec-minus
                • 4vec-res
                • 4vec-override
                • 4vec-bit-index
                • 4vec-?!
                • 4vec-zero-ext
                • 4vec-part-select
                  • 4vec-===
                  • 4vec-remainder
                  • 4vec-reduction-or
                  • 4vec-idx->4v
                  • 4vec-==
                  • 4vec-sign-ext
                  • 4vec-quotient
                  • 4vec-?*
                  • 4vec-bitxor
                  • 4vec-wildeq
                  • 4vec-times
                  • 4vec-bitmux
                  • 4vec-symwildeq
                  • 4vec-bitand
                  • 4vec-wildeq-safe
                  • 4vec-bitor
                  • 4vec-shift-core
                  • 4vec-pow
                  • 4vec-onset
                  • 4vec-offset
                  • 4vec-xdet
                  • 4vec-uminus
                  • 4vec-clog2
                  • 4vec-bitnot
                  • 4vec-onehot
                  • 4vec-countones
                  • 4veclist-p-to-stringp
                  • 4vec-p-to-stringp
                  • 4vec-onehot0
                  • 4vec-1mask
                  • 4vec-p-to-stringp-aux
                  • 4v->4vec-bit
                  • 4v-to-characterp
                  • Bool->vec
                  • Unsigned-4vec-p
                • 4vec-p
                • S4vecs
                • 4vec-examples
                • Maybe-4vec
                • 4vec-equiv
                • Make-4vec
                • 4vec->upper
                • 4vec->lower
                • 4veclist
                • 4vec-fix
                • Make-honsed-4vec
                • 4vec-index-p
              • 4vec-<<=
              • 3vec
              • 2vec
              • 2vecx
              • 2vecnatx
              • 4vec-x
              • 4vec-1x
              • 4vec-1z
              • 4vec-z
          • Symbolic-test-vector
          • Vl-to-svex
        • Fgl
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • 4vec-operations

    4vec-part-select

    Part select operation: select width bits of in starting at lsb.

    Signature
    (4vec-part-select lsb width in) → res
    Arguments
    lsb — Guard (4vec-p lsb).
    width — Guard (4vec-p width).
    in — Guard (4vec-p in).
    Returns
    res — Type (4vec-p res).

    Definitions and Theorems

    Function: 4vec-part-select

    (defun 4vec-part-select (lsb width in)
      (declare (xargs :guard (and (4vec-p lsb)
                                  (4vec-p width)
                                  (4vec-p in))))
      (let ((__function__ '4vec-part-select))
        (declare (ignorable __function__))
        (if (and (2vec-p lsb)
                 (2vec-p width)
                 (<= 0 (2vec->val width)))
            (b* ((lsbval (2vec->val lsb))
                 ((when (<= 0 lsbval))
                  (4vec-zero-ext width (4vec-rsh lsb in))))
              (4vec-zero-ext width
                             (4vec-concat (2vec (- lsbval))
                                          (4vec-x)
                                          in)))
          (4vec-x))))

    Theorem: 4vec-p-of-4vec-part-select

    (defthm 4vec-p-of-4vec-part-select
      (b* ((res (4vec-part-select lsb width in)))
        (4vec-p res))
      :rule-classes :rewrite)

    Theorem: 4vec-part-select-of-2vecx-fix-lsb

    (defthm 4vec-part-select-of-2vecx-fix-lsb
      (equal (4vec-part-select (2vecx-fix lsb)
                               width in)
             (4vec-part-select lsb width in)))

    Theorem: 4vec-part-select-2vecx-equiv-congruence-on-lsb

    (defthm 4vec-part-select-2vecx-equiv-congruence-on-lsb
      (implies (2vecx-equiv lsb lsb-equiv)
               (equal (4vec-part-select lsb width in)
                      (4vec-part-select lsb-equiv width in)))
      :rule-classes :congruence)

    Theorem: 4vec-part-select-of-2vecx-fix-width

    (defthm 4vec-part-select-of-2vecx-fix-width
      (equal (4vec-part-select lsb (2vecx-fix width)
                               in)
             (4vec-part-select lsb width in)))

    Theorem: 4vec-part-select-2vecx-equiv-congruence-on-width

    (defthm 4vec-part-select-2vecx-equiv-congruence-on-width
      (implies (2vecx-equiv width width-equiv)
               (equal (4vec-part-select lsb width in)
                      (4vec-part-select lsb width-equiv in)))
      :rule-classes :congruence)

    Theorem: 4vec-part-select-of-4vec-fix-in

    (defthm 4vec-part-select-of-4vec-fix-in
      (equal (4vec-part-select lsb width (4vec-fix in))
             (4vec-part-select lsb width in)))

    Theorem: 4vec-part-select-4vec-equiv-congruence-on-in

    (defthm 4vec-part-select-4vec-equiv-congruence-on-in
      (implies (4vec-equiv in in-equiv)
               (equal (4vec-part-select lsb width in)
                      (4vec-part-select lsb width in-equiv)))
      :rule-classes :congruence)