Transform
(vl-bitselect-occform x nf mod ialist warnings) → (mv new-warnings new-modules new-modinsts new-assigns new-nf)
This is only for dynamic bitselects, not static selects like
Function:
(defun vl-bitselect-occform (x nf mod ialist warnings) (declare (xargs :guard (and (vl-assign-p x) (vl-namefactory-p nf) (vl-module-p mod) (vl-warninglist-p warnings) (equal ialist (vl-make-moditem-alist mod))))) (declare (xargs :guard (and (not (vl-atom-p (vl-assign->expr x))) (member (vl-nonatom->op (vl-assign->expr x)) '(:vl-bitselect)) t))) (let ((__function__ 'vl-bitselect-occform)) (declare (ignorable __function__)) (b* ((x (vl-assign-fix x)) (warnings (vl-warninglist-fix warnings)) (nf (vl-namefactory-fix nf))) (b* (((vl-assign x) x) (from (first (vl-nonatom->args x.expr))) (idx (second (vl-nonatom->args x.expr))) (from-width (vl-expr->finalwidth from)) (idx-width (vl-expr->finalwidth idx)) ((unless (and (equal (vl-expr->finalwidth x.expr) 1) (equal (vl-expr->finalwidth x.lvalue) 1) (posp from-width) (posp idx-width) (eq (vl-expr->finaltype x.expr) :vl-unsigned) (vl-expr->finaltype x.lvalue) (vl-expr->finaltype from) (vl-expr->finaltype idx))) (occform-return :assigns (list x) :warnings (fatal :type :vl-programming-error :msg "~a0: bad widths in assignment of bit-select." :args (list x)))) (warnings (if (vl-expr-resolved-p idx) (fatal :type :vl-programming-error :msg "~a0: how did this get called? we're using a ~ dynamic bitselect when a static one would do." :args (list x)) warnings)) ((mv warnings from) (vl-occform-argfix from mod ialist warnings)) ((mv warnings idx) (vl-occform-argfix idx mod ialist warnings)) ((mv iname nf) (vl-namefactory-indexed-name "vl_bsel" nf)) (mods (vl-make-n-bit-dynamic-bitselect-m from-width idx-width)) (modinst (vl-simple-instantiate (car mods) iname (list x.lvalue from idx) :loc x.loc))) (occform-return :mods mods :modinsts (list modinst))))))
Theorem:
(defthm vl-warninglist-p-of-vl-bitselect-occform.new-warnings (b* (((mv ?new-warnings ?new-modules ?new-modinsts ?new-assigns ?new-nf) (vl-bitselect-occform x nf mod ialist warnings))) (vl-warninglist-p new-warnings)) :rule-classes :rewrite)
Theorem:
(defthm vl-modulelist-p-of-vl-bitselect-occform.new-modules (b* (((mv ?new-warnings ?new-modules ?new-modinsts ?new-assigns ?new-nf) (vl-bitselect-occform x nf mod ialist warnings))) (vl-modulelist-p new-modules)) :rule-classes :rewrite)
Theorem:
(defthm vl-modinstlist-p-of-vl-bitselect-occform.new-modinsts (b* (((mv ?new-warnings ?new-modules ?new-modinsts ?new-assigns ?new-nf) (vl-bitselect-occform x nf mod ialist warnings))) (vl-modinstlist-p new-modinsts)) :rule-classes :rewrite)
Theorem:
(defthm vl-assignlist-p-of-vl-bitselect-occform.new-assigns (b* (((mv ?new-warnings ?new-modules ?new-modinsts ?new-assigns ?new-nf) (vl-bitselect-occform x nf mod ialist warnings))) (vl-assignlist-p new-assigns)) :rule-classes :rewrite)
Theorem:
(defthm vl-namefactory-p-of-vl-bitselect-occform.new-nf (b* (((mv ?new-warnings ?new-modules ?new-modinsts ?new-assigns ?new-nf) (vl-bitselect-occform x nf mod ialist warnings))) (vl-namefactory-p new-nf)) :rule-classes :rewrite)
Theorem:
(defthm vl-bitselect-occform-mvtypes-1 (true-listp (mv-nth 1 (vl-bitselect-occform x nf mod ialist warnings))) :rule-classes :type-prescription)
Theorem:
(defthm vl-bitselect-occform-mvtypes-2 (true-listp (mv-nth 2 (vl-bitselect-occform x nf mod ialist warnings))) :rule-classes :type-prescription)
Theorem:
(defthm vl-bitselect-occform-mvtypes-3 (true-listp (mv-nth 3 (vl-bitselect-occform x nf mod ialist warnings))) :rule-classes :type-prescription)
Theorem:
(defthm vl-bitselect-occform-of-vl-assign-fix-x (equal (vl-bitselect-occform (vl-assign-fix x) nf mod ialist warnings) (vl-bitselect-occform x nf mod ialist warnings)))
Theorem:
(defthm vl-bitselect-occform-vl-assign-equiv-congruence-on-x (implies (vl-assign-equiv x x-equiv) (equal (vl-bitselect-occform x nf mod ialist warnings) (vl-bitselect-occform x-equiv nf mod ialist warnings))) :rule-classes :congruence)
Theorem:
(defthm vl-bitselect-occform-of-vl-namefactory-fix-nf (equal (vl-bitselect-occform x (vl-namefactory-fix nf) mod ialist warnings) (vl-bitselect-occform x nf mod ialist warnings)))
Theorem:
(defthm vl-bitselect-occform-vl-namefactory-equiv-congruence-on-nf (implies (vl-namefactory-equiv nf nf-equiv) (equal (vl-bitselect-occform x nf mod ialist warnings) (vl-bitselect-occform x nf-equiv mod ialist warnings))) :rule-classes :congruence)
Theorem:
(defthm vl-bitselect-occform-of-vl-module-fix-mod (equal (vl-bitselect-occform x nf (vl-module-fix mod) ialist warnings) (vl-bitselect-occform x nf mod ialist warnings)))
Theorem:
(defthm vl-bitselect-occform-vl-module-equiv-congruence-on-mod (implies (vl-module-equiv mod mod-equiv) (equal (vl-bitselect-occform x nf mod ialist warnings) (vl-bitselect-occform x nf mod-equiv ialist warnings))) :rule-classes :congruence)
Theorem:
(defthm vl-bitselect-occform-of-vl-warninglist-fix-warnings (equal (vl-bitselect-occform x nf mod ialist (vl-warninglist-fix warnings)) (vl-bitselect-occform x nf mod ialist warnings)))
Theorem:
(defthm vl-bitselect-occform-vl-warninglist-equiv-congruence-on-warnings (implies (vl-warninglist-equiv warnings warnings-equiv) (equal (vl-bitselect-occform x nf mod ialist warnings) (vl-bitselect-occform x nf mod ialist warnings-equiv))) :rule-classes :congruence)