Test sequence generation method, apparatus, system, and related device
By obtaining the constraints of test elements from the basic rule base and generating test sequences, the problem of generating test sequences in existing technologies that consume a lot of manpower is solved, thereby reducing costs and simplifying the process.
Patent Information
- Application Number
- CN202111396548.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-23
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2041-11-23
AI Technical Summary
Existing technologies consume a lot of manpower when generating test sequences, mainly because a large number of constraints need to be set to generate test sequences that meet the conditions.
By obtaining the description file of the test cases, parsing the test elements and retrieving basic constraints from the basic rule base, test sequences are generated, reducing the writing of redundant constraints in the description file.
It reduces the manpower cost required to generate test sequences, simplifies the test case writing process, improves the clarity and readability of description files, and facilitates the adjustment and reuse of test cases.
Smart Images

Figure CN114091383B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the chip technical field, and in particular, to a test sequence generation method, device, system and related equipment. BACKGROUND
[0002] Logic verification is a key step in the front-end design process of a digital chip, and is usually implemented by a verification platform. Specifically, the verification platform can simulate the actual running environment of the chip design to verify the correctness of the chip design function.
[0003] The UVM (Universal Verification Methodology) verification methodology is selected to build the verification environment, which is easy to integrate the IP level to the SOC level verification environment. In the specific verification process, a test sequence of a test case (test) is usually written based on the system verilog verification language, so that the verification platform generates a corresponding stimulus based on the test sequence, tests the running result of the chip design under the stimulus, and verifies the function of the chip design based on the running result.
[0004] However, the way of generating the test sequence in this verification process requires a large amount of human cost. SUMMARY
[0005] Therefore, embodiments of the present application provide a test sequence generation method, device, system and related equipment to reduce the human cost of generating the test sequence.
[0006] To achieve the above object, embodiments of the present application provide the following technical solutions.
[0007] In a first aspect, embodiments of the present application provide a test sequence generation method, comprising:
[0008] Obtaining a description file of a test case, wherein the description file comprises control logic of the test case, and the control logic of the test case is used at least to describe the logical relationship of each test element in the test case;
[0009] Parsing the description file to determine the test element in the test case;
[0010] Obtaining the constraint corresponding to the test element from a basic rule library, wherein the basic rule library comprises at least the basic constraint of the test element;
[0011] Generating the test sequence corresponding to the test case based on the description file and the constraint in the basic rule library.
[0012] Optionally, before the step of obtaining the description file of the test case, the method further comprises:
[0013] constructing a basic rule base corresponding to the application scenario of the test case, wherein the basic rule base comprises at least basic constraints of each test element in the application scenario of the test case.
[0014] Optionally, the step of constructing the basic rule base corresponding to the application scenario of the test case comprises:
[0015] obtaining a rule file, wherein the rule file is used to describe the basic constraints of the test element;
[0016] parsing the rule file to determine the basic constraints of the test element;
[0017] constructing the basic rule base based on the basic constraints of the test element.
[0018] Optionally, the step of constructing the basic rule base comprises:
[0019] configuring the basic constraints of the test element in the application scenario of the test case;
[0020] configuring the basic rule in the application scenario of the test case.
[0021] Optionally, in the step of generating the test sequence corresponding to the test case, the method further comprises:
[0022] Optionally, the test sequence comprises a plurality of parts, and in the test sequence file, each part of the test sequence corresponds to the constraint for generating the part of the test sequence.
[0023] Optionally, after the step of obtaining the constraint corresponding to the test element from the basic rule base, and before the step of generating the test sequence corresponding to the test case based on the constraint in the description file and the basic rule base, the method further comprises:
[0024] determining whether the constraint of each test element in the test case exists in the basic rule base;
[0025] if yes, determining whether the constraint range of the test element in the description file is within the constraint range of the corresponding test element in the basic rule base based on the constraint of each test element in the basic rule base,
[0026] if yes, executing the step of generating the test sequence corresponding to the test case based on the constraint in the description file and the basic rule base.
[0027] Optionally, the generating the test sequence corresponding to the test case based on the description file and the constraints in the basic rule library comprises:
[0028] determining a previous value of the test element in the test case;
[0029] determining a current value of the test element based on the previous value of the test element and the constraint corresponding to the test element.
[0030] Optionally, the generating the test sequence corresponding to the test case comprises:
[0031] acquiring type information for the generated test sequence;
[0032] calling a processing sub-function of an instruction type corresponding to the type information to generate the test sequence.
[0033] Optionally, in the step of parsing the description file to determine the test element in the test case, the parsing process further determines the constraint corresponding to each test element in the description file.
[0034] The generating the test sequence corresponding to the test case based on the description file and the constraints in the basic rule library specifically comprises: generating the test sequence corresponding to the test case based on the control logic of the test case and the constraint corresponding to each test element in the description file, and the constraint corresponding to each test element in the basic rule library.
[0035] Optionally, the basic constraint comprises a hardware constraint and a software constraint of each test element in the application scenario, the hardware constraint is at least one of a bit width, an address, and a storage space occupied by the test case, and the software constraint is at least one of a data format of the test case, a data type of the test element, and an RTL design rule corresponding to the test element.
[0036] Optionally, the description file is in an xml format, and the parsing the description file to determine the test element in the test case specifically comprises: parsing the description file by using a script tool to determine the test element in the test case.
[0037] Optionally, the rule file is in an xsd format, and the parsing the rule file specifically comprises: parsing the rule file by using a script tool.
[0038] In a second aspect, an embodiment of the present application provides a test sequence generation device, comprising:
[0039] The file acquisition module is configured to acquire a description file of a test case, wherein the description file comprises control logic of the test case, and the control logic of the test case is used at least for describing logical relationships of test elements in the test case.
[0040] The file parsing module is configured to parse the description file to determine the test elements in the test case.
[0041] The constraint acquisition module is configured to acquire constraints corresponding to the test elements from a basic rule library, wherein the basic rule library comprises at least basic constraints of the test elements.
[0042] The sequence generation module is configured to generate a test sequence corresponding to the test case based on the description file and the constraints in the basic rule library.
[0043] Optionally, the test sequence generation apparatus further comprises:
[0044] The rule library construction module is configured to construct a basic rule library corresponding to an application scenario of a test case, wherein the basic rule library comprises at least basic constraints of test elements in the application scenario.
[0045] In a third aspect, an embodiment of the present application provides a chip verification system configured to perform the test sequence generation method in the first aspect.
[0046] In a fourth aspect, an embodiment of the present application provides a computer device comprising at least one memory and at least one processor, wherein the memory stores one or more computer executable instructions, and the processor invokes the one or more computer executable instructions to perform the test sequence generation method in the first aspect.
[0047] In a fifth aspect, an embodiment of the present application provides a storage medium storing one or more computer executable instructions, wherein the one or more computer executable instructions are used to perform the test sequence generation method in the first aspect.
[0048] The embodiment of the present application provides a test sequence generation method, apparatus and system and related devices, and the method comprises the following steps: acquiring a description file of a test case, wherein the description file comprises control logic of the test case, and the control logic of the test case is used at least for describing logical relationships of test elements in the test case; parsing the description file to determine the test elements in the test case; acquiring constraints corresponding to the test elements from a basic rule library, wherein the basic rule library comprises at least basic constraints of the test elements; and generating a test sequence corresponding to the test case based on the description file and the constraints in the basic rule library.
[0049] It can be seen that the test sequence generation method in the embodiment of the present application realizes the generation of the test sequence based on the description file and the constraints of the test elements in the test case obtained from the basic rule library after analyzing the description file, so that the constraints in the basic rule library do not need to be described in the description file, thereby reducing the number of constraints written in the description file, reducing the human cost of writing the test case, and further reducing the human cost of generating the test sequence. BRIEF DESCRIPTION OF DRAWINGS
[0050] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are only embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort on the basis of the provided drawings.
[0051] Figure 1 An optional flowchart of the test sequence generation method provided by the embodiment of the present application.
[0052] Figure 2 An example diagram of the test elements of the test case provided by the embodiment of the present application;
[0053] Figure 3 An example diagram of the basic constraints provided by the embodiment of the present application;
[0054] Figure 4 An example diagram of the structure of the test case provided by the embodiment of the present application;
[0055] Figure 5 An example diagram of the structure of the test sequence file provided by the embodiment of the present application;
[0056] Figure 6 An example diagram of the logical structure of the test case provided by the embodiment of the present application;
[0057] Figure 7 Another optional flowchart of the test sequence generation method provided by the embodiment of the present application;
[0058] Figure 8 An optional flowchart of step S10 provided by the embodiment of the present application;
[0059] Figure 9 An optional flowchart of step S14 provided by the embodiment of the present application;
[0060] Figure 10 Another optional flowchart of step S14 provided by the embodiment of the present application;
[0061] Figure 11A block diagram of a test sequence generation apparatus provided by an embodiment of the present application is shown in the following;
[0062] Figure 12 Another block diagram of a test sequence generation apparatus provided by an embodiment of the present application is shown in the following. DETAILED DESCRIPTION
[0063] The technical solutions in the embodiments of the present application will be described clearly and completely in the following with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments of the present application, all the other embodiments obtained by those skilled in the art without creative work fall within the scope of the present application.
[0064] Based on the background art, the way of generating test sequences in the verification process of existing chip design needs to consume a large amount of human cost.
[0065] This is because, in the verification process of chip design, a large number of constraints need to be set to generate test sequences meeting the conditions, so that the way of generating sequences needs to consume a large amount of human cost for setting constraints.
[0066] Based on this, the embodiments of the present application provide a test sequence generation method, apparatus, system and related device. The method comprises: obtaining a description file of a test case, the description file comprising control logic of the test case, the control logic of the test case being used at least to describe logical relationships of test elements in the test case; parsing the description file to determine the test elements in the test case; obtaining constraints corresponding to the test elements from a basic rule library; wherein the basic rule library comprises at least basic constraints of the test elements; and generating a test sequence corresponding to the test case based on the description file and the constraints in the basic rule library.
[0067] As can be seen, the test sequence generation method in the embodiments of the present application generates test sequences based on the description file and the constraints of the test elements in the test case obtained from the basic rule library after parsing the description file, so that the description file does not need to describe the constraints in the basic rule library, thereby reducing the number of constraints written in the description file, reducing the human cost consumed in drafting the test case, and further reducing the human cost consumed in generating the test sequence.
[0068] Figure 1 An optional flowchart of the test sequence generation method provided by the embodiments of the present application is shown in the following. Figure 1 As shown in the figure, the test sequence generation method can comprise:
[0069] Step S10: constructing a basic rule base corresponding to an application scenario of the test case;
[0070] The basic rule base includes at least basic constraints of each test element in the application scenario.
[0071] The test case can be composed of test elements. Based on the logical relationship between the test elements and the constraints corresponding to each test element, a complete test case can be formed. The test element can be understood as an element of the test case, for example, a variable in the test case. For reference Figure 2 The test element of the test case is shown in the example diagram. The test element in the test case can be an opcode, a command, an address, data, etc.
[0072] Before writing the description file of the test case, a corresponding basic rule base can be constructed first. The basic rule base is used to describe the constraints commonly used in the test case in a specific environment as basic constraints. For reference Figure 3 The example diagram of the basic constraint is shown. The basic rule base can be for the test case in an application scenario. Correspondingly, the basic rule base can describe the constraints commonly used by each test element in the application scenario. Alternatively, the basic rule base can be for the test case in a project group in an application scenario. Correspondingly, the basic rule base can describe the constraints commonly used by each test element in the project group in the application scenario. These commonly used constraints are used to reflect the basic rules of the corresponding test case.
[0073] Based on different application scenarios, the hardware environment corresponding to the test case is different. Therefore, the basic rule base is at least for an application scenario. Correspondingly, the basic rule base at least forms the basic constraints of the test elements based on the test logic of the application scenario.
[0074] Continuing to refer to Figure 3 The basic constraints at least include the hardware constraints of the test elements in the application scenario, such as at least one of the bit width, address, and storage space occupied by the test elements. Of course, in some optional examples, the basic constraints can also include software constraints of the test elements in the application scenario, such as the data format of the test elements, the data type of the test elements, the RTL (Register Transfer Level) design rules corresponding to the test elements, etc.
[0075] In an optional example, the basic rule base is used to define all elements used in the application scenario (e.g. the entire access verification environment), and the definition of an element may, for example, include a constraint on the bit width and value range of the element, and a constraint on the value method of the random number of the element. The constraint on the value method of the random number of the element may, for example, be any one or more of the following: (i) completely random value within the constraint range; (ii) automatically add a fixed value to the value of the element in each instruction when multiple instruction groups need to be sent; (iii) automatically add a fixed value to each cycle in a single instruction group, etc.
[0076] It can be understood that the more specific the specific environment is, the more common constraints there are, and the smaller the range of the constraints is, and in the basic rule base, the more basic constraints there are, and the smaller the range of the constraints is. For example, in an application scenario, the corresponding basic constraints may only be hardware constraints and relatively basic software constraints of the application scenario, and in a project group of an application scenario, the corresponding basic constraints may further include constraints common to test elements in the project group, such as value ranges of test elements, attribute parameters of test elements in the project group, and RTL design rules of test elements further defined in the project group, etc.
[0077] Among them, the more constraints provided in the basic rule base, the fewer constraints the description file of the test case needs to write, and the less human cost is consumed.
[0078] In an optional example, the basic rule base can be a hash database, and the basic constraints therein can be described using Schema technology. Of course, in other examples, the basic rule base can also be a B+ tree database, a fix-length database, a table database, etc.
[0079] Among them, the basic rule base can further configure the basic rules, for example, configure a random mechanism to randomize the generated test sequence under the premise of meeting the corresponding constraints. In further examples, the basic rule base can configure the basic rules according to needs, which are not specifically limited by the present application.
[0080] After the basic rule base defines the basic constraints, the description file of the test case can be written. It can be understood that in the case of a fixed application scenario, the basic rule base can also be constructed in advance, so that in the corresponding example, step S10 can not be included, and the description file can be directly written based on the basic rule base, and steps S11-S14 can be further executed to generate the corresponding test sequence.
[0081] Then, with reference to Figure 1 , a step S11 is performed: obtaining a description file of the test case;
[0082] The description file comprises control logic of the test case, and the control logic of the test case is used at least for constraining logical relations of test elements in the test case.
[0083] In an optional example, with reference to a structural example diagram of a test case shown in Figure 4 , the test case can comprise an environment setting, a setup setting, a test flow, a result setting, etc., wherein the environment setting can comprise corresponding hardware constraints and partial basic software constraints, and the constraints can be stored in a basic rule library as basic constraints; at least part of the constraints in the setup setting can be stored in the basic rule library as common constraints, or all the constraints in the setup setting can be stored in the basic rule library; the test flow and the result setting can be described in a description file of the test case as control logic of the test case; or in other embodiments, part of the common constraints in the test flow and the result setting can be further stored in the basic rule library, so as to further simplify the description file, and of course, at least the main logic of the control logic of the test case should be reserved in the description file.
[0084] The description file can be in an xml (Extensible Markup Language, XML) format, used for organizing and storing data of the corresponding test case, but not participating in operations such as generation, reading, transmission, storage, etc.
[0085] The number of constraints in the description file is reduced, so that the probability of writing errors in the corresponding description file writing process is greatly reduced. At the same time, with the reduction of the number of constraints in the description file, the labor cost for checking the description file is also reduced.
[0086] According to the embodiment of the application, the description file comprises control logic for describing logical relations of test elements in the test case, so that a tester can clearly and intuitively determine the logical structure of the test case, thereby avoiding constraint conflicts that can be caused under multi-layer constraints, and easily realizing modification and reuse of the test case.
[0087] Then, with reference to Figure 1 , a step S12 is performed: parsing the description file to determine test elements in the test case.
[0088] Based on the description in the description file, the test elements can be determined in a parsing manner. The description file can be in xml format, for example, and the description file can be parsed by using a script tool to determine the test elements in the test case.
[0089] It can be understood that the description file can include the control logic of the test case and the constraints of the corresponding test elements. In an optional example, the constraints of the corresponding test elements in the description file can also be determined in the step S12, so that the parsing result can be directly used in the subsequent step to generate the corresponding test sequence.
[0090] With reference to Figure 1 , a step S13 is performed: constraints corresponding to the test elements are obtained from the basic rule library.
[0091] Based on the basic constraints of the test elements in the basic rule library, the constraints corresponding to the test elements can be obtained from the basic rule library. Specifically, the constraints corresponding to the test elements can be found based on the test elements.
[0092] Specifically, it can be determined by querying whether the basic rule library includes the constraints corresponding to the test elements. When the corresponding constraints are queried, the constraints are obtained.
[0093] With reference to Figure 1 , a step S14 is performed: based on the constraints in the description file and the constraints in the basic rule library, a test sequence corresponding to the test case is generated.
[0094] After the constraints in the basic rule library are obtained, the test sequence corresponding to the test case can be generated based on the constraints in the description file and the constraints in the basic rule library.
[0095] When the description file includes the control logic of the test case and the constraints of the corresponding test elements, the step can specifically be based on the control logic of the test case and the constraints of the corresponding test elements in the description file, and the constraints of the corresponding test elements in the basic rule library, to generate the test sequence corresponding to the test case.
[0096] In an optional example, the test sequence generated in step S14 can be in the form of a file. Specifically, generating the test sequence corresponding to the test case involves generating a test sequence file, which includes the test sequence. To improve the readability of the test sequence file, in a further optional example, the test sequence file further includes constraints for generating the test sequence. The test sequence can also be divided into multiple parts, and each part's test sequence can correspond one-to-one with the constraints that generated that part's test sequence, allowing testers to intuitively understand the test sequence and its corresponding constraints.
[0097] refer to Figure 5 The illustrated test sequence file structure example shows a test sequence comprising parts 11, 12, and 13. Part 11 corresponds to constraint 21, and constraint 21 is positioned on one side of part 11; part 12 corresponds to constraint 22, and constraint 22 is positioned on one side of part 12; part 13 corresponds to constraint 23, and constraint 23 is positioned on one side of part 13. It is understood that... Figure 5 This document only shows one possible setup for the test sequence file. Other optional examples may include other setup methods, such as setting the corresponding constraints above each part. This embodiment of the invention does not impose any specific limitations on these methods.
[0098] It should be noted that the test sequence generation method described in this embodiment of the invention can obtain constraints for different test elements from the basic rule base, allowing the description file to generate test sequences without describing too many redundant constraints, thus reducing the manpower cost required for generating test sequences. Furthermore, since the description file does not need to describe too many redundant constraints, its structure is clear and hierarchical, making it simpler and more convenient to adjust and reuse when needed, further saving manpower costs.
[0099] It is understood that the description file includes the control logic of the test cases and does not need to include too many basic constraints. This allows the description file to clearly and accurately reflect the data structure and control hierarchy of the test cases, so that in the subsequent process of adjusting the test cases, the location that needs to be adjusted can be found in a timely and accurate manner, and the test cases can be adjusted and reused.
[0100] by Figure 6 Taking the logical structure example diagram of the test cases shown in the figure as an example, Figure 6The test case in the description file includes two instruction groups, i.e., instruction group 0 and instruction group 1, each of which includes load / store / atomic operation instructions, register operation instructions, testbench configuration instructions, etc. For each instruction, the corresponding control logic is needed to constrain the test elements, for example, the load / store / atomic operation instruction includes command, address, data, etc. Different types of test elements, wherein the command can be based on the corresponding opcode, data format, numeric format, memory type, etc. Control field for corresponding constraint; the address can be based on index and offset, etc. For corresponding constraint; the data can be based on int, float, sint, etc. Different data types for constraint; accordingly, the register instruction can include configuration data, address, read / write operation type, etc. Test elements; the testbench configuration instruction can include command, control data, etc. Test elements.
[0101] In the description file corresponding to the test case, the instruction groups contained in the test case and the commands, addresses, data, etc. Test elements corresponding to different instructions in each instruction group can be included, and the control logic corresponding to the test elements can be described, and the specific constraints of the test elements in the test case can be described.
[0102] In step S12, the test elements in the test case can be parsed and determined by using a script tool. For example Figure 6 In the test case shown, the corresponding address, data, etc. Test elements in each instruction in the test case can be parsed and determined, and at the same time, the constraints of the test elements in the description file can be determined to execute the subsequent steps.
[0103] In an optional example, referring to Figure 7 Another optional flowchart of the test sequence generation method is shown. Before generating the test sequence, the constraints in the description file can be confirmed, and when the constraints in the description file meet the corresponding rules, the generation of the test sequence is executed.
[0104] Specifically, after step S13 and before step S14, the confirmation process of the constraints in the description file is executed, including:
[0105] Step S21: determining whether there are constraints of all test elements in the test case in the basic rule library;
[0106] In the basic rule library, all test elements in the test case are defined by default. When there are test elements in the description file that are not defined in the basic rule library, an error message is generated and the generation process of the test sequence is exited. When it is determined that there are constraints of all test elements in the test case in the basic rule library, step S22 is executed.
[0107] Step S22: determining whether the constraint range of the test element in the description file is within the constraint range of the corresponding test element in the basic rule library based on the constraints of each test element in the basic rule library;
[0108] The constraint range of the test element in the description file should be within the constraint range of the corresponding test element in the basic rule library, so as to avoid constraint out-of-range of the description file.
[0109] It should be noted that the constraint range of the test element in the description file is equivalent to the constraint range of the corresponding test element in the basic rule library, or it can be understood that the constraint range of the test element in the description file is within the constraint range of the corresponding test element in the basic rule library.
[0110] For example, the constraints of each test element in the basic rule library can determine whether the value range of the test element in the description file is out-of-range, or whether the value method of the test element is one of the methods defined in the basic rule library, so as to determine whether the constraint range of the test element in the description file is within the constraint range of the corresponding test element in the basic rule library.
[0111] When the constraint range of the test element in the description file is not within the constraint range of the corresponding test element in the basic rule library, the description file is considered to be an error, and an error message is generated and the generation process of the test sequence is exited.
[0112] When it is determined that the constraint range of the test element in the description file is within the constraint range of the corresponding test element in the basic rule library, step S14 is executed.
[0113] Through the confirmation process of the constraints of the description file, errors that may occur in the description file can be found in time, and the verification / test process of the chip design is avoided from being affected by the error description file.
[0114] In an optional example, the basic rule library can be generated based on a corresponding rule file. Referring to Figure 8 The optional flowchart of step S10 is shown in the figure, and step S10 can include:
[0115] Step S101: obtaining a rule file;
[0116] The rule file is used to describe the basic constraint of the test element.
[0117] The rule file can be written by a tester or generated by a tool for generating a rule file. In an optional example, the rule file can describe the basic constraint through Schema technology, so that the block layer can be conveniently transplanted and integrated into the SOC layer, and then the simulation verification platform can be connected in the simulation verification stage.
[0118] The basic rules of the test case can be simply and conveniently described through the Schema technology, including the operation code, the command, the address, the bit width and the type of the data, so that the description file of the test case only needs to complete a small amount of configuration and constraint, and the desired test sequence can be generated based on the basic rule library.
[0119] Specifically, the format of the rule file can be xsd (XML Schema Definition, document structure description).
[0120] Step S102: parsing the rule file to determine the basic constraint of the test element;
[0121] By parsing the rule file, the corresponding basic constraint information can be obtained, and the basic rule library can be constructed based on the basic constraint information.
[0122] Specifically, a script tool can be used to parse the rule file.
[0123] Step S103: constructing a basic rule library based on the basic constraint of the test element;
[0124] The basic rule library can be a hash database or other types of databases. During the construction of the basic rule library, a construction method matched with the corresponding type of database can be used, for example, when the basic rule library is a hash database, a construction method of the hash database can be used to construct the basic rule library.
[0125] In addition, it should be noted that the basic rule library can also be configured with a basic rule, for example, a random mechanism for realizing randomization of the test sequence, and the basic rule can be configured in the construction process of the basic rule library. Correspondingly, constructing the basic rule library can include: configuring the basic constraint of the test element in the application scenario of the test case; and configuring the basic rule in the application scenario of the test case.
[0126] It should be noted that the basic rule base can be fixed or updated based on a preset occasion, for example, when the application scene changes, the basic rule base is updated accordingly, or the basic rule base is adaptively adjusted (i.e. updated) based on a preset period. The updated content can be a basic constraint or a basic rule, which is not specifically limited in the present application.
[0127] In some examples, with reference to Figure 9 The optional flowchart of step S14 is shown, when generating the test sequence, the value of the test element in the current flow can be determined based on the value of the test element in the previous flow.
[0128] Specifically, step S14 can include:
[0129] Step S14a: determining the previous value of the test element in the test case;
[0130] The previous value of the test element can be understood as the value of the test element in the previous instruction group corresponding to the current instruction when the test case needs to send multiple instruction groups, or the value of the test element in the previous clock cycle in a single instruction group of the test case.
[0131] It can be understood that when the test case needs to send multiple instruction groups, the current instruction can be the instruction in the instruction group after the value of the multiple instruction groups has been determined, or the instruction in the first instruction group that needs to be determined. When the current instruction is the instruction in the first instruction group that needs to be determined, the previous value of the test element can be determined as a null value.
[0132] Correspondingly, when the value determination process of a single instruction group can include the value determination in multiple clock cycles, the previous clock cycle can be the clock cycle after the value in multiple clock cycles has been determined, or the first clock cycle that needs to be determined. When the current clock cycle is the first clock cycle that needs to be determined, the previous value of the test element can be determined as a null value.
[0133] Step S14b: determining the current value of the test element based on the previous value of the test element and the constraint corresponding to the test element;
[0134] After the previous value of the test element is determined, the current value of the test element can be determined based on the previous value and the constraint (e.g. the value determination method of the test element) corresponding to the test element.
[0135] For example, the value method of the test element is restricted as: (ii) in the case of sending multiple instruction groups, the value of the element in each instruction is automatically added with a fixed value; accordingly, the current value of the test element can be determined based on the previous value of the test element plus the fixed value.
[0136] Alternatively, the value method of the test element is restricted as: (iii) in a single instruction group, the value of the element is automatically added with a fixed value for each cycle; accordingly, the current value of the test element can be determined based on the previous value of the test element plus the fixed value.
[0137] It can be understood that the type of test sequence required is different based on different test benches, for example, the test bench can be C++, System Verilog, Verilog, System C, etc., and the corresponding type of test sequence should also be suitable for the corresponding test bench. Based on the constraints in the description file and the constraints in the basic rule library obtained in the foregoing steps, all information for describing the test case has been obtained, and on this premise, the embodiment of the application can generate any type of test sequence based on the information of the test case.
[0138] In an optional example, referring to Figure 10 Another optional flowchart of step S14 is shown in FIG. 14, and step S14 can further include:
[0139] Step S141: obtaining type information of the test sequence to be generated;
[0140] The type information of the test sequence can be written in the description file and obtained as a constraint from the parsing process of the description file. Alternatively, the type information of the test sequence can be determined based on user input information when the test case is generated, for example, a prompt information is popped up on a display device, so that the user inputs the type information of the test sequence to be generated based on the prompt information, and then the type information of the test sequence is obtained.
[0141] Step S142: calling a processing sub-function of an instruction type corresponding to the type information to generate a test sequence.
[0142] It can be understood that based on different type information, there are different instruction types, and after the type information is determined, the test sequence can be generated based on the processing sub-function of the corresponding instruction type. The processing sub-function is a function defined in the script tool for assisting the execution of the flow.
[0143] After the test case of the corresponding type is generated, the test case can be directly provided to the corresponding test platform for use.
[0144] It can be understood that, based on the processing sub-function of different instruction types, different types of test sequences can be generated, that is, the description file in the embodiment of the present application is a general file corresponding to different test platforms, thereby expanding the applicable environment of the embodiment of the present application. Moreover, the expansion of the applicable environment of the description file in the embodiment of the present application makes the description file not need to write different codes based on different test platforms, further reducing the labor cost.
[0145] The test sequence generation apparatus provided by the embodiment of the present application is introduced below. The apparatus content described below can be considered as a chip test device or a computer device, and is a functional module required to be set to implement the test sequence generation method provided by the embodiment of the present application. The apparatus content described below can be mutually corresponding and referred to the method content described above.
[0146] Figure 11 A block diagram of the test sequence generation apparatus provided by the embodiment of the present application is shown. As shown in the figure, Figure 11 The apparatus can include:
[0147] The file acquisition module 200 is configured to acquire a description file of a test case, wherein the description file includes control logic of the test case, and the control logic of the test case is used at least to describe a logical relationship of each test element in the test case.
[0148] The file parsing module 210 is configured to parse the description file and determine a test element in the test case.
[0149] The constraint acquisition module 220 is configured to acquire a constraint corresponding to the test element from a basic rule library, wherein the basic rule library at least includes a basic constraint of the test element.
[0150] The sequence generation module 230 is configured to generate a test sequence corresponding to the test case based on the description file and the constraint in the basic rule library.
[0151] In some embodiments, referring to Figure 12 Another block diagram of the test sequence generation apparatus provided by the embodiment of the present application is shown, and the test sequence generation apparatus further includes:
[0152] The rule library construction module 240 is configured to construct a basic rule library corresponding to an application scenario of a test case, wherein the basic rule library at least includes a basic constraint based on each test element in the application scenario.
[0153] In some embodiments, the rule library construction module 240 is configured to construct a basic rule library corresponding to an application scenario of a test case, including:
[0154] obtain a rule file, the rule file being used to describe basic constraints of test elements;
[0155] parse the rule file to determine the basic constraints of the test elements;
[0156] construct a basic rule library based on the basic constraints of the test elements.
[0157] In some embodiments, the rule library construction module 240 is configured to construct a basic rule library, and the construction includes:
[0158] configure the basic constraints of the test elements in the application scenario of the test case;
[0159] configure the basic rules in the application scenario of the test case.
[0160] In some embodiments, the sequence generation module 230 is configured to generate a test sequence corresponding to the test case, and specifically, generate a test sequence file, the test sequence file including the test sequence and constraints for generating the test sequence.
[0161] In some embodiments, the test sequence includes multiple parts, and in the test sequence file, each part of the test sequence corresponds to constraints for generating the part of the test sequence.
[0162] In some embodiments, the sequence generation module 230 is configured to generate a test sequence corresponding to the test case, and the generation includes:
[0163] obtain type information for the generated test sequence;
[0164] call a processing sub-function of an instruction type corresponding to the type information to generate the test sequence.
[0165] In some embodiments, in the process of parsing the description file to determine the test elements in the test case, the parsing process also determines constraints corresponding to each test element in the description file;
[0166] The sequence generation module 230 is configured to generate a test sequence corresponding to the test case based on the constraints in the description file and the basic rule library, and specifically, generate the test sequence corresponding to the test case based on the control logic of the test case and the constraints corresponding to each test element in the description file, and the constraints corresponding to each test element in the basic rule library.
[0167] In some embodiments, the basic constraints comprise hardware constraints and software constraints of each test element in the application scenario, the hardware constraints being at least one of bit width, address, and occupied storage space of the test case, and the software constraints being at least one of data format of the test case, data type of the test element, and RTL design rule corresponding to the test element.
[0168] In some embodiments, the description file is in xml format, and the file parsing module 210 is configured to parse the description file to determine the test elements in the test case, specifically, a script tool is used to parse the description file to determine the test elements in the test case.
[0169] In some embodiments, the rule file is in xsd format, and the rule library construction module 240 is configured to parse the rule file, specifically, a script tool is used to parse the rule file.
[0170] Embodiments of the present application also provide a chip verification system, which can be configured to perform the test sequence generation method provided by the embodiments of the present application.
[0171] Embodiments of the present application also provide a computer device, which can include at least one memory and at least one processor, the memory stores one or more computer executable instructions, and the processor invokes the one or more computer executable instructions to perform the test sequence generation method provided by the embodiments of the present application.
[0172] Embodiments of the present application provide a storage medium, which stores one or more computer executable instructions, and the one or more computer executable instructions are used to perform the test sequence generation method described above.
[0173] The above describes a plurality of embodiment schemes provided by the embodiments of the present application, and each optional mode introduced by each embodiment scheme can be combined, cross-referenced in a non-conflicting manner, thereby extending a plurality of possible embodiment schemes, which can be considered as the embodiment schemes disclosed and disclosed by the embodiments of the present application.
[0174] Although the embodiments of the present application are disclosed as above, the present application is not limited thereto. Any person skilled in the art can make various changes and modifications without departing from the spirit and scope of the present application, and therefore the protection scope of the present application should be subject to the scope defined by the claims.
Claims
1. A method for generating test sequences, characterized in that, include: Obtain the description file of the test case, the description file including the control logic of the test case, the control logic of the test case being used to describe at least the logical relationship between each test element in the test case; Parse the description file to determine the test elements in the test cases; Obtain the constraints corresponding to the test element from the basic rule base; wherein, the basic rule base includes at least the basic constraints of the test element in the application scenario of the test case; the constraints shared by all test elements are used as basic constraints; the basic constraints include at least the hardware constraints and / or software constraints corresponding to the test element in the application scenario. Based on the description file and the constraints in the basic rule base, a test sequence corresponding to the test case is generated.
2. The method according to claim 1, characterized in that, Before obtaining the test case description file, the process also includes: Construct a basic rule base corresponding to the application scenarios of the test cases, wherein the basic rule base includes at least the basic constraints based on each test element under the application scenario.
3. The method according to claim 2, characterized in that, The basic rule base corresponding to the application scenarios for constructing and testing cases includes: Obtain the rule file, which describes the basic constraints of the test elements; Parse the rule file to determine the basic constraints of the test elements; Based on the fundamental constraints of the test elements, a basic rule base is constructed.
4. The method according to claim 3, characterized in that, The construction forms a basic rule base, including: The basic constraints of the test elements in the application scenario of the configured test cases; Configure the basic rules for the application scenario of the test cases.
5. The method according to claim 1, characterized in that, Specifically, the step of generating a test sequence corresponding to the test case involves generating a test sequence file, which includes the test sequence and the constraints for generating the test sequence.
6. The method according to claim 5, characterized in that, The test sequence comprises multiple parts, and in the test sequence file, each part of the test sequence corresponds one-to-one with the constraint that generated that part of the test sequence.
7. The method according to claim 1, characterized in that, After obtaining the constraints corresponding to the test element from the basic rule base, and before generating the test sequence corresponding to the test case based on the description file and the constraints in the basic rule base, the process includes: Determine whether constraints exist for all test elements in the test case in the basic rule base; If so, based on the constraints of each test element in the basic rule base, determine whether the constraint range of the test element in the description file is within the constraint range of the corresponding test element in the basic rule base. If so, execute the step of generating a test sequence corresponding to the test case based on the constraints in the description file and the basic rule base.
8. The method according to claim 1, characterized in that, The step of generating a test sequence corresponding to the test cases based on the description file and the constraints in the basic rule base includes: In the test case, determine the previous value of the test element; Based on the previous value of the test element and the constraints corresponding to the test element, the current value of the test element is determined.
9. The method according to claim 1, characterized in that, The generation of the test sequence corresponding to the test case includes: Obtain the type information used to generate the test sequence; Call the processing sub-function of the instruction type corresponding to the type information to generate a test sequence.
10. The method according to claim 1, characterized in that, In the step of parsing the description file and determining the test elements in the test cases, the parsing process also determines the constraints corresponding to each test element in the description file; The step of generating a test sequence corresponding to the test case based on the description file and the constraints in the basic rule base specifically involves generating a test sequence corresponding to the test case based on the control logic of the test case and the constraints of each test element in the description file, as well as the constraints of each test element in the basic rule base.
11. The method according to claim 2, characterized in that, The basic constraints include hardware and software constraints for each test element in the application scenario. The hardware constraints are at least one of the following: the bit width, address, and storage space occupied by the test case. The software constraints are at least one of the following: the data format of the test case, the data type of the test element, and the RTL design rules corresponding to the test element.
12. The method according to claim 1, characterized in that, The description file is in XML format. The step of parsing the description file and determining the test elements in the test cases specifically involves using a script tool to parse the description file and determine the test elements in the test cases.
13. The method according to claim 3, characterized in that, The rule file is in XSD format. The process of parsing the rule file specifically involves using a script tool to parse the rule file.
14. A test sequence generation apparatus, characterized in that, include: The file acquisition module is used to acquire the description file of the test case. The description file includes the control logic of the test case. The control logic of the test case is used to describe at least the logical relationship between each test element in the test case. The file parsing module is used to parse the description file and determine the test elements in the test cases; The constraint acquisition module is used to acquire the constraints corresponding to the test element from the basic rule base; wherein, the basic rule base includes at least the basic constraints of the test element in the application scenario of the test case; the constraints shared by all test elements are used as basic constraints; the basic constraints include at least the hardware constraints and / or software constraints corresponding to the test element in the application scenario. The sequence generation module is used to generate test sequences corresponding to the test cases based on the description file and the constraints in the basic rule base.
15. The apparatus according to claim 14, characterized in that, Also includes: The rule base construction module is used to build a basic rule base corresponding to the application scenario of the test cases. The basic rule base includes at least the basic constraints based on each test element under the application scenario.
16. A chip verification system, characterized in that, The chip verification system is configured to perform the test sequence generation method as described in any one of claims 1-13.
17. A computer device, characterized in that, include: At least one memory and at least one processor; The memory stores one or more computer-executable instructions, and the processor invokes the one or more computer-executable instructions to execute the test sequence generation method as described in any one of claims 1-13.
18. A storage medium, characterized in that, The storage medium stores one or more computer-executable instructions, which are used to execute the test sequence generation method as described in any one of claims 1-13.
Citation Information
Patent Citations
Testing method and device and computer readable storage medium
CN110162468A