skip to main content
10.1145/3569052.3571872acmconferencesArticle/Chapter ViewAbstractPublication PagesispdConference Proceedingsconference-collections
research-article

Validating the Redundancy Assumption for HDL from Code Clone's Perspective

Published: 26 March 2023 Publication History

Abstract

Automated program repair (APR) is being leveraged in hardware description languages (HDLs) to fix hardware bugs without human involvement. Most existing APR techniques search for donor code (i.e., code fragment for bug fixing) in the original program to generate repairs, which is based on the assumption that donor code can be found in existing source code. The redundancy assumption is the fundamental basis of most APR techniques, which has been widely studied in software by searching code clones of donor code. However, despite a large body of work on code clone detection, researchers have focused almost exclusively on repositories in traditional programming languages, such as C/C++ and Java, while few studies have been done on detecting code clones in HDLs. Furthermore, little attention has been paid on the repetitiveness of bug fixes in hardware designs, which limits automatic repair targeting HDLs. To validate the redundancy assumption for HDL, we perform an empirical study on code clones of real-world bug fixes in Verilog. On top of empirical results, we find that 17.71% of newly introduced code in bug fixes can be found from the clone pairs of buggy code in the original program, and 11.77% can be found in the file itself. The findings not only validate the assumption but also provides helpful insights for the design of APR targeting HDLs.

References

[1]
[n. d.]. "hdlConvertor". https://github.com/Nic30/hdlConvertor. Last accessed: Oct. 2022.
[2]
[n. d.]. "Prologue: The 2020 Wilson Research Group Functional Verifica- tion Study". https://blogs.sw.siemens.com/verificationhorizons/2020/10/27/ prologue-the-2020-wilson-research-group-functional-verification-study/. Last accessed: Oct. 2022.
[3]
Hammad Ahmad, Yu Huang, and Westley Weimer. 2022. CirFix: automatically repairing defects in hardware design code. In Proceedings of the 27th ACM International Conference on Architectural Support for Programming Languages and Operating Systems. 990--1003.
[4]
Brenda S Baker. 1995. On finding duplication and near-duplication in large software systems. In Proceedings of 2nd Working Conference on Reverse Engineering. IEEE, 86--95.
[5]
Earl T Barr, Yuriy Brun, Premkumar Devanbu, Mark Harman, and Federica Sarro. 2014. The plastic surgery hypothesis. In Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering. 306--317.
[6]
Stefan Bellon, Rainer Koschke, Giulio Antoniol, Jens Krinke, and Ettore Merlo. 2007. Comparison and evaluation of clone detection tools. IEEE Transactions on software engineering, Vol. 33, 9 (2007), 577--591.
[7]
Roderick Bloem and Franz Wotawa. 2002. Verification and fault localization for VHDL programs. Journal of the Telematics Engineering Society (TIV), Vol. 2 (2002), 30--33.
[8]
Davor Cubranic and Gail C Murphy. 2003. Hipikat: Recommending pertinent software development artifacts. In 25th International Conference on Software Engineering, 2003. Proceedings. IEEE, 408--418.
[9]
Ghada Dessouky, David Gens, Patrick Haney, Garrett Persyn, Arun Kanuparthi, Hareesh Khattri, Jason M Fung, Ahmad-Reza Sadeghi, and Jeyavijayan Rajendran. 2019. {HardFails}: Insights into {Software-Exploitable} Hardware Bugs. In 28th USENIX Security Symposium (USENIX Security 19). 213--230.
[10]
Martin Fowler. 2018. Refactoring: improving the design of existing code. Addison-Wesley Professional.
[11]
Mark Gabel, Lingxiao Jiang, and Zhendong Su. 2008. Scalable detection of semantic clones. In Proceedings of the 30th international conference on Software engineering. 321--330.
[12]
John Hennessy and David Patterson. 2018. A new golden age for computer architecture: domain-specific hardware/software co-design, enhanced. In ACM/IEEE 45th Annual International Symposium on Computer Architecture (ISCA).
[13]
John L Hennessy and David A Patterson. 2019. A new golden age for computer architecture. Commun. ACM, Vol. 62, 2 (2019), 48--60.
[14]
Yu Huang, Hammad Ahmad, Stephanie Forrest, and Westley Weimer. 2021. Applying automated program repair to dataflow programming languages. In 2021 IEEE/ACM International Workshop on Genetic Improvement (GI). IEEE, 21--22.
[15]
Jiajun Jiang, Yingfei Xiong, Hongyu Zhang, Qing Gao, and Xiangqun Chen. 2018. Shaping program repair space with existing patches and similar code. In Proceedings of the 27th ACM SIGSOFT international symposium on software testing and analysis. 298--309.
[16]
Lingxiao Jiang, Ghassan Misherghi, Zhendong Su, and Stephane Glondu. 2007. Deckard: Scalable and accurate tree-based detection of code clones. In 29th International Conference on Software Engineering (ICSE'07). IEEE, 96--105.
[17]
Toshihiro Kamiya, Shinji Kusumoto, and Katsuro Inoue. 2002. CCFinder: A multilinguistic token-based code clone detection system for large scale source code. IEEE Transactions on Software Engineering, Vol. 28, 7 (2002), 654--670.
[18]
Alireza Khodamoradi, Kristof Denolf, and Ryan Kastner. 2021. S2n2: A fpga accelerator for streaming spiking neural networks. In The 2021 ACM/SIGDA International Symposium on Field-Programmable Gate Arrays. 194--205.
[19]
Dongsun Kim, Jaechang Nam, Jaewoo Song, and Sunghun Kim. 2013. Automatic patch generation learned from human-written patches. In 2013 35th International Conference on Software Engineering (ICSE). IEEE, 802--811.
[20]
Johann Knechtel. 2020. Hardware security for and beyond CMOS technology: an overview on fundamentals, applications, and challenges. In Proceedings of the 2020 International Symposium on Physical Design. 75--86.
[21]
Johann Knechtel, Jayanth Gopinath, Mohammed Ashraf, Jitendra Bhandari, Ozgur Sinanoglu, and Ramesh Karri. 2022. Benchmarking Security Closure of Physical Layouts: ISPD 2022 Contest. In Proceedings of the 2022 International Symposium on Physical Design. 221--228.
[22]
Raghavan Komondoor and Susan Horwitz. 2001. Using slicing to identify duplication in source code. In International static analysis symposium. Springer, 40--56.
[23]
Claire Le Goues, ThanhVu Nguyen, Stephanie Forrest, and Westley Weimer. 2011. Genprog: A generic method for automatic software repair. Ieee transactions on software engineering, Vol. 38, 1 (2011), 54--72.
[24]
Jaeseong Lee, Pengyu Nie, Junyi Jessy Li, and Milos Gligoric. 2020. On the naturalness of hardware descriptions. In Proceedings of the 28th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering. 530--542.
[25]
Jian Li, Yue Wang, Michael R Lyu, and Irwin King. 2018. Code completion with neural attention and pointer networks. In Proceedings of the 27th International Joint Conference on Artificial Intelligence. 4159--25.
[26]
G Jack Lipovski. 1977. Hardware description languages: voices from the Tower of Babel. Computer, Vol. 10, 06 (1977), 14--17.
[27]
Kui Liu, Dongsun Kim, Anil Koyuncu, Li Li, Tegawendé F Bissyandé, and Yves Le Traon. 2018. A closer look at real-world patches. In 2018 IEEE International Conference on Software Maintenance and Evolution (ICSME). IEEE, 275--286.
[28]
Jiacheng Ma, Gefei Zuo, Kevin Loughlin, Haoyang Zhang, Andrew Quinn, and Baris Kasikci. 2022. Debugging in the brave new world of reconfigurable hardware. In Proceedings of the 27th ACM International Conference on Architectural Support for Programming Languages and Operating Systems. 946--962.
[29]
Alexandru Marginean, Johannes Bader, Satish Chandra, Mark Harman, Yue Jia, Ke Mao, Alexander Mols, and Andrew Scott. 2019. SapFix: Automated end-to-end repair at scale. In 2019 IEEE/ACM 41st International Conference on Software Engineering: Software Engineering in Practice (ICSE-SEIP). IEEE, 269--278.
[30]
Matias Martinez, Westley Weimer, and Martin Monperrus. 2014. Do the fix ingredients already exist? an empirical inquiry into the redundancy assumptions of program repair approaches. In Companion Proceedings of the 36th international conference on software engineering. 492--495.
[31]
Bernhard Peischl, Naveed Riaz, and Franz Wotawa. 2008. Advances in automated source-level debugging of verilog designs. In New Challenges in Applied Intelligence Technologies. Springer, 363--372.
[32]
Bernhard Peischl and Franz Wotawa. 2006. Automated source-level error localization in hardware designs. IEEE design & test of computers, Vol. 23, 1 (2006), 8--19.
[33]
Dhavleesh Rattan, Rajesh Bhatia, and Maninder Singh. 2013. Software clone detection: A systematic review. Information and Software Technology, Vol. 55, 7 (2013), 1165--1199.
[34]
Chanchal Kumar Roy and James R Cordy. 2007. A survey on software clone detection research. Queen's School of Computing TR, Vol. 541, 115 (2007), 64--68.
[35]
Chanchal K Roy and James R Cordy. 2008. NICAD: Accurate detection of near-miss intentional clones using flexible pretty-printing and code normalization. In 2008 16th iEEE international conference on program comprehension. IEEE, 172--181.
[36]
Chanchal K Roy, James R Cordy, and Rainer Koschke. 2009. Comparison and evaluation of code clone detection techniques and tools: A qualitative approach. Science of computer programming, Vol. 74, 7 (2009), 470--495.
[37]
Vaibhav Saini, Farima Farmahinifarahani, Yadong Lu, Pierre Baldi, and Cristina V Lopes. 2018. Oreo: Detection of clones in the twilight zone. In Proceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering. 354--365.
[38]
Hitesh Sajnani, Vaibhav Saini, Jeffrey Svajlenko, Chanchal K Roy, and Cristina V Lopes. 2016. Sourcerercc: Scaling code clone detection to big-code. In Proceedings of the 38th International Conference on Software Engineering. 1157--1168.
[39]
Sangeetha Sudakrishnan, Janaki Madhavan, E James Whitehead Jr, and Jose Renau. 2008. Understanding bug fix patterns in verilog. In Proceedings of the 2008 international working conference on Mining software repositories. 39--42.
[40]
Donald Thomas and Philip Moorby. 2008. The Verilog® hardware description language. Springer Science & Business Media.
[41]
Lenny Truong and Pat Hanrahan. 2019. A golden age of hardware description languages: Applying programming language techniques to improve design productivity. In 3rd Summit on Advances in Programming Languages (SNAPL 2019). Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik.
[42]
Kyohei Uemura, Akira Mori, Kenji Fujiwara, Eunjong Choi, and Hajimu Iida. 2017. Detecting and analyzing code clones in HDL. In 2017 IEEE 11th International Workshop on Software Clones (IWSC). IEEE, 1--7.
[43]
Simon Urli, Zhongxing Yu, Lionel Seinturier, and Martin Monperrus. 2018. How to design a program repair bot? insights from the repairnator project. In 2018 IEEE/ACM 40th International Conference on Software Engineering: Software Engineering in Practice Track (ICSE-SEIP). IEEE, 95--104.
[44]
Qinggang Wang, Long Zheng, Yu Huang, Pengcheng Yao, Chuangyi Gui, Xiaofei Liao, Hai Jin, Wenbin Jiang, and Fubing Mao. 2021. GraSU: A fast graph update library for FPGA-based dynamic graph processing. In The 2021 ACM/SIGDA International Symposium on Field-Programmable Gate Arrays. 149--159.
[45]
Deheng Yang, Kui Liu, Dongsun Kim, Anil Koyuncu, Kisub Kim, Haoye Tian, Yan Lei, Xiaoguang Mao, Jacques Klein, and Tegawendé F Bissyandé. 2021. Where were the repair ingredients for Defects4j bugs? Empirical Software Engineering, Vol. 26, 6 (2021), 1--33.
[46]
Deheng Yang, Xiaoguang Mao, Liqian Chen, Xuezheng Xu, Yan Lei, David Lo, and Jiayu He. 2022. TransplantFix: Graph Differencing-based Code Transplantation for Automated Program Repair. In 37th IEEE/ACM International Conference on Automated Software Engineering. 1--13.
[47]
Hanqing Zeng, Chi Zhang, and Viktor Prasanna. 2017. Fast generation of high throughput customized deep learning accelerators on FPGAs. In 2017 International Conference on ReConFigurable Computing and FPGAs (ReConFig). IEEE, 1--8.
[48]
Qian Zhang, Jiyuan Wang, Guoqing Harry Xu, and Miryung Kim. 2022. HeteroGen: transpiling C to heterogeneous HLS code with automated test generation and program repair. In Proceedings of the 27th ACM International Conference on Architectural Support for Programming Languages and Operating Systems. 1017--1029.
[49]
Shijie Zhou and Viktor K Prasanna. 2017. Accelerating graph analytics on CPU-FPGA heterogeneous platform. In 2017 29th International Symposium on Computer Architecture and High Performance Computing (SBAC-PAD). IEEE, 137--144.
[50]
Yue Zou, Bihuan Ban, Yinxing Xue, and Yun Xu. 2020. CCGraph: a PDG-based code clone detector with approximate graph matching. In 2020 35th IEEE/ACM International Conference on Automated Software Engineering (ASE). IEEE, 931--942.

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
ISPD '23: Proceedings of the 2023 International Symposium on Physical Design
March 2023
278 pages
ISBN:9781450399784
DOI:10.1145/3569052
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 26 March 2023

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. automated program repair
  2. code clone
  3. empirical study
  4. hardware description languages

Qualifiers

  • Research-article

Conference

ISPD '23
Sponsor:
ISPD '23: International Symposium on Physical Design
March 26 - 29, 2023
Virtual Event, USA

Acceptance Rates

Overall Acceptance Rate 62 of 172 submissions, 36%

Upcoming Conference

ISPD '25
International Symposium on Physical Design
March 16 - 19, 2025
Austin , TX , USA

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • 0
    Total Citations
  • 102
    Total Downloads
  • Downloads (Last 12 months)26
  • Downloads (Last 6 weeks)1
Reflects downloads up to 03 Jan 2025

Other Metrics

Citations

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media