bus value viewer show transitions (`X`), adding some query commands to get/set waveform attributes/plot data
This commit is contained in:
parent
71a98e78f5
commit
d9a51e4b1a
|
|
@ -30,7 +30,9 @@ static int waves_selected(int event, int key, int state, int button)
|
|||
if(xctx->ui_state & excl) skip = 1;
|
||||
else if(state & Mod1Mask) skip = 1;
|
||||
else if(event == MotionNotify && (state & Button2Mask)) skip = 1;
|
||||
else if(event == MotionNotify && (state & Button1Mask) && (state & ShiftMask)) skip = 1;
|
||||
else if(event == ButtonPress && button == Button2) skip = 1;
|
||||
else if(event == ButtonPress && button == Button1 && (state & ShiftMask) ) skip = 1;
|
||||
else if(event == ButtonRelease && button == Button2) skip = 1;
|
||||
else if(event == KeyPress && (state & ShiftMask)) skip = 1;
|
||||
else if(!skip) for(i=0; i< xctx->rects[GRIDLAYER]; i++) {
|
||||
|
|
|
|||
39
src/draw.c
39
src/draw.c
|
|
@ -1768,7 +1768,8 @@ int schematic_waves_loaded(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void get_bus_value(int n_bits, int hex_digits, SPICE_DATA **idx_arr, int p, char *busval, double vth)
|
||||
void get_bus_value(int n_bits, int hex_digits, SPICE_DATA **idx_arr, int p, char *busval,
|
||||
double vthl, double vthh)
|
||||
{
|
||||
double val;
|
||||
int i;
|
||||
|
|
@ -1776,24 +1777,35 @@ void get_bus_value(int n_bits, int hex_digits, SPICE_DATA **idx_arr, int p, char
|
|||
int bin = 0;
|
||||
int hex = 0;
|
||||
char hexstr[] = "084C2A6E195D3B7F"; /* mirrored (Left/right) hex */
|
||||
|
||||
int x = 0;
|
||||
for(i = n_bits - 1; i >= 0; i--) {
|
||||
val = idx_arr[i][p];
|
||||
hexdigit |= (val > vth);
|
||||
if(val >= vthl && val <= vthh) { /* signal transitioning --> 'X' */
|
||||
x = 1; /* flag for 'X' value */
|
||||
i += bin - 3;
|
||||
bin = 3; /* skip remaining bits of hex digit */
|
||||
if(i < 0) break; /* MSB nibble is less than 4 bits --> break */
|
||||
} else hexdigit |= (val >= vthh ? 1 : 0);
|
||||
if(bin < 3) {
|
||||
bin++;
|
||||
hexdigit <<= 1;
|
||||
} else {
|
||||
hex++;
|
||||
busval[hex_digits - hex] = hexstr[hexdigit];
|
||||
hexdigit = 0;
|
||||
if(x)
|
||||
busval[hex_digits - hex] = 'X';
|
||||
else
|
||||
busval[hex_digits - hex] = hexstr[hexdigit];
|
||||
hexdigit = 0; /* prepare for next hex digit */
|
||||
bin = 0;
|
||||
x = 0;
|
||||
}
|
||||
}
|
||||
if(bin) {
|
||||
if(bin) { /* process (incomplete) MSB nibble */
|
||||
hex++;
|
||||
busval[hex_digits - hex] = hexstr[hexdigit];
|
||||
hexdigit = 0;
|
||||
if(x)
|
||||
busval[hex_digits - hex] = 'X';
|
||||
else
|
||||
busval[hex_digits - hex] = hexstr[hexdigit];
|
||||
}
|
||||
busval[hex_digits] = '\0';
|
||||
}
|
||||
|
|
@ -1836,7 +1848,7 @@ static void draw_graph_bus_points(const char *ntok, int n_bits, SPICE_DATA **idx
|
|||
double c = (n_nodes - wcnt) * s1 * gr->gh - gr->gy1 * s2; /* trace baseline */
|
||||
double c1 = c + gr->gh * 0.5 * s2; /* trace y-center, used for clipping */
|
||||
double lx1 = W_X(xctx->graph_values[sweep_idx][first]);
|
||||
double lx2 = W_X(xctx->graph_values[sweep_idx][last-1]);
|
||||
double lx2 = W_X(xctx->graph_values[sweep_idx][last]);
|
||||
double ylow = DW_Y(c + gr->gy2 * s2); /* swapped as xschem Y coordinates are top-bottom */
|
||||
double yhigh = DW_Y(c + gr->gy1 * s2);
|
||||
char busval[1024], old_busval[1024];
|
||||
|
|
@ -1845,7 +1857,8 @@ static void draw_graph_bus_points(const char *ntok, int n_bits, SPICE_DATA **idx
|
|||
double labsize = 0.015 * ydelta;
|
||||
double charwidth = labsize * 38.0;
|
||||
double x_size = 1.5 * xctx->zoom;
|
||||
double vth = (gr->gy1 + gr->gy2) * 0.5;
|
||||
double vthh = gr->gy1 * 0.2 + gr->gy2 * 0.8;
|
||||
double vthl = gr->gy1 * 0.8 + gr->gy2 * 0.2;
|
||||
int hex_digits = ((n_bits - 1) >> 2) + 1;
|
||||
if(c1 >= gr->ypos1 && c1 <=gr->ypos2) {
|
||||
drawline(wave_col, NOW, lx1, ylow, lx2, ylow, 0);
|
||||
|
|
@ -1853,7 +1866,7 @@ static void draw_graph_bus_points(const char *ntok, int n_bits, SPICE_DATA **idx
|
|||
for(p = first ; p <= last; p++) {
|
||||
/* calculate value of bus by adding all binary bits */
|
||||
/* hex_digits = */
|
||||
get_bus_value(n_bits, hex_digits, idx_arr, p, busval, vth);
|
||||
get_bus_value(n_bits, hex_digits, idx_arr, p, busval, vthl, vthh);
|
||||
xval = W_X(xctx->graph_values[sweep_idx][p]);
|
||||
/* used to draw bus value before 1st transition */
|
||||
if(p == first) {
|
||||
|
|
@ -2263,6 +2276,8 @@ static void show_node_measures(int measure_p, double measure_x, double measure_p
|
|||
double yy = yy1 + diffy / diffx * (xctx->graph_cursor1_x - measure_prev_x);
|
||||
char *fmt1, *fmt2;
|
||||
int hex_digits = ((n_bits - 1) >> 2) + 1;
|
||||
double vthh = gr->gy1 * 0.2 + gr->gy2 * 0.8;
|
||||
double vthl = gr->gy1 * 0.8 + gr->gy2 * 0.2;
|
||||
|
||||
if(SIGN0(gr->gy1) != SIGN0(gr->gy2) && fabs(yy) < 1e-4 * fabs(gr->gh)) yy = 0.0;
|
||||
if(yy != 0.0 && fabs(yy * gr->unity) < 1.0e-3) {
|
||||
|
|
@ -2280,7 +2295,7 @@ static void show_node_measures(int measure_p, double measure_x, double measure_p
|
|||
if(gr->unity != 1.0) my_snprintf(tmpstr, S(tmpstr), fmt2, yy * gr->unity, gr->unity_suffix);
|
||||
else my_snprintf(tmpstr, S(tmpstr), fmt1, yy);
|
||||
} else {
|
||||
get_bus_value(n_bits, hex_digits, idx_arr, measure_p, tmpstr, (gr->gy1 + gr->gy2) * 0.5);
|
||||
get_bus_value(n_bits, hex_digits, idx_arr, measure_p, tmpstr, vthl, vthh);
|
||||
}
|
||||
if(!bus_msb && !gr->digital) {
|
||||
draw_string(wave_color, NOW, tmpstr, 0, 0, 0, 0,
|
||||
|
|
|
|||
|
|
@ -1048,6 +1048,15 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
Tcl_SetResult(interp, xctx->sym[i].prop_ptr, TCL_VOLATILE);
|
||||
else
|
||||
Tcl_SetResult(interp, (char *)get_tok_value(xctx->sym[i].prop_ptr, argv[4], 0), TCL_VOLATILE);
|
||||
} else if (!strcmp(argv[2],"rect")) {
|
||||
if(argc <=5) {
|
||||
Tcl_SetResult(interp, "xschem getprop rect needs <color> <n> <token>", TCL_STATIC);
|
||||
return TCL_ERROR;
|
||||
} else {
|
||||
int c = atoi(argv[3]);
|
||||
int n = atoi(argv[4]);
|
||||
Tcl_SetResult(interp, (char *)get_tok_value(xctx->rect[c][n].prop_ptr, argv[5], 0), TCL_VOLATILE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ y1 = -0.0039
|
|||
y2 = 0.87
|
||||
divy = 3
|
||||
subdivy=1
|
||||
x1=1.21536e-07
|
||||
x2=3.17599e-07 divx=10
|
||||
x1=2e-12
|
||||
x2=4.8e-07 divx=10
|
||||
node="
|
||||
ldbl[0] ldbl[16] ldbl[32]
|
||||
ldbl[1] ldbl[17] ldbl[33]
|
||||
|
|
@ -47,8 +47,8 @@ y1 = -0.021
|
|||
y2 = 1.5
|
||||
subdivy=1
|
||||
divy = 4
|
||||
x1=1.21536e-07
|
||||
x2=3.17599e-07
|
||||
x1=2e-12
|
||||
x2=4.8e-07
|
||||
divx=10
|
||||
subdivx=4
|
||||
node="ldcp ldyms[4] ldyms[5] ldyms[6] ldymsref"
|
||||
|
|
@ -61,8 +61,8 @@ y2 = 1.6
|
|||
divy = 3
|
||||
subdivy=0
|
||||
subdivx = 1
|
||||
x1=1.21536e-07
|
||||
x2=3.17599e-07 divx=10
|
||||
x1=2e-12
|
||||
x2=4.8e-07 divx=10
|
||||
node="
|
||||
ldwl[0] ldwl[1] ldwl[2] ldwl[3]
|
||||
ldwl[4] ldwl[5] ldwl[6] ldwl[16]
|
||||
|
|
@ -74,8 +74,8 @@ B 2 1840 -120 2890 -20 {flags=3
|
|||
y1 = -0.021
|
||||
y2 = 0.9
|
||||
divy = 1
|
||||
x1=1.21536e-07
|
||||
x2=3.17599e-07 divx=10
|
||||
x1=2e-12
|
||||
x2=4.8e-07 divx=10
|
||||
node="ldymsref"
|
||||
color=3 unitx=n subdivy=4
|
||||
}
|
||||
|
|
@ -83,17 +83,17 @@ B 2 1840 -880 2890 -420 {flags=3
|
|||
digital=1
|
||||
y1 = 0
|
||||
y2 = 1.6
|
||||
ypos1=0.0886114
|
||||
ypos2=2.23099
|
||||
ypos1=0.0962921
|
||||
ypos2=2.80336
|
||||
divy = 1
|
||||
x1=1.21536e-07
|
||||
x2=3.17599e-07
|
||||
x1=1.9725e-07
|
||||
x2=2.85288e-07
|
||||
divx=12
|
||||
subdivx=4
|
||||
node="
|
||||
---In/Out---
|
||||
ldq[15]
|
||||
ldcp
|
||||
ldq[15] ldq[14] ldq[13] ldq[12]
|
||||
LDA,lda[12],lda[11],lda[10],lda[9],lda[8],lda[7],lda[6],lda[5],lda[4],lda[3],lda[2],lda[1],lda[0]
|
||||
LDQ,ldq[15],ldq[14],ldq[13],ldq[12],ldq[11],ldq[10],ldq[9],ldq[8],ldq[7],ldq[6],ldq[5],ldq[4],ldq[3],ldq[2],ldq[1],ldq[0]
|
||||
---Timing---
|
||||
|
|
@ -103,8 +103,9 @@ LDL3X,ldl3x[7],ldl3x[6],ldl3x[5],ldl3x[4],ldl3x[3],ldl3x[2],ldl3x[1],ldl3x[0]
|
|||
LDL2X,ldl2x[3],ldl2x[2],ldl2x[1],ldl2x[0]
|
||||
LDL1X,ldl1x[15],ldl1x[14],ldl1x[13],ldl1x[12],ldl1x[11],ldl1x[10],ldl1x[9],ldl1x[8],ldl1x[7],ldl1x[6],ldl1x[5],ldl1x[4],ldl1x[3],ldl1x[2],ldl1x[1],ldl1x[0]
|
||||
LDY1,ldy1[3],ldy1[2],ldy1[1],ldy1[0]
|
||||
WL[15:0],ldwl[15],ldwl[14],ldwl[13],ldwl[12],ldwl[11],ldwl[10],ldwl[9],ldwl[8],ldwl[7],ldwl[6],ldwl[5],ldwl[4],ldwl[3],ldwl[2],ldwl[1],ldwl[0]
|
||||
"
|
||||
color="18 4 15 4 15 18 15 4 18 4 15 4 15 4 15 4 15 4 15 4 15 4 15"
|
||||
color="18 4 15 4 15 4 15 4 18 15 4 18 4 15 4 15 4 15 4 15 4 15 4 15 4 15"
|
||||
unitx=n
|
||||
ypos1=-2.20115 ypos2=2.79884
|
||||
}
|
||||
|
|
@ -112,8 +113,8 @@ B 2 1840 -1280 2890 -1090 {flags=3
|
|||
y1 = -0.022
|
||||
y2 = 1.6
|
||||
divy = 4
|
||||
x1=1.19234e-07
|
||||
x2=3.15297e-07
|
||||
x1=2e-12
|
||||
x2=4.8e-07
|
||||
divx=8
|
||||
unitx=n
|
||||
node="xsa[0].ldqib xsa[5].ldqib xsa[0].ldsali xctrl.ldq_b"
|
||||
|
|
|
|||
Loading…
Reference in New Issue