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

Accellera

 

Version 2.3.1, June 1, 2009

VERILOG-AMS

electrical clk_out;

twoclk topclk1(.vout_q1(clk_out)); endmodule

9.20 Table based interpolation and lookup system function

Verilog-AMS HDL provides a multidimensional interpolation and lookup function called $table_model. The function is designed to operate specifically on multidimensional data in a form that is commonly generated via parametric sweeping schemes available in most analog simulators. This type of data is generated when simulating a system while varying (sweeping) a parameter across some range. Data dimensionality increases when parameter sweeps are nested. While the samples are those of a multidimensional function, sample generation via parametric sweeping leads to a simple recursive interpolation and extrapolation process defined by the $table_model function.

A typical example will help to explain the process. A user may wish to create a data based model of some function f(x,y) over some range of x and y and use that data as the basis of a behavioral model described in Verilog-AMS.

4

3

f(x,y)

2

y=1.0

1

 

y=0.5

 

 

 

 

 

 

 

 

 

 

 

 

 

y=0.0

 

 

 

 

 

2

4

6

x

Figure 9-1: Samples on isolines

We can say that f(x,y) is sampled on a set of isolines. An isoline for each value of y is generated when y is held constant and x is varied across a desired range. Each isoline may exist over a different range of x values and the number and spacing of samples may be different on each isoline.

When describing the sampled set, x and y are called independent variables and f(x,y) is called the dependent variable. The sampling scheme also introduces the concept of an innermost and outermost dimension. In this example, x is the fastest changing or innermost dimension associated with the sampled function f(x,y) and y is the slowest changing or outermost dimension.

Understanding that the underlying multidimensional function is sampled on a set of isolines, we can now describe a simple recursive process to interpolate, extrapolate, or perform lookup on this sampled function.

Copyright © 2009 Accellera Organization, Inc.

226

 

Accellera

Analog and Mixed-signal Extensions to Verilog HDL

Version 2.3.1, June 1, 2009

4

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

yh

 

 

 

yl

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

f(x,y)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2.75

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

y1=0.25

 

 

2

 

 

y=1.0

 

 

 

 

 

 

 

 

 

 

 

 

 

f(x1,y)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

f(x1,y1)=2.0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1

 

 

y=0.5

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1.75

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0.0

 

 

 

 

 

 

1.0

 

 

 

y=0.0

 

 

 

 

 

 

 

 

 

x1=3.5

 

 

 

 

 

 

 

 

 

 

 

y

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2

 

x

 

4

6

 

 

 

 

 

 

y

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Figure 9-2: Interpolation on isolines

Using the above example let us assume the user requests a value for the lookup pair (x1,y1). We first look through the set of isolines in y and find the pair that bracket y1. Now for each isoline in y we find the two points that bracket x1 and interpolate each isoline to find f(x1,yh) and f(x1,yl). Having thus generated an isoline in y for the point x1 in x, we may interpolate this isoline to find the value f(x1,y1). If the lookup point falls off the end of any given isoline then we extrapolate its value on that isoline.

As a consequence of this algorithm, the interpolation and extrapolation schemes always operate in a single dimension analogous to how the data was originally generated, so the interpolation and extrapolation schemes used may be specified on a per dimension basis.

The $table_model function defines a format to represent the isolines of multidimensional data and a set of interpolation schemes that we need only define for single dimensional data. The data may be stored in a file or as a sequence of one-dimension arrays or a single two-dimensional array.

The interpolation schemes are lookup, linear, quadratic splines, and cubic splines. Extrapolation may be specified as being constant, linear, or error (meaning if extrapolation occurs the system should error out).

The lookup variables, (x1, y1) in the example above (table_inputs in Syntax 10-5) may be any legal expression that can be assigned to an analog signal.

The syntax for the $table_model function is shown in Syntax 9-15.

table_model_function ::=

$table_model ( table_inputs , table_data_source , table_control_string )

table_inputs ::=

expression [, 2nd_dim_expression [, nth_dim_expression]]

table_data_source ::=

file_name | table_model_array

file_name ::=

string_literal | string_parameter table_model_array ::=

227

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

Accellera

 

Version 2.3.1, June 1, 2009

VERILOG-AMS

1st_dim_array_identifier [, 2nd_dim_array_identifier [, nth_dim_array_identifier]], output_array_identifier

table_control_string::= "[interp_control[;dependent_selector]]"

interp_control::=

"[1st_dim_table_ctrl_substr] [, 2nd_dim_table_ctrl_substr [, nth_dim_table_ctrl_substr]]]" dependent_selector::=

integer

table_ctrl_substr ::=

[table_interp_char[table_extrap_char [higher_table_extrap_char]]]

table_interp_char ::=

I | D | 1 | 2 | 3

table_extrap_char ::=

C | L | E

Syntax 9-15—Syntax for table model function

9.20.1 Table data source

table_data_source specifies the data source, samples of a multidimensional function arranged on isolines. The data is specified as columns in a text file or as a set of arrays (hence the name table model). In either case the layout is conceptually the same.

A table of M dependent variables of dimension N are laid out in N+M columns in the file, with the independent variables appearing in the first N columns followed by the dependent variables in the remaining M columns. The independent variables are ordered from the outermost (slowest changing) variable to the innermost (fastest changing) variable. Though an isoline ordinate does not change for a given isoline, in this scheme the ordinate is repeated for each point of that isoline (thus keeping the input data as a set of data rows all with the same number of points). The result is a sequential listing of each isoline with the total number of points in the listing being equal to the total number of samples on all isolines.

Again, the above example described via samples will help illustrate the layout. The function being described is

f(x,y)=0.5x + y

f(x,y) is the only dependent variable we consider in this case, and there are three isolines for values of y 0.0, 0.5 and 1.0; x is sampled at various points on each of the three isolines.

# 2-D table model sample example

#

y

x

f(x,y)

#

#y=0 isoline

 

0.01.0 0.5

0.02.0 1.0

0.03.0 1.5

0.04.0 2.0

0.05.0 2.5

0.0 6.0 3.0 #y=0.5 isoline

0.51.0 1.0

0.53.0 2.0

0.5 5.0 3.0 #y=1.0 isoline

Copyright © 2009 Accellera Organization, Inc.

228

 

Accellera

Analog and Mixed-signal Extensions to Verilog HDL

Version 2.3.1, June 1, 2009

1.01.0 1.5

1.02.0 2.0

1.04.0 3.0

As can be seen here, the slowly changing outer independent variable appears to the left while the rapidly changing inner independent variable appears to the right; isoline ordinates are repeated for each sample on a given isoline.

Each sample point is separated by a newline and each column is separated by one or more spaces or tabs. Comments begin with ‘#’ and continue to the end of that line. They may appear anywhere in the file. Blank lines are ignored. The numbers shall be real or integer (real_number or decimal_number as defined in A.8.3).

When the data source is a sequence of 1-D arrays the isolines are laid out in conceptually the same way with each array being just as a column in the file format described above. Arrays may be specified directly via the concatenation operator or via array variable names.

The state of the data source is captured on the first call to the table model function. Any change after this point is ignored.

While it is suggested that the user arrange the sampled isolines in sorted order (one isoline following another in all dimensions); if the user provides the data in random order the system will sort the data into isolines in each dimension. Whether the data is sorted or not, the system determines the isoline ordinate by reading its exact value from the file or array. Any noise on the isoline ordinate may cause the system to incorrectly generate multiple isolines where the user intended a single isoline.

The input example above illustrated the isoline format for a single two-dimensional function (or dependent variable). The file may contain multiple dependent variables, all sharing the same set of isoline samples. A column in the data source may also be marked as ignore. These and all interpolation control settings are provided via the interpolation control string.

9.20.2 Control string

The control string is used to specify how the $table_model function should interpolate or lookup the data in each dimension and how it should extrapolate at the boundaries of each dimension. It also provides for some control on how to treat columns of the input data source. The string consists of a set of comma separated sub-strings followed by a semicolon and the dependent selector. The first group of sub-strings provide control over each independent variable with the first sub-string applying to the outermost dimension and so on. The dependent variable selector is a column number allowing us to specify which dependent variable in the data source we wish to interpolate. This number runs 1 though M with M being the total number of dependent variables specified in the data source.

Each sub-string associated with interpolation control has at most 3 characters. The first character controls interpolation and obeys Table 9-29.

 

Table 9-29—Interpolation control character

 

 

Control

Description

character

 

 

 

I

Ignore this input column

D

Closest point lookup

229

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

Accellera

 

Version 2.3.1, June 1, 2009

VERILOG-AMS

Table 9-29—Interpolation control character (continued)

Control

Description

character

 

1Linear interpolation

2Quadratic spline interpolation

3Cubic spline interpolation

The remaining character(s) in the sub-string specify the extrapolation behavior.

 

Table 9-30—Extrapolation control character

 

 

Control

Description

character

 

 

 

C

Constant extrapolation

L

Linear extrapolation

E

Error on an extrapolation request

The constant extrapolation method returns the table endpoint value. Linear extrapolation extends linearly to the requested point from the endpoint using a slope consistent with the selected interpolation method. The user may also disable extrapolation by choosing the error extrapolation method. With this method, an extrapolation error is reported if the $table_model function is requested to evaluate a point beyond the interpolation region.

For each dimension, users may use up to 2 extrapolation method characters to specify the extrapolation method used for each end. When no extrapolation method character is given, the linear extrapolation method will be used for both ends as default. When one extrapolation method character is given, the specified extrapolation method will be used for both ends. When two extrapolation method characters are given, the first character specifies the extrapolation method used for the end with the lower coordinate value, and the second character is used for the end with the higher coordinate value.

Copyright © 2009 Accellera Organization, Inc.

230

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