Transform an arbitrary single assignment into occurrences.
(vl-assign-occform x nf mod ialist warnings) → (mv new-warnings new-modules new-modinsts new-assigns new-nf)
We don't support certain operators like division and modulus yet. It should be straightforward to add new operators: just figure out how to generate a gate-based conservative approximation, and then plug it in below.
Function:
(defun vl-assign-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 t))) (let ((__function__ 'vl-assign-occform)) (declare (ignorable __function__)) (b* ((x (vl-assign-fix x)) (warnings (vl-warninglist-fix warnings)) (nf (vl-namefactory-fix nf))) (b* ((expr (vl-assign->expr x)) ((when (vl-expr-sliceable-p expr)) (vl-plain-occform x nf mod ialist warnings)) ((when (vl-fast-atom-p expr)) (occform-return :assigns (list x) :warnings (fatal :type :vl-not-implemented :msg "~a0: don't know how to occform ~x1 atom." :args (list x (tag (vl-atom->guts expr)))))) (op (vl-nonatom->op expr))) (case op ((:vl-unary-bitand :vl-unary-bitor :vl-unary-xor) (vl-unary-reduction-op-occform x nf mod ialist warnings)) (:vl-unary-bitnot (vl-unary-not-occform x nf mod ialist warnings)) ((:vl-binary-plus :vl-binary-minus) (vl-plusminus-occform x nf mod ialist warnings)) ((:vl-binary-bitand :vl-binary-bitor :vl-binary-xor :vl-binary-xnor) (vl-basic-binary-op-occform x nf mod ialist warnings)) ((:vl-binary-gte) (vl-gte-occform x nf mod ialist warnings)) ((:vl-binary-ceq) (vl-ceq-occform x nf mod ialist warnings)) ((:vl-bitselect) (vl-bitselect-occform x nf mod ialist warnings)) ((:vl-qmark) (vl-mux-occform x nf mod ialist warnings)) ((:vl-binary-shl :vl-binary-shr) (vl-shift-occform x nf mod ialist warnings)) ((:vl-binary-times) (vl-mult-occform x nf mod ialist warnings)) ((:vl-binary-div) (vl-div-occform x nf mod ialist warnings)) ((:vl-binary-rem) (vl-rem-occform x nf mod ialist warnings)) ((:vl-partselect-colon :vl-concat :vl-multiconcat) (occform-return :assigns (list x) :warnings (fatal :type :vl-programming-error :msg "~a0: expected ~x1 operator to be sliceable!" :args (list x op)))) (otherwise (occform-return :assigns (list x) :warnings (fatal :type :vl-not-implemented :msg "~a0: don't know how to occform ~x1 operator." :args (list x op)))))))))
Theorem:
(defthm vl-warninglist-p-of-vl-assign-occform.new-warnings (b* (((mv ?new-warnings ?new-modules ?new-modinsts ?new-assigns ?new-nf) (vl-assign-occform x nf mod ialist warnings))) (vl-warninglist-p new-warnings)) :rule-classes :rewrite)
Theorem:
(defthm vl-modulelist-p-of-vl-assign-occform.new-modules (b* (((mv ?new-warnings ?new-modules ?new-modinsts ?new-assigns ?new-nf) (vl-assign-occform x nf mod ialist warnings))) (vl-modulelist-p new-modules)) :rule-classes :rewrite)
Theorem:
(defthm vl-modinstlist-p-of-vl-assign-occform.new-modinsts (b* (((mv ?new-warnings ?new-modules ?new-modinsts ?new-assigns ?new-nf) (vl-assign-occform x nf mod ialist warnings))) (vl-modinstlist-p new-modinsts)) :rule-classes :rewrite)
Theorem:
(defthm vl-assignlist-p-of-vl-assign-occform.new-assigns (b* (((mv ?new-warnings ?new-modules ?new-modinsts ?new-assigns ?new-nf) (vl-assign-occform x nf mod ialist warnings))) (vl-assignlist-p new-assigns)) :rule-classes :rewrite)
Theorem:
(defthm vl-namefactory-p-of-vl-assign-occform.new-nf (b* (((mv ?new-warnings ?new-modules ?new-modinsts ?new-assigns ?new-nf) (vl-assign-occform x nf mod ialist warnings))) (vl-namefactory-p new-nf)) :rule-classes :rewrite)
Theorem:
(defthm vl-assign-occform-mvtypes-1 (true-listp (mv-nth 1 (vl-assign-occform x nf mod ialist warnings))) :rule-classes :type-prescription)
Theorem:
(defthm vl-assign-occform-mvtypes-2 (true-listp (mv-nth 2 (vl-assign-occform x nf mod ialist warnings))) :rule-classes :type-prescription)
Theorem:
(defthm vl-assign-occform-mvtypes-3 (true-listp (mv-nth 3 (vl-assign-occform x nf mod ialist warnings))) :rule-classes :type-prescription)
Theorem:
(defthm vl-assign-occform-of-vl-assign-fix-x (equal (vl-assign-occform (vl-assign-fix x) nf mod ialist warnings) (vl-assign-occform x nf mod ialist warnings)))
Theorem:
(defthm vl-assign-occform-vl-assign-equiv-congruence-on-x (implies (vl-assign-equiv x x-equiv) (equal (vl-assign-occform x nf mod ialist warnings) (vl-assign-occform x-equiv nf mod ialist warnings))) :rule-classes :congruence)
Theorem:
(defthm vl-assign-occform-of-vl-namefactory-fix-nf (equal (vl-assign-occform x (vl-namefactory-fix nf) mod ialist warnings) (vl-assign-occform x nf mod ialist warnings)))
Theorem:
(defthm vl-assign-occform-vl-namefactory-equiv-congruence-on-nf (implies (vl-namefactory-equiv nf nf-equiv) (equal (vl-assign-occform x nf mod ialist warnings) (vl-assign-occform x nf-equiv mod ialist warnings))) :rule-classes :congruence)
Theorem:
(defthm vl-assign-occform-of-vl-module-fix-mod (equal (vl-assign-occform x nf (vl-module-fix mod) ialist warnings) (vl-assign-occform x nf mod ialist warnings)))
Theorem:
(defthm vl-assign-occform-vl-module-equiv-congruence-on-mod (implies (vl-module-equiv mod mod-equiv) (equal (vl-assign-occform x nf mod ialist warnings) (vl-assign-occform x nf mod-equiv ialist warnings))) :rule-classes :congruence)
Theorem:
(defthm vl-assign-occform-of-vl-warninglist-fix-warnings (equal (vl-assign-occform x nf mod ialist (vl-warninglist-fix warnings)) (vl-assign-occform x nf mod ialist warnings)))
Theorem:
(defthm vl-assign-occform-vl-warninglist-equiv-congruence-on-warnings (implies (vl-warninglist-equiv warnings warnings-equiv) (equal (vl-assign-occform x nf mod ialist warnings) (vl-assign-occform x nf mod ialist warnings-equiv))) :rule-classes :congruence)