Compute the
(vl-portdecls-to-i/o portdecls walist) → (mv successp warnings in-wires out-wires)
We don't take a warnings accumulator because we memoize this function.
See vl-emodwirelistlist-p for some discussion about the kinds of patterns we generate.
Historic note. We originally tried to base our
Function:
(defun vl-portdecls-to-i/o (portdecls walist) (declare (xargs :guard (and (vl-portdecllist-p portdecls) (vl-wirealist-p walist)))) (let ((__function__ 'vl-portdecls-to-i/o)) (declare (ignorable __function__)) (b* (((when (atom portdecls)) (mv t nil nil nil)) (warnings nil) (decl1 (car portdecls)) ((vl-portdecl decl1) decl1) ((unless (or (eq decl1.dir :vl-input) (eq decl1.dir :vl-output))) (mv nil (fatal :type :vl-bad-portdecl :msg "~a0: port declaration has unsupported direction ~x1." :args (list decl1 decl1.dir)) nil nil)) (entry (hons-get decl1.name walist)) ((unless (and entry (mbt (vl-emodwirelist-p (cdr entry))))) (mv nil (fatal :type :vl-bad-portdecl :msg "~a0: no wire alist entry for ~w1." :args (list decl1 decl1.name)) nil nil)) (msb-wires (llist-fix (cdr entry))) (lsb-wires (reverse msb-wires)) ((mv successp warnings in-wires out-wires) (vl-portdecls-to-i/o (cdr portdecls) walist)) ((unless successp) (mv nil warnings in-wires out-wires)) ((mv in-wires out-wires) (case decl1.dir (:vl-input (mv (cons lsb-wires in-wires) out-wires)) (:vl-output (mv in-wires (cons lsb-wires out-wires))) (otherwise (prog2$ (impossible) (mv in-wires out-wires)))))) (mv t warnings in-wires out-wires))))
Theorem:
(defthm booleanp-of-vl-portdecls-to-i/o.successp (b* (((mv ?successp ?warnings ?in-wires ?out-wires) (vl-portdecls-to-i/o portdecls walist))) (booleanp successp)) :rule-classes :type-prescription)
Theorem:
(defthm vl-warninglist-p-of-vl-portdecls-to-i/o.warnings (b* (((mv ?successp ?warnings ?in-wires ?out-wires) (vl-portdecls-to-i/o portdecls walist))) (vl-warninglist-p warnings)) :rule-classes :rewrite)
Theorem:
(defthm vl-emodwirelistlist-p-of-vl-portdecls-to-i/o.in-wires (b* (((mv ?successp ?warnings ?in-wires ?out-wires) (vl-portdecls-to-i/o portdecls walist))) (vl-emodwirelistlist-p in-wires)) :rule-classes :rewrite)
Theorem:
(defthm vl-emodwirelistlist-p-of-vl-portdecls-to-i/o.out-wires (b* (((mv ?successp ?warnings ?in-wires ?out-wires) (vl-portdecls-to-i/o portdecls walist))) (vl-emodwirelistlist-p out-wires)) :rule-classes :rewrite)
Theorem:
(defthm true-listp-of-vl-portdecls-to-i/o.warnings (b* (((mv ?successp ?warnings ?in-wires ?out-wires) (vl-portdecls-to-i/o portdecls walist))) (true-listp warnings)) :rule-classes :type-prescription)
Theorem:
(defthm true-listp-of-vl-portdecls-to-i/o.in-wires (b* (((mv ?successp ?warnings ?in-wires ?out-wires) (vl-portdecls-to-i/o portdecls walist))) (true-listp in-wires)) :rule-classes :type-prescription)
Theorem:
(defthm true-listp-of-vl-portdecls-to-i/o.out-wires (b* (((mv ?successp ?warnings ?in-wires ?out-wires) (vl-portdecls-to-i/o portdecls walist))) (true-listp out-wires)) :rule-classes :type-prescription)