D_200_OutputVars.tex M_108_OutputVars.tex Q_234_OutputVars.tex
M_102_OutputVars.tex M_110_OutputVars.tex Q_504_OutputVars.tex
M_1031_OutputVars.tex M_2002_OutputVars.tex Q_505_OutputVars.tex
M_103_OutputVars.tex M_77_OutputVars.tex
M_107_OutputVars.tex Q_230_OutputVars.tex
For those wishing to use output variables in their own models, or modified version of standard models, this can be achieved by attaching the standard Verilog-A attributes to a global variable definition; this is a common approach used across many simulators.
(*desc = OPdesc, units = OPunit*) real OPvarname;
N_DEV_ADMS<module>.C: In member function 'virtual bool Xyce::Device::ADMS<module>::Instance::updatePrimaryState()':N_DEV_ADMS<module>.C:<row>:<column>: error: '<variable>' was not declared in this scope<row> | stoVec[li_store_<variable>] = <variable>;| ^~~~~
real var_; // local variablereal var (* desc = "output variable" *);analog begin@(initial_model) beginvar_ = 1.0;endvar = var_;
3.2.1 Output variables
The standard attributes for descriptions and units, described in , have a special meaning for variables
declared at module scope. Module scope variables with a description or units attribute, or both, shall be
known as output variables, and Verilog-AMS simulators shall provide access to their values. SPICE-like
simulators print the names, values, units, and descriptions of output variables for SPICE primitives along
with voltages and currents when displaying operating-point information, and these variables are available
for plotting as a function of time (or the swept variable of a dc sweep).
For example, a module for a MOS transistor with the following declaration at module scope provides the
output variable cgs .
(* desc="gate-source capacitance", units="F" *)
real cgs;
Units and descriptions specified for block-level variables shall be ignored by the simulator, but can be usedI had not considered the possibility that anyone might try to tag model scoped variables this way (that is, variables that are used both inside an @(initial_model) block and the main module block), and it is unfortunate that Xyce/ADMS doesn't refuse to do it, leaving it until the compilation step to fail. I'll have to see what I can do about that. The issue is that the templates that emit the code for storing the variable into the "store" vector assume that the variable they're storing are members of the instance class, and all the templates that handle output variables are trying to make sure that is true. Somehow these model-scoped variables are confusing that process, and not being caught early enough. I'll have to look into that.
for documentation purposes.
real var_; // any scope at allreal VAR (* desc = "output variable" *); // never used in @(initial_<anything>)analog begin
VAR = var_;
stoVec[li_store_<variable>] = model_.<variable>;