faster implementation of name_pass_through_nets() so almost zero overhead when netlisting big circuits with no pass-thru symbols

This commit is contained in:
Stefan Frederik 2022-10-04 15:39:45 +02:00
parent 9c29324c8a
commit 1c407e5dd6
3 changed files with 47 additions and 16 deletions

View File

@ -638,14 +638,35 @@ static void name_pass_through_nets()
Str_hashentry *table[17];
Str_hashentry *entry;
const char *pin_name;
int *pt_symbol = NULL; /* pass-through symbols, symbols with duplicated ports */
int there_are_pt = 0;
xctx->hash_size = 17;
pt_symbol = my_calloc(1573, xctx->symbols, sizeof(int));
for(i = 0; i < xctx->symbols; i++) {
memset(table, 0, xctx->hash_size * sizeof(Str_hashentry *));
for(j = 0; j < xctx->sym[i].rects[PINLAYER]; j++) {
const char *pin_name = get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr, "name", 0);
entry = str_hash_lookup(table, pin_name, "1", XINSERT_NOREPLACE);
if(entry) {
pt_symbol[i] = 1;
there_are_pt = 1;
}
}
if(pt_symbol[i]) dbg(1, "duplicated pins: %s\n", xctx->sym[i].name);
}
str_hash_free(table);
if(!there_are_pt) { /* nothing to do: no pass through symbols */
my_free(1573, &pt_symbol);
return;
}
do { /* keep looping until propagation of nets occurs */
changed = 0;
memset(table, 0, xctx->hash_size * sizeof(Str_hashentry *));
for (i=0;i<instances;i++) {
dbg(1, "instance %d: %s\n", i, inst[i].instname);
if(inst[i].ptr<0) continue;
if(!pt_symbol[ inst[i].ptr ]) continue;
my_strdup(1565, &type, (inst[i].ptr + xctx->sym)->type);
if (type && !IS_LABEL_OR_PIN(type) ) {
if ((rects = (inst[i].ptr+ xctx->sym)->rects[PINLAYER]) > 0) {
@ -735,6 +756,7 @@ static void name_pass_through_nets()
} while(changed);
my_free(1570, &type);
my_free(1571, &type2);
my_free(1572, &pt_symbol);
xctx->hash_size = HASHSIZE;
}

View File

@ -1,4 +1,5 @@
v {xschem version=3.0.0 file_version=1.2 }
v {xschem version=3.1.0 file_version=1.2
}
G {}
K {}
V {
@ -17,11 +18,7 @@ always begin
A=~A;
if(i==20) $finish;
end}
S {va a 0 pwl 0 0 100n 0 101n 3
vvcc vcc 0 dc 3
vvss vss 0 dc 0
.tran 1n 200n}
S {}
E {}
C {title.sym} 160 -30 0 0 {name=l1 author="Stefan Schippers"}
C {ipin.sym} 210 -220 0 0 {name=p1 lab=A}

View File

@ -58,19 +58,29 @@ lab=AA}
N 450 -1110 600 -1110 {
lab=BB}
N 450 -410 600 -410 {
lab=#net1}
lab=RRSSTT}
N 450 -390 600 -390 {
lab=#net2}
lab=CCKK}
N 450 -370 600 -370 {
lab=#net3}
lab=AA}
N 450 -350 600 -350 {
lab=#net4}
lab=BB}
N 450 -310 480 -310 {
lab=ZZ7}
N 900 -310 930 -310 {
lab=ZZ8}
C {title.sym} 160 -30 0 0 {name=l1 author="Stefan Schippers"}
C {doublepin.sym} 300 -610 0 0 {name=x1}
N 900 -410 1050 -410 {
lab=RRSSTT}
N 900 -390 1050 -390 {
lab=CCKK}
N 900 -370 1050 -370 {
lab=AA}
N 900 -350 1050 -350 {
lab=BB}
N 1350 -310 1380 -310 {
lab=ZZ9}
C {doublepin.sym} 1200 -360 0 0 {name=x9}
C {doublepin.sym} 750 -360 0 0 {name=x8}
C {doublepin.sym} 750 -610 0 0 {name=x2}
C {lab_wire.sym} 520 -620 0 0 {name=l2 sig_type=std_logic lab=AA}
C {lab_pin.sym} 480 -560 0 1 {name=p3 lab=ZZ5}
@ -106,16 +116,18 @@ C {lab_wire.sym} 520 -1130 0 0 {name=l22 sig_type=std_logic lab=AA}
C {lab_wire.sym} 520 -1170 0 0 {name=l23 sig_type=std_logic lab=RRSSTT}
C {lab_wire.sym} 520 -1150 0 0 {name=l24 sig_type=std_logic lab=CCKK}
C {lab_wire.sym} 520 -1110 0 0 {name=l25 sig_type=std_logic lab=BB}
C {doublepin.sym} 300 -360 0 0 {name=x7}
C {doublepin.sym} 750 -360 0 0 {name=x8}
C {lab_pin.sym} 150 -350 0 0 {name=l33 sig_type=std_logic lab=BB}
C {doublepin.sym} 300 -610 0 0 {name=x1}
C {lab_pin.sym} 480 -310 0 1 {name=p7 lab=ZZ7}
C {lab_pin.sym} 930 -310 0 1 {name=p8 lab=ZZ8}
C {lab_pin.sym} 150 -370 0 0 {name=l30 sig_type=std_logic lab=AA}
C {lab_pin.sym} 150 -410 0 0 {name=l31 sig_type=std_logic lab=RRSSTT}
C {lab_pin.sym} 150 -390 0 0 {name=l32 sig_type=std_logic lab=CCKK}
C {lab_pin.sym} 150 -350 0 0 {name=l33 sig_type=std_logic lab=BB}
C {doublepin.sym} 300 -360 0 0 {name=x7}
C {ipin.sym} 100 -80 0 0 { name=p9 lab=RRSSTT }
C {ipin.sym} 100 -100 0 0 { name=p10 lab=CCKK }
C {ipin.sym} 100 -120 0 0 { name=p11 lab=BB }
C {ipin.sym} 100 -140 0 0 { name=p12 lab=AA }
C {opin.sym} 270 -120 0 0 { name=p13 lab=ZZ[8..1]}
C {opin.sym} 270 -120 0 0 { name=p13 lab=ZZ[9..1]}
C {title.sym} 160 -30 0 0 {name=l1 author="Stefan Schippers"}
C {lab_pin.sym} 1380 -310 0 1 {name=p8 lab=ZZ9}