xschem setprop made way faster if "fast" argument is provided. Example "clear probes" launcher object in mos_power_ampli.sch.

This commit is contained in:
Stefan Schippers 2020-10-19 02:07:17 +02:00
parent 7360982d7c
commit c84d71b859
4 changed files with 83 additions and 54 deletions

View File

@ -515,31 +515,33 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_AppendResult(interp, "xschem setprop: instance not found", NULL);
return TCL_ERROR;
} else {
bbox(BEGIN,0.0,0.0,0.0,0.0);
symbol_bbox(inst, &xctx->inst[inst].x1, &xctx->inst[inst].y1, &xctx->inst[inst].x2, &xctx->inst[inst].y2);
bbox(ADD, xctx->inst[inst].x1, xctx->inst[inst].y1, xctx->inst[inst].x2, xctx->inst[inst].y2);
push_undo();
set_modify(1);
if(!fast) {
prepared_hash_instances=0;
prepared_netlist_structs=0;
prepared_hilight_structs=0;
bbox(BEGIN,0.0,0.0,0.0,0.0);
symbol_bbox(inst, &xctx->inst[inst].x1, &xctx->inst[inst].y1, &xctx->inst[inst].x2, &xctx->inst[inst].y2);
bbox(ADD, xctx->inst[inst].x1, xctx->inst[inst].y1, xctx->inst[inst].x2, xctx->inst[inst].y2);
push_undo();
}
hash_all_names(inst);
set_modify(1);
prepared_hash_instances=0;
prepared_netlist_structs=0;
prepared_hilight_structs=0;
if(!strcmp(argv[3], "name")) hash_all_names(inst);
if(argc >= 5) {
new_prop_string(inst, subst_token(xctx->inst[inst].prop_ptr, argv[3], argv[4]),0, dis_uniq_names);
new_prop_string(inst, subst_token(xctx->inst[inst].prop_ptr, argv[3], argv[4]),fast, dis_uniq_names);
} else {/* assume argc == 4 */
new_prop_string(inst, subst_token(xctx->inst[inst].prop_ptr, argv[3], NULL),0, dis_uniq_names);
new_prop_string(inst, subst_token(xctx->inst[inst].prop_ptr, argv[3], NULL),fast, dis_uniq_names);
}
my_strdup2(367, &xctx->inst[inst].instname, get_tok_value(xctx->inst[inst].prop_ptr, "name",0));
/* new symbol bbox after prop changes (may change due to text length) */
symbol_bbox(inst, &xctx->inst[inst].x1, &xctx->inst[inst].y1, &xctx->inst[inst].x2, &xctx->inst[inst].y2);
bbox(ADD, xctx->inst[inst].x1, xctx->inst[inst].y1, xctx->inst[inst].x2, xctx->inst[inst].y2);
/* redraw symbol with new props */
bbox(SET,0.0,0.0,0.0,0.0);
draw();
bbox(END,0.0,0.0,0.0,0.0);
if(!fast) {
/* new symbol bbox after prop changes (may change due to text length) */
symbol_bbox(inst, &xctx->inst[inst].x1, &xctx->inst[inst].y1, &xctx->inst[inst].x2, &xctx->inst[inst].y2);
bbox(ADD, xctx->inst[inst].x1, xctx->inst[inst].y1, xctx->inst[inst].x2, xctx->inst[inst].y2);
/* redraw symbol with new props */
bbox(SET,0.0,0.0,0.0,0.0);
draw();
bbox(END,0.0,0.0,0.0,0.0);
}
}
Tcl_ResetResult(interp);
@ -756,7 +758,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
return TCL_ERROR;
}
if( (i = get_instance(argv[2])) < 0 ) {
Tcl_AppendResult(interp, "xschem getprop: instance not found", NULL);
Tcl_AppendResult(interp, "xschem instance_net: instance not found", NULL);
return TCL_ERROR;
}
prepare_netlist_structs(0);

View File

@ -1,5 +1,6 @@
v {xschem version=2.9.5_RC5 file_version=1.1}
G {type=launcher
v {xschem version=2.9.8 file_version=1.2}
G {}
K {type=launcher
format="** @descr : @url"
verilog_ignore=true
vhdl_ignore=true
@ -11,4 +12,4 @@ V {}
S {}
E {}
P 4 9 -0 -0 -30 -12.5 -30 -5 -60 -5 -50 0 -60 5 -30 5 -30 12.5 -0 0 {fill=true}
T {@descr} 10 -10 0 0 0.4 0.4 {}
T {@descr} 10 0 0 0 0.4 0.4 {vcenter=true}

View File

@ -147,8 +147,8 @@ C {lab_pin.sym} 340 -970 0 1 {name=p23 lab=E2}
C {lab_pin.sym} 560 -970 0 1 {name=p28 lab=E6}
C {lab_pin.sym} 840 -1000 0 0 {name=p29 lab=E4}
C {lab_pin.sym} 180 -1120 0 0 {name=p34 lab=VBOOST}
C {ammeter.sym} 1110 -540 0 0 {name=vd current=0.2229 net_name=true}
C {ammeter.sym} 1110 -640 0 0 {name=vu current=0.2165 net_name=true}
C {ammeter.sym} 1110 -540 0 0 {name=vd net_name=true current=0.2093}
C {ammeter.sym} 1110 -640 0 0 {name=vu net_name=true current=0.2336}
C {lab_pin.sym} 60 -1180 0 0 {name=p27 lab=VPP}
C {pnp.sym} 200 -950 0 1 {name=Q1 model=q2n2907p area=1 net_name=true}
C {pnp.sym} 360 -790 0 1 {name=Q2 model=q2n2907p area=1 net_name=true}
@ -230,34 +230,60 @@ C {lab_pin.sym} 180 -690 0 0 {name=p8 lab=C7}
C {lab_pin.sym} 340 -710 0 1 {name=p31 lab=C2}
C {title.sym} 160 -30 0 0 {name=l2 author="Stefan Schippers"}
C {lab_pin.sym} 930 -700 0 0 {name=p32 lab=SA}
C {ammeter.sym} 1110 -350 0 0 {name=v0 current=0.2423 net_name=true}
C {ammeter.sym} 1110 -350 0 0 {name=v0 net_name=true current=0.2288}
C {lab_pin.sym} 930 -380 0 0 {name=p35 lab=SB}
C {ammeter.sym} 560 -890 0 0 {name=v1 current=0.01959 net_name=true}
C {ammeter.sym} 340 -890 0 0 {name=v2 current=0.01949 net_name=true}
C {ammeter.sym} 260 -310 0 0 {name=v3 current=0.03924 net_name=true}
C {ammeter.sym} 770 -440 3 0 {name=v4 current=0.01944 net_name=true}
C {ammeter.sym} 690 -680 0 0 {name=v5 current=0.006183 net_name=true}
C {ammeter.sym} 180 -870 0 1 {name=v6 current=0.01952 net_name=true}
C {ammeter.sym} 840 -890 0 0 {name=v7 current=0.01947 net_name=true}
C {spice_probe.sym} 1010 -440 0 0 {name=p36 analysis=tran voltage=-46.14}
C {spice_probe_vdiff.sym} 930 -410 0 0 {name=p37 analysis=tran voltage=3.693}
C {spice_probe_vdiff.sym} 930 -730 0 0 {name=p38 analysis=tran voltage=3.685}
C {spice_probe.sym} 1010 -760 0 0 {name=p39 analysis=tran voltage=3.548}
C {spice_probe.sym} 1220 -590 0 0 {name=p40 analysis=tran voltage=-0.1372}
C {spice_probe.sym} 380 -530 0 0 {name=p41 analysis=tran voltage=21.3}
C {spice_probe.sym} 140 -530 0 1 {name=p42 analysis=tran voltage=21.3}
C {spice_probe.sym} 250 -470 0 1 {name=p43 analysis=tran voltage=20.38}
C {spice_probe.sym} 440 -790 0 0 {name=p44 analysis=tran voltage=48.05}
C {spice_probe.sym} 280 -950 0 0 {name=p45 analysis=tran voltage=47.26}
C {spice_probe.sym} 730 -810 0 0 {name=p46 analysis=tran voltage=24.6}
C {spice_probe.sym} 610 -1180 0 0 {name=p47 analysis=tran voltage=50}
C {spice_probe.sym} 760 -1120 0 0 {name=p48 analysis=tran voltage=49.03}
C {ammeter.sym} 1300 -590 3 0 {name=v8 current=-2.1207e-04 net_name=true}
C {spice_probe.sym} 1110 -280 0 0 {name=p49 analysis=tran voltage=-50}
C {spice_probe.sym} 280 -630 0 1 {name=p50 analysis=tran voltage=42.18}
C {spice_probe.sym} 340 -820 0 1 {name=p51 analysis=tran voltage=48.86}
C {spice_probe.sym} 120 -210 0 1 {name=p52 analysis=tran voltage=-42.41}
C {spice_probe.sym} 130 -70 0 1 {name=p53 analysis=tran voltage=-50}
C {ammeter.sym} 560 -890 0 0 {name=v1 net_name=true current=0.01956}
C {ammeter.sym} 340 -890 0 0 {name=v2 net_name=true current=0.01947}
C {ammeter.sym} 260 -310 0 0 {name=v3 net_name=true current=0.03924}
C {ammeter.sym} 770 -440 3 0 {name=v4 net_name=true current=0.01942}
C {ammeter.sym} 690 -680 0 0 {name=v5 net_name=true current=0.006271}
C {ammeter.sym} 180 -870 0 1 {name=v6 net_name=true current=0.01955}
C {ammeter.sym} 840 -890 0 0 {name=v7 net_name=true current=0.0195}
C {spice_probe.sym} 1010 -440 0 0 {name=p36 analysis=tran voltage=-46.31}
C {spice_probe_vdiff.sym} 930 -410 0 0 {name=p37 analysis=tran voltage=3.689}
C {spice_probe_vdiff.sym} 930 -730 0 0 {name=p38 analysis=tran voltage=3.691}
C {spice_probe.sym} 1010 -760 0 0 {name=p39 analysis=tran voltage=3.814}
C {spice_probe.sym} 1220 -590 0 0 {name=p40 analysis=tran voltage=0.1231}
C {spice_probe.sym} 380 -530 0 0 {name=p41 analysis=tran voltage=21.3}
C {spice_probe.sym} 140 -530 0 1 {name=p42 analysis=tran voltage=21.3}
C {spice_probe.sym} 250 -470 0 1 {name=p43 analysis=tran voltage=20.61}
C {spice_probe.sym} 440 -790 0 0 {name=p44 analysis=tran voltage=48.22}
C {spice_probe.sym} 280 -950 0 0 {name=p45 analysis=tran voltage=48.22}
C {spice_probe.sym} 730 -810 0 0 {name=p46 analysis=tran voltage=25.21}
C {spice_probe.sym} 610 -1180 0 0 {name=p47 analysis=tran voltage=50}
C {spice_probe.sym} 760 -1120 0 0 {name=p48 analysis=tran voltage=50}
C {ammeter.sym} 1300 -590 3 0 {name=v8 net_name=true current=0.03055}
C {spice_probe.sym} 1110 -280 0 0 {name=p49 analysis=tran voltage=-50}
C {spice_probe.sym} 280 -630 0 1 {name=p50 analysis=tran voltage=42.36}
C {spice_probe.sym} 340 -820 0 1 {name=p51 analysis=tran voltage=49.03}
C {spice_probe.sym} 120 -210 0 1 {name=p52 analysis=tran voltage=-42.58}
C {spice_probe.sym} 130 -70 0 1 {name=p53 analysis=tran voltage=-50}
C {opin.sym} 600 -130 0 0 {name=p5 lab=OUT}
C {ipin.sym} 530 -180 0 0 {name=p1 lab=MINUS}
C {ipin.sym} 530 -140 0 0 {name=p4 lab=VSS}
C {launcher.sym} 510 -330 0 0 {name=h2
descr="Ctrl-Click
Clear all probes"
tclcommand="
xschem push_undo
xschem set no_undo 1
xschem set no_draw 1
set lastinst [xschem get instances]
for \{ set i 0 \} \{ $i < $lastinst \} \{incr i \} \{
set type [xschem getprop instance $i cell::type]
if \{ [regexp \{(^|/)probe$\} $type ] \} \{
xschem setprop $i voltage fast
\}
if \{ [regexp \{current_probe$\} $type ] \} \{
xschem setprop $i current fast
\}
if \{ [regexp \{differential_probe$\} $type ] \} \{
xschem setprop $i voltage fast
\}
\}
xschem set no_undo 0
xschem set no_draw 0
xschem redraw
"
}

View File

@ -102,8 +102,8 @@ vvss vss 0 dc 0
.param frequ=20k
.param gain=42
.op
* .tran 6e-7 0.009 uic
* .op
.tran 6e-7 0.009 uic
** models are generally not free: you must download