Bug in Xyce/ADMS code generation when $limit arguments have expressions with function calls

59 views
Skip to first unread message

Thomas Russo

unread,
Nov 30, 2023, 1:03:34 PM11/30/23
to xyce-users
A Xyce user emailed me privately about a problem they were having with Xyce/ADMS, where "buildxyceplugin" was bombing because the generated code used variables that were never declared.

I tracked it down to an error in how Xyce/ADMS identifies assignments that include $limit --- it is assuming that $limit is the ONLY function call on the RHS, which is not true if any of the arguments of $limit include function calls.  Further, the code generation for the limiter assignments was improperly emitting code that assumed precomputation of function calls had happened, but without actually doing that precomputation.

The attached patch to xyceBasicTemplates_nosac.xml fixes the issue, and does not break any existing code in Xyce (I tested this by regenerating all the Verilog-A models and comparing the results to what is in the DeviceModelPKG directory, showing no differences except in the generation date, with the exception of the BSIMCMGs (which differ because a manual patch was applied to the DeviceModelPKG code and not reinserted by the autogeneration process as of the last public git push).

As always, this code is released to the Xyce team with no licensing restrictions, so they can add it to the official code base without concerns of license problems.


0001-Fix-error-in-limiter-detection.patch

Dietmar Warning

unread,
Nov 30, 2023, 3:24:04 PM11/30/23
to xyce-users
I can confirm: Applying the patch I am able to build hicum2 shared lib with $limit() functions like this:

    Vbiei = $limit(V(br_biei),"typedpnjlim_new",VT,VT*ln(VT/(`M_SQRT2*ibeis)),type);
    Vbici = $limit(V(br_bici),"typedpnjlim_new",VT,VT*ln(VT/(`M_SQRT2*ibcis)),type);

Thanks Thomas.

xyce-users

unread,
Nov 30, 2023, 6:46:21 PM11/30/23
to xyce-users
Thanks Tom!  we will apply your patch.

Eric

Tom Russo

unread,
Nov 30, 2023, 7:02:58 PM11/30/23
to xyce-users
FWIW, I believe you can just use "git am" on my patch file (which was created with "git format-patch") to import it directly into git on the development branch of your internal repo.  I do not believe that the fact that it was based on a different tree will interfere with doing that, especially since it's such a simple patch.


--
You received this message because you are subscribed to the Google Groups "xyce-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xyce-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xyce-users/5d79ae4f-6f45-4b8a-9224-80e0363bf7a0n%40googlegroups.com.


--
Tom Russo    KM5VY 
Tijeras, NM 

 echo "prpv_a'rfg_cnf_har_cvcr" | sed -e 's/_/ /g' | tr [a-m][n-z] [n-z][a-m]

xyce-users

unread,
Dec 4, 2023, 1:39:28 PM12/4/23
to xyce-users
Tom, I applied this patch using your suggested "git am" today.  It appeared to work fine without any issues.

thanks,
Eric
Reply all
Reply to author
Forward
0 new messages