Determine the net type to use for a port.
(vl-nettype-for-parsed-ansi-port dir x) → nettype
From SystemVerilog-2012 23.2.2.3, "the term "port kind" is used to mean any of the net type keywords, or the keyword var, which are used to explicitly declare a port of one of these kinds..."
For ports in an ANSI port list, the rules for determining the port kind appear to be the same for the first port and for subsequent ports. (Pages 667 and 668).
The rules depend on the direction of the port.
Function:
(defun vl-nettype-for-parsed-ansi-port (dir x) (declare (xargs :guard (and (vl-direction-p dir) (vl-ansi-portdecl-p x)))) (let ((__function__ 'vl-nettype-for-parsed-ansi-port)) (declare (ignorable __function__)) (b* (((vl-ansi-portdecl x))) (cond (x.nettype x.nettype) (x.varp nil) ((eq (vl-direction-fix dir) :vl-output) (if x.type nil :vl-wire)) (t :vl-wire)))))
Theorem:
(defthm vl-maybe-nettypename-p-of-vl-nettype-for-parsed-ansi-port (b* ((nettype (vl-nettype-for-parsed-ansi-port dir x))) (vl-maybe-nettypename-p nettype)) :rule-classes :rewrite)
Theorem:
(defthm vl-nettype-for-parsed-ansi-port-of-vl-direction-fix-dir (equal (vl-nettype-for-parsed-ansi-port (vl-direction-fix dir) x) (vl-nettype-for-parsed-ansi-port dir x)))
Theorem:
(defthm vl-nettype-for-parsed-ansi-port-vl-direction-equiv-congruence-on-dir (implies (vl-direction-equiv dir dir-equiv) (equal (vl-nettype-for-parsed-ansi-port dir x) (vl-nettype-for-parsed-ansi-port dir-equiv x))) :rule-classes :congruence)
Theorem:
(defthm vl-nettype-for-parsed-ansi-port-of-vl-ansi-portdecl-fix-x (equal (vl-nettype-for-parsed-ansi-port dir (vl-ansi-portdecl-fix x)) (vl-nettype-for-parsed-ansi-port dir x)))
Theorem:
(defthm vl-nettype-for-parsed-ansi-port-vl-ansi-portdecl-equiv-congruence-on-x (implies (vl-ansi-portdecl-equiv x x-equiv) (equal (vl-nettype-for-parsed-ansi-port dir x) (vl-nettype-for-parsed-ansi-port dir x-equiv))) :rule-classes :congruence)