Merge newly found Verilog descriptions with previously loaded descriptions, warning about any multiply defined descriptions.
(vl-load-merge-descriptions new old descalist reportcard) → (mv merged new-descalist reportcard)
As a simple rule, we always keep the first definition of any
description we encounter. This function is responsible for enforcing
this rule: we merge some newly parsed descriptions in with the
already-parsed descriptions. If there are any name clashes, the
original definition wins, and we add a warning to the
Function:
(defun vl-load-merge-descriptions (new old descalist reportcard) (declare (xargs :guard (and (vl-descriptionlist-p new) (vl-descriptionlist-p old) (vl-reportcard-p reportcard) (equal descalist (vl-make-descalist old))))) (let ((__function__ 'vl-load-merge-descriptions)) (declare (ignorable __function__)) (b* ((old (vl-descriptionlist-fix old)) (reportcard (vl-reportcard-fix reportcard)) ((when (atom new)) (mv old descalist reportcard)) (newdesc1 (vl-description-fix (car new))) (newname1 (vl-description->name newdesc1)) ((unless newname1) (vl-load-merge-descriptions (cdr new) (cons newdesc1 old) descalist reportcard)) (prevdesc (vl-fast-find-description newname1 old descalist)) ((unless prevdesc) (vl-load-merge-descriptions (cdr new) (cons newdesc1 old) (hons-acons newname1 newdesc1 descalist) reportcard)) (warning (make-vl-warning :type :vl-warn-multidef :msg "~m0 is defined multiple times. Keeping the old ~ definition (~a1) and ignoring the new one (~a2)." :args (list newname1 (vl-description->minloc prevdesc) (vl-description->minloc newdesc1)))) (reportcard (vl-extend-reportcard newname1 warning reportcard))) (vl-load-merge-descriptions (cdr new) old descalist reportcard))))
Theorem:
(defthm vl-descriptionlist-p-of-vl-load-merge-descriptions.merged (b* (((mv ?merged ?new-descalist ?reportcard) (vl-load-merge-descriptions new old descalist reportcard))) (vl-descriptionlist-p merged)) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-vl-load-merge-descriptions.new-descalist (implies (equal descalist (vl-make-descalist old)) (b* (((mv ?merged ?new-descalist ?reportcard) (vl-load-merge-descriptions new old descalist reportcard))) (equal new-descalist (vl-make-descalist merged)))) :rule-classes :rewrite)
Theorem:
(defthm vl-reportcard-p-of-vl-load-merge-descriptions.reportcard (b* (((mv ?merged ?new-descalist ?reportcard) (vl-load-merge-descriptions new old descalist reportcard))) (vl-reportcard-p reportcard)) :rule-classes :rewrite)
Theorem:
(defthm unique-names-after-vl-load-merge-descriptions (implies (uniquep (vl-descriptionlist->names old)) (b* (((mv merged ?descalist ?reportcard) (vl-load-merge-descriptions new old descalist reportcard))) (no-duplicatesp (vl-descriptionlist->names merged)))))
Theorem:
(defthm vl-load-merge-descriptions-of-vl-descriptionlist-fix-new (equal (vl-load-merge-descriptions (vl-descriptionlist-fix new) old descalist reportcard) (vl-load-merge-descriptions new old descalist reportcard)))
Theorem:
(defthm vl-load-merge-descriptions-vl-descriptionlist-equiv-congruence-on-new (implies (vl-descriptionlist-equiv new new-equiv) (equal (vl-load-merge-descriptions new old descalist reportcard) (vl-load-merge-descriptions new-equiv old descalist reportcard))) :rule-classes :congruence)
Theorem:
(defthm vl-load-merge-descriptions-of-vl-descriptionlist-fix-old (equal (vl-load-merge-descriptions new (vl-descriptionlist-fix old) descalist reportcard) (vl-load-merge-descriptions new old descalist reportcard)))
Theorem:
(defthm vl-load-merge-descriptions-vl-descriptionlist-equiv-congruence-on-old (implies (vl-descriptionlist-equiv old old-equiv) (equal (vl-load-merge-descriptions new old descalist reportcard) (vl-load-merge-descriptions new old-equiv descalist reportcard))) :rule-classes :congruence)
Theorem:
(defthm vl-load-merge-descriptions-of-vl-reportcard-fix-reportcard (equal (vl-load-merge-descriptions new old descalist (vl-reportcard-fix reportcard)) (vl-load-merge-descriptions new old descalist reportcard)))
Theorem:
(defthm vl-load-merge-descriptions-vl-reportcard-equiv-congruence-on-reportcard (implies (vl-reportcard-equiv reportcard reportcard-equiv) (equal (vl-load-merge-descriptions new old descalist reportcard) (vl-load-merge-descriptions new old descalist reportcard-equiv))) :rule-classes :congruence)