From e20e18b855f37c9d4cba48fb614a290538307e30 Mon Sep 17 00:00:00 2001 From: rlar Date: Tue, 7 Sep 2010 18:57:22 +0000 Subject: [PATCH] whitespace cleanup, \r\n -> \n --- ChangeLog | 21 + contrib/vbic/sgp2vbic | 644 +++++++++--------- contrib/vbic/vbic2sgp | 622 ++++++++--------- src/spicelib/devices/mos9/mos9temp.c | 30 +- src/xspice/examples/d_to_real/Makefile | 78 ++- src/xspice/examples/d_to_real/cfunc.mod | 82 ++- src/xspice/examples/d_to_real/ifspec.ifs | 64 +- src/xspice/examples/nco/Makefile | 78 ++- src/xspice/examples/nco/ifspec.ifs | 76 +-- .../examples/print_param_types/Makefile | 78 ++- .../examples/print_param_types/cfunc.mod | 62 +- .../examples/print_param_types/ifspec.ifs | 224 +++--- src/xspice/examples/real_delay/Makefile | 78 ++- src/xspice/examples/real_delay/ifspec.ifs | 66 +- src/xspice/examples/real_gain/Makefile | 78 ++- src/xspice/examples/real_gain/cfunc.mod | 76 +-- src/xspice/examples/real_gain/ifspec.ifs | 90 +-- src/xspice/examples/real_to_v/Makefile | 78 ++- src/xspice/examples/real_to_v/ifspec.ifs | 66 +- 19 files changed, 1295 insertions(+), 1296 deletions(-) diff --git a/ChangeLog b/ChangeLog index d5267fa9b..62708a9a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2010-09-07 Robert Larice + * contrib/vbic/sgp2vbic , + * contrib/vbic/vbic2sgp , + * src/spicelib/devices/mos9/mos9temp.c , + * src/xspice/examples/d_to_real/Makefile , + * src/xspice/examples/d_to_real/cfunc.mod , + * src/xspice/examples/d_to_real/ifspec.ifs , + * src/xspice/examples/nco/Makefile , + * src/xspice/examples/nco/ifspec.ifs , + * src/xspice/examples/print_param_types/Makefile , + * src/xspice/examples/print_param_types/cfunc.mod , + * src/xspice/examples/print_param_types/ifspec.ifs , + * src/xspice/examples/real_delay/Makefile , + * src/xspice/examples/real_delay/ifspec.ifs , + * src/xspice/examples/real_gain/Makefile , + * src/xspice/examples/real_gain/cfunc.mod , + * src/xspice/examples/real_gain/ifspec.ifs , + * src/xspice/examples/real_to_v/Makefile , + * src/xspice/examples/real_to_v/ifspec.ifs : + whitespace cleanup, \r\n -> \n + 2010-09-07 Holger Vogt * vectors.c: add plot [alli | allv | ally] * com_measure2.c: prevent seg fault if wrong meas type is chosen diff --git a/contrib/vbic/sgp2vbic b/contrib/vbic/sgp2vbic index 443dca31d..33295d015 100644 --- a/contrib/vbic/sgp2vbic +++ b/contrib/vbic/sgp2vbic @@ -1,322 +1,322 @@ -#!/bin/sh -- # perl -eval 'exec perl -S -x -w $0 ${1+"$@"}' -if 0; - -# -# sgp2vbic: program to convert an SGP .model card to VBIC -# -# Vers Date Who Comments -# ==== ========== ============= ======== -# 2.0 06/01/00 Colin McAndrew translated from shell/nawk version -# - -sub usage() { - print " -$prog: convert SGP .model card to VBIC .model card - -Usage: $prog [options] modelFile - -Files: - modelFile file with SGP .model card - -Options: - -d debug mode - -h print this help message - -i print detailed information - -v verbose mode - -vbeif Vbe do fwd Early voltage map at Vbe ($Vbeif) - -vceif Vce do fwd Early voltage map at Vce ($Vceif) - -vbcir Vbc do rev Early voltage map at Vbc ($Vbcir) - -vecir Vec do rev Early voltage map at Vec ($Vecir) -"; -} # End of: sub usage - -sub info() { - print " -This program maps an SGP .model card into a VBIC .model card. -For many parameters there is a 1-to-1 mapping between the two, -and the default VBIC parameters are such that the model extensions -that are not part of SGP are turned off. - -There are two fundamental and non-mappable differences between -the two models. First, the IRB emitter crowding based resistance -modulation model is not supported in VBIC. This parameter is -ignored. Second, the Early effect model is different, the bias -dependence is substantially better in VBIC than in SGP. This means -the models can be made to match only at specific biases. -These biases can be specified by the -vxxi[fr] flags. -"; -} # End of: sub info - -# -# Set program names and variables. -# - -$\="\n"; -$,=" "; -$Debug=""; -$Verbose=""; -$Number='([+-]?[0-9]+[.]?[0-9]*|[+-]?[0-9]+[.]?[0-9]*[eE][+-]?[0-9]+|[+-]?[.][0-9]+|[+-]?[.][0-9]+[eE][+-]?[0-9]+)'; -@prog=split("/",$0); -$prog=$prog[$#prog]; -$Pi=atan2(0,-1); -$Vbeif=0.6; -$Vceif=2.5; -$Vbcir=0.5; -$Vecir=2.5; - -# -# Parse command line arguments, allow argument -# flags to be any case. -# - -for (;;){ - if ($#ARGV < 0) { - last; - } elsif ($ARGV[0] =~ /^-d/i) { - $Debug="-d";$Verbose="-v"; - } elsif ($ARGV[0] =~ /^-h/i) { - &usage();exit(0); - } elsif ($ARGV[0] =~ /^-i/i) { - &info();exit(0); - } elsif ($ARGV[0] =~ /^-v$/i) { - $Verbose="-v"; - } elsif ($ARGV[0] =~ /^-vbeif$/i) { - shift(@ARGV); - if (!defined($ARGV[0])) { - die("ERROR: no value specified for -vbeif flag, stopped"); - } - $Vbeif=$ARGV[0]; - if ($Vbeif !~ /$Number/) { - die("ERROR: value for -vbeif flag must be a number, stopped"); - } - } elsif ($ARGV[0] =~ /^-vceif$/i) { - shift(@ARGV); - if (!defined($ARGV[0])) { - die("ERROR: no value specified for -vceif flag, stopped"); - } - $Vceif=$ARGV[0]; - if ($Vceif !~ /$Number/) { - die("ERROR: value for -vceif flag must be a number, stopped"); - } - } elsif ($ARGV[0] =~ /^-vbcir$/i) { - shift(@ARGV); - if (!defined($ARGV[0])) { - die("ERROR: no value specified for -vbcir flag, stopped"); - } - $Vbcir=$ARGV[0]; - if ($Vbcir !~ /$Number/) { - die("ERROR: value for -vbcir flag must be a number, stopped"); - } - } elsif ($ARGV[0] =~ /^-vecir$/i) { - shift(@ARGV); - if (!defined($ARGV[0])) { - die("ERROR: no value specified for -vecir flag, stopped"); - } - $Vecir=$ARGV[0]; - if ($Vecir !~ /$Number/) { - die("ERROR: value for -vecir flag must be a number, stopped"); - } - } elsif ($ARGV[0] =~ /^-/) { - &usage(); - die("ERROR: unknown flag $ARGV[0], stopped"); - } else { - last; - } - shift(@ARGV); -} -if ($#ARGV < 0) { - &usage();exit(1); # exit if no file name is specified -} - -$ModelFile=$ARGV[0]; - -sub QCDEPL { - my($vj,$p,$m,$f)=@_; - my($w,$xx,$cj,$qj); - - $w=1.0-$vj/$p; - if($w>=1.0-$f){ - $cj=$w**(-$m); - $qj=$p*(1.0-$w*$cj)/(1.0-$m); - } else { - $xx=(1.0-$f)**(-(1.0+$m)); - $cj=$xx*(1.0-$f*(1.0+$m)+$m*$vj/$p); - $qj=$xx*((1.0-$f*(1.0+$m))*($vj-$f*$p)+0.5*$m*($vj*$vj-$f*$f*$p*$p)/$p)+$p*(1.0-$xx*(1.0-$f)**2)/(1.0-$m); - } - return($qj,$cj); -} - -# -# Parse model file -# - -open(IF,"$ModelFile") || - die("ERROR: cannot open file $ModelFile, stopped"); -$inModel="no"; -while () { - chomp;tr/A-Z/a-z/; - if ($_ =~ /^\s*$/) {next;} - if ($_ =~ /^\s*\*/) {next;} - last if ($_ !~ /^\+/ && $inModel eq "yes"); - if ($_ =~ /^\s*\.mod/) { - $inModel="yes";$model=$_;next; - } - if ($inModel eq "yes") { - $_=~s/^\+\s*/ /;$model.=$_;next; - } -} -close(IF); -$model=~s/\s*=\s*/=/g; - -# -# Set SGP parameters from .model card -# - -$val{"is"}=1.0e-16; -$val{"bf"}=100.0; -$val{"nf"}=1.0; -$val{"vaf"}=0.0; -$val{"ikf"}=0.0; -$val{"ise"}=0.0; -$val{"ne"}=1.5; -$val{"br"}=1.0; -$val{"nr"}=1.0; -$val{"var"}=0.0; -$val{"ikr"}=0.0; -$val{"isc"}=0.0; -$val{"nc"}=2.0; -$val{"rb"}=0.0; -$val{"rbm"}=0.0; -$val{"re"}=0.0; -$val{"rc"}=0.0; -$val{"cje"}=0.0; -$val{"vje"}=0.75; -$val{"mje"}=0.33; -$val{"cjc"}=0.0; -$val{"vjc"}=0.75; -$val{"mjc"}=0.33; -$val{"xcjc"}=1.0; -$val{"cjs"}=0.0; -$val{"vjs"}=0.75; -$val{"mjs"}=0.0; -$val{"fc"}=0.5; -$val{"tf"}=0.0; -$val{"xtf"}=0.0; -$val{"vtf"}=0.0; -$val{"itf"}=0.0; -$val{"ptf"}=0.0; -$val{"tr"}=0.0; -$val{"kf"}=0.0; -$val{"af"}=1.0; -$val{"eg"}=1.11; -$val{"xtb"}=0.0; -$val{"xti"}=3.0; -$alias{"va"}="vaf"; -$alias{"ik"}="ikf"; -$alias{"c2"}="ise"; -$alias{"vb"}="var"; -$alias{"c4"}="isc"; -$alias{"pe"}="vje"; -$alias{"me"}="mje"; -$alias{"pc"}="vjc"; -$alias{"mc"}="mjc"; -$alias{"ccs"}="cjs"; -$alias{"ps"}="vjs"; -$alias{"ms"}="mjs"; -$alias{"pt"}="xti"; - -@Field=split(/\s+/,$model); -$name=$Field[1]; -for ($i=3;$i<=$#Field;++$i) { - die("ERROR: term $Field[$i] is not in name=value format, stopped") - if ($Field[$i] !~ /=/); - ($param,$value)=split(/=/,$Field[$i]); - die("ERROR: parameter $param must be a number, stopped") - if ($value !~ /$Number/); - if (defined($alias{$param})) {$param=$alias{$param};} - if ($param eq "irb") { - print STDERR "* WARNING: IRB parameter is not supported in vbic"; - next; - } - if (!defined($val{$param})) { - print STDERR "* WARNING: parameter $param is not supported in vbic"; - next; - } - $val{$param}=$value; - if ($param eq "rbm") {$done{"rbm"}="yes";} -} -if (!defined($done{"rbm"})) {$val{"rbm"}=$val{"rb"};} -if($val{"ise"}>1) {$val{"ise"}=$val{"ise"}*$val{"is"};} -if($val{"isc"}>1) {$val{"isc"}=$val{"isc"}*$val{"is"};} -$Vbcif=$Vbeif-$Vceif; -$Vbeir=$Vbcir-$Vecir; -($qjbef,$cj )=&QCDEPL($Vbeif,$val{"vje"},$val{"mje"},$val{"fc"}); -($qjbcf,$cjbcf)=&QCDEPL($Vbcif,$val{"vjc"},$val{"mjc"},$val{"fc"}); -($qjber,$cjber)=&QCDEPL($Vbeir,$val{"vje"},$val{"mje"},$val{"fc"}); -($qjbcr,$cj )=&QCDEPL($Vbcir,$val{"vjc"},$val{"mjc"},$val{"fc"}); -$ivaf=$val{"vaf"};if($ivaf>0){$ivaf=1/$ivaf;} -$ivar=$val{"var"};if($ivar>0){$ivar=1/$ivar;} -$godIf=$ivaf/(1-$Vbeif*$ivar-$Vbcif*$ivaf); -if($godIf<1e-10) {$godIf=1e-10;} -$godIr=$ivar/(1-$Vbeir*$ivar-$Vbcir*$ivaf); -if($godIr<1e-10) {$godIr=1e-10;} -$a11=$qjbcf-$cjbcf/$godIf; -$a12=$qjbef; -$r1=-1.0; -$a21=$qjbcr; -$a22=$qjber-$cjber/$godIr; -$r2=-1.0; -$det=$a11*$a22-$a12*$a21; -$ivef=($r1*$a22-$r2*$a12)/$det; -$iver=($r2*$a11-$r1*$a21)/$det; -$vef=1/$ivef;$ver=1/$iver; - -print '.model '.$name.' vbic -+ rcx = '.$val{"rc"}.' -+ rci = '."0.0".' -+ rbx = '.$val{"rbm"}.' -+ rbi = '.($val{"rb"}-$val{"rbm"}).' -+ re = '.$val{"re"}.' -+ is = '.$val{"is"}.' -+ nf = '.$val{"nf"}.' -+ nr = '.$val{"nr"}.' -+ fc = '.$val{"fc"}.' -+ cje = '.$val{"cje"}.' -+ pe = '.$val{"vje"}.' -+ me = '.$val{"mje"}.' -+ cjc = '.($val{"cjc"}*$val{"xcjc"}).' -+ cjep = '.($val{"cjc"}*(1.0-$val{"xcjc"})).' -+ pc = '.$val{"vjc"}.' -+ mc = '.$val{"mjc"}.' -+ cjcp = '.$val{"cjs"}.' -+ ps = '.$val{"vjs"}.' -+ ms = '.$val{"mjs"}.' -+ ibei = '.($val{"is"}/$val{"bf"}).' -+ nei = '.$val{"nf"}.' -+ iben = '.$val{"ise"}.' -+ nen = '.$val{"ne"}.' -+ ibci = '.($val{"is"}/$val{"br"}).' -+ nci = '.$val{"nr"}.' -+ ibcn = '.$val{"isc"}.' -+ ncn = '.$val{"nc"}.' -+ vef = '.$vef.' -+ ver = '.$ver.' -+ ikf = '.$val{"ikf"}.' -+ ikr = '.$val{"ikr"}.' -+ tf = '.$val{"tf"}.' -+ xtf = '.$val{"xtf"}.' -+ vtf = '.$val{"vtf"}.' -+ itf = '.$val{"itf"}.' -+ tr = '.$val{"tr"}.' -+ td = '.($val{"tf"}*$val{"ptf"}*$Pi/180.0).' -+ ea = '.$val{"eg"}.' -+ eaie = '.$val{"eg"}.' -+ eaic = '.$val{"eg"}.' -+ eane = '.$val{"eg"}.' -+ eanc = '.$val{"eg"}.' -+ xis = '.$val{"xti"}.' -+ xii = '.($val{"xti"}-$val{"xtb"}).' -+ xin = '.($val{"xti"}-$val{"ne"}*$val{"xtb"}).' -+ kfn = '.$val{"kf"}.' -+ afn = '.$val{"af"}; +#!/bin/sh -- # perl +eval 'exec perl -S -x -w $0 ${1+"$@"}' +if 0; + +# +# sgp2vbic: program to convert an SGP .model card to VBIC +# +# Vers Date Who Comments +# ==== ========== ============= ======== +# 2.0 06/01/00 Colin McAndrew translated from shell/nawk version +# + +sub usage() { + print " +$prog: convert SGP .model card to VBIC .model card + +Usage: $prog [options] modelFile + +Files: + modelFile file with SGP .model card + +Options: + -d debug mode + -h print this help message + -i print detailed information + -v verbose mode + -vbeif Vbe do fwd Early voltage map at Vbe ($Vbeif) + -vceif Vce do fwd Early voltage map at Vce ($Vceif) + -vbcir Vbc do rev Early voltage map at Vbc ($Vbcir) + -vecir Vec do rev Early voltage map at Vec ($Vecir) +"; +} # End of: sub usage + +sub info() { + print " +This program maps an SGP .model card into a VBIC .model card. +For many parameters there is a 1-to-1 mapping between the two, +and the default VBIC parameters are such that the model extensions +that are not part of SGP are turned off. + +There are two fundamental and non-mappable differences between +the two models. First, the IRB emitter crowding based resistance +modulation model is not supported in VBIC. This parameter is +ignored. Second, the Early effect model is different, the bias +dependence is substantially better in VBIC than in SGP. This means +the models can be made to match only at specific biases. +These biases can be specified by the -vxxi[fr] flags. +"; +} # End of: sub info + +# +# Set program names and variables. +# + +$\="\n"; +$,=" "; +$Debug=""; +$Verbose=""; +$Number='([+-]?[0-9]+[.]?[0-9]*|[+-]?[0-9]+[.]?[0-9]*[eE][+-]?[0-9]+|[+-]?[.][0-9]+|[+-]?[.][0-9]+[eE][+-]?[0-9]+)'; +@prog=split("/",$0); +$prog=$prog[$#prog]; +$Pi=atan2(0,-1); +$Vbeif=0.6; +$Vceif=2.5; +$Vbcir=0.5; +$Vecir=2.5; + +# +# Parse command line arguments, allow argument +# flags to be any case. +# + +for (;;){ + if ($#ARGV < 0) { + last; + } elsif ($ARGV[0] =~ /^-d/i) { + $Debug="-d";$Verbose="-v"; + } elsif ($ARGV[0] =~ /^-h/i) { + &usage();exit(0); + } elsif ($ARGV[0] =~ /^-i/i) { + &info();exit(0); + } elsif ($ARGV[0] =~ /^-v$/i) { + $Verbose="-v"; + } elsif ($ARGV[0] =~ /^-vbeif$/i) { + shift(@ARGV); + if (!defined($ARGV[0])) { + die("ERROR: no value specified for -vbeif flag, stopped"); + } + $Vbeif=$ARGV[0]; + if ($Vbeif !~ /$Number/) { + die("ERROR: value for -vbeif flag must be a number, stopped"); + } + } elsif ($ARGV[0] =~ /^-vceif$/i) { + shift(@ARGV); + if (!defined($ARGV[0])) { + die("ERROR: no value specified for -vceif flag, stopped"); + } + $Vceif=$ARGV[0]; + if ($Vceif !~ /$Number/) { + die("ERROR: value for -vceif flag must be a number, stopped"); + } + } elsif ($ARGV[0] =~ /^-vbcir$/i) { + shift(@ARGV); + if (!defined($ARGV[0])) { + die("ERROR: no value specified for -vbcir flag, stopped"); + } + $Vbcir=$ARGV[0]; + if ($Vbcir !~ /$Number/) { + die("ERROR: value for -vbcir flag must be a number, stopped"); + } + } elsif ($ARGV[0] =~ /^-vecir$/i) { + shift(@ARGV); + if (!defined($ARGV[0])) { + die("ERROR: no value specified for -vecir flag, stopped"); + } + $Vecir=$ARGV[0]; + if ($Vecir !~ /$Number/) { + die("ERROR: value for -vecir flag must be a number, stopped"); + } + } elsif ($ARGV[0] =~ /^-/) { + &usage(); + die("ERROR: unknown flag $ARGV[0], stopped"); + } else { + last; + } + shift(@ARGV); +} +if ($#ARGV < 0) { + &usage();exit(1); # exit if no file name is specified +} + +$ModelFile=$ARGV[0]; + +sub QCDEPL { + my($vj,$p,$m,$f)=@_; + my($w,$xx,$cj,$qj); + + $w=1.0-$vj/$p; + if($w>=1.0-$f){ + $cj=$w**(-$m); + $qj=$p*(1.0-$w*$cj)/(1.0-$m); + } else { + $xx=(1.0-$f)**(-(1.0+$m)); + $cj=$xx*(1.0-$f*(1.0+$m)+$m*$vj/$p); + $qj=$xx*((1.0-$f*(1.0+$m))*($vj-$f*$p)+0.5*$m*($vj*$vj-$f*$f*$p*$p)/$p)+$p*(1.0-$xx*(1.0-$f)**2)/(1.0-$m); + } + return($qj,$cj); +} + +# +# Parse model file +# + +open(IF,"$ModelFile") || + die("ERROR: cannot open file $ModelFile, stopped"); +$inModel="no"; +while () { + chomp;tr/A-Z/a-z/; + if ($_ =~ /^\s*$/) {next;} + if ($_ =~ /^\s*\*/) {next;} + last if ($_ !~ /^\+/ && $inModel eq "yes"); + if ($_ =~ /^\s*\.mod/) { + $inModel="yes";$model=$_;next; + } + if ($inModel eq "yes") { + $_=~s/^\+\s*/ /;$model.=$_;next; + } +} +close(IF); +$model=~s/\s*=\s*/=/g; + +# +# Set SGP parameters from .model card +# + +$val{"is"}=1.0e-16; +$val{"bf"}=100.0; +$val{"nf"}=1.0; +$val{"vaf"}=0.0; +$val{"ikf"}=0.0; +$val{"ise"}=0.0; +$val{"ne"}=1.5; +$val{"br"}=1.0; +$val{"nr"}=1.0; +$val{"var"}=0.0; +$val{"ikr"}=0.0; +$val{"isc"}=0.0; +$val{"nc"}=2.0; +$val{"rb"}=0.0; +$val{"rbm"}=0.0; +$val{"re"}=0.0; +$val{"rc"}=0.0; +$val{"cje"}=0.0; +$val{"vje"}=0.75; +$val{"mje"}=0.33; +$val{"cjc"}=0.0; +$val{"vjc"}=0.75; +$val{"mjc"}=0.33; +$val{"xcjc"}=1.0; +$val{"cjs"}=0.0; +$val{"vjs"}=0.75; +$val{"mjs"}=0.0; +$val{"fc"}=0.5; +$val{"tf"}=0.0; +$val{"xtf"}=0.0; +$val{"vtf"}=0.0; +$val{"itf"}=0.0; +$val{"ptf"}=0.0; +$val{"tr"}=0.0; +$val{"kf"}=0.0; +$val{"af"}=1.0; +$val{"eg"}=1.11; +$val{"xtb"}=0.0; +$val{"xti"}=3.0; +$alias{"va"}="vaf"; +$alias{"ik"}="ikf"; +$alias{"c2"}="ise"; +$alias{"vb"}="var"; +$alias{"c4"}="isc"; +$alias{"pe"}="vje"; +$alias{"me"}="mje"; +$alias{"pc"}="vjc"; +$alias{"mc"}="mjc"; +$alias{"ccs"}="cjs"; +$alias{"ps"}="vjs"; +$alias{"ms"}="mjs"; +$alias{"pt"}="xti"; + +@Field=split(/\s+/,$model); +$name=$Field[1]; +for ($i=3;$i<=$#Field;++$i) { + die("ERROR: term $Field[$i] is not in name=value format, stopped") + if ($Field[$i] !~ /=/); + ($param,$value)=split(/=/,$Field[$i]); + die("ERROR: parameter $param must be a number, stopped") + if ($value !~ /$Number/); + if (defined($alias{$param})) {$param=$alias{$param};} + if ($param eq "irb") { + print STDERR "* WARNING: IRB parameter is not supported in vbic"; + next; + } + if (!defined($val{$param})) { + print STDERR "* WARNING: parameter $param is not supported in vbic"; + next; + } + $val{$param}=$value; + if ($param eq "rbm") {$done{"rbm"}="yes";} +} +if (!defined($done{"rbm"})) {$val{"rbm"}=$val{"rb"};} +if($val{"ise"}>1) {$val{"ise"}=$val{"ise"}*$val{"is"};} +if($val{"isc"}>1) {$val{"isc"}=$val{"isc"}*$val{"is"};} +$Vbcif=$Vbeif-$Vceif; +$Vbeir=$Vbcir-$Vecir; +($qjbef,$cj )=&QCDEPL($Vbeif,$val{"vje"},$val{"mje"},$val{"fc"}); +($qjbcf,$cjbcf)=&QCDEPL($Vbcif,$val{"vjc"},$val{"mjc"},$val{"fc"}); +($qjber,$cjber)=&QCDEPL($Vbeir,$val{"vje"},$val{"mje"},$val{"fc"}); +($qjbcr,$cj )=&QCDEPL($Vbcir,$val{"vjc"},$val{"mjc"},$val{"fc"}); +$ivaf=$val{"vaf"};if($ivaf>0){$ivaf=1/$ivaf;} +$ivar=$val{"var"};if($ivar>0){$ivar=1/$ivar;} +$godIf=$ivaf/(1-$Vbeif*$ivar-$Vbcif*$ivaf); +if($godIf<1e-10) {$godIf=1e-10;} +$godIr=$ivar/(1-$Vbeir*$ivar-$Vbcir*$ivaf); +if($godIr<1e-10) {$godIr=1e-10;} +$a11=$qjbcf-$cjbcf/$godIf; +$a12=$qjbef; +$r1=-1.0; +$a21=$qjbcr; +$a22=$qjber-$cjber/$godIr; +$r2=-1.0; +$det=$a11*$a22-$a12*$a21; +$ivef=($r1*$a22-$r2*$a12)/$det; +$iver=($r2*$a11-$r1*$a21)/$det; +$vef=1/$ivef;$ver=1/$iver; + +print '.model '.$name.' vbic ++ rcx = '.$val{"rc"}.' ++ rci = '."0.0".' ++ rbx = '.$val{"rbm"}.' ++ rbi = '.($val{"rb"}-$val{"rbm"}).' ++ re = '.$val{"re"}.' ++ is = '.$val{"is"}.' ++ nf = '.$val{"nf"}.' ++ nr = '.$val{"nr"}.' ++ fc = '.$val{"fc"}.' ++ cje = '.$val{"cje"}.' ++ pe = '.$val{"vje"}.' ++ me = '.$val{"mje"}.' ++ cjc = '.($val{"cjc"}*$val{"xcjc"}).' ++ cjep = '.($val{"cjc"}*(1.0-$val{"xcjc"})).' ++ pc = '.$val{"vjc"}.' ++ mc = '.$val{"mjc"}.' ++ cjcp = '.$val{"cjs"}.' ++ ps = '.$val{"vjs"}.' ++ ms = '.$val{"mjs"}.' ++ ibei = '.($val{"is"}/$val{"bf"}).' ++ nei = '.$val{"nf"}.' ++ iben = '.$val{"ise"}.' ++ nen = '.$val{"ne"}.' ++ ibci = '.($val{"is"}/$val{"br"}).' ++ nci = '.$val{"nr"}.' ++ ibcn = '.$val{"isc"}.' ++ ncn = '.$val{"nc"}.' ++ vef = '.$vef.' ++ ver = '.$ver.' ++ ikf = '.$val{"ikf"}.' ++ ikr = '.$val{"ikr"}.' ++ tf = '.$val{"tf"}.' ++ xtf = '.$val{"xtf"}.' ++ vtf = '.$val{"vtf"}.' ++ itf = '.$val{"itf"}.' ++ tr = '.$val{"tr"}.' ++ td = '.($val{"tf"}*$val{"ptf"}*$Pi/180.0).' ++ ea = '.$val{"eg"}.' ++ eaie = '.$val{"eg"}.' ++ eaic = '.$val{"eg"}.' ++ eane = '.$val{"eg"}.' ++ eanc = '.$val{"eg"}.' ++ xis = '.$val{"xti"}.' ++ xii = '.($val{"xti"}-$val{"xtb"}).' ++ xin = '.($val{"xti"}-$val{"ne"}*$val{"xtb"}).' ++ kfn = '.$val{"kf"}.' ++ afn = '.$val{"af"}; diff --git a/contrib/vbic/vbic2sgp b/contrib/vbic/vbic2sgp index 8d4a95083..3d9036f09 100644 --- a/contrib/vbic/vbic2sgp +++ b/contrib/vbic/vbic2sgp @@ -1,311 +1,311 @@ -#!/bin/sh -- # perl -eval 'exec perl -S -x -w $0 ${1+"$@"}' -if 0; - -# -# vbic2sgp: program to convert a VBIC .model card to SGP -# -# Vers Date Who Comments -# ==== ========== ============= ======== -# 1.0 07/17/00 Colin McAndrew modified sgp2vbic -# - -sub usage() { - print " -$prog: convert VBIC .model card to SGP .model card - -Usage: $prog [options] modelFile - -Files: - modelFile file with VBIC .model card - -Options: - -d debug mode - -h print this help message - -i print detailed information - -v verbose mode - -vbeif Vbe do fwd Early voltage map at Vbe ($Vbeif) - -vceif Vce do fwd Early voltage map at Vce ($Vceif) - -vbcir Vbc do rev Early voltage map at Vbc ($Vbcir) - -vecir Vec do rev Early voltage map at Vec ($Vecir) -"; -} # End of: sub usage - -sub info() { - print " -This program maps a VBIC .model card into an SGP .model card. -For many parameters there is a 1-to-1 mapping between the two, -and the default VBIC parameters are such that the model extensions -that are not part of SGP are turned off. However if the extensions -in VBIC are used, clearly they are not translated into SGP. - -In particular, note that using the separate ideality coefficients -for base current in VBIC will give a model that will NOT translate -into SGP properly. A simple calculation of BF(SGP)=IS(VBIC)/IBEI(VBIC) -is done, that will not be accurate if NEI(VBIC) is not equal to NF(VBIC). - -The Early effect model is different between VBIC and SGP, the bias -dependence is substantially better in VBIC than in SGP. This means -the models can be made to match only at specific biases. -These biases can be specified by the -vxxi[fr] flags. -"; -} # End of: sub info - -# -# Set program names and variables. -# - -$\="\n"; -$,=" "; -$Debug=""; -$Verbose=""; -$Number='([+-]?[0-9]+[.]?[0-9]*|[+-]?[0-9]+[.]?[0-9]*[eE][+-]?[0-9]+|[+-]?[.][0-9]+|[+-]?[.][0-9]+[eE][+-]?[0-9]+)'; -@prog=split("/",$0); -$prog=$prog[$#prog]; -$Pi=atan2(0,-1); -$Vbeif=0.6; -$Vceif=2.5; -$Vbcir=0.5; -$Vecir=2.5; - -# -# Parse command line arguments, allow argument -# flags to be any case. -# - -for (;;){ - if ($#ARGV < 0) { - last; - } elsif ($ARGV[0] =~ /^-d/i) { - $Debug="-d";$Verbose="-v"; - } elsif ($ARGV[0] =~ /^-h/i) { - &usage();exit(0); - } elsif ($ARGV[0] =~ /^-i/i) { - &info();exit(0); - } elsif ($ARGV[0] =~ /^-v$/i) { - $Verbose="-v"; - } elsif ($ARGV[0] =~ /^-vbeif$/i) { - shift(@ARGV); - if (!defined($ARGV[0])) { - die("ERROR: no value specified for -vbeif flag, stopped"); - } - $Vbeif=$ARGV[0]; - if ($Vbeif !~ /$Number/) { - die("ERROR: value for -vbeif flag must be a number, stopped"); - } - } elsif ($ARGV[0] =~ /^-vceif$/i) { - shift(@ARGV); - if (!defined($ARGV[0])) { - die("ERROR: no value specified for -vceif flag, stopped"); - } - $Vceif=$ARGV[0]; - if ($Vceif !~ /$Number/) { - die("ERROR: value for -vceif flag must be a number, stopped"); - } - } elsif ($ARGV[0] =~ /^-vbcir$/i) { - shift(@ARGV); - if (!defined($ARGV[0])) { - die("ERROR: no value specified for -vbcir flag, stopped"); - } - $Vbcir=$ARGV[0]; - if ($Vbcir !~ /$Number/) { - die("ERROR: value for -vbcir flag must be a number, stopped"); - } - } elsif ($ARGV[0] =~ /^-vecir$/i) { - shift(@ARGV); - if (!defined($ARGV[0])) { - die("ERROR: no value specified for -vecir flag, stopped"); - } - $Vecir=$ARGV[0]; - if ($Vecir !~ /$Number/) { - die("ERROR: value for -vecir flag must be a number, stopped"); - } - } elsif ($ARGV[0] =~ /^-/) { - &usage(); - die("ERROR: unknown flag $ARGV[0], stopped"); - } else { - last; - } - shift(@ARGV); -} -if ($#ARGV < 0) { - &usage();exit(1); # exit if no file name is specified -} - -$ModelFile=$ARGV[0]; - -sub QCDEPL { - my($vj,$p,$m,$f)=@_; - my($w,$xx,$cj,$qj); - - $w=1.0-$vj/$p; - if($w>=1.0-$f){ - $cj=$w**(-$m); - $qj=$p*(1.0-$w*$cj)/(1.0-$m); - } else { - $xx=(1.0-$f)**(-(1.0+$m)); - $cj=$xx*(1.0-$f*(1.0+$m)+$m*$vj/$p); - $qj=$xx*((1.0-$f*(1.0+$m))*($vj-$f*$p)+0.5*$m*($vj*$vj-$f*$f*$p*$p)/$p)+$p*(1.0-$xx*(1.0-$f)**2)/(1.0-$m); - } - return($qj,$cj); -} - -# -# Parse model file -# - -open(IF,"$ModelFile") || - die("ERROR: cannot open file $ModelFile, stopped"); -$inModel="no"; -while () { - chomp;tr/A-Z/a-z/; - if ($_ =~ /^\s*$/) {next;} - if ($_ =~ /^\s*\*/) {next;} - last if ($_ !~ /^\+/ && $inModel eq "yes"); - if ($_ =~ /^\s*\.mod/) { - $inModel="yes";$model=$_;next; - } - if ($inModel eq "yes") { - $_=~s/^\+\s*/ /;$model.=$_;next; - } -} -close(IF); -$model=~s/\s*=\s*/=/g; - -# -# Set VBIC parameters from .model card -# - -$val{"is"}=1.0e-16; -$val{"nf"}=1.0; -$val{"nr"}=1.0; -$val{"ibei"}=1.0e-18; -$val{"nei"}=1.0; -$val{"vef"}=0.0; -$val{"ikf"}=0.0; -$val{"iben"}=0.0; -$val{"nen"}=1.5; -$val{"ibci"}=1.0e-16; -$val{"nci"}=1.0; -$val{"ver"}=0.0; -$val{"ikr"}=0.0; -$val{"ibcn"}=0.0; -$val{"ncn"}=2.0; -$val{"rbx"}=0.0; -$val{"rbi"}=0.0; -$val{"re"}=0.0; -$val{"rcx"}=0.0; -$val{"rci"}=0.0; -$val{"cje"}=0.0; -$val{"vje"}=0.75; -$val{"mje"}=0.33; -$val{"fc"}=0.9; -$val{"cjc"}=0.0; -$val{"cjep"}=0.0; -$val{"vjc"}=0.75; -$val{"mjc"}=0.33; -$val{"cjcp"}=0.0; -$val{"vjs"}=0.75; -$val{"mjs"}=0.0; -$val{"tf"}=0.0; -$val{"xtf"}=0.0; -$val{"vtf"}=0.0; -$val{"itf"}=0.0; -$val{"tr"}=0.0; -$val{"td"}=0.0; -$val{"kfn"}=0.0; -$val{"afn"}=1.0; -$val{"ea"}=1.12; -$val{"eaie"}=1.12; -$val{"eaic"}=1.12; -$val{"eane"}=1.12; -$val{"eanc"}=1.12; -$val{"xis"}=3; -$val{"xii"}=3; -$val{"xin"}=3; -$alias{"ik"}="ikf"; -$alias{"pe"}="vje"; -$alias{"me"}="mje"; -$alias{"pc"}="vjc"; -$alias{"mc"}="mjc"; -$alias{"ps"}="vjs"; -$alias{"ms"}="mjs"; - -@Field=split(/\s+/,$model); -$name=$Field[1]; -for ($i=3;$i<=$#Field;++$i) { - die("ERROR: term $Field[$i] is not in name=value format, stopped") - if ($Field[$i] !~ /=/); - ($param,$value)=split(/=/,$Field[$i]); - die("ERROR: parameter $param must be a number, stopped") - if ($value !~ /$Number/); - if (defined($alias{$param})) {$param=$alias{$param};} - if (!defined($val{$param})) { - print STDERR "* WARNING: parameter $param is not supported in sgp"; - next; - } - $val{$param}=$value; -} -$Vbcif=$Vbeif-$Vceif; -$Vbeir=$Vbcir-$Vecir; -($qjbef,$cj )=&QCDEPL($Vbeif,$val{"vje"},$val{"mje"},$val{"fc"}); -($qjbcf,$cjbcf)=&QCDEPL($Vbcif,$val{"vjc"},$val{"mjc"},$val{"fc"}); -($qjber,$cjber)=&QCDEPL($Vbeir,$val{"vje"},$val{"mje"},$val{"fc"}); -($qjbcr,$cj )=&QCDEPL($Vbcir,$val{"vjc"},$val{"mjc"},$val{"fc"}); -$ivef=$val{"vef"};if($ivef>0){$ivef=1/$ivef;} -$iver=$val{"ver"};if($iver>0){$iver=1/$iver;} -$godIf=$cjbcf*$ivef/(1+$qjbef*$iver+$qjbcf*$ivef); -if($godIf<1e-10) {$godIf=1e-10;} -$godIr=$cjber*$iver/(1+$qjber*$iver+$qjbcr*$ivef); -if($godIr<1e-10) {$godIr=1e-10;} -$a11=-$Vbcif-1.0/$godIf; -$a12=-$Vbeif; -$r1 =-1.0; -$a21=-$Vbcir; -$a22=-$Vbeir-1.0/$godIr; -$r2 =-1.0; -$det=$a11*$a22-$a12*$a21; -$ivaf=($r1*$a22-$r2*$a12)/$det; -$ivar=($r2*$a11-$r1*$a21)/$det; -$vaf=1/$ivaf;$var=1/$ivar; - -print '.model '.$name.' sgp -+ rc = '.($val{"rcx"}+$val{"rci"}).' -+ rbm = '.$val{"rbx"}.' -+ rb = '.($val{"rbx"}+$val{"rbi"}).' -+ re = '.$val{"re"}.' -+ is = '.$val{"is"}.' -+ nf = '.$val{"nf"}.' -+ nr = '.$val{"nr"}.' -+ fc = '.$val{"fc"}.' -+ cje = '.$val{"cje"}.' -+ vje = '.$val{"vje"}.' -+ mje = '.$val{"mje"}.' -+ cjc = '.($val{"cjc"}+$val{"cjep"}).' -+ xcjc = '.($val{"cjc"}/($val{"cjc"}+$val{"cjep"})).' -+ pjc = '.$val{"vjc"}.' -+ mjc = '.$val{"mjc"}.' -+ cjs = '.$val{"cjcp"}.' -+ pjs = '.$val{"vjs"}.' -+ mjs = '.$val{"mjs"}.' -+ bf = '.($val{"is"}/$val{"ibei"}).' -+ ise = '.$val{"iben"}.' -+ ne = '.$val{"nen"}.' -+ br = '.($val{"is"}/$val{"ibci"}).' -+ isc = '.$val{"ibcn"}.' -+ nc = '.$val{"ncn"}.' -+ vaf = '.$vaf.' -+ var = '.$var.' -+ ikf = '.$val{"ikf"}.' -+ ikr = '.$val{"ikr"}.' -+ tf = '.$val{"tf"}.' -+ xtf = '.$val{"xtf"}.' -+ vtf = '.$val{"vtf"}.' -+ itf = '.$val{"itf"}.' -+ tr = '.$val{"tr"}.' -+ ptf = '.($val{"td"}*180.0/($val{"tf"}*$Pi)).' -+ eg = '.$val{"ea"}.' -+ xti = '.$val{"xis"}.' -+ xtb = '.($val{"xis"}-$val{"xii"}).' -+ kf = '.$val{"kfn"}.' -+ af = '.$val{"afn"}; +#!/bin/sh -- # perl +eval 'exec perl -S -x -w $0 ${1+"$@"}' +if 0; + +# +# vbic2sgp: program to convert a VBIC .model card to SGP +# +# Vers Date Who Comments +# ==== ========== ============= ======== +# 1.0 07/17/00 Colin McAndrew modified sgp2vbic +# + +sub usage() { + print " +$prog: convert VBIC .model card to SGP .model card + +Usage: $prog [options] modelFile + +Files: + modelFile file with VBIC .model card + +Options: + -d debug mode + -h print this help message + -i print detailed information + -v verbose mode + -vbeif Vbe do fwd Early voltage map at Vbe ($Vbeif) + -vceif Vce do fwd Early voltage map at Vce ($Vceif) + -vbcir Vbc do rev Early voltage map at Vbc ($Vbcir) + -vecir Vec do rev Early voltage map at Vec ($Vecir) +"; +} # End of: sub usage + +sub info() { + print " +This program maps a VBIC .model card into an SGP .model card. +For many parameters there is a 1-to-1 mapping between the two, +and the default VBIC parameters are such that the model extensions +that are not part of SGP are turned off. However if the extensions +in VBIC are used, clearly they are not translated into SGP. + +In particular, note that using the separate ideality coefficients +for base current in VBIC will give a model that will NOT translate +into SGP properly. A simple calculation of BF(SGP)=IS(VBIC)/IBEI(VBIC) +is done, that will not be accurate if NEI(VBIC) is not equal to NF(VBIC). + +The Early effect model is different between VBIC and SGP, the bias +dependence is substantially better in VBIC than in SGP. This means +the models can be made to match only at specific biases. +These biases can be specified by the -vxxi[fr] flags. +"; +} # End of: sub info + +# +# Set program names and variables. +# + +$\="\n"; +$,=" "; +$Debug=""; +$Verbose=""; +$Number='([+-]?[0-9]+[.]?[0-9]*|[+-]?[0-9]+[.]?[0-9]*[eE][+-]?[0-9]+|[+-]?[.][0-9]+|[+-]?[.][0-9]+[eE][+-]?[0-9]+)'; +@prog=split("/",$0); +$prog=$prog[$#prog]; +$Pi=atan2(0,-1); +$Vbeif=0.6; +$Vceif=2.5; +$Vbcir=0.5; +$Vecir=2.5; + +# +# Parse command line arguments, allow argument +# flags to be any case. +# + +for (;;){ + if ($#ARGV < 0) { + last; + } elsif ($ARGV[0] =~ /^-d/i) { + $Debug="-d";$Verbose="-v"; + } elsif ($ARGV[0] =~ /^-h/i) { + &usage();exit(0); + } elsif ($ARGV[0] =~ /^-i/i) { + &info();exit(0); + } elsif ($ARGV[0] =~ /^-v$/i) { + $Verbose="-v"; + } elsif ($ARGV[0] =~ /^-vbeif$/i) { + shift(@ARGV); + if (!defined($ARGV[0])) { + die("ERROR: no value specified for -vbeif flag, stopped"); + } + $Vbeif=$ARGV[0]; + if ($Vbeif !~ /$Number/) { + die("ERROR: value for -vbeif flag must be a number, stopped"); + } + } elsif ($ARGV[0] =~ /^-vceif$/i) { + shift(@ARGV); + if (!defined($ARGV[0])) { + die("ERROR: no value specified for -vceif flag, stopped"); + } + $Vceif=$ARGV[0]; + if ($Vceif !~ /$Number/) { + die("ERROR: value for -vceif flag must be a number, stopped"); + } + } elsif ($ARGV[0] =~ /^-vbcir$/i) { + shift(@ARGV); + if (!defined($ARGV[0])) { + die("ERROR: no value specified for -vbcir flag, stopped"); + } + $Vbcir=$ARGV[0]; + if ($Vbcir !~ /$Number/) { + die("ERROR: value for -vbcir flag must be a number, stopped"); + } + } elsif ($ARGV[0] =~ /^-vecir$/i) { + shift(@ARGV); + if (!defined($ARGV[0])) { + die("ERROR: no value specified for -vecir flag, stopped"); + } + $Vecir=$ARGV[0]; + if ($Vecir !~ /$Number/) { + die("ERROR: value for -vecir flag must be a number, stopped"); + } + } elsif ($ARGV[0] =~ /^-/) { + &usage(); + die("ERROR: unknown flag $ARGV[0], stopped"); + } else { + last; + } + shift(@ARGV); +} +if ($#ARGV < 0) { + &usage();exit(1); # exit if no file name is specified +} + +$ModelFile=$ARGV[0]; + +sub QCDEPL { + my($vj,$p,$m,$f)=@_; + my($w,$xx,$cj,$qj); + + $w=1.0-$vj/$p; + if($w>=1.0-$f){ + $cj=$w**(-$m); + $qj=$p*(1.0-$w*$cj)/(1.0-$m); + } else { + $xx=(1.0-$f)**(-(1.0+$m)); + $cj=$xx*(1.0-$f*(1.0+$m)+$m*$vj/$p); + $qj=$xx*((1.0-$f*(1.0+$m))*($vj-$f*$p)+0.5*$m*($vj*$vj-$f*$f*$p*$p)/$p)+$p*(1.0-$xx*(1.0-$f)**2)/(1.0-$m); + } + return($qj,$cj); +} + +# +# Parse model file +# + +open(IF,"$ModelFile") || + die("ERROR: cannot open file $ModelFile, stopped"); +$inModel="no"; +while () { + chomp;tr/A-Z/a-z/; + if ($_ =~ /^\s*$/) {next;} + if ($_ =~ /^\s*\*/) {next;} + last if ($_ !~ /^\+/ && $inModel eq "yes"); + if ($_ =~ /^\s*\.mod/) { + $inModel="yes";$model=$_;next; + } + if ($inModel eq "yes") { + $_=~s/^\+\s*/ /;$model.=$_;next; + } +} +close(IF); +$model=~s/\s*=\s*/=/g; + +# +# Set VBIC parameters from .model card +# + +$val{"is"}=1.0e-16; +$val{"nf"}=1.0; +$val{"nr"}=1.0; +$val{"ibei"}=1.0e-18; +$val{"nei"}=1.0; +$val{"vef"}=0.0; +$val{"ikf"}=0.0; +$val{"iben"}=0.0; +$val{"nen"}=1.5; +$val{"ibci"}=1.0e-16; +$val{"nci"}=1.0; +$val{"ver"}=0.0; +$val{"ikr"}=0.0; +$val{"ibcn"}=0.0; +$val{"ncn"}=2.0; +$val{"rbx"}=0.0; +$val{"rbi"}=0.0; +$val{"re"}=0.0; +$val{"rcx"}=0.0; +$val{"rci"}=0.0; +$val{"cje"}=0.0; +$val{"vje"}=0.75; +$val{"mje"}=0.33; +$val{"fc"}=0.9; +$val{"cjc"}=0.0; +$val{"cjep"}=0.0; +$val{"vjc"}=0.75; +$val{"mjc"}=0.33; +$val{"cjcp"}=0.0; +$val{"vjs"}=0.75; +$val{"mjs"}=0.0; +$val{"tf"}=0.0; +$val{"xtf"}=0.0; +$val{"vtf"}=0.0; +$val{"itf"}=0.0; +$val{"tr"}=0.0; +$val{"td"}=0.0; +$val{"kfn"}=0.0; +$val{"afn"}=1.0; +$val{"ea"}=1.12; +$val{"eaie"}=1.12; +$val{"eaic"}=1.12; +$val{"eane"}=1.12; +$val{"eanc"}=1.12; +$val{"xis"}=3; +$val{"xii"}=3; +$val{"xin"}=3; +$alias{"ik"}="ikf"; +$alias{"pe"}="vje"; +$alias{"me"}="mje"; +$alias{"pc"}="vjc"; +$alias{"mc"}="mjc"; +$alias{"ps"}="vjs"; +$alias{"ms"}="mjs"; + +@Field=split(/\s+/,$model); +$name=$Field[1]; +for ($i=3;$i<=$#Field;++$i) { + die("ERROR: term $Field[$i] is not in name=value format, stopped") + if ($Field[$i] !~ /=/); + ($param,$value)=split(/=/,$Field[$i]); + die("ERROR: parameter $param must be a number, stopped") + if ($value !~ /$Number/); + if (defined($alias{$param})) {$param=$alias{$param};} + if (!defined($val{$param})) { + print STDERR "* WARNING: parameter $param is not supported in sgp"; + next; + } + $val{$param}=$value; +} +$Vbcif=$Vbeif-$Vceif; +$Vbeir=$Vbcir-$Vecir; +($qjbef,$cj )=&QCDEPL($Vbeif,$val{"vje"},$val{"mje"},$val{"fc"}); +($qjbcf,$cjbcf)=&QCDEPL($Vbcif,$val{"vjc"},$val{"mjc"},$val{"fc"}); +($qjber,$cjber)=&QCDEPL($Vbeir,$val{"vje"},$val{"mje"},$val{"fc"}); +($qjbcr,$cj )=&QCDEPL($Vbcir,$val{"vjc"},$val{"mjc"},$val{"fc"}); +$ivef=$val{"vef"};if($ivef>0){$ivef=1/$ivef;} +$iver=$val{"ver"};if($iver>0){$iver=1/$iver;} +$godIf=$cjbcf*$ivef/(1+$qjbef*$iver+$qjbcf*$ivef); +if($godIf<1e-10) {$godIf=1e-10;} +$godIr=$cjber*$iver/(1+$qjber*$iver+$qjbcr*$ivef); +if($godIr<1e-10) {$godIr=1e-10;} +$a11=-$Vbcif-1.0/$godIf; +$a12=-$Vbeif; +$r1 =-1.0; +$a21=-$Vbcir; +$a22=-$Vbeir-1.0/$godIr; +$r2 =-1.0; +$det=$a11*$a22-$a12*$a21; +$ivaf=($r1*$a22-$r2*$a12)/$det; +$ivar=($r2*$a11-$r1*$a21)/$det; +$vaf=1/$ivaf;$var=1/$ivar; + +print '.model '.$name.' sgp ++ rc = '.($val{"rcx"}+$val{"rci"}).' ++ rbm = '.$val{"rbx"}.' ++ rb = '.($val{"rbx"}+$val{"rbi"}).' ++ re = '.$val{"re"}.' ++ is = '.$val{"is"}.' ++ nf = '.$val{"nf"}.' ++ nr = '.$val{"nr"}.' ++ fc = '.$val{"fc"}.' ++ cje = '.$val{"cje"}.' ++ vje = '.$val{"vje"}.' ++ mje = '.$val{"mje"}.' ++ cjc = '.($val{"cjc"}+$val{"cjep"}).' ++ xcjc = '.($val{"cjc"}/($val{"cjc"}+$val{"cjep"})).' ++ pjc = '.$val{"vjc"}.' ++ mjc = '.$val{"mjc"}.' ++ cjs = '.$val{"cjcp"}.' ++ pjs = '.$val{"vjs"}.' ++ mjs = '.$val{"mjs"}.' ++ bf = '.($val{"is"}/$val{"ibei"}).' ++ ise = '.$val{"iben"}.' ++ ne = '.$val{"nen"}.' ++ br = '.($val{"is"}/$val{"ibci"}).' ++ isc = '.$val{"ibcn"}.' ++ nc = '.$val{"ncn"}.' ++ vaf = '.$vaf.' ++ var = '.$var.' ++ ikf = '.$val{"ikf"}.' ++ ikr = '.$val{"ikr"}.' ++ tf = '.$val{"tf"}.' ++ xtf = '.$val{"xtf"}.' ++ vtf = '.$val{"vtf"}.' ++ itf = '.$val{"itf"}.' ++ tr = '.$val{"tr"}.' ++ ptf = '.($val{"td"}*180.0/($val{"tf"}*$Pi)).' ++ eg = '.$val{"ea"}.' ++ xti = '.$val{"xis"}.' ++ xtb = '.($val{"xis"}-$val{"xii"}).' ++ kf = '.$val{"kfn"}.' ++ af = '.$val{"afn"}; diff --git a/src/spicelib/devices/mos9/mos9temp.c b/src/spicelib/devices/mos9/mos9temp.c index cd8d6dfe3..c0985a790 100644 --- a/src/spicelib/devices/mos9/mos9temp.c +++ b/src/spicelib/devices/mos9/mos9temp.c @@ -37,7 +37,7 @@ MOS9temp(GENmodel *inModel, CKTcircuit *ckt) double ni_temp, nifact; /* loop through all the mosfet models */ for( ; model != NULL; model = model->MOS9nextModel) { - + if(!model->MOS9tnomGiven) { model->MOS9tnom = ckt->CKTnomTemp; } @@ -52,7 +52,7 @@ MOS9temp(GENmodel *inModel, CKTcircuit *ckt) nifact=(model->MOS9tnom/300)*sqrt(model->MOS9tnom/300); nifact*=exp(0.5*egfet1*((1/(double)300)-(1/model->MOS9tnom))/ CONSTKoverQ); - ni_temp=1.45e16*nifact; + ni_temp=1.45e16*nifact; model->MOS9oxideCapFactor = 3.9 * 8.854214871e-12/ @@ -87,11 +87,11 @@ MOS9temp(GENmodel *inModel, CKTcircuit *ckt) 1e6 /*(cm**3/m**3)*/ )/ model->MOS9oxideCapFactor; } if(!model->MOS9vt0Given) { - if(!model->MOS9surfaceStateDensityGiven) + if(!model->MOS9surfaceStateDensityGiven) model->MOS9surfaceStateDensity=0; - vfb = wkfngs - model->MOS9surfaceStateDensity * 1e4 + vfb = wkfngs - model->MOS9surfaceStateDensity * 1e4 * CHARGE/model->MOS9oxideCapFactor; - model->MOS9vt0 = vfb + model->MOS9type * + model->MOS9vt0 = vfb + model->MOS9type * (model->MOS9gamma * sqrt(model->MOS9phi)+ model->MOS9phi); } else { @@ -109,12 +109,12 @@ MOS9temp(GENmodel *inModel, CKTcircuit *ckt) } } /* now model parameter preprocessing */ - model->MOS9narrowFactor = model->MOS9delta * 0.5 * M_PI * EPSSIL / + model->MOS9narrowFactor = model->MOS9delta * 0.5 * M_PI * EPSSIL / model->MOS9oxideCapFactor ; - + /* loop through all instances of the model */ - for(here = model->MOS9instances; here!= NULL; + for(here = model->MOS9instances; here!= NULL; here = here->MOS9nextInstance) { double czbd; /* zero voltage bulk-drain capacitance */ @@ -167,7 +167,7 @@ MOS9temp(GENmodel *inModel, CKTcircuit *ckt) } else if (model->MOS9sheetResistanceGiven) { if ((model->MOS9sheetResistance != 0) && (here->MOS9drainSquares != 0)) { - here->MOS9drainConductance = + here->MOS9drainConductance = here->MOS9m / (model->MOS9sheetResistance*here->MOS9drainSquares); } else { @@ -186,7 +186,7 @@ MOS9temp(GENmodel *inModel, CKTcircuit *ckt) } else if (model->MOS9sheetResistanceGiven) { if ((model->MOS9sheetResistance != 0) && (here->MOS9sourceSquares != 0)) { - here->MOS9sourceConductance = + here->MOS9sourceConductance = here->MOS9m / (model->MOS9sheetResistance*here->MOS9sourceSquares); } else { @@ -218,15 +218,15 @@ MOS9temp(GENmodel *inModel, CKTcircuit *ckt) here->MOS9tSurfMob = model->MOS9surfaceMobility/ratio4; phio= (model->MOS9phi-pbfact1)/fact1; here->MOS9tPhi = fact2 * phio + pbfact; - here->MOS9tVbi = + here->MOS9tVbi = model->MOS9delvt0 + - model->MOS9vt0 - model->MOS9type * + model->MOS9vt0 - model->MOS9type * (model->MOS9gamma* sqrt(model->MOS9phi)) - +.5*(egfet1-egfet) + +.5*(egfet1-egfet) + model->MOS9type*.5* (here->MOS9tPhi-model->MOS9phi); - here->MOS9tVto = here->MOS9tVbi + model->MOS9type * + here->MOS9tVto = here->MOS9tVbi + model->MOS9type * model->MOS9gamma * sqrt(here->MOS9tPhi); - here->MOS9tSatCur = model->MOS9jctSatCur* + here->MOS9tSatCur = model->MOS9jctSatCur* exp(-egfet/vt+egfet1/vtnom); here->MOS9tSatCurDens = model->MOS9jctSatCurDensity * exp(-egfet/vt+egfet1/vtnom); diff --git a/src/xspice/examples/d_to_real/Makefile b/src/xspice/examples/d_to_real/Makefile index d2d2af97e..dfbcc8f7d 100755 --- a/src/xspice/examples/d_to_real/Makefile +++ b/src/xspice/examples/d_to_real/Makefile @@ -1,40 +1,38 @@ -# $Id$ -# -# Makefile for Code Model directories -# - -# Include global XSPICE selections for CC and other macros -include /usr/local/xspice-1-0/include/make.include - -INCLUDE = -I. -I$(ROOT)/include/sim - -CFLAGS = -g - -#----------------------------------------------------------------------------- -# Edit the following definition to specify the object files that comprise -# your code model. If your code model is completely specified in the -# cfunc.mod file, there is no need to edit this definition. -# DO NOT include the ifspec.o file. - -CODE_MODEL_OBJECTS = cfunc.o - -#----------------------------------------------------------------------------- -# DO NOT MODIFY THE FOLLOWING DEFINITIONS: - -.SUFFIXES: $(SUFFIXES) .mod .ifs - -.mod.c: - $(BINDIR)/cmpp -mod $< - -.ifs.c: - $(BINDIR)/cmpp -ifs - -.c.o: $*.c - ${CC} ${CFLAGS} ${INCLUDE} -c $*.c - -all : ifspec.o $(CODE_MODEL_OBJECTS) - -cfunc.o : cfunc.c -ifspec.o : ifspec.c - - +# $Id$ +# +# Makefile for Code Model directories +# + +# Include global XSPICE selections for CC and other macros +include /usr/local/xspice-1-0/include/make.include + +INCLUDE = -I. -I$(ROOT)/include/sim + +CFLAGS = -g + +#----------------------------------------------------------------------------- +# Edit the following definition to specify the object files that comprise +# your code model. If your code model is completely specified in the +# cfunc.mod file, there is no need to edit this definition. +# DO NOT include the ifspec.o file. + +CODE_MODEL_OBJECTS = cfunc.o + +#----------------------------------------------------------------------------- +# DO NOT MODIFY THE FOLLOWING DEFINITIONS: + +.SUFFIXES: $(SUFFIXES) .mod .ifs + +.mod.c: + $(BINDIR)/cmpp -mod $< + +.ifs.c: + $(BINDIR)/cmpp -ifs + +.c.o: $*.c + ${CC} ${CFLAGS} ${INCLUDE} -c $*.c + +all : ifspec.o $(CODE_MODEL_OBJECTS) + +cfunc.o : cfunc.c +ifspec.o : ifspec.c diff --git a/src/xspice/examples/d_to_real/cfunc.mod b/src/xspice/examples/d_to_real/cfunc.mod index 079fc78ca..25fa24c92 100755 --- a/src/xspice/examples/d_to_real/cfunc.mod +++ b/src/xspice/examples/d_to_real/cfunc.mod @@ -1,43 +1,39 @@ -/* $Id$ */ - -void ucm_d_to_real (ARGS) -{ - - Digital_State_t in; - - double *out; - double delay; - double zero; - double one; - double ena; - - - in = INPUT_STATE(in); - if(PORT_NULL(enable)) - ena = 1.0; - else if(INPUT_STATE(enable) == ONE) - ena = 1.0; - else - ena = 0.0; - out = OUTPUT(out); - - zero = PARAM(zero); - one = PARAM(one); - delay = PARAM(delay); - - - if(in == ZERO) - *out = zero * ena; - else if(in == UNKNOWN) - *out = (zero + one) / 2.0 * ena; - else - *out = one * ena; - - if(TIME > 0.0) - OUTPUT_DELAY(out) = delay; - -} - - - - +/* $Id$ */ + +void ucm_d_to_real (ARGS) +{ + + Digital_State_t in; + + double *out; + double delay; + double zero; + double one; + double ena; + + + in = INPUT_STATE(in); + if(PORT_NULL(enable)) + ena = 1.0; + else if(INPUT_STATE(enable) == ONE) + ena = 1.0; + else + ena = 0.0; + out = OUTPUT(out); + + zero = PARAM(zero); + one = PARAM(one); + delay = PARAM(delay); + + + if(in == ZERO) + *out = zero * ena; + else if(in == UNKNOWN) + *out = (zero + one) / 2.0 * ena; + else + *out = one * ena; + + if(TIME > 0.0) + OUTPUT_DELAY(out) = delay; + +} diff --git a/src/xspice/examples/d_to_real/ifspec.ifs b/src/xspice/examples/d_to_real/ifspec.ifs index eb2300c82..29369a966 100755 --- a/src/xspice/examples/d_to_real/ifspec.ifs +++ b/src/xspice/examples/d_to_real/ifspec.ifs @@ -1,32 +1,32 @@ -/* $Id$ */ - -NAME_TABLE: - -Spice_Model_Name: d_to_real -C_Function_Name: ucm_d_to_real -Description: "Node bridge from digital to real with enable" - - -PORT_TABLE: - -Port_Name: in enable out -Description: "input" "enable" "output" -Direction: in in out -Default_Type: d d real -Allowed_Types: [d] [d] [real] -Vector: no no no -Vector_Bounds: - - - -Null_Allowed: no yes no - - -PARAMETER_TABLE: - -Parameter_Name: zero one delay -Description: "value for 0" "value for 1" "delay" -Data_Type: real real real -Default_Value: 0.0 1.0 1e-9 -Limits: - - [1e-15 -] -Vector: no no no -Vector_Bounds: - - - -Null_Allowed: yes yes yes - +/* $Id$ */ + +NAME_TABLE: + +Spice_Model_Name: d_to_real +C_Function_Name: ucm_d_to_real +Description: "Node bridge from digital to real with enable" + + +PORT_TABLE: + +Port_Name: in enable out +Description: "input" "enable" "output" +Direction: in in out +Default_Type: d d real +Allowed_Types: [d] [d] [real] +Vector: no no no +Vector_Bounds: - - - +Null_Allowed: no yes no + + +PARAMETER_TABLE: + +Parameter_Name: zero one delay +Description: "value for 0" "value for 1" "delay" +Data_Type: real real real +Default_Value: 0.0 1.0 1e-9 +Limits: - - [1e-15 -] +Vector: no no no +Vector_Bounds: - - - +Null_Allowed: yes yes yes + diff --git a/src/xspice/examples/nco/Makefile b/src/xspice/examples/nco/Makefile index d2d2af97e..dfbcc8f7d 100755 --- a/src/xspice/examples/nco/Makefile +++ b/src/xspice/examples/nco/Makefile @@ -1,40 +1,38 @@ -# $Id$ -# -# Makefile for Code Model directories -# - -# Include global XSPICE selections for CC and other macros -include /usr/local/xspice-1-0/include/make.include - -INCLUDE = -I. -I$(ROOT)/include/sim - -CFLAGS = -g - -#----------------------------------------------------------------------------- -# Edit the following definition to specify the object files that comprise -# your code model. If your code model is completely specified in the -# cfunc.mod file, there is no need to edit this definition. -# DO NOT include the ifspec.o file. - -CODE_MODEL_OBJECTS = cfunc.o - -#----------------------------------------------------------------------------- -# DO NOT MODIFY THE FOLLOWING DEFINITIONS: - -.SUFFIXES: $(SUFFIXES) .mod .ifs - -.mod.c: - $(BINDIR)/cmpp -mod $< - -.ifs.c: - $(BINDIR)/cmpp -ifs - -.c.o: $*.c - ${CC} ${CFLAGS} ${INCLUDE} -c $*.c - -all : ifspec.o $(CODE_MODEL_OBJECTS) - -cfunc.o : cfunc.c -ifspec.o : ifspec.c - - +# $Id$ +# +# Makefile for Code Model directories +# + +# Include global XSPICE selections for CC and other macros +include /usr/local/xspice-1-0/include/make.include + +INCLUDE = -I. -I$(ROOT)/include/sim + +CFLAGS = -g + +#----------------------------------------------------------------------------- +# Edit the following definition to specify the object files that comprise +# your code model. If your code model is completely specified in the +# cfunc.mod file, there is no need to edit this definition. +# DO NOT include the ifspec.o file. + +CODE_MODEL_OBJECTS = cfunc.o + +#----------------------------------------------------------------------------- +# DO NOT MODIFY THE FOLLOWING DEFINITIONS: + +.SUFFIXES: $(SUFFIXES) .mod .ifs + +.mod.c: + $(BINDIR)/cmpp -mod $< + +.ifs.c: + $(BINDIR)/cmpp -ifs + +.c.o: $*.c + ${CC} ${CFLAGS} ${INCLUDE} -c $*.c + +all : ifspec.o $(CODE_MODEL_OBJECTS) + +cfunc.o : cfunc.c +ifspec.o : ifspec.c diff --git a/src/xspice/examples/nco/ifspec.ifs b/src/xspice/examples/nco/ifspec.ifs index 30cdba5d7..42cede661 100755 --- a/src/xspice/examples/nco/ifspec.ifs +++ b/src/xspice/examples/nco/ifspec.ifs @@ -1,38 +1,38 @@ -/* $Id$ */ - -NAME_TABLE: - -Spice_Model_Name: nco -C_Function_Name: ucm_nco -Description: "A simple MIDI numerically controlled oscillator" - - -PORT_TABLE: - -Port_Name: in out -Description: "program input" "oscillator output" -Direction: in out -Default_Type: d d -Allowed_Types: [d] [d] -Vector: yes no -Vector_Bounds: [7 7] - -Null_Allowed: no no - - -PARAMETER_TABLE: - -Parameter_Name: delay mult_factor -Description: "output delay" "freq multiplier" -Data_Type: real real -Default_Value: 1e-9 1 -Limits: [1e-15 -] [1e-9 -] -Vector: no no -Vector_Bounds: - - -Null_Allowed: yes yes - - -STATIC_VAR_TABLE: - -Static_Var_Name: freq -Data_Type: pointer -Description: "frequencies of notes" +/* $Id$ */ + +NAME_TABLE: + +Spice_Model_Name: nco +C_Function_Name: ucm_nco +Description: "A simple MIDI numerically controlled oscillator" + + +PORT_TABLE: + +Port_Name: in out +Description: "program input" "oscillator output" +Direction: in out +Default_Type: d d +Allowed_Types: [d] [d] +Vector: yes no +Vector_Bounds: [7 7] - +Null_Allowed: no no + + +PARAMETER_TABLE: + +Parameter_Name: delay mult_factor +Description: "output delay" "freq multiplier" +Data_Type: real real +Default_Value: 1e-9 1 +Limits: [1e-15 -] [1e-9 -] +Vector: no no +Vector_Bounds: - - +Null_Allowed: yes yes + + +STATIC_VAR_TABLE: + +Static_Var_Name: freq +Data_Type: pointer +Description: "frequencies of notes" diff --git a/src/xspice/examples/print_param_types/Makefile b/src/xspice/examples/print_param_types/Makefile index d2d2af97e..dfbcc8f7d 100755 --- a/src/xspice/examples/print_param_types/Makefile +++ b/src/xspice/examples/print_param_types/Makefile @@ -1,40 +1,38 @@ -# $Id$ -# -# Makefile for Code Model directories -# - -# Include global XSPICE selections for CC and other macros -include /usr/local/xspice-1-0/include/make.include - -INCLUDE = -I. -I$(ROOT)/include/sim - -CFLAGS = -g - -#----------------------------------------------------------------------------- -# Edit the following definition to specify the object files that comprise -# your code model. If your code model is completely specified in the -# cfunc.mod file, there is no need to edit this definition. -# DO NOT include the ifspec.o file. - -CODE_MODEL_OBJECTS = cfunc.o - -#----------------------------------------------------------------------------- -# DO NOT MODIFY THE FOLLOWING DEFINITIONS: - -.SUFFIXES: $(SUFFIXES) .mod .ifs - -.mod.c: - $(BINDIR)/cmpp -mod $< - -.ifs.c: - $(BINDIR)/cmpp -ifs - -.c.o: $*.c - ${CC} ${CFLAGS} ${INCLUDE} -c $*.c - -all : ifspec.o $(CODE_MODEL_OBJECTS) - -cfunc.o : cfunc.c -ifspec.o : ifspec.c - - +# $Id$ +# +# Makefile for Code Model directories +# + +# Include global XSPICE selections for CC and other macros +include /usr/local/xspice-1-0/include/make.include + +INCLUDE = -I. -I$(ROOT)/include/sim + +CFLAGS = -g + +#----------------------------------------------------------------------------- +# Edit the following definition to specify the object files that comprise +# your code model. If your code model is completely specified in the +# cfunc.mod file, there is no need to edit this definition. +# DO NOT include the ifspec.o file. + +CODE_MODEL_OBJECTS = cfunc.o + +#----------------------------------------------------------------------------- +# DO NOT MODIFY THE FOLLOWING DEFINITIONS: + +.SUFFIXES: $(SUFFIXES) .mod .ifs + +.mod.c: + $(BINDIR)/cmpp -mod $< + +.ifs.c: + $(BINDIR)/cmpp -ifs + +.c.o: $*.c + ${CC} ${CFLAGS} ${INCLUDE} -c $*.c + +all : ifspec.o $(CODE_MODEL_OBJECTS) + +cfunc.o : cfunc.c +ifspec.o : ifspec.c diff --git a/src/xspice/examples/print_param_types/cfunc.mod b/src/xspice/examples/print_param_types/cfunc.mod index 8cf7d02ca..f6762d74b 100755 --- a/src/xspice/examples/print_param_types/cfunc.mod +++ b/src/xspice/examples/print_param_types/cfunc.mod @@ -1,33 +1,29 @@ -/* $Id$ */ - -void ucm_print_param_types (ARGS) -{ - int i; - - if(INIT) { - /* Print scalar parameters */ - printf("\nScalar parameters\n\n"); - printf("integer = %d\n", PARAM(integer)); - printf("real = %e\n", PARAM(real)); - printf("complex = <%e %e>\n", PARAM(complex).real, - PARAM(complex).imag); - printf("string = %s\n", PARAM(string)); - - /* Print vector parameters */ - printf("\nVector parameters\n\n"); - for(i = 0; i < PARAM_SIZE(integer_array); i++) - printf("integer = %d\n", PARAM(integer_array[i])); - for(i = 0; i < PARAM_SIZE(real_array); i++) - printf("real = %e\n", PARAM(real_array[i])); - for(i = 0; i < PARAM_SIZE(complex_array); i++) - printf("complex = <%e %e>\n", PARAM(complex_array[i]).real, - PARAM(complex_array[i]).imag); - for(i = 0; i < PARAM_SIZE(string_array); i++) - printf("string = %s\n", PARAM(string_array[i])); - - } -} - - - - +/* $Id$ */ + +void ucm_print_param_types (ARGS) +{ + int i; + + if(INIT) { + /* Print scalar parameters */ + printf("\nScalar parameters\n\n"); + printf("integer = %d\n", PARAM(integer)); + printf("real = %e\n", PARAM(real)); + printf("complex = <%e %e>\n", PARAM(complex).real, + PARAM(complex).imag); + printf("string = %s\n", PARAM(string)); + + /* Print vector parameters */ + printf("\nVector parameters\n\n"); + for(i = 0; i < PARAM_SIZE(integer_array); i++) + printf("integer = %d\n", PARAM(integer_array[i])); + for(i = 0; i < PARAM_SIZE(real_array); i++) + printf("real = %e\n", PARAM(real_array[i])); + for(i = 0; i < PARAM_SIZE(complex_array); i++) + printf("complex = <%e %e>\n", PARAM(complex_array[i]).real, + PARAM(complex_array[i]).imag); + for(i = 0; i < PARAM_SIZE(string_array); i++) + printf("string = %s\n", PARAM(string_array[i])); + + } +} diff --git a/src/xspice/examples/print_param_types/ifspec.ifs b/src/xspice/examples/print_param_types/ifspec.ifs index e836df007..fe93bd56b 100755 --- a/src/xspice/examples/print_param_types/ifspec.ifs +++ b/src/xspice/examples/print_param_types/ifspec.ifs @@ -1,112 +1,112 @@ -/* $Id$ */ - -NAME_TABLE: - -Spice_Model_Name: print_param_types -C_Function_Name: ucm_print_param_types -Description: "ignores its input, but prints its parameters" - - -PORT_TABLE: - - -Port_Name: in -Description: "input" -Direction: in -Default_Type: v -Allowed_Types: [v,vd,i,id,vnam] -Vector: yes -Vector_Bounds: - -Null_Allowed: no - - - -PARAMETER_TABLE: - -Parameter_Name: integer -Description: "integer parameter" -Data_Type: int -Default_Value: 1 -Limits: - -Vector: no -Vector_Bounds: - -Null_Allowed: yes - -PARAMETER_TABLE: - -Parameter_Name: real -Description: "real parameter" -Data_Type: real -Default_Value: 1 -Limits: - -Vector: no -Vector_Bounds: - -Null_Allowed: yes - -PARAMETER_TABLE: - -Parameter_Name: complex -Description: "complex parameter" -Data_Type: complex -Default_Value: <1.0, 1.0> -Limits: - -Vector: no -Vector_Bounds: - -Null_Allowed: yes - -PARAMETER_TABLE: - -Parameter_Name: string -Description: "string parameter" -Data_Type: string -Default_Value: "one" -Limits: - -Vector: no -Vector_Bounds: - -Null_Allowed: yes - -PARAMETER_TABLE: - -Parameter_Name: integer_array -Description: "integer array parameter" -Data_Type: int -Default_Value: 1 -Limits: - -Vector: yes -Vector_Bounds: in -Null_Allowed: yes - -PARAMETER_TABLE: - -Parameter_Name: real_array -Description: "real array parameter" -Data_Type: real -Default_Value: 1 -Limits: - -Vector: yes -Vector_Bounds: in -Null_Allowed: yes - -PARAMETER_TABLE: - -Parameter_Name: complex_array -Description: "complex array parameter" -Data_Type: complex -Default_Value: <1.0 1.0> -Limits: - -Vector: yes -Vector_Bounds: in -Null_Allowed: yes - -PARAMETER_TABLE: - -Parameter_Name: string_array -Description: "string array parameter" -Data_Type: string -Default_Value: "one" -Limits: - -Vector: yes -Vector_Bounds: in -Null_Allowed: yes - - +/* $Id$ */ + +NAME_TABLE: + +Spice_Model_Name: print_param_types +C_Function_Name: ucm_print_param_types +Description: "ignores its input, but prints its parameters" + + +PORT_TABLE: + + +Port_Name: in +Description: "input" +Direction: in +Default_Type: v +Allowed_Types: [v,vd,i,id,vnam] +Vector: yes +Vector_Bounds: - +Null_Allowed: no + + + +PARAMETER_TABLE: + +Parameter_Name: integer +Description: "integer parameter" +Data_Type: int +Default_Value: 1 +Limits: - +Vector: no +Vector_Bounds: - +Null_Allowed: yes + +PARAMETER_TABLE: + +Parameter_Name: real +Description: "real parameter" +Data_Type: real +Default_Value: 1 +Limits: - +Vector: no +Vector_Bounds: - +Null_Allowed: yes + +PARAMETER_TABLE: + +Parameter_Name: complex +Description: "complex parameter" +Data_Type: complex +Default_Value: <1.0, 1.0> +Limits: - +Vector: no +Vector_Bounds: - +Null_Allowed: yes + +PARAMETER_TABLE: + +Parameter_Name: string +Description: "string parameter" +Data_Type: string +Default_Value: "one" +Limits: - +Vector: no +Vector_Bounds: - +Null_Allowed: yes + +PARAMETER_TABLE: + +Parameter_Name: integer_array +Description: "integer array parameter" +Data_Type: int +Default_Value: 1 +Limits: - +Vector: yes +Vector_Bounds: in +Null_Allowed: yes + +PARAMETER_TABLE: + +Parameter_Name: real_array +Description: "real array parameter" +Data_Type: real +Default_Value: 1 +Limits: - +Vector: yes +Vector_Bounds: in +Null_Allowed: yes + +PARAMETER_TABLE: + +Parameter_Name: complex_array +Description: "complex array parameter" +Data_Type: complex +Default_Value: <1.0 1.0> +Limits: - +Vector: yes +Vector_Bounds: in +Null_Allowed: yes + +PARAMETER_TABLE: + +Parameter_Name: string_array +Description: "string array parameter" +Data_Type: string +Default_Value: "one" +Limits: - +Vector: yes +Vector_Bounds: in +Null_Allowed: yes + + diff --git a/src/xspice/examples/real_delay/Makefile b/src/xspice/examples/real_delay/Makefile index d2d2af97e..dfbcc8f7d 100755 --- a/src/xspice/examples/real_delay/Makefile +++ b/src/xspice/examples/real_delay/Makefile @@ -1,40 +1,38 @@ -# $Id$ -# -# Makefile for Code Model directories -# - -# Include global XSPICE selections for CC and other macros -include /usr/local/xspice-1-0/include/make.include - -INCLUDE = -I. -I$(ROOT)/include/sim - -CFLAGS = -g - -#----------------------------------------------------------------------------- -# Edit the following definition to specify the object files that comprise -# your code model. If your code model is completely specified in the -# cfunc.mod file, there is no need to edit this definition. -# DO NOT include the ifspec.o file. - -CODE_MODEL_OBJECTS = cfunc.o - -#----------------------------------------------------------------------------- -# DO NOT MODIFY THE FOLLOWING DEFINITIONS: - -.SUFFIXES: $(SUFFIXES) .mod .ifs - -.mod.c: - $(BINDIR)/cmpp -mod $< - -.ifs.c: - $(BINDIR)/cmpp -ifs - -.c.o: $*.c - ${CC} ${CFLAGS} ${INCLUDE} -c $*.c - -all : ifspec.o $(CODE_MODEL_OBJECTS) - -cfunc.o : cfunc.c -ifspec.o : ifspec.c - - +# $Id$ +# +# Makefile for Code Model directories +# + +# Include global XSPICE selections for CC and other macros +include /usr/local/xspice-1-0/include/make.include + +INCLUDE = -I. -I$(ROOT)/include/sim + +CFLAGS = -g + +#----------------------------------------------------------------------------- +# Edit the following definition to specify the object files that comprise +# your code model. If your code model is completely specified in the +# cfunc.mod file, there is no need to edit this definition. +# DO NOT include the ifspec.o file. + +CODE_MODEL_OBJECTS = cfunc.o + +#----------------------------------------------------------------------------- +# DO NOT MODIFY THE FOLLOWING DEFINITIONS: + +.SUFFIXES: $(SUFFIXES) .mod .ifs + +.mod.c: + $(BINDIR)/cmpp -mod $< + +.ifs.c: + $(BINDIR)/cmpp -ifs + +.c.o: $*.c + ${CC} ${CFLAGS} ${INCLUDE} -c $*.c + +all : ifspec.o $(CODE_MODEL_OBJECTS) + +cfunc.o : cfunc.c +ifspec.o : ifspec.c diff --git a/src/xspice/examples/real_delay/ifspec.ifs b/src/xspice/examples/real_delay/ifspec.ifs index 603bbee27..20c6413ca 100755 --- a/src/xspice/examples/real_delay/ifspec.ifs +++ b/src/xspice/examples/real_delay/ifspec.ifs @@ -1,33 +1,33 @@ -/* $Id$ */ - -NAME_TABLE: - -Spice_Model_Name: real_delay -C_Function_Name: ucm_real_delay -Description: "A Z ** -1 block working on real data" - - -PORT_TABLE: - -Port_Name: in clk out -Description: "input" "clock" "output" -Direction: in in out -Default_Type: real d real -Allowed_Types: [real] [d] [real] -Vector: no no no -Vector_Bounds: - - - -Null_Allowed: no no no - - -PARAMETER_TABLE: - -Parameter_Name: delay -Description: "delay from clk to out" -Data_Type: real -Default_Value: 1e-9 -Limits: [1e-15 -] -Vector: no -Vector_Bounds: - -Null_Allowed: yes - - +/* $Id$ */ + +NAME_TABLE: + +Spice_Model_Name: real_delay +C_Function_Name: ucm_real_delay +Description: "A Z ** -1 block working on real data" + + +PORT_TABLE: + +Port_Name: in clk out +Description: "input" "clock" "output" +Direction: in in out +Default_Type: real d real +Allowed_Types: [real] [d] [real] +Vector: no no no +Vector_Bounds: - - - +Null_Allowed: no no no + + +PARAMETER_TABLE: + +Parameter_Name: delay +Description: "delay from clk to out" +Data_Type: real +Default_Value: 1e-9 +Limits: [1e-15 -] +Vector: no +Vector_Bounds: - +Null_Allowed: yes + + diff --git a/src/xspice/examples/real_gain/Makefile b/src/xspice/examples/real_gain/Makefile index d2d2af97e..dfbcc8f7d 100755 --- a/src/xspice/examples/real_gain/Makefile +++ b/src/xspice/examples/real_gain/Makefile @@ -1,40 +1,38 @@ -# $Id$ -# -# Makefile for Code Model directories -# - -# Include global XSPICE selections for CC and other macros -include /usr/local/xspice-1-0/include/make.include - -INCLUDE = -I. -I$(ROOT)/include/sim - -CFLAGS = -g - -#----------------------------------------------------------------------------- -# Edit the following definition to specify the object files that comprise -# your code model. If your code model is completely specified in the -# cfunc.mod file, there is no need to edit this definition. -# DO NOT include the ifspec.o file. - -CODE_MODEL_OBJECTS = cfunc.o - -#----------------------------------------------------------------------------- -# DO NOT MODIFY THE FOLLOWING DEFINITIONS: - -.SUFFIXES: $(SUFFIXES) .mod .ifs - -.mod.c: - $(BINDIR)/cmpp -mod $< - -.ifs.c: - $(BINDIR)/cmpp -ifs - -.c.o: $*.c - ${CC} ${CFLAGS} ${INCLUDE} -c $*.c - -all : ifspec.o $(CODE_MODEL_OBJECTS) - -cfunc.o : cfunc.c -ifspec.o : ifspec.c - - +# $Id$ +# +# Makefile for Code Model directories +# + +# Include global XSPICE selections for CC and other macros +include /usr/local/xspice-1-0/include/make.include + +INCLUDE = -I. -I$(ROOT)/include/sim + +CFLAGS = -g + +#----------------------------------------------------------------------------- +# Edit the following definition to specify the object files that comprise +# your code model. If your code model is completely specified in the +# cfunc.mod file, there is no need to edit this definition. +# DO NOT include the ifspec.o file. + +CODE_MODEL_OBJECTS = cfunc.o + +#----------------------------------------------------------------------------- +# DO NOT MODIFY THE FOLLOWING DEFINITIONS: + +.SUFFIXES: $(SUFFIXES) .mod .ifs + +.mod.c: + $(BINDIR)/cmpp -mod $< + +.ifs.c: + $(BINDIR)/cmpp -ifs + +.c.o: $*.c + ${CC} ${CFLAGS} ${INCLUDE} -c $*.c + +all : ifspec.o $(CODE_MODEL_OBJECTS) + +cfunc.o : cfunc.c +ifspec.o : ifspec.c diff --git a/src/xspice/examples/real_gain/cfunc.mod b/src/xspice/examples/real_gain/cfunc.mod index f6934ccc3..0cdb365fe 100755 --- a/src/xspice/examples/real_gain/cfunc.mod +++ b/src/xspice/examples/real_gain/cfunc.mod @@ -1,39 +1,37 @@ -/* $Id$ */ - -void ucm_real_gain (ARGS) -{ - double *in; - double *out; - - double in_offset; - double gain; - double out_offset; - double delay; - double ic; - - - /* Get the input and output pointers */ - in = INPUT(in); - out = OUTPUT(out); - - /* Get the parameters */ - in_offset = PARAM(in_offset); - gain = PARAM(gain); - out_offset = PARAM(out_offset); - delay = PARAM(delay); - ic = PARAM(ic); - - - /* Assign the output and delay */ - if(ANALYSIS == DC) { - *out = ic; - if(INIT) - cm_event_queue(delay); - } - else { - *out = gain * (*in + in_offset) + out_offset; - OUTPUT_DELAY(out) = delay; - } -} - - +/* $Id$ */ + +void ucm_real_gain (ARGS) +{ + double *in; + double *out; + + double in_offset; + double gain; + double out_offset; + double delay; + double ic; + + + /* Get the input and output pointers */ + in = INPUT(in); + out = OUTPUT(out); + + /* Get the parameters */ + in_offset = PARAM(in_offset); + gain = PARAM(gain); + out_offset = PARAM(out_offset); + delay = PARAM(delay); + ic = PARAM(ic); + + + /* Assign the output and delay */ + if(ANALYSIS == DC) { + *out = ic; + if(INIT) + cm_event_queue(delay); + } + else { + *out = gain * (*in + in_offset) + out_offset; + OUTPUT_DELAY(out) = delay; + } +} diff --git a/src/xspice/examples/real_gain/ifspec.ifs b/src/xspice/examples/real_gain/ifspec.ifs index 886acfdcb..b6a8005a9 100755 --- a/src/xspice/examples/real_gain/ifspec.ifs +++ b/src/xspice/examples/real_gain/ifspec.ifs @@ -1,45 +1,45 @@ -/* $Id$ */ - -NAME_TABLE: - -Spice_Model_Name: real_gain -C_Function_Name: ucm_real_gain -Description: "A gain block for event-driven real data" - - -PORT_TABLE: - -Port_Name: in out -Description: "input" "output" -Direction: in out -Default_Type: real real -Allowed_Types: [real] [real] -Vector: no no -Vector_Bounds: - - -Null_Allowed: no no - - -PARAMETER_TABLE: - -Parameter_Name: in_offset gain out_offset -Description: "input offset" "gain" "output offset" -Data_Type: real real real -Default_Value: 0.0 1.0 0.0 -Limits: - - - -Vector: no no no -Vector_Bounds: - - - -Null_Allowed: yes yes yes - - -PARAMETER_TABLE: - -Parameter_Name: delay ic -Description: "delay" "initial condition" -Data_Type: real real -Default_Value: 1.0e-9 0.0 -Limits: - - -Vector: no no -Vector_Bounds: - - -Null_Allowed: yes yes - - +/* $Id$ */ + +NAME_TABLE: + +Spice_Model_Name: real_gain +C_Function_Name: ucm_real_gain +Description: "A gain block for event-driven real data" + + +PORT_TABLE: + +Port_Name: in out +Description: "input" "output" +Direction: in out +Default_Type: real real +Allowed_Types: [real] [real] +Vector: no no +Vector_Bounds: - - +Null_Allowed: no no + + +PARAMETER_TABLE: + +Parameter_Name: in_offset gain out_offset +Description: "input offset" "gain" "output offset" +Data_Type: real real real +Default_Value: 0.0 1.0 0.0 +Limits: - - - +Vector: no no no +Vector_Bounds: - - - +Null_Allowed: yes yes yes + + +PARAMETER_TABLE: + +Parameter_Name: delay ic +Description: "delay" "initial condition" +Data_Type: real real +Default_Value: 1.0e-9 0.0 +Limits: - - +Vector: no no +Vector_Bounds: - - +Null_Allowed: yes yes + + diff --git a/src/xspice/examples/real_to_v/Makefile b/src/xspice/examples/real_to_v/Makefile index d2d2af97e..dfbcc8f7d 100755 --- a/src/xspice/examples/real_to_v/Makefile +++ b/src/xspice/examples/real_to_v/Makefile @@ -1,40 +1,38 @@ -# $Id$ -# -# Makefile for Code Model directories -# - -# Include global XSPICE selections for CC and other macros -include /usr/local/xspice-1-0/include/make.include - -INCLUDE = -I. -I$(ROOT)/include/sim - -CFLAGS = -g - -#----------------------------------------------------------------------------- -# Edit the following definition to specify the object files that comprise -# your code model. If your code model is completely specified in the -# cfunc.mod file, there is no need to edit this definition. -# DO NOT include the ifspec.o file. - -CODE_MODEL_OBJECTS = cfunc.o - -#----------------------------------------------------------------------------- -# DO NOT MODIFY THE FOLLOWING DEFINITIONS: - -.SUFFIXES: $(SUFFIXES) .mod .ifs - -.mod.c: - $(BINDIR)/cmpp -mod $< - -.ifs.c: - $(BINDIR)/cmpp -ifs - -.c.o: $*.c - ${CC} ${CFLAGS} ${INCLUDE} -c $*.c - -all : ifspec.o $(CODE_MODEL_OBJECTS) - -cfunc.o : cfunc.c -ifspec.o : ifspec.c - - +# $Id$ +# +# Makefile for Code Model directories +# + +# Include global XSPICE selections for CC and other macros +include /usr/local/xspice-1-0/include/make.include + +INCLUDE = -I. -I$(ROOT)/include/sim + +CFLAGS = -g + +#----------------------------------------------------------------------------- +# Edit the following definition to specify the object files that comprise +# your code model. If your code model is completely specified in the +# cfunc.mod file, there is no need to edit this definition. +# DO NOT include the ifspec.o file. + +CODE_MODEL_OBJECTS = cfunc.o + +#----------------------------------------------------------------------------- +# DO NOT MODIFY THE FOLLOWING DEFINITIONS: + +.SUFFIXES: $(SUFFIXES) .mod .ifs + +.mod.c: + $(BINDIR)/cmpp -mod $< + +.ifs.c: + $(BINDIR)/cmpp -ifs + +.c.o: $*.c + ${CC} ${CFLAGS} ${INCLUDE} -c $*.c + +all : ifspec.o $(CODE_MODEL_OBJECTS) + +cfunc.o : cfunc.c +ifspec.o : ifspec.c diff --git a/src/xspice/examples/real_to_v/ifspec.ifs b/src/xspice/examples/real_to_v/ifspec.ifs index 9b06bf137..5d7b3d0e1 100755 --- a/src/xspice/examples/real_to_v/ifspec.ifs +++ b/src/xspice/examples/real_to_v/ifspec.ifs @@ -1,33 +1,33 @@ -/* $Id$ */ - -NAME_TABLE: - -Spice_Model_Name: real_to_v -C_Function_Name: ucm_real_to_v -Description: "Node bridge from real to analog voltage" - - -PORT_TABLE: - -Port_Name: in out -Description: "input" "output" -Direction: in out -Default_Type: real v -Allowed_Types: [real] [v, vd, i, id] -Vector: no no -Vector_Bounds: - - -Null_Allowed: no no - - -PARAMETER_TABLE: - -Parameter_Name: gain transition_time -Description: "gain" "output transition time" -Data_Type: real real -Default_Value: 1.0 1e-9 -Limits: - [1e-15 -] -Vector: no no -Vector_Bounds: - - -Null_Allowed: yes yes - - +/* $Id$ */ + +NAME_TABLE: + +Spice_Model_Name: real_to_v +C_Function_Name: ucm_real_to_v +Description: "Node bridge from real to analog voltage" + + +PORT_TABLE: + +Port_Name: in out +Description: "input" "output" +Direction: in out +Default_Type: real v +Allowed_Types: [real] [v, vd, i, id] +Vector: no no +Vector_Bounds: - - +Null_Allowed: no no + + +PARAMETER_TABLE: + +Parameter_Name: gain transition_time +Description: "gain" "output transition time" +Data_Type: real real +Default_Value: 1.0 1e-9 +Limits: - [1e-15 -] +Vector: no no +Vector_Bounds: - - +Null_Allowed: yes yes + +