(vl-seltrace-to-svex-select x indices base-type base-svar outer-ss) → (mv err select)
Function:
(defun vl-seltrace-to-svex-select (x indices base-type base-svar outer-ss) (declare (xargs :guard (and (vl-seltrace-p x) (sv::svexlist-p indices) (vl-datatype-p base-type) (sv::svar-p base-svar) (vl-scopestack-p outer-ss)))) (declare (xargs :guard (and (vl-seltrace-usertypes-ok x) (vl-datatype-resolved-p base-type) (>= (len indices) (vl-seltrace-index-count x))))) (let ((__function__ 'vl-seltrace-to-svex-select)) (declare (ignorable __function__)) (b* ((type (vl-seltrace-type x base-type)) ((mv err size) (vl-datatype-size type)) ((when err) (mv err nil)) ((unless size) (mv (vmsg "Could not size datatype ~s0" type) nil)) ((when (atom x)) (mv nil (sv::make-svex-select-var :name base-svar :width size))) ((vl-selstep step) (car x)) (rest-type (vl-seltrace-type (cdr x) base-type)) (rest-type (vl-maybe-usertype-resolve rest-type)) ((mv err shift-amt) (vl-select-case step.select :field (b* (((mv err idx) (vl-datatype-field-shift-amount rest-type step.select.name)) ((when err) (mv err idx))) (mv nil (svex-int idx))) :index (vl-datatype-index-shift-amount rest-type (car indices)))) ((when err) (mv err nil)) ((mv err rest) (vl-seltrace-to-svex-select (cdr x) (vl-select-case step.select :field indices :index (cdr indices)) base-type base-svar outer-ss)) ((when err) (mv err nil))) (mv err (sv::make-svex-select-part :lsb shift-amt :width size :subexp rest)))))
Theorem:
(defthm return-type-of-vl-seltrace-to-svex-select.err (b* (((mv ?err ?select) (vl-seltrace-to-svex-select x indices base-type base-svar outer-ss))) (iff (vl-msg-p err) err)) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-vl-seltrace-to-svex-select.select (b* (((mv ?err ?select) (vl-seltrace-to-svex-select x indices base-type base-svar outer-ss))) (implies (not err) (sv::svex-select-p select))) :rule-classes :rewrite)
Theorem:
(defthm vars-of-vl-seltrace-to-svex-select (b* (((mv ?err ?select) (vl-seltrace-to-svex-select x indices base-type base-svar outer-ss))) (implies (and (not (member v (double-rewrite (sv::svexlist-vars indices)))) (not (equal v (sv::svar-fix base-svar))) (not err)) (not (member v (sv::svex-select-vars select))))))
Theorem:
(defthm vl-seltrace-to-svex-select-of-vl-seltrace-fix-x (equal (vl-seltrace-to-svex-select (vl-seltrace-fix x) indices base-type base-svar outer-ss) (vl-seltrace-to-svex-select x indices base-type base-svar outer-ss)))
Theorem:
(defthm vl-seltrace-to-svex-select-vl-seltrace-equiv-congruence-on-x (implies (vl-seltrace-equiv x x-equiv) (equal (vl-seltrace-to-svex-select x indices base-type base-svar outer-ss) (vl-seltrace-to-svex-select x-equiv indices base-type base-svar outer-ss))) :rule-classes :congruence)
Theorem:
(defthm vl-seltrace-to-svex-select-of-svexlist-fix-indices (equal (vl-seltrace-to-svex-select x (sv::svexlist-fix indices) base-type base-svar outer-ss) (vl-seltrace-to-svex-select x indices base-type base-svar outer-ss)))
Theorem:
(defthm vl-seltrace-to-svex-select-svexlist-equiv-congruence-on-indices (implies (sv::svexlist-equiv indices indices-equiv) (equal (vl-seltrace-to-svex-select x indices base-type base-svar outer-ss) (vl-seltrace-to-svex-select x indices-equiv base-type base-svar outer-ss))) :rule-classes :congruence)
Theorem:
(defthm vl-seltrace-to-svex-select-of-vl-datatype-fix-base-type (equal (vl-seltrace-to-svex-select x indices (vl-datatype-fix base-type) base-svar outer-ss) (vl-seltrace-to-svex-select x indices base-type base-svar outer-ss)))
Theorem:
(defthm vl-seltrace-to-svex-select-vl-datatype-equiv-congruence-on-base-type (implies (vl-datatype-equiv base-type base-type-equiv) (equal (vl-seltrace-to-svex-select x indices base-type base-svar outer-ss) (vl-seltrace-to-svex-select x indices base-type-equiv base-svar outer-ss))) :rule-classes :congruence)
Theorem:
(defthm vl-seltrace-to-svex-select-of-svar-fix-base-svar (equal (vl-seltrace-to-svex-select x indices base-type (sv::svar-fix base-svar) outer-ss) (vl-seltrace-to-svex-select x indices base-type base-svar outer-ss)))
Theorem:
(defthm vl-seltrace-to-svex-select-svar-equiv-congruence-on-base-svar (implies (sv::svar-equiv base-svar base-svar-equiv) (equal (vl-seltrace-to-svex-select x indices base-type base-svar outer-ss) (vl-seltrace-to-svex-select x indices base-type base-svar-equiv outer-ss))) :rule-classes :congruence)
Theorem:
(defthm vl-seltrace-to-svex-select-of-vl-scopestack-fix-outer-ss (equal (vl-seltrace-to-svex-select x indices base-type base-svar (vl-scopestack-fix outer-ss)) (vl-seltrace-to-svex-select x indices base-type base-svar outer-ss)))
Theorem:
(defthm vl-seltrace-to-svex-select-vl-scopestack-equiv-congruence-on-outer-ss (implies (vl-scopestack-equiv outer-ss outer-ss-equiv) (equal (vl-seltrace-to-svex-select x indices base-type base-svar outer-ss) (vl-seltrace-to-svex-select x indices base-type base-svar outer-ss-equiv))) :rule-classes :congruence)