• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • 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
          • 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
            • Vl-msb-bits-to-care-mask
            • Vl-msb-bits-zap-dontcares
            • Vl-msb-bits-to-intliteral
              • Vl-intliteral-msb-bits
            • Port-tools
            • Lvalues
          • Server
          • Kit
          • Printer
          • Esim-vl
          • Well-formedness
        • Sv
        • Fgl
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Caremask

    Vl-msb-bits-to-intliteral

    Puts a list of bits into a constint or weirdint atom, as appropriate. Assumes the finalwidth should be the length of the bitlist.

    Signature
    (vl-msb-bits-to-intliteral x type) → lit
    Arguments
    x — Guard (vl-bitlist-p x).
    type — Guard (vl-exprtype-p type).
    Returns
    lit — Type (vl-expr-p lit).

    Definitions and Theorems

    Function: vl-msb-bits-to-intliteral

    (defun vl-msb-bits-to-intliteral (x type)
      (declare (xargs :guard (and (vl-bitlist-p x)
                                  (vl-exprtype-p type))))
      (declare (xargs :guard (consp x)))
      (let ((__function__ 'vl-msb-bits-to-intliteral))
        (declare (ignorable __function__))
        (b* ((x (mbe :logic (if (consp x) x '(:vl-0val))
                     :exec x))
             (natval (vl-msb-bits->maybe-nat-val x 0))
             (type (vl-exprtype-fix type))
             ((when natval)
              (make-vl-atom :guts (make-vl-constint :value natval
                                                    :origwidth (len x)
                                                    :origtype type
                                                    :wasunsized nil)
                            :finalwidth (len x)
                            :finaltype type)))
          (make-vl-atom :guts (make-vl-weirdint :bits x
                                                :origwidth (len x)
                                                :origtype type
                                                :wasunsized nil)
                        :finalwidth (len x)
                        :finaltype type))))

    Theorem: vl-expr-p-of-vl-msb-bits-to-intliteral

    (defthm vl-expr-p-of-vl-msb-bits-to-intliteral
      (b* ((lit (vl-msb-bits-to-intliteral x type)))
        (vl-expr-p lit))
      :rule-classes :rewrite)

    Theorem: vl-expr-welltyped-p-of-vl-msb-bits-to-intliteral

    (defthm vl-expr-welltyped-p-of-vl-msb-bits-to-intliteral
      (vl-expr-welltyped-p (vl-msb-bits-to-intliteral x type)))

    Theorem: vl-expr->finalwidth-of-vl-msb-bits-to-intliteral

    (defthm vl-expr->finalwidth-of-vl-msb-bits-to-intliteral
      (equal (vl-expr->finalwidth (vl-msb-bits-to-intliteral x type))
             (pos-fix (len x))))

    Theorem: vl-expr->finaltype-of-vl-msb-bits-to-intliteral

    (defthm vl-expr->finaltype-of-vl-msb-bits-to-intliteral
      (equal (vl-expr->finaltype (vl-msb-bits-to-intliteral x type))
             (vl-exprtype-fix type)))

    Theorem: vl-msb-bits-to-intliteral-of-vl-bitlist-fix-x

    (defthm vl-msb-bits-to-intliteral-of-vl-bitlist-fix-x
      (equal (vl-msb-bits-to-intliteral (vl-bitlist-fix x)
                                        type)
             (vl-msb-bits-to-intliteral x type)))

    Theorem: vl-msb-bits-to-intliteral-vl-bitlist-equiv-congruence-on-x

    (defthm vl-msb-bits-to-intliteral-vl-bitlist-equiv-congruence-on-x
      (implies (vl-bitlist-equiv x x-equiv)
               (equal (vl-msb-bits-to-intliteral x type)
                      (vl-msb-bits-to-intliteral x-equiv type)))
      :rule-classes :congruence)

    Theorem: vl-msb-bits-to-intliteral-of-vl-exprtype-fix-type

    (defthm vl-msb-bits-to-intliteral-of-vl-exprtype-fix-type
      (equal (vl-msb-bits-to-intliteral x (vl-exprtype-fix type))
             (vl-msb-bits-to-intliteral x type)))

    Theorem: vl-msb-bits-to-intliteral-vl-exprtype-equiv-congruence-on-type

    (defthm
         vl-msb-bits-to-intliteral-vl-exprtype-equiv-congruence-on-type
      (implies (vl-exprtype-equiv type type-equiv)
               (equal (vl-msb-bits-to-intliteral x type)
                      (vl-msb-bits-to-intliteral x type-equiv)))
      :rule-classes :congruence)