next up previous contents index
Next: The WRspice Daemon and Up: System Tasks Previous: Other System Functions Recognized   Contents   Index

WRspice C/C++ Bridge Function

cfunc(funcname, arg1, ..., argN)
The cfunc pseudo-function allows arbitrary C/C++ function calls to be made from the model code.

The return value can be used in an assignment. In the C++ files, the construct maps to funcname(arg1, ..., argN).

This can be used to, for example, make available special math functions callable from Verilog-A. Be advised that this can be unsafe to use in model code, as the derivative is not included in the Jacobian, which can lead to convergence problems. However, if such functions are used only for initialization, use is safe.

To use this facility, the HEADER variable in the Makefile should be redefined to yes, and the user should create an include file that contains (perhaps through another include) prototypes of the functions called using cfunc. This file must be named MODULEextra.h, where MODULE is the short name also provided from the Makefile.

The header file must also be modified to link the library containing the function implementations to the loadable module. The user is expected to know how to do this.


next up previous contents index
Next: The WRspice Daemon and Up: System Tasks Previous: Other System Functions Recognized   Contents   Index
Stephen R. Whiteley 2022-09-18