Verilog-2005 only. Match
(vl-parse-taskport-list &key (tokstream 'tokstream) (config 'config)) → (mv errmsg? value new-tokstream)
The basic grammar rules are:
task_port_item ::= { attribute_instance } tf_input_declaration | { attribute_instance } tf_output_declaration | { attribute_instance } tf_inout_declaration task_port_list ::= task_port_item { , task_port_item }
We use this same function for parsing function port lists. Note that a function port list is just the subset of a task port list, where the ports are all of type input.
function_port_list ::= { attribute_instance } tf_input_declaration { ',' { attribute_instance } tf_input_declaration }
We therefore just write a parser for task_port_list, then separately check (when we construct the function declaration) that all the ports are inputs.
Function:
(defun vl-parse-taskport-list-fn (tokstream config) (declare (xargs :stobjs (tokstream))) (declare (xargs :guard (vl-loadconfig-p config))) (declare (ignorable config)) (let ((__function__ 'vl-parse-taskport-list)) (declare (ignorable __function__)) (seq tokstream (atts := (vl-parse-0+-attribute-instances)) (ins1 := (vl-parse-taskport-declaration atts)) (unless (vl-is-token? :vl-comma) (return ins1)) (:= (vl-match-token :vl-comma)) (ins2 := (vl-parse-taskport-list)) (return (append ins1 ins2)))))
Theorem:
(defthm vl-parse-taskport-list-fails-gracefully (implies (mv-nth 0 (vl-parse-taskport-list)) (not (mv-nth 1 (vl-parse-taskport-list)))))
Theorem:
(defthm vl-warning-p-of-vl-parse-taskport-list (iff (vl-warning-p (mv-nth 0 (vl-parse-taskport-list))) (mv-nth 0 (vl-parse-taskport-list))))
Theorem:
(defthm vl-parse-taskport-list-result (implies (and t) (vl-portdecllist-p (mv-nth 1 (vl-parse-taskport-list)))))
Theorem:
(defthm vl-parse-taskport-list-true-listp (true-listp (mv-nth 1 (vl-parse-taskport-list))) :rule-classes :type-prescription)
Theorem:
(defthm vl-parse-taskport-list-count-strong (and (<= (vl-tokstream-measure :tokstream (mv-nth 2 (vl-parse-taskport-list))) (vl-tokstream-measure)) (implies (not (mv-nth 0 (vl-parse-taskport-list))) (< (vl-tokstream-measure :tokstream (mv-nth 2 (vl-parse-taskport-list))) (vl-tokstream-measure)))) :rule-classes ((:rewrite) (:linear)))