From 35c2d0fa93a26b2fa97ef58b4da2d99e23317f8c Mon Sep 17 00:00:00 2001 From: Stefan Schippers Date: Fri, 16 Oct 2020 00:13:39 +0200 Subject: [PATCH] better node multiplicity detection in spice and verilog awk netlist post-processors (\?-?[0-9]+) --- src/spice.awk | 12 ++++++------ src/verilog.awk | 2 +- src/xschem.tcl | 10 +++------- xschem_library/devices/netlist_options.sym | 6 ++++-- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/spice.awk b/src/spice.awk index c255ceb4..3ff26d22 100755 --- a/src/spice.awk +++ b/src/spice.awk @@ -212,7 +212,7 @@ function process( i, iprefix) # .probe tran v( ?1 DL[3],DL[2],DL[1],DL[0] , ?1 WL[3],WL{2],WL[1],WL[0] ) - if($1 ==".probe" && $4 ~/^\?[0-9]+$/ && $7 ~/^\?[0-9]+$/ && NF==9) { + if($1 ==".probe" && $4 ~/^\?-?0-9]+$/ && $7 ~/^\?-?[0-9]+$/ && NF==9) { num1=split($5,name,",") num2=split($8,name2,",") @@ -222,7 +222,7 @@ function process( i, iprefix) } # .save v( ?1 DL[3],DL[2],DL[1],DL[0] , ?1 WL[3],WL{2],WL[1],WL[0] ) - } else if($1 ==".save" && $3 ~/^\?[0-9]+$/ && $6 ~/^\?[0-9]+$/ && NF==8) { + } else if($1 ==".save" && $3 ~/^\?-?[0-9]+$/ && $6 ~/^\?-?[0-9]+$/ && NF==8) { num1=split($4,name,",") num2=split($7,name2,",") @@ -233,13 +233,13 @@ function process( i, iprefix) # .probe tran v( ?1 LDY1_B[1],LDY1_B[0] ) - } else if($1 ==".probe" && $4 ~/^\?[0-9]+$/ && NF==6) { + } else if($1 ==".probe" && $4 ~/^\?-?[0-9]+$/ && NF==6) { num=split($5,name,",") for(i=1;i<=num;i++) { print $1 " " $2 " " $3 " " name[i] " " $6 } # .save v( ?1 LDY1_B[1],LDY1_B[0] ) - } else if($1 ==".save" && $3 ~/^\?[0-9]+$/ && NF==5) { + } else if($1 ==".save" && $3 ~/^\?-?[0-9]+$/ && NF==5) { num=split($4,name,",") for(i=1;i<=num;i++) { print $1 " " $2 " " name[i] " " $5 @@ -277,7 +277,7 @@ function process( i, iprefix) for(j=2;j<=NF;j+=1) # start from 2 not from 3 20070221 { - if($j ~/^\?[0-9]+$/) continue # handle the case that $2 not pinlist 20070221 + if($j ~/^\?-?[0-9]+$/) continue # handle the case that $2 not pinlist 20070221 arg_num[j]=split($j,tmp,",") for(k=1;k<=arg_num[j]; k++) { arg_name[j,k]=tmp[k] @@ -289,7 +289,7 @@ function process( i, iprefix) for(j=2;j<=NF;j++) { - if($j !~ /^\?[0-9]+$/) + if($j !~ /^\?-?[0-9]+$/) { printf "%s ", $j # if not a node just print it } diff --git a/src/verilog.awk b/src/verilog.awk index 400e6519..4b704a50 100755 --- a/src/verilog.awk +++ b/src/verilog.awk @@ -245,7 +245,7 @@ begin_module && $1 ~/^\);$/ { { pin="" if(j>7) {printf ","} - if($j !~ /^\?[0-9]+$/) + if($j !~ /^\?-?[0-9]+$/) { pin=pin $j # if not a node just print it } diff --git a/src/xschem.tcl b/src/xschem.tcl index 85e33213..e0772a16 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -2657,10 +2657,8 @@ proc abs_sym_path {fname {ext {} } } { return "$fname" } } - if { $::OS ne {Windows}} { - # transform a/b/../c to a/c or a/b/c/.. to a/b - while {[regsub {([^/]*\.*[^./]+[^/]*)/\.\./?} $fname {} fname] } {} - } + # transform a/b/../c to a/c or a/b/c/.. to a/b + while {[regsub {([^/]*\.*[^./]+[^/]*)/\.\./?} $fname {} fname] } {} # remove trailing '/'s to non empty path regsub {([^/]+)/+$} $fname {\1} fname # if fname copy tmpfname is ../../e/f @@ -2679,9 +2677,7 @@ proc abs_sym_path {fname {ext {} } } { } else { set tmpfname "${tmpdirname}/$tmpfname" } if { [file exists "$tmpfname"] } { return "$tmpfname" } ## should we return path if directory exists ? - if { $::OS ne {Windows} } { - if { [file exists [file dirname "$tmpfname"]] } { return "$tmpfname" } - } + if { [file exists [file dirname "$tmpfname"]] } { return "$tmpfname" } } # remove any leading './' while { [regsub {^\./} $fname {} fname] } {} diff --git a/xschem_library/devices/netlist_options.sym b/xschem_library/devices/netlist_options.sym index e0077797..1ff7e9df 100644 --- a/xschem_library/devices/netlist_options.sym +++ b/xschem_library/devices/netlist_options.sym @@ -1,5 +1,7 @@ -v {xschem version=2.9.5_RC5 file_version=1.1} -G {type=netlist_options +v {xschem version=2.9.8 file_version=1.2} +G {} +K {type=netlist_options +template="name=n1" } V {} S {}