[ Shell ] 通過 Shell 腳本導出 GDSII/OASIS 文件


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

常見的集成電路版圖數據庫文件格式有 GDSII 和 OASIS,virtuoso 提供了下面兩個工具,可以用來通過命令行導出版圖數據。

  • strmout (導出為 GDSII 格式)

    strmout -help
    Usage: Usage: strmout
        -library                        <Input Library>
        -strmFile                       <Output Stream File>
        [-strmVersion]                  <Stream Version Number>
        [-runDir]                       <Run Directory>
        [-topCell]                      <Toplevel Cells to Translate>
        [-view]                         <Toplevel Cell View Name>
        [-logFile]                      <Output Log File Name>
        [-summaryFile]                  <Output Summary File>
        [-techLib]                      <Technology Library>
        [-hierDepth]                    <Hierarchical Depth to Translate to>
        [-layerMap]                     <Quoted List of Layer Map Files>
        [-translateUnmappedLPP]         <Allow undefined LPP to be translated by incrementally mapping LPP using layerMap file, SKILL hook poLayerMap, and automatic layer mapping>
        [-labelMap]                     <Input Label Map File>
        [-labelDepth]                   <Hierarchical Depth to Add Labels to>
        [-replaceBusBitChar]            <Replace "<>" With "[]">
        [-cellMap]                      <Input Cell Map File>
        [-fontMap]                      <Input Font Map File>
        [-propMap]                      <Input Property Map File>
        [-objectMap]                    <Quoted List of Object Mapping Files>
        [-viaMap]                       <Via Mapping File>
        [-viaCutArefThreshold]          <Threshold Value For Creating AREF For Cut Geometries For Via>
        [-userSkillFile]                <User Skill File>
        [-refLibList]                   <Name of The File Containing Refliblist >
        [-arrayInstToScalar]
        [-cellNamePrefix]               <Cell Name Prefix>
        [-cellNameSuffix]               <Cell Name Suffix>
        [-ignoreTopCellPrefixSuffix]    <Ignores cellName Prefix and Suffix for topCell>
        [-case]                         <upper | lower | preserve >
        [-labelCase]                    <upper | lower | preserve >
        [-ignoreLines]
        [-noOutputTextDisplays]
        [-noOutputUnplacedInst]         <Do not Output Unplaced Instances>
        [-convertDot]                   <node | polygon | ignore >
        [-convertPin]                   <geometry | text | geometryAndText | ignore >
        [-pinAttNum]                    <Stream Attribute Num (1-127) For Preserving Pins>
        [-pathToPolygon]                <Convert Paths to Polygons>
        [-diagonalPathToPolygon]        <Convert Paths with non-orthogonal segments to polygons>
        [-propValueOnly]                <Output Property Values Only>
        [-rectToBox]
        [-respectGDSIINameLimit]
        [-gdsCellNameLength]            <Truncate GDS Cell/STRUCT name length to specified value (>=10)>
        [-flattenPcells]
        [-flattenVias]
        [-outputViaShapesToViaPurp]     <Output Shapes of Via to Via Purpose>
        [-doNotPreservePcellPins]
        [-snapToGrid]
        [-dbuPerUU]                     <DB Units per user units>
        [-reportPrecisionLoss]          <Report Precision Loss Because of dbuPerUU Value>
        [-noObjectProp]
        [-ignorePcellEvalFail]
        [-mergePathSegsToPath]          <Merging pathSegs into a single PATH>
        [-noConvertHalfWidthPath]       <Do not Convert The Half Width Path to Boundary>
        [-checkPolygon]                 <Report Bad Polygons And Paths>
        [-backupGdsLogFiles]            <Backup GDSII and LOG files, if they already exist>
        [-maxVertices]                  <Maximum Limit of Vertices (5-4000) Allowed in Stream File>
        [-strmTextNS]                   <NameSpace of The TEXT Records in The Stream File>
        [-templateFile]                 <Name of The File Containing Option Names And Values>
        [-cellListFile]                 <Name of the file containing cellList>
        [-outputDir]                    <output directory>
        [-noInfo]                       <Quoted List of Info Message Ids>
        [-noWarn]                       <Quoted List of Warning Message Ids>
        [-warnToErr]                    <Quoted List of warning Message Ids>
        [-infoToWarn]                   <Quoted List of Info Message Ids>
        [-donutNumSides]                <Number of sides (4-131072) for the BOUNDARY of donut>
        [-ellipseNumSides]              <Number of sides (4-131072) for the BOUNDAR of ellipse>
        [-wildCardInCellMap]            <Wild Card in cell map file>
        [-ignoreMissingCells]           <Ignores Missing cellViews During Translation and Continue Translation>
        [-ignoreMissingVias]            <Ignores Missing standard/custom vias During Translation and Continue Translation>
        [-subMasterSeparator]           <Separator to used for sub-master naming (default: "_CDNS_")>
        [-convertPcellPin]              <geometry | text | geometryAndText | ignore (default: convertPin value)>
        [-guiHistory]                   <Use options of last successful translation from the XStream Out GUI>
        [-ignoreZeroWidthPathSeg]       <Ignores zero width PathSeg during translation>
        [-ignoreObjectMapFromTech]      <Ignores object map file from technology>
        [-ignoreCurrentTimestamp]       <Ignores current timestamp>
        [-verbose]                      <Generate detailed information in the log and summary files>ose] <Generate detailed information in the log and summary files>
    
  • oasisout (導出為 OASIS 格式)

    oasisout -help
    Usage: oasisout
        -library                        <Input Library>
        -oasisFile                      <Output OASIS File>
        [-arrayInstToScalar]            <Convert Arrays to Scalar Instances>
        [-backupOasisLogFiles]          <Backup OASIS and LOG files, if they    already exist>
        [-case]                         <upper | lower | preserve>
        [-cellMap]                      <Input cell map file>
        [-cellListFile]                 <Name of the file containing cellList>
        [-cellNamePrefix]               <Cell name prefix>
        [-cellNameSuffix]               <Cell name suffix>
        [-checkPolygon]                 <Report bad polygons and paths>
        [-circleToPolygon]              <Convert Cricle/Ellipse object to Polygon>
        [-compress]                     <Enable CBLOCK compression>
        [-compressLevel]                <Set the compression level for CBLOCK   compression>
        [-convertDot]                   <polygon | circle | ignore>
        [-convertPcellPin]              <geometry | text | geometryAndText |    ignore (default: convertPin value)>
        [-convertPin]                   <geometry | text | geometryAndText |    ignore>
        [-dbuPerUU]                     <DB Units per user units>
        [-diagonalPathToPolygon]        <Convert Paths with non-orthogonal  segments to Polygons>
        [-doNotPreservePcellPins]       <Do not preserve the PCell Pins>
        [-donutNumSides]                <Number of sides (4-131072) for the     BOUNDARY of Donut>
        [-ellipseNumSides]              <Number of sides (4-131072) for the     BOUNDAR of Circle/Ellipse>
        [-flattenPcells]                <Flatten the PCell Instances>
        [-flattenViaShapesToViaPurp]    <Flatten Vias' Shapes to Via Purpose>
        [-flattenVias]                  <Flatten the Vias>
        [-GDSIICompatible]              <Generate the OASIS file with GDSII     specific limits>
        [-guiHistory]                   <Use options of last successful     translation from the XOasis Out GUI>
        [-hierDepth]                    <Hierarchical depth to translate to>
        [-ignoreLines]                  <Ignore Line objects>
        [-ignoreMissingCells]           <Ignore missing cellViews during    translation and continue translation>
        [-ignoreMissingVias]            <Ignore missing standard/custom vias    during translation and continue translation>
        [-ignoreObjectMapFromTech]      <Ignore object map file from technology>
        [-ignorePcellEvalFail]          <Ignore the PCell evaluation failure>
        [-ignoreRoutes]                 <Ignore Route objects>
        [-ignoreZeroWidthPathSeg]       <Ignore zero width PathSeg during   translation>
        [-infoToWarn]                   <Quoted list of Info message Ids>
        [-labelMap]                     <Input label map file>
        [-labelDepth]                   <Hierarchical depth to add labels to>
        [-layerMap]                     <Quoted list of layer map files>
        [-logFile]                      <Output log file name>
        [-mergePathSegsToPath]          <Merge pathSegs into a single PATH>
        [-noConvertHalfWidthPath]       <Do not convert the half width Path to  Boundary>
        [-noInfo]                       <Quoted list of info message Ids>
        [-noObjectProp]                 <Do not write the special object    properties>
        [-noOutputTextDisplays]         <Do not output Text Displays>
        [-noOutputUnplacedInst]         <Do not output Unplaced Instances>
        [-noWarn]                       <Quoted list of warning message Ids>
        [-objectMap]                    <Quoted list of object mapping files>
        [-outputDir]                    <output directory>
        [-pathToPolygon]                <Convert Path object to Polygon>
        [-preservePinAtt]               <Preserve Pin connectivity information>
        [-preserveTextAtt]              <Preserve Text attributes as properties>
        [-propMap]                      <Input property map file>
        [-refLibList]                   <Name of the file containing reference  libraries list>
        [-replaceBusBitChar]            <Replace "<>" with "[]">
        [-runDir]                       <Run directory>
        [-snapToGrid]                   <Snap to grid>
        [-subMasterSeparator]           <Separator to used for sub-master naming    (default: "_CDNS_")>
        [-summaryFile]                  <Output summary file>
        [-techLib]                      <Technology library>
        [-templateFile]                 <Name of the file containing option names   And values>
        [-textCase]                     <upper | lower | preserve>
        [-topCell]                      <Toplevel cells to translate>
        [-translateUnmappedLPP]         <Allow undefined LPP to be translated by    incrementally mapping LPP using layerMap file, SKILL hook poLayerMap, and  automatic layer mapping>
        [-userSkillFile]                <User skill file>
        [-verbose]                      <Generate detailed information in the log   and summary files>
        [-viaMap]                       <Via mapping file>
        [-view]                         <Toplevel cell view name>
        [-warnToErr]                    <Quoted list of warning message Ids>
        [-wildCardInCellMap]            <Wild card in cell map file>
    

OASIS 的文件體積聲稱可以比 GDSII 小 10~50 倍,實際在我的使用中這個數字可以到 20+(以項目情況而定),當項目數據較大的情況下,文件小了確實可以加快運行速度、節省時間(估計是硬盤讀寫環節拖累了整體運行時間)。
oasisoutstrmout 幾個常用的參數都是相同的,下面講下如何使用。

另外,命令的運行路徑必須在 virtuoso 啟動路徑(能在當前路徑下找得到 cds.lib 文件)。

參數解釋

必要的

首先有幾個必要的運行條件和參數。

  • -library

    這個參數用來指定導出的單元庫 (library) 名。

  • -strmFile

    當使用 strmout 時,這個參數用來指定導出的 GDSII 文件名稱。

  • -oasisFile

    當使用 oasisout 時,這個參數用來指定導出的 OASIS 文件名稱。

推薦的

其次還有幾個是可選的參數,但是建議也指定一下。

  • -topCell

    指定導出單元的頂層 Cell 名稱,指定了頂層 Cell 就不會導出該頂層沒有調用的單元,否則會導出當前庫下的所有 Cell 。

  • -view

    指定導出單元的頂層 View 名稱,默認為 layout

  • -runDir

    指定運行路徑。

    注意這里的 運行路徑 不同於前面提到的命令的運行路徑。
    當定義了 -runDir-strmFile-oasisFile-logFile-summaryFile 等參數如果定義的是相對路徑,則會以 -runDir 為參考。

  • -logFile

    生成 log 文件,默認生成文件名為 strmOut.logoasisOut.log

  • -summaryFile

    生成 summary 文件,默認不生成。

  • -layerMap

    指定 layermap 文件,默認情況是調用 attach tech 中的 layermap,當對層次轉換有特殊要求時可以通過這個參數來指定自定義的 layermap 。

編寫腳本 export_layout

下面寫個腳本優化一下這個運行方式。

點擊查看完整代碼
#!/bin/bash
#--------------------------
# Program  : export_layout.sh
# Language : Bash
# Author   : YEUNGCHIE
# Version  : 2022.04.05
#--------------------------
HelpDoc(){
    cat <<EOF
-------------------------------------------------
Export Layout ( GDSII or OASIS ) File
-------------------------------------------------
Usage: export_layout -path cdslibDir -lib libName -cell cellName [ OPTIONS ]

    -path       Path where the cds.lib file is located
    -lib        Layout top cell libName
    -cell       Layout top cell cellName
    -view       Layout top cell viewName    ( Default: layout )
    -file       Output file name            ( Default: <cellName>.gds or <cellName>.oasis )
    -log        Log file                    ( Default: export_layout.log )
    -sum        Summary file
    -layermap   Specified the layermap file
    -oasis      Specified the file format is OASIS, and GDSII if not specified
    -h, -help   Display this help

Examples:   export_layout\\
                -path       \$project/work/
                -lib        Xeon
                -cell       X999
                -oasis

Output:     OASIS file - X999.oasis
EOF
}

for a in $@; do
    if [[ $a =~ ^-+h(elp)? ]]; then
        HelpDoc >&2
        exit 1
    fi
done

unset libName
unset cellName
unset viewName
unset file
unset path
unset logFile
unset sumCmd
unset mapCmd
unset OASIS

viewName='layout'
logFile='export_layout.log'

# 命令行參數分析
while [[ -n $1 ]]; do
    case $1 in
        -lib)       shift;  libName=$1                  ;;
        -cell)      shift;  cellName=$1                 ;;
        -view)      shift;  viewName=$1                 ;;
        -file)      shift;  file=$1                     ;;
        -path)      shift;  path=$1                     ;;
        -log)       shift;  logFile=$1                  ;;
        -sum)       shift;  sumCmd="-summaryFile $1"    ;;
        -layermap)  shift;  mapCmd="-layerMap $1"       ;;
        -oasis)     OASIS=1                             ;;
        *)
            echo "Invalid option - '$1'" >&2
            echo "Try -h or -help for more infomation." >&2
            exit 1
        ;;
    esac
    shift
done

# 記錄當前路徑
runDir=$(pwd -P)

# 參數檢查
if [[ ! ( $path && $libName && $cellName ) ]]; then
    # 缺少必要參數時,打印 help 並退出
    HelpInfo >&2
    exit 1
elif [[ -d $path ]]; then
    cd $path
else
    # 找不到目標路徑文件,打印報錯
    echo "No such directory - $path" >&2
    echo "Try -h or -help for more infomation." >&2
    exit 1
fi

## 不同的文件格式
if [[ $OASIS ]]; then
    if [[ ! $file ]]; then file="${cellName}.oasis" ; fi
    command="oasisout -oasisFile $file"
else
    if [[ ! $file ]]; then file="${cellName}.gds" ; fi
    command="strmout -strmFile $file"
fi

command="$command -runDir $runDir -library $libName -topCell $cellName -view $viewName -logFile $logFile $sumCmd $mapCmd"

# 運行
exec $command

優化后的腳本有三個必要的參數需要指定

  • -path
    指定 cds.lib 文件所在的文件夾路徑
  • -lib
    指定導出單元的頂層 Library 名稱
  • -cell
    指定導出單元的頂層 Cell 名稱

通過 -path 參數來定義 virtuoso 啟動路徑,實現在任意路徑下可運行,生成的文件都在當前路徑下。

運行實例

例:cdslib 文件所在路徑為 ../project

  1. 導出版圖 verify/ad01d0/layout 單元為 GDSII 文件。

    export_layout -path ../project -lib verify -cell ad01d0
    
  2. 導出版圖 verify/inv0d0/layout 單元為 OASIS 文件,指定輸出文件名 inv.oasis,指定 log 文件為 inv.log

    export_layout -path ../project -lib verify -cell inv0d0 -file inv.oasis -oasis -log inv.log
    

相關拓展


免責聲明!

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



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