Rename $log to $log10.

Verilog-2005 defines the base-10 log function to be $log10. This makes
sense because in C the log() function is the natural log. So add the
$log10 function.

Since there may be legacy code that uses the $log function, leave it
defined, but we should consider at least printing a warning when the
$log function is used.
This commit is contained in:
Stephen Williams 2008-05-03 18:29:52 -07:00
parent c993fb8325
commit bbc80a84a6
3 changed files with 8 additions and 2 deletions

View File

@ -1206,7 +1206,7 @@ expr_primary
}
| K_log '(' expression ')'
{ perm_string tn = perm_string::literal("$log");
{ perm_string tn = perm_string::literal("$log10");
PECallFunction*tmp = make_call_function(tn, $3);
FILE_NAME(tmp,@1);
$$ = tmp;

View File

@ -68,7 +68,12 @@ typedef struct s_single_data {
static t_single_data va_single_data[]= {
{"$sqrt", sqrt},
{"$ln", log},
{"$log", log10},
{"$log", log10}, /* FIXME: The $log function is replaced by the
$log10 function to eliminate confusion with
the natural log. In C, "log" is ln and log10
is log-base-10. The $log is being left in for
compatibility. */
{"$log10", log10},
{"$exp", exp},
{"$abs", fabs},
{"$ceil", ceil},

View File

@ -7,6 +7,7 @@
$sqrt vpiSysFuncReal
$ln vpiSysFuncReal
$log vpiSysFuncReal
$log10 vpiSysFuncReal
$exp vpiSysFuncReal
$abs vpiSysFuncReal
$ceil vpiSysFuncReal