找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 345|回复: 0

分享一个原理图迁移工艺的skill脚本

[复制链接]

20

主题

0

回帖

100

积分

技术员

积分
100
发表于 2023-11-6 16:56:52 | 显示全部楼层 |阅读模式
本帖最后由 彭加木 于 2023-11-6 17:00 编辑

如果你是一名模拟IC设计者,如果你曾经或者将要换工艺,那么你一定寻找过原理图迁移工艺的方法,下面介绍的就是可以实现这个功能的脚本。

脚本内容
首先感谢网友的无私奉献,该脚本来源于Cadence在线技术支持网站:support.cadence.com,需要注册用户才有权限进入,具体脚本(文件名:CCSdelInstCreate.il)如下。
  1. /*************************************************************************
  2.    * DISCLAIMER: The following code is provided for Cadence customers       *
  3.    * to use at their own risk. The code may require modification to         *
  4.    * satisfy the requirements of any user. The code and any modifications   *
  5.    * to the code may not be compatible with current or future versions of   *
  6.    * Cadence products. THE CODE IS PROVIDED "AS IS" AND WITH NO WARRANTIES, *
  7.    * INCLUDING WITHOUT LIMITATION ANY EXPRESS WARRANTIES OR IMPLIED         *
  8.    * WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.         *
  9.    *************************************************************************/
  10.    
  11.    /*
  12.    USAGE:
  13.    ======
  14.    
  15.    This SKILL code runs on all the schematic views of a library and finds if
  16.    instances of a particular device or cell has been used or not. If they are
  17.    found then they need to be replaced with a new cell of a new library.
  18.    List of cell and its mapping to new cell has to be provided via deviceMapList.
  19.    For example:
  20.    deviceMapList='(("nmos1v" ("newRefLib" "nmos2v")) ("pmos1v" ("newRefLib" "pmos2v")))
  21.    
  22.    In above example, nmos1v is supposed to be swapped with newRefLib nmos2v cell.
  23.    pmos1v is supposed to be swapped with newRefLib pmos2v cell.
  24.    
  25.    The code copies old instance transform (placement info) and important properties
  26.    which needs to be paased on to new cell. And then it copies the old property
  27.    values to new properties. The old and new property mapping is supposed to be
  28.    provided via propMapList.
  29.    For example:
  30.    propMapList='(("L" "l") ("W" "w") ("M" "m"))
  31.    
  32.    In the above list, value of property "L" is supposed to be copied to "l".
  33.    value of property "W" is supposed to be copied to "w".
  34.    value of property "M" is supposed to be copied to "m".
  35.    
  36.    Load the SKILL code in CIW:
  37.    load "CCSdelInstCreate.il"
  38.    
  39.    Run in CIW:
  40.    CCSdelInstCreate("MYLIB")
  41.    
  42.    */
  43.    
  44.    procedure( CCSdelInstCreate(library @optional
  45.    ;; Modify device list as per your primitive devices
  46.    ( deviceMapList '(("nmos" ("OALIB" "nmos4"))  ("pmos" ("OALIB" "pmos4"))))
  47.    ;; Modify propMapList as per the properties you want to copy
  48.        (propMapList '(("l" "L") ("w" "W") ("m" "m")) )
  49.         "tll")   
  50.    let((cv cellname name transform libId instId deviceList deviceTable propTable)
  51.    
  52.    libId=ddGetObj(library)
  53.    unless(libId error("Specified library: %s does not exists, cannot proceed!\n" library))
  54.    
  55.    deviceTable=makeTable("deviceTable")
  56.    foreach(dev deviceMapList
  57.        deviceTable[car(dev)]=cadr(dev)
  58.        deviceList=cons(car(dev) deviceList)
  59.        )
  60.    
  61.    propTable=makeTable("propTable")
  62.    foreach(cellId libId~>cells
  63.    ;; Check if the cell has schematic view
  64.        if(exists(x cellId~>views~>name (x=="schematic"))
  65.            then
  66.    printf("Operating on Lib: %s Cell:%s View: schematic\n" library cellId~>name )
  67.            cv=dbOpenCellViewByType(library cellId~>name "schematic"  "schematic"  "a")
  68.    ;; Check if cellview has the instances of given device
  69.                    foreach(inst cv~>instances
  70.                        if(member(inst~>cellName deviceList) then
  71.                        transform=inst~>transform
  72.                        name=inst~>name
  73.                        cellname=inst~>cellName
  74.    
  75.    ;; Populate old property values to table
  76.    /*
  77.                        foreach(propList propMapList
  78.                        propTable[car(propList)]=dbFindProp(inst car(propList))~>value
  79.                            ) ;foreach
  80.    */
  81.                        cdfId=cdfGetInstCDF(inst)
  82.                        foreach(propList propMapList
  83.                        propTable[car(propList)]=cdfFindParamByName(cdfId car(propList))~>value
  84.                            ) ;foreach
  85.    
  86.    ;; Delete old instance
  87.                        dbDeleteObject(inst)
  88.    
  89.    ;; Create new instance
  90.            instId=dbCreateInstByMasterName(cv car(deviceTable[cellname])
  91.                cadr(deviceTable[cellname])
  92.                    "symbol" name
  93.                    car(transform)
  94.                    cadr(transform) )
  95.    
  96.    ;; Polpulate the inst parameter values from prop table
  97.            foreach(propList propMapList
  98.                dbSet(instId propTable[car(propList)] cadr(propList))
  99.                )
  100.                                ) ;if member
  101.                                ) ;foreach inst
  102.    
  103.    /* To check and save the cellview uncomment below line */
  104.             ; if(dbIsCellViewModified(cv) then schCheck(cv) dbSave(cv))
  105.            ) ;if
  106.        ) ;foreach
  107.    t
  108.      );let
  109.    );proc
复制代码

以上脚本实现的思路大概分成以下几步:
第一步:用户通过传递参数确定不同工艺之间器件名称、参数之间的对应关系。
第二步:打开原始电路,并将原始电路中的参数值和坐标信息保存在变量中。
第三步:删除原始电路中需要替换的cell,并从参考库中调进新的cell,将上一步保存的参数值填入相应位置,并按照原始电路中cell的坐标放置新的cell,保存电路。
第四步:遍历目标Library中所有原理图,重复上面三个步骤,完成所有替换。
使用上面的脚本可以完成器件替换,但是很可能替换完成之后仿真中依然存在错误,原因是在替换过程中器件的参数虽然填入,但是未触发相应的CDF callbacks函数,所以还需要用下文提供的函数重新触发CDF callbacks.


推荐大家在完成替换流程之后重新触发该Library下所有的CDF callbacks,需要加载两个脚本。

第一个脚本实现触发CDF callbacks函数,脚本内容比较复杂,具体内容没有认真看过,内容如下(文件名:CCSinvokeCdfCallbacks.il):
  1. /* CCSinvokeCdfCallbacks.il
  2.    
  3.    Date       Jul 11, 1 9  
  4.    Modified   Dec  3, 2 13
  5.    
  6.    Invoke all the CDF callbacks for instances
  7.    
  8.    The main entry point is (CCSinvokeCdfCallbacks cellView)
  9.   9which invokes all the CDF callbacks for every instance in
  10.    a cellView. This has some keyword arguments which allow debug
  11.    messages to be displayed, to invoke the formInitProc if needed,
  12.    and to invoke using the instance CDF directly, rather than try
  13.    to create something that looks more like the effective CDF that
  14.    is found when the callbacks are normally invoked from the forms.
  15.    
  16.    You can use the variable CCScallbackPatternsToIgnore so
  17.    that some callbacks can be omitted.
  18.    
  19.   9Extended in version 1.1  to allow ?filterFunc to be passed.
  20.    This is a function that gets the cdf, the param name (nil
  21.    for the initProc) and callback string.
  22.    The function should return t if the callback should be called,
  23.    and nil otherwise. For example:
  24.    
  25.    procedure(MYfilterFunc(cdf paramName callback)
  26.        destructuringBind(
  27.        (lib @optional cell) CCSgetLibCellFromCDF(cdf)
  28.        ; t if any other parameter than w for gpdk090/nmos1v
  29.        !(lib=="gpdk090" && cell=="nmos1v" && param=="w")
  30.        )
  31.    )
  32.    
  33.    CCSinvokeCdfCallbacks(geGetEditCellView() ?filterFunc 'MYfilterFunc)
  34.    
  35.    ***************************************************
  36.    
  37.    SCCS Info: @(#) CCSinvokeCdfCallbacks.il 12/23/13.12:50:52 1.16
  38.    
  39.    */
  40.    
  41.    /*******************************************************************************
  42.    *  DISCLAIMER: The following code is provided for Cadence customers to use at  *
  43.    *   their own risk. The code may require modification to satisfy the           *
  44.    *   requirements of any user. The code and any modifications to the code may   *
  45.    *   not be compatible with current or future versions of Cadence products.     *
  46.    *   THE CODE IS PROVIDED "AS IS" AND WITH NO WARRANTIES, INCLUDING WITHOUT     *
  47.    *   LIMITATION ANY EXPRESS WARRANTIES OR IMPLIED WARRANTIES OF MERCHANTABILITY *
  48.    *   OR FITNESS FOR A PARTICULAR USE.                                           *
  49.    *******************************************************************************/
  50.    /***************************************************************
  51.    *                                                              *
  52.    *    The variable CCScallbackPatternsToIgnore is set to be     *
  53.    *      a list of patterns against which the callbacks are      *
  54.    *      checked. If any of these patterns are matched then      *
  55.    *                 the callback is not invoked.                 *
  56.    *                                                              *
  57.    ***************************************************************/
  58.    
  59.    (unless (boundp 'CCScallbackPatternsToIgnore)
  60.      (setq CCScallbackPatternsToIgnore
  61.        '("^MYPDKNot_Allowed.*")))
  62.    
  63.    /***************************************************************
  64.    *                                                              *
  65.    *  (CCSshouldCallbackBeExecuted callback filterFunc cdf param) *
  66.    *                                                              *
  67.    *  This checks the callback against all the patterns defined   *
  68.    *    in the list CCScallbackPatternsToIgnore to determine      *
  69.    *       whether the callback should be executed or not.        *
  70.    *    If filterFunc is passed, call with cdf, param name and    *
  71.    *            callback - this should return t or nil            *
  72.    *                                                              *
  73.    ***************************************************************/
  74.    
  75.    (procedure (CCSshouldCallbackBeExecuted callback filterFunc cdf param)
  76.      (and
  77.        (forall pattern CCScallbackPatternsToIgnore
  78.            (null (rexMatchp pattern callback)))
  79.        (if filterFunc
  80.          (funcall filterFunc cdf param callback)
  81.          t
  82.          )
  83.        )
  84.      )
  85.    
  86.    /***************************************************************
  87.    *                                                              *
  88.    *                 (CCSgetLibCellFromCDF cdf)                   *
  89.    *                                                              *
  90.    *   Utility function to retrieve a list of lib and cell name   *
  91.    *  from the CDF, regardless of whether it is an inst, cell or  *
  92.    * lib CDF. For lib CDF it only returns a list of the lib name  *
  93.    *                                                              *
  94.    ***************************************************************/
  95.    
  96.    (procedure (CCSgetLibCellFromCDF cdf)
  97.      (let (id)
  98.        (setq id (getq cdf id))
  99.        (case (type id)
  100.          (dbobject
  101.        (list (getq id libName) (getq id cellName))
  102.        )
  103.          (ddCellType
  104.        (list (getq (getq id lib) name) (getq id name))
  105.        )
  106.          (ddLibType
  107.        (list (getq id name))
  108.        )
  109.          )
  110.        )
  111.      )
  112.    
  113.    /*********************************************************************
  114.    *                                                                    *
  115.    *       (CCScreateEffectiveCDFLookalike cdf [lookalikeParams]        *
  116.    *                       [resetLookalikeParams])                      *
  117.    *                                                                    *
  118.    *     Create a structure which looks (sort of) like an effective     *
  119.    *  CDF. The reason for creating this is to allow the "id" parameter  *
  120.    *  to be correctly set to the cell, rather than the instance, which  *
  121.    * is what happens if we use the cdfGetInstCDF() function to simulate *
  122.    * cdfgData. The lookalikeParams optional parameter allows creation   *
  123.    * of the parameters to be "lookalike" as well, so that callbacks can *
  124.    * be called even if there is no actual instance. By default, the     *
  125.    * parameters will be reset with using lookalikeParams, unless you    *
  126.    *                   pass nil as the third argument.                  *
  127.    *                                                                    *
  128.    *********************************************************************/
  129.    
  130.    (procedure (CCScreateEffectiveCDFLookalike cdf @optional lookalikeParams
  131.                          (resetLookalikeParams t))
  132.      (let (new cdfFields newParam)
  133.           (unless (getd 'make_CCSeffCDF)
  134.               ;---------------------------------------------------------
  135.               ; Because some slots appear twice in cdf->? have
  136.               ; to make the list unique
  137.               ;---------------------------------------------------------
  138.               (setq cdfFields (makeTable 'cdfFields))
  139.               (foreach field (getq cdf ?)
  140.                (setarray cdfFields  field t)
  141.                )
  142.               (eval `(defstruct CCSeffCDF ,@(getq cdfFields ?))))
  143.           (setq new (make_CCSeffCDF))
  144.           (when (and lookalikeParams (null (getd 'make_CCSeffCDFparam)))
  145.         (setq cdfFields (makeTable 'cdfFields))
  146.         (foreach field (getq (car (getq cdf parameters)) ?)
  147.              (setarray cdfFields field t))
  148.         (eval `(defstruct CCSeffCDFparam ,@(getq cdfFields ?))))
  149.           ;-----------------------------------------------------------------
  150.           ; populate the effective cdf with the top level cdf attributes
  151.           ;-----------------------------------------------------------------
  152.           (foreach param (getq cdf ?)
  153.            (putprop new (get cdf param) param))
  154.           ;-----------------------------------------------------------------
  155.           ; Set the id and type attributes appropriately
  156.           ;-----------------------------------------------------------------
  157.           (when (equal (getq new type) "instData")
  158.         (putpropq new (dbGetq (dbGetq (getq cdf id) master) cell) id)
  159.         (putpropq new "cellData" type)
  160.         )
  161.           ;-----------------------------------------------------------------
  162.           ; If we want the parameters to be lookalike too, create those
  163.           ;-----------------------------------------------------------------
  164.           (when lookalikeParams
  165.         (putpropq new
  166.               (foreach mapcar param (getq cdf parameters)
  167.                    (setq newParam (make_CCSeffCDFparam))
  168.                    (foreach slot (getq param ?)
  169.                         (putprop newParam (get param slot) slot))
  170.                    (when resetLookalikeParams
  171.                      ; reset the value to defValue for safety
  172.                      (putpropq newParam (getq newParam defValue) value)
  173.                      )
  174.                    newParam
  175.                    )
  176.               parameters)
  177.         ) ; when
  178.           ;-----------------------------------------------------------------
  179.           ; Add the parameters as properties in the effective cdf
  180.           ;-----------------------------------------------------------------
  181.           (foreach param (getq new parameters)
  182.            (putprop new param (getq param name))
  183.            )
  184.           new
  185.           )
  186.      )
  187.    
  188.    /*******************************************************************
  189.    *                                                                  *
  190.    *       (CCSaddFormFieldsToEffectiveCDFLookalike cdf inst)         *
  191.    *                                                                  *
  192.    * Populate four extra fields - libraryName, cellName, viewName and *
  193.    *  instanceName to emulate the forms on the forms - i.e. so that   *
  194.    *  cdfgForm gets these slots. This is for callbacks which (badly)  *
  195.    *   use cdfgForm to find out libraryName, cellName and viewName.   *
  196.    *                                                                  *
  197.    *******************************************************************/
  198.    
  199.    (procedure (CCSaddFormFieldsToEffectiveCDFLookalike cdf inst)
  200.      (let (fieldData value)
  201.        (unless (getd 'make_CCSeffCDFFormFields)
  202.          (defstruct CCSeffCDFFormFields value defValue lastValue
  203.        editable enabled invisible)
  204.          )
  205.        (foreach (field attr) '(libraryName cellName viewName instanceName)
  206.             '(libName cellName viewName name)
  207.             (setq value (dbGet inst attr))
  208.             (setq fieldData
  209.               (make_CCSeffCDFFormFields
  210.                 ?value value
  211.                 ?defValue value
  212.                 ?lastValue value
  213.                 ?editable t
  214.                 ?enabled t
  215.                 ?invisible nil
  216.                 ))
  217.             (putprop cdf fieldData field)
  218.             )
  219.        cdf
  220.        )
  221.      )
  222.    
  223.    /********************************************************************
  224.    *                                                                   *
  225.    *       (CCSinvokeObjCdfCallbacks cdf @key (debug nil) order        *
  226.    *        (callInitProc nil) (setCdfgForm t) (filterFunc nil))       *
  227.    *                                                                   *
  228.    *       Underlying function which does all the real work. This      *
  229.    * is separated from the original function CCSinvokeInstCdfCallbacks *
  230.    *     so that this can be called with a completely virtual CDF.     *
  231.    *      See CCSinvokeInstCdfCallbacks for a description of the       *
  232.    *   arguments - note that there is the ability to control whether   *
  233.    *                      cdfgForm is set or not.                      *
  234.    *  Return nil if any callback failed with a SKILL error, t otherwise*
  235.    *                                                                   *
  236.    ********************************************************************/
  237.    
  238.    (procedure (CCSinvokeObjCdfCallbacks cdf @key (debug nil) order
  239.                         (callInitProc nil) (setCdfgForm t)
  240.                         filterFunc)
  241.      ;----------------------------------------------------------------------
  242.      ; Make cdfgData and cdfgForm dynamically scoped, to avoid
  243.      ; interfering with any global usage of these variables
  244.      ;----------------------------------------------------------------------
  245.      (let (callback parameters cdfgData cdfgForm (success t))
  246.           ;-----------------------------------------------------------------
  247.           ; Set the cdfgData to be the instance CDF
  248.           ;-----------------------------------------------------------------
  249.           (setq cdfgData cdf)
  250.           (setq cdfgForm nil)
  251.           (when setCdfgForm
  252.         ;---------------------------------------------------------------
  253.         ; some callbacks use cdfgForm instead
  254.         ;---------------------------------------------------------------
  255.         (setq cdfgForm cdfgData)
  256.         )
  257.           ;-----------------------------------------------------------------
  258.           ; Call the formInitProc if there is one.
  259.           ;-----------------------------------------------------------------
  260.           (when callInitProc
  261.             (setq callback (getq cdfgData formInitProc))
  262.             (when (and callback
  263.                (nequal callback "")
  264.                (CCSshouldCallbackBeExecuted callback filterFunc
  265.                                cdfgData nil))
  266.               (when debug
  267.                 (printf "  Invoking formInitProc: '%s'\n" callback))
  268.               ;-----------------------------------------------------
  269.               ; Evaluate the callback
  270.               ;-----------------------------------------------------
  271.               (unless
  272.                (errset (evalstring
  273.                     (strcat callback "(cdfgData)")) t)
  274.                (setq success nil)
  275.                )
  276.               )
  277.             )
  278.           ;-----------------------------------------------------------------
  279.           ; Control order of parameter evaluation. If order specified,
  280.           ; just do those, otherwise do all in arbitrary order
  281.           ;-----------------------------------------------------------------
  282.           (if order
  283.           (setq parameters (foreach mapcar param order
  284.                         (get cdfgData param)))
  285.           (setq parameters (getq cdfgData parameters))
  286.           )
  287.           ;-----------------------------------------------------------------
  288.           ; loop through all parameters
  289.           ;-----------------------------------------------------------------
  290.           (foreach param parameters
  291.            (setq callback (getq param callback))
  292.            (when (and callback
  293.                   (nequal callback "")
  294.                   (CCSshouldCallbackBeExecuted callback filterFunc
  295.                                   cdfgData
  296.                                   (getq param name)))
  297.                  (when debug
  298.                    (printf "  Invoking callback for '%s': '%s'\n"
  299.                        (getq param name) callback))
  300.                  ;--------------------------------------------------
  301.                  ; evaluate the callback
  302.                  ;--------------------------------------------------
  303.                  (unless (errset (evalstring callback) t)
  304.                   (setq success nil)
  305.                   )
  306.                  ))
  307.      success))
  308.    
  309.    /*****************************************************************
  310.    *                                                                *
  311.    *      (CCSinvokeInstCdfCallbacks instance [?debug debug]        *
  312.    *  [?order order] [?callInitProc callInitProc] [?useInstCDF nil] *
  313.    *            [?addFormFields nil] [?filterFunc  nil]             *
  314.    *                                                                *
  315.    * Invoke all the parameter callbacks in the CDF for an instance. *
  316.    *       This won't do anything if it doesn't have any CDF.       *
  317.    * debug is a flag to turn on debug messages. order allows just   *
  318.    * selected parameters to be called, in the specified order.      *
  319.    * callInitProc allows the formInitProc to be called. useInstCDF  *
  320.    * tells the formInitProc to be called with the instCDF rather    *
  321.    * than the effective lookalike CDF. addFormFields tells it to    *
  322.    * add the libraryName/cellName/viewName slots to emulate the     *
  323.    * fields on the cdfgForm, which are used by some bad callback    *
  324.    * code - note this is only done if useInstCDF is nil             *
  325.    *                                                                *
  326.    *****************************************************************/
  327.    
  328.    (procedure (CCSinvokeInstCdfCallbacks instance @key (debug nil) order
  329.                         (callInitProc nil) (useInstCDF nil)
  330.                         (addFormFields nil) (filterFunc nil))
  331.      ;----------------------------------------------------------------------
  332.      ; Make cdfgData and cdfgForm dynamically scoped, to avoid
  333.      ; interfering with any global usage of these variables
  334.      ;----------------------------------------------------------------------
  335.      (let (cdf)
  336.           (when debug
  337.             (printf " Invoking callbacks for instance '%s'\n"
  338.                 (dbGetq instance name)))
  339.           ;-----------------------------------------------------------------
  340.           ; Set the cdf to be the instance CDF
  341.           ;-----------------------------------------------------------------
  342.           (setq cdf (cdfGetInstCDF instance))
  343.           (unless useInstCDF
  344.               (setq cdf (CCScreateEffectiveCDFLookalike cdf))
  345.               (when addFormFields
  346.             (CCSaddFormFieldsToEffectiveCDFLookalike cdf instance)
  347.             )
  348.               )
  349.           ;-----------------------------------------------------------------
  350.           ; Return value will be nil if any callbacks had errors
  351.           ;-----------------------------------------------------------------
  352.           (CCSinvokeObjCdfCallbacks
  353.         cdf
  354.         ?debug debug ?order order ?callInitProc callInitProc
  355.         ?setCdfgForm (null useInstCDF) ?filterFunc filterFunc
  356.         )
  357.      ))
  358.    
  359.    /***************************************************************
  360.    *                                                              *
  361.    *              (CCSconvertCdfToPcellParams cdf)                *
  362.    *                                                              *
  363.    * Take modified parameters in the CDF, and return this as the  *
  364.    *      list of parameter names, types, and values that is      *
  365.    *       needed to create a pcell with dbCreateParamInst.       *
  366.    *                                                              *
  367.    ***************************************************************/
  368.    
  369.    (procedure (CCSconvertCdfToPcellParams cdf)
  370.      (foreach mapcar param
  371.           (setof par (getq cdf parameters)
  372.              (nequal (getq par value) (getq par defValue)))
  373.           (list
  374.             (getq param name)
  375.             ; need to map this to pcell parameter types...
  376.             (case (getq param paramType)
  377.               (("int" "boolean" "float" "string") (getq param paramType))
  378.               (t "string")
  379.               )
  380.             (getq param value)
  381.             )
  382.           )
  383.      )
  384.    
  385.    /***************************************************************
  386.    *                                                              *
  387.    *       (CCSinvokeCdfCallbacks cellView @key (debug nil)       *
  388.    *   (callInitProc nil) (useInstCDF nil) (addFormFields nil))   *
  389.    *                         (filterFunc nil)                     *
  390.    *                                                              *
  391.    *  Invoke the CDF callbacks for all instances in the cellView. *
  392.    *  Returns nil if any callback had a SKILL error, otherwise t  *
  393.    *                                                              *
  394.    ***************************************************************/
  395.    
  396.    (procedure (CCSinvokeCdfCallbacks cellView @key (debug nil)
  397.                     (order nil)
  398.                     (callInitProc nil) (useInstCDF nil)
  399.                     (addFormFields nil) (filterFunc nil))
  400.      (let ((success t))
  401.           (when debug
  402.             (printf "Invoking callbacks for all instances in cell '%s'\n"
  403.                 (dbGetq cellView cellName)))
  404.           (foreach instance (dbGetq cellView instances)
  405.            (unless
  406.             (CCSinvokeInstCdfCallbacks instance
  407.                           ?debug debug
  408.                           ?order order
  409.                           ?callInitProc callInitProc
  410.                           ?useInstCDF useInstCDF
  411.                           ?addFormFields addFormFields
  412.                           ?filterFunc filterFunc
  413.                           )
  414.             (setq success nil)
  415.             )
  416.            ) ; foreach
  417.           success
  418.           )
  419.      ) ; procedure
复制代码

第二个脚本遍历指定Library下所有原理图,并依次触发该原理图中cell的CDF callbacks函数,内容如下(文件名:CCSCdfCallbackEntireLib.il)。
  1. /*
  2.   This SKILL code is not sufficient on its own. You need to also
  3.   download CCSinvokeCdfCallbacks.il file before running this code.
  4.   
  5.   load "CCSinvokeCdfCallbacks.il"
  6.   load "CCSCdfCallbackEntireLib.il"
  7.   
  8.   CCSCdfCallbackEntireLib("MYLIB")
  9.   
  10.   Where "MYLIB" is the design library.
  11.   
  12.   */
  13.   
  14.   
  15.   
  16.   /***************************************************************
  17.   *                                                              *
  18.   *        (CCSCdfCallbackEntireLib libName                *
  19.   *                                                              *
  20.   *  Invoke the CDF callbacks for all schematics of given library *
  21.   *                                                              *
  22.   ***************************************************************/
  23.   
  24.   procedure(CCSCdfCallbackEntireLib(library)
  25.   let((libName)
  26.   unless(libName=ddGetObj(library) error("Library %s does not exists\n" library))
  27.   foreach(cell libName~>cells
  28.       if(exists(x cell~>views~>name (x=="schematic"))
  29.            then
  30.       printf("Processing cell %s\n" cell~>name)
  31.   ;Open schematic
  32.       cv = dbOpenCellViewByType(library cell~>name "schematic" "schematic" "a")
  33.   
  34.   /* Run CDF Callback.
  35.   
  36.   Modify the below line if you want to run it with callInitProc and userInstCDF:
  37.   CCSinvokeCdfCallbacks(cv ?callInitProc t ?useInstCDF t)
  38.   
  39.   Modify the below line if want to run callback of certain parameters only and in a particular order:
  40.   CCSinvokeCdfCallbacks(cv ?order list("l" "w"))
  41.   
  42.   */
  43.   
  44.       CCSinvokeCdfCallbacks(cv)
  45.   ;Run schematic heck and Save
  46.       schCheck(cv)
  47.       dbSave(cv)
  48.           ) ;if
  49.       );foreach
  50.   ) ;let
  51.   ) ; procedure
复制代码

以上是原理图迁移工艺脚本需要使用的代码,至于代码中更具体的内容,欢迎感兴趣的同学在评论中积极讨论,当然对于大部分同学来说只需要了解如何使用脚本即可。
脚本使用介绍
下面介绍一下脚本的使用方法,在使用脚本前需要仔细阅读脚本最前面的注释内容,对每个脚本的使用方法都有详细介绍。

使用CCSdelInstCreate.il函数时,首先需要修改脚本第46行中deviceMapList和第48行中propMapList对应的内容,其中:
deviceMapList:指定器件的对应关系,格式为:("old_cell name" ("lib_name" "new_cell name")).

propMapList:指定器件参数的对应关系,比如,不同工艺中有可能对MOS的栅长、栅宽等参数叫法不一致,所以需要用户提供正确的对应关系,否则可能出现替换之后属性错误的情况。

注意:propMapList中的属性是指器件CDF中对应的Name一项,并非指器件Q出的属性名称,有几种方法可以查看propMapList中需要使用的属性名称。

最简单的方法是查看CDF中属性名称,在CIW界面:Tools->CDF->Edit,然后按照下图中标注选择Library Name、Cell Name等,即可在Component Parameter一项查看到器件参数名称。


还有一种方法可以查看对应参数在CDF中的名称,在Q出器件属性之后,每个参数后面有个是否显示器件属性名称和对应值的选择框,选择both一项可以同时查看器件属性名称和其对应值。

按照上述方法查看CDF中器件属性名称,并按照对应关系修改脚本中propMapList的值。

修改完脚本即可在CIW界面内load脚本,脚本load成功之后,使用函数
CCSdelInstCreate("library_name"),即可完成器件替换。

需要注意的是,由于每个工艺中器件种类较多,而不同种类器件属性不一样,所以为了避免出错,大家务必每次使用脚本只替换具有相同属性的器件。

对于一个原理图中包含不同属性的不同器件时,使用脚本替换数量较多的器件,或者选择重复多次上述替换步骤,分别替换不同类型器件的方法,进行整个设计的原理图替换。

实例:smic18mmrf工艺向tsmc18rf迁移的操作,CCSdelInstCreate.il脚本第46~48行内容修改如下:
  1. ( deviceMapList '(("n33" ("tsmc18rf" "nmos3v"))  ("p33" ("tsmc18rf" "pmos3v"))))
  2. ;; Modify propMapList as per the properties you want to copy
  3.     (propMapList '(("m" "m") ("l" "l") ("fw" "w") ("fingers" "fingers")) )
复制代码


在CIW窗口load脚本,并运行函数:


查看原理图,可以看到器件及相应属性已经按照预期替换成新工艺下的属性,但是部分器件的CDF callbacks没有触发,这时候电路抽出的网表极有可能是不正确的。


脚本使用第二步,替换完器件之后,使用以下脚本重新触发器件的CDF callbacks函数。

在CIW界面,依次load脚本CCSinvokeCdfCallbacks.il和CCSCdfCallbackEntireLib.il,然后按照格式:CCSCdfCallbackEntireLib("lib_name")调用函数。


重新触发CDF callbacks函数之后,使用脚本替换的器件与手工调用器件参数完全一致,仿真中生成的网表内容也一致,到此完成整个替换过程。

已知问题
脚本极有可能只完成用户80%的原理图迁移工作,为大家带来一部分效率提升,剩下的已知或者未知问题只能手动修改。

如果在脚本使用中发现:脚本运行报error,并且无法实现替换功能,请尽量保证每次脚本只替换一种器件类型,并且器件名称和参数对应正确。

在触发CDF callbacks函数时偶尔会出现CIW报错但是并不影响功能,无需在意,关于CDF callbacks函数的触发脚本还有多种其它用法,请参考脚本前的注释内容。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
EDA1024论坛免责声明
请勿上传侵权资料及软件! 如果发现资料侵权请及时联系,联系邮件: fenxin@fenchip.com QQ: 2322712906. 我们将在最短时间内删除。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|EDA1024技术论坛

GMT+8, 2024-4-27 23:47 , Processed in 0.046580 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表