Object demand verification method and device and computer equipment

The instruction set architecture of RISC-V objects is verified through the formal verification model, which solves the problem of low verification efficiency and realizes efficient and accurate instruction set architecture verification.

CN119088713APending Publication Date: 2024-12-06ALIBABA DAMO (HANGZHOU) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411238835.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-04
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

In the RISC-V-based object verification process, the verification efficiency is low, the dynamic traversal method is limited by software and hardware resources, and the reference model is difficult to maintain.

Method used

The formal verification model is used to verify the instruction set architecture of the target object. By building a formal verification model that meets the target needs, the test results and expected results are obtained, and the verification results are compared to determine the verification results, illegal instructions are identified and processed.

Benefits of technology

It realizes efficient and accurate verification of the target object instruction set architecture ISA, improves verification efficiency, and solves the problem of low verification efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119088713A_ABST
    Figure CN119088713A_ABST
Patent Text Reader

Abstract

The invention discloses an object demand verification method and device and computer equipment. The method comprises the steps that a target demand of a target object is obtained, and the target object is a CPU IP core achieved based on an RISC-V architecture; constructing a form verification model meeting a target demand; target input information is controlled to be input into the target object, and a test result output by the target object based on a corresponding instruction set architecture ISA is obtained; inputting the target input information into the formal verification model to obtain an expected result output by the formal verification model based on the corresponding ISA; based on the test result and the expected result, a verification result of the target object is obtained, and the verification result is used for identifying whether the target object meets the target requirement or not. According to the method and the device, the technical problem that the verification efficiency is relatively low when the object based on the RISC-V is verified in the related technology is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computers, and in particular to an object requirement verification method, device and computer equipment. Background Art

[0002] RISC-V is a fully open source instruction set architecture that not only focuses on implementation on miniaturized, low-power devices, but also fully considers the competitive environment of the contemporary market to achieve full open source of the instruction set, thereby further developing the RISC-V instruction set.

[0003] However, in related technologies, when verifying RISC-V-based objects, for example, in the early design stage of the CPU IP core (for example, the non-chip stage, the hardware accelerator stage, etc.), when simulating and testing the CPU IP core, a dynamic traversal method is often used to query the entire verification space. The traversal speed is limited by the dynamic testing software and hardware resources, and the reference model is difficult to maintain.

[0004] Therefore, in the related art, when verifying RISC-V-based objects, there is a problem of low verification efficiency.

[0005] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0006] The embodiments of the present invention provide an object requirement verification method, apparatus, and computer device to at least solve the technical problem of low verification efficiency when verifying RISC-V-based objects in the related art.

[0007] According to one aspect of an embodiment of the present invention, there is provided an object requirement verification method, comprising: obtaining a target requirement of a target object, wherein the target object is a CPU IP core implemented based on a RISC-V architecture; constructing a formal verification model that meets the target requirement; controlling target input information to be input into the target object, and obtaining a test result output by the target object based on a corresponding instruction set architecture ISA; inputting the target input information into the formal verification model, and obtaining an expected result output by the formal verification model based on the corresponding ISA; and obtaining a verification result of the target object based on the test result and the expected result, wherein the verification result is used to identify whether the target object meets the target requirement.

[0008] Optionally, constructing a formal verification model that meets the target requirements includes: defining state attributes of the target object and constraints for achieving the target requirements according to the target requirements; and generating the formal verification model that meets the target requirements based on the state attributes and the constraints.

[0009] Optionally, defining the state attributes of the target object and the constraints for achieving the target requirements based on the target requirements includes: selecting a formal verification tool, wherein the formal verification tool supports at least one of the following: configuration of the instruction set, selection of the data bit width, software switch state, and user state permission setting; determining at least one of the following corresponding to the target requirement: a target instruction set, a target data bit width, a target software switch state, and a target user state permission; and defining the state attributes of the target object and the constraints for achieving the target requirements based on at least one of the following: the target instruction set, the target data bit width, the target software switch state, and the target user state permission.

[0010] Optionally, the target instruction set includes: illegal instructions, wherein the type of the illegal instructions includes at least one of the following: undefined instructions, reserved instructions for extension, malformed instructions, and privileged instructions that can only be executed in target mode.

[0011] Optionally, constructing a formal verification model that meets the target requirements includes: obtaining a description document of the target requirements; verifying the description document to obtain a verification result; and if the verification result passes, constructing the formal verification model that meets the target requirements.

[0012] Optionally, obtaining the verification result of the target object based on the test result and the expected result includes: comparing the expected result with the output results corresponding to each instruction in the test result; and determining that the instruction in the target object whose output result in the test result is different from the corresponding output result in the expected result is the illegal instruction.

[0013] Optionally, the illegal instruction is an instruction that cannot be recognized or executed by the target object.

[0014] Optionally, the method further includes: performing at least one of the following processing on the illegal instruction: identifying the illegal instruction, simulating the illegal instruction, terminating the program corresponding to the illegal instruction, and debugging the program corresponding to the illegal instruction.

[0015] Optionally, constructing a formal verification model that meets the target requirements includes: acquiring a verification level of the target requirements of the target object; and constructing the formal verification model that meets the target requirements based on the verification level.

[0016] According to another aspect of the present invention, an object requirement verification device is provided, comprising: a first acquisition module, used to acquire a target requirement of a target object, wherein the target object is a CPU IP core implemented based on a RISC-V architecture; a construction module, used to construct a formal verification model that meets the target requirement; a control module, used to control target input information to be input into the target object, and obtain a test result of the target object based on an output of a corresponding instruction set architecture ISA; a second acquisition module, used to input the target input information into the formal verification model, and obtain an expected result of the formal verification model based on an output of the corresponding ISA; and a third acquisition module, used to obtain a verification result of the target object based on the test result and the expected result, wherein the verification result is used to identify whether the target object meets the target requirement.

[0017] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute any one of the object requirement verification methods described above.

[0018] According to another aspect of an embodiment of the present invention, there is provided a computer device, comprising: a memory and a processor, wherein the memory stores a computer program; the processor is used to execute the computer program stored in the memory, wherein when the computer program is run, the processor executes any one of the object requirement verification methods described above.

[0019] In an embodiment of the present invention, a formal verification model is used to verify the instruction set architecture ISA corresponding to the target object, thereby achieving the purpose of verifying the target object. Since the formal verification model can verify the contents of the instruction set architecture ISA included in the target object at one time, that is, the formal verification model is used to verify accurately and efficiently. Compared with the related art that requires verifying the contents of the ISA one by one, the technical effect of efficiently and accurately identifying the instruction set architecture ISA corresponding to the target object is effectively achieved, thereby solving the technical problem of low verification efficiency when verifying RISC-V-based objects in the related art. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0021] Figure 1 A hardware structure block diagram of a computer terminal (or mobile device) for implementing an object requirement verification method is shown;

[0022] Figure 2 is a flowchart of an object requirement verification method according to Embodiment 1 of the present invention;

[0023] Figure 3 is a flow chart of a RISC-V illegal instruction verification method based on formal verification methodology according to an optional implementation of the present invention;

[0024] Figure 4 is a structural block diagram of an object requirement verification device provided according to an embodiment of the present invention;

[0025] Figure 5 It is a structural block diagram of a computer terminal according to an embodiment of the present invention. DETAILED DESCRIPTION

[0026] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings 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 ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0028] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following explanations:

[0029] Formal verification method (Formal), formal verification method is a verification method used to verify whether a digital circuit or software design meets its specifications or requirements. In the formal verification method, the design is represented as a mathematical model, and then verified using a formal verification tool to determine whether the model meets its specifications. The use of formal verification includes the following steps: Write RTL (Register Transfer Level) code or code in a high-level description language to represent the design. Use a formal verification tool to model the design and convert it into a verifiable mathematical model. Define specifications or requirements to describe the conditions that the design should meet. Use a formal verification tool to model the specifications and convert them into a verifiable mathematical model. Use a formal verification tool to compare the design model and the specification model to check whether the design meets the specifications. According to the verification results, if the design meets the specifications, it can be concluded that the design is correct; if the design does not meet the specifications, possible problems can be found and repaired. Compared with the traditional simulation verification method, it has higher reliability and accuracy because it uses mathematical proofs to verify the correctness of the design.

[0030] Verilog HDL is a hardware description language that describes the structure and behavior of digital system hardware in text form. It can be used to represent logic circuit diagrams, logic expressions, and the logical functions performed by digital logic systems.

[0031] Instruction Set Architecture (ISA), also known as architecture or system architecture, is a complete definition of the interface between software and hardware. ISA defines the set of all instructions that a computer can execute. Each instruction specifies what operation the computer performs, the address space where the operands processed are stored, and the type of operands. The contents specified by ISA include data types and formats, instruction formats, addressing methods and the size of accessible address spaces, the number of registers accessible by programs, the number of bits and numbers, the definition of control registers, the compilation method of I / O space, the interrupt structure, the definition and switching of machine working states, the input and output structure and data transmission methods, storage protection methods, etc. Therefore, it can be seen that the instruction set architecture refers to the part that can be perceived by software, also known as the software visible part.

[0032] RISC-V (pronounced "RISC-FIVE") is an open instruction set architecture (ISA) based on the principles of reduced instruction set computing (RISC). V stands for the fifth generation of RISC (reduced instruction set computer), indicating that there have been four generations of RISC processor prototype chips. In contrast to most ISAs, the RISC-V ISA can be used for free in all desired devices, allowing anyone to design, manufacture and sell RISC-V chips and software. Although RISC-V is not the first open source instruction set (ISA), it is the first instruction set architecture designed to be suitable for specific scenarios. Based on the RISC-V instruction set architecture, server CPUs, home appliance CPUs, industrial control CPUs and CPUs used in sensors smaller than a finger can be designed.

[0033] Illegal instruction, undefined instruction code or instruction that is not supported by the hardware or software status.

[0034] Instruction mnemonics, since the hardware can only recognize 1 and 0, it is necessary to use binary opcodes, but it is very troublesome to write programs in binary. In order to facilitate writing and reading programs, each instruction is usually represented by 3 or 4 English abbreviations. This abbreviation code is called an instruction mnemonic.

[0035] YAML is a highly readable format for expressing data serialization. YAML is a recursive abbreviation of "YAML Ain't a Markup Language". When the language was developed, YAML actually meant "Yet Another Markup Language", but in order to emphasize that the language is data-centric rather than markup-centric, it was renamed with the reverse abbreviation.

[0036] Example 1

[0037] According to an embodiment of the present invention, an embodiment of an object requirement verification method is also provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0038] The method embodiment provided in Embodiment 1 of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 FIG. 1 shows a hardware structure block diagram of a computer terminal (or mobile device) for implementing an object requirement verification method. Figure 1As shown, the computer terminal 10 (or mobile device) may include one or more processors (102a, 102b, ..., 102n are used to illustrate the figure, and the processor may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission device for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.

[0039] It should be noted that the one or more processors and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10 (or mobile device). As involved in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0040] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the object requirement verification method in the embodiment of the present invention. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, realizing the vulnerability detection method of the above-mentioned application program. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0041] The transmission device is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0042] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).

[0043] In view of the above problems, under the above operating environment, this application provides the following Figure 2 The object requirements validation method shown. Figure 2 1 is a flow chart of the object requirement verification method according to Embodiment 1 of the present invention. Figure 2 As shown, the method comprises the following steps:

[0044] Step S202, obtaining target requirements of a target object, wherein the target object is a CPU IP core implemented based on a RISC-V architecture;

[0045] Step S204, constructing a formal verification model that meets the target requirements;

[0046] Step S206, controlling the target input information to be input into the target object, and obtaining the test result output by the target object based on the corresponding instruction set architecture ISA;

[0047] Step S208, inputting the target input information into the formal verification model to obtain the expected result output by the formal verification model;

[0048] Step S210, obtaining a verification result of the target object based on the test result and the expected result, wherein the verification result is used to identify whether the target object meets the target requirement.

[0049] Through the above embodiments, the purpose of verifying the target object is achieved by using a formal verification model to verify the instruction set architecture ISA corresponding to the target object. Since the formal verification model can verify the contents of the instruction set architecture ISA included in the target object at one time, that is, the formal verification model is used to verify accurately and efficiently. Compared with the related art that requires verifying the contents of the ISA one by one, the technical effect of efficiently and accurately identifying the instruction set architecture ISA corresponding to the target object is effectively achieved, thereby solving the technical problem of low verification efficiency when verifying RISC-V-based objects in the related art.

[0050] As an optional embodiment, constructing a formal verification model that meets the target requirements may include multiple ways. For example, the state attributes of the target object and the constraints for achieving the target requirements may be defined according to the target requirements; then, based on the state attributes and the constraints, a formal verification model that meets the target requirements is generated. Since the formal verification model defines the state attributes and constraints based on the target requirements, the generated formal verification model can fully meet the target requirements.

[0051] As an optional embodiment, when defining the state attributes of the target object and the constraints for achieving the target requirements according to the target requirements, it can be generated by directly defining it, or it can be generated based on a formal verification tool. In order to further improve the generation efficiency of the model and the diversity of flexible selection, the state attributes of the target object and the constraints for achieving the target requirements can be defined based on a formal verification tool that supports configuration. For example, a formal verification tool can be selected first, wherein the formal verification tool supports at least one of the following: configuration of the instruction set, selection of data bit width, software switch state, and user state permission setting; determine at least one of the following corresponding to the target requirements: target instruction set, target data bit width, target software switch state, and target user state permission; based on at least one of the following, define the state attributes of the target object and the constraints for achieving the target requirements: the target instruction set, the target data bit width, the target software switch state, and the target user state permission. The use of a formal verification tool to define the state attributes of the target object and the way to achieve the constraints of the target requirements can further improve the model generation efficiency because the formal verification tool can save time to a certain extent. In addition, since formal verification tools support configuration of instruction sets, selection of data bit width, software switch status, and user-mode permission settings, they can also improve the flexibility of generating formal verification models to a certain extent.

[0052] As an optional embodiment, the configuration of the above-mentioned instruction set includes the configuration of instruction sets under multiple illegal scenarios. For example, the supported instruction sets include RV64IMFAD, RV32IMFAD, etc., where the numbers represent the data bit widths implemented by the hardware, and the letters represent the optional instruction set contents. Different bit widths and different instruction set selections may affect different illegal scenarios. In addition, each instruction set can also set a variety of software switches. When the software switch is turned off, even if the hardware can be implemented, it will still be judged as an illegal instruction. Furthermore, each instruction set may have expectations for the current software status, such as execution status, user state permissions, etc., and once violated, it will be considered an illegal instruction.

[0053] As an optional embodiment, the target instruction set includes: illegal instructions, wherein the type of illegal instructions includes at least one of the following: undefined instructions, reserved instructions for extension, malformed instructions, and privileged instructions that can only be executed in target mode. It should be noted that the above types of illegal instructions are only examples and are not exhaustive.

[0054] As an optional embodiment, the target object is a CPU IP core implemented based on the RISC-V architecture, wherein the full name of the CPU IP core is Central Processing Unit, Intellectual Property, central processing unit intellectual property core. The target object can be used in a data center implemented based on the RISC-V architecture, can be used in a personal computer PC implemented based on the RISC-V architecture, and can also be used in other mobile devices implemented based on the RISC-V architecture, such as mobile phones, PADs, etc. The object requirement verification method described in the embodiment of the present invention is used to verify the CPU IP core. Afterwards, the verification of the CPU IP core is a preliminary product of a hardware device, and the CPU IP core after the verification can be used to produce a hardware device.

[0055] As an optional embodiment, based on the above description, the process of building a formal verification model that meets the target requirements is briefly described below. First, a Python script can be used to extract the instruction set information supported by the CPU IP core corresponding to the target object, search for the corresponding instruction encoding information according to the instruction mnemonics in the instruction set, identify the various main encoding fields, and optionally organize and summarize them in a YAML file. Afterwards, according to the implementation, the YAML file is supplemented by the instruction mnemonic search so that its information meets the test requirements. Furthermore, a Python script is used to translate the YAML file storing complete ISA instruction information into an SV model (formal verification model) compiled by controllable tool analysis.

[0056] As an optional embodiment, when constructing a formal verification model that meets the target requirements, in order to improve the success rate of subsequent verification, before constructing the formal verification model that meets the target requirements, first obtain the description document of the target requirements; verify the description document to obtain the verification result; if the verification result passes, construct the formal verification model that meets the target requirements. Before the formal verification model that meets the target requirements, the description document of the target requirements is first verified. Since the existing design problems and logic problems can be clearly found when verifying the description document of the target requirements, subsequent verification errors caused by errors caused by the description document can be effectively avoided, that is, verification errors caused by errors in the verification standard can be effectively avoided. In this optional embodiment, since the description document as the target requirement is verified before the target object is verified based on the formal verification model, on the one hand, the inaccuracy problem of verifying the target object caused by standard errors is effectively solved, and on the other hand, it can also effectively realize the verification of both the target object and the target requirement, thereby improving the verification accuracy and efficiency.

[0057] As an optional embodiment, when obtaining the verification result of the target object based on the test result and the expected result, a variety of methods can be used. For example, the expected result can be compared with the output results corresponding to each instruction in the test result; then, the instruction in the target object whose output result in the test result is different from the corresponding output result in the expected result is determined to be an illegal instruction. Directly identifying different processing results as illegal instructions can directly and simply realize the identification of illegal instructions.

[0058] In the related art, in the RISC-V specification, due to instruction encoding, processor hardware and software status, etc., specific instruction encoding may be defined as illegal instructions. Such instructions do not produce execution results and report exceptions. Illegal instruction exceptions are common verification difficulties in the verification process. The main impact is reflected in: illegal instructions are identified as legal instructions, resulting in unexpected execution results and underreporting of exception information. Illegal instructions are partially identified as legal instructions, causing the decoding and transmission units to issue instructions, but the execution unit cannot recognize them, causing the execution unit to get stuck or affecting other normal execution instructions. It may affect the normal execution of instruction streams and speculative execution of instruction streams, which are difficult to circumvent through software means.

[0059] As an optional embodiment, the illegal instruction is an instruction that cannot be recognized or executed by the target object.

[0060] As an optional embodiment, after identifying an illegal instruction, processing can be performed on the illegal instruction, and the executed processing can also include multiple types, for example, it can include at least one of the following processing: marking the illegal instruction, simulating the illegal instruction, terminating the program corresponding to the illegal instruction, and debugging the program corresponding to the illegal instruction.

[0061] As an optional embodiment, when constructing a formal verification model that meets the target requirements, the target object can be verified according to the verification requirements. It should be noted that the target requirements of the target object may include multiple sub-requirements, and the sub-requirements may correspond to multiple levels, that is, the division of sub-requirements may be based on the levels. Therefore, when constructing a formal verification model that meets the target requirements, the following method can be adopted: obtain the verification level of the target requirements of the target object; based on the verification level, construct a formal verification model that meets the target requirements. The above-mentioned verification level can be a performance of the target object, or a group of functions of the target object, or the entire system corresponding to the target object. The above-mentioned verification level can be flexibly selected based on the verification requirements.

[0062] The RISCCV illegal instruction verification method based on formal verification methodology provided by the above embodiment can realize efficient verification of illegal instruction scenarios in the RISC-V instruction set. It is difficult for the related art verification scheme to completely cover and count all coding spaces and corresponding hardware and software configurations. The verification method based on formal verification methodology (Formal) proposed in the embodiment of the present invention can efficiently manage the generation model according to the verification requirements and realize the full-space verification of illegal instruction-related scenarios. The implementation scheme of the present invention can be reused in any project using the RISC-V architecture.

[0063] Based on the above embodiment and optional embodiment, an optional implementation is provided. In this optional implementation, a RISC-V illegal instruction verification method based on formal verification methodology is proposed. Figure 3 is a flow chart of a RISC-V illegal instruction verification method based on formal verification methodology according to an optional embodiment of the present invention, such as Figure 3 As shown, the process of this optional implementation includes the following steps.

[0064] Step S1, generate an instruction encoding comparison model that can be used for formal verification. In this optional implementation, FPV in formal verification is used for proof, and the model is required to be a synthesizable SV model. The model of this optional implementation is based on the open source ISS (instruction set simulation) tool spike developed for RISC-V, and a set of model translation tools based on Python language are written and implemented, which can realize the configuration of instruction sets according to the verification object (i.e. the above-mentioned target object), the screening of data bit width (the size of the amount of data that can be processed at one time), and the generation of YAML that can be indexed based on instruction mnemonics, and the SV model including all valid coding information.

[0065] Among them, Formal property verification (FPV for short), at a high level, is a method used to prove that a set of properties defined in SystemVerilog assertions or similar languages ​​are satisfied for a given RTL fragment.

[0066] The input to FPV is: an RTL model; a set of properties to be proved: assertions and coverpoints; a set of constraints: assumptions, plus clock and reset definitions.

[0067] The FPV tool mathematically analyzes the space of all possible logic execution paths on the target model based on the constraints passed in. Unlike simulation, it does not check specific signal values: all possible legal values ​​are immediately checked under the current constraints.

[0068] The output of FPV typically includes: a list of proven properties: proven assertions and unreachable coverpoints; for each failed assertion or reachable coverpoint, a waveform showing the failure / reachability situation; a list of bounded or inconclusive proofs: assertions and covers that were not explicitly proven or not proven.

[0069] Step S2, based on the information arrangement and supplement mechanism of instruction mnemonics, supplements the data content of the yaml language generated based on iss. Because the data content generated based on iss only includes instruction encoding information and hardware configuration screening results, it is still necessary to supplement for other illegal scenes. By supplementing the data content generated based on iss, it is realized that the instruction content can be indexed and managed in the form of instruction set and instruction mnemonics. In addition to recording the legal encoding of instructions in the corresponding instruction mnemonic table item, other illegal scenes such as software configuration, register overlap and other information of supplementary instructions can also be effectively expanded. Afterwards, the data of the yaml language after optimization and supplementation is converted into a model (i.e., formal verification control model (or referred to as the formal verification model referred to above)) based on the system veri log hardware description language, which can be used for the final comparison of formal. It should be noted that the optimization process realized in this step can also directly adopt the model generation process in step S1, and the corresponding data information is combined with the information in step S1 to be processed as a formal verification control model. It should be noted that the above-mentioned various languages ​​(for example, yaml language, json language and system veri log language) are all optional.

[0070] It should be noted that in RISC-V, "illegal instructions" refer to instructions that the processor cannot recognize or execute. When the CPU encounters an illegal instruction, an exception is triggered, called an "illegal instruction exception."

[0071] According to the reasons for illegal instructions, in the optional implementation of the present invention, there are multiple illegal scenarios that need to be supplemented. For example, the supplement of illegal content of RV64 / 32GCVB includes at least one of the following:

[0072] Undefined instructions: The RISC-V architecture allows custom extended instruction sets. If the processor encounters an extended instruction that it does not support, it will be considered an illegal instruction.

[0073] Reserved instructions: Some instruction codes are reserved by the RISC-V architecture for future expansion. If the processor encounters a reserved instruction code, it will also be considered an illegal instruction.

[0074] Incorrect instruction format: Each RISC-V instruction must follow a specific format. If the instruction format is incorrect, the processor will treat it as an illegal instruction.

[0075] Privileged mode: Some instructions can only be executed in a specific processor mode, such as machine mode. If a privileged instruction is executed in non-privileged mode, an illegal instruction exception will also be triggered.

[0076] Illegal instruction exception handling:

[0077] Step S3, integrate the generated control model with the verification object, and check the correctness of the illegal judgment logic through the formal verification tool FPV. Because the control model is implemented strictly in accordance with the RISC-V specification and includes common illegal exception scenarios of instructions, verification processes can support verifications of different levels such as BT (Block Test), IT (Integrated Test), and ST (System Test). The verification process only needs to configure the above steps S1 and S2 according to the actual implementation of the verification object to generate the corresponding verification comparison model. The verifier needs to determine the verification level and cut the verification object according to the complexity of the verification object. Use the formal verification tool to explore illegal scenarios for the purpose of full convergence or bug hunting ing on the verification object, and compare whether the judgment results of the illegal instructions of the verification object and the control model are consistent. In the process of verification with full convergence as the goal, the exploration verification of the entire space of illegal instructions can be guaranteed by means of constraint analysis and checker coverage of formal verification, combined with the exploration algorithm of the formal tool itself.

[0078] When an illegal instruction exception occurs, the processor jumps to a predefined exception handler. The exception handler can take the following actions:

[0079] Identifying illegal instructions: By analyzing the values ​​of the program counter and other registers when the exception occurs, it is possible to determine which instruction caused the exception.

[0080] Emulating instructions: If the illegal instruction is caused by an unsupported extended instruction, the exception handler can try to emulate the behavior of that instruction.

[0081] Terminate the program: The exception handler may choose to terminate the program if it cannot handle the illegal instruction.

[0082] Debugging: Illegal instruction exceptions usually indicate a program error. Exception handlers can provide debugging information to help programmers locate and fix errors.

[0083] Therefore, illegal instructions are instructions that the RISC-V processor cannot recognize or execute. Understanding the causes and handling of illegal instructions is essential to writing correct and robust RISC-V programs.

[0084] In the above optional implementation, the illegal instruction database under the software and hardware configuration is completely maintained. The model maintenance is completely based on the RISC-V specification description, does not depend on the verification level and verification object and the actual implementation, does not require repeated development for different objects, and does not require the tester to organize and write test stimuli. Because the verification model generation operation is simple, the relevant function testing can be put into practice in the early stage of the verification object development.

[0085] In addition, the verification scheme in the above optional implementation is based on the methodology of formal verification, which can ensure the coverage of the verification space on the basis of analyzing the constraints and checker rationality. Formal verification can efficiently explore the verification space, and the verification speed is fast. Only the formal verification FPV tool license is required, and no additional hardware resources are required to complete the relevant verification. Therefore, efficient model maintenance of illegal instructions can be achieved, and functional models can be flexibly and quickly generated according to verification requirements, so as to achieve efficient comparison and verification based on formal verification methodology.

[0086] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.

[0087] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a computer-readable storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods of various embodiments of the present invention.

[0088] Example 2

[0089] According to an embodiment of the present invention, there is also provided a device for implementing the above object requirement verification. Figure 4 is a structural block diagram of an object requirement verification device provided according to an embodiment of the present invention, such as Figure 4 As shown, the device includes: a first acquisition module 42, a construction module 44, a control module 46, a second acquisition module 48 and a third acquisition module 40. The device is described below.

[0090] A first acquisition module 42 is used to acquire target requirements of a target object, wherein the target object is a CPU IP core implemented based on a RISC-V architecture; a construction module 44 is connected to the first acquisition module 42, and is used to construct a formal verification model that meets the target requirements; a control module 46 is used to control target input information to be input into the target object, and obtain a test result of the target object based on the output of a corresponding instruction set architecture ISA; a second acquisition module 48 is connected to the construction module 44, and is used to input the target input information into the formal verification model, and obtain an expected result of the formal verification model based on the output of the corresponding ISA; a third acquisition module 40 is connected to the control module 46 and the second acquisition module 48, and is used to obtain a verification result of the target object based on the test result and the expected result, wherein the verification result is used to identify whether the target object meets the target requirements.

[0091] It should be noted that the first acquisition module 42, construction module 44, control module 46, second acquisition module 48 and third acquisition module 40 correspond to steps S202 to S210 in Example 1, and the examples and application scenarios implemented by the modules and the corresponding steps are the same, but are not limited to the contents disclosed in the above-mentioned Example 1. It should be noted that the above-mentioned modules as part of the device can be run in the computer terminal 10 provided in Example 1.

[0092] Example 3

[0093] The embodiment of the present invention can provide a computer terminal, which can be any computer terminal device in a computer terminal group. Optionally, in this embodiment, the computer terminal can also be replaced by a terminal device such as a mobile terminal.

[0094] Optionally, in this embodiment, the computer terminal may be located in at least one network device among a plurality of network devices of the computer network.

[0095] In this embodiment, the above-mentioned computer terminal can execute the program code of the following steps in the object requirement verification method of the application: obtaining the target requirement of the target object, wherein the target object is a CPU IP core implemented based on the RISC-V architecture; constructing a formal verification model that meets the target requirement; controlling the target input information to be input into the target object, and obtaining the test result of the target object based on the corresponding instruction set architecture ISA output; inputting the target input information into the formal verification model, and obtaining the expected result of the formal verification model based on the corresponding ISA output; based on the test result and the expected result, obtaining the verification result of the target object, wherein the verification result is used to identify whether the target object meets the target requirement.

[0096] Optionally, Figure 5 is a structural block diagram of a computer terminal according to an embodiment of the present invention. Figure 5 As shown, the computer terminal may include: one or more (only one is shown in the figure) processors 502, a memory 504, and the like.

[0097] Among them, the memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the object requirement verification method and device in the embodiment of the present invention. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, realizing the above-mentioned object requirement verification method. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the computer terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0098] The processor can call the information and application programs stored in the memory through the transmission device to execute the following steps: construct a formal verification model that meets the target requirements, including: defining the state attributes of the target object and the constraints for achieving the target requirements according to the target requirements; based on the state attributes and the constraints, generating a formal verification model that meets the target requirements.

[0099] Optionally, the processor may also execute program code of the following steps: constructing a formal verification model that meets target requirements, including: defining state attributes of the target object and constraints for achieving the target requirements according to the target requirements; and generating a formal verification model that meets the target requirements based on the state attributes and constraints.

[0100] Optionally, the processor may also execute program code for the following steps: defining, according to target requirements, state attributes of the target object and constraints for achieving the target requirements, including: selecting a formal verification tool, wherein the formal verification tool supports at least one of the following: configuration of an instruction set, selection of a data bit width, software switch state, and user state permission setting; determining at least one of the following corresponding to the target requirement: a target instruction set, a target data bit width, a target software switch state, and a target user state permission; and defining, based on at least one of the following, the state attributes of the target object and constraints for achieving the target requirements: a target instruction set, a target data bit width, a target software switch state, and a target user state permission.

[0101] Optionally, the processor may also execute the program code of the following steps: the target instruction set includes: illegal instructions, wherein the types of illegal instructions include at least one of the following: undefined instructions, reserved instructions for extension, malformed instructions, and privileged instructions that can only be executed in target mode.

[0102] Optionally, the processor may also execute program code of the following steps: constructing a formal verification model that meets the target requirements, including: obtaining a description document of the target requirements; verifying the description document to obtain a verification result; and if the verification result passes, constructing a formal verification model that meets the target requirements.

[0103] Optionally, the processor may also execute program code of the following steps: obtaining verification results of the target object based on the test results and expected results, including: comparing the expected results with the output results corresponding to each instruction in the test results; and determining that the instructions in the target object whose output results in the test results are different from the corresponding output results in the expected results are illegal instructions.

[0104] Optionally, the processor may also execute program code of the following steps: an illegal instruction is an instruction that cannot be recognized or executed by the target object.

[0105] Optionally, the processor may also execute program code of the following steps: performing at least one of the following processing on illegal instructions: marking illegal instructions, simulating illegal instructions, terminating the program corresponding to the illegal instructions, and debugging the program corresponding to the illegal instructions.

[0106] Optionally, the processor may also execute program code of the following steps: constructing a formal verification model that meets target requirements, including: obtaining a verification level of the target requirements of the target object; and constructing a formal verification model that meets the target requirements based on the verification level.

[0107] By adopting the embodiment of the present invention, a solution for object requirement verification is provided. By adopting a formal verification model to verify the instruction set architecture ISA corresponding to the target object, the purpose of verifying the target object is achieved. Since the formal verification model can verify the contents of the instruction set architecture ISA included in the target object at one time, that is, the characteristics of accurate and efficient verification by adopting the formal verification model, compared with the need to verify the contents in the ISA one by one in the related art, the technical effect of efficiently and accurately identifying the instruction set architecture ISA corresponding to the target object is effectively achieved, thereby solving the technical problem of low verification efficiency when verifying RISC-V-based objects in the related art.

[0108] Those skilled in the art will appreciate that the structure shown in the figure is for illustration only, and the computer terminal may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a handheld computer, a mobile Internet device (MID), a PAD, or other terminal devices. Figure 5 The structure of the electronic device is not limited. For example, the computer terminal 10 may also include Figure 5 More or fewer components (such as network interfaces, display devices, etc.) shown in, or having Figure 5 Different configurations are shown.

[0109] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, which can include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0110] Example 4

[0111] The embodiment of the present invention further provides a computer-readable storage medium. Optionally, in this embodiment, the computer-readable storage medium can be used to store the program code executed by the object requirement verification method provided in the first embodiment.

[0112] Optionally, in this embodiment, the computer-readable storage medium may be located in any one of the computer terminals in a computer terminal group in a computer network, or in any one of the mobile terminals in a mobile terminal group.

[0113] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: obtaining target requirements for a target object, wherein the target object is a CPU IP core implemented based on a RISC-V architecture; constructing a formal verification model that meets the target requirements; controlling target input information to be input into the target object, and obtaining a test result output by the target object based on a corresponding instruction set architecture ISA; inputting the target input information into the formal verification model, and obtaining an expected result output by the formal verification model based on the corresponding ISA; obtaining a verification result of the target object based on the test results and the expected results, wherein the verification result is used to identify whether the target object meets the target requirements.

[0114] Optionally, in this embodiment, the computer-readable storage medium is also configured to store program code for executing the following steps: constructing a formal verification model that meets target requirements, including: defining state attributes of the target object and constraints for achieving the target requirements according to the target requirements; and generating a formal verification model that meets the target requirements based on the state attributes and constraints.

[0115] Optionally, in this embodiment, the computer-readable storage medium is also configured to store program code for executing the following steps: defining the state attributes of the target object and the constraints for achieving the target requirements according to the target requirements, including: selecting a formal verification tool, wherein the formal verification tool supports at least one of the following: configuration of the instruction set, selection of the data bit width, software switch state, and user state permission setting; determining at least one of the following corresponding to the target requirement: target instruction set, target data bit width, target software switch state, and target user state permissions; defining the state attributes of the target object and the constraints for achieving the target requirements based on at least one of the following: target instruction set, target data bit width, target software switch state, and target user state permissions.

[0116] Optionally, in this embodiment, the computer-readable storage medium is also configured to store program code for executing the following steps: the target instruction set includes: illegal instructions, wherein the type of illegal instructions includes at least one of the following: undefined instructions, reserved instructions for extension, malformed instructions, and privileged instructions that can only be executed in target mode.

[0117] Optionally, in this embodiment, the computer-readable storage medium is also configured to store program code for executing the following steps: constructing a formal verification model that meets the target requirements, including: obtaining a description document of the target requirements; verifying the description document to obtain a verification result; and if the verification result passes, constructing a formal verification model that meets the target requirements.

[0118] Optionally, in this embodiment, the computer-readable storage medium is also configured to store program code for executing the following steps: obtaining a verification result of the target object based on the test results and the expected results, including: comparing the expected results with the output results corresponding to each instruction in the test results; determining that the instructions in the target object whose output results in the test results are different from the corresponding output results in the expected results are illegal instructions.

[0119] Optionally, in this embodiment, the computer-readable storage medium is further configured to store program codes for executing the following steps: illegal instructions are instructions that cannot be recognized or executed by the target object.

[0120] Optionally, in this embodiment, the computer-readable storage medium is also configured to store program code for executing the following steps: performing at least one of the following processing on the illegal instructions: identifying the illegal instructions, simulating the illegal instructions, terminating the program corresponding to the illegal instructions, and debugging the program corresponding to the illegal instructions.

[0121] Optionally, in this embodiment, the computer-readable storage medium is also configured to store program code for executing the following steps: constructing a formal verification model that meets target requirements, including: obtaining a verification level of the target requirements of the target object; based on the verification level, constructing a formal verification model that meets the target requirements.

[0122] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0123] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0124] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0125] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0126] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0127] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a computer-readable storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned computer-readable storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.

[0128] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A method for object requirement verification, characterized in that: include: Obtain target requirements of a target object, wherein the target object is a CPU IP core implemented based on a RISC-V architecture; Construct a formal verification model that meets the target requirements; Controlling target input information to be input into the target object, and obtaining a test result output by the target object based on a corresponding instruction set architecture ISA; Inputting the target input information into the formal verification model to obtain an expected result of the formal verification model based on the corresponding ISA output; Based on the test result and the expected result, a verification result of the target object is obtained, wherein the verification result is used to identify whether the target object meets the target requirement.

2. The method according to claim 1, characterized in that The constructing of a formal verification model that meets the target requirements includes: According to the target requirement, define the state attributes of the target object and the constraint conditions for achieving the target requirement; Based on the state attributes and the constraint conditions, the formal verification model that meets the target requirements is generated.

3. The method according to claim 2, characterized in that Defining the state attributes of the target object and the constraint conditions for achieving the target requirement according to the target requirement includes: Select a formal verification tool, wherein the formal verification tool supports at least one of the following: configuration of an instruction set, selection of a data bit width, software switch status, and user state permission setting; Determine at least one of the following corresponding to the target requirement: a target instruction set, a target data bit width, a target software switch state, and a target user state permission; The state attributes of the target object and the constraints for achieving the target requirements are defined based on at least one of the following: the target instruction set, the target data bit width, the target software switch state and the target user state permissions.

4. The method according to claim 3, characterized in that: The target instruction set includes: illegal instructions, wherein the type of the illegal instructions includes at least one of the following: undefined instructions, reserved instructions for extension, instructions with incorrect formats, and privileged instructions that can only be executed in target mode.

5. The method according to claim 1, characterized in that The constructing of a formal verification model that meets the target requirements includes: Obtaining a description document of the target requirement; Verifying the description document to obtain a verification result; When the verification result passes, the formal verification model that meets the target requirements is constructed.

6. The method according to claim 1, characterized in that The obtaining, based on the test result and the expected result, a verification result of the target object includes: Compare the expected result with the output results corresponding to each instruction in the test result; Determine in the target object that an instruction whose output result in the test result is different from a corresponding output result in the expected result is the illegal instruction.

7. The method according to claim 6, characterized in that The illegal instructions are instructions that cannot be recognized or executed by the target object.

8. The method according to claim 6, characterized in that The method further comprises: performing at least one of the following processing on the illegal instruction: The illegal instructions are marked, the illegal instructions are simulated, the program corresponding to the illegal instructions is terminated, and the program corresponding to the illegal instructions is debugged.

9. The method according to any one of claims 1 to 8, characterized in that The constructing of a formal verification model that meets the target requirements includes: Obtaining a verification level of a target requirement of the target object; Based on the verification level, the formal verification model that meets the target requirements is constructed.

10. An object requirement verification device, characterized in that: include: A first acquisition module is used to acquire target requirements of a target object, wherein the target object is a CPU IP core implemented based on a RISC-V architecture; A construction module, used to construct a formal verification model that meets the target requirements; A control module, used for controlling target input information to be input into the target object, and obtaining a test result output by the target object based on a corresponding instruction set architecture ISA; A second acquisition module, configured to input the target input information into the formal verification model to obtain an expected result output by the formal verification model based on the corresponding ISA; The third acquisition module is used to obtain a verification result of the target object based on the test result and the expected result, wherein the verification result is used to identify whether the target object meets the target requirement.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the object requirement verification method according to any one of claims 1 to 9.

12. A computer device, characterized in that: include: Memory and processor, The memory stores a computer program; The processor is used to execute the computer program stored in the memory, and when the computer program is running, the processor executes the object requirement verification method according to any one of claims 1 to 9.