张子航,罗雯,陈钢.使用函数式语言与命令式语言混合开发EDA程序的一次探索[J]. 微电子学与计算机,2023,40(5):56-64. doi: 10.19304/J.ISSN1000-7180.2022.0492
引用本文: 张子航,罗雯,陈钢.使用函数式语言与命令式语言混合开发EDA程序的一次探索[J]. 微电子学与计算机,2023,40(5):56-64. doi: 10.19304/J.ISSN1000-7180.2022.0492
ZHANG Z H,LUO W,CHEN G. An exploration of EDA program development with hybrid programming using functional language and imperative language[J]. Microelectronics & Computer,2023,40(5):56-64. doi: 10.19304/J.ISSN1000-7180.2022.0492
Citation: ZHANG Z H,LUO W,CHEN G. An exploration of EDA program development with hybrid programming using functional language and imperative language[J]. Microelectronics & Computer,2023,40(5):56-64. doi: 10.19304/J.ISSN1000-7180.2022.0492

使用函数式语言与命令式语言混合开发EDA程序的一次探索

An exploration of EDA program development with hybrid programming using functional language and imperative language

  • 摘要: 相较于命令式语言,函数式语言有两个明显的优点:安全性好、开发周期短.但一般而言,函数式语言的代码性能不够好,妨碍了它的推广和实践应用,尤其是在性能要求很高的领域. 基于上述问题进行了一次函数式语言和命令式语言混合编程的探索,试图在同一个项目中结合两类编程语言混合编程,一方面用函数式语言OCaml快速编写复杂度较高的算法核心代码;另一方面,用C语言编写难度不大但是对性能影响比较大的代码,通过这种混合编程方式在较短的时间内可以实现一个结构比较复杂但在性能上接近C语言编写的同类代码的软件. 选用海量图形数据的高速区域化查询这一案例,该EDA问题对运算效率有较高的要求,所以在数据结构上选择四叉树结构来实现区域查询,因此是一个比较有代表性的使用高效数据结构来满足性能要求的问题. 实验结果表明,OCaml和C的混合编程能将核心算法的研发周期明显缩短,同时性能与C语言编写的同类型的代码相仿,这也就说明了函数式语言和命令式语言的混合编程可以成为EDA软件开发的一个可行的方案.

     

    Abstract: Compared with imperative languages, functional languages offer two main advantages: good security and a short development cycle. However, functional language programs are slower, which hinders their practical application, particularly in areas requiring high performances, such as exploratory data analysis (EDA). This study investigates a hybrid programming paradigm with both functional and command languages. Functional language OCaml develops the core code of an algorithm with high complexity. Meanwhile, C language is used to write codes that are not necessarily difficult but contribute significantly to the performance. An extremely complex algorithm can be implemented rapidly while achieving performance comparable to a handwritten C program using this method. A high-speed regional query of massive graphics data is used in the current experiment. Because EDA require a high computational efficiency of the algorithm, the quadtree data structure is used to accomplish an efficient binary region query. This representative problem uses an efficient data structure to fulfill the performance requirements.The experimental results show that the mixed programming of OCaml and C can shorten the development cycle of the core algorithm significantly, and the performance is similar to the code of the same type written in C language, which also shows that the mixed programming of functional language and imperative language can become a feasible program for EDA software development.

     

/

返回文章
返回