• 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-resand

    Bitwise wired AND resolution of two 4vecs.

    Signature
    (4vec-resand a b) → ans
    Arguments
    a — Guard (4vec-p a).
    b — Guard (4vec-p b).
    Returns
    ans — Type (4vec-p ans).

    Resolves together two 4vecs as if they were both assigned to a wand net in Verilog. Each bit of the result is determined by the corresponding bits of the two inputs as follows:

    • If either input is 0, the result is 0.
    • If either input is Z, the result is the other input bit.
    • If both inputs are 1, the result is 1.
    • If one input is X and the other is not 0, the result is X.

    Definitions and Theorems

    Function: 4vec-resand

    (defun 4vec-resand (a b)
      (declare (xargs :guard (and (4vec-p a) (4vec-p b))))
      (let ((__function__ '4vec-resand))
        (declare (ignorable __function__))
        (b* (((4vec a)) ((4vec b)))
          (4vec (logand (logior a.upper a.lower)
                        (logior b.upper b.lower)
                        (logior a.upper b.upper))
                (logand a.lower b.lower)))))

    Theorem: 4vec-p-of-4vec-resand

    (defthm 4vec-p-of-4vec-resand
      (b* ((ans (4vec-resand a b)))
        (4vec-p ans))
      :rule-classes :rewrite)

    Main correctness theorem: each result bit just the ACL2::4v-wand of the corresponding input bits.

    Theorem: 4vec-resand-bits

    (defthm 4vec-resand-bits
      (equal (4vec-idx->4v n (4vec-resand x y))
             (acl2::4v-wand (4vec-idx->4v n x)
                            (4vec-idx->4v n y))))

    Theorem: 4vec-resand-of-4vec-fix-a

    (defthm 4vec-resand-of-4vec-fix-a
      (equal (4vec-resand (4vec-fix a) b)
             (4vec-resand a b)))

    Theorem: 4vec-resand-4vec-equiv-congruence-on-a

    (defthm 4vec-resand-4vec-equiv-congruence-on-a
      (implies (4vec-equiv a a-equiv)
               (equal (4vec-resand a b)
                      (4vec-resand a-equiv b)))
      :rule-classes :congruence)

    Theorem: 4vec-resand-of-4vec-fix-b

    (defthm 4vec-resand-of-4vec-fix-b
      (equal (4vec-resand a (4vec-fix b))
             (4vec-resand a b)))

    Theorem: 4vec-resand-4vec-equiv-congruence-on-b

    (defthm 4vec-resand-4vec-equiv-congruence-on-b
      (implies (4vec-equiv b b-equiv)
               (equal (4vec-resand a b)
                      (4vec-resand a b-equiv)))
      :rule-classes :congruence)