diff --git a/examples/xspice/pll/pll-xspice-fstep.cir b/examples/xspice/pll/pll-xspice-fstep.cir index 0bb2fb17f..09feede63 100644 --- a/examples/xspice/pll/pll-xspice-fstep.cir +++ b/examples/xspice/pll/pll-xspice-fstep.cir @@ -69,7 +69,7 @@ save cont s1 s2 u1 d1 set xbrushwidth=2 let isbmode = $?batchmode if isbmode = 0 - iplot -w $&simtime cont + iplot -w $&simtime -d 4000 cont endif * calculate breakpoint for switching frequency let t1_3 = simtime/3 diff --git a/examples/xspice/pll/pll-xspice.cir b/examples/xspice/pll/pll-xspice.cir index 1d14368de..a1df101f1 100644 --- a/examples/xspice/pll/pll-xspice.cir +++ b/examples/xspice/pll/pll-xspice.cir @@ -64,7 +64,7 @@ abridge-w1 [d_divout d_ref d_Un d_D] [s1 s2 u1n d1] dac1 ; change to d_u or d_Un .control save cont s1 s2 u1n d1 v.xlf.vdd#branch; to save memory -iplot cont +iplot -d 4000 cont tran 0.1n $&simtime uic rusage plot cont s1 s2+1.2 u1n+2.4 d1+3.6 xlimit 4u 5u diff --git a/src/frontend/breakp.c b/src/frontend/breakp.c index 190e91730..cf1e410b4 100644 --- a/src/frontend/breakp.c +++ b/src/frontend/breakp.c @@ -205,36 +205,50 @@ com_iplot(wordlist *wl) /* settrace(wl, VF_PLOT); */ struct dbcomm *d, *td, *currentdb = NULL; - double window; + double window = 0.0; + int initial_steps = IPOINTMIN; char *s; - /* Look for "-w window-size" at the front, indicating a windowed iplot. */ + /* Look for "-w window-size" at the front, indicating a windowed iplot + * or "-d steps" to set the initial delay before the window appears. + */ - if (wl->wl_next && !strcmp("-w", wl->wl_word)) { - char *cp; - int error; + while (wl && wl->wl_word[0] == '-') { + if (wl->wl_word[1] == 'w' && !wl->wl_word[2]) { + wl = wl->wl_next; + if (wl) { + char *cp; + int error; - wl = wl->wl_next; - cp = wl->wl_word; - window = INPevaluate(&cp, &error, 0); - if (error || window <= 0) { - fprintf(cp_err, "Incremental plot width must be positive.\n"); - return; + cp = wl->wl_word; + window = INPevaluate(&cp, &error, 0); + if (error || window <= 0) { + fprintf(cp_err, + "Incremental plot width must be positive.\n"); + return; + } + } + } else if (wl->wl_word[1] == 'd' && !wl->wl_word[2]) { + wl = wl->wl_next; + if (wl) + initial_steps = atoi(wl->wl_word); + } else { + break; } wl = wl->wl_next; - } else { - window = 0.0; } /* We use a modified ad-hoc algorithm here where db_also denotes vectors on the same command line and db_next denotes separate iplot commands. */ + while (wl) { s = cp_unquote(wl->wl_word); d = TMALLOC(struct dbcomm, 1); d->db_analysis = NULL; d->db_number = debugnumber++; - d->db_value1 = window; // Field re-use + d->db_op = initial_steps; // Field re-use + d->db_value1 = window; // Field re-use if (eq(s, "all")) { d->db_type = DB_IPLOTALL; } else { diff --git a/src/frontend/commands.c b/src/frontend/commands.c index 3966a9197..a72560cba 100644 --- a/src/frontend/commands.c +++ b/src/frontend/commands.c @@ -427,7 +427,7 @@ struct comm spcp_coms[] = { { "iplot", com_iplot, TRUE, TRUE, { 0200, 0200, 0200, 0200 }, E_DEFHMASK, 0, LOTS, NULL, - "[-w width] [all] [node ...] : Incrementally plot nodes." } , + "[-w width] [-s initial_steps] [all] [node ...] : Incrementally plot nodes." } , { "status", com_sttus, TRUE, FALSE, { 0, 0, 0, 0 }, E_DEFHMASK, 0, 0, NULL, diff --git a/src/frontend/plotting/graf.c b/src/frontend/plotting/graf.c index 33e7187ae..590b419b6 100644 --- a/src/frontend/plotting/graf.c +++ b/src/frontend/plotting/graf.c @@ -855,7 +855,7 @@ static int iplot(struct plot *pl, struct dbcomm *db) /* Do simple check for exit first */ window = db->db_value1; - if (len < 2 || (window == 0.0 && len < IPOINTMIN)) { /* Nothing yet */ + if (len < 2 || db->db_op > len) { /* Nothing yet */ return 0; } diff --git a/src/include/ngspice/ftedebug.h b/src/include/ngspice/ftedebug.h index f9225f43e..34c215904 100644 --- a/src/include/ngspice/ftedebug.h +++ b/src/include/ngspice/ftedebug.h @@ -34,6 +34,8 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group #define DBC_GTE 5 /* >= (ge) */ #define DBC_LTE 6 /* <= (le) */ +/* Below, members db_op and db_value1 are re-purposed by iplot options. */ + struct dbcomm { int db_number; /* The number of this debugging command. */ char db_type; /* One of the above. */ @@ -41,7 +43,7 @@ struct dbcomm { char *db_nodename2; /* What node. */ char *db_analysis; /* for a specific analysis. */ int db_iteration; /* For the DB_STOPAFTER command. */ - char db_op; /* For DB_STOPWHEN. */ + int db_op; /* For DB_STOPWHEN. */ double db_value1; /* If this is DB_STOPWHEN. */ double db_value2; /* If this is DB_STOPWHEN. */ int db_graphid; /* If iplot, id of graph. */