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