various fixes in multi trace/multi dataset graphs
This commit is contained in:
parent
5ac44c11ea
commit
c42f37909c
32
src/draw.c
32
src/draw.c
|
|
@ -1571,6 +1571,9 @@ int read_dataset(FILE *fd)
|
|||
if(sim_type && sim_type != 2) sim_type = 0;
|
||||
else sim_type = 2;
|
||||
}
|
||||
else if(!strncmp(line, "Plotname:", 9)) {
|
||||
sim_type = 0;
|
||||
}
|
||||
/* points and vars are needed for all sections (also ones we are not interested in)
|
||||
* to skip binary blobs */
|
||||
else if(!strncmp(line, "No. of Data Rows :", 18)) {
|
||||
|
|
@ -1838,7 +1841,7 @@ static void draw_graph_bus_points(const char *ntok, int first, int last,
|
|||
}
|
||||
drawline(wave_col, NOW, x1, ylow, x2, ylow, 0);
|
||||
drawline(wave_col, NOW, x1, yhigh, x2, yhigh, 0);
|
||||
for(p = first ; p < last; p++) {
|
||||
for(p = first ; p <= last; p++) {
|
||||
/* calculate value of bus by adding all binary bits */
|
||||
busval = 0;
|
||||
for(i = 0; i < n_bits; i++) {
|
||||
|
|
@ -1894,7 +1897,7 @@ static void draw_graph_points(int v, int first, int last, double cy, double dy,
|
|||
double c = ydelta * wcnt * s1;
|
||||
|
||||
if( !digital || (c >= wy1 && c <= wy2) ) {
|
||||
for(p = first ; p < last; p++) {
|
||||
for(p = first ; p <= last; p++) {
|
||||
yy = xctx->graph_values[v][p];
|
||||
if(digital) {
|
||||
yy = c + yy *s2;
|
||||
|
|
@ -2186,7 +2189,7 @@ void draw_graph(int c, int i, int flags)
|
|||
int p, dset, ofs;
|
||||
int poly_npoints;
|
||||
int v;
|
||||
int first;
|
||||
int first, last;
|
||||
double xx;
|
||||
double start;
|
||||
double end;
|
||||
|
|
@ -2204,48 +2207,57 @@ void draw_graph(int c, int i, int flags)
|
|||
/* loop through all datasets found in raw file */
|
||||
for(dset = 0 ; dset < xctx->graph_datasets; dset++) {
|
||||
if(dataset == -1 || dset == dataset) {
|
||||
double prev_x;
|
||||
first = -1;
|
||||
double prev_x, prev_prev_x;
|
||||
int cnt=0;
|
||||
first = last = -1;
|
||||
poly_npoints = 0;
|
||||
my_realloc(1401, &xarr, xctx->graph_npoints[dset] * sizeof(double));
|
||||
my_realloc(1402, &yarr, xctx->graph_npoints[dset] * sizeof(double));
|
||||
/* Process "npoints" simulation items
|
||||
* p loop split repeated 2 timed (for x and y points) to preserve cache locality */
|
||||
prev_prev_x = prev_x = 0;
|
||||
last = ofs;
|
||||
for(p = ofs ; p < ofs + xctx->graph_npoints[dset]; p++) {
|
||||
xx = xctx->graph_values[sweep_idx][p];
|
||||
if(xx > end || (sweep_idx == 0 && (p > ofs && fabs(xx) < fabs(prev_x))) ) {
|
||||
if(xx > end || xx < start ||
|
||||
((sweep_idx == 0 && cnt > 1) &&
|
||||
SIGN(xx - prev_x) != SIGN(prev_x - prev_prev_x) ) ) {
|
||||
if(first != -1) {
|
||||
/* get y-axis points */
|
||||
if(bus_msb) {
|
||||
if(digital) {
|
||||
draw_graph_bus_points(ntok, first, p, cx, dx, cy, dy, wave_color,
|
||||
draw_graph_bus_points(ntok, first, last, cx, dx, cy, dy, wave_color,
|
||||
sweep_idx, digital, dig_max_waves, wcnt, n_nodes, wy1, wy2);
|
||||
}
|
||||
} else {
|
||||
draw_graph_points(v, first, p, cy, dy, xarr, yarr, wave_color,
|
||||
draw_graph_points(v, first, last, cy, dy, xarr, yarr, wave_color,
|
||||
digital, dig_max_waves, wcnt, n_nodes, wy1, wy2);
|
||||
}
|
||||
poly_npoints = 0;
|
||||
first = -1;
|
||||
cnt = 0;
|
||||
}
|
||||
}
|
||||
if(xx >= start && xx <= end) {
|
||||
if(first == -1) first = p;
|
||||
/* Build poly x array. Translate from graph coordinates to {x1,y1} - {x2, y2} world. */
|
||||
xarr[poly_npoints] = W_X(xx);
|
||||
last = p;
|
||||
poly_npoints++;
|
||||
}
|
||||
prev_prev_x = prev_x;
|
||||
prev_x = xx;
|
||||
cnt++;
|
||||
}
|
||||
if(first != -1) {
|
||||
/* get y-axis points */
|
||||
if(bus_msb) {
|
||||
if(digital) {
|
||||
draw_graph_bus_points(ntok, first, p, cx, dx, cy, dy, wave_color,
|
||||
draw_graph_bus_points(ntok, first, last, cx, dx, cy, dy, wave_color,
|
||||
sweep_idx, digital, dig_max_waves, wcnt, n_nodes, wy1, wy2);
|
||||
}
|
||||
} else {
|
||||
draw_graph_points(v, first, p, cy, dy, xarr, yarr, wave_color,
|
||||
draw_graph_points(v, first, last, cy, dy, xarr, yarr, wave_color,
|
||||
digital, dig_max_waves, wcnt, n_nodes, wy1, wy2);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ function insert_symbol(sym, lib, n,cellname, name, dir, tmp)
|
|||
sub(/.*=/,"",name)
|
||||
dir=$0
|
||||
sub(/.*dir[ \t]*=/,"",dir)
|
||||
sub(/[ \t]*\}.*/,"",dir)
|
||||
sub(/[ \t]+.*\}.*/,"",dir)
|
||||
dir= dir=="in" ? "I" : (dir=="out" ? "O" : "B")
|
||||
pin_ar[cellname, ++n] = name
|
||||
pin_x[cellname,name]=($3+$5)/2
|
||||
|
|
|
|||
|
|
@ -311,7 +311,7 @@ extern char win_temp_dir[PATH_MAX];
|
|||
strcmp(type,"show_label") && strcmp(type,"iopin")))
|
||||
#define IS_LABEL_OR_PIN(type) (!(strcmp(type,"label") && strcmp(type,"ipin") && strcmp(type,"opin") && strcmp(type,"iopin")))
|
||||
#define IS_PIN(type) (!(strcmp(type,"ipin") && strcmp(type,"opin") && strcmp(type,"iopin")))
|
||||
|
||||
#define SIGN(x) ( (x) < 0 ? -1 : 1)
|
||||
|
||||
/* floor not needed? screen coordinates always positive <<<< */
|
||||
/* #define X_TO_SCREEN(x) ( floor(((x)+xctx->xorigin)* xctx->mooz) ) */
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ B 2 830 -490 1300 -280 {flags=1
|
|||
y1 = -0.0578106
|
||||
y2 = 3.04806
|
||||
divy = 6
|
||||
x1=0.0194063
|
||||
x2=3.15766
|
||||
x1=-0.0713879
|
||||
x2=3.06704
|
||||
divx=6
|
||||
node="v(a) v(zz) v(zzz)"
|
||||
color="4 6 8"
|
||||
|
|
@ -34,8 +34,8 @@ B 2 30 -930 500 -720 {flags=1
|
|||
y1 = -0.0578106
|
||||
y2 = 3.04806
|
||||
divy = 6
|
||||
x1=-0.0714119
|
||||
x2=3.06686
|
||||
x1=-0.0713879
|
||||
x2=3.06704
|
||||
divx=6
|
||||
node="v(a) v(z)"
|
||||
color="4 6 8"
|
||||
|
|
@ -70,7 +70,7 @@ N 540 -850 540 -760 { lab=A}
|
|||
C {vsource.sym} 50 -140 0 0 {name=V1 value="pwl 0 0 1u 0 5u 3"}
|
||||
C {lab_pin.sym} 50 -170 0 0 {name=p4 lab=A}
|
||||
C {lab_pin.sym} 50 -110 0 0 {name=p5 lab=0}
|
||||
C {code_shown.sym} 580 -150 0 0 {name=STIMULI
|
||||
C {code_shown.sym} 520 -190 0 0 {name=STIMULI
|
||||
only_toplevel=true
|
||||
tclcommand="xschem edit_vi_prop"
|
||||
value=".control
|
||||
|
|
@ -78,9 +78,13 @@ dc v1 0 3 0.001
|
|||
* .tran 10n 10u uic
|
||||
save all
|
||||
write LCC_instances.raw
|
||||
|
||||
set appendwrite
|
||||
dc v1 3 0 -0.001
|
||||
write LCC_instances.raw
|
||||
.endc
|
||||
"}
|
||||
C {code.sym} 760 -170 0 0 {name=MODEL
|
||||
C {code.sym} 840 -190 0 0 {name=MODEL
|
||||
only_toplevel="true"
|
||||
tclcommand="xschem edit_vi_prop"
|
||||
value="************************************************
|
||||
|
|
|
|||
Loading…
Reference in New Issue