break.awk: do not break user code lines in spice netlists

This commit is contained in:
stefan schippers 2023-12-02 23:00:44 +01:00
parent b2965f4c3d
commit 8305024cd6
2 changed files with 13 additions and 8 deletions

View File

@ -25,6 +25,8 @@
BEGIN{ quote=0 }
/^\*\*\*\* begin user architecture code/ { user_code = 1 }
{
pos=0
sub(/[ \t]*$/, "") # chop trailing white space
@ -32,7 +34,8 @@ BEGIN{ quote=0 }
first = substr($0,1,1)
# dont break .include lines as ngspice chokes on these.
if(tolower($1) ~ /\.inc(lude)?|\.lib|\.title|\.save|\.write/) nobreak = 1
if(user_code == 1) nobreak = 1
else if(tolower($1) ~ /\.inc(lude)?|\.lib|\.title|\.save|\.write/) nobreak = 1
else if($0 ~/^\*\* ..._path:/) nobreak = 1
else nobreak = 0
# 20151203 faster executionif no {}' present
@ -42,7 +45,7 @@ BEGIN{ quote=0 }
pos++
c = substr($0,i,1)
if(c ~/[{}']/) quote=!quote
if(!nobreak && pos> 100 && !quote && (c ~/[ \t]/)) {
if(!nobreak && pos> 130 && !quote && (c ~/[ \t]/)) {
if(first=="*")
c = "\n*+" c
else
@ -56,7 +59,7 @@ BEGIN{ quote=0 }
split($0, a, /[^ \t]+/)
for(i=1;i<=NF;i++) {
pos += length($i)+length(a[i])
if(!nobreak && pos>100) {
if(!nobreak && pos>130) {
if(first=="*") {
printf "%s", "\n*+"
} else {
@ -71,3 +74,5 @@ BEGIN{ quote=0 }
printf "\n"
}
}
/^\*\*\*\* end user architecture code/ { user_code = 0 }

View File

@ -190,21 +190,21 @@ proc test_xschem_simulation {{f simulate_ff.sch}} {
proc netlist_test {} {
global netlist_dir
foreach {f t h} {
rom8k.sch spice 1947979332
rom8k.sch spice 665784374
greycnt.sch verilog 3032956185
autozero_comp.sch spice 751826850
test_generators.sch spice 49312823
inst_sch_select.sch spice 2444330953
test_bus_tap.sch spice 181420586
inst_sch_select.sch spice 2432089114
test_bus_tap.sch spice 188702715
loading.sch vhdl 2975204502
mos_power_ampli.sch spice 125840804
hierarchical_tedax.sch tedax 998070173
LCC_instances.sch spice 696885230
LCC_instances.sch spice 1646579002
pcb_test1.sch tedax 1925087189
test_doublepin.sch spice 4159808692
simulate_ff.sch spice 574849766
test_symbolgen.sch spice 2593807370
test_mosgen.sch spice 21996225
test_mosgen.sch spice 2380524013
} {
xschem set netlist_type $t
xschem load [abs_sym_path $f]