(vl-assign-check-selfassigns x ss) checks an assignment for bits that occur on the lhs and rhs.
(vl-assign-check-selfassigns x ss) → warnings
Function:
(defun vl-assign-check-selfassigns (x ss) (declare (xargs :guard (and (vl-assign-p x) (vl-scopestack-p ss)))) (let ((__function__ 'vl-assign-check-selfassigns)) (declare (ignorable __function__)) (b* (((vl-assign x) (vl-assign-fix x)) (lhs-bits (mergesort (vl-expr-approx-bits x.lvalue ss))) (rhs-bits (mergesort (vl-expr-approx-bits x.expr ss))) (oops (intersect lhs-bits rhs-bits))) (if oops (list (make-vl-warning :type :vl-warn-selfassign :msg "~a0: lhs bits occur on rhs: ~&1." :args (list x oops) :fatalp nil :fn __function__)) nil))))
Theorem:
(defthm vl-warninglist-p-of-vl-assign-check-selfassigns (b* ((warnings (vl-assign-check-selfassigns x ss))) (vl-warninglist-p warnings)) :rule-classes :rewrite)
Theorem:
(defthm vl-assign-check-selfassigns-of-vl-assign-fix-x (equal (vl-assign-check-selfassigns (vl-assign-fix x) ss) (vl-assign-check-selfassigns x ss)))
Theorem:
(defthm vl-assign-check-selfassigns-vl-assign-equiv-congruence-on-x (implies (vl-assign-equiv x x-equiv) (equal (vl-assign-check-selfassigns x ss) (vl-assign-check-selfassigns x-equiv ss))) :rule-classes :congruence)
Theorem:
(defthm vl-assign-check-selfassigns-of-vl-scopestack-fix-ss (equal (vl-assign-check-selfassigns x (vl-scopestack-fix ss)) (vl-assign-check-selfassigns x ss)))
Theorem:
(defthm vl-assign-check-selfassigns-vl-scopestack-equiv-congruence-on-ss (implies (vl-scopestack-equiv ss ss-equiv) (equal (vl-assign-check-selfassigns x ss) (vl-assign-check-selfassigns x ss-equiv))) :rule-classes :congruence)