Remove obsolete VAMS $log function.
This patch remove the old VAMS $log function. It could create confusion with the Verilog $log task. Recent versions of VAMS and 1364-2005 use $log10 for the base 10 logarithm.
This commit is contained in:
parent
e6945db9b4
commit
2eb01605b1
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000-2009 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2000-2010 Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* and/or modify it in source code form under the terms of the GNU
|
||||||
|
|
@ -414,9 +414,9 @@ NetExpr* PECallFunction::elaborate_pexpr(Design*des, NetScope*scope) const
|
||||||
return rtn;
|
return rtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* These are only available with verilog-ams or icarus-misc. */
|
/* This is only available with verilog-ams or icarus-misc. */
|
||||||
if ((gn_icarus_misc_flag || gn_verilog_ams_flag) &&
|
if ((gn_icarus_misc_flag || gn_verilog_ams_flag) &&
|
||||||
(nm == "$log" || nm == "$abs")) {
|
(nm == "$abs")) {
|
||||||
if (parms_.size() != 1 || parms_[0] == 0) {
|
if (parms_.size() != 1 || parms_[0] == 0) {
|
||||||
cerr << get_fileline() << ": error: " << nm
|
cerr << get_fileline() << ": error: " << nm
|
||||||
<< " takes a single argument." << endl;
|
<< " takes a single argument." << endl;
|
||||||
|
|
@ -426,15 +426,11 @@ NetExpr* PECallFunction::elaborate_pexpr(Design*des, NetScope*scope) const
|
||||||
NetExpr*arg = parms_[0]->elaborate_pexpr(des, scope);
|
NetExpr*arg = parms_[0]->elaborate_pexpr(des, scope);
|
||||||
if (arg == 0) return 0;
|
if (arg == 0) return 0;
|
||||||
NetESFunc*rtn;
|
NetESFunc*rtn;
|
||||||
if (nm == "$log") {
|
/* This can return either a real or an arbitrary
|
||||||
rtn = new NetESFunc(nm, IVL_VT_REAL, 1, 1);
|
* width vector, so set things to fail if this
|
||||||
} else {
|
* does not get replaced with a constant during
|
||||||
/* This can return either a real or an arbitrary
|
* elaboration. */
|
||||||
* width vector, so set things to fail if this
|
rtn = new NetESFunc(nm, IVL_VT_NO_TYPE, 0, 1);
|
||||||
* does not get replaced with a constant during
|
|
||||||
* elaboration. */
|
|
||||||
rtn = new NetESFunc(nm, IVL_VT_NO_TYPE, 0, 1);
|
|
||||||
}
|
|
||||||
rtn->set_line(*this);
|
rtn->set_line(*this);
|
||||||
rtn->cast_signed(true);
|
rtn->cast_signed(true);
|
||||||
rtn->parm(0, arg);
|
rtn->parm(0, arg);
|
||||||
|
|
@ -451,7 +447,7 @@ NetExpr* PECallFunction::elaborate_pexpr(Design*des, NetScope*scope) const
|
||||||
NetExpr*arg0 = parms_[0]->elaborate_pexpr(des, scope);
|
NetExpr*arg0 = parms_[0]->elaborate_pexpr(des, scope);
|
||||||
NetExpr*arg1 = parms_[1]->elaborate_pexpr(des, scope);
|
NetExpr*arg1 = parms_[1]->elaborate_pexpr(des, scope);
|
||||||
if (arg0 == 0 || arg1 == 0) return 0;
|
if (arg0 == 0 || arg1 == 0) return 0;
|
||||||
/* See $log above for why this has no type or width. */
|
/* See $abs above for why this has no type or width. */
|
||||||
NetESFunc*rtn = new NetESFunc(nm, IVL_VT_NO_TYPE, 0, 2);
|
NetESFunc*rtn = new NetESFunc(nm, IVL_VT_NO_TYPE, 0, 2);
|
||||||
rtn->set_line(*this);
|
rtn->set_line(*this);
|
||||||
rtn->cast_signed(true);
|
rtn->cast_signed(true);
|
||||||
|
|
|
||||||
12
eval_tree.cc
12
eval_tree.cc
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999-2009 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 1999-2010 Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* and/or modify it in source code form under the terms of the GNU
|
||||||
|
|
@ -1742,8 +1742,6 @@ NetExpr* evaluate_math_one_arg(NetExpr*&arg_, const char*name)
|
||||||
|
|
||||||
if (strcmp(name, "$ln") == 0) {
|
if (strcmp(name, "$ln") == 0) {
|
||||||
return new NetECReal(verireal(log(arg)));
|
return new NetECReal(verireal(log(arg)));
|
||||||
} else if (strcmp(name, "$log") == 0) {
|
|
||||||
return new NetECReal(verireal(log10(arg)));
|
|
||||||
} else if (strcmp(name, "$log10") == 0) {
|
} else if (strcmp(name, "$log10") == 0) {
|
||||||
return new NetECReal(verireal(log10(arg)));
|
return new NetECReal(verireal(log10(arg)));
|
||||||
} else if (strcmp(name, "$exp") == 0) {
|
} else if (strcmp(name, "$exp") == 0) {
|
||||||
|
|
@ -1941,18 +1939,14 @@ NetExpr* NetESFunc::eval_tree(int prune_to_width)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((gn_icarus_misc_flag || gn_verilog_ams_flag) &&
|
if ((gn_icarus_misc_flag || gn_verilog_ams_flag) &&
|
||||||
(strcmp(nm, "$log") == 0 || strcmp(nm, "$abs") == 0)) {
|
(strcmp(nm, "$abs") == 0)) {
|
||||||
if (nparms() != 1 || parm(0) == 0) {
|
if (nparms() != 1 || parm(0) == 0) {
|
||||||
cerr << get_fileline() << ": error: " << nm
|
cerr << get_fileline() << ": error: " << nm
|
||||||
<< " takes a single argument." << endl;
|
<< " takes a single argument." << endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
NetExpr*arg = parm(0)->dup_expr();
|
NetExpr*arg = parm(0)->dup_expr();
|
||||||
if (strcmp(nm, "$log") == 0) {
|
rtn = evaluate_abs(arg);
|
||||||
rtn = evaluate_math_one_arg(arg, nm);
|
|
||||||
} else {
|
|
||||||
rtn = evaluate_abs(arg);
|
|
||||||
}
|
|
||||||
delete arg;
|
delete arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ License.
|
||||||
Verilog-A math library built for Icarus Verilog
|
Verilog-A math library built for Icarus Verilog
|
||||||
http://www.icarus.com/eda/verilog/
|
http://www.icarus.com/eda/verilog/
|
||||||
|
|
||||||
Copyright (C) 2007-2009 Cary R. (cygcary@yahoo.com)
|
Copyright (C) 2007-2010 Cary R. (cygcary@yahoo.com)
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -38,7 +38,7 @@ like all Verilog-D system functions the name must be prefixed with a '$'.
|
||||||
For reference the functions are:
|
For reference the functions are:
|
||||||
|
|
||||||
$ln(x) -- Natural logarithm
|
$ln(x) -- Natural logarithm
|
||||||
$log10(x) -- Decimal logarithm // $log is being deprecated!
|
$log10(x) -- Decimal logarithm
|
||||||
$exp(x) -- Exponential
|
$exp(x) -- Exponential
|
||||||
$sqrt(x) -- Square root
|
$sqrt(x) -- Square root
|
||||||
$min(x,y) -- Minimum
|
$min(x,y) -- Minimum
|
||||||
|
|
|
||||||
|
|
@ -70,11 +70,6 @@ typedef struct s_single_data {
|
||||||
} t_single_data;
|
} t_single_data;
|
||||||
|
|
||||||
static t_single_data va_single_data[]= {
|
static t_single_data va_single_data[]= {
|
||||||
{"$log", log10}, /* NOTE: 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. */
|
|
||||||
{"$abs", fabs},
|
{"$abs", fabs},
|
||||||
{0, 0} /* Must be NULL terminated! */
|
{0, 0} /* Must be NULL terminated! */
|
||||||
};
|
};
|
||||||
|
|
@ -239,12 +234,6 @@ static PLI_INT32 va_single_argument_compiletf(PLI_BYTE8 *ud)
|
||||||
single_funcs_count*sizeof(va_single_t **));
|
single_funcs_count*sizeof(va_single_t **));
|
||||||
single_funcs[single_funcs_count-1] = fun_data;
|
single_funcs[single_funcs_count-1] = fun_data;
|
||||||
|
|
||||||
if (strcmp(name, "$log") == 0) {
|
|
||||||
vpi_printf("%s:%d: deprecation: ", vpi_get_str(vpiFile, callh),
|
|
||||||
(int)vpi_get(vpiLineNo, callh));
|
|
||||||
vpi_printf("Please use $log10() instead of $log()!\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* vpi_scan() returning 0 (NULL) has already freed argv. */
|
/* vpi_scan() returning 0 (NULL) has already freed argv. */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
# Single argument functions.
|
# Single argument functions.
|
||||||
$log vpiSysFuncReal
|
|
||||||
$abs vpiSysFuncReal
|
$abs vpiSysFuncReal
|
||||||
# Double argument functions.
|
# Double argument functions.
|
||||||
$min vpiSysFuncReal
|
$min vpiSysFuncReal
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue