Puts a list of bits into a constint or weirdint atom, as appropriate. Assumes the finalwidth should be the length of the bitlist.
(vl-msb-bits-to-intliteral x type) → lit
Function:
(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:
(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:
(defthm vl-expr-welltyped-p-of-vl-msb-bits-to-intliteral (vl-expr-welltyped-p (vl-msb-bits-to-intliteral x type)))
Theorem:
(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:
(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:
(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:
(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:
(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:
(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)