Technical White Paper: Using Advanced Formal Verification Tools to Efficiently Complete RISC-V Processor Verification

Publisher:EE小广播Latest update time:2023-06-15 Source: EEWORLDAuthor: Laurent Arditi, Paul Sargent, Thomas Aird 职务:Coda Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Technical White Paper


Using advanced formal verification tools to efficiently complete RISC-V processor verification


In our previous technical white paper , "Efficient RISC-V Processor Verification Method Based on Formal Verification" , we introduced a formal verification-based, easy-to-mobile RISC-V processor verification program using Codasip L31, a 32-bit mid-range embedded RISC-V processor core for microcontroller applications. Together with the RISC-V ISA golden model and the automatically generated checks for RISC-V compliance, it shows how to effectively locate vulnerabilities that cannot be simulated.


The openness of RISC-V allows the architecture and microarchitecture based on the RISC-V core to be customized and extended to meet specific needs. This desire for design freedom is also shifting the responsibility of the verification part to the growing developer community. However, as more and more companies and developers transform to RISC-V, everyone finds that processor verification is not an easy task. The new features brought by the new standard due to its novelty and flexibility can inadvertently create specification and design loopholes, so processor verification is a very important part of the processor development process.


During the development of a RISC-V processor core of moderate complexity, hundreds or even thousands of bugs are discovered. As more advanced features are introduced, new bugs of varying complexity are introduced. Some types of bugs are so complex that they cannot be found even in simulation. Therefore, RTL verification methods must be enabled by adding formal verification. From extreme bugs to hidden bugs, formal verification allows you to exhaustively explore all states within a reasonable processing time.


In this article, we will take the Siemens EDA processor verification application as an example, combined with the features provided by Codasip L31, a popular RISC-V processor IP, to introduce a specific method of using advanced EDA tools to verify the processor in actual design work. This verification method achieves a high degree of automation by providing a set of dedicated assertion templates for each instruction, eliminating the need for manual design, thereby improving the work efficiency of the formal verification team.


How to use Siemens EDA processors to verify your application


Before we use the tool, we need to set up formal verification for the Codasip L31 RISC-V core. This setup is similar to the setup used to formally verify standard assertions using assertion-based verification (ABV) methods with abstractions, constraints, etc.


The tool allows to verify specific categories of directives and enable or disable certain resource checks. With this tool, our verification can start from a simplified space, which includes:


Only the simplest instructions, such as only integer operations and logical instructions.

Only the simplest (but most important) checks are included. For example, updates of general purpose registers. Other checks that can be added later refer to updates of system registers (CSR) or program counter (PC) and memory accesses.

Main-only mode: no interrupts, aborts, exceptions, or debug access.

These three orthogonal constraints can be relaxed one by one depending on the criticality of the microarchitectural features. Classical formal verification techniques can be used to help obtain the results asserted by the checker: abstraction, design reduction, case splitting, invariant generation, semi-formal bug hunting, etc.


result


This formal-based approach allowed us to find corner cases and provide insights to improve our simulation and testbench. This verification work was done near the end of the project after other simulation-based verification flows had run without finding new vulnerabilities, allowing us to find real and important vulnerabilities.


We can focus on three vulnerabilities in particular, which were found in the Siemens EDA processor verification application for L31. Here is how to find and fix these three vulnerabilities:


1. The branch predictor is broken


With this vulnerability, returning to a PC address that previously held a jump/branch instruction causes the branch predictor to incorrectly predict a jump to another address. This edge case is found when the following conditions are met:


Self-modifying code

image.png

An extremely rare version of this vulnerability also occurs when an undefined instruction is added (a new instruction exception):

image.png


The vulnerability was discovered by an assertion checking the PC value, which resulted in a branch instruction being incorrectly executed, leading to incorrect code execution. This vulnerability was fixed by properly clearing the buffered data for branch prediction and pipeline.


Finding this vulnerability using the Siemens EDA Processor Verification Application takes 8 cycles and 15 minutes of runtime. Reproducing the vulnerability in simulation requires a random generator that supports self-modifying code that can return exactly the same address and modify that address from a branch to another type of instruction. In other words, a random generator cannot do this. Only a directed sequence that knows the details of the vulnerability can do it.


2. Multiple executions of the same instruction


With this bug, NPC (Next PC) unit stalls occur, which causes the same address to be fetched multiple times. Each instruction is executed and retired.


This extreme case occurs when the following conditions are met:

The core is configured with TCM.

Specific delays can be seen on the extraction bus.

Specific pauses can be seen within the pipeline.


The vulnerability directly causes a stall in the rest of the pipeline that is not handled correctly, resulting in multiple executions of the same instruction. This vulnerability can be fixed by correctly handling stalls in the rest of the pipeline.


Finding this vulnerability using the Siemens EDA Processor Verification Application takes 5 cycles and 10 minutes of runtime. Reproducing it in simulation requires a random pattern of random delays and pauses, but also requires a fair amount of "luck" to reproduce this particular sequence.


3. Legal FENCE.I instructions are considered illegal


With this vulnerability, memory barriers are handled by the CSR unit. If the instruction bits (bits [31:20]) corresponding to the CSR address bits of a CSR operation match certain CSR registers (e.g., debug, counters), the instruction may be incorrectly marked as illegal.


This extreme case is found when the following conditions are met:


There are random bits in imm[11:0]/rs1/rd.

These bits match some other illegal instructions.


image.png


The direct consequence of this vulnerability is that an illegal instruction exception is raised incorrectly. This vulnerability can be fixed by correctly decoding the complete instruction in each part of the pipeline.


Finding this vulnerability using the Siemens EDA Processor Verification Application took only 8 cycles and 5 minutes of runtime. Because the compiler only creates the simplest binary encoding implementation, it is difficult to reproduce the vulnerability in simulation. It requires a special compiler to create variants of the legitimate encoding, or special directed testing with various encodings.


Advantages/Conclusions Found


Applying this approach can improve the productivity of the verification team. Increase efficiency during critical phases of the project. While building the right setup takes effort in the beginning, progress accelerates as we add new instruction categories and new checkers. This "sweet spot" is where we find most issues, and things start to slow down as constraints are relaxed to allow the tool to explore more esoteric modes of operation.


image.png

Figure 1. The sweet spot for verifying the best efficiency of the L31 RISC-V core (Source: Codasip)


Overall, using the Siemens EDA Processor Verification Application is quite efficient because the overall effort required to verify the entire CPU is much lower than the effort required to achieve similar verification quality manually. Of the total 30 vulnerabilities, 15 were found through formal verification.


Table 1 Simulation vs Formal Verification

image.png


When combined together to achieve a high level of quality, simulation and formal verification are extremely powerful and allow us to foster a virtuous cycle of verification improvements.

image.png

Figure 2 Achieving first-class quality through continuous improvement (Source: Codasip)


The solution was proven to work on the Codasip L31, a 3-stage pipeline microcontroller, and is now deployed in Codasip's next-generation RISC-V cores, including embedded and application cores. With the knowledge accumulated from verifying applications using Siemens EDA processors on the L31, the effort required to establish a robust environment can be reduced even if the application core is more complex. Next steps for Codasip include further research on how the tool can be applied to superscalar and out-of-order cores, as well as support for new RISC-V extensions.


Additional reading

Efficient Verification of RISC-V Processors - Technical White Paper:

Building a Swiss Cheese Model Approach for Processor Verification - Blog Post:


This article is excerpted from the white paper "Form-based Efficient RISC-V Processor Verification Methodology - Formal Verification", published by Codasip, a leading global RISC-V supplier and processor solution leader headquartered in Europe, whose processor IP is currently deployed in billions of chips . Codasip provides customized computing to customers by combining the open RISC-V ISA, Codasip Studio processor design automation tool and high-quality processor IP. This innovative approach enables easy customization and differentiated design, thereby developing high-performance, game-changing products and achieving true transformation. If you want to get the full version of this white paper, you can visit the Codasip Chinese website or follow the company's WeChat official account.

[1] [2]
Reference address:Technical White Paper: Using Advanced Formal Verification Tools to Efficiently Complete RISC-V Processor Verification

Previous article:STMicroelectronics’ eight-output high-side switch integrates rich protection and diagnostic functions in a compact package
Next article:Advantech Industrial Storage SQFlash 730 Series: High-Performance & Low-Power PCIe Gen.4 SSD

Recommended ReadingLatest update time:2024-11-16 13:04

Undergraduate students from the University of Science and Technology of China designed a 64-bit RISC-V processor chip in 9 months
On July 25, the University of Chinese Academy of Sciences (UCAS) announced the results of the first phase of its "One Chip for Life" program. For the first time in China, five undergraduate students from the class of 2016 took the lead in designing and taping out a 64-bit RISC-V processor SoC chip with tape-out as the
[Mobile phone portable]
Cool Core Microelectronics launches the world’s first 150M-GHz full-band wireless SoC, using RISC-V IP
Recently, at the 2nd Dishui Lake RISC-V Forum, Shen Bo, CTO of Shanghai Cool Core Microelectronics Co., Ltd., introduced the world's first 150M-GHz full-band wireless SoC launched by the company. This is also the first of Cool Core Microelectronics to adopt a flat head. Brother RISC-V core SoC. Shen Bo said that the
[Internet of Things]
Imagination announces RISC-V based CPU product family
Imagination Catapult CPUs use the RISC-V instruction set architecture (ISA) and are designed for heterogeneous computing solutions London, UK, December 6, 2021 - Imagination Technologies announces the Catapult series of RISC-V central processing unit (CPU) product families. These fully innovative CPU
[Embedded]
Imagination announces RISC-V based CPU product family
Can RISC-V become a force in high-performance computing?
RISC-V architecture looks set to become more common in high-performance computing (HPC) and may even become the dominant architecture, according to some technology experts in the field. At the same time, the European High Performance Computing Joint Organization (EuroHPC JU) has just announced a project to develop R
[Embedded]
Deep Vision Selects SiFive’s RISC-V IP for Next-Generation Inference Accelerator
Recently, Deep Vision selected SiFive's Intelligence X280 processor IP to provide the market with greater flexibility and AI reasoning pre-processing. SiFive, the creator and leader of RISC-V computing, recently announced that Deep Vision will integrate SiFive RISC-V processor IP into its next-generatio
[Embedded]
OpenHW builds RISC-V-based MCU development kit for IoT
The OpenHW Group and its members have released what it says is one of the most comprehensive open source RISC-V development kits in the industry. It features an OpenHW Core-V MCU, Core-V Software Development Kit (SDK) with a full-featured Eclipse Integrated Development Environment (IDE), and an open PCB d
[Embedded]
Saifang Technology teaches you how to use RISC-V development board to realize automatic line patrol driving of small cars
Recently, DFRobot has developed a line patrol car exhibit, which uses a RISC-V main control development board equipped with the Saifang Technology JH7100 (Fang Jinghong 7100) chip and runs the Fedora Linux operating system. With the support of the PinPong Python library, the Mind+ programming software is used for GP
[Embedded]
Saifang Technology teaches you how to use RISC-V development board to realize automatic line patrol driving of small cars
RISC-V has entered high performance, and mass production is the key!
This is the best RISC-V China Summit. Although it has ended for a week, the stories it spread are still exciting, the topics it triggered have not faded, and the inspiration it brought is still worth savoring. In the post-Moore era, the chip manufacturing process has encountered bottlenecks. Under the "Tick-Tock" it
[Embedded]
RISC-V has entered high performance, and mass production is the key!
Latest Industrial Control Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号