preserve line ordering regardless of awk hash implementation in tedax netlists as done for vhdl and verilog; include a couple of tedax netlist checks in xschemtest

This commit is contained in:
Stefan Frederik 2021-12-16 00:39:09 +01:00
parent ba15e21b24
commit fd5e6caf13
2 changed files with 36 additions and 14 deletions

View File

@ -66,6 +66,7 @@ $1=="device"||$1=="footprint"{
for(i=3; i<=NF;i++) {
fp = ((i==3) ? $i : fp " " $i)
}
if(!(inst_name in footprint)) footprint_num[footprint_n++] = inst_name
footprint[inst_name] = fp
}
next
@ -80,6 +81,7 @@ $1=="device"||$1=="footprint"{
for(i=3; i<=NF;i++) {
dev = ((i==3) ? $i : dev " " $i)
}
if(!(inst_name in device)) device_num[device_n++] = inst_name
device[inst_name] = dev
}
next
@ -101,17 +103,18 @@ $1=="device"||$1=="footprint"{
# conn lines need not to be printed but pinslot and pinidx lines do.
for(i=1; i<=numslots;i++) {
curr_pin = (nn>1) ? pinlist_arr[i]: pinlist_arr[1]
if(!((inst_name, curr_pin) in arr) || arr[inst_name, curr_pin]=="" || arr[inst_name, curr_pin] ~/^--UNCONN--/) {
if(!((inst_name,curr_pin) in arr)) arr_num[arr_n++] = (inst_name SUBSEP curr_pin)
if(!((inst_name,curr_pin) in arr) || arr[inst_name,curr_pin]=="" || arr[inst_name,curr_pin] ~/^--UNCONN--/) {
if(curr_pin == pin_number) {
arr[inst_name, curr_pin]=net_name SUBSEP pin_index SUBSEP pin_name SUBSEP i SUBSEP slotted
arr[inst_name,curr_pin]=net_name SUBSEP pin_index SUBSEP pin_name SUBSEP i SUBSEP slotted
} else {
arr[inst_name, curr_pin]="--UNCONN--" SUBSEP pin_index SUBSEP pin_name SUBSEP i SUBSEP slotted
arr[inst_name,curr_pin]="--UNCONN--" SUBSEP pin_index SUBSEP pin_name SUBSEP i SUBSEP slotted
}
# hidden connections (VCC, VSS on slotted devices, usually) specified on instance have higher
# precedence w.r.t. default specified in symbol.
} else if($0 ~ /# instance_based/ && curr_pin==pin_number) {
# overwrite with instance specified net name.
arr[inst_name, curr_pin]=net_name SUBSEP pin_index SUBSEP pin_name SUBSEP i SUBSEP slotted
arr[inst_name,curr_pin]=net_name SUBSEP pin_index SUBSEP pin_name SUBSEP i SUBSEP slotted
}
}
next
@ -127,7 +130,8 @@ $1=="device"||$1=="footprint"{
}
/^end netlist/{
for(i in arr) {
for(ii = 0; ii < arr_n; ii++) { # used to preserve ordering
i = arr_num[ii]
if(arr[i]) {
split(i, i_arr, SUBSEP)
split(arr[i], n_arr, SUBSEP)
@ -141,12 +145,27 @@ $1=="device"||$1=="footprint"{
print "pinname", i_arr[1], i_arr[2], n_arr[3]
}
}
for(i in footprint) print "footprint", i, footprint[i]
for(i in device) print "device", i, device[i]
for(ii = 0; ii < footprint_n; ii++) { # used to preserve ordering
i = footprint_num[ii]
print "footprint", i, footprint[i]
}
for(ii = 0; ii < device_n; ii++) { # used to preserve ordering
i = device_num[ii]
print "device", i, device[i]
}
print $0
delete arr
delete arr_num # used to preserve ordering
arr_n = 0
delete footprint
delete footprint_num # used to preserve ordering
footprint_n = 0
delete device
delete device_num # used to preserve ordering
device_n = 0
next
}

View File

@ -162,18 +162,21 @@ proc test_xschem_simulation {{f simulate_ff.sch}} {
proc netlist_test {} {
global netlist_dir
foreach {f t h} {
rom8k.sch spice 1466291334
greycnt.sch verilog 3391559642
autozero_comp.sch spice 2011673313
loading.sch vhdl 2601437773
mos_power_ampli.sch spice 1186348644
LCC_instances.sch spice 824427889
simulate_ff.sch spice 1321596936
rom8k.sch spice 1466291334
greycnt.sch verilog 3391559642
autozero_comp.sch spice 2011673313
loading.sch vhdl 2601437773
mos_power_ampli.sch spice 1186348644
hierarchical_tedax.sch tedax 998070173
LCC_instances.sch spice 824427889
pcb_test1.sch tedax 1295717013
simulate_ff.sch spice 1321596936
} {
xschem set netlist_type $t
xschem load [abs_sym_path $f]
xschem netlist
if {$t eq {verilog}} { set t v}
if {$t eq {tedax}} { set t tdx}
set netlist_file $netlist_dir/[file rootname $f].$t
## check netlist hashes, compare with gold hashes
set netlist_hash [xschem hash_file $netlist_file 1]