Construct an emod wire from a base name and index.
No restrictions are placed on the base name because we will automatically encode it if necessary; see emodwire-encoding.
We take special measures to optimize this function: we pre-generate strings
Note that we emulate defaggregate and add
Function:
(defun vl-make-indexed-wire-names-array (n) (cons (cons n (cat "[" (natstr n) "]")) (if (zp n) nil (vl-make-indexed-wire-names-array (1- n)))))
Function:
(defun vl-emodwire-encoded$inline (basename index) (declare (type string basename) (xargs :guard (and (maybe-natp index) (or index (not (equal basename "NIL")))))) (mbe :logic (if (not index) (intern basename "ACL2") (intern (cat basename "[" (natstr index) "]") "ACL2")) :exec (cond ((not index) (intern basename "ACL2")) ((< index 256) (intern (cat basename (aref1 '*vl-indexed-wire-name-array* *vl-indexed-wire-name-array* index)) "ACL2")) (t (intern (cat basename "[" (natstr index) "]") "ACL2")))))
Theorem:
(defthm vl-emodwire-p-of-vl-emodwire-encoded (implies (and (force (stringp name)) (force (maybe-natp index)) (force (or index (not (equal name "NIL"))))) (vl-emodwire-p (vl-emodwire-encoded (vl-emodwire-encode name) index))))
Function:
(defun vl-emodwire-exec$inline (basename index) (declare (type string basename) (xargs :guard (and (maybe-natp index) (or index (not (equal basename "NIL")))))) (vl-emodwire-encoded (vl-emodwire-encode basename) index))
Theorem:
(defthm vl-emodwire-p-of-vl-emodwire-exec (implies (and (force (stringp basename)) (force (maybe-natp index)) (force (or index (not (equal basename "NIL"))))) (vl-emodwire-p (vl-emodwire-exec basename index))))
Function:
(defun vl-emodwire (basename index) (declare (type string basename) (xargs :guard (and (maybe-natp index) (or index (not (equal basename "NIL")))))) (mbe :logic (let ((basename (vl-emodwire-encode basename))) (if (not index) (intern basename "ACL2") (intern (cat basename "[" (natstr index) "]") "ACL2"))) :exec (vl-emodwire-exec basename index)))
Theorem:
(defthm vl-emodwire-is-vl-emodwire-exec (equal (vl-emodwire basename index) (vl-emodwire-exec basename index)))
Theorem:
(defthm symbolp-of-vl-emodwire (symbolp (vl-emodwire basename index)) :rule-classes :type-prescription)
Theorem:
(defthm vl-emodwire-p-of-vl-emodwire (implies (and (force (stringp basename)) (force (maybe-natp index)) (force (or index (not (equal basename "NIL"))))) (vl-emodwire-p (vl-emodwire basename index))))