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.
This commit is contained in:
Giles Atkinson 2023-06-20 10:53:21 +01:00 committed by Holger Vogt
parent 8ce190e7d6
commit 1a056f935c
6 changed files with 35 additions and 19 deletions

View File

@ -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

View File

@ -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

View File

@ -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 {

View File

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

View File

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

View File

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