Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
VAMS-LRM-2-3-1.pdf
Скачиваний:
43
Добавлен:
05.06.2015
Размер:
3.73 Mб
Скачать

 

Accellera

Analog and Mixed-signal Extensions to Verilog HDL

Version 2.3.1, June 1, 2009

9.20.3 Example control strings

 

Table 9-31—Example control strings

 

 

Control string

Description

 

 

""

Null string, default linear interpolation and extrapolation. Dimensional-

 

ity of the data is assumed to be N+M-1. Column N+M is taken as the

 

dependent.

 

 

"1L,1L"

Data is 2-D, linear interpolation and extrapolation in both dimensions.

"1LL,1LL"

Same as above, extrapolation method specified for both ends in each

 

dimension.

"1LL,1LL;1"

Same as above, dependent variable 1 is specified. This is the default

 

behavior when there are multiple dependent variables in the file and

 

there is no dependent variable selector specified in the control string

 

 

"D,3,3"

Discrete lookup in the outer dimension, linear interpolation on dimen-

 

sion two and cubic spline interpolation on the inner dimension.

"I,1CC,1CC;3"

Ignore column 1, linear interpolation and constant extrapolation in all

 

dimensions, interpolation applies to dependent variable 3. There are at

 

least 6 column in the data file.

 

 

"3,D,I,1;3"

Cubic spline interpolation in dimension 3, (column 1), closest lookup in

 

dimension 2 (column 2), ignore column 3, and use linear interpolation on

 

the innermost dimension (dimension 1, column 4). Interpolate dependent

 

variable 3 (column 7). This file has at least 7 columns.

 

 

9.20.4 Lookup algorithm

In lookup mode the function returns the closest point in the specified dimension. When the lookup ordinate is equidistant from two bracketing samples the function snaps away from zero.

9.20.5 Interpolation algorithms

The linear interpolation algorithm provides a simple linear interpolation between the closest sample points on a given isoline. Cubic spline interpolation1 generates a spline for each isoline being interpolated. The extrapolation option specified is taken into account when generating the spline coefficients so as to avoid end point discontinuities in the first order derivative of the interpolated function.

When formulating the cubic spline equations the desired derivative of the interpolation function at both end points must be specified in order to provide the complete set of constraints for the cubic spline equations. It is convenient then that the table model function specifies end point extrapolation behavior. If the user selects linear extrapolation this leads to a natural spline. If constant extrapolation is specified the end point derivative is set to zero thus avoiding a discontinuity in the first order derivative at that end point.

Quadratic splines are similar to cubic splines, offering more efficient evaluation with generally less favorable interpolation results. Again one should attempt to avoid end point discontinuities, though it is not always possible in this case.

As a general rule cubic splines are best applied to smoothly varying samples (such as the DC I-V characteristic of a diode) while linear interpolation is a better option for data with abrupt transitions (such as a transient pulsed waveform).

1Numerical Methods in Scientific Computing, Germund Dahlquist and Åke Björck.

231

Copyright © 2009 Accellera Organization, Inc. All rights reserved.

Accellera

 

Version 2.3.1, June 1, 2009

VERILOG-AMS

9.20.6 Example

A simple call to the $table_model function is illustrated using the two dimensional sample set given in the above plots and tables. Let’s first assume this data is stored in a file called sample.dat. The data is two dimensional with a single dependent variable. The independent variables were named x and y above. y is the outermost independent variable in the sample set while x is the innermost independent variable.

module example_tb(a, b); electrical a, b; inout a, b;

analog begin

I(a, b) <+ $table_model(0.0, V(a,b),"sample.dat"); end

endmodule

This instance specifies zero for x and uses a module potential to interpolate y. No control string is specified and so the function defaults to performing linear interpolation and linear extrapolation in both dimensions.

It is possible to specify how to perform the interpolation via the control string:

I(a, b) <+ $table_model(0.0, V(a,b),"sample.dat", "1LL,3LL");

Linear interpolation and extrapolation are specified in y and cubic interpolation with linear extrapolation in x.

The data source may also be specified as an array.

module example_tb(a, b); electrical a, b; inout a, b;

real y[0:11], x[0:11],f_xy[0:11]; analog begin

@(initial_step) begin

// y=0.0 isoline

y[0] =0.0; x[0] =1.0; f_xy[0] =0.5; y[1] =0.0; x[1] =2.0; f_xy[1] =1.0; y[2] =0.0; x[2] =3.0; f_xy[2] =1.5; y[3] =0.0; x[3] =4.0; f_xy[3] =2.0; y[4] =0.0; x[4] =5.0; f_xy[4] =2.5; y[5] =0.0; x[5] =6.0; f_xy[5] =3.0; // y=0.5 isoline

y[6] =0.5; x[6] =1.0; f_xy[6] =1.0; y[7] =0.5; x[7] =3.0; f_xy[7] =2.0; y[8] =0.5; x[8] =5.0; f_xy[8] =3.0; // y=1.0 isoline

y[9] =1.0; x[9] =1.0; f_xy[9] =1.5; y[10]=1.0; x[10]=2.0; f_xy[10]=2.0; y[11]=1.0; x[11]=4.0; f_xy[11]=3.0;

end

I(a, b) <+ $table_model(0, V(a,b), y, x, f_xy); end

endmodule

Here the array is specified via array variables. The variables are initialized inside an initial_step block ensuring that they do not change after the first call to $table_model. Arrays may also be specified directly via an array assignment pattern.

Copyright © 2009 Accellera Organization, Inc.

232

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]