• 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
            • 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
              • 3vec-operations
              • *svex-op-table*
            • 4vmask
            • Why-infinite-width
            • Svex-vars
            • Evaluation
            • Values
          • Symbolic-test-vector
          • Vl-to-svex
        • Fgl
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • 4vec-operations

    4vec-concat

    Like logapp for 4vecs; the width is also a 4vec.

    Signature
    (4vec-concat width low high) → concat
    Arguments
    width — Width of less-significant 4vec.
        Guard (4vec-p width).
    low — Source of the W less-significant bits.
        Guard (4vec-p low).
    high — Source of the rest of the bits.
        Guard (4vec-p high).
    Returns
    concat — Type (4vec-p concat).

    In the usual case, width is some natural number: we concatenate the width least significant bits of low with all of high. That is, we produce a new 4vec which might be written in Verilog as {high, low[width-1:0]}.

    Since width is a 4vec it may have X or Z bits or may be negative. In this case, the result is infinite Xes.

    Definitions and Theorems

    Function: 4vec-concat

    (defun 4vec-concat (width low high)
     (declare (xargs :guard (and (4vec-p width)
                                 (4vec-p low)
                                 (4vec-p high))))
     (let ((__function__ '4vec-concat))
       (declare (ignorable __function__))
       (if
        (and (2vec-p width)
             (<= 0 (2vec->val width)))
        (if
         (mbe :logic nil
              :exec
              (and (>= (2vec->val width) (4vec-bit-limit))
                   (b* (((4vec low)) ((4vec high)))
                     (or (if (< low.upper 0)
                             (not (eql high.upper -1))
                           (not (eql high.upper 0)))
                         (if (< low.lower 0)
                             (not (eql high.lower -1))
                           (not (eql high.lower 0)))))
                   (4vec-very-large-integer-warning (2vec->val width))))
         (4vec-x)
         (b* ((wval (2vec->val width)))
           (if-2vec-p (low high)
                      (2vec (logapp wval (2vec->val low)
                                    (2vec->val high)))
                      (b* (((4vec low)) ((4vec high)))
                        (4vec (logapp wval low.upper high.upper)
                              (logapp wval low.lower high.lower))))))
        (4vec-x))))

    Theorem: 4vec-p-of-4vec-concat

    (defthm 4vec-p-of-4vec-concat
      (b* ((concat (4vec-concat width low high)))
        (4vec-p concat))
      :rule-classes :rewrite)

    Theorem: 4vec-concat-of-2vecnatx-fix-width

    (defthm 4vec-concat-of-2vecnatx-fix-width
      (equal (4vec-concat (2vecnatx-fix width)
                          low high)
             (4vec-concat width low high)))

    Theorem: 4vec-concat-2vecnatx-equiv-congruence-on-width

    (defthm 4vec-concat-2vecnatx-equiv-congruence-on-width
      (implies (2vecnatx-equiv width width-equiv)
               (equal (4vec-concat width low high)
                      (4vec-concat width-equiv low high)))
      :rule-classes :congruence)

    Theorem: 4vec-concat-of-4vec-fix-low

    (defthm 4vec-concat-of-4vec-fix-low
      (equal (4vec-concat width (4vec-fix low) high)
             (4vec-concat width low high)))

    Theorem: 4vec-concat-4vec-equiv-congruence-on-low

    (defthm 4vec-concat-4vec-equiv-congruence-on-low
      (implies (4vec-equiv low low-equiv)
               (equal (4vec-concat width low high)
                      (4vec-concat width low-equiv high)))
      :rule-classes :congruence)

    Theorem: 4vec-concat-of-4vec-fix-high

    (defthm 4vec-concat-of-4vec-fix-high
      (equal (4vec-concat width low (4vec-fix high))
             (4vec-concat width low high)))

    Theorem: 4vec-concat-4vec-equiv-congruence-on-high

    (defthm 4vec-concat-4vec-equiv-congruence-on-high
      (implies (4vec-equiv high high-equiv)
               (equal (4vec-concat width low high)
                      (4vec-concat width low high-equiv)))
      :rule-classes :congruence)