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

Accellera

 

Version 2.3.1, June 1, 2009

VERILOG-AMS

// The following is illegal for P=32 initial

$displayb({32-P{1’b1}}, a[P-1:0]);

When a replication expression is evaluated, the operands shall be evaluated exactly once, even if the replication constant is zero. For example:

result = {4{func(w)}} ;

would be computed as:

y = func(w) ;

result = {y, y, y, y} ;

4.3 Built-in mathematical functions

Verilog-AMS HDL supports both the standard and transcendental mathematical functions. Both the IEEE std 1364-2005 Verilog HDL system function syntax style and the traditional Verilog-AMS HDL style are supported. Users are encouraged to adopt the IEEE std 1364-2005 Verilog HDL system function style when using the mathematical functions but the traditional Verilog-AMS HDL style will continue to be supported for backwards compatibility. The following tables Table 4-14 and Table 4-15 show both syntax styles as well as the equivalent C function.

4.3.1 Standard mathematical functions

The standard mathematical functions supported by Verilog-AMS HDL are shown in Table 4-14. The operands shall be numeric (integer or real). For min(), max(), and abs(), if either operand is real, both are converted to real, as is the result. All other arguments are converted to real.

Table 4-14—Standard functions

Verilog

Traditional

Equivalent C

Description

Domain

Verilog-AMS

function style

function

function style

 

 

 

 

 

 

 

 

 

 

 

$ln(x)

ln(x)

log(x)

Natural logarithm

x > 0

$log10(x)

log(x)

log10(x)

Decimal logarithm

x > 0

$exp(x)

exp(x)

exp(x)

Exponential

All x

$sqrt(x)

sqrt(x)

sqrt(x)

Square root

x >= 0

-

min(x, y)

-

Minimum

All x, all y

-

max(x, y)

-

Maximum

All x, all y

-

abs(x)

-

Absolute

All x

$pow(x,y)

pow(x, y)

pow(x,y)

Power (xy)

if x > 0, all y;

 

 

 

 

if x = 0, y > 0;

 

 

 

 

if x < 0, int(y)

$floor(x)

floor(x)

floor(x)

Floor

All x

$ceil(x)

ceil(x)

ceil(x)

Ceiling

All x

Copyright © 2009 Accellera Organization, Inc.

58

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