disable displaying backannotation data if `b` cursor is hidden or `Simulation->Live annotation with b cursor` is disabled. Use resolved_net() in translate() when displaying @spice_get_voltage so it will work on sub block ports

This commit is contained in:
stefan schippers 2023-06-05 12:58:19 +02:00
parent 1cf0c820f9
commit 4f387f3bbe
5 changed files with 33 additions and 7 deletions

View File

@ -420,7 +420,9 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
need_all_redraw = 1;
}
} else {
need_all_redraw = 1;
xctx->graph_annotate_p = -1;
/* need_all_redraw = 1; */
redraw_all_at_end = 1;
}
}
/* swap cursors */

View File

@ -3398,13 +3398,16 @@ const char *translate(int inst, const char* s)
else if(strcmp(token,"@spice_get_voltage")==0 )
{
int start_level; /* hierarchy level where waves were loaded */
if(xctx->graph_annotate_p>=0 && !tclgetboolvar("live_cursor2_backannotate")) {
xctx->graph_annotate_p = -1;
}
if((start_level = sch_waves_loaded()) >= 0 && xctx->graph_annotate_p>=0) {
int multip;
int no_of_pins= (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER];
if(no_of_pins == 1) {
char *fqnet = NULL;
const char *path = xctx->sch_path[xctx->currsch] + 1;
const char *net = NULL;
char *net = NULL;
size_t len;
int idx;
double val;
@ -3417,14 +3420,19 @@ const char *translate(int inst, const char* s)
++path;
}
prepare_netlist_structs(0);
net = expandlabel(xctx->inst[inst].lab, &multip);
if(net == NULL || net[0] == '\0') net = net_name(inst,0, &multip, 0, 0);
my_strdup2(_ALLOC_ID_, &net, expandlabel(xctx->inst[inst].lab, &multip));
if(net == NULL || net[0] == '\0') {
my_strdup2(_ALLOC_ID_, &net, net_name(inst, 0, &multip, 0, 0));
}
if(multip == 1) {
len = strlen(path) + strlen(net) + 1;
dbg(1, "translate() @spice_get_voltage: inst=%s\n", xctx->inst[inst].instname);
dbg(1, " net=%s\n", net);
fqnet = my_malloc(_ALLOC_ID_, len);
my_snprintf(fqnet, len, "%s%s", path, net);
/*
* fqnet = my_malloc(_ALLOC_ID_, len);
* my_snprintf(fqnet, len, "%s%s", path, net);
*/
my_strdup2(_ALLOC_ID_, &fqnet, resolved_net(net));
strtolower(fqnet);
dbg(1, "translate() @spice_get_voltage: fqnet=%s start_level=%d\n", fqnet, start_level);
idx = get_raw_index(fqnet);
@ -3447,7 +3455,8 @@ const char *translate(int inst, const char* s)
dbg(1, "inst %d, net=%s, fqnet=%s idx=%d valstr=%s\n", inst, net, fqnet, idx, valstr);
my_free(_ALLOC_ID_, &fqnet);
}
}
my_free(_ALLOC_ID_, &net);
}
}
}
}
@ -3455,6 +3464,9 @@ const char *translate(int inst, const char* s)
{
int start_level; /* hierarchy level where waves were loaded */
dbg(1, "--> %s\n", token);
if(xctx->graph_annotate_p>=0 && !tclgetboolvar("live_cursor2_backannotate")) {
xctx->graph_annotate_p = -1;
}
if((start_level = sch_waves_loaded()) >= 0 && xctx->graph_annotate_p>=0) {
char *fqnet = NULL;
const char *path = xctx->sch_path[xctx->currsch] + 1;
@ -3509,6 +3521,9 @@ const char *translate(int inst, const char* s)
else if(strncmp(token,"@spice_get_current(", 19)==0 )
{
int start_level; /* hierarchy level where waves were loaded */
if(xctx->graph_annotate_p>=0 && !tclgetboolvar("live_cursor2_backannotate")) {
xctx->graph_annotate_p = -1;
}
if((start_level = sch_waves_loaded()) >= 0 && xctx->graph_annotate_p>=0) {
char *fqdev = NULL;
const char *path = xctx->sch_path[xctx->currsch] + 1;
@ -3576,6 +3591,9 @@ const char *translate(int inst, const char* s)
else if(strcmp(token,"@spice_get_diff_voltage")==0 )
{
int start_level; /* hierarchy level where waves were loaded */
if(xctx->graph_annotate_p>=0 && !tclgetboolvar("live_cursor2_backannotate")) {
xctx->graph_annotate_p = -1;
}
if((start_level = sch_waves_loaded()) >= 0 && xctx->graph_annotate_p>=0) {
int multip;
int no_of_pins= (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER];
@ -3642,6 +3660,9 @@ const char *translate(int inst, const char* s)
else if(strcmp(token,"@spice_get_current")==0 )
{
int start_level; /* hierarchy level where waves were loaded */
if(xctx->graph_annotate_p>=0 && !tclgetboolvar("live_cursor2_backannotate")) {
xctx->graph_annotate_p = -1;
}
if((start_level = sch_waves_loaded()) >= 0 && xctx->graph_annotate_p>=0) {
char *fqdev = NULL;
const char *path = xctx->sch_path[xctx->currsch] + 1;

View File

@ -12,3 +12,4 @@ L 5 -0 -0 3.125 0 {}
B 5 -1.25 -1.25 1.25 1.25 {name=p dir=inout}
P 5 7 13.75 5 17.5 0 13.75 -5 6.875 -5 3.125 0 6.875 5 13.75 5 {fill=true}
T {@lab} 19.8438 -9.375 0 0 0.33 0.33 {}
T {@spice_get_voltage} -1.875 3.90625 0 1 0.2 0.2 {layer=15}

View File

@ -12,3 +12,4 @@ L 5 -5 0 0 0 {}
B 5 -1.25 -1.25 1.25 1.25 {name=p dir=out}
P 5 7 -5 0 -8.75 -5 -17.5 -5 -13.75 0 -17.5 5 -8.75 5 -5 0 {fill=true}
T {@lab} -18.75 -8.75 0 1 0.33 0.33 {}
T {@spice_get_voltage} 1.875 3.90625 0 0 0.2 0.2 {layer=15}

View File

@ -12,3 +12,4 @@ L 5 0 0 8.75 0 {}
B 5 -1.25 -1.25 1.25 1.25 {name=p dir=in}
P 5 7 17.5 0 13.75 -5 5 -5 8.75 0 5 5 13.75 5 17.5 0 {fill=true}
T {@lab} 20 -8.75 0 0 0.33 0.33 {}
T {@spice_get_voltage} -1.875 3.90625 0 1 0.2 0.2 {layer=15}