add `fast` option in xschem hilight_instname. mos_power_ampli: use hilight to show devices with high current

This commit is contained in:
stefan schippers 2023-12-09 11:39:04 +01:00
parent b21ac67cc4
commit c8ced06bbe
4 changed files with 54 additions and 12 deletions

View File

@ -538,6 +538,8 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
@ -823,8 +825,9 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
Highlight selected element/pins/labels/nets
if 'drill' is given propagate net highlights through conducting elements
(elements that have the 'propag' attribute on pins ) </pre>
<li><kbd> hilight_instname inst</kbd></li><pre>
<li><kbd> hilight_instname inst [fast]</kbd></li><pre>
Highlight instance 'inst'
if 'fast' is specified do not redraw
'inst' can be an instance name or number </pre>
<li><kbd> hilight_netname net</kbd></li><pre>
Highlight net name 'net' </pre>
@ -1451,6 +1454,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
</ul>

View File

@ -1796,8 +1796,9 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
redraw_hilights(0);
Tcl_ResetResult(interp);
}
/* hilight_instname inst
/* hilight_instname inst [fast]
* Highlight instance 'inst'
* if 'fast' is specified do not redraw
* 'inst' can be an instance name or number */
else if(!strcmp(argv[1], "hilight_instname"))
{
@ -1806,6 +1807,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
int inst;
char *type;
int incr_hi;
int fast = 0;
if(argc > 3 && !strcmp(argv[3], "fast")) fast = 1;
xctx->enable_drill=0;
incr_hi = tclgetboolvar("incr_hilight");
prepare_netlist_structs(0);
@ -1828,8 +1831,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
if(incr_hi) incr_hilight_color();
}
dbg(1, "hilight_nets=%d\n", xctx->hilight_nets);
if(xctx->hilight_nets) propagate_hilights(1, 0, XINSERT_NOREPLACE);
redraw_hilights(0);
if(!fast) {
if(xctx->hilight_nets) propagate_hilights(1, 0, XINSERT_NOREPLACE);
redraw_hilights(0);
}
}
}
Tcl_ResetResult(interp);

View File

@ -482,3 +482,36 @@ C {ngspice_get_expr.sym} 130 -730 0 1 {name=r21
node="[format %.4g [expr [ngspice::get_current \{q7[ic]\}] / [ngspice::get_current \{q7[ib]\}] ] ]"
descr = beta
}
C {launcher.sym} 460 -190 0 0 {name=h5
descr=hi_current
tclcommand="
set incr_hilight 0
xschem unhilight_all
foreach \{n s t\} [xschem instance_list] \{
if \{$t == \{label\} || $t == \{ipin\} || $t == \{opin\} || $t == \{iopin\}\} \{continue\}
set curr 0
if \{$t == \{resistor\} || $t == \{ammeter\} \} \{
set curr [expr \{ abs([from_eng [xschem translate $n \{@spice_get_current\}]])\}]
\}
if \{$t == \{pnp\} || $t == \{npn\}\} \{
set curr [expr \{abs([ngspice::get_current $n\\\\\\[ic\\\\\\]])\}]
\}
if \{$t == \{nmos\}\} \{
set curr [expr \{abs([ngspice::get_current $n.rd\\\\\\[i\\\\\\]])\}]
\}
if \{$curr > 0.02\} \{
xschem set hilight_color 11
xschem hilight_instname $n fast
\} elseif \{$curr > 0.01\} \{
xschem set hilight_color 0
xschem hilight_instname $n fast
\} else \{
xschem set hilight_color 4
xschem hilight_instname $n fast
\}
\}
xschem redraw
"
}

View File

@ -38,8 +38,8 @@ B 2 1200 -500 1880 -310 {flags=graph
y1 = -0.00095
y2 = 12
divy = 6
x1=0.0226597
x2=0.0229721
x1=0.0246251
x2=0.0249375
divx=10
node="i(v.x1.vu)
i(v.x0.vu)
@ -52,8 +52,8 @@ B 2 1200 -830 1880 -520 {flags=graph
y1 = -50
y2 = 61
divy = 12
x1=0.0226597
x2=0.0229721
x1=0.0246251
x2=0.0249375
divx=10
node="outp
outm
@ -69,8 +69,8 @@ B 2 1200 -1020 1880 -830 {flags=graph
y1 = 0
y2 = 1100
divy = 6
x1=0.0226597
x2=0.0229721
x1=0.0246251
x2=0.0249375
divx=10
@ -83,8 +83,8 @@ B 2 1200 -310 1880 -120 {flags=graph
y1 = 0
y2 = 960
divy = 6
x1=0.0226597
x2=0.0229721
x1=0.0246251
x2=0.0249375
divx=10