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

CCSmigrateDesign.il

[复制链接]

20

主题

0

回帖

100

积分

技术员

积分
100
发表于 2023-11-6 17:06:35 | 显示全部楼层 |阅读模式
  1. /*

  2. Group Custom IC, Cadence Design Systems

  3. Language SKILL

  4. Revision No. 1.0

  5. Date Created 27th Aug 2009

  6. Last Modified 21st Mar 2021

  7. Tested in IC20.1-ISR17

  8. COS solution 11256326

  9. Author hcquek

  10. Lint score 100

  11. Description This program will replace cells in specified libraries

  12. ********************************************************************

  13. * DISCLAIMER: The following code is provided for Cadence customers *

  14. * to use at their own risk. The code may require modification to *

  15. * satisfy the requirements of any user. The code and any *

  16. * modifications to the code may not be compatible with current or *

  17. * future versions of Cadence products. *

  18. * THE CODE IS PROVIDED "AS IS" AND WITH NO WARRANTIES, INCLUDING *

  19. * WITHOUT LIMITATION ANY EXPRESS WARRANTIES OR IMPLIED WARRANTIES *

  20. * OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. *

  21. ********************************************************************

  22. Save this program as "CCSmigrateDesign.il" in your working directory

  23. Then key in the following in the CIW input panel :

  24. load "CCSmigrateDesign.il"

  25. Press F10 in CIW to display input form that uses mapping file for multiple devices.

  26. - The mapping file should contain lines as shown below, # is used to separate the old vs new devices

  27. - oldLib/oldCell/oldView will be replaced with newLib/newCell/newView for 1 or more cells in the list of libraries specified in the form

  28. ; This is a comment

  29. oldLib oldCell oldView # newLib newCell newView newProp1

  30. ; Props are optional

  31. oldLib oldCell oldView oldProp1 oldProp2 ... oldProp99 # newLib newCell newView newProp1 newProp2 ... newProp99

  32. As an example, the following devices need to be migrated:

  33. Old PDK uses nmos1 (W1, L1) and nmos2 (W2, L2)

  34. New PDK uses nmos1a (W11, L11) and nmos2a (W22, L22)

  35. The following mapping can be used:

  36. oldTechLib nmos1 symbol W1 L1 # newTechLib nmos1a symbol W11 L11

  37. oldTechLib nmos2 symbol W2 L2 # newTechLib nmos2a symbol W22 L22

  38. */

  39. procedure( CCSmigrateDesignForm()

  40.    let( (targetLib allTargetLibs targetCells mapFile fileSel viewType addLibButton backupOrg recreateInst)

  41.       targetLib=hiCreateComboField(

  42.          ?name 'targetLib

  43.          ?prompt "Target library"

  44.          ?items sort(setof(x ddGetLibList() !member("tech.db" x~>files~>name) && !pcreMatchp("tools.*(dfII|etc)" x~>readPath))~>name nil)

  45.          ?callback "CCSaddCellsToForMigration(hiGetCurrentForm())"

  46.       ) ;hiCreateComboField

  47.       targetCells=hiCreateListBoxField(

  48.          ?name 'targetCells

  49.          ?prompt "Target cells"

  50.          ?choices list()

  51.          ?numRows 10

  52.          ?multipleSelect t

  53.       ) ;hiCreateListBoxField

  54.       addLibButton=hiCreateFormButton(

  55.          ?name 'addLibButton

  56.          ?buttonText "+"

  57.          ?callback "CCSaddLibForMigration(hiGetCurrentForm())"

  58.       ) ;hiCreateFormButton

  59.       allTargetLibs=hiCreateMLTextField(

  60.          ?name 'allTargetLibs

  61.          ?prompt "Target libs and cells"

  62.          ?hasHorizontalScrollbar nil

  63.          ?hasVerticalScrollbar t

  64.          ?enableWordWrap t

  65.       ) ;hiCreateMLTextField

  66.       mapFile=hiCreateStringField(

  67.          ?name 'mapFile

  68.          ?prompt "Mapping file"

  69.       ) ;hiCreateStringField

  70.       fileSel=hiCreateFormButton(

  71.          ?name 'fileSel

  72.          ?buttonText "..."

  73.          ?callback "ddsFileBrowseCB(hiGetCurrentForm() 'mapFile)"

  74.       ) ;hiCreateFormButton

  75.       viewType=hiCreateRadioField(

  76.          ?name 'viewType

  77.          ?prompt "Choose view type"

  78.          ?choices list("schematic" "maskLayout")

  79.       ) ;hiCreateRadioField

  80.       backupOrg=hiCreateRadioField(

  81.          ?name 'backupOrg

  82.          ?prompt "Backup original"

  83.          ?choices list("Yes" "No")

  84.       ) ;hiCreateRadioField

  85.       recreateInst=hiCreateRadioField(

  86.          ?name 'recreateInst

  87.          ?prompt "Recreate inst"

  88.          ?choices list("Yes" "No")

  89.          ?value "No"

  90.       ) ;hiCreateRadioField

  91.       hiCreateAppForm(

  92.          ?name 'migrateDesignForm

  93.          ?formTitle "Library migration helper"

  94.          ?callback "CCSmigrateDesign(hiGetCurrentForm())"

  95.          ?fields list(

  96.             list(targetLib 0:0 500:50 150)

  97.             list(targetCells 0:50 500:200 150)

  98.             list(addLibButton 500:50 30:30)

  99.             list(allTargetLibs 0:260 500:200 150)

  100.             list(mapFile 0:460 500:50 150)

  101.             list(fileSel 500:470 30:30 150)

  102.             list(viewType 0:500 500:50 150)

  103.             list(backupOrg 0:530 500:50 150)

  104.             list(recreateInst 0:560 500:50 150)

  105.          ) ;list

  106.          ?initialSize list(550 650)

  107.       ) ;hiCreateAppForm

  108.       hiDisplayForm('migrateDesignForm)

  109.    ) ;let

  110. ) ;procedure

  111. procedure( CCSaddCellsToForMigration(migrateDesignForm)

  112.    let( (targetLib)

  113.       targetLib=migrateDesignForm~>targetLib~>value

  114.       ; Will get the following warning if ddGetObj(targetLib) is used and form is cancelled with invalid lib name

  115.       ; Use member cmd as workaround

  116.       ; *WARNING* ddGetObj: invalid libId (0x(nil))

  117.       when( member(targetLib ddGetLibList()~>name)

  118.          migrateDesignForm~>targetCells~>choices=cons("All" ddGetObj(targetLib)~>cells~>name)

  119.          migrateDesignForm~>targetCells~>value=list(car(migrateDesignForm~>targetCells~>choices))

  120.       ) ;when

  121.    ) ;let

  122. ) ;procedure

  123. procedure( CCSaddLibForMigration(migrateDesignForm)

  124.    let( (targetLib targetCells targetLibWithCell allTargetLibs)

  125.       targetLib=migrateDesignForm~>targetLib~>value

  126.       targetCells=migrateDesignForm~>targetCells~>value

  127.       targetLibWithCell=foreach(mapcar x targetCells

  128.          strcat(targetLib "/" x)

  129.       ) ;foreach

  130.       allTargetLibs=parseString(migrateDesignForm~>allTargetLibs~>value " \t\n")

  131.       if( ddGetObj(targetLib) then

  132.          allTargetLibs=buildString(append(allTargetLibs targetLibWithCell) "\n")

  133.          migrateDesignForm~>allTargetLibs~>value=allTargetLibs

  134.       else

  135.          error("TargetLib %s not found\n" targetLib)

  136.       ) ;if

  137.    ) ;let

  138. ) ;procedure

  139. procedure( CCSmigrateDesign(migrateDesignForm)

  140.    let( (startTime endTime totalTime allTargetLibs mapFile inPort oldTable newTable k badLines

  141.     oldCell newCell cv viewType inLine inLineList oldLib oldView newLib newView backupOrg recreateInst

  142. instList totalLibs libCount totalViews viewCount libList targetLibCellList targetLibList targetCellList

  143. paramTable j instCdf paramId instMaster instName instPt instOrient)

  144.       startTime=getCurrentTime()

  145.       allTargetLibs=parseString(migrateDesignForm~>allTargetLibs~>value " \t\n")

  146.       mapFile=migrateDesignForm~>mapFile~>value

  147.       viewType=migrateDesignForm~>viewType~>value

  148.       backupOrg=migrateDesignForm~>backupOrg~>value

  149.       recreateInst=migrateDesignForm~>recreateInst~>value

  150.       unless( isFile(mapFile) error("File %s cannot be found\n" mapFile))

  151.       inPort=infile(mapFile)

  152.       oldTable=makeTable("oldTable" nil)

  153.       newTable=makeTable("newTable" nil)

  154.       k=0

  155.       badLines=list()

  156.       while( gets(inLine inPort)

  157.          inLineList=parseString(inLine "#\n")

  158.          when( !pcreMatchp("^(\\s*|\\t*);" inLine) && length(inLineList)>=2

  159.             oldTable[k]=parseString(car(inLineList) " \t")

  160.             newTable[k]=parseString(cadr(inLineList) " \t")

  161.             unless( length(oldTable[k])==length(newTable[k])

  162.                badLines=cons(inLine badLines)

  163.             ) ;unless

  164.             k++

  165.          ) ;when

  166.       ) ;while

  167.       close(inPort)

  168.       when( length(badLines)>0

  169.          printf("The following lines in mapping file needs to be corrected:\n")

  170.          foreach(line badLines

  171.             printf("%s\n" line)

  172.          ) ;foreach

  173.          printf("=== Format of mapping file ===\n")

  174.          printf("oldLib oldCell oldView # newLib newCell newView\n")

  175.          error("")

  176.       ) ;when

  177.       libList=list()

  178.       foreach( targetLib allTargetLibs

  179.          targetLibList=parseString(targetLib "/")

  180.          unless( member(car(targetLibList) libList)

  181.             libList=append1(libList car(targetLibList))

  182.          ) ;unless

  183.       ) ;foreach

  184.       totalLibs=length(libList)

  185.       libCount=1

  186.       foreach( targetLib libList

  187.          printf("Processing lib %s\n" targetLib)

  188.          targetLibCellList=setof(x allTargetLibs pcreMatchp(strcat("^" targetLib "/") x))

  189.          targetCellList=list()

  190.          foreach( targetLibCell targetLibCellList

  191.             targetCellList=append1(targetCellList cadr(parseString(targetLibCell "/")))

  192.          ) ;foreach

  193.          if( member("All" targetCellList) then

  194.             targetCellList=ddGetObj(targetLib)~>cells

  195.          else

  196.             targetCellList=foreach(mapcar x targetCellList

  197.                ddGetObj(targetLib x)

  198.             ) ;foreach

  199.          ) ;if

  200.          totalViews=0

  201.          viewCount=1

  202.          foreach( cell targetCellList

  203.             totalViews=totalViews+length(setof(x cell~>views when(ddGetObj(targetLib cell~>name x~>name "*")

  204.                         ddMapGetFileViewType(ddGetObj(targetLib cell~>name x~>name "*"))==viewType)))

  205.          ) ;foreach

  206.          paramTable=makeTable("paramTable" nil)

  207.          foreach( cell targetCellList

  208.             foreach( view setof(x cell~>views when(ddGetObj(targetLib cell~>name x~>name "*")

  209.                         ddMapGetFileViewType(ddGetObj(targetLib cell~>name x~>name "*"))==viewType) && !pcreMatchp("^(schematic|layout)_\\d+_\\d+$" x~>name))

  210.                cv=dbOpenCellViewByType(targetLib cell~>name view~>name "" "a")

  211.                printf(" %s : Processing : %s/%s/%s (lib : %d/%d views in lib: %d/%d)\n"

  212.    getCurrentTime() targetLib cell~>name view~>name libCount totalLibs viewCount totalViews)

  213.                viewCount++

  214.                when(backupOrg=="Yes" CCSbackupCellViewBeforeMigration(cell cv viewType))

  215.                if(cv then

  216.                   for(i 0 length(oldTable)-1

  217.                      ; oldTable[i]=list(oldLib oldCell oldView oldParam1 oldParam2 ...)

  218.                      ; newTable[i]=list(newLib newCell newView newParam1 newParam2 ...)

  219.                      oldLib=nth(0 oldTable[i])

  220.                      oldCell=nth(1 oldTable[i])

  221.                      oldView=nth(2 oldTable[i])

  222.                      newLib=nth(0 newTable[i])

  223.                      newCell=nth(1 newTable[i])

  224.                      newView=nth(2 newTable[i])

  225.                      instList=setof(x cv~>instances x~>libName==oldLib && x~>cellName==oldCell && x~>viewName==oldView)

  226.                      foreach( inst instList

  227.                         j=0

  228.                         instCdf=cdfGetInstCDF(inst)

  229.                         foreach(param cdddr(oldTable[i])

  230.              paramTable[j]=cdfFindParamByName(instCdf param)~>value

  231.                            j++

  232.                         ) ;foreach

  233.                         if( recreateInst=="Yes" then

  234.                            instMaster=dbOpenCellViewByType(newLib newCell newView)

  235.                            instName=inst~>name

  236.                            instPt=inst~>xy

  237.                            instOrient=inst~>orient

  238.                            dbDeleteObject(inst)

  239.                            inst=dbCreateInst(cv instMaster instName instPt instOrient)

  240.                         else

  241.                            leReplaceAnyInstMaster(inst newLib newCell newView)

  242.                         ) ;if

  243.                         j=0

  244.                         instCdf=cdfGetInstCDF(inst)

  245.                         foreach(param cdddr(newTable[i])

  246.                            paramId=cdfFindParamByName(instCdf param)

  247.                            if( paramId~>paramType=="string" && !stringp(paramTable[j]) then

  248.                               paramId~>value=sprintf(nil ""%s"" paramTable[j])

  249.                            else

  250.                               paramId~>value=paramTable[j]

  251.                            ) ;if

  252.                            j++

  253.                         ) ;foreach

  254.                         foreach( prop inst~>prop

  255.                            unless( setof(x instCdf->parameters x->name==prop~>name)

  256.                               dbDeleteObject(prop)

  257.                            ) ;unless

  258.                         ) ;foreach

  259.                      ) ;foreach

  260.                   ) ;for

  261.                   when( cv~>modifiedButNotSaved

  262.                      when(viewType=="schematic" schCheck(cv))

  263.                      dbSave(cv)

  264.                   ) ;when

  265.                   dbClose(cv)

  266.                else

  267.                   printf(" Cellview %s/%s/%s not processed\n" targetLib cell~>name view~>name)

  268.                ) ;if

  269.             ) ;foreach

  270.          ) ;foreach

  271.          libCount++

  272.       ) ;foreach

  273.       endTime=getCurrentTime()

  274.       printf("\n")

  275.       printf("Migration start time : %s\n" startTime)

  276.       printf("Migration end time : %s\n" endTime)

  277.       totalTime=(stringToTime(endTime)-stringToTime(startTime))/3600.0

  278.       printf("Total time : %.1f mins\n" totalTime)

  279.    ) ;let

  280. ) ;procedure

  281. procedure( CCSbackupCellViewBeforeMigration(cell cv viewType)

  282.    let( (dateList year month day time backupViewName cvBackup)

  283.       dateList=parseString(getCurrentTime())

  284.       year=nth(3 dateList)

  285.       day=nth(1 dateList)

  286.       case( nth(0 dateList)

  287.          ("Jan" month="01")

  288.          ("Feb" month="02")

  289.          ("Mar" month="03")

  290.          ("Apr" month="04")

  291.          ("May" month="05")

  292.          ("Jun" month="06")

  293.          ("Jul" month="07")

  294.          ("Aug" month="08")

  295.          ("Sep" month="09")

  296.          ("Oct" month="10")

  297.          ("Nov" month="11")

  298.          ("Dec" month="12")

  299.       ) ;case

  300.       time=buildString(parseString(nth(2 dateList) ":") "")

  301.       case( viewType

  302.          ("schematic" backupViewName=sprintf(nil "schematic_%s%s%s_%s" year month day time))

  303.          ("maskLayout" backupViewName=sprintf(nil "layout_%s%s%s_%s" year month day time))

  304.       ) ;case

  305.       ; schematic_20210224_134108

  306.       unless( pcreMatchList("^(schematic|layout)_\\d+_\\d+$" cell~>views~>name)

  307.          dbSave(cv cv~>libName cv~>cellName backupViewName)

  308.          cvBackup=dbOpenCellViewByType(cv~>libName cv~>cellName backupViewName "" "a")

  309.          when(viewType=="schematic" schCheck(cvBackup))

  310.          dbSave(cvBackup)

  311.          dbClose(cvBackup)

  312.          printf(" %s : Backup view %s saved for %s/%s/%s\n" getCurrentTime() backupViewName cv~>libName cv~>cellName cv~>viewName)

  313.       ) ;unless

  314.    ) ;let

  315. ) ;procedure

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

本版积分规则

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

GMT+8, 2024-4-29 00:37 , Processed in 0.042941 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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