.measure results from batch mode may be saved in a file
(in addition to the printout) Add command set measoutfile=<path/filename> to .spiceinit or to a .control section in the netlist
This commit is contained in:
parent
0c34ac019f
commit
ced2128f58
|
|
@ -216,7 +216,7 @@ do_measure(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
struct card *meas_card, *meas_results = NULL, *end = NULL, *newcard;
|
struct card *meas_card, *meas_results = NULL, *end = NULL, *newcard;
|
||||||
char *line, *an_name, *an_type, *resname, *meastype, *str_ptr, out_line[1000];
|
char *line, *an_name, *an_type, *resname, *meastype, *str_ptr, out_line[1000], out_file[1000];
|
||||||
int ok = 0;
|
int ok = 0;
|
||||||
int fail;
|
int fail;
|
||||||
int num_failed = 0;
|
int num_failed = 0;
|
||||||
|
|
@ -225,6 +225,7 @@ do_measure(
|
||||||
bool measures_passed;
|
bool measures_passed;
|
||||||
wordlist *measure_word_list;
|
wordlist *measure_word_list;
|
||||||
int precision = measure_get_precision();
|
int precision = measure_get_precision();
|
||||||
|
FILE *measout = NULL;
|
||||||
|
|
||||||
#ifdef HAS_PROGREP
|
#ifdef HAS_PROGREP
|
||||||
if (!chk_only)
|
if (!chk_only)
|
||||||
|
|
@ -252,6 +253,12 @@ do_measure(
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cp_getvar("measoutfile", CP_STRING, out_file, sizeof(out_file))) {
|
||||||
|
measout = fopen(out_file, "w");
|
||||||
|
if (!measout)
|
||||||
|
fprintf(stderr, " Warning: Could not open file %s\n", out_file);
|
||||||
|
}
|
||||||
|
|
||||||
/* Evaluating the linked list of .meas cards, assembled from the input deck
|
/* Evaluating the linked list of .meas cards, assembled from the input deck
|
||||||
by fcn inp_spsource() in inp.c:575.
|
by fcn inp_spsource() in inp.c:575.
|
||||||
A typical .meas card will contain:
|
A typical .meas card will contain:
|
||||||
|
|
@ -293,6 +300,23 @@ do_measure(
|
||||||
|
|
||||||
if (!chk_only && strcmp(an_type, "tran") == 0) {
|
if (!chk_only && strcmp(an_type, "tran") == 0) {
|
||||||
fprintf(stdout, "\n Measurements for Transient Analysis\n\n");
|
fprintf(stdout, "\n Measurements for Transient Analysis\n\n");
|
||||||
|
if (measout)
|
||||||
|
fprintf(measout, "\n Measurements for Transient Analysis\n\n");
|
||||||
|
}
|
||||||
|
else if (!chk_only && strcmp(an_type, "dc") == 0) {
|
||||||
|
fprintf(stdout, "\n Measurements for DC Analysis\n\n");
|
||||||
|
if (measout)
|
||||||
|
fprintf(measout, "\n Measurements for DC Analysis\n\n");
|
||||||
|
}
|
||||||
|
else if (!chk_only && strcmp(an_type, "ac") == 0) {
|
||||||
|
fprintf(stdout, "\n Measurements for AC Analysis\n\n");
|
||||||
|
if (measout)
|
||||||
|
fprintf(measout, "\n Measurements for AC Analysis\n\n");
|
||||||
|
}
|
||||||
|
else if (!chk_only && strcmp(an_type, "sp") == 0) {
|
||||||
|
fprintf(stdout, "\n Measurements for SP Analysis\n\n");
|
||||||
|
if (measout)
|
||||||
|
fprintf(measout, "\n Measurements for SP Analysis\n\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -395,8 +419,11 @@ do_measure(
|
||||||
|
|
||||||
if (strncmp(meastype, "param", 5) != 0 && strncmp(meastype, "expr", 4) != 0) {
|
if (strncmp(meastype, "param", 5) != 0 && strncmp(meastype, "expr", 4) != 0) {
|
||||||
|
|
||||||
if (!chk_only)
|
if (!chk_only) {
|
||||||
fprintf(stdout, "%s", newcard->line);
|
fprintf(stdout, "%s", newcard->line);
|
||||||
|
if (measout)
|
||||||
|
fprintf(measout, "%s", newcard->line);
|
||||||
|
}
|
||||||
end = newcard;
|
end = newcard;
|
||||||
newcard = newcard->nextcard;
|
newcard = newcard->nextcard;
|
||||||
|
|
||||||
|
|
@ -409,8 +436,11 @@ do_measure(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!chk_only)
|
if (!chk_only) {
|
||||||
fprintf(stdout, "%-20s=", resname);
|
fprintf(stdout, "%-20s=", resname);
|
||||||
|
if (measout)
|
||||||
|
fprintf(measout, "%-20s=", resname);
|
||||||
|
}
|
||||||
|
|
||||||
if (!chk_only) {
|
if (!chk_only) {
|
||||||
ok = nupa_eval(meas_card);
|
ok = nupa_eval(meas_card);
|
||||||
|
|
@ -418,16 +448,25 @@ do_measure(
|
||||||
if (ok) {
|
if (ok) {
|
||||||
str_ptr = strstr(meas_card->line, meastype);
|
str_ptr = strstr(meas_card->line, meastype);
|
||||||
if (!get_double_value(&str_ptr, meastype, &result, chk_only)) {
|
if (!get_double_value(&str_ptr, meastype, &result, chk_only)) {
|
||||||
if (!chk_only)
|
if (!chk_only) {
|
||||||
fprintf(stdout, " failed\n");
|
fprintf(stdout, " failed\n");
|
||||||
|
if (measout)
|
||||||
|
fprintf(measout, " failed\n");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!chk_only)
|
if (!chk_only) {
|
||||||
fprintf(stdout, " %.*e\n", precision, result);
|
fprintf(stdout, " %.*e\n", precision, result);
|
||||||
|
if (measout)
|
||||||
|
fprintf(measout, " %.*e\n", precision, result);
|
||||||
|
}
|
||||||
nupa_add_param(resname, result);
|
nupa_add_param(resname, result);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!chk_only)
|
if (!chk_only) {
|
||||||
fprintf(stdout, " failed\n");
|
fprintf(stdout, " failed\n");
|
||||||
|
if (measout)
|
||||||
|
fprintf(measout, " failed\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
txfree(an_type);
|
txfree(an_type);
|
||||||
|
|
@ -435,13 +474,19 @@ do_measure(
|
||||||
txfree(meastype);
|
txfree(meastype);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!chk_only)
|
if (!chk_only) {
|
||||||
fprintf(stdout, "\n");
|
fprintf(stdout, "\n");
|
||||||
|
if (measout)
|
||||||
|
fprintf(measout, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
txfree(an_name);
|
txfree(an_name);
|
||||||
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
if (measout) {
|
||||||
|
fclose(measout);
|
||||||
|
measout = NULL;
|
||||||
|
}
|
||||||
return(measures_passed);
|
return(measures_passed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue