skip to main content
10.1145/3649329.3657311acmconferencesArticle/Chapter ViewAbstractPublication PagesdacConference Proceedingsconference-collections
research-article
Open access

Formally Verifying Arithmetic Chisel Designs for All Bit Widths at Once

Published: 07 November 2024 Publication History

Abstract

Chisel is an open-source hardware description language embedded in Scala to facilitate parameterized and reusable digital circuit design. Chisel is becoming increasingly popular and has been used to design RISC-V CPUs, e.g. RocketChip and XiangShan. While Chisel features high-level hardware designs, its verification is still low-level: Low-level (e.g. Verilog) programs are first generated from Chisel programs, then the verification tools are applied to these low-level programs. In this work, we focus on formal verification of arithmetic units. Efficient low-level formal verification of arithmetic units has always been a challenge and remains an active research area, attributed to the state explosion problem brought on by bit widths. To circumvent this problem for arithmetic Chisel designs, we propose an approach to their high-level formal verification so that their correctness is verified for all bit widths at once, instead of for each bit width separately. The key idea is to transform arithmetic Chisel designs into Scala software programs that simulate their behaviors, where the high-level features are preserved, then resort to Stainless, a deductive formal verification tool for Scala. We validate the effectiveness of this approach by formally verifying the correctness of dividers and multipliers in two representative open source RISC-V processors, namely, RocketChip and XiangShan. Compared to the existing proof-assistant-based parameterized verification approaches for arithmetic designs (e.g. Kami), the verification cost in our approach is much lower on average.

References

[1]
K. Asanović, R. Avižienis, et al. 2016. The rocket chip generator. Technical Report. UCB/EECS-2016-17, EECS Department, University of California, Berkeley.
[2]
K. Asanović, R. Avižienis, et al. 2023. Multiplier and divider in Rocket-Chip. https://github.com/chipsalliance/rocket-chip/blob/master/src/main/scala/rocket/Multiplier.scala.
[3]
J. Bachrach, H. Vo, B. C. Richards, et al. 2012. Chisel: constructing hardware in a Scala embedded language. In DAC. 1216--1225.
[4]
F. Bornebusch, C. Lüth, and et al. 2020. Towards Automatic Hardware Synthesis from Formal Specification to Implementation. In ASP-DAC. 375--380.
[5]
R. E. Bryant. 1986. Graph-Based Algorithms for Boolean Function Manipulation. IEEE Trans. Computers 35, 8 (1986), 677--691.
[6]
R. E. Bryant. 1996. Bit-Level Analysis of an SRT Divider Circuit. In DAC. 661--665.
[7]
J. Choi, M. Vijayaraghavan, B. Sherman, et al. 2023. Non-restoring divider in Kami. https://github.com/mit-plv/kami/blob/rv32i/Kami/Ex/Divider64.v.
[8]
J. Choi, M. Vijayaraghavan, B. Sherman, et al. 2023. Radix-4 Booth Multiplier in Kami. https://github.com/mit-plv/kami/blob/rv32i/Kami/Ex/Multiplier64.v.
[9]
J. Choi, M. Vijayaraghavan, B. Sherman, and et al. 2017. Kami: a platform for high-level parametric hardware specification and its modular verification. Proc. ACM Program. Lang. 1, ICFP (2017), 24:1--24:30.
[10]
E. M. Clarke, M. Khaira, and X. Zhao. 1996. Word Level Model Checking - Avoiding the Pentium FDIV Error. In DAC. 645--648.
[11]
A. Dobis, K. Laeufer, H. J. Damsgaard, et al. 2023. Verification of Chisel Hardware Designs with ChiselVerify. Microprocess. Microsystems 96 (2023), 104737.
[12]
A. Dobis, T. Petersen, H. J. Damsgaard, et al. 2021. ChiselVerify: An Open-Source Hardware Verification Library for Chisel and Scala. In NorCAS. 1--7.
[13]
J. P. P. Flor, W. Swierstra, and Y. Sijsling. 2015. Pi-Ware: Hardware Description and Verification in Agda. In TYPES (LIPIcs, Vol. 69). 9:1--9:27.
[14]
D. Kapur and M. Subramaniam. 2000. Using an induction prover for verifying arithmetic circuits. Int. J. Softw. Tools Technol. Transf. 3, 1 (2000), 32--65.
[15]
D. Kaufmann and A. Biere. 2021. AMulet 2.0 for Verifying Multiplier Circuits. In TACAS. 357--364.
[16]
D. Kaufmann and A. Biere. 2023. Improving AMulet2 for verifying multiplier circuits using SAT solving and computer algebra. Int. J. Softw. Tools Technol. Transf. 25, 2 (2023), 133--144.
[17]
J. Kumar, Y. Miyasaka, A. Srivastava, and M. Fujita. 2023. Formal Verification of Integer Multiplier Circuits Using Binary Decision Diagrams. IEEE Trans. Comput. Aided Des. Integr. Circuits Syst. 42, 4 (2023), 1365--1378.
[18]
EPFL IC LARA. 2023. Stainless: Verification framework for a subset of the Scala programming language. https://github.com/epfl-lara/stainless.
[19]
Richard Lin and Kevin Laeufer. 2023. ChiselTest. https://github.com/ucb-bar/chiseltest
[20]
J. Lv, P. Kalla, and F. Enescu. 2013. Efficient Gröbner Basis Reductions for Formal Verification of Galois Field Arithmetic Circuits. IEEE Trans. Comput. Aided Des. Integr. Circuits Syst. 32, 9 (2013), 1409--1420.
[21]
R. Mukherjee, M. Tautschnig, and D. Kroening. 2016. v2c - A Verilog to C Translator. In TACAS. 580--586.
[22]
C. Scholl and A. Konrad. 2020. Symbolic Computer Algebra and SAT Based Information Forwarding for Fully Automatic Divider Verification. In DAC. 1--6.
[23]
C. Scholl, A. Konrad, and et al. 2021. Verifying Dividers Using Symbolic Computer Algebra and Don't Care Optimization. In DATE. 1110--1115.
[24]
OSCPU team. 2023. NutShell RISC-V CPU. https://github.com/OSCPU/NutShell.
[25]
M. Temel and W. A. Hunt. 2021. Sound and Automated Verification of Real-World RTL Multipliers. In FMCAD. 53--62.
[26]
M. Temel, A. Slobodová, and W. A. Hunt. 2020. Automated and Scalable Verification of Integer Multipliers. In CAV. 485--507.
[27]
YCA Tsai. 2021. Dynamic verification library for Chisel. Master's thesis. University of California, Berkeley.
[28]
N. Voirol. 2019. Verified Functional Programming. Ph. D. Dissertation. EPFL, Switzerland.
[29]
M. Xiang, Y. Li, and Y. Zhao. 2023. ChiselFV: A Formal Verification Framework for Chisel. In DATE. 1--6.
[30]
Y. Xu, Z. Yu, D. Tang, et al. 2022. Towards Developing High Performance RISC-V Processors Using Agile Methodology. In MICRO. 1178--1199.
[31]
Y. Xu, Z. Yu, D. Tang, et al. 2023. Multiplier in XiangShan. https://github.com/OpenXiangShan/XiangShan/blob/master/src/main/scala/xiangshan/backend/fu/Multiplier.scala.
[32]
Y. Xu, Z. Yu, D. Tang, et al. 2023. Radix2Divider in XiangShan. https://github.com/OpenXiangShan/XiangShan/blob/master/src/main/scala/xiangshan/backend/fu/Radix2Divider.scala.
[33]
Y. Xu, Z. Yu, D. Tang, et al. 2023. XiangShan: An open-source high-performance RISC-V processor. https://github.com/OpenXiangShan/XiangShan.
[34]
S. Yu, Y. Dong, J. Liu, et al. 2022. CHA: Supporting SVA-Like Assertions in Formal Verification of Chisel Programs (Tool Paper). In SEFM. 324--331.
[35]
J. Zhao, B Korpan, A. Gonzalez, and K. Asanovic. 2023. RISC-V BOOM: The Berkeley Out-of-Order RISC-V Processor. https://boom-core.org/.

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
DAC '24: Proceedings of the 61st ACM/IEEE Design Automation Conference
June 2024
2159 pages
ISBN:9798400706011
DOI:10.1145/3649329
This work is licensed under a Creative Commons Attribution International 4.0 License.

Sponsors

In-Cooperation

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 07 November 2024

Check for updates

Author Tags

  1. chisel
  2. multipliers and dividers
  3. scala
  4. formal verification
  5. proof refinement

Qualifiers

  • Research-article

Funding Sources

  • Strategic Priority Research Program of the Chinese Academy of Sciences

Conference

DAC '24
Sponsor:
DAC '24: 61st ACM/IEEE Design Automation Conference
June 23 - 27, 2024
CA, San Francisco, USA

Acceptance Rates

Overall Acceptance Rate 1,770 of 5,499 submissions, 32%

Upcoming Conference

DAC '25
62nd ACM/IEEE Design Automation Conference
June 22 - 26, 2025
San Francisco , CA , USA

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • 0
    Total Citations
  • 203
    Total Downloads
  • Downloads (Last 12 months)203
  • Downloads (Last 6 weeks)50
Reflects downloads up to 20 Feb 2025

Other Metrics

Citations

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Login options

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media