Eliminate gate and module instance arrays from a module.
(vl-module-replicate x ss) → new-x
Function:
(defun vl-module-replicate (x ss) (declare (xargs :guard (and (vl-module-p x) (vl-scopestack-p ss)))) (let ((__function__ 'vl-module-replicate)) (declare (ignorable __function__)) (b* ((x (vl-module-fix x)) ((when (vl-module->hands-offp x)) x) (ss (vl-scopestack-push x ss)) ((vl-module x) x) ((unless (or (vl-some-gateinst-array-p x.gateinsts) (vl-some-modinst-array-p x.modinsts))) x) (nf (vl-starting-namefactory x)) (warnings x.warnings) ((mv warnings new-gateinsts nf) (vl-replicate-gateinstlist x.gateinsts nf ss warnings)) ((mv warnings new-modinsts nf) (vl-replicate-modinstlist x.modinsts nf ss warnings)) (- (vl-free-namefactory nf)) (x-prime (change-vl-module x :modinsts new-modinsts :gateinsts new-gateinsts :warnings warnings))) x-prime)))
Theorem:
(defthm vl-module-p-of-vl-module-replicate (b* ((new-x (vl-module-replicate x ss))) (vl-module-p new-x)) :rule-classes :rewrite)
Theorem:
(defthm vl-module-replicate-of-vl-module-fix-x (equal (vl-module-replicate (vl-module-fix x) ss) (vl-module-replicate x ss)))
Theorem:
(defthm vl-module-replicate-vl-module-equiv-congruence-on-x (implies (vl-module-equiv x x-equiv) (equal (vl-module-replicate x ss) (vl-module-replicate x-equiv ss))) :rule-classes :congruence)
Theorem:
(defthm vl-module-replicate-of-vl-scopestack-fix-ss (equal (vl-module-replicate x (vl-scopestack-fix ss)) (vl-module-replicate x ss)))
Theorem:
(defthm vl-module-replicate-vl-scopestack-equiv-congruence-on-ss (implies (vl-scopestack-equiv ss ss-equiv) (equal (vl-module-replicate x ss) (vl-module-replicate x ss-equiv))) :rule-classes :congruence)