find_inst_to_be_redrawn() fix speed issue when auto-net name showing is enabled: evaluate out of any operation loop, using hash table of changed nodes

This commit is contained in:
Stefan Frederik 2021-01-07 16:35:57 +01:00
parent 5cc1f04588
commit acb1c28921
13 changed files with 2097 additions and 2048 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="Xschem" Language="1033" Version="2.9.9.1" Manufacturer="Xschem" UpgradeCode="0deb9c17-cbbd-491c-be3e-24446b27ccd5">
<Product Id="*" Name="Xschem" Language="1033" Version="2.9.9.2" Manufacturer="Xschem" UpgradeCode="0deb9c17-cbbd-491c-be3e-24446b27ccd5">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<WixVariable Id="WixUILicenseRtf"
Value="License.rtf" />
@ -10,9 +10,31 @@
<Icon Id="xschem_icon.ico" SourceFile="xschem_icon.ico"/>
<Property Id="ARPPRODUCTICON" Value="xschem_icon.ico" />
<UIRef Id="WixUI_InstallDir" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<Media Id="1" Cabinet="xschemMedia1.cab" EmbedCab="yes" />
<Condition Message="A newer version of [ProductName] is
already installed. Exiting installation.">
<![CDATA[Installed OR NOT NEWER_VERSION_FOUND]]>
</Condition>
<Upgrade Id="0deb9c17-cbbd-491c-be3e-24446b27ccd5">
<UpgradeVersion
Property="OLD_VERSION_FOUND"
Minimum="2.9.9.0"
Maximum="2.9.9.2"
IncludeMinimum="yes"
IncludeMaximum="no"
OnlyDetect="no"
IgnoreRemoveFailure="yes"
MigrateFeatures="yes" />
<UpgradeVersion
Property="NEWER_VERSION_FOUND"
Minimum="2.9.9.2"
IncludeMinimum="no"
OnlyDetect="yes" />
</Upgrade>
<Feature Id="MainProduct" Title="Xschem" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id="src" />
@ -81,6 +103,10 @@
<Condition Message='ActiveTcl v8.6 must be installed'>
<![CDATA[Installed or ACTIVE_TCL_VERSION >= "8.6"]]>
</Condition>
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallFinalize" />
</InstallExecuteSequence>
</Product>
<Fragment>
@ -106,6 +132,9 @@
<Component Id="CMPHSPICEBACKANNOTATE">
<File Id="HSPICEBACKANNOTATE" KeyPath="yes" Source="../../src/hspice_backannotate.tcl" />
</Component>
<Component Id="CMPADDCUSTOMMENU">
<File Id="ADDCUSTOMMENU" KeyPath="yes" Source="../../src/add_custom_menu.tcl" />
</Component>
<Component Id="CMPKEYSHELP">
<File Id="KEYSHELP" KeyPath="yes" Source="../../src/keys.help" />
</Component>
@ -283,6 +312,7 @@
<ComponentRef Id="CMPFLATTENSAVENODEASAWK" />
<ComponentRef Id="CMPGSCHEMTOXSCHEMAWK" />
<ComponentRef Id="CMPHSPICEBACKANNOTATE" />
<ComponentRef Id="CMPADDCUSTOMMENU" />
<ComponentRef Id="CMPHERCULESTOSPICEAWK" />
<ComponentRef Id="CMPIMPORTOPUSSYMBOLSAWK" />
<ComponentRef Id="CMPLABELCOMPACTORAWK" />

View File

@ -453,6 +453,12 @@
<Component Id="cmp9F6E802F56EEA72A1473FA788F20FBE5" Guid="{9A7C8827-3AAF-4BCE-B504-0DF2C5F78782}">
<File Id="filF1ED18E7F4F67D529E56D9B00B050CAC" KeyPath="yes" Source="$(var.docSrcDir)\xschem_man\symbol_property_syntax3.png" />
</Component>
<Component Id="cmp531EA85E335C3D3E948CB16A872837A6" Guid="{7AD55AF2-1748-484B-A9AC-BAB0919721B9}">
<File Id="filF046A5CD15470FBE36F3CD60AF03B9F4" KeyPath="yes" Source="$(var.docSrcDir)\xschem_man\symbol_property_syntax4.png" />
</Component>
<Component Id="cmpE918044EAD1A5F238F1B2A2DCEAE702C" Guid="{08956EF5-7149-45CA-A434-FA0A1D108167}">
<File Id="fil7B22FD4ED48963FA2B408FBB7C90D8D1" KeyPath="yes" Source="$(var.docSrcDir)\xschem_man\symbol_property_syntax5.png" />
</Component>
<Component Id="cmp30FF303E2BEC5A123613729EAFAF6576" Guid="{BBA07B51-21AE-4DA0-8D15-7092A9F04799}">
<File Id="filCCAC9D72DA84033404DE8E2EC5F8900A" KeyPath="yes" Source="$(var.docSrcDir)\xschem_man\symgen_vs_djboxsym.png" />
</Component>
@ -944,6 +950,8 @@
<ComponentRef Id="cmp6D2ED59DF2340D1122FD7F1D589EF887" />
<ComponentRef Id="cmp5C29C1D986EFE74BCDC1524B14AA8C8D" />
<ComponentRef Id="cmp9F6E802F56EEA72A1473FA788F20FBE5" />
<ComponentRef Id="cmp531EA85E335C3D3E948CB16A872837A6" />
<ComponentRef Id="cmpE918044EAD1A5F238F1B2A2DCEAE702C" />
<ComponentRef Id="cmp30FF303E2BEC5A123613729EAFAF6576" />
<ComponentRef Id="cmp160D310A1499755F8452C664AB1882FF" />
<ComponentRef Id="cmp94BBC0CDFCEEBAF38436152C69968121" />

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1662,8 +1662,8 @@ void new_wire(int what, double mx_snap, double my_snap)
if(show_pin_net_names) {
prepare_netlist_structs(0);
bbox(START , 0.0 , 0.0 , 0.0 , 0.0);
find_inst_to_be_redrawn(xctx->wire[xctx->wires-1].node);
find_inst_hash_clear();
int_hash_lookup(xctx->node_redraw_table, xctx->wire[xctx->wires-1].node, 0, XINSERT_NOREPLACE);
find_inst_to_be_redrawn();
bbox(SET , 0.0 , 0.0 , 0.0 , 0.0);
draw();
bbox(END , 0.0 , 0.0 , 0.0 , 0.0);

View File

@ -476,12 +476,12 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
ROTATION(rot, flip, 0.0,0.0,text.x0,text.y0,x1,y1);
textlayer = c;
/* do not allow custom text color on PINLAYER hilighted instances */
if( !(xctx->inst[n].color == PINLAYER)) {
if( !(xctx->inst[n].color == -PINLAYER)) {
textlayer = symptr->text[j].layer;
if(textlayer < 0 || textlayer >= cadlayers) textlayer = c;
}
/* display PINLAYER colored instance texts even if PINLAYER disabled */
if(xctx->inst[n].color == PINLAYER || enable_layer[textlayer]) {
if(xctx->inst[n].color == -PINLAYER || enable_layer[textlayer]) {
#if HAS_CAIRO==1
textfont = symptr->text[j].font;
if((textfont && textfont[0]) || symptr->text[j].flags) {

View File

@ -934,15 +934,6 @@ void update_symbol(const char *result, int x)
only_different=atoi(tclgetvar("preserve_unchanged_attrs") );
copy_cell=atoi(tclgetvar("user_wants_copy_cell") );
bbox(START,0.0,0.0,0.0,0.0);
if(show_pin_net_names) {
prepare_netlist_structs(0);
for(k = 0; k < (xctx->inst[i].ptr + xctx->sym)->rects[PINLAYER]; k++) {
if( xctx->inst[i].node && xctx->inst[i].node[k]) {
find_inst_to_be_redrawn(xctx->inst[i].node[k]);
}
}
find_inst_hash_clear();
}
/* 20191227 necessary? --> Yes since a symbol copy has already been done
in edit_symbol_property() -> tcl edit_prop, this ensures new symbol is loaded from disk.
if for some reason a symbol with matching name is loaded in xschem this
@ -967,6 +958,16 @@ void update_symbol(const char *result, int x)
if(xctx->sel_array[k].type!=ELEMENT) continue;
i=xctx->sel_array[k].n;
if(show_pin_net_names) {
int j;
prepare_netlist_structs(0);
for(j = 0; j < (xctx->inst[i].ptr + xctx->sym)->rects[PINLAYER]; j++) {
if( xctx->inst[i].node && xctx->inst[i].node[j]) {
int_hash_lookup(xctx->node_redraw_table, xctx->inst[i].node[j], 0, XINSERT_NOREPLACE);
}
}
}
/* 20171220 calculate bbox before changes to correctly redraw areas */
/* must be recalculated as cairo text extents vary with zoom factor. */
symbol_bbox(i, &xctx->inst[i].x1, &xctx->inst[i].y1, &xctx->inst[i].x2, &xctx->inst[i].y2);
@ -1056,11 +1057,10 @@ void update_symbol(const char *result, int x)
prepare_netlist_structs(0);
for(j = 0; j < (xctx->inst[i].ptr + xctx->sym)->rects[PINLAYER]; j++) {
if( xctx->inst[i].node && xctx->inst[i].node[j]) {
find_inst_to_be_redrawn(xctx->inst[i].node[j]);
int_hash_lookup(xctx->node_redraw_table, xctx->inst[i].node[j], 0, XINSERT_NOREPLACE);
}
}
}
find_inst_hash_clear();
}
if(xctx->hilight_nets) for(i=0; i < xctx->instances; i++) {
char *type = (xctx->inst[i].ptr+ xctx->sym)->type;
@ -1071,6 +1071,7 @@ void update_symbol(const char *result, int x)
}
}
}
find_inst_to_be_redrawn();
/* redraw symbol with new props */
bbox(SET,0.0,0.0,0.0,0.0);
dbg(1, "update_symbol(): redrawing inst_ptr.txtprop string\n");

View File

@ -468,46 +468,52 @@ void draw_selection(GC g, int interruptable)
xctx->movelastsel = i;
}
void find_inst_hash_clear(void)
{
free_int_hash(xctx->node_redraw_table);
}
void find_inst_to_be_redrawn(const char *node)
/* A list of electrical nodes that could potentially have been changed is previously hashed
* into xctx->node_redraw_table, find all connected instances/wires and set bbox of areas
* that potentially need to be redraw (show net names on symbol pins)
*/
void find_inst_to_be_redrawn()
{
struct int_hashentry *ientry;
int i, p, rects;
xSymbol * sym;
if(int_hash_lookup(xctx->node_redraw_table, node, 0, XINSERT_NOREPLACE)) return;
dbg(1, "find_inst_to_be_redrawn(): node=%s\n", node);
for(i=0; i < xctx->instances; i++) {
sym = xctx->inst[i].ptr + xctx->sym;
rects = sym->rects[PINLAYER];
for(p = 0; p < rects; p++) {
if(node && xctx->inst[i].node[p] && !strcmp(xctx->inst[i].node[p], node )) {
symbol_bbox(i, &xctx->inst[i].x1, &xctx->inst[i].y1, &xctx->inst[i].x2, &xctx->inst[i].y2 );
bbox(ADD, xctx->inst[i].x1, xctx->inst[i].y1, xctx->inst[i].x2, xctx->inst[i].y2 );
if(xctx->inst[i].node && xctx->inst[i].node[p]) {
ientry = int_hash_lookup(xctx->node_redraw_table, xctx->inst[i].node[p], 0, XLOOKUP);
if(ientry) {
/* dbg(0, "find_inst_to_be_redrawn(): inst to be redrawn: %d\n", i); */
symbol_bbox(i, &xctx->inst[i].x1, &xctx->inst[i].y1, &xctx->inst[i].x2, &xctx->inst[i].y2 );
bbox(ADD, xctx->inst[i].x1, xctx->inst[i].y1, xctx->inst[i].x2, xctx->inst[i].y2 );
break;
}
}
}
}
for(i=0;i < xctx->wires; i++) {
if(node && xctx->wire[i].node && !strcmp(xctx->wire[i].node, node )) {
if(xctx->wire[i].bus){
int ov, y1, y2;
ov = INT_BUS_WIDTH(xctx->lw)> cadhalfdotsize ? INT_BUS_WIDTH(xctx->lw) : CADHALFDOTSIZE;
if(xctx->wire[i].y1 < xctx->wire[i].y2) { y1 = xctx->wire[i].y1-ov; y2 = xctx->wire[i].y2+ov; }
else { y1 = xctx->wire[i].y1+ov; y2 = xctx->wire[i].y2-ov; }
bbox(ADD, xctx->wire[i].x1-ov, y1 , xctx->wire[i].x2+ov , y2 );
} else {
int ov, y1, y2;
ov = cadhalfdotsize;
if(xctx->wire[i].y1 < xctx->wire[i].y2) { y1 = xctx->wire[i].y1-ov; y2 = xctx->wire[i].y2+ov; }
else { y1 = xctx->wire[i].y1+ov; y2 = xctx->wire[i].y2-ov; }
bbox(ADD, xctx->wire[i].x1-ov, y1 , xctx->wire[i].x2+ov , y2 );
if(xctx->wire[i].node) {
ientry = int_hash_lookup(xctx->node_redraw_table, xctx->wire[i].node, 0, XLOOKUP);
if(ientry) {
if(xctx->wire[i].bus){
int ov, y1, y2;
ov = INT_BUS_WIDTH(xctx->lw)> cadhalfdotsize ? INT_BUS_WIDTH(xctx->lw) : CADHALFDOTSIZE;
if(xctx->wire[i].y1 < xctx->wire[i].y2) { y1 = xctx->wire[i].y1-ov; y2 = xctx->wire[i].y2+ov; }
else { y1 = xctx->wire[i].y1+ov; y2 = xctx->wire[i].y2-ov; }
bbox(ADD, xctx->wire[i].x1-ov, y1 , xctx->wire[i].x2+ov , y2 );
} else {
int ov, y1, y2;
ov = cadhalfdotsize;
if(xctx->wire[i].y1 < xctx->wire[i].y2) { y1 = xctx->wire[i].y1-ov; y2 = xctx->wire[i].y2+ov; }
else { y1 = xctx->wire[i].y1+ov; y2 = xctx->wire[i].y2-ov; }
bbox(ADD, xctx->wire[i].x1-ov, y1 , xctx->wire[i].x2+ov , y2 );
}
}
}
}
free_int_hash(xctx->node_redraw_table);
}
void copy_objects(int what)
@ -922,18 +928,18 @@ void copy_objects(int what)
bbox(ADD, xctx->inst[n].x1, xctx->inst[n].y1, xctx->inst[n].x2, xctx->inst[n].y2 );
if(show_pin_net_names) for(p = 0; p < (xctx->inst[n].ptr + xctx->sym)->rects[PINLAYER]; p++) {
if( xctx->inst[n].node && xctx->inst[n].node[p]) {
find_inst_to_be_redrawn(xctx->inst[n].node[p]);
int_hash_lookup(xctx->node_redraw_table, xctx->inst[n].node[p], 0, XINSERT_NOREPLACE);
}
}
}
if(show_pin_net_names && xctx->sel_array[i].type == WIRE) {
find_inst_to_be_redrawn(xctx->wire[n].node);
int_hash_lookup(xctx->node_redraw_table, xctx->wire[n].node, 0, XINSERT_NOREPLACE);
}
}
}
if(show_pin_net_names) find_inst_hash_clear();
} /* end for(k=0;k<cadlayers;k++) */
find_inst_to_be_redrawn();
check_collapsing_objects();
if(autotrim_wires) trim_wires();
update_conn_cues(1, 1);
@ -1034,15 +1040,15 @@ void move_objects(int what, int merge, double dx, double dy)
bbox(ADD, inst[n].x1, inst[n].y1, inst[n].x2, inst[n].y2 );
if(show_pin_net_names) for(p = 0; p < (inst[n].ptr + xctx->sym)->rects[PINLAYER]; p++) {
if( inst[n].node && inst[n].node[p]) {
find_inst_to_be_redrawn(inst[n].node[p]);
int_hash_lookup(xctx->node_redraw_table, xctx->inst[n].node[p], 0, XINSERT_NOREPLACE);
}
}
}
if(show_pin_net_names && xctx->sel_array[i].type == WIRE) {
find_inst_to_be_redrawn(wire[n].node);
int_hash_lookup(xctx->node_redraw_table, xctx->wire[n].node, 0, XINSERT_NOREPLACE);
}
}
if(show_pin_net_names) find_inst_hash_clear();
find_inst_to_be_redrawn();
for(k=0;k<cadlayers;k++)
{
for(i=0;i<xctx->lastsel;i++)
@ -1467,18 +1473,18 @@ void move_objects(int what, int merge, double dx, double dy)
bbox(ADD, inst[n].x1, inst[n].y1, inst[n].x2, inst[n].y2 );
if(show_pin_net_names) for(p = 0; p < (inst[n].ptr + xctx->sym)->rects[PINLAYER]; p++) {
if( inst[n].node && inst[n].node[p]) {
find_inst_to_be_redrawn(inst[n].node[p]);
int_hash_lookup(xctx->node_redraw_table, xctx->inst[n].node[p], 0, XINSERT_NOREPLACE);
}
}
}
if(show_pin_net_names && xctx->sel_array[i].type == WIRE) {
find_inst_to_be_redrawn(wire[n].node);
int_hash_lookup(xctx->node_redraw_table, xctx->wire[n].node, 0, XINSERT_NOREPLACE);
}
}
}
if(show_pin_net_names) find_inst_hash_clear();
} /*end for(k=0;k<cadlayers;k++) */
find_inst_to_be_redrawn();
check_collapsing_objects();
if(autotrim_wires) trim_wires();
update_conn_cues(1, 1);

View File

@ -276,7 +276,7 @@ void hash_inst_pin(int what, int i, int j)
xctx->inst[i].name, j, prop_ptr);
statusmsg(str,2);
if(!netlist_count) {
xctx->inst[i].color = PINLAYER;
xctx->inst[i].color = -PINLAYER;
xctx->hilight_nets=1;
}
}
@ -695,7 +695,7 @@ void prepare_netlist_structs(int for_netlist)
strcmp(type, "use")) {
my_snprintf(str, S(str), "instance: %d (%s): no name attribute set", i, inst[i].name);
statusmsg(str,2);
inst[i].color = PINLAYER;
inst[i].color = -PINLAYER;
xctx->hilight_nets=1;
}
}
@ -703,7 +703,7 @@ void prepare_netlist_structs(int for_netlist)
char str[2048];
my_snprintf(str, S(str), "Symbol: %s: no type attribute set", inst[i].name);
statusmsg(str,2);
inst[i].color = PINLAYER;
inst[i].color = -PINLAYER;
xctx->hilight_nets=1;
}
if(type && inst[i].node && IS_LABEL_OR_PIN(type) ) { /* instance must have a pin! */
@ -1179,7 +1179,7 @@ int sym_vs_sch_pins()
statusmsg(str,2);
for(j = 0; j < xctx->instances; j++) {
if(!strcmp(xctx->inst[j].name, xctx->sym[i].name)) {
xctx->inst[i].color = PINLAYER;
xctx->inst[i].color = -PINLAYER;
xctx->hilight_nets=1;
}
}
@ -1195,7 +1195,7 @@ int sym_vs_sch_pins()
statusmsg(str,2);
for(j = 0; j < xctx->instances; j++) {
if(!strcmp(xctx->inst[j].name, xctx->sym[i].name)) {
xctx->inst[i].color = PINLAYER;
xctx->inst[i].color = -PINLAYER;
xctx->hilight_nets=1;
}
}
@ -1228,7 +1228,7 @@ int sym_vs_sch_pins()
statusmsg(str,2);
for(j = 0; j < xctx->instances; j++) {
if(!strcmp(xctx->inst[j].name, xctx->sym[i].name)) {
xctx->inst[i].color = PINLAYER;
xctx->inst[i].color = -PINLAYER;
xctx->hilight_nets=1;
}
}
@ -1251,7 +1251,7 @@ int sym_vs_sch_pins()
statusmsg(str,2);
for(k = 0; k < xctx->instances; k++) {
if(!strcmp(xctx->inst[k].name, xctx->sym[i].name)) {
xctx->inst[i].color = PINLAYER;
xctx->inst[i].color = -PINLAYER;
xctx->hilight_nets=1;
}
}

View File

@ -589,12 +589,12 @@ static void ps_draw_symbol(int n,int layer, short tmp_flip, short rot, double xo
ROTATION(rot, flip, 0.0,0.0,text.x0,text.y0,x1,y1);
textlayer = layer;
/* do not allow custom text color on PINLAYER hilighted instances */
if( !(xctx->inst[n].color == PINLAYER)) {
if( !(xctx->inst[n].color == -PINLAYER)) {
textlayer = (xctx->inst[n].ptr+ xctx->sym)->text[j].layer;
if(textlayer < 0 || textlayer >= cadlayers) textlayer = layer;
}
/* display PINLAYER colored instance texts even if PINLAYER disabled */
if(xctx->inst[n].color == PINLAYER || enable_layer[textlayer]) {
if(xctx->inst[n].color == -PINLAYER || enable_layer[textlayer]) {
my_snprintf(ps_font_family, S(ps_font_name), "Helvetica");
my_snprintf(ps_font_name, S(ps_font_name), "Helvetica");
textfont = symptr->text[j].font;

View File

@ -352,19 +352,16 @@ void delete(void)
if(show_pin_net_names && type && IS_LABEL_OR_PIN(type) ) {
for(p = 0; p < (xctx->inst[n].ptr + xctx->sym)->rects[PINLAYER]; p++) {
if( xctx->inst[n].node && xctx->inst[n].node[p]) {
find_inst_to_be_redrawn(xctx->inst[n].node[p]);
int_hash_lookup(xctx->node_redraw_table, xctx->inst[n].node[p], 0, XINSERT_NOREPLACE);
}
}
}
}
if(show_pin_net_names && xctx->sel_array[i].type == WIRE && xctx->wire[n].node) {
find_inst_to_be_redrawn(xctx->wire[n].node);
int_hash_lookup(xctx->node_redraw_table, xctx->wire[n].node, 0, XINSERT_NOREPLACE);
}
}
if(show_pin_net_names) {
find_inst_hash_clear();
}
find_inst_to_be_redrawn();
/* already done above

View File

@ -210,7 +210,7 @@ void check_unique_names(int rename)
if(comma_pos) *comma_pos = '\0';
dbg(1, "check_unique_names(): checking %s\n", start);
if( (entry = inst_hash_lookup(table, start, i, XINSERT_NOREPLACE, strlen(start)) ) && entry->value != i) {
xctx->inst[i].color = PINLAYER;
xctx->inst[i].color = -PINLAYER;
xctx->hilight_nets=1;
if(rename == 1) {
if(first) {
@ -2326,7 +2326,7 @@ const char *net_name(int i, int j, int *multip, int hash_prefix_unnamed_net, int
i, j, xctx->inst[i].instname ) ;
statusmsg(errstr,2);
if(!netlist_count) {
xctx->inst[i].color = PINLAYER;
xctx->inst[i].color = -PINLAYER;
xctx->hilight_nets=1;
}
}

View File

@ -1031,8 +1031,7 @@ extern void arc_3_points(double x1, double y1, double x2, double y2, double x3,
extern void move_objects(int what,int merge, double dx, double dy);
extern void redraw_w_a_l_r_p_rubbers(void); /* redraw wire, arcs, line, polygon rubbers */
extern void copy_objects(int what);
extern void find_inst_to_be_redrawn(const char *node);
extern void find_inst_hash_clear(void);
extern void find_inst_to_be_redrawn();
extern void pan(int what);
extern void pan2(int what, int mx, int my);
extern void zoom_rectangle(int what);