Featured image of post 都怎么批量同时替换libName和cellName?

都怎么批量同时替换libName和cellName?

版图中批量同时替换libName和cellName我不会啊,Find/Replace不能同时replace libName和cellName, property form 最烦了,懒人解决问题的办法就是写脚本, 方便省时

问题

目前版图中libName或cellName两者只改其一,能通过Find/Replace功能加正则匹配还是能搞定的,再不济也能通过 property form 分批改动。 但要同时改 libName 和 cellName 还有点麻烦

思路

首先想到肯定要能批量更改 其次要能直观看到替换前后的 lib/cell 最后能反馈结果

脚本实现

  1. 获取已选的 instances
setof(tmp geGetSelectedSet() tmp~>objType=="inst")
  1. 将inst信息写入一个临时的 change map文件
(fprintf fh "%s\t%s\t%s\t%s\n" oldLibName oldCellName oldViewName oldInstName)
  1. 在编辑器中通过查找替换功能改为期望的lib/cell,并保存
chiplayout    cell1      layout
- chiplayout    cell2      layout
+ chiplayout2    cell12      layout
chiplayout    cell3      layout
chiplayout    cell4      layout
chiplayout    cell5      layout
- chiplayout    cell6      layout
+ chiplayout    cell16      layout
chiplayout    cell7      layout
chiplayout    cell8      layout
chiplayout    cell9      layout
  1. 重新读取改过的 change map文件
  (while (gets lines fh)
    lineList = append1(lineList parseString(lines "\n"))
  )
  1. 根据文件内容用 leReplaceAnyInstMaster 替换旧的 inst
(leReplaceAnyInstMaster (nthelem i insts) newLib newCell newView)
  1. 反馈结果
(printf "Total %d: %d no change, %d replaced, %d failed.\n" length(insts) noChangeNum successedNum failedNum)

脚本&快捷键

通过网盘分享的文件: 链接: https://pan.baidu.com/s/16682bY78SKqyWmOBLCUAag?pwd=pty2 提取码: pty2 复制这段内容后打开百度网盘手机App,操作更方便哦

load("xxx/chiplayout_changeRefLibAndCell.il")
hiSetBindKey("Layout" "Ctrl<Key>m" "cl_changeRefLibAndCell()")

总结

  1. 新版脚本彻底放开限制,只要目标单元存在,跨lib、跨cell的lib*/cell*替换都能搞定;
  2. 交互式文本编辑超简单,三列格式清晰,不用记指令,新手也能上手;
  3. 严格按行数、顺序匹配,替换的时候不会错位,保证版图修改精准。
陕ICP备20000710号
本站已运行15年5月12天
发表了396篇文章 · 总计14万0千字
最后更新:2026-01-24
Built with Hugo
Theme Stack designed by Jimmy