(vl-rangeresolve x ss warnings) → (mv warnings new-x)
Function:
(defun vl-rangeresolve (x ss warnings) (declare (xargs :guard (and (vl-range-p x) (vl-scopestack-p ss) (vl-warninglist-p warnings)))) (declare (ignorable ss)) (let ((__function__ 'vl-rangeresolve)) (declare (ignorable __function__)) (b* ((x (vl-range-fix x)) (warnings (vl-warninglist-fix warnings))) (b* (((vl-range x) x) ((mv msb-ok msb) (vl-consteval x.msb ss)) ((mv lsb-ok lsb) (vl-consteval x.lsb ss)) ((unless (and msb-ok lsb-ok)) (mv (warn :type :vl-bad-range :msg "Unable to safely resolve range ~a0." :args (list x)) x)) (msb (vl-make-index (vl-resolved->val msb))) (lsb (vl-make-index (vl-resolved->val lsb))) (new-range (hons-copy (make-vl-range :msb msb :lsb lsb))) (new-range-size (vl-range-size new-range)) ((when (>= new-range-size (expt 2 20))) (mv (fatal :type :vl-range-too-big :msg "Range ~a0 is going to have size ~x1. This is crazy. ~ Causing a fatal warning to prevent further ~ simplification of this module." :args (list x new-range-size)) x))) (mv (ok) new-range)))))
Theorem:
(defthm vl-warninglist-p-of-vl-rangeresolve.warnings (b* (((mv ?warnings ?new-x) (vl-rangeresolve x ss warnings))) (vl-warninglist-p warnings)) :rule-classes :rewrite)
Theorem:
(defthm vl-range-p-of-vl-rangeresolve.new-x (b* (((mv ?warnings ?new-x) (vl-rangeresolve x ss warnings))) (vl-range-p new-x)) :rule-classes :rewrite)
Theorem:
(defthm vl-rangeresolve-of-vl-range-fix-x (equal (vl-rangeresolve (vl-range-fix x) ss warnings) (vl-rangeresolve x ss warnings)))
Theorem:
(defthm vl-rangeresolve-vl-range-equiv-congruence-on-x (implies (vl-range-equiv x x-equiv) (equal (vl-rangeresolve x ss warnings) (vl-rangeresolve x-equiv ss warnings))) :rule-classes :congruence)
Theorem:
(defthm vl-rangeresolve-of-vl-scopestack-fix-ss (equal (vl-rangeresolve x (vl-scopestack-fix ss) warnings) (vl-rangeresolve x ss warnings)))
Theorem:
(defthm vl-rangeresolve-vl-scopestack-equiv-congruence-on-ss (implies (vl-scopestack-equiv ss ss-equiv) (equal (vl-rangeresolve x ss warnings) (vl-rangeresolve x ss-equiv warnings))) :rule-classes :congruence)
Theorem:
(defthm vl-rangeresolve-of-vl-warninglist-fix-warnings (equal (vl-rangeresolve x ss (vl-warninglist-fix warnings)) (vl-rangeresolve x ss warnings)))
Theorem:
(defthm vl-rangeresolve-vl-warninglist-equiv-congruence-on-warnings (implies (vl-warninglist-equiv warnings warnings-equiv) (equal (vl-rangeresolve x ss warnings) (vl-rangeresolve x ss warnings-equiv))) :rule-classes :congruence)