Home> >

script_ex02 : Comparing Two Model Cards

script_ex02 : Comparing Two Model Cards

script_ex02 : Comparing Two Model Cards

Requires: Utmost IV

Minimum Versions: Utmost IV 1.10.6.R

This example describes how to use a script to compare two model cards.

It is not necessary for the model parameters to appear in the same order
in each of the model cards. It is not necessary for the model parameters
to have the same ‘case’ in each of the model cards. For example, a
parameter called ‘VTH0’ is the same as a parameter called ‘vth0’, since
SPICE is case insensitive.

The script will generate a report output file when it is done which will
describe the model differences or let you know that the models are
identical. The script will alert you to the following differences.

  • Model card types are different
  • Parameter values are different
  • Parameter expressions are different
  • Parameter is an expression in one card and a value in the other
  • Parameter exists only in one of the cards

The Utmost IV script is shown here
script_ex02.sjs. The models in this example are called
nmos1
and
nmos2
and are contained in the files
script_ex02_model1.l and
script_ex02_model2.l.

The script file and the input model library files must be saved into the
directory from which you run the following command.

utmost4 -s script_ex02.sjs

When the script runs, the models will be read in from the
input library files, then an output report
script_ex02_report.txt will be generated which will describe any differences in the model cards.

Files

script_ex02_model1.l

.MODEL nmos1 NMOS (
+LEVEL    = 49             VERSION  = 3.3            TNOM     = 27             
+TOX      = 1.4e-08        XJ       = 1.5e-07        NCH      = 1.7e+17        
+VTH0     = 0.7            K1       = 0.5            K2       = -0.0186        
+K3       = 80             K3B      = 0              W0       = 2.5e-06        
+NLX      = 1.74e-07       DVT0W    = 0              DVT1W    = 0              
+DVT2W    = -0.032         DVT0     = 2.2            DVT1     = 0.53           
+DVT2     = -0.032         U0       = 0.067          UA       = 2.25e-09       
+UB       = 5.9e-19        UC       = -4.6e-11       VSAT     = 80000          
+A0       = 1              AGS      = 0              B0       = 0              
+B1       = 0              KETA     = -0.047         A1       = 0              
+A2       = 1              RDSW     = 0              PRWG     = 0              
+PRWB     = 0              WR       = 1              WINT     = 0              
+LINT     = 0              XL       = 0              XW       = 0              
+DWG      = 0              DWB      = 0              VOFF     = -0.1           
+CDSCD    = 0              CDSCB    = 0              ETA0     = 0.08           
+ETAB     = -0.07          DSUB     = 0.56           PCLM     = 1.3            
+PDIBLC1  = 0.39           PDIBLC2  = 0.0086         PDIBLCB  = 0              
+DROUT    = 0.56           PSCBE1   = 8e+08          PSCBE2   = 5e-05          
+PVAG     = 0              DELTA    = 0.01           MOBMOD   = 1              
+PRT      = 0              UTE      = -1.5           KT1      = 0              
+KT1L     = 0              KT2      = 0              UA1      = 4.3e-09        
+UB1      = -7.6e-18       UC1      = -5.6e-11       AT       = 33000          
+NQSMOD   = 0              WL       = 0              WLN      = 1              
+WW       = 0              WWN      = 1              WWL      = 0              
+LL       = 0              LLN      = 1              LW       = 0              
+LWN      = 1              LWL      = 0              CAPMOD   = 2              
+TPB      = 0              TPBSW    = 0              TPBSWG   = 0              
+TCJ      = 0              TCJSW    = 0              TCJSWG   = 0              
+NOFF     = 1              ACDE     = 1              MOIN     = 15 )

script_ex02_model2.l

.MODEL nmos2 NMOS (
+LEVEL    = 49             VERSION  = 3.3            TNOM     = 27             
+tox      = 1.4e-08        XJ       = 1.5e-07        NCH      = 1.7e+17        
+VTH0     = '0.7 + dvth'   K1       = '0.5'          K2       = -0.0186        
+K3       = 80             K3B      = 0              W0       = 2.5e-06        
+NLX      = 1.74e-07       DVT0W    = 0              DVT1W    = 0              
+DVT2W    = -0.032         dvt0     = 2.2            DVT1     = 0.53           
+DVT2     = -0.032         U0       = 0.072          UA       = 2.25e-09       
+UB       = 7.4e-19        uc       = -4.6e-11       VSAT     = 80000          
+A0       = 1              AGS      = 0              B0       = 0              
+B1       = 0              KETA     = -0.047         A1       = 0              
+A2       = 1              RDSW     = 0              PRWG     = 0              
+CDSCD    = 0              CDSCB    = 0              ETA0     = 0.08           
+ETAB     = -0.07          DSUB     = 0.56           PCLM     = 1.3            
+PDIBLC1  = 0.39           PDIBLC2  = 0.0086         PDIBLCB  = 0              
+DROUT    = 0.56           PSCBE1   = 8e+08          PSCBE2   = 5e-05          
+PVAG     = 0              DELTA    = 0.01           MOBMOD   = 1              
+PRWB     = 0              WR       = 1              WINT     = 0              
+DWG      = 0              DWB      = 0              VOFF     = -0.1           
+NFACTOR  = 1              CIT      = 0              CDSC     = 0.00024        
+PRT      = 0              UTE      = -1.5           KT1      = 0              
+KT1L     = 0              KT2      = 0              UA1      = 4.3e-09        
+UB1      = -7.6e-18       UC1      = -5.6e-11       AT       = 33000          
+NQSMOD   = 0              WL       = 0              WLN      = 1              
+WW       = 0              WWN      = 1              WWL      = 0              
+LL       = 0              LLN      = 1              LW       = 0              
+LWN      = 1              LWL      = 0              CAPMOD   = 2              
+TPB      = 0              TPBSW    = 0              TPBSWG   = 0              
+TCJ      = 0              TCJSW    = 0              TCJSWG   = 0              
+NOFF     = 1              ACDE     = 1              MOIN     = 15 )

script_ex02_report.txt



Differences found between models:

		First		Second
		Model		Model

Name		nmos1		nmos2

VTH0		0.7		'0.7 + dvth'
K1		0.5		'0.5'
U0		0.067		0.072
UB		5.9e-19		7.4e-19
LINT		0		---
XL		0		---
XW		0		---
NFACTOR		---		1
CIT		---		0
CDSC		---		0.00024

script_ex02.sjs

var i;

var reportFileName = "script_ex02_report.txt";

var diff = reportText = "";
var myDir;
var myLib1, myCardType1, parNames1, numPars1, par1isVal, par1Val;
var myLib2, myCardType2, parNames2, numPars2, par2isVal, par2Val;
var parName;

var file1 = "script_ex02_model1.l";
var file2 = "script_ex02_model2.l";

var modelName1 = "nmos1";
var modelName2 = "nmos2";

var column = "optVal";

myDir = Silvaco.Utmost4.openCurrentWorkingDirectory (); 
myLib1 = Silvaco.Utmost4.makeModelLibrary ();
myLib2 = Silvaco.Utmost4.makeModelLibrary ();
myLib1.importModelCards (myDir, file1, "", "", modelName1, column); 
myLib2.importModelCards (myDir, file2, "", "", modelName2, column); 

/* Compare the type of the cards */

myCardType1 = myLib1.getCardType (modelName1);
myCardType2 = myLib2.getCardType (modelName2);
if (myCardType1!=myCardType2){
    diff += "Type\t" + myCardType1 + "\t" + myCardType2 + "\n\n";
}
/* Compare the number of parameters */

parNames1 =  myLib1.getParamNames (modelName1);
parNames2 =  myLib2.getParamNames (modelName2);
numPars1 = parNames1.length;
numPars2 = parNames2.length;

for (i=0;i<numPars1;i++)
{
    parName   = parNames1[i];
    par1Val = readValue (myLib1, modelName1, parName, column, par1isVal);

	if (myLib2.hasParameter (modelName2, parName))
    {
        par2Val = readValue (myLib2, modelName2, parName, column, par2isVal);

        if (par1isVal != par2isVal || par1Val != par2Val)
            diff += parName + "\t\t" + par1Val + "\t\t" + par2Val + "\n";
	}
    else
        diff += parName + "\t\t" + par1Val + "\t\t---\n";
}

for (i=0;i<numPars2;i++)
{
    parName   = parNames2[i];
    par2Val = readValue (myLib2, modelName2, parName, column, par2isVal);
	if (!myLib1.hasParameter (modelName1, parName))
        diff += parName + "\t\t---\t\t" + par2Val + "\n";
}

if (diff.length > 0)
{
    reportText  = "\n\nDifferences found between models:\n\n";
    reportText += "\t\tFirst\t\tSecond\n";
    reportText += "\t\tModel\t\tModel\n\n";
    reportText += "Name\t\t" + modelName1 + "\t\t" + modelName2 + "\n\n";
    reportText += diff;
}
else
    reportText  = "\n\nThe models are identical"+"\n";

Silvaco.Utmost4.writeToFile (myDir, reportFileName, reportText, "overwrite");


function readValue (modelLib, modelName, paramName, column, parIsVal)
{
    var parVal;
    parIsVal = modelLib.getValue (modelName, parName, "isVal");
    if (parIsVal)
        parVal =  modelLib.getValue (modelName, parName, column);
    else
        parVal = "'" + modelLib.getValue (modelName, parName, "expr") + "'";
    return parVal;
}

Related Articles