• 中国计算机学会会刊
  • 中国科技核心期刊
  • 中文核心期刊

计算机工程与科学 ›› 2025, Vol. 47 ›› Issue (06): 958-967.

• 高性能计算 • 上一篇    下一篇

FT-Format:一种可配置的硬件代码快速格式化工具

陈桂湘1,2,刘胜1,2,郭阳1,2   

  1. (1.国防科技大学计算机学院,湖南 长沙 410073;2.先进微处理器芯片与系统重点实验室,湖南 长沙 410073)

  • 收稿日期:2024-10-23 修回日期:2024-11-01 出版日期:2025-06-25 发布日期:2025-06-26

FT-Format: A configurable hardware code fast formatting tool

CHEN Guixiang1,2,LIU Sheng1,2,GUO Yang1,2   

  1. (1.College of Computer Science and Technology,National University of Defense Technology,Changsha 410073;
    2.Key Laboratory of Advanced Microprocessor Chips and Systems,Changsha 410073,China)

  • Received:2024-10-23 Revised:2024-11-01 Online:2025-06-25 Published:2025-06-26

摘要: 在集成电路设计领域,规范硬件代码的格式是容易被忽视但至关重要的,它直接影响代码的可读性和可维护性。虽然现有的代码格式化工具已得到广泛应用,但它们确实存在固有的局限,尤其是对于硬件描述语言支持度不高。为了弥补这一缺陷,对主流的格式化工具进行评估后提出了基于Python语言的硬件代码格式化工具FT-Format,实现了快速高效的格式化处理流程并且允许用户自定义调整格式化过程。为了定量评估工具的处理质量,设计了2种错误格式自检算法。结果表明,FT-Format平均每秒可处理25 381行代码,并通过了错误格式自检算法的验证,进一步等价性验证的结果证明FT- Format维持了硬件代码处理前后的逻辑一致性。

关键词: 硬件描述语言, 格式化, 高效, 可配置

Abstract: Ensuring proper format of hardware code is easily overlooked but crucial in integrated circuit design as it directly impacts code readability and maintainability. While existing formatting tools have gained widespread application, they do have inherent limitations, especially for hardware description languages. To bridge this gap, after evaluating mainstream formatting tools, this paper proposes FT-Format, a Python-based hardware code formatting tool that enables efficient and rapid formatting while allowing user-customizable adjustments. To quantitatively assess the tool’s processing quality, two self-checking algorithms for error formats are  designed. Experimental results demonstrate that FT-Format achieves an impressive average processing speed of 25 381 lines of code per second, and successfully passes validation via the self-checking algorithms. Furthermore, equivalence verification confirms that FT-Format maintains the logical consistency of hardware code throughout the formatting process. 

Key words: hardware description language, formatting, efficient, configurable