diff --git a/src/xschem.tcl b/src/xschem.tcl index bf26c213..f3519253 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -765,10 +765,26 @@ proc gaw_cmd {cmd} { } return } - chan configure $gaw_fd -blocking 1 -buffering line -encoding binary -translation binary + chan configure $gaw_fd -blocking 0 -buffering line -encoding binary -translation binary puts $gaw_fd "$cmd" + set n [regexp -all \n $cmd] + incr n + puts "gaw command lines: $n" fileevent $gaw_fd readable gaw_echoline - vwait gaw_fd + while { $n} { + #timeout for abnormal deadlocks + after 10000 set gaw_fd stalled + vwait gaw_fd + if { $gaw_fd ne {stalled} } { + after cancel set gaw_fd stalled + } else { + puts "timeout waiting for gaw response.." + break + } + incr n -1 + } + close $gaw_fd + unset gaw_fd } proc waves {} { diff --git a/xschem_library/examples/mos_power_ampli.sch b/xschem_library/examples/mos_power_ampli.sch index 5b2ae88a..99356631 100644 --- a/xschem_library/examples/mos_power_ampli.sch +++ b/xschem_library/examples/mos_power_ampli.sch @@ -396,7 +396,15 @@ descr = power } C {launcher.sym} 800 -140 0 0 {name=h3 descr="Load file into gaw" -tclcommand="gaw_cmd \\"tabledel mos_power_ampli.raw -load $netlist_dir/mos_power_ampli.raw -table_set mos_power_ampli.raw\\"" +comment=" + This launcher gets raw filename from current schematic using 'xschem get schname' + and stripping off path and suffix. It then loads raw file into gaw. + This allow to use it in any schematic without changes. +" +tclcommand=" +set rawfile [file tail [file rootname [xschem get schname]]].raw +gaw_cmd \\"tabledel $rawfile +load $netlist_dir/$rawfile +table_set $rawfile\\" +unset rawfile" } diff --git a/xschem_library/examples/poweramp.sch b/xschem_library/examples/poweramp.sch index 9b414b8a..10f20b7c 100644 --- a/xschem_library/examples/poweramp.sch +++ b/xschem_library/examples/poweramp.sch @@ -240,3 +240,17 @@ C {ngspice_get_expr.sym} 820 -510 2 0 {name=r29 node="[format %.4g [expr ([ngspice::get_voltage outm] - [ngspice::get_voltage outp]) * [ngspice::get_current \{r1[i]\}]]] W" descr = power } +C {launcher.sym} 780 -190 0 0 {name=h3 +descr="Load file into gaw" +comment=" + This launcher gets raw filename from current schematic using 'xschem get schname' + and stripping off path and suffix. It then loads raw file into gaw. + This allow to use it in any schematic without changes. +" +tclcommand=" +set rawfile [file tail [file rootname [xschem get schname]]].raw +gaw_cmd \\"tabledel $rawfile +load $netlist_dir/$rawfile +table_set $rawfile\\" +unset rawfile" +}