• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • Proof-automation
    • ACL2
    • Macro-libraries
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
        • Warnings
        • Primitives
        • Use-set
        • Syntax
        • Getting-started
        • Utilities
        • Loader
        • Transforms
          • Expression-sizing
          • Occform
          • Oprewrite
          • Expand-functions
            • Vl-expr-expand-function-calls
            • Vl-expand-function-call
            • Vl-module-expand-functions
            • Vl-modulelist-expand-functions
            • Vl-check-bad-funcalls
            • Vl-funtemplate
              • Vl-funtemplate-p
                • Vl-fun-vardecllist-to-vardecls
                • Vl-funinputlist-to-vardecls
                • Vl-fundecl-expansion-template
                • Vl-funinput-to-vardecl
                  • Vl-fundecllist-expansion-templates
                  • Vl-fun-vardecllist-types-okp
                  • Vl-portdecllist-types-okp
                  • Vl-fun-vardecl-to-vardecl
                  • Vl-find-funtemplate
                  • Vl-funtemplatelist
                • Vl-funtemplate-fix
                • Vl-funtemplate-equiv
                • Make-vl-funtemplate
                • Vl-funtemplate->locals
                • Vl-funtemplate->inputs
                • Vl-funtemplate->assigns
                • Change-vl-funtemplate
                • Vl-funtemplate->out
                • Vl-funtemplate->name
              • Vl-funbody-to-assignments
              • Vl-assignlist->rhses
              • Vl-fundecl-expand-params
              • Vl-fun-stmt-okp
              • Vl-fundecllist-expand-params
              • Vl-remove-fake-function-vardecls
              • Vl-design-expand-functions
            • Delayredux
            • Unparameterization
            • Caseelim
            • Split
            • Selresolve
            • Weirdint-elim
            • Vl-delta
            • Replicate-insts
            • Rangeresolve
            • Propagate
            • Clean-selects
            • Clean-params
            • Blankargs
            • Inline-mods
            • Expr-simp
            • Trunc
            • Always-top
            • Gatesplit
            • Gate-elim
            • Expression-optimization
            • Elim-supplies
            • Wildelim
            • Drop-blankports
            • Clean-warnings
            • Addinstnames
            • Custom-transform-hooks
            • Annotate
            • Latchcode
            • Elim-unused-vars
            • Problem-modules
          • Lint
          • Mlib
          • Server
          • Kit
          • Printer
          • Esim-vl
          • Well-formedness
        • Sv
        • Fgl
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Vl-funtemplate-p

    Vl-funinput-to-vardecl

    Convert a function's input declaration into a net declaration for its funtemplate.

    Signature
    (vl-funinput-to-vardecl x) → vardecl
    Arguments
    x — Guard (vl-portdecl-p x).
    Returns
    vardecl — Type (vl-vardecl-p 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 logic types for a and b, which is perfectly fine and sensible. But, when we are trying to cosimulate our simplified modules against the original modules, e.g., in the VL systest directory, then this can cause problems because plain Verilog-2005 simulators don't know about logic types.

    To avoid this, when we convert function inputs into wires, we'll just go ahead and ensure the net type is :vl-wire.

    Definitions and Theorems

    Function: vl-funinput-to-vardecl

    (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: vl-vardecl-p-of-vl-funinput-to-vardecl

    (defthm vl-vardecl-p-of-vl-funinput-to-vardecl
      (b* ((vardecl (vl-funinput-to-vardecl x)))
        (vl-vardecl-p vardecl))
      :rule-classes :rewrite)