Browse Source

Add an option to the iplot command: -d sets the number of simulation

steps before the window is shown.  The value can be chosen to
limit rapid resizing when starting and that is used in the PLL examples.
pre-master-46
Giles Atkinson 3 years ago
committed by Holger Vogt
parent
commit
5114d6c2f4
  1. 2
      examples/xspice/pll/pll-xspice-fstep.cir
  2. 2
      examples/xspice/pll/pll-xspice.cir
  3. 26
      src/frontend/breakp.c
  4. 2
      src/frontend/commands.c
  5. 2
      src/frontend/plotting/graf.c
  6. 4
      src/include/ngspice/ftedebug.h

2
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

2
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

26
src/frontend/breakp.c

@ -205,35 +205,49 @@ 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)) {
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");
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 {
window = 0.0;
break;
}
wl = wl->wl_next;
}
/* 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_op = initial_steps; // Field re-use
d->db_value1 = window; // Field re-use
if (eq(s, "all")) {
d->db_type = DB_IPLOTALL;

2
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,

2
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;
}

4
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. */

Loading…
Cancel
Save