do not force a full hash_wires() on every net insertion; code formatting

This commit is contained in:
Stefan Schippers 2020-10-11 13:08:32 +02:00
parent 077fde9350
commit 32f85ac4f4
8 changed files with 37 additions and 34 deletions

View File

@ -1626,12 +1626,6 @@ void new_wire(int what, double mx_snap, double my_snap)
if( (what & PLACE) ) {
if( (ui_state & STARTWIRE) && (x1!=x2 || y1!=y2) ) {
/*
prepared_netlist_structs = 0;
prepared_hash_wires = 0;
prepared_hilight_structs = 0;
prepare_netlist_structs(0);
*/
push_undo();
if(manhattan_lines==1) {
if(xx2!=xx1) {
@ -1669,7 +1663,8 @@ void new_wire(int what, double mx_snap, double my_snap)
printf("xschem wire %g %g %g %g %d\n", xx1, yy1, xx2, yy2, -1);
fflush(stdout);
}
prepared_hash_wires = 0;
hash_wire(XINSERT, lastwire-1);
/* prepared_hash_wires = 0; */
prepared_hilight_structs = 0;
update_conn_cues(1,1);
if(show_pin_net_names) {
@ -1681,6 +1676,7 @@ void new_wire(int what, double mx_snap, double my_snap)
draw();
bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
}
draw_hilight_net(1);/* for updating connection bubbles on hilight nets */
}
if(! (what &END)) {
x1=mx_snap;

View File

@ -145,7 +145,7 @@ int callback(int event, int mx, int my, KeySym key,
switch(event)
{
case EnterNotify:
if(!sel_or_clip[0]) my_snprintf(sel_or_clip, S(sel_or_clip), "%s/%s", user_conf_dir, ".selection.sch"); /* 20181002 */
if(!sel_or_clip[0]) my_snprintf(sel_or_clip, S(sel_or_clip), "%s/%s", user_conf_dir, ".selection.sch");
/* xschem window *sending* selected objects
when the pointer comes back in abort copy operation since it has been done
@ -252,7 +252,7 @@ int callback(int event, int mx, int my, KeySym key,
new_polygon(RUBBER); /* 20171115 */
}
if(!(ui_state & STARTPOLYGON) && (state&Button1Mask) && !(ui_state & STARTWIRE) && !(ui_state & STARTPAN2) &&
!(state & Mod1Mask) && !(state & ShiftMask) && !(ui_state & PLACE_SYMBOL)) /* start of a mouse area selection */
!(state & Mod1Mask) && !(state & ShiftMask) && !(ui_state & PLACE_SYMBOL)) /* start of a mouse area select */
{
static int onetime=0;
if(mx != mx_save || my != my_save) {
@ -260,7 +260,7 @@ int callback(int event, int mx, int my, KeySym key,
select_rect(BEGIN,1);
onetime=1;
}
if(abs(mx-mx_save) > 8 || abs(my-my_save) > 8 ) { /* 20121123 set some reasonable threshold before unselecting */
if(abs(mx-mx_save) > 8 || abs(my-my_save) > 8 ) { /* set some reasonable threshold before unselecting */
if(onetime) {
unselect_all(); /* 20171026 avoid multiple calls of unselect_all() */
onetime=0;
@ -281,7 +281,7 @@ int callback(int event, int mx, int my, KeySym key,
if( !(ui_state & STARTSELECT)) {
select_rect(BEGIN,1);
}
if(abs(mx-mx_save) > 8 || abs(my-my_save) > 8 ) { /* 20121130 set some reasonable threshold before unselecting */
if(abs(mx-mx_save) > 8 || abs(my-my_save) > 8 ) { /* set some reasonable threshold before unselecting */
select_object(X_TO_XSCHEM(mx_save), Y_TO_XSCHEM(my_save), 0, 0); /* 20121130 remove near object if dragging */
rebuild_selected_array();
}

View File

@ -524,9 +524,10 @@ void edit_wire_property(void)
int oldbus=0;
int k = selectedgroup[i].n;
if(selectedgroup[i].type != WIRE) continue;
prepared_hash_wires=0; /* 20181025 */
prepared_netlist_structs=0;
prepared_hilight_structs=0;
/* does not seem to be necessary */
/* prepared_hash_wires=0;
* prepared_netlist_structs=0;
* prepared_hilight_structs=0; */
oldbus = wire[k].bus;
if(preserve == 1) {
set_different_token(&wire[k].prop_ptr,

View File

@ -315,6 +315,7 @@ void hash_wire(int what, int n)
double tmpd;
double x1, y1, x2, y2;
int x1a, x2a, y1a, y2a;
struct wireentry *wptr;
/* 20190606 */
/* wire[n].node=NULL; */
@ -351,6 +352,11 @@ void hash_wire(int what, int n)
/* insert wire[n] in region [tmpi, tmpj] */
if(what==XINSERT) wireinsert(n, tmpi, tmpj);
else wiredelete(n, tmpi, tmpj);
/* reset ends of all wires that *could* touch wire[n] */
for(wptr = wiretable[tmpi][tmpj] ; wptr ; wptr = wptr->next) {
wire[wptr->n].end1 = wire[wptr->n].end2 = -1;
}
}
}
}

View File

@ -156,7 +156,7 @@ ID_EXT_PARENTHESIS [-#+/=_a-zA-Z][-#@\\/:.=_+a-zA-Z0-9]*\([-#@\\/:.=_+a-zA-Z0-9]
^\*.* { /* a comment, return as LINE token */
yylval.ptr.str=NULL; /*19102004 */
if(dbg_var >= 3) fprintf(errfp, "yylex(): B_LINE: %s\n",yytext);
my_strdup(299, &yylval.ptr.str, yytext); /* these things are freed after use in expandlabel.y */
my_strdup(299, &yylval.ptr.str, yytext); /* freed after use in expandlabel.y */
return B_LINE;
}
<label>{
@ -216,7 +216,7 @@ ID_EXT_PARENTHESIS [-#+/=_a-zA-Z][-#@\\/:.=_+a-zA-Z0-9]*\([-#@\\/:.=_+a-zA-Z0-9]
/* recognize the most esotheric identifiers */
{ID_EXT}|{ID_EXT_PARENTHESIS} {
yylval.ptr.str=NULL;/*19102004 */
my_strdup(300, &yylval.ptr.str, yytext); /* these things are freed after use in expandlabel.y */
my_strdup(300, &yylval.ptr.str, yytext); /* freed after use in expandlabel.y */
if(dbg_var >= 3) fprintf(errfp, "yylex(): B_NAME: %s\n", yytext);
return B_NAME;
}
@ -239,7 +239,7 @@ ID_EXT_PARENTHESIS [-#+/=_a-zA-Z][-#@\\/:.=_+a-zA-Z0-9]*\([-#@\\/:.=_+a-zA-Z0-9]
<rest>{ /* treat rest of line as a single LINE token */
(.|\n)* {
yylval.ptr.str=NULL; /*19102004 */
my_strdup(301, &yylval.ptr.str, yytext); /* these things are freed after use in expandlabel.y */
my_strdup(301, &yylval.ptr.str, yytext); /* freed after use in expandlabel.y */
if(dbg_var >= 3) fprintf(errfp, "yylex(): <rest> B_LINE: %s\n",yytext);
BEGIN(INITIAL);
return B_LINE;

View File

@ -366,7 +366,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else if(!strcmp(argv[1],"log"))
{
static int opened=0;
if(argc==3 && opened==0 ) { errfp = fopen(argv[2], "w");opened=1; } /* added check to avoid multiple open 07102004 */
if(argc==3 && opened==0 ) { errfp = fopen(argv[2], "w");opened=1; } /* added check to avoid multiple open */
else if(argc==2 && opened==1) { fclose(errfp); errfp=stderr;opened=0; }
Tcl_ResetResult(interp);
}

View File

@ -1570,9 +1570,9 @@ void print_spice_element(FILE *fd, int inst)
{ /* and node number: m1 n1 m2 n2 .... */
for(i=0;i<no_of_pins;i++)
{
if(strcmp(get_tok_value((inst_ptr[inst].ptr+instdef)->boxptr[PINLAYER][i].prop_ptr,"spice_ignore",0), "true")) {
char *prop = (inst_ptr[inst].ptr+instdef)->boxptr[PINLAYER][i].prop_ptr;
if(strcmp(get_tok_value(prop, "spice_ignore", 0), "true")) {
str_ptr = net_name(inst,i, &mult, 0);
/* fprintf(errfp, "inst: %s --> %s\n", name, str_ptr); */
fprintf(fd, "@%d %s ", mult, str_ptr);
}
}
@ -2293,7 +2293,6 @@ void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level primiti
const char *lab;
char *template=NULL,*format=NULL,*s=NULL, *name=NULL, *token=NULL;
const char *value;
int pin_number; /* 20180911 */
int sizetok=0;
int token_pos=0, escape=0;
int no_of_pins=0;
@ -2399,10 +2398,9 @@ void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level primiti
}
else if(token[0]=='@' && token[1]=='@') { /* recognize single pins 15112003 */
for(i=0;i<no_of_pins;i++) {
if(!strcmp(
get_tok_value((inst_ptr[inst].ptr+instdef)->boxptr[PINLAYER][i].prop_ptr,"name",0),
token+2)) {
if(strcmp(get_tok_value((inst_ptr[inst].ptr+instdef)->boxptr[PINLAYER][i].prop_ptr,"verilog_ignore",0), "true")) {
char *prop = (inst_ptr[inst].ptr+instdef)->boxptr[PINLAYER][i].prop_ptr;
if(!strcmp( get_tok_value(prop,"name",0), token+2)) {
if(strcmp(get_tok_value(prop, "verilog_ignore",0), "true")) {
str_ptr = net_name(inst,i, &mult, 0);
fprintf(fd, "----pin(%s) ", str_ptr);
}
@ -2412,15 +2410,16 @@ void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level primiti
}
/* reference by pin number instead of pin name, allows faster lookup of the attached net name 20180911 */
else if(token[0]=='@' && token[1]=='#') {
pin_number = atoi(token+2);
if(pin_number < no_of_pins) {
const char *vi;
vi = get_tok_value((inst_ptr[inst].ptr+instdef)->boxptr[PINLAYER][pin_number].prop_ptr,"verilog_ignore",0);
if(strcmp(vi, "true")) {
str_ptr = net_name(inst,pin_number, &mult, 0);
fprintf(fd, "----pin(%s) ", str_ptr);
}
int pin_number = atoi(token+2);
if(pin_number < no_of_pins) {
const char *vi;
char *prop = (inst_ptr[inst].ptr+instdef)->boxptr[PINLAYER][pin_number].prop_ptr;
vi = get_tok_value(prop,"verilog_ignore",0);
if(strcmp(vi, "true")) {
str_ptr = net_name(inst,pin_number, &mult, 0);
fprintf(fd, "----pin(%s) ", str_ptr);
}
}
}
else if(!strncmp(token,"@tcleval", 8)) { /* 20171029 */
/* char tclcmd[strlen(token)+100] ; */

View File

@ -510,7 +510,8 @@ void vhdl_block_netlist(FILE *fd, int i) /*20081204 */
for(j=0;j<lastinstdef;j++)
{
if( strcmp(get_tok_value(instdef[j].prop_ptr,"vhdl_primitive",0),"true")==0 ) continue;
if(!instdef[j].type || (strcmp(instdef[j].type,"primitive")!=0 && strcmp(instdef[j].type,"subcircuit")!=0)) continue;
if(!instdef[j].type || (strcmp(instdef[j].type,"primitive")!=0 && strcmp(instdef[j].type,"subcircuit")!=0))
continue;
if((
strcmp(instdef[j].type,"subcircuit")==0 ||
strcmp(instdef[j].type,"primitive")==0