这两天试了下使用tcl写pcell,感觉还是非常方便的,按manual中command的参数要求与格式完成后,在laker里直接source 该tcl。即可在设置的lib 中找到这个pcell,不用再考虑如何去编译的问题。下面给个效果图与参考代码。
Syntax
dbDefineParameterizedCell -lib libName -cell cellName -params parameters [-vars localVariables] [-refresh 0|1] [-encrypt encryptionKey] [-pcellVersion num] -exec Tcl_commands
# create a spiral inductor
dbDefineParameterizedCell -lib parameterizedCellLib \
-cell Spiral_v2 -params [list [list spiralNo 10 Integer] \
[list radius 10.0 Float] [list gap 3.0 Float] \
[list width 2.0 Float] [list space 0.8 Float]] \
-vars {Layer PI2 sin45 sec hgap cvId nCnt os is om im} \
-exec {
# create a spiral inductor
set cvId $dbParameterizedCell
set Layer MET1
set PI2 [expr acos(0)]
set sin45 [expr sin($PI2/2)]
set sec [expr 1.0/cos($PI2/4)]
set hgap [expr $gap*0.5]
for {set nCnt 0} {$nCnt < $spiralNo} {incr nCnt} {
set os [expr $radius*$sec]
set is [expr double($radius-$width)*$sec]
set om [expr $os*$sin45]
set im [expr $is*$sin45]
dbCreatePolygon -cv $cvId -layer $Layer \
-point ($os,$hgap) ($om,[expr $om+$hgap])\
(0,[expr $os+$hgap]) (0,[expr $is+$hgap])\
($im,[expr $im+$hgap]) ($is,$hgap)
dbCreatePolygon -cv $cvId -layer $Layer \
-point ([expr -$os],$hgap)\
([expr -$om],[expr $om+$hgap]) (0,[expr $os+$hgap])\
(0,[expr $is+$hgap]) ([expr -$im],[expr $im+$hgap]) \
([expr -$is],$hgap)
dbCreatePolygon -cv $cvId -layer $Layer \
-point ($os,[expr -$hgap]) ($om,[expr -$om-$hgap])\
(0,[expr -$os-$hgap]) (0,[expr -$is-$hgap])\
($im,[expr -$im-$hgap]) ($is,[expr -$hgap])
dbCreatePolygon -cv $cvId -layer $Layer \
-point ([expr -$os],[expr -$hgap])\
([expr -$om],[expr -$om-$hgap]) \
(0,[expr -$os-$hgap]) (0,[expr -$is-$hgap]) \
([expr -$im],[expr -$im-$hgap])\
([expr -$is],[expr -$hgap])
set radius [expr double($radius+$width+$space)]
}
# return 1
expr 1
}