Matches a port declaration (which may involve several comma-separated variable names), and creates an ansi-portdecl object for each of them.
(vl-parse-ansi-port-declaration-2005 atts &key (tokstream 'tokstream) (config 'config)) → (mv errmsg? value new-tokstream)
Function:
(defun vl-parse-ansi-port-declaration-2005-fn (atts tokstream config) (declare (xargs :stobjs (tokstream))) (declare (xargs :guard (vl-loadconfig-p config))) (declare (ignorable config)) (declare (xargs :guard (vl-atts-p atts))) (let ((__function__ 'vl-parse-ansi-port-declaration-2005)) (declare (ignorable __function__)) (seq tokstream (unless (vl-is-some-token? *vl-directions-kwds*) (return-raw (vl-parse-error "Expected a port direction"))) (dir := (vl-parse-port-direction)) (nettype := (vl-parse-optional-nettype)) (when (and (eq dir :vl-output) (not nettype)) (type := (vl-match-some-token '(:vl-kwd-reg :vl-kwd-integer :vl-kwd-time))) (when (eq (vl-token->type type) :vl-kwd-reg) (when (vl-is-token? :vl-kwd-signed) (signed := (vl-match))) (when (vl-is-token? :vl-lbrack) (range := (vl-parse-range)))) (id := (vl-match-token :vl-idtoken)) (rest := (vl-parse-0+-port-identifiers-as-ansi-decls-2005)) (return (cons (make-vl-ansi-portdecl :atts atts :dir dir :nettype nil :type (make-vl-coretype :name (case (vl-token->type type) (:vl-kwd-integer :vl-integer) (t :vl-time)) :signedp (if signed t (eq (vl-token->type type) :vl-kwd-integer)) :pdims (and range (list range))) :name (vl-idtoken->name id) :loc (vl-token->loc id)) rest))) (unless nettype (return-raw (vl-parse-error "Expected a nettype after an 'input' or 'inout' declaration."))) (when (vl-is-token? :vl-kwd-signed) (signed := (vl-match))) (when (vl-is-token? :vl-lbrack) (range := (vl-parse-range))) (id := (vl-match-token :vl-idtoken)) (rest := (vl-parse-0+-port-identifiers-as-ansi-decls-2005)) (return (cons (make-vl-ansi-portdecl :atts atts :dir dir :nettype nettype :type (make-vl-coretype :name :vl-logic :signedp (and signed t) :pdims (and range (list range))) :name (vl-idtoken->name id) :loc (vl-token->loc id)) rest)))))
Theorem:
(defthm vl-parse-ansi-port-declaration-2005-fails-gracefully (implies (mv-nth 0 (vl-parse-ansi-port-declaration-2005 atts)) (not (mv-nth 1 (vl-parse-ansi-port-declaration-2005 atts)))))
Theorem:
(defthm vl-warning-p-of-vl-parse-ansi-port-declaration-2005 (iff (vl-warning-p (mv-nth 0 (vl-parse-ansi-port-declaration-2005 atts))) (mv-nth 0 (vl-parse-ansi-port-declaration-2005 atts))))
Theorem:
(defthm vl-parse-ansi-port-declaration-2005-result (implies (and (force (vl-atts-p atts))) (vl-ansi-portdecllist-p (mv-nth 1 (vl-parse-ansi-port-declaration-2005 atts)))))
Theorem:
(defthm vl-parse-ansi-port-declaration-2005-true-listp (true-listp (mv-nth 1 (vl-parse-ansi-port-declaration-2005 atts))) :rule-classes :type-prescription)
Theorem:
(defthm vl-parse-ansi-port-declaration-2005-count-strong (and (<= (vl-tokstream-measure :tokstream (mv-nth 2 (vl-parse-ansi-port-declaration-2005 atts))) (vl-tokstream-measure)) (implies (not (mv-nth 0 (vl-parse-ansi-port-declaration-2005 atts))) (< (vl-tokstream-measure :tokstream (mv-nth 2 (vl-parse-ansi-port-declaration-2005 atts))) (vl-tokstream-measure)))) :rule-classes ((:rewrite) (:linear)))