Field programmable gate array (FPGA) defect inspection method based on formal verification

Through the method based on formal verification, it solves the problem that FPGA defect inspection software is not mature in China and the foreign software interface does not support Chinese. It realizes fast and automatic RTL code inspection, improves the reliability and security of the design, and provides More rigorous mathematical proofs and concrete inspection results.

CN118627439AActive Publication Date: 2024-09-10CHENGDU DIZHEN COMPUTER TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411095185.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-12
Publication Date
2024-09-10
Estimated Expiration
2044-08-12

AI Technical Summary

Technical Problem

Existing FPGA defect inspection software is not yet mature in China, and the foreign software interface does not support Chinese. It is prone to stuck states and difficult to understand rule descriptions, resulting in low efficiency of design defect inspection and affecting design reliability and safety.

Method used

Using a method based on formal verification, by loading Verilog and VHDL code, perform syntax analysis, generate syntax trees, insert assertions, generate intermediate language, scan and classify defect inspection items, dynamically plan and schedule operations, and generate inspection results and waveform sequence files , supports comprehensive and in-depth defect inspection of RTL codes of Xilinx, Altera, Lattice, and Actel chips.

Benefits of technology

It realizes fast, automatic and comprehensive inspection of RTL code structure, improves the efficiency of locating and repairing design defects, improves product reliability and safety, provides more stringent mathematical proof and specific inspection results, supports Chinese interface, and avoids It solves the problems of software stuck and difficult to understand rules description.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118627439A
    Figure CN118627439A
Patent Text Reader

Abstract

The invention discloses an FPGA (Field Programmable Gate Array) defect inspection method based on formalized verification, which comprises the following steps of: firstly loading Verilog and VHDL (Very High Definition Language) code files, performing grammar and semantic analysis, generating a grammar tree, performing logic optimization and integration, scanning design and inserting assertion, performing defect inspection based on a formalized verification method, and generating a detection result. The method can be used for realizing FPGA defect inspection software based on formalized verification, and supporting comprehensive and in-depth defect inspection on RTL codes in a XilinxAlterLatticeActel chip, and can be applied to the field programmable gate array (FPGA) defect inspection software based on formalized verification and the RTL codes in the XilinxAlterLatticeActel chip. The check based on the formalized verification method has more strict mathematical proof and more specific check results for static check, and can reproduce a verified defect path.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of FPGA testing and verification, and is suitable for defect inspection of VHDL and Verilog codes in FPGA, and in particular to an FPGA defect inspection method based on formal verification. Background Art

[0002] At present, there is basically no mature domestic EDA software company that has developed hardware description language defect checking software in the domestic business; most of the defect checking software currently used in China is in cooperation with foreign related enterprises or provides agency services. OneSpin 360 products of Germany's OneSpin Solutions are a complete FPGA verification solution that can help engineers ensure that their projects meet specifications and standards. The software provides a series of powerful tools, including formal verification, logical equivalence checking, asynchronous timing analysis, etc. These tools are based on its powerful and efficient formal verification engine to help design teams discover and solve errors and security vulnerabilities in hardware design and improve the reliability and security of the design. Questa of Mentor Graphics, USA, is an integrated circuit design and verification tool suite, mainly used for digital and analog circuit design verification and simulation. It provides a series of tools for different stages of the design process, among which Questa Formal is a formal verification tool. The functions of Questa Fromal include theorem proving, model checking, constrained random verification, etc. It can automatically analyze the design specifications and generate corresponding mathematical expressions, and then use formal verification reasoning technology to verify whether these specifications are met. However, the defects of the above technologies are that the software interface does not support Chinese, the software may get stuck, and the rule descriptions are difficult to understand. Summary of the invention

[0003] In order to quickly, automatically and comprehensively check the structure of the RTL code, a formal verification method is used to check the design defects in the code, so that designers can locate, verify and repair possible problems in the design earlier, speed up the project progress and truly improve the reliability of the product. The present invention proposes an FPGA defect inspection method based on formal verification, which includes the following steps: S1. Loading a code file, wherein the code file is Verilog and VHDL; S2. Perform syntax analysis on the code file to generate a syntax tree; optimize the syntax tree, scan the syntax tree and insert assertions; for example, for division by zero check, the assertion generator will scan all division nodes in the syntax tree, generate an assertion that the divisor is not equal to zero for each node, and insert the assertion at the location of the node; S3 generates an intermediate language, scans the intermediate language and inserts assertion information; statistics of step S2 generates and inserts the design assertion information, S4 scans the assertion information to generate a list of check items; specifically, the corresponding defect check item information is generated through the assertion information, and the defect check item information is classified and marked according to the defect type and module to which it belongs, and a list of defect check items to be tested with code information is generated; S5. Dynamically plan and schedule the operation inspection tasks, generate corresponding task input data, and collect task results; S6. Generate operation input data according to task attributes, perform check item analysis and solution operations, and generate results and waveform sequence files.

[0004] Furthermore, in S3, the code file is converted into an RTL intermediate language and assertions are inserted, and check item information is statistically generated.

[0005] Furthermore, in S2, the code file is first subjected to lexical analysis, and then syntax analysis is performed using token symbols generated by the lexical analysis to generate an abstract syntax tree.

[0006] Furthermore, the original abstract syntax tree is optimized, wherein useless signals and devices included in the original abstract syntax tree are cleared to obtain an optimized abstract syntax tree; and an intermediate language is generated according to the optimized abstract syntax tree.

[0007] Furthermore, in the process of generating the intermediate language, corresponding assertion information is inserted into the checkpoints identified according to the assertion information.

[0008] Furthermore, the method for inserting assertion information includes: Insert assertion for division by zero check; Scan to the syntax tree and find that the BLOCK3 statement block contains a division (c=a÷b); The divisor is analyzed to be b, and an assertion is generated that the divisor is not zero (assert(b != 0)). Then insert it under the BLOCK3 statement block.

[0009] Furthermore, in S5, after obtaining the configuration data and the inspection item information, the dynamic planning schedule runs the inspection task; wherein, Classify the incoming inspection items according to inspection type and task attributes, and then group them according to computer processor load. After grouping, generate independent inspection tasks and assign corresponding algorithms and solving engines to each task. After the allocation is completed, the number of tasks is dynamically planned according to the computer CPU usage, the operation of each task is monitored, and the detection results and data are collected after the task is completed.

[0010] Furthermore, the specific steps in S6 include: After receiving the assigned check items, read the corresponding input data, extract and analyze the check item assertion information; Generate solution algorithms for defect inspection items; The solution engine performs a solution according to the solution algorithm and the input data, and the obtained solution result can be analyzed to obtain the inspection result of the inspection item.

[0011] The present invention can be used to implement a FPGA defect inspection software based on formal verification, supporting comprehensive and in-depth defect inspection of RTL codes in Xilinx \Altera\Lattice\Actel chips. Inspection based on formal verification methods has more rigorous mathematical proofs, more specific inspection results, and defect paths that can be reproduced and verified for static inspection. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 This is a flow chart of a FPGA defect inspection method based on formal verification of the present invention; Figure 2 This is a flowchart of parsing and inserting assertions in an embodiment of the present invention; Figure 3 This is a flow chart of inserting assertion for division by zero in an embodiment of the present invention; Figure 4 This is a workflow diagram of a scheduling module in an embodiment of the present invention; Figure 5 This is a flowchart of the inspection item operation in an embodiment of the present invention; Figure 6 A schematic diagram of the basic principle of the BMC algorithm in an embodiment of the present invention; Figure 7 Schematic diagram of the basic principle of the K-induction algorithm in an embodiment of the present invention. DETAILED DESCRIPTION

[0013] The specific implementation manner and working principle of the present invention are further described in detail below with reference to the accompanying drawings.

[0014] This embodiment provides an FPGA defect inspection method based on formal verification. The method first loads Verilog and VHDL code files, generates a syntax tree through grammatical semantic analysis, performs logic optimization and synthesis, scans the design and inserts assertions, performs defect inspection based on formal verification methods, and generates inspection results. The specific flow chart is as follows: Figure 1 As shown, the specific description is given below.

[0015] The present invention provides a FPGA defect inspection method based on formal verification, which specifically includes the following steps: S1. Input the Verilog / VHDL module source code file into the parser module, perform syntax analysis on the HDL code, generate an abstract syntax tree, and perform logic synthesis to generate netlist data. During this process, the assertion generator scans the points in the entire design that need to be checked for defects and inserts the corresponding verification assertions.

[0016] For example, for division by zero check, the assertion generator will scan all division nodes in the syntax tree, generate an assertion that the divisor is not equal to zero for each node, and insert the assertion at the location of the node.

[0017] S2. According to the generated netlist data, the assertion information generated and inserted into the design in step S1 is counted, and then the corresponding defect check item information is generated through the assertion information. The defect check item information is classified and marked according to the defect type and the module to which it belongs, and a list of defect check items to be tested with code information is generated.

[0018] S3. Mark the inspection items that need to be inspected by selecting defect type, module or specific inspection item. After confirming the inspection items, you can set other related constraint information, such as inspection depth, clock and reset information. After the configuration is completed, according to the inspection items and inspection depth that need to be inspected, different algorithms and solution engines are assigned to the selected inspection items according to the task attributes, and then the corresponding operation configuration data is generated according to the assigned algorithm, solution engine and set constraints. The operation configuration data includes the verification algorithm used, verification depth, solution engine, and information about the inspection items to be verified.

[0019] S4. After the scheduling module obtains the operation configuration data, it will dynamically plan the number of tasks according to the computer hardware, and then start the corresponding process to check for defects. After the specific inspection process obtains the assigned task information, it generates the corresponding abstract logic description language according to the verification algorithm and the solving engine. For example, the SMT solving engine corresponds to the SMT-LIB language.

[0020] S5. After the inspection module obtains the abstract logic description language, the verification algorithm analyzes the input data and inspection items according to the preset algorithm flow to obtain the specific verification logic formula, and then uses the solution engine to solve the verification logic formula. After the verification algorithm obtains the output of the solution engine, it analyzes again to finally determine whether the inspection item is violated, and then generates the corresponding verification waveform sequence data based on the results and the solution engine data, and outputs the violation information with a detailed description.

[0021] S6. After the results of each inspection process are obtained, they are handed over to the scheduling module for statistical analysis, and the inspection results, statistical data and waveform sequences are returned to the front-end interface for display. The front-end interface displays the inspection results and statistical data in a list, and then generates a waveform graph by analyzing the waveform sequence to help users better locate defects and verify problems, allowing users to understand the problems more clearly and facilitate repairs.

[0022] In steps S1 to S2, the parser module and the intermediate language generator convert the original input code into the RTL intermediate language and insert assertions, and generate defect check item information. The specific process is as follows: Figure 2 As shown. The parser module is divided into lexical analysis and syntax analysis. The Verilog / VHDL module source code file is input into the parser module. The parser module first performs lexical analysis on the source code, and then uses the token symbols generated by the lexical analysis to perform syntax analysis, and finally generates an abstract syntax tree AST (Abstract Syntax Tree). The semantic analysis optimization module then optimizes the abstract syntax tree, cleans up useless signals and devices, and expands instantiations. The optimized syntax tree is then handed over to the intermediate language module for processing. The intermediate language module generates the intermediate language of the design (a netlist structure composed of basic devices and connections) based on the syntax tree. In the process of converting the source code to the intermediate language, the assertion generator will scan the design at different stages according to the specific assertion type, and insert the corresponding assertions at the identified checkpoints. After generating the final intermediate language with assertion information, it scans and analyzes the entire design, counts all assertions, and generates a defect check item list with configuration information. The generated intermediate language is represented by RTL, and the RTL is scanned and assertions are inserted. The specific operation of inserting assertions is as follows Figure 3 As shown, Figure 3 It includes an assertion insertion process for checking division by zero. The assertion insertion module first scans the BLOCK3 statement block in the syntax tree and finds that there is a division (c=a÷b), then analyzes the divisor to be b, and then generates an assertion that the divisor is not zero (assert(b != 0)), and then inserts it into the BLOCK3 statement block.

[0023] In step S4, after the scheduling module obtains the configuration data and inspection item information, it dynamically plans and schedules the inspection task. The specific process is as follows: Figure 4 As shown in the figure, the scheduling module classifies the incoming inspection items according to the inspection type and task attributes, and then groups them according to the number of computer processor cores. After grouping, independent inspection tasks are generated and the corresponding algorithms and solving engines are assigned to each. After the assignment is completed, the number of tasks is dynamically planned according to the computer CPU usage, the operation of each task is monitored, and the inspection results and data are collected after the task is completed.

[0024] In step S5, after the calculation and solution module receives the assigned inspection item, it reads the corresponding input data, extracts and analyzes the inspection item assertion information, and generates the corresponding solution formula for the specific inspection item. The solution engine solves according to the solution formula and input data, and the obtained solution result can be analyzed to obtain the inspection result of the inspection item. Under some inspection results, the corresponding waveform file can also be output. This part of the process is as follows Figure 5 shown.

[0025] The solution algorithm for defect check items is a formal verification algorithm, such as the BMC (bounded model checking) algorithm, the K-induction algorithm, etc. The basic idea of ​​the BMC algorithm is to transform the problem to be verified into a logical formula and solve these formulas within a given state limit to check for errors in the system. The algorithm principle is as follows Figure 6 As shown, first, state 0 to state X (the range of X is any natural number) are valid states in the system state space, where state 0 is the initial state of the system, and two adjacent states can be converted sequentially, such as state 1 is the next state of state 0 when the system is running normally. Figure 6 The verification problem is to satisfy the assertion from the initial state 0 to the state X. If the verification result is satisfied, it proves that the system will not violate this check item in the first X states. This algorithm is limited to verifying the correctness within a finite state space, and at this time, the K-induction algorithm is required.

[0026] The K-induction algorithm is a method for proving system properties, which is particularly suitable for verifying systems with infinite state spaces or unbounded ranges. Its basic principle is as follows: Figure 7 As shown in the figure, X is any natural number, n is any natural number less than or equal to X, and the verification problem is whether state X can violate the assertion when states Xn to X-1 all satisfy the assertion. If the verification result is no, the following conclusion is drawn: if the first n states of the system do not violate this check item, then the next state (n+1) must not violate this check item. After reaching this conclusion, combined with the conclusion of BMC, if X ≥ n, then this system will definitely not violate this check item.

[0027] The above description is only a specific implementation mode of the present invention. Any feature disclosed in this specification, unless otherwise stated, can be replaced by other alternative features that are equivalent or have similar purposes; all disclosed features, or all steps in the methods or processes, except for mutually exclusive features and / or steps, can be combined in any way; any non-essential additions and substitutions made by technicians in this field based on the technical features of the technical solution of the present invention belong to the protection scope of the present invention.

Claims

1. A FPGA defect inspection method based on formal verification, characterized in that: The method comprises the following steps: S1. Loading a code file, wherein the code file is Verilog and VHDL; S2. Perform syntax analysis on the code file to generate a syntax tree; optimize the syntax tree, scan the syntax tree and insert assertions; S3. Generate an intermediate language, scan the intermediate language and insert assertion information; S4. Scan the assertion information to generate a list of check items; S5. Dynamically plan and schedule the operation inspection tasks, generate corresponding task input data, and collect task results; S6. Generate operation input data according to task attributes, perform check item analysis and solution operations, and generate results and waveform sequence files.

2. The FPGA defect inspection method based on formal verification according to claim 1 is characterized in that: In S3, the code file is converted into an RTL intermediate language and assertions are inserted, and check item information is statistically generated.

3. The FPGA defect inspection method based on formal verification according to claim 1 is characterized in that: In S2, the code file is first subjected to lexical analysis, and then syntax analysis is performed using token symbols generated by the lexical analysis to generate an abstract syntax tree.

4. The FPGA defect inspection method based on formal verification according to claim 3 is characterized in that: The original abstract syntax tree is then optimized, wherein useless signals and devices included in the original abstract syntax tree are cleared to obtain an optimized abstract syntax tree; and an intermediate language is generated according to the optimized abstract syntax tree.

5. The FPGA defect inspection method based on formal verification according to claim 4 is characterized in that: In the process of generating the intermediate language, corresponding assertion information is inserted according to the checkpoints identified by the assertion information.

6. The FPGA defect inspection method based on formal verification according to claim 5, characterized in that: The method for inserting assertion information comprises: Insert assertion for division by zero check; Scan to the syntax tree and find that the BLOCK3 statement block contains a division (c=a÷b); The divisor is analyzed to be b, and an assertion is generated that the divisor is not zero (assert(b != 0)). Then insert it under the BLOCK3 statement block.

7. The FPGA defect inspection method based on formal verification according to claim 1, characterized in that: The S5 also includes the dynamic planning and scheduling of the inspection task after obtaining the configuration data and the inspection item information; wherein, Classify the incoming inspection items according to inspection type and task attributes, and then group them according to computer processor load. After grouping, generate independent inspection tasks and assign corresponding algorithms and solving engines to each task. After the allocation is completed, the number of tasks is dynamically planned according to the computer CPU usage, the operation of each task is monitored, and the detection results and data are collected after the task is completed.

8. The FPGA defect inspection method based on formal verification according to claim 7 is characterized in that: The specific steps in S6 include: After receiving the assigned check items, read the corresponding input data, extract and analyze the check item assertion information; Generate solution algorithms for defect inspection items; The solution engine performs a solution according to the solution algorithm and the input data, and the obtained solution result can be analyzed to obtain the inspection result of the inspection item.

Citation Information

Patent Citations

  • A FPGA / IP core logic code security rule detection method

    CN109032934A

  • FPGA (Field Programmable Gate Array) software testing method and equipment

    CN114661615A

  • Integrated circuit credibility verification tool and method based on FPGA design

    CN115169269A

  • Program verification method and device, equipment, medium and product

    CN118277253A