Function parsing inconsistency?

23 views
Skip to first unread message

Jesus Perez

unread,
Sep 3, 2019, 9:38:29 AM9/3/19
to xyce-users
Hello,

I'd like to report what seems like inconsistent behavior in Xyce.

When defining a function using a .FUNC statement it seems to take a function name that starts with a number. However, when calling the function from an expression it will return a "bad number format" error (or something of the sort) if the function name begins with a number.

Regards,
Jesús

xyce-users

unread,
Sep 3, 2019, 10:37:31 AM9/3/19
to xyce-users
Jesús,

Thanks for mentioning this to us.  This same issue also exists in other simulators, like HSPICE.  In HSPICE, if you try to define:

  .PARAM 2func(x)='1+x'

then you get this error message:

  syntax error: parameter name begins with a number, requires an alphabetic character at beginning, error occurs at or before 2func

The issue is allowing a parser to "guess" if an expression really meant to call 2func(x) or actually meant to call something like 2+func(x).  The Xyce error message, as shown below with an example netlist, is admittedly less clear than other simulators.  At the least, we may want to improve the .PARAM and .FUNC sections of the Xyce Reference Guide to be more clear about what legal Function and Parameter names are in Xyce.
 
  Illegal format for number (2FUNC) in expression: 2func(P1)
 
For other readers this issue occurs with this example Xyce netlist. This netlist works fine if 2func is re-named to afunc.

* Xyce netlist to test function names that start with a number
.FUNC 2func(x) {1+x}
.PARAM P1=1
V1 1 0 1
R1 1 2 {2func(P1)}
R2 2 0 1
.DC V1 1 5 1
.PRINT DC V(1) V(2)
.END

--The Xyce Team
Reply all
Reply to author
Forward
0 new messages