Convert most of a package into a vl-genblob.
(vl-package->genblob x) → genblob
Certain fields of a vl-package aren't also fields of a vl-genblob, for instance, a genblob doesn't have warnings, a name, location information, etc.
But aside from these fields, most of a package can be extracted and turned into a genblob for easy processing. After processing the blob, the updated fields can be reinstalled into the package using vl-genblob->package.
Function:
(defun vl-package->genblob (x) (declare (xargs :guard (vl-package-p x))) (let ((__function__ 'vl-package->genblob)) (declare (ignorable __function__)) (b* (((vl-package x))) (make-vl-genblob :id x.name :scopetype :vl-package :fundecls x.fundecls :taskdecls x.taskdecls :typedefs x.typedefs :paramdecls x.paramdecls :vardecls x.vardecls :imports x.imports))))
Theorem:
(defthm vl-genblob-p-of-vl-package->genblob (b* ((genblob (vl-package->genblob x))) (vl-genblob-p genblob)) :rule-classes :rewrite)
Theorem:
(defthm vl-package->genblob-of-vl-package-fix-x (equal (vl-package->genblob (vl-package-fix x)) (vl-package->genblob x)))
Theorem:
(defthm vl-package->genblob-vl-package-equiv-congruence-on-x (implies (vl-package-equiv x x-equiv) (equal (vl-package->genblob x) (vl-package->genblob x-equiv))) :rule-classes :congruence)