A formal verification method, electronic device and storage medium

By converting the register transmission-level model into a full-true model of the same programming language and aligning it with the fast model, the verification complexity problem caused by the differences in languages ​​in the prior art is solved, and fast and accurate functional verification is achieved.

CN118862774BActive Publication Date: 2024-12-06沐曦科技(成都)有限公司
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411342335.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-25
Publication Date
2024-12-06
Estimated Expiration
2044-09-25

AI Technical Summary

Technical Problem

In the prior art, register transmission-level code and fast model are difficult to align due to different languages, resulting in complex verification processes and error-proneness, which increases verification cycles.

Method used

Convert the register transfer-level model into a full-true model of the same programming language and align it with the fast model to verify the correctness of the two through the target test cases to ensure consistency of functions.

Benefits of technology

Simplifies the alignment process, improves verification efficiency, shortens verification cycles, and allows direct reuse of test cases, reducing the possibility of errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118862774B_ABST
    Figure CN118862774B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of chip design, and in particular to a formal verification method, electronic device and storage medium, which obtains a fast model using a first programming language; obtains a register transfer level model; converts the register transfer level model into a full-true model using the first programming language; aligns the full-true model with the fast model to obtain an aligned full-true model and an aligned fast model; verifies the correctness of the aligned fast model through a verified target test case to obtain a first test result; verifies the correctness of the aligned full-true model through the target test case to obtain a second test result; when the first test result and the second test result are exactly the same, a functionally consistent fast model and a register transfer level model are obtained. The alignment is easy, the efficiency of formal verification is improved and the cycle of formal verification is shortened.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of chip design, and in particular to a formal verification method, electronic equipment and storage medium. Background Art

[0002] In the field of chip design, the architecture of a chip system is a high-level description of the core behavior, data flow, and control logic of the chip system. Register transfer level (RTL) code is a specific hardware implementation of the architecture, which is used to manufacture actual integrated circuits. The implementation of RTL code is through hardware description languages ​​such as Verilog or VHDL, which describes the core behavior, data flow, and control logic of the architecture. A fast model is a software implementation, usually written in a high-level language such as C / C++, which is used to quickly verify the concepts of the architecture and the effectiveness of the algorithm. It focuses on simulating the behavior of the architecture while ignoring the underlying hardware details.

[0003] The purpose of formal verification is to ensure that the RTL code and the fast model are functionally equivalent. The formal verification process includes: model alignment, ensuring that the RTL code and the fast model are consistent in interface and behavior; test case verification, collecting the output results of the fast model and the RTL model by running test cases; result comparison, comparing the output results of the two to ensure that the behaviors of the two are consistent. Since the RTL code and the fast model are implemented in different types of languages, it is very difficult to align the two different languages, which is not only prone to errors but also increases the verification cycle. Therefore, a formal verification method that is easier to align is urgently needed. Summary of the invention

[0004] In view of the above technical problems, the technical solution adopted by the present invention is: a formal verification method, the method comprising the following steps:

[0005] S100: Acquire a fast model, where the fast model uses a first programming language.

[0006] S200, obtaining a register transfer level model, wherein the register transfer level model and the fast model are used to describe the same or multiple functional modules in the same system architecture.

[0007] S300, converting the register transfer level model into a full-scale model using the first programming language.

[0008] S400, aligning the full-scale model with the fast model to obtain an aligned full-scale model and an aligned fast model.

[0009] S500, verifying the correctness of the aligned fast model through a verified target test case to obtain a first test result.

[0010] S600: Verify the correctness of the aligned full-scale model through the target test case to obtain a second test result.

[0011] S700: When the first test result and the second test result are completely identical, a fast model and a register transfer level model that are consistent in function are obtained.

[0012] In addition, the present invention also provides a non-transitory computer-readable storage medium, in which at least one instruction or at least one program is stored, and the at least one instruction or the at least one program is loaded and executed by a processor to implement the above method.

[0013] In addition, the present invention also provides an electronic device, including a processor and the above-mentioned non-transitory computer-readable storage medium.

[0014] The present invention has at least the following beneficial effects:

[0015] The embodiment of the present invention provides a formal verification method, which converts a register transfer level model into a full-fledged model using the first programming language, aligns the full-fledged model with a fast model using the first programming language, and obtains an aligned full-fledged model and an aligned fast model; compares the test results after inputting the target test case into the aligned full-fledged model and the aligned fast model respectively, and when the two test results are the same, obtains a fast model and a register transfer level model that are functionally consistent. Among them, since both the full-fledged model and the fast model use the first programming language, not only is alignment easy, but the target test cases of the two can be directly reused without any adjustment, which improves the efficiency of formal verification and shortens the cycle of formal verification. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0017] Figure 1 A flow chart of a formal verification method provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0018] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0019] Unless otherwise defined, all technical and scientific terms used in the embodiments of the present invention have the same meanings as commonly understood by those skilled in the art.

[0020] See also Figure 1 , which shows a formal verification method, the method comprising the following steps:

[0021] S100: Acquire a fast model, where the fast model uses a first programming language.

[0022] Among them, the fast model is a high-level simulation model that focuses on the behavior of the system rather than the specific physical implementation details. It does not contain the underlying gate-level logic or detailed timing information, but focuses more on functional correctness and performance evaluation.

[0023] Optionally, the fast model is a behavioral model, a C / C++ / SystemC model, or other types of fast models also fall within the protection scope of the present invention.

[0024] Optionally, the first programming language is C language, C++ language or System C language. Other types of programming languages ​​also fall within the protection scope of the present invention.

[0025] S200, obtaining a register transfer level model, wherein the register transfer level model and the fast model are used to describe the same system architecture.

[0026] Among them, the Register-Transfer Level (RTL) model is a hardware description language model used to describe the data flow and control logic between registers.

[0027] It should be noted that the register transfer level model provides a detailed description of hardware behavior, including the behavior of registers and combinational logic. The fast model provides a high-level functional description, usually without specific timing or hardware implementation details. Both the register transfer level and the fast model are used to describe the same system architecture, and the functions of the two are the same.

[0028] S300, converting the register transfer level model into a full-scale model using the first programming language.

[0029] The full-true model is a hardware behavior description implemented in the first programming language, and the content of the hardware behavior description of the full-true model is exactly the same as that of the register transfer level model.

[0030] Optionally, the conversion module for converting the register transfer level model into the full-fledged model can convert the hardware description language into the first programming language.

[0031] Specifically, the conversion steps of the conversion module include:

[0032] S310, parse the code in the register transfer level model and construct a syntax tree. Specifically, parse the hardware description language code and construct an abstract syntax tree (AST). Ensure that the code complies with the hardware description language specification, and perform type checking on the syntax tree to obtain an updated syntax tree.

[0033] S320, traverse the syntax tree to generate equivalent code of the first programming language, for example, including module definition conversion, signal and variable conversion, and logic conversion, wherein the logic conversion includes conversion of combinational logic, sequential logic and process block.

[0034] S330, optimizing the equivalent code to obtain optimized equivalent code. For example, the optimization includes eliminating constant folding, dead code, etc.

[0035] S340, compile the optimized equivalent code to generate an executable file, where the executable file is a full-scale model.

[0036] Other conversion modules for converting the code in the register transfer level model into equivalent code in the first programming language all fall within the protection scope of the present invention.

[0037] S400, aligning the full-scale model with the fast model to obtain an aligned full-scale model and an aligned fast model.

[0038] Alignment refers to comparing and adjusting the full-scale model and the rapid model to make them match in function and behavior. This ensures that the RTL model and the rapid model output the same results when the same data is input to verify their consistency and accuracy.

[0039] Specifically, the alignment steps include:

[0040] S410, applying the same input data to the full-scale model and the fast model, comparing the outputs of the full-scale model and the fast model, and obtaining an output difference.

[0041] S420, analyzing the output difference and determining the root cause of the output difference.

[0042] S430: Adjust the quick model or the full-scale model according to the root cause.

[0043] S440, repeatedly executing S410 to S430 until the full-true model and the fast model exhibit consistent behaviors under all test conditions, thereby obtaining an aligned full-true model and an aligned fast model.

[0044] It should be noted that since the full-scale model and the fast model are codes of the same programming language, the alignment is less complex and easier than aligning the RTL model and the fast model.

[0045] S500, verifying the correctness of the aligned fast model through a verified target test case to obtain a first test result.

[0046] Among them, the target test case is a test case that has been repeatedly verified. Specifically, the developed test case is used to verify the specific functions or performance of the model, and the correctness of the test case itself needs to be verified. Therefore, it is necessary to run and adjust the test case multiple times so that it can accurately capture and detect the expected behavior and abnormal conditions of the model, and then obtain the target test case.

[0047] S600: Verify the correctness of the aligned full-scale model through the target test case to obtain a second test result.

[0048] The full-scale model is verified by using the test cases used to verify the fast model without any adjustment, so that the input stimuli of the fast model and the full-scale model are truly the same.

[0049] It should be noted that the RTL model and the fast model are verified separately through test cases, and the test cases need to be adaptively adjusted according to the timing, data format, simulation platform and other aspects. It is impossible to make the test cases of the RTL model and the fast model truly identical. In addition, the adjustment process not only increases the verification cycle, but also may introduce errors and the adjusted content may affect the final result.

[0050] S700: When the first test result and the second test result are completely identical, a fast model and a register transfer level model that are consistent in function are obtained.

[0051] It should be noted that when the test results are not exactly the same, it means that the functions of the fast model and the register transfer level model are inconsistent. This may be a problem with the test case itself, or there may be errors in the design of the fast model or the register transfer level model itself, which requires further inspection and verification.

[0052] As a preferred embodiment, the register transfer level model in S200 is a model that has been through design verification (Design Verification, DV).

[0053] As a preferred embodiment, S200 also includes obtaining a verification quantity threshold N specified by the user; when the number of register transfer level models that have been design-verified is N, S300-700 is executed. Specifying a suitable N can form a pipeline for design verification and S300-S700, thereby shortening the verification cycle. The minimum value of N is 1, and the maximum value is the total number of register transfer level models in the system architecture. When N is equal to the minimum value, the solution provided by the embodiment of the present invention is to execute S300-S700 according to the current register transfer level model that has completed design verification for each completed design verification of a register transfer level model. When N is equal to the maximum value, the solution provided by the embodiment of the present invention is to execute S300-S700 after completing the design verification of all register transfer level models in the system architecture.

[0054] As a preferred embodiment, S200 also includes obtaining a target time specified by a user, and executing S300-700 according to multiple register transfer level models that have been designed and verified within the target time range. Executing S300 according to the register transfer level models within the target time range specified by the user can give the user greater flexibility.

[0055] Optionally, each register transfer level model after design verification is sequentially executed with S300, and S300 and subsequent steps are verified one by one and executed one by one, which can improve the speed of the pipeline and further shorten the verification cycle. Alternatively, all register transfer level models of the system architecture are designed and verified before S300 is executed. Other methods for configuring the execution of S300 after design verification of the register transfer level model fall within the protection scope of the present invention.

[0056] Optionally, in S300, each register transfer level model will be converted into a full-fledged model, and the two correspond one to one.

[0057] In summary, an embodiment of the present invention provides a formal verification method, which converts a register transfer level model into a full-fledged model using the first programming language, aligns the full-fledged model with a fast model using the first programming language, and obtains an aligned full-fledged model and an aligned fast model; compares the test results after inputting the target test cases into the aligned full-fledged model and the aligned fast model respectively, and when the two test results are the same, obtains a functionally consistent fast model and a register transfer level model. Among them, since both the full-fledged model and the fast model use the first programming language, not only is alignment easy, but the target test cases of the two can be directly reused without any adjustment, which improves the efficiency of formal verification and shortens the cycle of formal verification.

[0058] An embodiment of the present invention also provides a non-transitory computer-readable storage medium, which can be set in an electronic device to store at least one instruction or at least one program related to implementing a method in a method embodiment. The at least one instruction or the at least one program is loaded and executed by the processor to implement the method provided in the above embodiment.

[0059] An embodiment of the present invention further provides an electronic device, comprising a processor and the aforementioned non-transitory computer-readable storage medium.

[0060] An embodiment of the present invention further provides a computer program product, which includes program code. When the program product is run on an electronic device, the program code is used to enable the electronic device to execute the steps of the method according to various exemplary embodiments of the present invention described above in this specification.

[0061] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0062] Although some specific embodiments of the present invention have been described in detail by way of example, it should be understood by those skilled in the art that the above examples are for illustration only and are not intended to limit the scope of the present invention. It should also be understood by those skilled in the art that various modifications may be made to the embodiments without departing from the scope and spirit of the present invention. The scope of the present invention is defined by the appended claims.

Claims

1. A formal verification method, characterized in that: The method comprises the following steps: S100, obtaining a fast model, where the fast model adopts a first programming language; S200, obtaining a register transfer level model, wherein the register transfer level model and the fast model are used to describe the same or multiple functional modules in the same system architecture; S300, converting the register transfer level model into a full-scale model using the first programming language; S400, aligning the full-scale model with the fast model to obtain an aligned full-scale model and an aligned fast model; S500, verifying the correctness of the aligned fast model through a verified target test case to obtain a first test result; S600, verifying the correctness of the aligned full-scale model through the target test case to obtain a second test result; S700, when the first test result and the second test result are completely identical, obtaining a fast model and a register transfer level model that are functionally consistent; Among them, S300 also includes a conversion step: S310, parsing the code in the register transfer level model and constructing a syntax tree; S320, traversing the syntax tree to generate equivalent code in the first programming language; S330, optimizing the equivalent code to obtain an optimized equivalent code; S340, compile the optimized equivalent code to generate an executable file, where the executable file is a full-scale model.

2. The method according to claim 1, characterized in that S400 also includes an alignment step: S410, applying the same input data to the full-scale model and the fast model, comparing the outputs of the full-scale model and the fast model, and obtaining an output difference; S420, analyzing the output difference and determining the root cause of the output difference; S430, adjusting the quick model or the full-scale model according to the root cause; S440, repeatedly executing S410 to S430 until the full-true model and the fast model exhibit consistent behaviors under all test conditions, thereby obtaining an aligned full-true model and an aligned fast model.

3. The method according to claim 1, characterized in that The register transfer level model in S200 is a model that has been verified by design.

4. The method according to claim 1, characterized in that: S200 also includes obtaining a verification quantity threshold N specified by a user; when the number of register transfer level models that have been verified by the design is N, S300-700 is executed.

5. The method according to claim 1, characterized in that S200 also includes obtaining a target time specified by a user, and executing S300-700 according to a plurality of register transfer level models that have been designed and verified within the target time range.

6. The method according to claim 1, characterized in that The fast model is a behavioral model.

7. The method according to claim 1, characterized in that The first programming language is C language, C++ language or SystemC language.

8. A non-transitory computer-readable storage medium, wherein at least one instruction or at least one program is stored in the storage medium, characterized in that: The at least one instruction or the at least one program is loaded and executed by the processor to implement the method according to any one of claims 1 to 7.

9. An electronic device, characterized in that: The invention comprises a processor and the non-transitory computer-readable storage medium as claimed in claim 8.

Citation Information

Patent Citations

  • System and method for verifying register transfer level (RTL) hardware

    CN102567165A

  • Method and system for verifying video algorithm register transfer level implementation

    CN104166744A

  • Chip design method, system, device and storage medium

    CN112069754A

  • Low-power verification method and device, electronic equipment and storage medium

    CN113723033A

  • Resource estimation method and device for register transfer level circuit design

    CN117077583A