(vl-occform-extend-id x range warnings) → (mv warnings new-x)
Function:
(defun vl-occform-extend-id (x range warnings) (declare (xargs :guard (and (vl-expr-p x) (vl-maybe-range-p range) (vl-warninglist-p warnings)))) (declare (xargs :guard (and (vl-idexpr-p x) (posp (vl-expr->finalwidth x)) (vl-expr->finaltype x)))) (let ((__function__ 'vl-occform-extend-id)) (declare (ignorable __function__)) (b* ((x (vl-expr-fix x)) (range (vl-maybe-range-fix range)) (finalwidth (vl-expr->finalwidth x)) (finaltype (vl-expr->finaltype x)) ((unless (vl-maybe-range-resolved-p range)) (mv (fatal :type :vl-occform-bad-id :msg "Expected range for ~a0 to be resolved: ~a1." :args (list x range)) x)) (actual-size (vl-maybe-range-size range)) ((when (eql actual-size finalwidth)) (mv (ok) x)) ((when (< finalwidth actual-size)) (mv (fatal :type :vl-occform-bad-id :msg "Finalwidth of ~a0 is too small for range ~a1." :args (list x range)) x)) (name (vl-idexpr->name x)) (id-part (vl-idexpr name actual-size finaltype)) (pad-width (- finalwidth actual-size)) (pad-bit (cond ((eq finaltype :vl-unsigned) |*sized-1'b0*|) ((not range) (vl-idexpr name 1 :vl-signed)) (t (make-vl-nonatom :op :vl-bitselect :args (list id-part (vl-make-index (vl-resolved->val (vl-range->msb range)))) :finalwidth 1 :finaltype :vl-unsigned)))) (concat (make-vl-nonatom :op :vl-concat :args (append (replicate pad-width pad-bit) (list id-part)) :finalwidth finalwidth :finaltype :vl-unsigned))) (mv (ok) concat))))
Theorem:
(defthm vl-warninglist-p-of-vl-occform-extend-id.warnings (b* (((mv ?warnings ?new-x) (vl-occform-extend-id x range warnings))) (vl-warninglist-p warnings)) :rule-classes :rewrite)
Theorem:
(defthm vl-expr-p-of-vl-occform-extend-id.new-x (b* (((mv ?warnings ?new-x) (vl-occform-extend-id x range warnings))) (vl-expr-p new-x)) :rule-classes :rewrite)
Theorem:
(defthm vl-expr->finalwidth-of-vl-occform-extend-id (equal (vl-expr->finalwidth (mv-nth 1 (vl-occform-extend-id x range warnings))) (vl-expr->finalwidth x)))
Theorem:
(defthm vl-expr-welltyped-p-of-vl-occform-extend-id (implies (and (vl-expr-welltyped-p x) (vl-idexpr-p x) (vl-expr->finaltype x)) (vl-expr-welltyped-p (mv-nth 1 (vl-occform-extend-id x range warnings)))))
Theorem:
(defthm vl-occform-extend-id-of-vl-expr-fix-x (equal (vl-occform-extend-id (vl-expr-fix x) range warnings) (vl-occform-extend-id x range warnings)))
Theorem:
(defthm vl-occform-extend-id-vl-expr-equiv-congruence-on-x (implies (vl-expr-equiv x x-equiv) (equal (vl-occform-extend-id x range warnings) (vl-occform-extend-id x-equiv range warnings))) :rule-classes :congruence)
Theorem:
(defthm vl-occform-extend-id-of-vl-maybe-range-fix-range (equal (vl-occform-extend-id x (vl-maybe-range-fix range) warnings) (vl-occform-extend-id x range warnings)))
Theorem:
(defthm vl-occform-extend-id-vl-maybe-range-equiv-congruence-on-range (implies (vl-maybe-range-equiv range range-equiv) (equal (vl-occform-extend-id x range warnings) (vl-occform-extend-id x range-equiv warnings))) :rule-classes :congruence)
Theorem:
(defthm vl-occform-extend-id-of-vl-warninglist-fix-warnings (equal (vl-occform-extend-id x range (vl-warninglist-fix warnings)) (vl-occform-extend-id x range warnings)))
Theorem:
(defthm vl-occform-extend-id-vl-warninglist-equiv-congruence-on-warnings (implies (vl-warninglist-equiv warnings warnings-equiv) (equal (vl-occform-extend-id x range warnings) (vl-occform-extend-id x range warnings-equiv))) :rule-classes :congruence)