当前位置: 首页 > news >正文

Skill语言学习_6

使用Skill语言,完成差分对的匹配和Dummy管的添加

image-20260304155052028

Skill版本:

getSkillVersion
"SKILL35.00"
> 

学习参考:

[ Skill ] Cadence Skill 语言入门 - YEUNGCHIE - 博客园

脚本思路:

1、将框选区域所有器件按照器件名字分为两个列表;

2、按照ABBA,BAAB的匹配形式将两个列表的器件重新排列为两个新列表;

3、设定间距x,y;

4、按照设定的间距排布器件,并使得上下列器件的栅极生成于中间;

5、在上下两列器件两端加入Dummy器件。

设计操作:

1、将框选区域所有器件按照器件名字分为两个列表;

获取当前处于编辑状态的 CellView 的数据库 id,赋值给 cv;

cv = geGetEditCellView()

获取当前在版图窗口中被鼠标选中的所有对象的id列表;

instList = geGetSelSet()

提取每个对象的 baseName 属性;

bNameList = instList~>baseName

得到bNameList,并观察结果:

bNameList = instList~>baseName
("NM123.1" "NM123.2" "NM123.3" "NM123.4" "NM1.1" "NM1.2" "NM1.3" "NM1.4")
>

可知可根据baseName"."号之前的字符串将所有器件分为两类。

获取器件名称中第一个点号(.)之前的部分保存在nameList列表中;

nameList = foreach(mapcar bName bNameList car(parseString(bName ".")))

得到nameList,并观察结果:

nameList = foreach(mapcar bName bNameList car(parseString(bName ".")))
("NM123" "NM123" "NM123" "NM123" "NM1" "NM1" "NM1" "NM1")
>

使用mapcar函数将器件ID和器件nameList匹配;

pairedList = mapcar('list instList nameList)

得到pairedList,并观察结果:

pairedList = mapcar('list instList nameList)
(	(db:0x16387a1d "NM123") (db:0x16387a1e "NM123") (db:0x16387a1f "NM123") (db:0x16387a20 "NM123") (db:0x16387a21 "NM1")(db:0x16387a22 "NM1") (db:0x16387a23 "NM1") (db:0x16387a24 "NM1")	)
>

将nameList去重后,作为两个列表的区分依据:

uniqueList = ciUtilsMakeUnique(nameList)
("NM123" "NM1")
>

根据nameList将器id分为两个列表:

nm1List = setof(pair pairedList (cadr(pair) == car(uniqueList)))		
nm1List = mapcar('car nm1List)
nm0List = setof(pair pairedList (cadr(pair) == cadr(uniqueList)))
nm0List = mapcar('car nm0List)

得到nm0List和nm1List的id列表:

nm0List
nm1List
(db:0x16387a21 db:0x16387a22 db:0x16387a23 db:0x16387a24)
(db:0x16387a1d db:0x16387a1e db:0x16387a1f db:0x16387a20)
>

符合预期结果。

2、按照ABBA,BAAB的匹配形式将两个列表的器件重新排列为两个新列表;

abbaPattern = list(nth(0 nm0List) nth(0 nm1List) nth(1 nm1List)  nth(1 nm0List) 
)baabPattern = list(nth(2 nm1List) nth(2 nm0List) nth(3 nm0List)nth(3 nm1List)
)

得到abbaPattern 和baabPattern两个id列表:

abbaPattern 
baabPattern
(db:0x16387a21 db:0x16387a1d db:0x16387a1e db:0x16387a22)
(db:0x16387a1f db:0x16387a23 db:0x16387a24 db:0x16387a20)
> 

3、设定间距x,y;

x = 2
y = 2

4、按照设定的间距排布器件,并使得上下列器件的栅极生成于中间;

确定器件的宽度和高度以及原始坐标;

bBox = car(nm0List)~>bBox     
instWidth = caadr(bBox) - caar(bBox)
instHeight = cadadr(bBox) - cadar(bBox)
originxy = car(nm0List)~>xy

排布器件,并按照设定生成栅极;

for(i 0 (length(abbaPattern)-1)let((currentItem newxy)currentItem = nth(i abbaPattern)dbReplaceProp(currentItem "connectGates" "string" "Bottom")newxy = list(car(originxy) + i*(x+instWidth) cadr(originxy))currentItem~>xy = newxyprintf("num %d: value = %L\n" i currentItem~>xy));let 
);forfor(i 0 (length(baabPattern)-1)let((currentItem newxy)currentItem = nth(i baabPattern)dbReplaceProp(currentItem "connectGates" "string" "Top")newxy = list(car(originxy) + i*(x+instWidth) cadr(originxy) - y - instHeight)currentItem~>xy = newxyprintf("num %d: value = %L\n" i currentItem~>xy);println(i currentItem~>bBox));let 
);for	

image-20260304165814389

5、在上下两列器件的左右两端加入Dummy器件。

参考Skill语言学习_5

let((targetInst bBox origin left right top bottom x1 y1 width x2 height dummyLib dummyCell masterCv spacing leftOrigin rightOrigin maxNum num newName leftInst rightInst)targetInst = car(abbaPattern)bBox = targetInst~>bBoxorigin = targetInst~>xyleft = caadr(bBox)right = caar(bBox)top = cadadr(bBox)bottom = cadar(bBox)x1 = car(origin)y1 = cadr(origin)x2 = caar(last(abbaPattern)~>xy)width  = left - rightheight = top - bottomdummyLib  = targetInst~>libName      dummyCell = targetInst~>cellName    masterCv = dbOpenCellViewByType(dummyLib dummyCell "layout")spacing = xleftOrigin  = list(x1 - width - spacing, y1)rightOrigin = list(x2 + width + spacing, y1)maxNum = 0foreach(instName cv~>instances~>nameif(rexMatchp("Dummy*" instName)thennum = atoi(substring(instName strlen("Dummy")+1))if(num > maxNum thenmaxNum = num);if);if);foreachnewName = sprintf(str "Dummy%d" (maxNum+1))leftInst  = dbCreateInst(cv masterCv newName leftOrigin  "R0" 1)dbCopyProp(targetInst leftInst)newName = sprintf(str "Dummy%d" (maxNum+2))rightInst = dbCreateInst(cv masterCv newName rightOrigin "R0" 1)dbCopyProp(targetInst rightInst)
);letlet((selected targetInst bBox origin left right top bottom x1 y1 x2 width height dummyLib dummyCell masterCv spacing leftOrigin rightOrigin maxNum num newName leftInst rightInst)targetInst = car(baabPattern)bBox = targetInst~>bBoxorigin = targetInst~>xyleft = caadr(bBox)right = caar(bBox)top = cadadr(bBox)bottom = cadar(bBox)x1 = car(origin)y1 = cadr(origin)x2 = caar(last(baabPattern)~>xy)width  = left - rightheight = top - bottomdummyLib  = targetInst~>libName      dummyCell = targetInst~>cellName    masterCv = dbOpenCellViewByType(dummyLib dummyCell "layout")spacing = xleftOrigin  = list(x1 - width - spacing, y1)rightOrigin = list(x2 + width + spacing, y1)maxNum = 0foreach(instName cv~>instances~>nameif(rexMatchp("Dummy*" instName)thennum = atoi(substring(instName strlen("Dummy")+1))if(num > maxNum thenmaxNum = num);if);if);foreachnewName = sprintf(str "Dummy%d" (maxNum+1))leftInst  = dbCreateInst(cv masterCv newName leftOrigin  "R0" 1)dbCopyProp(targetInst leftInst)newName = sprintf(str "Dummy%d" (maxNum+2))rightInst = dbCreateInst(cv masterCv newName rightOrigin "R0" 1)dbCopyProp(targetInst rightInst)
);let

整合上述代码,并绑定快捷键:

procedure(arrangeMultiplierDevicesAddDummy(x y)let((cv instList bNameList nameList pairedList uniqueList nm1List nm0List bBox instWidth instHeight abbaPattern baabPattern originxy)cv = geGetEditCellView()instList = geGetSelSet()bNameList = instList~>baseNamenameList = foreach(mapcar bName bNameList car(parseString(bName ".")))pairedList = mapcar('list instList nameList)uniqueList = ciUtilsMakeUnique(nameList)nm1List = setof(pair pairedList (cadr(pair) == car(uniqueList)))		nm1List = mapcar('car nm1List)nm0List = setof(pair pairedList (cadr(pair) == cadr(uniqueList)))nm0List = mapcar('car nm0List)abbaPattern = list(nth(0 nm0List) nth(0 nm1List) nth(1 nm1List)  nth(1 nm0List) )baabPattern = list(nth(2 nm1List) nth(2 nm0List) nth(3 nm0List)nth(3 nm1List))bBox = car(nm0List)~>bBox     instWidth = caadr(bBox) - caar(bBox)instHeight = cadadr(bBox) - cadar(bBox)       originxy = car(nm0List)~>xyfor(i 0 (length(abbaPattern)-1)let((currentItem newxy)currentItem = nth(i abbaPattern)dbReplaceProp(currentItem "connectGates" "string" "Bottom")newxy = list(car(originxy) + i*(x+instWidth) cadr(originxy))currentItem~>xy = newxyprintf("num %d: value = %L\n" i currentItem~>xy));let );forfor(i 0 (length(baabPattern)-1)let((currentItem newxy)currentItem = nth(i baabPattern)dbReplaceProp(currentItem "connectGates" "string" "Top")newxy = list(car(originxy) + i*(x+instWidth) cadr(originxy) - y - instHeight)currentItem~>xy = newxyprintf("num %d: value = %L\n" i currentItem~>xy);println(i currentItem~>bBox));let );for	let((targetInst bBox origin left right top bottom x1 y1 width x2 height dummyLib dummyCell masterCv spacing leftOrigin rightOrigin maxNum num newName leftInst rightInst)targetInst = car(abbaPattern)bBox = targetInst~>bBoxorigin = targetInst~>xyleft = caadr(bBox)right = caar(bBox)top = cadadr(bBox)bottom = cadar(bBox)x1 = car(origin)y1 = cadr(origin)x2 = caar(last(abbaPattern)~>xy)width  = left - rightheight = top - bottomdummyLib  = targetInst~>libName      dummyCell = targetInst~>cellName    masterCv = dbOpenCellViewByType(dummyLib dummyCell "layout")spacing = xleftOrigin  = list(x1 - width - spacing, y1)rightOrigin = list(x2 + width + spacing, y1)maxNum = 0foreach(instName cv~>instances~>nameif(rexMatchp("Dummy*" instName)thennum = atoi(substring(instName strlen("Dummy")+1))if(num > maxNum thenmaxNum = num);if);if);foreachnewName = sprintf(str "Dummy%d" (maxNum+1))leftInst  = dbCreateInst(cv masterCv newName leftOrigin  "R0" 1)dbCopyProp(targetInst leftInst)newName = sprintf(str "Dummy%d" (maxNum+2))rightInst = dbCreateInst(cv masterCv newName rightOrigin "R0" 1)dbCopyProp(targetInst rightInst));letlet((selected targetInst bBox origin left right top bottom x1 y1 x2 width height dummyLib dummyCell masterCv spacing leftOrigin rightOrigin maxNum num newName leftInst rightInst)targetInst = car(baabPattern)bBox = targetInst~>bBoxorigin = targetInst~>xyleft = caadr(bBox)right = caar(bBox)top = cadadr(bBox)bottom = cadar(bBox)x1 = car(origin)y1 = cadr(origin)x2 = caar(last(baabPattern)~>xy)width  = left - rightheight = top - bottomdummyLib  = targetInst~>libName      dummyCell = targetInst~>cellName    masterCv = dbOpenCellViewByType(dummyLib dummyCell "layout")spacing = xleftOrigin  = list(x1 - width - spacing, y1)rightOrigin = list(x2 + width + spacing, y1)maxNum = 0foreach(instName cv~>instances~>nameif(rexMatchp("Dummy*" instName)thennum = atoi(substring(instName strlen("Dummy")+1))if(num > maxNum thenmaxNum = num);if);if);foreachnewName = sprintf(str "Dummy%d" (maxNum+1))leftInst  = dbCreateInst(cv masterCv newName leftOrigin  "R0" 1)dbCopyProp(targetInst leftInst)newName = sprintf(str "Dummy%d" (maxNum+2))rightInst = dbCreateInst(cv masterCv newName rightOrigin "R0" 1)dbCopyProp(targetInst rightInst));let);let
);procedurehiSetBindKey("Layout" "Ctrl<Key>2" "arrangeMultiplierDevicesAddDummy(2 2)")

测试该脚本:

image-20260305103034499

将该脚本写入.cdsinit文件自动load

在桌面打开Terminal,输入:
cd
gedit .cdsinin
在.cdsinit文件内,load脚本的全路径:
load("/home/~~/~~/~~/arrangeMultiplierDevicesAddDummy.il")
如下:

image-20260305103150938

综上完成了差分对的匹配和Dummy管的添加的功能🎉🎉🎉

http://www.jsqmd.com/news/438436/

相关文章:

  • 探讨长春别墅装修设计公司排名,亿建艺筑能进前十吗 - 工业设备
  • 实力强的旅游度假酒店品牌推荐,溪山里酒店合适吗? - mypinpai
  • 2026学历提升避坑指南:从报名门槛到就业前景七家机构多维度横向对比 - 速递信息
  • 新 MacBook 部署大模型避坑指南:Ollama+llama.cpp 一键部署,离线也能用
  • 2026甘肃保温材料厂家实测推荐:甘肃全顺如何破解西北严寒保温难题? - 深度智识库
  • 2026年洗发水推荐:十大热门品牌深度测评 - 包罗万闻
  • 能源与碳排的智能化监测管理系统
  • 2026年3月草本洗头皂厂家推荐:行业测评与选择指南 - 品牌鉴赏师
  • 2026 AI论文写作工具全景测评AI论文网站排名 | 全流程能力与学术合规综合对比
  • 选购别墅庭院设计公司,长春欧亚园林口碑好不好? - 工业品网
  • 2026年污泥脱水卧螺离心机厂家推荐:自来水/工业/车载/撬装式卧螺离心机专业供应 - 品牌推荐官
  • 11年死磕工程:只为拉力赛道生死3秒 - RF_RACER
  • 大件出海包装全流程:如何让物流环节更稳、成本更低、通关更顺 - 速递信息
  • 2026年探讨CE认证代理机构哪家价格合理,郜盟认证是优选 - 工业推荐榜
  • AutoCAD 2026下载安装教程:详细步骤图解(新手必看) - sdfsafafa
  • 2026年上海升立机械:兼具口碑与性价比的双螺旋锥形、犁刀混合机厂家推荐 - 工业设备
  • 聊聊考研数学培训价格,盘点2026年全国便宜又好用的机构 - myqiye
  • 2026年最新盘点:十大剪辑素材网站推荐,延时视频、影视剪辑、UP主资源大盘点 - 品牌2026
  • 2026年全自动攻丝机市场,这些厂家受青睐,转盘攻牙机/自动钻孔攻丝机/伺服攻丝机,全自动攻丝机企业哪家好 - 品牌推荐师
  • 跨平台相机方案深度对比:CameraX vs. Flutter Camera vs. React Native - 教程
  • 2026年3月舒缓头皮洗发皂厂家最新推荐,温和舒缓敏感头皮不适 - 品牌鉴赏师
  • AI 智能体与传统自动化工具的本质区别,企业老板一定要看清 - 速递信息
  • 告别低效繁琐!降AIGC网站 千笔·降AIGC助手 VS 灵感风暴AI
  • 宝成百利作为冰棍专业供应商有啥优势,合作品牌多吗? - 工业品网
  • 了解像素壹佰靠谱吗,如何选择适合自己的课程? - 工业品牌热点
  • 2026年3月东莞博罗湖镇搬家公司最新推荐,专业团队高效搬迁有保障 - 品牌鉴赏师
  • 直接上结论:千笔,本科生的降AI率神器
  • 新佳源环保公司概况怎样,在泰州服务覆盖范围广不广呢 - mypinpai
  • 2026年度精选:十大AI训练图片与视频素材数据集优质供应商卓特视觉详解 - 品牌2026
  • 2026年南通环保评测公司排行,诚信环保评价公司哪家性价比高 - mypinpai