This ONLY shifts the base expression to the right point for the partselect; it does not truncate it at the right width.
(vl-plusminus-partselect->svex x type psel base-svex width) → (mv err result)
Function:
(defun vl-plusminus-partselect->svex (x type psel base-svex width) (declare (xargs :guard (and (sv::svex-select-p x) (vl-datatype-p type) (vl-plusminus-p psel) (sv::svex-p base-svex) (natp width)))) (declare (xargs :guard (vl-datatype-resolved-p type))) (let ((__function__ 'vl-plusminus-partselect->svex)) (declare (ignorable __function__)) (b* (((vl-plusminus psel)) ((mv err slotsize dim-msb dim-lsb) (vl-datatype-slot-width/range type)) ((when err) (mv err nil)) (downp (<= dim-lsb dim-msb)) (width-svex (svex-int (lnfix width))) (sel-lsb (if downp (if psel.minusp (sv::svcall + base-svex (sv::svcall + (svex-int 1) (sv::svcall sv::u- width-svex))) base-svex) (if psel.minusp base-svex (sv::svcall + base-svex (sv::svcall + (svex-int -1) width-svex))))) (shift-amt (vl-index-shift-amount slotsize dim-msb dim-lsb sel-lsb)) (width (* slotsize (lnfix width)))) (mv nil (sv::make-svex-select-part :lsb shift-amt :width width :subexp x)))))
Theorem:
(defthm return-type-of-vl-plusminus-partselect->svex.err (b* (((mv ?err ?result) (vl-plusminus-partselect->svex x type psel base-svex width))) (iff (vl-msg-p err) err)) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-vl-plusminus-partselect->svex.result (b* (((mv ?err ?result) (vl-plusminus-partselect->svex x type psel base-svex width))) (implies (not err) (sv::svex-select-p result))) :rule-classes :rewrite)
Theorem:
(defthm vars-of-vl-plusminus-partselect->svex (b* (((mv ?err ?result) (vl-plusminus-partselect->svex x type psel base-svex width))) (implies (and (not (member v (double-rewrite (sv::svex-select-vars x)))) (not (member v (double-rewrite (sv::svex-vars base-svex)))) (not err)) (not (member v (sv::svex-select-vars result))))))
Theorem:
(defthm vl-plusminus-partselect->svex-of-svex-select-fix-x (equal (vl-plusminus-partselect->svex (sv::svex-select-fix x) type psel base-svex width) (vl-plusminus-partselect->svex x type psel base-svex width)))
Theorem:
(defthm vl-plusminus-partselect->svex-svex-select-equiv-congruence-on-x (implies (sv::svex-select-equiv x x-equiv) (equal (vl-plusminus-partselect->svex x type psel base-svex width) (vl-plusminus-partselect->svex x-equiv type psel base-svex width))) :rule-classes :congruence)
Theorem:
(defthm vl-plusminus-partselect->svex-of-vl-datatype-fix-type (equal (vl-plusminus-partselect->svex x (vl-datatype-fix type) psel base-svex width) (vl-plusminus-partselect->svex x type psel base-svex width)))
Theorem:
(defthm vl-plusminus-partselect->svex-vl-datatype-equiv-congruence-on-type (implies (vl-datatype-equiv type type-equiv) (equal (vl-plusminus-partselect->svex x type psel base-svex width) (vl-plusminus-partselect->svex x type-equiv psel base-svex width))) :rule-classes :congruence)
Theorem:
(defthm vl-plusminus-partselect->svex-of-vl-plusminus-fix-psel (equal (vl-plusminus-partselect->svex x type (vl-plusminus-fix psel) base-svex width) (vl-plusminus-partselect->svex x type psel base-svex width)))
Theorem:
(defthm vl-plusminus-partselect->svex-vl-plusminus-equiv-congruence-on-psel (implies (vl-plusminus-equiv psel psel-equiv) (equal (vl-plusminus-partselect->svex x type psel base-svex width) (vl-plusminus-partselect->svex x type psel-equiv base-svex width))) :rule-classes :congruence)
Theorem:
(defthm vl-plusminus-partselect->svex-of-svex-fix-base-svex (equal (vl-plusminus-partselect->svex x type psel (sv::svex-fix base-svex) width) (vl-plusminus-partselect->svex x type psel base-svex width)))
Theorem:
(defthm vl-plusminus-partselect->svex-svex-equiv-congruence-on-base-svex (implies (sv::svex-equiv base-svex base-svex-equiv) (equal (vl-plusminus-partselect->svex x type psel base-svex width) (vl-plusminus-partselect->svex x type psel base-svex-equiv width))) :rule-classes :congruence)
Theorem:
(defthm vl-plusminus-partselect->svex-of-nfix-width (equal (vl-plusminus-partselect->svex x type psel base-svex (nfix width)) (vl-plusminus-partselect->svex x type psel base-svex width)))
Theorem:
(defthm vl-plusminus-partselect->svex-nat-equiv-congruence-on-width (implies (acl2::nat-equiv width width-equiv) (equal (vl-plusminus-partselect->svex x type psel base-svex width) (vl-plusminus-partselect->svex x type psel base-svex width-equiv))) :rule-classes :congruence)