#include "spice.h"
#include "ftedefs.h"
#include "fteinp.h"
#include "spfteext.h"
#include "ftegraph.h"
#include "plotext.h"
#include "outdata.h"
#include "util.h"
#include "iferrmsg.h"
Go to the source code of this file.
|
static bool | parse_var () |
|
static void | pr_parms () |
|
static void | checkloop () |
|
static void | set_opvec () |
|
static int | mainloop () |
|
static int | do_it () |
|
static int | findext () |
|
static void | check_end () |
|
static bool | read_check_control_file () |
|
static bool | check_evaluate () |
|
static void | execblock () |
|
static void | modify () |
|
static void | setvec () |
|
static FILE * | df_open () |
|
static void | df_close () |
|
void | com_check (wordlist *wl) |
|
void | com_loop (wordlist *wl) |
|
static bool | parse_var (struct sLOOPprms *loop, wordlist **wl) |
|
void | ft_check (wordlist *wl, FILE *infile) |
|
static void | checkloop (wordlist *cmdwl) |
|
static void | set_opvec (int n) |
|
static int | mainloop (struct control *cntrl) |
|
static int | do_it (int i, int j, double value1, double value2) |
|
static int | findext (int iterno, double *value1, double value2, double delta) |
|
static int | read_check_control_file (FILE *fp, char *blname) |
|
static void | execblock (char *blname) |
|
static void | modify (double value1, double value2) |
|
static void | setvec (double v1, double v2) |
|
static void | df_close (FILE *fp) |
|
static void check_end |
( |
| ) |
|
|
static |
Definition at line 927 of file check.c.
static struct sOUTcontrol * OUTcntrl
static bool check_evaluate |
( |
| ) |
|
|
static |
static void checkloop |
( |
| ) |
|
|
static |
static void checkloop |
( |
wordlist * |
cmdwl | ) |
|
|
static |
Definition at line 598 of file check.c.
604 double value1, value2;
605 char *apology =
"Sorry, margin analysis can't be resumed in this version.\n";
633 value1 = cntrl.val1 - cntrl.step1 * cntrl.delta1;
634 value2 = cntrl.val2 - cntrl.step2 * cntrl.delta2;
638 value1, cntrl.val1+cntrl.step1*cntrl.delta1,
639 value2, cntrl.val2+cntrl.step2*cntrl.delta2));
642 (void) fprintf(
cp_out,
"%d %d %g %g\n",
643 -cntrl.step1,-cntrl.step2,value1,value2);
646 (void) fprintf(
Op,
"%d %d %g %g\n",
647 -cntrl.step1,-cntrl.step2,value1,value2);
654 if (cntrl.iterno < 0 || cntrl.iterno > 10) {
657 "Warning: bad value for checkiterate, ignored.\n");
664 (void) fprintf(
cp_err,apology);
669 (
void) fprintf(
cp_err,apology);
bool cp_getvar(char *n, int t, char *r)
struct wordlist * wl_next
static struct sOUTcontrol * OUTcntrl
Definition at line 87 of file check.c.
103 (void) fprintf(
cp_err,
"Error: no circuit loaded.\n");
107 (void) fprintf(
cp_err,
"Error: no bound codeblock.\n");
111 (void) fprintf(
cp_err,
"Error: codeblock %s not found.\n",
141 for (ww = wl; wl; wl = wn) {
163 "Error: no or more than one analysis specified\n");
172 if (isupper(*c)) *c = tolower(*c);
180 if (step1 || step2) {
182 (void) fprintf(
cp_err,
"Error: Can't open data output file\n");
189 (void) fprintf(
cp_err,
"Error: check variable checkPNTS not set\n");
219 "Operating range analysis complete. Data in file %s.\n",buf);
static char buf[MAXPROMPT]
bool cp_getvar(char *n, int t, char *r)
struct plot * plot_alloc()
static bool check_evaluate()
struct circ * ft_circuits
struct wordlist * wl_prev
wordlist * GetAnalysisFromDeck()
struct wordlist * wl_next
static struct sOUTcontrol * OUTcntrl
Definition at line 225 of file check.c.
243 loop.inprogress =
false;
251 fprintf(
cp_err,
"Syntax error\n");
259 "Error: no or more than one analysis specified\n");
264 if (isupper(*c)) *c = tolower(*c);
268 for (i = 0; i <=
loop.nestLevel; i++)
278 if ((
loop.step[i] > 0 && tt > 1
e-8) ||
279 (
loop.step[i] < 0 && tt < 1
e-8) ||
283 if (i >
loop.nestLevel)
286 if (
loop.dims[2] <= 1) {
321 error = (*(
ft_sim->doAnalyses))
329 loop.inprogress =
true;
340 if (
loop.dims[2] > 1) {
wordlist * GetAnalysisFromDeck()
struct wordlist * wl_next
static struct sOUTcontrol * OUTcntrl
static void df_close |
( |
FILE * |
fp | ) |
|
|
static |
static FILE * df_open |
( |
| ) |
|
|
static |
Definition at line 1093 of file check.c.
1102 char buf[128], buf1[128], *
s;
1107 wl =
cp_lexer(
"set mplot_cur=mplot");
1117 if ((s = strrchr(buf,DIR_TERM)) !=
NULL)
1123 if ((s = strrchr(buf1,
'.')) !=
NULL)
1125 strcat(buf1,
".d00");
1126 s = strchr(buf1,
'.') + 2;
1127 for (i = 1; i < 100; i++) {
1128 if (
access(buf1,0))
break;
1130 *(s+1) = i%10 +
'0';
1134 fp = fopen(buf1,
"w");
1140 sprintf(buf,
"set mplot_cur=%s",buf1);
static char buf[MAXPROMPT]
int access(char *pth, int m)
static int do_it |
( |
int |
i, |
|
|
int |
j, |
|
|
double |
value1, |
|
|
double |
value2 |
|
) |
| |
|
static |
Definition at line 849 of file check.c.
859 (void) fprintf(
cp_out,
"%d %d %g %g\n",i,j,value1,value2);
861 (void) fprintf(
Op,
"%d %d %g %g\n",i,j,value1,value2);
static struct sOUTcontrol * OUTcntrl
static void execblock |
( |
| ) |
|
|
static |
static void execblock |
( |
char * |
blname | ) |
|
|
static |
Definition at line 1017 of file check.c.
1022 FILE *lastin, *lastout, *lasterr;
static int findext |
( |
int |
iterno, |
|
|
double * |
value1, |
|
|
double |
value2, |
|
|
double |
delta |
|
) |
| |
|
static |
Definition at line 881 of file check.c.
static struct sOUTcontrol * OUTcntrl
void ft_check |
( |
wordlist * |
wl, |
|
|
FILE * |
infile |
|
) |
| |
Definition at line 477 of file check.c.
485 char *filename =
NULL;
489 ShowPrompt(
"Exit sced to run operating range analysis.");
497 if (infile !=
NULL) {
513 if ((fp = fopen(filename,
"r")) ==
NULL) {
514 (void) fprintf(
cp_err,
"Error: can't open source file\n");
520 if (filename && *filename) {
521 cblock =
tmalloc(strlen(filename) + 3);
522 sprintf(cblock,
"#_%s",filename);
536 ww =
cp_lexer(
"set value1=0.0 value2=0.0");
bool inp_spdeck(struct line *deck, char *filename)
void com_check(wordlist *wl)
static bool read_check_control_file()
struct wordlist * wl_next
void ShowPrompt(char *str)
static int mainloop |
( |
struct control * |
cntrl | ) |
|
|
static |
Definition at line 695 of file check.c.
701 double value1, value2, delta;
702 char *flags, *rowflags;
713 "Error: central point bad, range not found.\n");
716 value2 = cntrl->
val2;
717 value1 = cntrl->
val1;
719 for (i = 0; i < 10; i++) {
722 do_it(0,0,value1,value2);
734 (void) fprintf(
cp_err,
"Warning: could not find upper limit.\n");
738 value1 = cntrl->
val1;
740 for (i = 0; i < 2; i++) {
743 do_it(0,0,value1,value2);
755 (void) fprintf(
cp_err,
"Warning: could not find lower limit.\n");
762 num1 = 2*cntrl->
step1 + 1;
763 num2 = 2*cntrl->
step2 + 1;
769 for (j = -cntrl->
step2; j <= cntrl->step2; j++) {
772 rowflags = flags + (j + cntrl->
step2)*num1;
773 for (last = i = -cntrl->
step1; i <= cntrl->step1; i++,rowflags++) {
774 if (*rowflags == 2)
continue;
775 if (*rowflags == 1)
break;
777 *rowflags =
do_it(i,j,value1,value2);
790 rowflags = flags + (j + cntrl->
step2 + 1)*num1 - 1;
791 for (i = cntrl->
step1; i > last; i--,rowflags--) {
792 if (*rowflags == 2)
continue;
793 if (*rowflags == 1)
break;
795 *rowflags =
do_it(i,j,value1,value2);
811 if (cntrl->
step2 > 1) {
812 for (i = -cntrl->
step1; i <= cntrl->step1; i++) {
815 rowflags = flags + i + cntrl->
step1;
816 for (last = j = -cntrl->
step2; j <= cntrl->step2;
817 j++,rowflags += num1) {
818 if (*rowflags == 2)
continue;
819 if (*rowflags == 1)
break;
821 *rowflags =
do_it(i,j,value1,value2);
828 rowflags = flags + i + cntrl->
step1 + 2*cntrl->
step2*num1;
829 for (j = cntrl->
step2; j > last; j--,rowflags -= num1) {
830 if (*rowflags == 2)
continue;
831 if (*rowflags == 1)
break;
833 *rowflags =
do_it(i,j,value1,value2);
static struct sOUTcontrol * OUTcntrl
static void modify |
( |
double |
value1, |
|
|
double |
value2 |
|
) |
| |
|
static |
Definition at line 1043 of file check.c.
1050 sprintf(buf,
"set value1=%g value2=%g",value1,value2);
static char buf[MAXPROMPT]
static bool parse_var |
( |
| ) |
|
|
static |
Definition at line 361 of file check.c.
386 line = (*wl)->wl_word;
389 loop->
start[0] = tmp;
401 line = (*wl)->wl_word;
411 (*wl) = (*wl)->wl_next;
417 line = (*wl)->wl_word;
426 (*wl) = (*wl)->wl_next;
431 line = (*wl)->wl_word;
434 loop->
start[1] = tmp;
440 (*wl) = (*wl)->wl_next;
447 line = (*wl)->wl_word;
450 loop->
start[1] = tmp;
457 (*wl) = (*wl)->wl_next;
463 line = (*wl)->wl_word;
466 loop->
start[1] = tmp;
471 (*wl) = (*wl)->wl_next;
struct wordlist * wl_next
Definition at line 551 of file check.c.
554 int step1, step2, iterno;
555 double val1, delta1, val2, delta2;
582 "Substitution for value1:\n\ 585 steps: %d\n\n",val1,delta1,step1);
588 "Substitution for value2:\n\ 591 steps: %d\n\n",val2,delta2,step2);
593 out_printf(
"checkiterate is set to %d\n\n",iterno);
bool cp_getvar(char *n, int t, char *r)
static bool read_check_control_file |
( |
| ) |
|
|
static |
static int read_check_control_file |
( |
FILE * |
fp, |
|
|
char * |
blname |
|
) |
| |
|
static |
Definition at line 939 of file check.c.
954 if (
prefix(
".control",buf)) {
959 if (
prefix(
".endc",buf)) {
961 (void) fprintf(
cp_err,
"Warning: no .control line found\n");
965 *strchr(buf,
'\n') =
'\0';
static char buf[MAXPROMPT]
static void set_opvec |
( |
| ) |
|
|
static |
static void set_opvec |
( |
int |
n | ) |
|
|
static |
Definition at line 674 of file check.c.
685 sprintf(buf,
"unlet oplo; let oplo[%d]=0",2*n);
687 sprintf(buf,
"unlet ophi; let ophi[%d]=0",2*n);
static char buf[MAXPROMPT]
static void setvec |
( |
double |
v1, |
|
|
double |
v2 |
|
) |
| |
|
static |
Definition at line 1059 of file check.c.
1063 struct dvec *
d, *n1, *n2;
1078 if (i < 0 || i >= len)
1084 if (i < 0 || i >= len)