Try to unparameterize a single module instance.
(vl-unparam-inst inst ss warnings modname) → (mv successp warnings inst needed-sigs mod-ss)
Function:
(defun vl-unparam-inst (inst ss warnings modname) (declare (xargs :guard (and (vl-modinst-p inst) (vl-scopestack-p ss) (vl-warninglist-p warnings) (stringp modname)))) (let ((__function__ 'vl-unparam-inst)) (declare (ignorable __function__)) (b* (((vl-modinst inst) (vl-modinst-fix inst)) (mod (vl-scopestack-find-definition inst.modname ss)) (ss (vl-scopestack-fix ss)) ((unless (and mod (or (eq (tag mod) :vl-module) (eq (tag mod) :vl-interface)))) (vl-unparam-debug "~a0: can't find module ~a1.~%" inst inst.modname) (mv nil (fatal :type :vl-bad-instance :msg "~a0: trying to instantiate undefined module ~s1." :args (list inst inst.modname)) inst nil ss)) ((when (eq (tag mod) :vl-interface)) (mv t (ok) inst nil ss)) ((vl-module mod) mod) ((when (atom mod.paramdecls)) (if (vl-paramargs-empty-p inst.paramargs) (mv t (ok) inst (make-vl-unparam-signature :modname inst.modname) (vl-scopestack-push mod ss)) (mv nil (fatal :type :vl-bad-instance :msg "~a0: parameter arguments given to ~s1, but ~s1 ~ does not take any parameters." :args (list inst inst.modname)) inst nil ss))) (ctx (make-vl-context :mod modname :elem inst)) ((mv ok warnings mod-ss final-paramdecls) (vl-scope-finalize-params mod mod.paramdecls inst.paramargs warnings ss ctx)) ((unless ok) (vl-unparam-debug "~a0: failed to finalize params~%" inst) (mv nil warnings inst nil ss)) (new-modname (vl-unparam-newname inst.modname final-paramdecls)) (new-inst (change-vl-modinst inst :modname new-modname :paramargs (make-vl-paramargs-plain :args nil))) (unparam-signature (make-vl-unparam-signature :modname inst.modname :final-params final-paramdecls))) (vl-unparam-debug "~a0: success, new instance is ~a1.~%" inst new-inst) (mv t warnings new-inst unparam-signature mod-ss))))
Theorem:
(defthm booleanp-of-vl-unparam-inst.successp (b* (((mv ?successp ?warnings ?inst ?needed-sigs ?mod-ss) (vl-unparam-inst inst ss warnings modname))) (booleanp successp)) :rule-classes :type-prescription)
Theorem:
(defthm vl-warninglist-p-of-vl-unparam-inst.warnings (b* (((mv ?successp ?warnings ?inst ?needed-sigs ?mod-ss) (vl-unparam-inst inst ss warnings modname))) (vl-warninglist-p warnings)) :rule-classes :rewrite)
Theorem:
(defthm vl-modinst-p-of-vl-unparam-inst.inst (b* (((mv ?successp ?warnings ?inst ?needed-sigs ?mod-ss) (vl-unparam-inst inst ss warnings modname))) (vl-modinst-p inst)) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-vl-unparam-inst.needed-sigs (b* (((mv ?successp ?warnings ?inst ?needed-sigs ?mod-ss) (vl-unparam-inst inst ss warnings modname))) (iff (vl-unparam-signature-p needed-sigs) needed-sigs)) :rule-classes :rewrite)
Theorem:
(defthm vl-scopestack-p-of-vl-unparam-inst.mod-ss (b* (((mv ?successp ?warnings ?inst ?needed-sigs ?mod-ss) (vl-unparam-inst inst ss warnings modname))) (vl-scopestack-p mod-ss)) :rule-classes :rewrite)
Theorem:
(defthm vl-unparam-inst-of-vl-modinst-fix-inst (equal (vl-unparam-inst (vl-modinst-fix inst) ss warnings modname) (vl-unparam-inst inst ss warnings modname)))
Theorem:
(defthm vl-unparam-inst-vl-modinst-equiv-congruence-on-inst (implies (vl-modinst-equiv inst inst-equiv) (equal (vl-unparam-inst inst ss warnings modname) (vl-unparam-inst inst-equiv ss warnings modname))) :rule-classes :congruence)
Theorem:
(defthm vl-unparam-inst-of-vl-scopestack-fix-ss (equal (vl-unparam-inst inst (vl-scopestack-fix ss) warnings modname) (vl-unparam-inst inst ss warnings modname)))
Theorem:
(defthm vl-unparam-inst-vl-scopestack-equiv-congruence-on-ss (implies (vl-scopestack-equiv ss ss-equiv) (equal (vl-unparam-inst inst ss warnings modname) (vl-unparam-inst inst ss-equiv warnings modname))) :rule-classes :congruence)
Theorem:
(defthm vl-unparam-inst-of-vl-warninglist-fix-warnings (equal (vl-unparam-inst inst ss (vl-warninglist-fix warnings) modname) (vl-unparam-inst inst ss warnings modname)))
Theorem:
(defthm vl-unparam-inst-vl-warninglist-equiv-congruence-on-warnings (implies (vl-warninglist-equiv warnings warnings-equiv) (equal (vl-unparam-inst inst ss warnings modname) (vl-unparam-inst inst ss warnings-equiv modname))) :rule-classes :congruence)
Theorem:
(defthm vl-unparam-inst-of-str-fix-modname (equal (vl-unparam-inst inst ss warnings (str-fix modname)) (vl-unparam-inst inst ss warnings modname)))
Theorem:
(defthm vl-unparam-inst-streqv-congruence-on-modname (implies (streqv modname modname-equiv) (equal (vl-unparam-inst inst ss warnings modname) (vl-unparam-inst inst ss warnings modname-equiv))) :rule-classes :congruence)