Post

根据文件中指定的映射关系批量重命名多个库,并更新(包括新库名称在内的)库列表下cell view的引用关系

根据文件中指定的映射关系批量重命名多个库,并更新(包括新库名称在内的)库列表下cell view的引用关系

脚本说明

我希望能够一次性重命名多个库。这些库的旧名称与新名称保存在一个文件中,格式如下:

1
2
3
oldlib1 newlib1
oldlib2 newlib2
oldlib3 newlib3

同时,我还希望更新其他引用了这些库中 cell 的库,使它们指向新的库名。我会将需要更新引用的库名称写在另一个文件中,一行列出所有库名,例如:

1
SAMPLE MAJOR MINOR FINAL FORWARD

那么,如何实现这些库的重命名和引用更新呢?


用法说明

你可以使用下面提供的 SKILL 脚本来完成这项任务。请将以下 SKILL 代码复制保存为文件 CCSren_libs.il,该代码也作为解决方案的附件提供。

在 CIW 中加载脚本:

1
load "CCSren_libs.il"

创建库重命名映射文件,假设文件名为 oldLibToNewLibMapFile,格式如下:

1
oldlib1    newlib1   oldlib2    newlib2   oldlib3    newlib3

创建另一个文件,用来指定哪些库需要更新引用。假设文件名为 LibsToUpdate,内容格式如下:

1
SAMPLE MAJOR MINOR FINAL FORWARD

然后,在 CIW 中调用以下命令:

1
CCSren_libs("oldLibToNewLibMapFile" "LibsToUpdate")

这将会完成库的重命名,并在目标库中更新引用关系。


脚本代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
;-----------------------x Copy from here x-------------------
/*************************************************************************
* DISCLAIMER: The following code is provided for Cadence customers       *
* to use at their own risk. The code may require modification to         *
* satisfy the requirements of any user. The code and any modifications   *
* to the code may not be compatible with current or future versions of   *
* Cadence products. THE CODE IS PROVIDED "AS IS" AND WITH NO WARRANTIES, *
* INCLUDING WITHOUT LIMITATION ANY EXPRESS WARRANTIES OR IMPLIED         *
* WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.         *
*************************************************************************/

procedure(CCSren_libs(oldToNewLibFile libsToUpdateFile)
  let((src dst newName libList1 libSpecList ip str spec ip1 libList)
	
    ;; Read the name of libraries to be updated after rename
    ip1=infile(libsToUpdateFile)
    gets(str ip1)
    libList=parseString(str " \n")
	
    ;; Read the set of old and new lib name and form a list of list with oldlib newlib pair
    ip=infile(oldToNewLibFile)
    libList1=list()

    while(gets(str ip)
	str=parseString(str " \n")
	libList1=cons(str libList1)
    ) ;while

        ;; Operate on each pair of oldlib-newlib one by one
	foreach(lib libList1
		newName=cadr(lib)
		src=gdmCreateSpec(car(lib) nil nil nil "CDBA")
		dst=gdmCreateSpec(newName nil nil nil "CDBA")
		
		;; replace the old lib name to new lib name in master library list
		libList=subst(newName car(lib) libList)

		;; Cover the scenario of oldlib not in list, add newlib anyways
		unless(member(newName libList) libList=cons(newName libList))
		
		;; Create specList for libs to be updated
		libSpecList=gdmCreateSpecList()
		
		foreach(lib1 libList
			spec=gdmCreateSpec(lib1 "" "" "" "CDBA")
			gdmAddSpecToSpecList(spec libSpecList)
		) ;foreach
		ccpRename(src dst t 'CCP_EXPAND_COMANAGED 'CCP_UPDATE_FROM_LIBLIST libSpecList)
	) ; foreach oldToNewLibFile libList1
 t
  ) ; let
) ; procedure
This post is licensed under CC BY 4.0 by the author.

支持创作者

如果本文帮助到你,可以通过以下收款码支持我:

收款码

感谢你的支持!