Matches port stuff for UDPs with integrated port/port declaration lists.
(vl-parse-integrated-udp-head &key (tokstream 'tokstream) (config 'config)) → (mv errmsg? value new-tokstream)
This is for UDPs like
primitive foo(output reg o, input a, input b); ... endprimitive
The formal syntax we're working with here is:
udp_declaration ::= {attribute_instance} 'primitive' udp_identifier '(' udp_declaration_port_list ')' ';' udp_body 'endprimitive'
But in this function we assume we have read the "primitive foo (" part and that the next token "output". So all we really want to match is:
udp_declaration_port_list ')' ';'
We return a vl-udp-head-p that captures the ports correctly.
Function:
(defun vl-parse-integrated-udp-head-fn (tokstream config) (declare (xargs :stobjs (tokstream))) (declare (xargs :guard (vl-loadconfig-p config))) (declare (ignorable config)) (declare (xargs :guard (or (vl-is-token? :vl-kwd-output) (vl-is-token? :vl-beginattr)))) (let ((__function__ 'vl-parse-integrated-udp-head)) (declare (ignorable __function__)) (seq tokstream (outatts := (vl-parse-0+-attribute-instances)) (output := (vl-parse-udp-output-declaration outatts)) (:= (vl-match-token :vl-comma)) (inputs := (vl-parse-1+-udp-input-declarations-separated-by-commas)) (:= (vl-match-token :vl-rparen)) (:= (vl-match-token :vl-semi)) (return (make-vl-udp-head :output output :inputs inputs :sequentialp (equal (vl-portdecl->type output) *vl-plain-old-reg-type*))))))
Theorem:
(defthm vl-parse-integrated-udp-head-fails-gracefully (implies (mv-nth 0 (vl-parse-integrated-udp-head)) (not (mv-nth 1 (vl-parse-integrated-udp-head)))))
Theorem:
(defthm vl-warning-p-of-vl-parse-integrated-udp-head (iff (vl-warning-p (mv-nth 0 (vl-parse-integrated-udp-head))) (mv-nth 0 (vl-parse-integrated-udp-head))))
Theorem:
(defthm vl-parse-integrated-udp-head-result (implies (and (force (or (vl-is-token? :vl-kwd-output) (vl-is-token? :vl-beginattr)))) (equal (vl-udp-head-p (mv-nth 1 (vl-parse-integrated-udp-head))) (not (mv-nth 0 (vl-parse-integrated-udp-head))))))
Theorem:
(defthm vl-parse-integrated-udp-head-count-strong (and (<= (vl-tokstream-measure :tokstream (mv-nth 2 (vl-parse-integrated-udp-head))) (vl-tokstream-measure)) (implies (not (mv-nth 0 (vl-parse-integrated-udp-head))) (< (vl-tokstream-measure :tokstream (mv-nth 2 (vl-parse-integrated-udp-head))) (vl-tokstream-measure)))) :rule-classes ((:rewrite) (:linear)))