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. 46
      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 set xbrushwidth=2
let isbmode = $?batchmode let isbmode = $?batchmode
if isbmode = 0 if isbmode = 0
iplot -w $&simtime cont
iplot -w $&simtime -d 4000 cont
endif endif
* calculate breakpoint for switching frequency * calculate breakpoint for switching frequency
let t1_3 = simtime/3 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 .control
save cont s1 s2 u1n d1 v.xlf.vdd#branch; to save memory save cont s1 s2 u1n d1 v.xlf.vdd#branch; to save memory
iplot cont
iplot -d 4000 cont
tran 0.1n $&simtime uic tran 0.1n $&simtime uic
rusage rusage
plot cont s1 s2+1.2 u1n+2.4 d1+3.6 xlimit 4u 5u plot cont s1 s2+1.2 u1n+2.4 d1+3.6 xlimit 4u 5u

46
src/frontend/breakp.c

@ -205,36 +205,50 @@ com_iplot(wordlist *wl)
/* settrace(wl, VF_PLOT); */ /* settrace(wl, VF_PLOT); */
struct dbcomm *d, *td, *currentdb = NULL; struct dbcomm *d, *td, *currentdb = NULL;
double window;
double window = 0.0;
int initial_steps = IPOINTMIN;
char *s; char *s;
/* Look for "-w window-size" at the front, indicating a windowed iplot. */
if (wl->wl_next && !strcmp("-w", wl->wl_word)) {
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;
/* Look for "-w window-size" at the front, indicating a windowed iplot
* or "-d steps" to set the initial delay before the window appears.
*/
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;
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; wl = wl->wl_next;
} else {
window = 0.0;
} }
/* We use a modified ad-hoc algorithm here where db_also denotes /* We use a modified ad-hoc algorithm here where db_also denotes
vectors on the same command line and db_next denotes vectors on the same command line and db_next denotes
separate iplot commands. */ separate iplot commands. */
while (wl) { while (wl) {
s = cp_unquote(wl->wl_word); s = cp_unquote(wl->wl_word);
d = TMALLOC(struct dbcomm, 1); d = TMALLOC(struct dbcomm, 1);
d->db_analysis = NULL; d->db_analysis = NULL;
d->db_number = debugnumber++; 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")) { if (eq(s, "all")) {
d->db_type = DB_IPLOTALL; d->db_type = DB_IPLOTALL;
} else { } else {

2
src/frontend/commands.c

@ -427,7 +427,7 @@ struct comm spcp_coms[] = {
{ "iplot", com_iplot, TRUE, TRUE, { "iplot", com_iplot, TRUE, TRUE,
{ 0200, 0200, 0200, 0200 }, E_DEFHMASK, 0, LOTS, { 0200, 0200, 0200, 0200 }, E_DEFHMASK, 0, LOTS,
NULL, NULL,
"[-w width] [all] [node ...] : Incrementally plot nodes." } ,
"[-w width] [-s initial_steps] [all] [node ...] : Incrementally plot nodes." } ,
{ "status", com_sttus, TRUE, FALSE, { "status", com_sttus, TRUE, FALSE,
{ 0, 0, 0, 0 }, E_DEFHMASK, 0, 0, { 0, 0, 0, 0 }, E_DEFHMASK, 0, 0,
NULL, 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 */ /* Do simple check for exit first */
window = db->db_value1; 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; 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_GTE 5 /* >= (ge) */
#define DBC_LTE 6 /* <= (le) */ #define DBC_LTE 6 /* <= (le) */
/* Below, members db_op and db_value1 are re-purposed by iplot options. */
struct dbcomm { struct dbcomm {
int db_number; /* The number of this debugging command. */ int db_number; /* The number of this debugging command. */
char db_type; /* One of the above. */ char db_type; /* One of the above. */
@ -41,7 +43,7 @@ struct dbcomm {
char *db_nodename2; /* What node. */ char *db_nodename2; /* What node. */
char *db_analysis; /* for a specific analysis. */ char *db_analysis; /* for a specific analysis. */
int db_iteration; /* For the DB_STOPAFTER command. */ 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_value1; /* If this is DB_STOPWHEN. */
double db_value2; /* If this is DB_STOPWHEN. */ double db_value2; /* If this is DB_STOPWHEN. */
int db_graphid; /* If iplot, id of graph. */ int db_graphid; /* If iplot, id of graph. */

Loading…
Cancel
Save