From c8ced06bbe2fd8ca32151cd3ec89b462c0282ed5 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Sat, 9 Dec 2023 11:39:04 +0100 Subject: [PATCH] add `fast` option in xschem hilight_instname. mos_power_ampli: use hilight to show devices with high current --- doc/xschem_man/developer_info.html | 6 +++- src/scheduler.c | 11 +++++-- xschem_library/examples/mos_power_ampli.sch | 33 +++++++++++++++++++++ xschem_library/examples/poweramp.sch | 16 +++++----- 4 files changed, 54 insertions(+), 12 deletions(-) diff --git a/doc/xschem_man/developer_info.html b/doc/xschem_man/developer_info.html index bf953e8f..bad620aa 100644 --- a/doc/xschem_man/developer_info.html +++ b/doc/xschem_man/developer_info.html @@ -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 ) -
  • 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 
  • hilight_netname net
  •     Highlight net name 'net' 
    @@ -1451,6 +1454,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns" + diff --git a/src/scheduler.c b/src/scheduler.c index 3982afb6..651d08b1 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -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); diff --git a/xschem_library/examples/mos_power_ampli.sch b/xschem_library/examples/mos_power_ampli.sch index 1ce5a9a5..53ef1e80 100644 --- a/xschem_library/examples/mos_power_ampli.sch +++ b/xschem_library/examples/mos_power_ampli.sch @@ -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 + +" +} diff --git a/xschem_library/examples/poweramp.sch b/xschem_library/examples/poweramp.sch index cec1ab07..0edee977 100644 --- a/xschem_library/examples/poweramp.sch +++ b/xschem_library/examples/poweramp.sch @@ -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