StefanSchippers / xschem

A schematic editor for VLSI/Asic/Analog custom designs, netlist backends for VHDL, Spice and Verilog. The tool is focused on hierarchy and parametric designs, to maximize circuit reuse.
Other
297 stars 21 forks source link

tcleval(): evaluation of script: fet_drc failed #198

Closed sfs325 closed 1 month ago

sfs325 commented 2 months ago

Dear all, I recently installed Xschem version 3.4.5. I have started with an example with a simple mosfet and two voltage supplies to check the operation point. As soon as I try to change any parameter of the mosfet I get the following error:

tcleval(): evaluation of script: fet_drc {M1} {/usr/local/share/pdk/sky130A/libs.tech/xschem/sky130_fd_pr/nfet3_01v8.sym} {nfet_01v8} {20} {0.15} {1} failed : invalid command name "fet_drc"

Even if I use the default parameters I open them and click on OK, I get the error.

StefanSchippers commented 2 months ago

This error does not prevent correct netlisting. fet_drc is a drc checker for transistor dimensions. The drc checker (fet_drc) is included in recent xschemrc in the xschem_sky130 repository.

To fix add this procedure at the bottom of your xschemrc file:

# sky130 mosfets dimension checks
proc fet_drc {instance symbol model w l nf} {
  set res {}
  # puts "$instance $model $symbol w=$w l=$l nf=$nf"
  if { [string is double $w] && [string is double $l] && [string is integer $nf]} {
    # not *_nf.sym devices: get single finger width
    if {![regexp {fet.*_nf\.sym$} $symbol]} {
      set w [expr { double($w) / double($nf)}]
    }
    switch -regexp $model {
      {[np]fet_01v8$} {
        if { $w < 0.42 } {
          append res "${instance} ($model): finger width is too small, w / nf = $w" \n
        }
        if { $l < 0.15 } {
          append res "${instance} ($model): length is too small, l = $l" \n
        }
      }
      {pfet_01v8_lvt$} {
        if { $w < 0.42 } {
          append res "${instance} ($model): finger width is too small, w / nf = $w" \n
        }
        if { $l < 0.35 } {
          append res "${instance} ($model): length is too small, l = $l" \n
        }
      }
      {nfet_01v8_lvt$} {
        if { $w < 0.42 } {
          append res "${instance} ($model): finger width is too small, w / nf = $w" \n
        }
        if { $l < 0.15 } {
          append res "${instance} ($model): length is too small, l = $l" \n
        }
      }
      {[np]fet_g5v0d10v5$} {
        if { $w < 0.42 } {
          append res "${instance} ($model): finger width is too small, w / nf = $w" \n
        }
        if { $l < 0.5 } {
          append res "${instance} ($model): length is too small, l = $l" \n
        }
      }
      {pfet_g5v0d16v0$} {
        if { $w < 5 } {
          append res "${instance} ($model): finger width is too small, w / nf = $w" \n
        }
        if { $l < 0.66 } {
          append res "${instance} ($model): length is too small, l = $l" \n
        }
      }
      {nfet_g5v0d16v0$} {
        if { $w < 5 } {
          append res "${instance} ($model): finger width is too small, w / nf = $w" \n
        }
        if { $l < 0.7 } {
          append res "${instance} ($model): length is too small, l = $l" \n
        }
      }
    } ;# switch
  }
  return $res
}
sfs325 commented 2 months ago

Thank you for your reply. I see that it does not prevent from netlisting. I see the procedure in fet_drc xschemrc. Unfortunetly your fix does not work. At least I have reported it.

I have been playing around with xschem and your effort is unvaluable.

StefanSchippers commented 2 months ago

Ensure you have added the fet_drc procedure in the xschemrc you are using. Xschem loads first the xschemrc in the directory where it is started, then if no xschemrc is found it loads the one in your home directory: ~/.xschem/xschemrc.

If this still fails ensure you have updated version of the xschem symbols. Unfortunately this drc check was asked a couple weeks ago, and to make it work with no problems all the tools must be updated. You can copy all the sky130 symbols from here in your pdk installation (usually ../share/pdk/sky130A/libs.tech/xschem/sky130_fd_pr)

StefanSchippers commented 2 months ago

I have also made an update to xschem , if no fet_drc is defined do no attempt to call it, to avoid these nasty error messages. Thank you for reporting.