diff --git a/src/callback.c b/src/callback.c index 710612e4..617c5a0b 100644 --- a/src/callback.c +++ b/src/callback.c @@ -282,6 +282,10 @@ void backannotate_at_cursor_b_pos(xRect *r, Graph_ctx *gr) first = -1; prev_prev_x = prev_x = 0; last = ofs; + + /* optimization: skip unwanted datasets, if no dc no need to detect sweep variable wraps */ + if(dataset >= 0 && strcmp(xctx->raw->sim_type, "dc") && dataset != sweepvar_wrap) goto done; + for(p = ofs ; p < ofs_end; p++) { xx = gv[p]; wrap = ( cnt > 1 && XSIGN(xx - prev_x) != XSIGN(prev_x - prev_prev_x)); @@ -295,13 +299,13 @@ void backannotate_at_cursor_b_pos(xRect *r, Graph_ctx *gr) xx, cursor2, first, last, start, end, p, wrap, sweepvar_wrap, ofs); if(first == -1) first = p; if(p == first) { - if(xx == cursor2) {goto done;} + if(xx == cursor2) {goto found;} s = XSIGN0(xx - cursor2); dbg(1, "s=%d\n", s); } else { int ss = XSIGN0(xx - cursor2); dbg(1, "s=%d, ss=%d\n", s, ss); - if(ss != s) {goto done;} + if(ss != s) {goto found;} } last = p; } @@ -311,10 +315,13 @@ void backannotate_at_cursor_b_pos(xRect *r, Graph_ctx *gr) prev_x = xx; } /* for(p = ofs ; p < ofs + raw->npoints[dset]; p++) */ /* offset pointing to next dataset */ + + done: + ofs = ofs_end; sweepvar_wrap++; } /* for(dset...) */ - done: + found: if(first != -1) { if(p > last) { double sweep0, sweep1; diff --git a/src/draw.c b/src/draw.c index 36660d3b..31015f93 100644 --- a/src/draw.c +++ b/src/draw.c @@ -2514,6 +2514,9 @@ int graph_fullyzoom(xRect *r, Graph_ctx *gr, int graph_dataset) int cnt=0, wrap; register SPICE_DATA *gv = raw->values[sweep_idx]; ofs_end = ofs + raw->npoints[dset]; + + /* optimization: skip unwanted datasets, if no dc no need to detect sweep variable wraps */ + if(dataset >= 0 && strcmp(xctx->raw->sim_type, "dc") && dataset != sweepvar_wrap) goto done; for(p = ofs ; p < ofs_end; p++) { if(gr->logx) xx = mylog10(gv[p]); else xx = gv[p]; @@ -2539,6 +2542,9 @@ int graph_fullyzoom(xRect *r, Graph_ctx *gr, int graph_dataset) ++cnt; } } /* for(p = ofs ; p < ofs + raw->npoints[dset]; p++) */ + + done: + /* offset pointing to next dataset */ ofs = ofs_end; sweepvar_wrap++; @@ -3528,6 +3534,9 @@ int calc_custom_data_yrange(int sweep_idx, const char *express, Graph_ctx *gr) ofs_end = ofs + raw->npoints[dset]; first = -1; last = ofs; + + /* optimization: skip unwanted datasets, if no dc no need to detect sweep variable wraps */ + if(dataset >= 0 && strcmp(xctx->raw->sim_type, "dc") && dataset != sweepvar_wrap) goto done; for(p = ofs ; p < ofs_end; p++) { if(gr->logx) xx = mylog10(gv[p]); @@ -3560,6 +3569,9 @@ int calc_custom_data_yrange(int sweep_idx, const char *express, Graph_ctx *gr) idx = plot_raw_custom_data(sweep_idx, first, last, express, NULL); } } + + done: + /* offset pointing to next dataset */ ofs = ofs_end; sweepvar_wrap++; @@ -3984,6 +3996,10 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct) * p loop split repeated 2 timed (for x and y points) to preserve cache locality */ prev_x = 0; last = ofs; + + /* optimization: skip unwanted datasets, if no dc no need to detect sweep variable wraps */ + if(dataset >= 0 && strcmp(xctx->raw->sim_type, "dc") && dataset != sweepvar_wrap) goto done; + for(p = ofs ; p < ofs_end; p++) { double xxprevious, xxfollowing; @@ -4059,6 +4075,8 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct) } /* if(xx >= start && xx <= end) */ prev_x = xx; } /* for(p = ofs ; p < ofs + xctx->raw->npoints[dset]; p++) */ + + if(first != -1) { if(dataset == -1 || dataset == sweepvar_wrap) { /* plot graph. Bus bundles are not plotted if graph is not digital.*/ @@ -4075,6 +4093,9 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct) } } } + + done: + /* offset pointing to next dataset */ ofs = ofs_end; sweepvar_wrap++; diff --git a/xschem_library/ngspice/autozero_comp.sch b/xschem_library/ngspice/autozero_comp.sch index f3d4ef1f..50073e61 100644 --- a/xschem_library/ngspice/autozero_comp.sch +++ b/xschem_library/ngspice/autozero_comp.sch @@ -53,10 +53,12 @@ color="8 6" linewidth_mult=1.0 hilight_wave=-1 -dataset=-1 +dataset=188 rawfile=$netlist_dir/autozero_comp.raw sim_type=tran -rainbow=0} +rainbow=0 +hcursor1_y=0.13350312 +hcursor2_y=0.58853305} B 2 270 -1160 680 -1030 {flags=graph,unlocked y1 = 0.647319 y2 = 0.652563 @@ -135,6 +137,27 @@ saout sweep="freq0 freq1 freq0" mode=HistoH xlabmag=2.0} +B 2 270 -1610 680 -1450 {flags=graph,unlocked +y1 = 0 +y2 = 0.9 +divy = 5 +x1=1.9099218e-07 +x2=3.4920522e-07 +divx=5 +subdivx=4 +unitx=n +node="zero0 +zero1 +zero2" +color="12 4 7" + +linewidth_mult=0.1 +hilight_wave=-1 + +rawfile=$netlist_dir/autozero_comp.raw +sim_type=tran +rainbow=0 +dataset=235} T {CAL} 140 -180 0 1 0.4 0.4 {} T {EN} 140 -130 0 1 0.4 0.4 {} T {CALIBRATION