Convert a function's input declaration into a net declaration for its funtemplate.
(vl-funinput-to-vardecl x) → vardecl
We assume the input is okay in the sense of vl-portdecllist-types-okp.
We implement a special hack for Verilog-2005 compatibility. In particular, consider a basic function such as:
function [3:0] AndFn(input [3:0] a, input [3:0] b); AndFn = a & b; endfunction
Our internal representation of function inputs now uses
To avoid this, when we convert function inputs into wires, we'll just go ahead and ensure the net type is :vl-wire.
Function:
(defun vl-funinput-to-vardecl (x) (declare (xargs :guard (vl-portdecl-p x))) (let ((__function__ 'vl-funinput-to-vardecl)) (declare (ignorable __function__)) (b* (((vl-portdecl x) x) (name-atom (make-vl-atom :guts (make-vl-string :value x.name)))) (make-vl-vardecl :name x.name :type x.type :nettype :vl-wire :atts (acons "VL_FUNCTION_INPUT" name-atom x.atts) :loc x.loc))))
Theorem:
(defthm vl-vardecl-p-of-vl-funinput-to-vardecl (b* ((vardecl (vl-funinput-to-vardecl x))) (vl-vardecl-p vardecl)) :rule-classes :rewrite)