作为一个IC后端工程师,常年需要和工具、数据库和unix打交道,零零总总算下来也学(被)会(迫)了好几种脚本语言:perl,shell,TCL等。在项目的反复捶打下,确实提高了不少工作效率,受益匪浅!
基于过往IC设计的工作诉求,python对于IC设计有点杀(实)鸡(在)用(太)牛(强)刀(大)的感脚。芯片工程师的大部分的工作都是针对明码 告、数据的整合和抽取(应该没有小伙伴去研究DDC之类文件的数据结构吧)。
这个世界最大的不变就是变化本身,停留在过去越久身(灵)体(魂)就会越沉重,尽管有点大材小用,但是对于有追求,有理想,有job要跑,有bug要修的IC四有芯人而言,这点进步的动力还(以)是(免)要(被)有(淘)的(汰)。看看下面这位老哥(Bruce Eckel, 如有误:烦请指正) 的坚持,小伙伴还有借口不学python吗r>
丰富的数据类型
数据类型是一个语言的基础面。python的数据类型非常灵活和多变。数据的引用和回收机制可以让计算机的管理和用户的使用双双提高效率。
字符串(string),元组(tuple),集合(set),列表/数组(list),字典(dictionary)等等。
乍看起来,都是相貌平平,但是加上任意的数据嵌套,会让应用场景变得几位灵活和方便,字典嵌套字典组成二位字典
类似的,数组套接数组成二维、甚至多维数组。同样,数组和字典也可以互相嵌套。更有趣的是,对于数组这种变量,也不要实现定义长度,可以随时裁剪和追加,对于变量使用的的各种调整提供了非常便利的操作可能。
对于这么复杂多变的变量类型,主要原因还是python使用引用的方法来构造变量:任何一个变量都可以看作是到一个内存的指针关系
譬如C语言就是面向过程编程的语言,相应的C++、java,python等是面向对象编程的语言
python提供了丰富的类别和接口,这让面向对象编程变得可能,至于用户是采用python来做面向对象还是面向过程编程,完全在于用户的场景和处理方法,简单的总结:面向过程容易理解和开发,面向对象容易扩展和维护。
丰富的模块和生态
在 络、 区和git中,python具有非常多的模块(model),很多高大上的模块广受好评,甚至之前的一些支持C的模块现在也提供了对python的支持。【摘录自: Python有哪些实用的模块em>侵删】
1. Requests. The most famous http library written by kenneth reitz. It’s a must have for every python developer.
2. Scrapy. If you are involved in webscraping then this is a must have library for you. After using this library you won’t use any other.
3. wxPython. A gui toolkit for python. I have primarily used it in place of tkinter. You will really love it.
4. Pillow. A friendly fork of PIL (Python Imaging Library). It is more user friendly than PIL and is a must have for anyone who works with images.
5. SQLAlchemy. A database library. Many love it and many hate it. The choice is yours.
6. BeautifulSoup. I know it’s slow but this xml and html parsing library is very useful for beginners.
7. Twisted. The most important tool for any network application developer. It has a very beautiful api and is used by a lot of famous python developers.
8. NumPy. How can we leave this very important library t provides some advance math functionalities to python.
9. SciPy. When we talk about NumPy then we have to talk about scipy. It is a library of algorithms and mathematical tools for python and has caused many scientists to switch from ruby to python.
10. matplotlib. A numerical plotting library. It is very useful for any data scientist or any data analyzer.
11. Pygame. Which developer does not like to play games and develop them his library will help you achieve your goal of 2d game development.
12. Pyglet. A 3d animation and game creation engine. This is the engine in which the famous python port of minecraft was made
13. pyQT. A GUI toolkit for python. It is my second choice after wxpython for developing GUI’s for my python scripts.
14. pyGtk. Another python GUI library. It is the same library in which the famous Bittorrent client is created.
15. Scapy. A packet sniffer and analyzer for python made in python.
16. pywin32. A python library which provides some useful methods and classes for interacting with windows.
17. nltk. Natural Language Toolkit – I realize most people won’t be using this one, but it’s generic enough. It is a very useful library if you want to manipulate strings. But it’s capacity is beyond that. Do check it out.
18. nose. A testing framework for python. It is used by millions of python developers. It is a must have if you do test driven development.
19. SymPy. SymPy can do algebraic evaluation, differentiation, expansion, complex numbers, etc. It is contained in a pure Python distribution.
20. IPython. I just can’t stress enough how useful this tool is. It is a python prompt on steroids. It has completion, history, shell capabilities, and a lot more. Make sure that you take a look at it.
IC工程师的抉择
如文章开头所言,一般的IC芯片工程的大部分时间的处理对象都是纯文本的数据,这也是为什么前边提出来的脚本语言:TCL、shell、perl在IC设计领域里流行的一个原因。
在过往,perl一直是一个效率不错的脚本语言,但是正如某位大咖所言:perl是一个文学家构建出来的,而python则是由一个数学家开发出来的。维护过perl程序(即便是自己写的perl脚本)的工程师对此一定深有体会。
在初接触phtyon后,笔者对IC工程师的脚本语言的选择,有下面一些建议
-
** EDA工具内的操作:**
- TCL (Tooling Command Language)
- EDA工具内嵌的脚本语言
- 小巧,易学(笔者:世界上最简单的语言之一):通过内嵌工具的内部命令(native-command)可以实现工具内的数据抽取和处理
- TCL是纯本的操作,大型数据处理效率很慢,同时也会间接占用EDA license使用时间和EDA资源
- 调用系统命令:
- 使用 唤起shell命令,譬如:之类的。但是由于一些特殊字符的影响,,经常会花费更多的时间进行命令调整。
- 唤起第三方脚本语言(perl、python之类的): 等等。
- 由于大型项目的数据数据体量问题,在笔者的经验中,EDA通常由于内存占用等原因,上述两种的命令执行都有可能回失败,笔者理解,主要原因是唤起解析器(interpreter)或者shell的失败导致。
- TCL (Tooling Command Language)
-
shell下简单的文本处理:
- 在交互模式下(interactive mode)使用shell 命令,譬如等等。通常这类操作简单便捷,即用即显,以交互模式进行文本处理效率比较高(文本数据量不大的情况 ,
- 不建议过多使用将此类命令去构建shell 脚本,此类命令都有独立的版本,任何的版本迁徙和系统调整会影响运行结果。
- 唤起TCL shell ():使用TCL命令完成功能。但是TCL的优势是在工具里边和工具命令联动使用,单独的TCL语法非常简单,不适合稍微复杂的情景处理,加之shell命令强大的处理能力,已经鲜见有小伙伴这么使用TCL了。
- perl的命令行模式进行文本(文件)的操作:高效且便捷
-
python的用武之地
- 对于复杂格式的文本进行高效处理
- EDA工具的高层控制:调度,状态归集等:在验证和后端等多任务模式下可以发挥作用。
- IC设计加速和辅助:python多样话的接口和业务场景支持,可以实现一些IC设计业务的自动化实现:
- 代码生成:基于excel输入进行代码的格式化输出
- IP性能比对:
- 对std-cell进行PPA性能分析,对于不同memory选型的PPA结果收集和分析
- 格式化和图表化的性能分析
- 数据类型丰富,利于编程实现,运行效率高,脚本易于维护
- 支持跨平台(Windows,unix,MacOS)使用,程序迁移容易
- 版本的选择:由于python在3.0进行了一次重大更新,现在的最新版本已经迁移到了3.9+,建议小伙伴们使用python 3.*的版本。
本章词汇
词汇 | 解释 |
---|---|
Pycharm | JetBrain公司出品的专门用于python语言的IDE工具 |
【敲黑板划重点】

软件语言的丰富给工程师提供了多样化的选择,正所谓跳跳大路通罗马,python的这条罗马之路貌似短了那么一点点
参考资料
Mark Lutz Python 学习手册
www.python.org
文章知识点与官方知识档案匹配,可进一步学习相关知识Python入门技能树首页概览211955 人正在系统学习中
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!