Добавил:
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

# End of example input file.

Although the user is encouraged to specify each noise pair in order of ascending frequency, the simulator shall internally sort the pairs into ascending frequency if required. Each frequency value must be unique. noise_table() performs piecewise linear interpolation to compute the power spectral density generated by the function at each frequency between the lowest and highest frequency in the set of values. For frequencies lower than the lowest frequency in the value set, noise_table() returns the power specified for the lowest frequency, and for frequencies higher than the highest frequency, noise_table() returns the power specified for the highest frequency.

The optional name argument acts as a label for the noise source used when the simulator outputs the individual contribution of each noise source to the total output noise. The contributions of noise sources with the same name from the same instance of a module are combined in the noise contribution summary.

4.6.4.4 Noise model for diode

The noise of a junction diode could be modelled as shown in the following example.

I(a,c) <+ is*(exp(V(a,c) / (n * $vt)) - 1)

+white_noise(2*‘P_Q*I(<a>))

+flicker_noise(kf*pow(abs(I(<a>)), af), ef);

4.6.4.5Correlated noise

Each noise function generates noise which is uncorrelated with the noise generated by other functions. Perfectly correlated noise is generated by using the output of one noise function for more than one noise source. Partially correlated noise is generated by combining the output of shared and unshared noise functions.

Example 1 — Two noise voltages are perfectly correlated.

n = white_noise(pwr); V(a,b) <+ c1*n; V(c,d) <+ c2*n;

Example 2 - Partially correlated noise sources can also be modelled.

n1 = white_noise(1-corr);

n2 = white_noise(1-corr);

n12 = white_noise(corr); V(a,b) <+ Kv*(n1 + n12); I(b,c) <+ Ki*(n2 + n12);

4.7 User defined functions

A user defined function can be used to return a value (for an expression). All functions are defined within modules. Each function can be an analog user defined function or a digital function (as defined in IEEE std 1364-2005 Verilog HDL).

4.7.1 Defining an analog user defined function

The syntax for defining an analog user defined function is shown in Syntax 4-4.

analog_function_declaration ::=

// from A.2.6

analog function [ analog_function_type ] analog_function_identifier ;

 

83

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

Accellera

 

Version 2.3.1, June 1, 2009

VERILOG-AMS

analog_function_item_declaration { analog_function_item_declaration } analog_function_statement

endfunction

 

analog_function_type ::= integer | real

 

analog_function_item_declaration ::=

 

analog_block_item_declaration

 

| input_declaration ;

 

| output_declaration ;

 

| inout_declaration ;

// from A.2.8

analog_block_item_declaration ::=

{ attribute_instance } parameter_declaration ;

 

| { attribute_instance } integer_declaration

 

| { attribute_instance } real_declaration

 

Syntax 4-4—Syntax for an analog user defined function declaration

An analog user defined function declaration shall begin with the keywords analog function, optionally followed by the type of the return value from the function, then the name of the function and a semicolon, and ending with the keyword endfunction.

The analog_function_type specifies the return value of the function; its use is optional. type can be a real or an integer; if unspecified, the default is real.

An analog user defined function:

can use any statements available for conditional execution (see 5.2);

shall not use access functions;

shall not use analog filter functions;

shall not use contribution statements or event control statements;

shall have at least one input declared; the block item declaration shall declare the type of the inputs (whether they are input, output, inout) as well as local variables used in the function;

shall not use named blocks;

shall only reference locally-defined variables, variables passed as arguments, locally-defined parameters and module level parameters; and

If a locally-defined parameter with the specified name does not exist, then the module level parameter of the specified name will be used.

Example 1 — Determine max value:

This example defines an analog user defined function called maxValue, which returns the potential of whichever signal is larger.

analog function real maxValue; input n1, n2;

real n1, n2; begin

// code to compare potential of two signal maxValue = (n1 > n2) ? n1 : n2;

end endfunction

Example 2 — Area and perimeter of a rectangle

Copyright © 2009 Accellera Organization, Inc.

84

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