Revert "Revert "ngspice version detection implemented""
This commit is contained in:
parent
fb24e80363
commit
ca1a099b51
|
|
@ -6,15 +6,49 @@
|
||||||
#
|
#
|
||||||
# Rel Date Who Comments
|
# Rel Date Who Comments
|
||||||
# ==== ========== ============= ========
|
# ==== ========== ============= ========
|
||||||
|
# 1.1 07/05/17 Dietmar Warning Version detection included
|
||||||
# 1.0 05/13/11 Dietmar Warning Initial version
|
# 1.0 05/13/11 Dietmar Warning Initial version
|
||||||
#
|
#
|
||||||
|
|
||||||
package simulate;
|
package simulate;
|
||||||
|
if (defined($main::simulatorCommand)) {
|
||||||
|
$simulatorCommand=$main::simulatorCommand;
|
||||||
|
} else {
|
||||||
|
$simulatorCommand="ngspice";
|
||||||
|
}
|
||||||
$netlistFile="ngspiceCkt";
|
$netlistFile="ngspiceCkt";
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
sub version {
|
sub version {
|
||||||
return("26"); # the version only seems to be printed in interactive mode
|
my($version,$vaVersion);
|
||||||
|
$version="unknown";
|
||||||
|
$vaVersion="unknown";
|
||||||
|
if (!open(OF,">$simulate::netlistFile")) {
|
||||||
|
die("ERROR: cannot open file $simulate::netlistFile, stopped");
|
||||||
|
}
|
||||||
|
print OF "version test";
|
||||||
|
print OF "r1 1 0 1";
|
||||||
|
print OF "v1 1 0 1";
|
||||||
|
print OF ".control";
|
||||||
|
print OF "version";
|
||||||
|
print OF ".endc";
|
||||||
|
print OF ".end";
|
||||||
|
close(OF);
|
||||||
|
if (!open(SIMULATE,"$simulate::simulatorCommand < $simulate::netlistFile 2>/dev/null|")) {
|
||||||
|
die("ERROR: cannot run $simulate::simulatorCommand, stopped");
|
||||||
|
}
|
||||||
|
while (<SIMULATE>) {
|
||||||
|
chomp;
|
||||||
|
# Check whether this line is the one we are looking for.
|
||||||
|
# Also the term in parenthesis "()" stores the number to $1 which we can reuse later.
|
||||||
|
if (s/.+ngspice-([0-9]+)//) {
|
||||||
|
# Simple read the stored group from the matching in the if clause
|
||||||
|
$version=$1;
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close(SIMULATE);
|
||||||
|
return($version,$vaVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub runNoiseTest {
|
sub runNoiseTest {
|
||||||
|
|
@ -77,8 +111,8 @@ sub runNoiseTest {
|
||||||
# Run simulations and get the results
|
# Run simulations and get the results
|
||||||
#
|
#
|
||||||
|
|
||||||
if (!open(SIMULATE,"$main::simulatorCommand < $simulate::netlistFile 2>/dev/null|")) {
|
if (!open(SIMULATE,"$simulate::simulatorCommand < $simulate::netlistFile 2>/dev/null|")) {
|
||||||
die("ERROR: cannot run $main::simulatorCommand, stopped");
|
die("ERROR: cannot run $simulate::simulatorCommand, stopped");
|
||||||
}
|
}
|
||||||
$inData=0;
|
$inData=0;
|
||||||
while (<SIMULATE>) {
|
while (<SIMULATE>) {
|
||||||
|
|
@ -203,8 +237,8 @@ sub runAcTest {
|
||||||
# Run simulations and get the results
|
# Run simulations and get the results
|
||||||
#
|
#
|
||||||
|
|
||||||
if (!open(SIMULATE,"$main::simulatorCommand < $simulate::netlistFile 2>/dev/null|")) {
|
if (!open(SIMULATE,"$simulate::simulatorCommand < $simulate::netlistFile 2>/dev/null|")) {
|
||||||
die("ERROR: cannot run $main::simulatorCommand, stopped");
|
die("ERROR: cannot run $simulate::simulatorCommand, stopped");
|
||||||
}
|
}
|
||||||
$inData=0;
|
$inData=0;
|
||||||
while (<SIMULATE>) {
|
while (<SIMULATE>) {
|
||||||
|
|
@ -340,8 +374,8 @@ sub runDcTest {
|
||||||
# Run simulations and get the results
|
# Run simulations and get the results
|
||||||
#
|
#
|
||||||
|
|
||||||
if (!open(SIMULATE,"$main::simulatorCommand < $simulate::netlistFile 2>/dev/null|")) {
|
if (!open(SIMULATE,"$simulate::simulatorCommand < $simulate::netlistFile 2>/dev/null|")) {
|
||||||
die("ERROR: cannot run $main::simulatorCommand, stopped");
|
die("ERROR: cannot run $simulate::simulatorCommand, stopped");
|
||||||
}
|
}
|
||||||
$inResults=0;
|
$inResults=0;
|
||||||
while (<SIMULATE>) {
|
while (<SIMULATE>) {
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ Options:
|
||||||
-nw do not print warning messages
|
-nw do not print warning messages
|
||||||
-platform prints the hardware platform and operating system version
|
-platform prints the hardware platform and operating system version
|
||||||
-p plot results (limited, only standard test variant)
|
-p plot results (limited, only standard test variant)
|
||||||
-P plot results (complete, for all test variants)
|
|
||||||
-r re-use previously simulated results if they exist
|
-r re-use previously simulated results if they exist
|
||||||
(default is to resimulate, even if results exist)
|
(default is to resimulate, even if results exist)
|
||||||
-sv prints the simulator version being run
|
-sv prints the simulator version being run
|
||||||
|
|
@ -70,6 +69,7 @@ undef($qaSpecFile);
|
||||||
undef(@Setup);
|
undef(@Setup);
|
||||||
undef(@Test);
|
undef(@Test);
|
||||||
undef(@Variants);
|
undef(@Variants);
|
||||||
|
undef(@TestVariants);
|
||||||
$debug=0;
|
$debug=0;
|
||||||
$verbose=0;
|
$verbose=0;
|
||||||
$reallyVerbose=0;
|
$reallyVerbose=0;
|
||||||
|
|
@ -98,6 +98,7 @@ undef($acClip);undef($acNdigit);undef($acRelTol);
|
||||||
undef($noiseClip);undef($noiseNdigit);undef($noiseRelTol);
|
undef($noiseClip);undef($noiseNdigit);undef($noiseRelTol);
|
||||||
undef($mFactor);undef($shrinkPercent);undef($scaleFactor);undef(%TestSpec);
|
undef($mFactor);undef($shrinkPercent);undef($scaleFactor);undef(%TestSpec);
|
||||||
undef($refrnceDirectory);
|
undef($refrnceDirectory);
|
||||||
|
undef($simulatorCommand);
|
||||||
|
|
||||||
#
|
#
|
||||||
# These are the tolerances used to compare results
|
# These are the tolerances used to compare results
|
||||||
|
|
@ -230,9 +231,13 @@ if (!$onlyDoComparison) {
|
||||||
#
|
#
|
||||||
|
|
||||||
if (!$onlyDoComparison) {
|
if (!$onlyDoComparison) {
|
||||||
$version=&simulate::version();
|
($version,$vaVersion)=&simulate::version();
|
||||||
if ($onlyDoSimulatorVersion) {
|
if ($onlyDoSimulatorVersion) {
|
||||||
print $version;exit(0);
|
if ($vaVersion eq "unknown") {
|
||||||
|
print $version;exit(0);
|
||||||
|
} else {
|
||||||
|
print $version,$vaVersion;exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$qaSpecFile=$ARGV[0];
|
$qaSpecFile=$ARGV[0];
|
||||||
|
|
@ -297,7 +302,7 @@ if ($reallyVerbose) {
|
||||||
$flag="";
|
$flag="";
|
||||||
}
|
}
|
||||||
foreach $test (@Test) {
|
foreach $test (@Test) {
|
||||||
next if (!$doTest{$test});
|
next if (%doTest && !$doTest{$test});
|
||||||
|
|
||||||
if ($verbose) {print "\n****** Running test ($simulatorName): $test"}
|
if ($verbose) {print "\n****** Running test ($simulatorName): $test"}
|
||||||
|
|
||||||
|
|
@ -305,13 +310,13 @@ foreach $test (@Test) {
|
||||||
undef($outputAc);
|
undef($outputAc);
|
||||||
undef($outputNoise);
|
undef($outputNoise);
|
||||||
&modelQa::processTestSpec(@{$TestSpec{$test}});
|
&modelQa::processTestSpec(@{$TestSpec{$test}});
|
||||||
foreach $variant (@Variants) {
|
foreach $variant (@TestVariants) {
|
||||||
if ($variant eq "standard") {
|
if ($variant eq "standard") {
|
||||||
$refFile="$refrnceDirectory/$test.standard";
|
$refFile="$refrnceDirectory/$test.standard";
|
||||||
} else {
|
} else {
|
||||||
$refFile="$resultsDirectory/$test.standard";
|
$refFile="$resultsDirectory/$test.standard";
|
||||||
}
|
}
|
||||||
next if (!$doVariant{$variant});
|
next if (%doVariant && !$doVariant{$variant});
|
||||||
$simFile="$resultsDirectory/$test.$variant";
|
$simFile="$resultsDirectory/$test.$variant";
|
||||||
if ($outputDc) {
|
if ($outputDc) {
|
||||||
if (($forceSimulation || ! -r $simFile) && !$onlyDoComparison) {
|
if (($forceSimulation || ! -r $simFile) && !$onlyDoComparison) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue