Convenient way to generate an internal wire for a primitive.
(vl-primitive-mkwire name) → (mv expr vardecl)
This is similar to vl-occform-mkwire, but our primitives are all one-bit things so we leave out the ranges to make them prettier.
Function:
(defun vl-primitive-mkwire (name) (declare (xargs :guard (stringp name))) (let ((__function__ 'vl-primitive-mkwire)) (declare (ignorable __function__)) (b* ((name (hons-copy (string-fix name))) (expr (vl-idexpr name 1 :vl-unsigned)) (vardecl (make-vl-vardecl :name name :type *vl-plain-old-wire-type* :nettype :vl-wire :loc *vl-fakeloc*))) (mv expr vardecl))))
Theorem:
(defthm vl-expr-p-of-vl-primitive-mkwire.expr (b* (((mv ?expr ?vardecl) (vl-primitive-mkwire name))) (vl-expr-p expr)) :rule-classes :rewrite)
Theorem:
(defthm vl-vardecl-p-of-vl-primitive-mkwire.vardecl (b* (((mv ?expr ?vardecl) (vl-primitive-mkwire name))) (vl-vardecl-p vardecl)) :rule-classes :rewrite)
Theorem:
(defthm vl-primitive-mkwire-of-str-fix-name (equal (vl-primitive-mkwire (str-fix name)) (vl-primitive-mkwire name)))
Theorem:
(defthm vl-primitive-mkwire-streqv-congruence-on-name (implies (streqv name name-equiv) (equal (vl-primitive-mkwire name) (vl-primitive-mkwire name-equiv))) :rule-classes :congruence)