translating Hspice libraries with XDM

187 views
Skip to first unread message

basma alm

unread,
May 9, 2021, 8:27:20 AM5/9/21
to xyce-users
Hello

I'm Trying to translate the attached .lib and .sp using XDM
However, im getting the below error


~/Downloads/try2$ xdm_bdl -s hspice -d out -o xyce --auto cnfet_sample.sp


xdm_bdl 2.2.0 (last changed on 2020-10-07 23:58:08) at
    xdm_bdl

is translating the file:

    'cnfet_sample.sp' (input format=hspice)
        using xml definition /tmp/_MEIU4JXzP/hspice.xml
     => and is creating the translated files under the directory 'out' (output format = xyce)
        using xml definition /tmp/_MEIU4JXzP/xyce.xml

Original calling command for this run was:

        xdm_bdl -s hspice -d out -o xyce --auto cnfet_sample.sp


    05/09/2021 03:22:49 PM WARNING:  In file:"cnfet_sample.sp" at line:[40]. * .TITLE 'IDS vs VGS for CNFET'; HSpice Parser Retained (as a comment). Continuing.
    05/09/2021 03:22:49 PM WARNING:  In file:"cnfet_sample.sp" at line:[46]. * .options POST; HSpice Parser Retained (as a comment). Continuing.
    05/09/2021 03:22:49 PM WARNING:  In file:"cnfet_sample.sp" at line:[47]. * .options AUTOSTOP; HSpice Parser Retained (as a comment). Continuing.
    05/09/2021 03:22:49 PM WARNING:  In file:"cnfet_sample.sp" at line:[48]. * .options INGOLD=2     DCON=1; HSpice Parser Retained (as a comment). Continuing.
    05/09/2021 03:22:49 PM WARNING:  In file:"cnfet_sample.sp" at line:[49]. * .options GSHUNT=1e-12 RMIN=1e-15; HSpice Parser Retained (as a comment). Continuing.
    05/09/2021 03:22:49 PM WARNING:  In file:"cnfet_sample.sp" at line:[50]. * .options ABSTOL=1e-5  ABSVDC=1e-4; HSpice Parser Retained (as a comment). Continuing.
    05/09/2021 03:22:49 PM WARNING:  In file:"cnfet_sample.sp" at line:[51]. * .options RELTOL=1e-2  RELVDC=1e-2; HSpice Parser Retained (as a comment). Continuing.
    05/09/2021 03:22:49 PM WARNING:  In file:"cnfet_sample.sp" at line:[52]. * .options NUMDGT=4     PIVOT=13; HSpice Parser Retained (as a comment). Continuing.
    05/09/2021 03:22:49 PM WARNING:  In file:"cnfet_sample.sp" at line:[61]. * .model 'CNFET.lib'; HSpice Parser Retained (as a comment). Continuing.
Traceback (most recent call last):
  File "xdm_bdl.py", line 292, in <module>
  File "xdm/inout/readers/GenericReader.py", line 118, in read
  File "xdm/inout/readers/GenericReader.py", line 477, in read_line
  File "xdm/inout/readers/XDMFactory.py", line 952, in build_directive
  File "xdm/inout/readers/XDMFactory.py", line 478, in handle_sweep
IndexError: pop from an empty deque
[207018] Failed to execute script xdm_bdl

basma alm

unread,
May 9, 2021, 8:34:14 AM5/9/21
to xyce-users
these are the mentioned attachment

xyce-users

unread,
May 10, 2021, 11:05:02 PM5/10/21
to xyce-users
Thank you for reporting this. There are a couple things in the netlist and lib files that you can try to fix. But this seemed to reveal a condition that XDM isn't checking for, so we can investigate that for future releases.

*  The .TITTLE statement should be on the first line of the netlilst file, but that's not causing the error
*  In cnfet_sample.sp line 23 should read ".lib 'CNFET.lib' CNFET"
*  Since the libraries weren't loading anyway, they weren't causing the error. Here's where the problem seems to be: line 76 of cnfet_sample.lib should probably read ".SWEEP  Vdd   START=0     STOP='Supply'   STEP='0.1*Supply'"

Let us know if that helps.

basma alm

unread,
May 11, 2021, 7:34:03 AM5/11/21
to xyce-users
Thank you for your reply it did help as it had finished the translation.
However when i try to run Xyce on the cnfet_sample i get the following errors find the translated libraries in the following link

/Downloads/try2/out$ Xyce cnfet_sample.sp

*****
***** Welcome to the Xyce(TM) Parallel Electronic Simulator
*****
***** This is version Xyce DEVELOPMENT-202105070125-g-b37dc80c-opensource
***** Date: Tue May 11 14:25:12 +03 2021


***** Executing netlist cnfet_sample.sp

***** Reading and parsing netlist...
Netlist warning in file cnfet_sample.sp at or near line 81
 Unrecognized dot line will be ignored
***** Setting up topology...

Netlist error: Attempt to evaluate expression
 MAX((1/Tavg(V(Source_b,Source),V(Source_L1,Source_b),1)-1)*Rc(MAX(ABS(V(Drain_b,Drain_ch))/CoeffRd,1e-9))*(1-Sout),1e-4),
 which contains unknowns
Netlist error: Attempt to evaluate expression
 MAX(CoeffRd*Rc(MAX(ABS(V(Drain_b,Drain_ch))/CoeffRd,1e-9)),1e-4), which
 contains unknowns
Netlist error: Attempt to evaluate expression
 MAX((1/Tavg(V(Drain_b,Drain),V(Drain_b,Drain_ch),0)-1)*Rc(MAX(ABS(V(Drain_b,Drain_ch))/CoeffRd,1e-9))*(1-Dout),1e-4),
 which contains unknowns
Netlist error: Attempt to evaluate expression
 MAX((1/Tavg(V(Source_b,Source),V(Source_L1,Source_b),1)-1)*Rc(MAX(ABS(V(Drain_b,Drain_ch))/CoeffRd,1e-9))*(1-Sout),1e-4),
 which contains unknowns
Netlist error: Attempt to evaluate expression
 MAX(CoeffRd*Rc(MAX(ABS(V(Drain_b,Drain_ch))/CoeffRd,1e-9)),1e-4), which
 contains unknowns
Netlist error: Attempt to evaluate expression
 MAX((1/Tavg(V(Drain_b,Drain),V(Drain_b,Drain_ch),0)-1)*Rc(MAX(ABS(V(Drain_b,Drain_ch))/CoeffRd,1e-9))*(1-Dout),1e-4),
 which contains unknowns
Netlist error: Attempt to evaluate expression
 MAX(Lss/Leff*Rc(MAX(ABS(V(Drain_b,Drain_ch))/CoeffRd,1e-9)),1e-4), which
 contains unknowns
Netlist error in file CNFET.lib at or near line 963
 Device instance XCNT:XNCNFET_L2_MIDD:XNCNFET_L1:GBTBT: Illegal use of lead
 current specification in expression
 'J_btbt(V(Drain,Source),I(GCNT),V(phib,Gnd))' in parameter I
Netlist error: Attempt to evaluate expression
 MAX(Lss/Leff*Rc(MAX(ABS(V(Drain_b,Drain_ch))/CoeffRd,1e-9)),1e-4), which
 contains unknowns
Netlist error in file CNFET.lib at or near line 963
 Device instance XCNT:XNCNFET_L2_EDGE:XNCNFET_L1:GBTBT: Illegal use of lead
 current specification in expression
 'J_btbt(V(Drain,Source),I(GCNT),V(phib,Gnd))' in parameter I
Netlist error: There was 1 undefined symbol in .PRINT command: V
Simulation aborted due to error.  There are 0 MSG_FATAL errors and 11
 MSG_ERROR errors
*** Xyce Abort ***
Simulation aborted due to error.  There are 0 MSG_FATAL errors and 11
 MSG_ERROR errors


*** Xyce Abort ***

basma alm

unread,
May 19, 2021, 2:58:28 PM5/19/21
to xyce-users
I believe i found the reason for the errors in CNFET library
there are the following two lines

GCNT Source Drain VALUE={JFET(V(Vdrain,Vsource),photon,V(phib,Gnd))}
GBTBT Source Drain VALUE={J_btbt(V(Vdrain,Vsource),I(GCNT),V(phib,Gnd))}

the "I(GCNT)" seems to be causing the issue is there a workaround for getting the current of  VCCS node

xyce-users

unread,
May 20, 2021, 5:20:34 PM5/20/21
to xyce-users
At the moment, it is illegal in Xyce to use some types if "I()" accessors in B, E, F, G, or H source expressions.  Only those for which the current is actually a solution variable are currently allowed for this use case, and that excludes any I(Gxxx) or I(Fxxx) expressions; the current through a current source is not a solution variable.  Generally speaking, only voltage sources and inductors have their currents as solution variables --- all other "lead currents" are computed as a post-processing operation.

In your case, the simplest workaround I can think of would be to use JFET(V(Vdrain,Vsource),photon,V(phib,Gnd)) in your GBTBT expression in place of I(GCNT).  Since the current through GCNT is specified exactly as this expression, you should be in business with that substitution.

Generally speaking, you can also use 0-volt DC voltage sources as "ammeters": place them in series with the device whose current you actually want to know, and the current through the source is accessible as I(V...), and because it is a solution variable will be legal to use in B, E, F, G, or H source expressions.  This will require inserting additional nodes.  For example, you might be able to get away with:


   GCNT Source DrainPrime VALUE={JFET(V(Vdrain,Vsource),photon,V(phib,Gnd))}
   Vgcnt_monitor DrainPrime Drain DC 0
   GBTBT Source Drain VALUE={J_btbt(V(Vdrain,Vsource),I(Vgcnt_monitor),V(phib,Gnd))}

The zero-volt voltage source in series with GCNT, such that the series combination of GCNT and Vgcnt_monitor is in parallel with GBTBT should be equivalent to your existing circuit, and the current though the voltage source is the one you wanted.

This long-standing limitation on what I() accessors are legal in dependent source expressions is a consequence of some very old decisions made in Xyce development.  New development might make it possible that these decisions can be revisited in the future, but at the moment the limitations stand:  only I() accessors that acccss current through VOLTAGE sources (V, B, E, or H) may be used in B, E, F, G, or H expressions. 

basma alm

unread,
May 24, 2021, 9:09:34 AM5/24/21
to xyce-users
Thank you the solution was of great help i will try both methods and compare results.

unfortunately, im still unable to simulate the device as the error unknow expression remains 
it seems the error is caused by the defined functions

library functions:
.FUNC Rc(Vds)
+ {1/((2+kT/Vds*(log((1+Coexp1(Vds))/(1+Coexp1(Vds)*exp(Vds/kT))) + log((1+Coexp2(Vds))/(1+Coexp2(Vds)*exp(Vds/kT)))))*Coeffj)}


.FUNC Tavg(Vsba,Vres,barrier) 
+ {(EXP(Tuncoeff*Wbarrier1(Vsba,Vres,barrier)*SQRT(Vbarrier1)) + EXP(Tuncoeff*Wbarrier2(Vsba,Vres,barrier)*SQRT(Vbarrier2(Vsba,Vres,barrier))))/2}


Error:
Netlist error: Attempt to evaluate expression
 MAX((1/Tavg(V(Source_b,Source),V(Source_L1,Source_b),1)-1)*Rc(MAX(ABS(V(Drain_b,Drain_ch))/CoeffRd,1e-9))*(1-Sout),1e-4),
 which contains unknowns
Netlist error: Attempt to evaluate expression
 MAX(CoeffRd*Rc(MAX(ABS(V(Drain_b,Drain_ch))/CoeffRd,1e-9)),1e-4), which
 contains unknowns
Netlist error: Attempt to evaluate expression
 MAX((1/Tavg(V(Drain_b,Drain),V(Drain_b,Drain_ch),0)-1)*Rc(MAX(ABS(V(Drain_b,Drain_ch))/CoeffRd,1e-9))*(1-Dout),1e-4),
 which contains unknowns
Netlist error: Attempt to evaluate expression
 MAX((1/Tavg(V(Source_b,Source),V(Source_L1,Source_b),1)-1)*Rc(MAX(ABS(V(Drain_b,Drain_ch))/CoeffRd,1e-9))*(1-Sout),1e-4),
 which contains unknowns
Netlist error: Attempt to evaluate expression
 MAX(CoeffRd*Rc(MAX(ABS(V(Drain_b,Drain_ch))/CoeffRd,1e-9)),1e-4), which
 contains unknowns
Netlist error: Attempt to evaluate expression
 MAX((1/Tavg(V(Drain_b,Drain),V(Drain_b,Drain_ch),0)-1)*Rc(MAX(ABS(V(Drain_b,Drain_ch))/CoeffRd,1e-9))*(1-Dout),1e-4),
 which contains unknowns
Netlist error: Attempt to evaluate expression
 MAX(Lss/Leff*Rc(MAX(ABS(V(Drain_b,Drain_ch))/CoeffRd,1e-9)),1e-4), which
 contains unknowns

xyce-users

unread,
May 24, 2021, 9:32:43 AM5/24/21
to xyce-users
The error "Attempt to evaluate expression ... which contains unknowns" means that Xyce has tried to evaluate the expression in some context where some quantity that appears in it is undefined.

There are some contexts in which it is illegal to use voltage node values in expressions --- these would be illegal anywhere where Xyce is expecting a constant value.  Just seeing the error message doesn't explain *why* the expression is invalid, you'll have to look at how it's being used.

You'll have to find where expressions like "MAX((1/Tavg(V(Source_b,Source),V(Source_L1,Source_b),1)-1)*Rc(MAX(ABS(V(Drain_b,Drain_ch))/CoeffRd,1e-9))*(1-Sout),1e-4)" appear.  This expression must be getting used somewhere where it is not legal because it doesn't evaluate to a time-independent constant.

There are only a few contexts where expressions that contain nodal voltages or branch currents are legal: in the "V=" or "I=" expressions of B sources, the VALUE expression of a dependent source, the capacitance and charge parameters of capacitors, and a few others.  Voltage-dependent expressions are illegal in .param or .global_param definitions and in almost all other device parameter contexts --- in these contexts the expression must evaluate to something independent of the solution.  This is documented in the Reference Guide in sections 2.1.12 (.global_param) and 2.1.25 (.param) and  is further documented in sections 2.2.1 (expressions in .param or .global_param statements) and 2.2.4 (expressions for device instance and model parameters).

basma alm

unread,
May 25, 2021, 7:08:18 AM5/25/21
to xyce-users
that particular instance is being used as the value of the resistance

Rsbs Source Source_b
+ R={MAX((1/Tavg(V(Source_b,Source),V(Source_L1,Source_b),1)-1)*Rc(MAX(ABS(V(Drain_b,Drain_ch))/CoeffRd,1e-9))*(1-Sout),1e-4)}

xyce-users

unread,
May 25, 2021, 10:38:50 AM5/25/21
to xyce-users

That explains the problem.  Xyce does not allow solution-dependent resistances the way HSPICE does.  In Xyce the resistor is always a linear device with constant resistance.

The only workaround would be to simulate that resistor using an equivalent "B" source.  One could do it as a B-source

   BRsbs Source Source_B  I={V(Source,Source_B)/(resistance expression)}
or as
   BRsbs Source Source_B V={I(BRsbs)*(resistance expression)}

with the latter being necessary if it is ever possible for the resistance expression to be zero, and the former preferable if the resistance expression cannot ever be zero (because a B source in current-source mode does not increase the size of the problem, whereas every B source in voltage-source mode adds an unknown (the current) and an equation to the problem).

This is a suitable workaround for all analyses except for noise.  There is no workaround if you're doing noise analysis, because there's no way to add the resistor's noise terms in this way.
 

basma alm

unread,
May 25, 2021, 1:34:31 PM5/25/21
to xyce-users
thank you for the information.
i have modified all resistance value into the suggested expression and now im getting endless warning as below.

warning: Numerically singular matrix found by Amesos, returning zero
 solution to nonlinear solver!
Reply all
Reply to author
Forward
0 new messages