码迷,mamicode.com
首页 > 其他好文 > 详细

Skill 导出所有Layer信息用于tapeout

时间:2020-08-01 21:30:01      阅读:76      评论:0      收藏:0      [点我收藏+]

标签:get   getc   field   item   reac   html   init   call   reverse   

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

了解到 61 版本的环境中不提供 dataType 的获取渠道了,现在通过分析 layermap 文件的方式来获取。

  • code
/************************************
*                                   *
*   Program   :  ycLayerExcel.il    *
*   Language  :  Cadence Skill      *
*   Author    :  YEUNGCHIE          *
*   Version   :  20.07.15.2351      *
*   MainFunc  :  ycLayerExcel       *
*                                   *
************************************/
procedure(ycLayerExcel()
    prog((  cv defLib 
            ycLayerExcelLibField ycLayerExcelCellField ycLayerExcelViewField
            ycLayerExcelBrowseField ycLayerExcelRefreshField ycLayerExcelCopyField
            ycLayerExcelFormatField ycLayerExcelLayerNameField ycLayerExcelLayerNumField ycLayerExcelPurposeField ycLayerExcelDataTypeField ycLayerExcelOutputField
            ycLayerExcelForm
        )
        
        unless(cv = geGetEditCellView()
            defLib = car(last(ddGetLibList()))
        )
        ;CellView Select
        ycLayerExcelLibField = ddHiCreateLibraryComboField(
            ?name           ‘ycLayerExcelLibField
            ?prompt         sprintf(nil "%s" "Library")
            ?defValue       cv~>libName || defLib~>name
            ?callback       "_ycLayerExcelLibFieldCB()"
            ?toolTip        "Library"
            ?nextField      ‘ycLayerExcelCellField
        )
        ycLayerExcelCellField = hiCreateComboField(
            ?name           ‘ycLayerExcelCellField
            ?prompt         sprintf(nil "%s" "Cell")
            ?items          cv~>lib~>cells~>name || defLib~>cells~>name
            ?defValue       cv~>cellName || car(defLib~>cells~>name) || ""
            ?callback       "_ycLayerExcelCellFieldCB()"
            ?nextField      ‘ycLayerExcelViewField
        )
        ycLayerExcelViewField = hiCreateComboField(
            ?name           ‘ycLayerExcelViewField
            ?prompt         sprintf(nil "%s" "View")
            ?items          cv~>cell~>views~>name || car(defLib~>cells)~>views~>name
            ?defValue       cv~>viewName || car(car(defLib~>cells)~>views~>name) || ""
        )
        ;Button
        ycLayerExcelBrowseField = hiCreateFormButton(
            ?name           ‘ycLayerExcelBrowseField
            ?buttonText     "Browse"
            ?callback       "_ycLayerExcelBrowseFieldCB()"
        )
        ycLayerExcelRefreshField = hiCreateFormButton(
            ?name           ‘ycLayerExcelRefreshField
            ?buttonText     "Refresh"
            ?callback       "_ycLayerExcelRefreshFieldCB()"
        )
        ycLayerExcelCopyField = hiCreateFormButton(
            ?name           ‘ycLayerExcelCopyField
            ?buttonText     "Copy"
            ?callback       "_ycLayerExcelCopyFieldCB()"
        )
        ;Output Setup
        ycLayerExcelFormatField = hiCreateStringField(
            ?name           ‘ycLayerExcelFormatField
            ?prompt         "Format"
            ?defValue       "<layerName> 0.005 <layerNum> <purpose> <dataType>"
        )
        ycLayerExcelLayerNameField = hiCreateFormButton(
            ?name           ‘ycLayerExcelLayerNameField
            ?buttonText     " <layerName> "
            ?callback       "_ycLayerExcelAddFormatCB(\" <layerName> \")"
        )
        ycLayerExcelLayerNumField = hiCreateFormButton(
            ?name           ‘ycLayerExcelLayerNumField
            ?buttonText     " <layerNum> "
            ?callback       "_ycLayerExcelAddFormatCB(\" <layerNum> \")"
        )
        ycLayerExcelPurposeField = hiCreateFormButton(
            ?name           ‘ycLayerExcelPurposeField
            ?buttonText     " <purpose> "
            ?callback       "_ycLayerExcelAddFormatCB(\" <purpose> \")"
        )
        ycLayerExcelDataTypeField = hiCreateFormButton(
            ?name           ‘ycLayerExcelDataTypeField
            ?buttonText     " <dataType> "
            ?callback       "_ycLayerExcelAddFormatCB(\" <dataType> \")"
        )
        ycLayerExcelOutputField = hiCreateMLTextField(
            ?name           ‘ycLayerExcelOutputField
            ?editable       nil
        )
        ;Form
        ycLayerExcelForm = hiCreateAppForm(
            ?name           ‘ycLayerExcelForm
            ?formTitle      "Layer Info In Excel Format"
            ?fields         list(
                
                list(ycLayerExcelLibField           011 : 001   150 : 034   50  )
                list(ycLayerExcelCellField          011 : 036   150 : 034   50  )
                list(ycLayerExcelViewField          011 : 071   150 : 034   50  )
                
                list(ycLayerExcelBrowseField        070 : 106   080 : 034       )
                list(ycLayerExcelRefreshField       070 : 141   080 : 034       )
                list(ycLayerExcelCopyField          070 : 176   080 : 034       )
                
                list(ycLayerExcelFormatField        201 : 001   449 : 034   50  )
                list(ycLayerExcelLayerNameField     231 : 042   089 : 027   50  )
                list(ycLayerExcelLayerNumField      331 : 042   089 : 027   50  )
                list(ycLayerExcelPurposeField       431 : 042   089 : 027   50  )
                list(ycLayerExcelDataTypeField      531 : 042   089 : 027   50  )
                list(ycLayerExcelOutputField        201 : 076   449 : 154   30  )
            )
            ?buttonLayout   list(‘Close list(‘Init "_ycLayerExcelFormInitCB()"))
        )
        hiDisplayForm(ycLayerExcelForm)
    )
)
procedure(_ycLayerExcelLibFieldCB()
    prog((lib cellsName reCellName)
        
        lib = ddGetObj(ycLayerExcelForm~>ycLayerExcelLibField~>value)
        cellsName = lib~>cells~>name
        
        ycLayerExcelForm~>ycLayerExcelCellField~>items = cellsName
        
        case(ycInListp(ycLayerExcelForm~>ycLayerExcelCellField~>value cellsName)
            (nil
                ycLayerExcelForm~>ycLayerExcelCellField~>value = car(cellsName)
            )
            (t
                _ycLayerExcelCellFieldCB()
            )
            
        )
    )
)
procedure(_ycLayerExcelCellFieldCB()
    prog((lib cell viewsName)
        
        lib = ddGetObj(ycLayerExcelForm~>ycLayerExcelLibField~>value)
        cell = car(setof(c lib~>cells c~>name == ycLayerExcelForm~>ycLayerExcelCellField~>value))
        viewsName = cell~>views~>name
        
        ycLayerExcelForm~>ycLayerExcelViewField~>items = viewsName
        
        case(ycInListp(ycLayerExcelForm~>ycLayerExcelViewField~>value viewsName)
            (nil
                ycLayerExcelForm~>ycLayerExcelViewField~>value = car(viewsName)
            )
            (t
                ;
            )
        )
    )
)
procedure(_ycLayerExcelBrowseFieldCB()
    prog(()
        ddsSyncWithForm(
            hiGetCurrentForm()
            ‘browse
            ‘ycLayerExcelLibField
            ‘ycLayerExcelCellField
            ‘ycLayerExcelViewField
        )
    )
)
procedure(_ycLayerExcelRefreshFieldCB()
    prog((lpps layerNames layerNums purposes format layerInfo outputText matchInfo suffix)
        
        ycLayerExcelForm~>ycLayerExcelOutputField~>value = ""
        
        cv = dbOpenCellViewByType(
            ycLayerExcelForm~>ycLayerExcelLibField~>value
            ycLayerExcelForm~>ycLayerExcelCellField~>value
            ycLayerExcelForm~>ycLayerExcelViewField~>value
            ""
            "r"
        )
        dbOpenHier(cv 32)
        lpps = cv~>lpps
        layerNames = lpps~>layerName
        foreach(layerNum lpps~>layerNum
            layerNums = append1(
                layerNums
                sprintf(nil "%d" layerNum)
            )
        )
        purposes = lpps~>purpose
        
        format = ycLayerExcelForm~>ycLayerExcelFormatField~>value
        if(rexMatchp("<dataType>" format)
            layerInfo = _ycReadLayermap()
            ;‘((layerName purpose layerNum dataType) ...)
        )
        
        format = parseString(format)
        
        outputText = ""
        for(x 0 length(lpps) - 1
            for(f 0 length(format) - 1
                if(f == length(format) - 1
                    suffix = "\n"
                    suffix = "\t"
                )
                
                case(nth(f format)
                    ("<layerName>"
                        outputText = strcat(outputText nth(x layerNames)        suffix)
                    )
                    ("<layerNum>"
                        outputText = strcat(outputText nth(x layerNums)         suffix)
                    )
                    ("<purpose>"
                        outputText = strcat(outputText nth(x purposes)          suffix)
                    )
                    ("<dataType>"
                        matchInfo = setof(layer layerInfo
                            nth(0 layer) == nth(x layerNames) &&
                            nth(1 layer) == nth(x purposes)   &&
                            nth(2 layer) == nth(x layerNums) 
                        )
                        
                        outputText = strcat(outputText nth(3 car(matchInfo)) || ""  suffix)
                    )
                    (t
                        if(rexMatchp("<*>" nth(f format))
                            then
                                warn("Cannot match %s\n" nth(f format))
                                outputText = strcat(outputText ""               suffix)
                            else
                                outputText = strcat(outputText nth(f format)    suffix)
                        )
                    )
                )
            )
        )
        ycLayerExcelForm~>ycLayerExcelOutputField~>value = outputText
        printf(outputText)
    )
)
procedure(_ycLayerExcelCopyFieldCB()
    prog(()
        hiSetClipboard(ycLayerExcelForm~>ycLayerExcelOutputField~>value)
    )
)
procedure(_ycLayerExcelAddFormatCB(addFormat)
    prog((format)
        format = ycLayerExcelForm~>ycLayerExcelFormatField~>value
        ycLayerExcelForm~>ycLayerExcelFormatField~>value = strcat(format addFormat)
    )
)
procedure(_ycLayerExcelFormInitCB()
    prog(()
        ycLayerExcelForm~>ycLayerExcelLibField~>value = ycLayerExcelForm~>ycLayerExcelLibField~>defValue
        ycLayerExcelForm~>ycLayerExcelCellField~>value = ycLayerExcelForm~>ycLayerExcelCellField~>defValue
        ycLayerExcelForm~>ycLayerExcelViewField~>value = ycLayerExcelForm~>ycLayerExcelViewField~>defValue
        ycLayerExcelForm~>ycLayerExcelOutputField~>value = ""
        ycLayerExcelForm~>ycLayerExcelFormatField~>value = "<layerName> 0.005 <layerNum> <purpose> <dataType>"
    )
)
procedure(_ycReadLayermap()
    prog((tech layermapFileName layermapPath techLibPath file row layerInfo)
        tech = techGetTechFile(cv)
        layermapFileName = strcat(tech~>libName ".layermap")
        
        unless(isFile(layermapPath = layermapFileName)
            techLibPath = buildString(reverse(cdr(reverse(parseString(tech~>path "/" t)))) "/")
            layermapPath = strcat(techLibPath "/" layermapFileName)
        )
        
        unless(file = infile(layermapPath)
            error("Could not access library %s\n" layermapPath)
        )
        while(gets(row file)
            row = car(parseString(row "#\n" t))
            row = parseString(row " ")
            when(row layerInfo = append1(layerInfo row))
        )
        close(file)
        return(layerInfo)
    )
)
  • describe
  1. 通过调用ycLayerExcel()来使用。
  2. 操作方式可以参考Skill 脚本演示 ycLayerExcel.il - YEUNGCHIE - 博客园

Skill 导出所有Layer信息用于tapeout

标签:get   getc   field   item   reac   html   init   call   reverse   

原文地址:https://www.cnblogs.com/yeungchie/p/12774503.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!