second round of additions to improve auto_hilight_graph_nodes

This commit is contained in:
stefan schippers 2024-03-25 22:28:29 +01:00
parent aa6182c65f
commit f53bc2c6b7
4 changed files with 46 additions and 21 deletions

View File

@ -3632,10 +3632,14 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
if(strpbrk(express, " \n\t")) { if(strpbrk(express, " \n\t")) {
expression = 1; expression = 1;
} }
if(!expression && tclgetboolvar("auto_hilight_graph_nodes")) { }
hilight_graph_node(express, wc); if(raw && raw->values && tclgetboolvar("auto_hilight_graph_nodes")) {
if(!expression) {
if(!bus_msb) hilight_graph_node(express, wc);
else hilight_graph_node(bus_msb, wc);
} }
} }
dbg(1, "express=%s, bus_msb=%s\n", express ? express : "NULL", bus_msb ? bus_msb : "NULL");
/* quickly find index number of ntok_copy variable to be plotted */ /* quickly find index number of ntok_copy variable to be plotted */
if( expression || (idx = get_raw_index(bus_msb ? bus_msb : express, NULL)) != -1 ) { if( expression || (idx = get_raw_index(bus_msb ? bus_msb : express, NULL)) != -1 ) {
int p, dset, ofs, ofs_end; int p, dset, ofs, ofs_end;

View File

@ -259,28 +259,48 @@ static int there_are_hilights()
int hilight_graph_node(const char *node, int col) int hilight_graph_node(const char *node, int col)
{ {
int current = 0;
const char *path; const char *path;
const char *path3;
char *path2 = NULL;
char *n = NULL; char *n = NULL;
char *nptr, *ptr; char *nptr, *ptr, *ptr2;
Hilight_hashentry *entry; Hilight_hashentry *entry;
if(strchr(node, '.')) return 0;
path = xctx->sch_path[xctx->currsch]; path = xctx->sch_path[xctx->currsch];
my_strdup2(_ALLOC_ID_, &n, node); my_strdup2(_ALLOC_ID_, &n, node);
nptr = n; nptr = n;
if(strstr(n, "i(")) {nptr[1] = ' '; nptr += 1;} dbg(1, "hilight_graph_node(): %s: %d\n", node, col);
else if(strstr(n, "I(")) {nptr[1] = ' '; nptr += 1;} if(strstr(n, "i(v.")) {current = 1; nptr += 4;}
if((ptr = strchr(n, ')'))) *ptr = '\0'; else if(strstr(n, "I(V.")) {current = 1; nptr += 4;}
else if(strstr(n, "i(")) {current = 1; nptr += 2;}
else if(strstr(n, "I(")) {current = 1; nptr += 2;}
else if(strstr(n, "v(")) {nptr += 2;}
else if(strstr(n, "V(")) {nptr += 2;}
if((ptr = strrchr(n, ')'))) *ptr = '\0';
dbg(1, "hilight_graph_node(): %s: %d\n", n, col); if((ptr2 = strrchr(nptr, '.'))) {
entry = hier_hilight_hash_lookup(nptr, -col, path, XLOOKUP); *ptr2 = '\0';
path3 = nptr;
nptr = ptr2 + 1;
my_mstrcat(_ALLOC_ID_, &path2, path, path3, ".", NULL);
}
else {
my_strdup2(_ALLOC_ID_, &path2, path);
}
if(current) {
nptr--;
*nptr = ' ';
}
entry = hier_hilight_hash_lookup(nptr, -col, path2, XLOOKUP);
if(!entry || entry->value != -col ) { if(!entry || entry->value != -col ) {
hier_hilight_hash_lookup(nptr, -col, path, XINSERT); hier_hilight_hash_lookup(nptr, -col, path2, XINSERT);
dbg(1, "hilight_graph_node(): propagate_hilights(), col=%d\n", col); dbg(1, "hilight_graph_node(): propagate_hilights(), col=%d\n", col);
propagate_hilights(1, 0, XINSERT_NOREPLACE); propagate_hilights(1, 0, XINSERT_NOREPLACE);
} }
my_free(_ALLOC_ID_, &n); my_free(_ALLOC_ID_, &n);
my_free(_ALLOC_ID_, &path2);
return 1; return 1;
} }

View File

@ -61,7 +61,7 @@ VPP
VNN VNN
x1.VBOOST x1.VBOOST
x0.VBOOST" x0.VBOOST"
color="4 15 6 12 7 4" color="4 15 10 12 7 4"
unitx=m unitx=m
hilight_wave=-1 hilight_wave=-1
linewidth_mult=2.3} linewidth_mult=2.3}

View File

@ -36,10 +36,10 @@ x1=2e-12
x2=9e-06 x2=9e-06
divx=5 divx=5
subdivx=1 subdivx=1
node="sig_in node="SIG_IN
vref VREF
vcc" VCC"
color="8 9 11" color="8 9 4"
dataset=0 dataset=0
unitx=u unitx=u
} }
@ -55,14 +55,15 @@ x1=2e-12
x2=9e-06 x2=9e-06
divx=5 divx=5
subdivx=1 subdivx=1
node="CODE;code[5],code[4],code[3],code[2],code[1],code[0] node="CODE;CODE[5],CODE[4],CODE[3],CODE[2],CODE[1],CODE[0]
ck CK
rst RST
x1.comp" x1.COMP"
color="7 4 10 4" color="7 4 10 4"
dataset=0 dataset=0
unitx=u unitx=u
digital=1} digital=1
}
B 2 900 -970 1700 -630 {flags=graph B 2 900 -970 1700 -630 {flags=graph
y1=14.1924 y1=14.1924
y2=54.9924 y2=54.9924
@ -186,7 +187,7 @@ tclcommand="
xschem raw_read $netlist_dir/[file tail [file rootname [xschem get current_name]]].raw tran xschem raw_read $netlist_dir/[file tail [file rootname [xschem get current_name]]].raw tran
" "
} }
C {launcher.sym} 870 -90 0 0 {name=h1 C {launcher.sym} 650 -870 0 0 {name=h1
descr="Netlist + Simulate descr="Netlist + Simulate
Ctrl-Left-Click" Ctrl-Left-Click"
tclcommand="xschem netlist; simulate" tclcommand="xschem netlist; simulate"