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

$info shall indicate that the assertion failure carries no specific severity.

For simulation tools, these tasks shall also report the simulation run time at which the severity system task is called.

Each of these system tasks can also include additional user-specified information using the same format as the Verilog $display.

9.8 PLA modeling system tasks

Verilog AMS HDL does not extend the PLA modeling tasks defined in IEEE std 1364-2005 Verilog HDL.

9.9 Stochastic analysis system tasks

Verilog AMS HDL does not extend the stochastic analysis tasks defined in IEEE std 1364-2005 Verilog HDL.

9.10 Simulator time system functions

Verilog AMS HDL extends the simulator time functions defined in IEEE std 1364-2005 Verilog HDL as follows;

A new function is added called $abstime that can be used from the analog and digital contexts. $abstime returns the absolute time, that is a real value number representing time in seconds.

NOTE—In previous versions of the Verilog-AMS LRM, $realtime was supported in the analog context and it had an additional argument. This version of the LRM deprecates using $realtime in the analog context.

9.11 Conversion system functions

Verilog AMS HDL extends the conversion functions defined in IEEE std 1364-2005 Verilog HDL so that $bitstoreal and $realtobits can be used in the analog context.

9.12 Command line input

Verilog AMS HDL extends the command line input functions defined in IEEE std 1364-2005 Verilog HDL so that they can be used in the analog context.

9.13 Probabilistic distribution system functions

Verilog-AMS HDL extends the probabilistic distribution functions so that they are supported in the analog context. Also, real versions of the probabilistic distribution functions are introduced. Also, real versions of the probabilistic distribution functions are introduced as well as a special analog random system task called $arandom.

9.13.1 $random and $arandom

This subclause describes how the $random and $arandom system functions are supported in the analog context.

The syntax for these functions is shown in Syntax 9-8.

211

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

Accellera

 

Version 2.3.1, June 1, 2009

VERILOG-AMS

random_function ::=

$random [ ( random_seed ) ]

random seed ::= integer_variable_identifier

| reg_variable_identifier | time_variable_identifier

analog_random_function ::=

$arandom [ ( analog_random_seed [, type_string] ) ]

analog_random seed ::= integer_variable_identifier

| reg_variable_identifier | time_variable_identifier

| integer_parameter_identifier | decimal_number

type_string ::=

"global"

| "instance"

Syntax 9-8—Syntax for the random_function and analog random function

he system functions $random and $arandom provide a mechanism for generating random numbers. The random number returned is a 32-bit signed integer; it can be positive or negative. The two functions differ in the arguments they take. $arandom is upwardly compatible with $random $arandom can take the same arguments as $random and has the same behavior.

The random_seed argument may take one of several forms. It may be omitted, in which case the simulator picks a seed. It may be a reg, integer, or time variable, in which case it is an inout argument; that is, a value is passed to the function and a different value is returned. The variable should be initialized by the user prior to calling $random and only updated by the system function. The function returns a new 32-bit random number each time it is called.

The system function $random shall always return the same stream of values given the same initial random_seed. This facilitates debugging by making the operation of the system repeatable.

$arandom supports the seed argument analog_random_seed. The analog_random_seed argument can also be a parameter or a constant, in which case the system function does not update the parameter value. However an internal seed is created which is assigned the initial value of the parameter or constant and the internal seed gets updated every time the call to $arandom is made. This allows the $arandom system function to be used for parameter initialization. In order to get different random values when the analog_random_seed argument is a parameter, the user can override the parameter using a method in 6.3.

The type_string is an additional argument that $arandom supports beyond $random. The type_string provides support for Monte-Carlo analysis. If the type_string is "global" then one value is generated for each Monte-Carlo trial. If the type_string is "instance" then one value is generated for each instance that references this value, and a new set of values for these instances is generated for each Monte-Carlo trial.

Examples:

Copyright © 2009 Accellera Organization, Inc.

212

 

Accellera

Analog and Mixed-signal Extensions to Verilog HDL

Version 2.3.1, June 1, 2009

Where b > 0, the expression ($random % b) gives a number in the following range:

[(-b+1) : (b-1)].

The following code fragment shows an example of random number generation between -59 and 59:

integer rand;

rand = $random % 60;

9.13.2 distribution functions

The section describes how the distribution functions are supported in the analog context.

The syntax for these functions are shown in Syntax 9-9.

distribution_functions ::= $digital_dist_functions ( args )

| $rdist_uniform ( seed , start_expression , end_expression [, type_string] )

| $rdist_normal ( seed , mean_expression , standard_deviation_expression [, type_string] ) | $rdist_exponential ( seed , mean_expression [, type_string] )

| $rdist_poisson ( seed , mean_expression [, type_string] )

| $rdist_chi_square ( seed , degree_of_freedom_expression [, type_string] ) | $rdist_t ( seed , degree_of_freedom_expression [, type_string] )

| $rdist_erlang ( seed , k_stage_expression , mean_expression [, type_string] )

seed ::= integer_variable_identifier

| integer_parameter_identifier | decimal_number

type_string ::=

"global"

| "instance"

Syntax 9-9—Syntax for the probabilistic distribution functions

The following rules apply to these functions.

All arguments to the system functions are real values, except for seed (which is defined by $random). For the $rdist_exponential, $rdist_poisson, $rdist_chi_square, $rdist_t, and $rdist_erlang functions, the arguments mean, degree_of_freedom, and k_stage shall be greater than zero (0). Otherwise an error shall be reported.

Each of these functions returns a pseudo-random number whose characteristics are described by the function name, e.g., $rdist_uniform returns random numbers uniformly distributed in the interval specified by its arguments.

For each system function, the seed argument shall be an integer. If it is an integer variable, then it is an inout argument; that is, a value is passed to the function and a different value is returned. The variable is initialized by the user and only updated by the system function. This ensures the desired distribution is achieved upon successive calls to the system function. If the seed argument is a parameter or constant, then the system function does not update the parameter value. However an internal seed is created which is assigned the initial value of the parameter or constant and the internal seed gets updated every time the call to the system function is made. This allows the system function to be used for parameter initialization.

213

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

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