Skipper & Tcl 筆記


https://www.cnblogs.com/yeungchie/

ski-db

打開一個文件獲取 lib 對象 dbImport

set file "layout.gds"
set lib  [dbImport $file]

從 lib 對象獲取 libId dbLibGet

set libId [dbLibGet -lib $lib -attr id]

獲取數據精度

set dbum [expr int([dbLibGet -lib $lib -attr dbuPerUm])]

獲取頂層單元名 dbLibTopCell

set top [dbLibTopCell $lib]

從 lib 對象指定名稱獲取 cell 對象

dbCellGetByName

set cell [dbCellGetByName -lib $lib -cellName $top]

獲取 cell 的 bBox dbCellGetBBox

set box [dbCellGetBBox -cell $cell]

創建一個新的 newlib dbLibCreate

set newLib [dbLibCreate "NewLib" -dbu $dbum]

在 newLib 中創建一個新的 newCell

dbCellCreate

set newCell [dbLibCreate -lib $newLib -cellName "newCell"]

在 cell 中搜索實例 dbFindInst

set insts [dbFindInst -cell $cell -masterNamePattern ".+"]
# 正則匹配所有名字就是全都搜出來

獲取實例參數 dbFigGet

set master [dbFigGet $fig -attr master]
set xy     [dbFigGet $fig -attr pos]
set ori    [dbFigGet $fig -attr orient]
set mag    [dbFigGet $fig -attr mag]

在 cell 中搜索 label dbFindLabel

set labels [dbFindLabel -cell $cell -strPattern ".+" -regexp]
# 這個函數需要指定 -regexp 才會啟用正則

獲取 label 參數 dbFigGet

set layer   [dbFigGet $fig -attr layer]
set purpose [dbFigGet $fig -attr purpose]
set xy      [dbFigGet $fig -attr pos]
set text    [dbFigGet $fig -attr str]
set height  [dbFigGet $fig -attr height]
set ori     [dbFigGet $fig -attr orient]
set justify [dbFigGet $fig -attr justify]

獲取最大層次深度 dbLibMaxLevel

set level [dbLibMaxLevel $lib]

查看當前庫(文件)信息 dbLibSummary

set sum [dbLibSummary $lib -general]

查看數據類型

regexp {Format\\s+:\\s+(\\S+)\\s} $sum _ format
puts $format

導出 lib dbExport

  • GDSII
dbExport $lib "filename.gds" -preserveProp -emptyCell skipNone -skipSwitchCell
  • OASIS
dbExport $lib "filename.gds" -preserveProp -oasis -replaceInAString -writeInvalidString -cblock -cblockTable -emptyCell skipNone -skipSwitchCell
# 需要指定 -oasis 才是 OASIS 格式導出
# 且部分參數只有 OASIS 才支持,導出為 GDSII 時使用會報錯

ski-flashlvl

快速 LVL

ski-flashlvl layout_1.gds TOPCELL layout_2.gds TOPCELL lvl.rep [-OASISIN]

Tcl

不換行 puts

set blog "YEUNGCHIE"
puts -nonewline $blog

刷新標准輸出緩沖區

flush stdout

等待獲取標准輸入

gets stdin reply
puts $reply

查看數組中某個元素的位置

也可以用來檢測是否存在

set array [list a1 a2 b3 b4 5]
lsearch -exact $array b4
# 3   在第 3 的索引位置
lsearch -exact $array ab
# -1  返回 -1 代表不存在

數組排序

  • 簡單排序
lsort [list a12 a1 b0 a10 a8 a1]
# a1 a1 a10 a12 a8 b0
  • 如果字符串中存在數字,按照正確的數字大小排序
lsort -dictionary [list a12 a1 b0 a10 a8 a1]
# a1 a1 a8 a10 a12 b0
  • 排序並去重
lsort -dictionary -uniq [list a12 a1 b0 a10 a8 a1]
# a1 a8 a10 a12 b0

錯誤捕獲

catch { try_command } aa bb


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM