|
发表于 2025-1-26 14:34:20
|
显示全部楼层
procedure(changelabel()
cv=geGetWindowCellView()
CL_S=hiCreateStringField(
?name 'CL_NAME
?prompt "Change Label Name"
?defValue ""
)
if(SL_list=geGetSelSet(cv)
then
L_S=nil
hiCreateAppForm(
?name 'CLform
?formTitle "Change Label"
?fields list(CL_S)
)
else
L_S=hiCreateStringField(
?name 'L_NAME
?prompt "Label Name"
?defValue ""
)
hiCreateAppForm(
?name 'CLform
?formTitle "Change Label"
?fields list(L_S CL_S)
)
)
hiDisplayForm('CLform)
CL_list=parseString(CL_S~>value " ")
if(L_S
then
L_list=parseString(L_S~>value " ")
else
L_list=list()
for(n 1 length(SL_list)
if(nthelem(n SL_list)~>objType == "label"
L_list=append1(L_list nthelem(n SL_list))
)
)
)
unless(L_S
unless(length(CL_list) == 1
hiDisplayMenu(
hiCreateSimpleMenu(
'menu
""
'("Attention! The number of Change Label Name can only be 1!")
'("")
);end of hiCreateSimpleMenu
);end of hiDisplayMenu
return()
)
if(nindex(car(CL_list) ":")
then
C_name=substring(car(CL_list) 1 nindex(car(CL_list) "<")-1)
C_num1=atoi(substring(car(CL_list) nindex(car(CL_list) "<")+1 length(car(CL_list))))
C_num2=atoi(substring(car(CL_list) nindex(car(CL_list) ":")+1 length(car(CL_list))))
C_num=abs(C_num2-C_num1)+1
unless(length(L_list) == C_num
hiDisplayMenu(
hiCreateSimpleMenu(
'menu
""
'("Attention! The number of selected label does not match the number with the Change Label Name!")
'("")
);end of hiCreateSimpleMenu
);end of hiDisplayMenu
return()
)
for(n 1 C_num
L_name=nthelem(n L_list)~>theLabel L_xy=nthelem(n L_list)~>xy
nthelem(n L_list)~>theLabel = strcat(C_name substring(L_name nindex(L_name "<") nindex(L_name ">")))
when(Ter_pin=leSearchHierarchy(cv list(L_xy L_xy) 0 "any shape" list(list("net name" "==" L_name)))
Ter_pin~>pin~>term~>name = nthelem(n L_list)~>theLabel
)
)
else
for(n 1 length(L_list)
L_name=nthelem(n L_list)~>theLabel L_xy=nthelem(n L_list)~>xy
nthelem(n L_list)~>theLabel = car(CL_list)
when(Ter_pin=leSearchHierarchy(cv list(L_xy L_xy) 0 "any shape" list(list("net name" "==" L_name)))
Ter_pin~>pin~>term~>name = car(CL_list)
)
)
)
)
when(L_S
NL_list=list() NCL_list=list()
for(n 1 length(L_list)
if(nindex(nthelem(n L_list) ":")
then
L_name=substring(nthelem(n L_list) 1 nindex(nthelem(n L_list) "<")-1)
L_num1=atoi(substring(nthelem(n L_list) nindex(nthelem(n L_list) "<")+1 length(nthelem(n L_list))))
L_num2=atoi(substring(nthelem(n L_list) nindex(nthelem(n L_list) ":")+1 length(nthelem(n L_list))))
L_num=abs(L_num2-L_num1)+1
cond(
(L_num2 > L_num1
for(m 1 L_num
NL_list=append1(NL_list strcat(L_name "<" artMakeString(L_num1+m-1) ">"))
)
)
(L_num1 > L_num2
for(m 1 L_num
NL_list=append1(NL_list strcat(L_name "<" artMakeString(L_num1-m+1) ">"))
)
)
)
else
NL_list=append1(NL_list nthelem(n L_list))
)
)
for(n 1 length(CL_list)
if(nindex(nthelem(n CL_list) ":")
then
CL_name=substring(nthelem(n CL_list) 1 nindex(nthelem(n CL_list) "<")-1)
CL_num1=atoi(substring(nthelem(n CL_list) nindex(nthelem(n CL_list) "<")+1 length(nthelem(n CL_list))))
CL_num2=atoi(substring(nthelem(n CL_list) nindex(nthelem(n CL_list) ":")+1 length(nthelem(n CL_list))))
CL_num=abs(CL_num2-CL_num1)+1
cond(
(CL_num2 > CL_num1
for(m 1 CL_num
NCL_list=append1(NCL_list strcat(CL_name "<" artMakeString(CL_num1+m-1) ">"))
)
)
(CL_num1 > CL_num2
for(m 1 CL_num
NCL_list=append1(NCL_list strcat(CL_name "<" artMakeString(CL_num1-m+1) ">"))
)
)
)
else
NCL_list=append1(NCL_list nthelem(n CL_list))
)
)
unless(length(NL_list) == length(NCL_list)
unless(length(NCL_list) == 1
hiDisplayMenu(
hiCreateSimpleMenu(
'menu
""
'("The number of Label Name does not match the number with the Change Label Name!")
'("")
);end of hiCreateSimpleMenu
);end of hiDisplayMenu
return()
)
)
missNL_list=list()
if(length(NCL_list) == 1
then
for(n 1 length(NL_list)
when(NL=leSearchHierarchy(cv cv~>bBox 0 "label" list(list("text" "==" nthelem(n NL_list))))
for(m 1 length(NL)
when(nthelem(m NL)~>theLabel == nthelem(n NL_list) nthelem(m NL)~>theLabel = nthelem(1 NCL_list))
)
)
when(NL_TP=leSearchHierarchy(cv cv~>bBox 0 "any shape" list(list("net name" "==" nthelem(n NL_list))))
for(m 1 length(NL_TP)
when(nthelem(m NL_TP)~>pin~>term~>name == nthelem(n NL_list) nthelem(m NL_TP)~>pin~>term~>name = nthelem(1 NCL_list))
)
)
unless(NL && NL_TP missNL_list=append1(missNL_list nthelem(n NL_list)))
)
else
for(n 1 length(NL_list)
when(NL=leSearchHierarchy(cv cv~>bBox 0 "label" list(list("text" "==" nthelem(n NL_list))))
for(m 1 length(NL)
when(nthelem(m NL)~>theLabel == nthelem(n NL_list) nthelem(m NL)~>theLabel = nthelem(n NCL_list))
)
)
when(NL_TP=leSearchHierarchy(cv cv~>bBox 0 "any shape" list(list("net name" "==" nthelem(n NL_list))))
for(m 1 length(NL_TP)
when(nthelem(m NL_TP)~>pin~>term~>name == nthelem(n NL_list) nthelem(m NL_TP)~>pin~>term~>name = nthelem(n NCL_list))
)
)
unless(NL && NL_TP missNL_list=append1(missNL_list nthelem(n NL_list)))
)
)
when(missNL_list
unless(isFile("./MISS_PIN")
sh(strcat("touch " "./" "MISS_PIN"))
)
missNL_Outp=outfile("./MISS_PIN")
fprintf(missNL_Outp "%s\n" "The following label could not be found in the Layout:")
for(n 1 length(missNL_list)
fprintf(missNL_Outp "%s\n" nthelem(n missNL_list))
)
close(missNL_Outp)
view("./MISS_PIN")
)
)
)
支持两种模式,第一种已经在 layout 中点选了所需要修改的 label,此时执行 changelabel() 函数,会出现一个对话框,在对话框中输入想要修改成的 label name,此时的 label name 只能是唯一的,比如在 layout 中选中的是 AAA<0:15> 这些 bus label,在对话框中输入 AAA_BBB<0:15>,点 OK 后就会将这些选中的 bus label 改成 AAA_BBB<0:15>,并且如果这些 label 下有 pin ,也会同时修改它们的 terminal name(这个操作是自动的,不需要提前将 pin 选中);比如在 layout 中选中的是好几个不同名字的 label,但是在对话框中输入了一个 label name,就会将所有选中的 label 都修改成这个输入的 label name。
第二种没有在 layout 中选中任何 label,直接执行 changelabel() 函数,此时出现的对话框有两个输入行,第一行 Label Name 是要修改的 label,第二行 Change Label Name 是要修改成的 label name,分别输入好后点 ok ,就会执行完成,同样会同时修改 labe 和 pin,若有在 layout 中找不到的 label 会在执行结束后弹出一个文件将未找到的 label 列出,这种模式支持同时修改多种 label ,只需要第一行和第二行输入的每一种 label 数目相同即可。
|
|