Register test method, SOC chip, electronic equipment and storage medium

By reading the register test file in the SOC chip and executing specified test rules, including continuous writing, reading and alternating read and write operations, the problem of low register verification efficiency is solved and efficient and flexible register testing and verification is achieved.

CN118535403APending Publication Date: 2024-08-23PHYTIUM TECH CO LTD
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202410578231.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-10
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

As chip functions increase, the number and complexity of registers increase, making register verification difficult and consuming a lot of time and energy. How to efficiently verify registers has become a problem for chip companies.

Method used

Provide a register testing method that reads the register test file from the memory through the processor, and performs access testing on the registers in the SOC chip according to the test rules, including continuous writing, continuous reading, alternating reading and writing and other operations, covering safety and non-security Level, write different values ​​such as maximum value, reset value, random value, automate the test process and reduce manual intervention.

Benefits of technology

It improves the efficiency and flexibility of register testing, can cover more test scenarios, reduces bug escapes, and achieves fast and accurate register verification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535403A
    Figure CN118535403A
Patent Text Reader

Abstract

The invention relates to a register test method, an SOC chip, electronic equipment and a computer readable storage medium, and belongs to the field of chips. The method is applied to the SOC chip, and the SOC chip comprises a processor, a memory and a plurality of registers to be tested. The method comprises the steps that a processor reads a register test file from a memory, and the register test file comprises a test rule for testing a register to be tested in the SOC chip; the processor performs an access test on a to-be-tested register in the SOC chip according to a test rule in the register test file to obtain a test result; wherein the access test comprises at least one of continuous writing, continuous reading and alternate reading and writing of the processor under a specified level, the specified level comprises a security level and / or a non-security level, and the write-in value comprises at least one of a register maximum value, a reset value, a reset value negation value and a random value. The test efficiency of the register can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of chips, and specifically relates to a register testing method, a SOC chip, an electronic device and a computer-readable storage medium. Background Art

[0002] As the functions of chips increase, the number of corresponding registers also increases, and the properties of registers become more and more complex. Therefore, register verification has become a difficult and important part of chip verification. Among them, register verification consumes a lot of time and energy of verification personnel. How to efficiently verify registers has become an urgent problem for chip companies to solve. Summary of the invention

[0003] In view of this, the purpose of the present application is to provide a register testing method, a SOC chip, an electronic device and a computer-readable storage medium to improve the test efficiency of the register.

[0004] The embodiment of the present application is implemented as follows:

[0005] In a first aspect, an embodiment of the present application provides a register testing method, which is applied to a SOC chip, wherein the SOC chip includes a processor, a memory, and a plurality of registers to be tested, and the processor is connected to the memory and the plurality of registers, and the method includes: the processor reads a register test file from the memory, wherein the register test file contains test rules for testing the registers to be tested in the SOC chip; the processor performs an access test on the registers to be tested in the SOC chip according to the test rules in the register test file to obtain a test result; wherein the access test includes at least one of continuous writing, continuous reading, and alternating reading and writing when the processor is at a specified level, the specified level includes a security level and / or a non-security level, and the write value includes at least one of a register maximum value, a reset value, a reset value inverted, and a random value.

[0006] In an embodiment of the present application, the registers can be automatically tested according to the register test file. In addition to conventional tests, the access test can also include at least one of continuous writing, continuous reading, and alternating reading and writing when the processor is at a specified level. During the test, by switching the level of the processor, cross-test scenarios of the processor at a secure level and a non-secure level can be covered, and various test scenarios can be covered. At the same time, the write value during the test is no longer limited to a fixed value, and different values ​​can be written as required. For example, the write value includes at least one of the register maximum value, reset value, inverted reset value, and random value, making the test method more flexible, thereby improving the test efficiency of the register.

[0007] In combination with a possible implementation manner of the embodiment of the first aspect, the processor tests the register to be tested in the SOC chip according to the test rules in the register test file, including: the processor parses the test rules in the register test file, wherein the test rules include: attribute information of the register to be tested, access address, access mode, level to be switched by the processor, test identifier, and access data; the processor issues a test access request to the corresponding register according to the content contained in the test rules; the processor records the access information of the test access request to obtain a test result.

[0008] In an embodiment of the present application, the test rules are parsed to obtain the contents contained in the test rules. Then, based on the contents contained in the test rules, a test access request is issued to the corresponding register, and the access information of the test access request is recorded to obtain the test results. In this way, automatic testing of the registers can be achieved, reducing manual intervention in the testing process, thereby improving the testing efficiency of the registers.

[0009] In combination with a possible implementation manner of the first aspect embodiment, the multiple registers to be tested include a first type of registers, and the processor performs an access test on the registers to be tested in the SOC chip according to the test rules in the register test file, including: the processor performs secure read access, secure write access and the write value is the maximum value of the register, non-secure read access, secure read access, non-secure write access and the write value is a reset value, non-secure read access, secure read access, secure write access and the write value is a reset value, non-secure write access and the write value is a reset value, non-secure write access and the write value is a maximum value of the register, secure read access, secure write access and the write value is a reset value, and secure read access on the first type of registers in sequence according to the test rules in the register test file.

[0010] In an embodiment of the present application, when the register includes a first type of register (which may be a register that satisfies normal readable and writable properties but will affect the subsequent tests of other registers), when testing the register, the first type of register may be subjected to a secure read access, a secure write access and the written value is the maximum value of the register, a non-secure read access, a secure read access, a non-secure write access and the written value is a reset value, a non-secure read access, a secure read access, a secure write access and the written value is a reset value, a non-secure write access and the written value is a maximum value of the register, a secure read access, a secure write access and the written value is a reset value, and a secure read access, so as to test whether the function of the register is abnormal and reduce bug escapes.

[0011] In combination with a possible implementation manner of the first aspect, the multiple registers to be tested include second-category registers, and the processor performs access tests on the registers to be tested in the SOC chip according to the test rules in the register test file, including: the processor performs secure read reset value access, secure write access with the write value being the register maximum value, and secure read access on the second-category registers in sequence according to the test rules in the register test file.

[0012] In an embodiment of the present application, when the register includes a second type of register (a register that does not meet the normal readable and writable properties), for this type of register, during the test, the second type of register is accessed with a secure read reset value, accessed with a secure write value that is the maximum value of the register, and accessed with a secure read, and only three access operations are required to verify the function of the register.

[0013] In combination with a possible implementation manner of the first aspect embodiment, the multiple registers to be tested include a third type of registers, and the processor performs an access test on the registers to be tested in the SOC chip according to the test rules in the register test file, including: the processor performs secure read access, secure write access and the write value is the maximum value of the register, non-secure read access, secure read access, non-secure write access and the write value is a reset value, non-secure read access, secure read access, random access, secure write access and the write value is a reset value, non-secure write access and the write value is a maximum value of the register, secure read access, secure write access and the write value is a reset value, and secure read access on the third type of registers in sequence according to the test rules in the register test file.

[0014] In an embodiment of the present application, when the register includes a third type of register (registers excluding the first type of register and the second type of register), when testing the third type of register, the following are performed in sequence: secure read access, secure write access and the written value is the maximum value of the register, non-secure read access, secure read access, non-secure write access and the written value is the reset value, non-secure read access, secure read access, random access, secure write access and the written value is the reset value, non-secure write access and the written value is the maximum value of the register, secure read access, secure write access and the written value is the reset value, and secure read access, so as to test whether the function of the register is abnormal and reduce bug escapes; at the same time, the introduction of random access can cover more test scenarios and fully verify the functions of ordinary registers.

[0015] In combination with a possible implementation manner of the embodiment of the first aspect, the step of obtaining the register test file includes: obtaining a register information file of the register to be tested in the SOC chip; generating a directional test sequence according to the first category of registers, the second category of registers and preset test rules in the register information file, and generating a random test sequence according to the third category of registers in the register information file and preset test rules; merging the directional test sequence and the random test sequence to generate the register test sequence, wherein each test mode of each register in the register test sequence has a unique test identifier; converting the register test sequence into a stimulus test instruction and compiling it to generate the register test file.

[0016] In an embodiment of the present application, different test sequences can be generated according to different registers in the register information file, such as generating a directed test sequence and a random test sequence, and then merging the directed test sequence and the random test sequence to generate a register test sequence with a unique test identifier. Then, the register test sequence is converted into a stimulus test instruction and compiled, so that the register can be quickly tested directly based on the register test file.

[0017] In combination with a possible implementation manner of the embodiment of the first aspect, the step of obtaining the register information file includes: extracting specified information of each register according to the original register specification file of the SOC chip; wherein the specified information includes register address, name, reset value, access attributes of each field, security attributes, and function; classifying the registers of the SOC chip according to the attribute information and function in the specified information to obtain first-category registers, second-category registers, and third-category registers; merging the first-category registers, the second-category registers, and the third-category registers in a specified order to obtain the register information file of a specified format containing all registers.

[0018] In an embodiment of the present application, the specified information of each register is extracted so that the registers of the SOC chip are classified according to the attribute information and function in the specified information, and then the various types of registers are merged in a specified order to form a register information file containing all registers in a specified format for easy display, and the subsequent register information file generates a register test file or expected results.

[0019] In combination with a possible implementation manner of the embodiment of the first aspect, the method also includes: the processor stores the test result to the memory; the processor reads the test result from the memory, and compares the test result with the same test identifier with the expected result of the register, and outputs a test log, wherein the test log includes the test identifier, the level of the processor, the register information to be tested, the access method, and the comparison result of the access data; wherein the expected result is determined based on the register information file and preset test rules, and the expected result is used to verify the test result, and has a parameter type of the same dimension as the test result.

[0020] In an embodiment of the present application, the corresponding expected test results can be set by parsing the register information file and the preset test rules, and combining the attribute information of the register, so that when verifying the test effect of the register later, the processor can obtain the expected result and compare the test result with the same test identifier with the expected result of the register, so as to quickly output the test log and improve efficiency.

[0021] In combination with a possible implementation manner of the first aspect embodiment, the method also includes: the processor records the test address of the register tested during the test process, and compares the recorded test address with the address bin to calculate the test coverage; wherein the address bin records the addresses of all registers to be tested in the SOC chip; if the test coverage is lower than a threshold, the processor performs an access test on the uncovered registers in the address bin according to the test rules in the register test file.

[0022] In an embodiment of the present application, the test address of the register in the test record is compared with the address bin to calculate the test coverage. Based on the test coverage, the test progress of the register and whether the register needs to be continued to be tested can be known in real time.

[0023] In the second aspect, an embodiment of the present application also provides a SOC chip, comprising: a memory, a processor, and multiple registers to be tested; the memory is used to store a register test file, wherein the register test file contains test rules for testing the registers to be tested in the SOC chip; the processor is connected to the memory and the multiple registers through an on-chip network, and the processor is configured to: read the register test file from the memory, and perform an access test on the registers to be tested in the SOC chip according to the test rules in the register test file to obtain a test result; wherein the access test includes at least one of continuous writing, continuous reading, and alternating reading and writing when the processor is at a specified level, the specified level includes a security level and / or a non-security level, and the write value includes at least one of a register maximum value, a reset value, a reset value inverse, and a random value.

[0024] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a memory and a processor, the processor being connected to the memory via an on-chip network; the memory being used to store programs; the processor being used to call the programs stored in the memory to execute a method provided in the above-mentioned first aspect embodiment and / or any possible implementation method in combination with the first aspect embodiment.

[0025] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method provided in the embodiment of the first aspect and / or any possible implementation method in combination with the embodiment of the first aspect is executed.

[0026] Other features and advantages of the present application will be described in the following description. The purpose and other advantages of the present application can be realized and obtained through the structures specifically pointed out in the written description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. The above and other purposes, features and advantages of the present application will be more clear as shown in the drawings.

[0028] Figure 1 A schematic structural diagram of a SOC chip provided in an embodiment of the present application is shown.

[0029] Figure 2 A schematic diagram showing the principle of a register test provided in an embodiment of the present application is shown.

[0030] Figure 3 A flow chart of a register testing method provided in an embodiment of the present application is shown.

[0031] Figure 4 A schematic structural diagram of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0032] The technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The following embodiments can be used as examples to more clearly illustrate the technical solutions of the present application, and cannot be used to limit the scope of protection of the present application. It will be appreciated by those skilled in the art that, in the absence of conflict, the features in the following embodiments and embodiments can be combined with each other.

[0033] It should be noted that similar numbers and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings. At the same time, in the description of this application, relational terms such as "first", "second", etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements includes not only those elements, but also includes other elements that are not clearly listed, or also includes elements inherent to such process, method, article or equipment. Furthermore, the term "and / or" in this application is only a kind of association relationship describing the associated object, indicating that there can be three relationships, for example, A and / or B, which can represent: A exists alone, A and B exist at the same time, and B exists alone.

[0034] In the description of the embodiments of the present application, unless otherwise clearly specified or limited, the technical term "connection" may refer to a direct connection or an indirect connection through an intermediate medium.

[0035] In order to improve the test efficiency of registers, the present application provides a register testing method, a SOC (System on Chip) chip, an electronic device and a computer-readable storage medium.

[0036] The SOC chip provided in the embodiment of the present application is described below. The SOC chip provided in the embodiment of the present application includes: a processor, a memory, and a plurality of registers to be tested, and the processor is connected to the memory and the plurality of registers. The processor includes but is not limited to a central processing unit (CPU).

[0037] In one possible implementation, the processor can be connected to the memory and multiple registers to be tested through a network on chip (NOC). NOC is a communication architecture used to connect different components inside an integrated circuit chip. Compared with the bus architecture, NOC has the advantages of scalability, low power consumption, high performance (providing high bandwidth and low latency), and is more suitable for application in chips.

[0038] In one implementation, the structure of the SOC chip can be as follows: Figure 1 As shown, Figure 1 The IP-A, IP-B, IP-C, and IP-N in the figure are all IP (Intellectual Property) registers to be tested. With the emergence of IP modules of various functions and types in chips, the verification of IP modules has become a difficult and important point in chip verification. The verification of current IP registers consumes a lot of time and energy of verification personnel. This application improves the test efficiency of registers by optimizing the existing register test method, reducing the manual intervention process in the test process.

[0039] The memory is used to store a register test file, wherein the register test file includes a test rule for testing a register to be tested in the SOC chip, and the test rule includes test content for the register, etc.

[0040] The processor is configured to: read a register test file from the memory, and perform an access test on a register to be tested in the SOC chip according to a test rule in the register test file to obtain a test result.

[0041] Among them, when the present application performs access test on the register, it is no longer a simple test of its writing, reading, and writing and reading. By adding the register reading and writing function, the test content is more complete. In addition to the conventional test, the access test can also include at least one of continuous writing, continuous reading, and alternating reading and writing when the processor is at a specified level. The specified level includes a security level (such as the EL3 level when the processor is in a secure state) and / or an unsafe level (such as the EL1 level when the processor is in an unsafe state), wherein EL (Exception Level) is the abbreviation of the exception level, and the exception level of the processor includes four levels: EL0, EL1, EL2, and EL3. During the test process, by switching the level of the processor, the cross-test scenarios of the processor being at a secure level and an unsafe level can be covered, so that more test content can be covered, and more register access tests can be implemented in a shorter time. At the same time, the write value during the test process is no longer limited to a fixed value, and different values ​​can be written as required. For example, the write value includes at least one of the register maximum value, reset value, reset value negation, and random value, making the test method more flexible.

[0042] In one possible implementation, the processor is configured to parse the test rules in the register test file, wherein the test rules include: attribute information of the register to be tested, access address, access method, level to which the processor needs to switch, test identifier, and access data; and based on the content contained in the test rules, a test access request is issued to the corresponding register, and access information of the test access request is recorded to obtain a test result.

[0043] The multiple registers to be tested in the SOC chip can be divided into different types of registers according to their functions and attributes. For example, they can be divided into first-class registers (also called designated registers), second-class registers (also called special registers), and third-class registers (also called ordinary registers). Among them, the first-class registers are defined as: this type of registers meet the normal readable and writable attributes, but will affect the subsequent tests of other registers. Therefore, during the test, they cannot be cross-tested with other registers. The second-class registers are defined as: this type of registers do not meet the normal readable and writable attributes. For example, a new value can only be written after the reset value is reset, otherwise the written value is invalid. The third-class registers are defined as: other registers except the first-class registers and the second-class registers. For the above-mentioned first-class registers and second-class registers, they will be marked in advance in the register test file due to their special functions. If there is no marked register, it is a normal register by default.

[0044] When multiple registers to be tested include a first type of register (also referred to as a designated register), when the processor performs an access test on the registers to be tested in the SOC chip according to the test rules in the register test file, the process may be: the processor performs secure read access, secure write access and the write value is the maximum value of the register, non-secure read access, secure read access, non-secure write access and the write value is the reset value, non-secure read access, secure read access, secure write access and the write value is the reset value, non-secure write access and the write value is the maximum value of the register, secure read access, secure write access and the write value is the reset value, and secure read access on the first type of register in sequence according to the test rules in the register test file.

[0045] In a possible implementation manner, the process of the processor (such as a CPU) performing a directional test on the first type of registers may be:

[0046] 1.CPU is in EL3, secure read access;

[0047] 2. The CPU is in EL3, with secure write access and the write value is the maximum value, for example, for a 32-bit register, the write value is 0xffff_ffff;

[0048] 3.CPU is in EL1(NS), Non-Secure read access;

[0049] 4.CPU is at EL3, secure read access;

[0050] 5. The CPU is in EL1 (NS), non-secure write access, and the write value is the reset value;

[0051] 6.CPU is in EL1(NS), non-secure read access;

[0052] 7.CPU is at EL3, secure read access;

[0053] 8.CPU is in EL3, safe write access, write value is reset value;

[0054] 9. The CPU is in EL1 (NS), non-secure write access, and the write value is the maximum value;

[0055] 10.CPU is at EL3, secure read access;

[0056] 11.CPU is in EL3, write reset value;

[0057] 12.CPU is in EL3, read reset value.

[0058] Each of the above-mentioned test steps has a unique test ID, so as to facilitate subsequent comparison of the same test ID with the expected result.

[0059] When multiple registers to be tested include second-class registers (also called special registers), when the processor performs access test on the registers to be tested in the SOC chip according to the test rules in the register test file, the process may be: the processor performs secure read reset value access, secure write access with the write value being the maximum value of the register, and secure read access on the second-class registers in sequence according to the test rules in the register test file. This type of register does not meet the normal readable and writable attributes, and only three secure accesses are performed on this type of register. The test scenarios are: read value, write maximum value, read value, and each register is accessed 3 times.

[0060] In a possible implementation manner, the process of the processor (such as a CPU) performing a directional test on the second type of registers may be:

[0061] 1.CPU is in EL3, secure read access;

[0062] 2. The CPU is in EL3, with secure write access, and the write value is the maximum value, for example, 0xf;

[0063] 3.CPU is in EL1(NS), non-secure read access;

[0064] Each of the above test steps has a unique test ID, which facilitates subsequent comparison of the same test ID with the expected result.

[0065] When multiple registers to be tested include third-category registers (also referred to as ordinary registers), when the processor performs an access test on the registers to be tested in the SOC chip according to the test rules in the register test file, the process may be: the processor performs secure read access, secure write access and the write value is the maximum value of the register, non-secure read access, secure read access, non-secure write access and the write value is the reset value, non-secure read access, secure read access, random access, secure write access and the write value is the reset value, non-secure write access and the write value is the maximum value of the register, secure read access, secure write access and the write value is the reset value, and secure read access on the third-category register in sequence according to the test rules in the register test file.

[0066] For ordinary registers, this type of register meets the normal readable and writable properties and does not affect the test of other registers in the SOC chip. All ordinary registers can be randomly tested to randomly generate the above scenario, and the number of accesses to each register is uncertain. For ordinary registers, during the multiple access tests of each register, the test of other ordinary registers can be inserted, that is, when testing ordinary registers, cross-tests can be performed with other ordinary registers.

[0067] In one implementation, the process of a processor (such as a CPU) performing a random test on a common register (such as a reg_D register) may be:

[0068] 1.CPU is in EL3, secure read access;

[0069] 2. The CPU is in EL3, with secure write access, and the write value is the maximum value, such as 0xf in this example;

[0070] 3.CPU is in EL1(NS), non-secure read access;

[0071] 4.CPU is at EL3, secure read access;

[0072] 5. The CPU is in EL1 (NS), non-secure write access, and the write value is the reset value;

[0073] 6.CPU is in EL1(NS), non-secure read access;

[0074] 7.CPU is at EL3, secure read access;

[0075] 8. Random access;

[0076] 9.CPU is in EL3, safe write access, write value is reset value;

[0077] 10. The CPU is in EL1 (NS), non-secure write access, and the write value is the maximum value;

[0078] 11.CPU is at EL3, secure read access;

[0079] 12.CPU is in EL3, safe write access, write value is reset value;

[0080] 13.CPU is at EL3, secure read access.

[0081] Using random access can cover more test scenarios and fully verify the functions of common registers (such as reg_D register). For the random access in 8 above, based on the cross access with other registers, the register will randomly make the following accesses:

[0082] 1.CPU is in EL3, secure write access, write value 0x0;

[0083] 2. The CPU is in EL1 (NS), non-secure write access, write a random value such as the random value is 0x9;

[0084] 3. The CPU is in EL3, secure read access, and the register read value is 0x7.

[0085] Each of the above test steps has a unique test ID, which facilitates subsequent comparison of the same test ID with the expected result.

[0086] In the above test process, if an abnormal situation occurs, the key information of the abnormal situation (such as abnormal time, abnormal type, etc.) will be synchronously stored in the test results, and there is no need to record the waveform information again for retesting. In addition, the simulation error points can be clearly viewed from the test results, which is convenient for reproducing the error scenario, reducing a large number of manual processing processes and improving the accuracy of test result comparison.

[0087] In one possible implementation, the processor is also configured to store the test results in a memory, read the test results from the memory, and compare the test results with the same test identifier with the expected results of the register, and output a test log, wherein the test log includes the test identifier testID, the level of the processor (EL level in a secure state or an unsecure state), the register information to be tested (including the register name, register size, register access attributes, access address (addr), offset (offset), reset value, etc.), access mode (read or write), and comparison results of the access data.

[0088] Among them, the expected result is determined according to the register information file and the preset test rules, and the expected result and the test result have the same dimension parameter type, which is used to verify the test result. In the embodiment of the present application, the corresponding expected test result can be set by parsing the register information file and the preset test rules, and combining the attribute information of the register, so that when verifying the test effect of the register later, the processor can obtain the expected result, compare the test result with the same test identifier with the expected result of the register, and output the test log.

[0089] For example, taking the test of a non-secure attribute register (such as uart1 register) as an example, it is valid for the processor to access the register at the secure EL3 level or the non-secure EL1 level, and the register test passes. In one implementation mode, the test result may be:

[0090] 1.testID:0, the core is at EL3 and reads the register. The read value is consistent with the reset value.

[0091] 2.testID:3, the core is at EL3 and writes the value 0xffff0700 to this register.

[0092] 3.testID:5, the core reads the register in non-secure EL1, and the read value is 0xffff0700.

[0093] 4.testID:7, the core reads the register at EL3, and the read value is 0xffff0700.

[0094] 5.testID:8, the core is at EL3 and writes the value 0x300 to this register.

[0095] 6.testID:15, the core is in non-secure EL1 and writes the value 0x4d60600 to this register.

[0096] 7. testID: 17, the core reads the register at secure EL3, and the read value is 0x4d60600. In one implementation, when the test result with the same test ID is compared with the expected result of the register, the output test log can be shown in Table 1.

[0097] Table 1

[0098]

[0099] In some possible implementations, during the test process, a test integrity check can also be performed, and the processor is also configured to record the test addresses of the registers tested during the test process, and compare the recorded test addresses with the address bins to calculate the test coverage; if the test coverage is lower than the threshold, the processor can also perform access tests on the registers not covered in the address bins according to the test rules in the register test file. Among them, the address bins record the addresses of all registers to be tested in the SOC chip. Assuming that there are 100 addresses of registers to be tested, and the test addresses of the registers tested during the recorded test process are 70, the test coverage is 70%. By comparing the test addresses of the registers tested during the recorded test process with the addresses in the address bins, the registers not covered in the address bins can be known.

[0100] Wherein, the register test file can be obtained in the following manner, or the step of obtaining the register test file may include: obtaining the register information file (which may be in json format) of the register to be tested in the SOC chip; generating a directional test sequence according to the first type of registers, the second type of registers and the preset test rules in the register information file, and generating a random test sequence according to the third type of registers in the register information file and the preset test rules; merging the directional test sequence and the random test sequence to generate a register test sequence, wherein each test mode of each register in the register test sequence has a unique test identifier; converting the register test sequence into an excitation test instruction and compiling it to generate a register test file. Some tools for converting register test sequences into excitation test instructions can be used to convert the register test sequence into an excitation test instruction, and then the excitation test instruction is binary compiled to obtain a register test file. Wherein, the random items of the random test sequence include random addresses, random access operations, random EL levels of the processor, and random security / non-security attributes of register access requests, wherein the request operations include: reading values, writing flip values ​​of reset values, writing random values, writing reset values, and writing input values, and all of the above random items and request operations can be cross-random. When merging random test sequences and directed test sequences, the testIDs are generated in order to ensure the uniqueness of the IDs for subsequent data comparison.

[0101] Among them, the first category registers and the second category registers in the register information file can be manually classified and labeled. The preset test rules can be set according to the test requirements, and the access mode of the test access (such as continuous writing, continuous reading, alternating reading and writing, etc.) and the level of the processor can be set. The access data, such as the write value, can also be set, and the test identification and the access order of the registers can be set.

[0102] Designated registers and special registers can flexibly adjust the test strategy without affecting the test results of other registers. This solution provides a solution that meets the register test requirements. Special registers and designated registers need to pre-specify the address information of this type of register. When generating the register test sequence of the entire SOC chip, it will be considered that this type of register belongs to the fixed test register group and a directional test sequence will be generated. Among them, if the SOC chip does not contain the first type of registers and / or the second type of registers, only a random test sequence will be generated.

[0103] In a possible implementation manner, the step of obtaining the register information file can be performed in the following manner, or the step of obtaining the register information file includes: extracting the specified information of each register according to the original register specification file of the SOC chip (which can be in the format of xls (Excel file) or xml (eXtensible Markup Language)); wherein the specified information includes the register address, name, reset value, access attributes of each field, security attributes, and function; classifying the registers of the SOC chip according to the attribute information (including access attributes of each field, security attributes) and function in the specified information to obtain first-category registers, second-category registers, and third-category registers; merging the first-category registers, the second-category registers, and the third-category registers in a specified order to obtain a register information file of a specified format containing all registers, and the specified format can be in the format of json (JavaScript Object Notation), and in addition, it can also be in the format of html (Hyper Text Markup Language) for subsequent display.

[0104] Among them, when classifying the registers of the SOC chip according to the attribute information (including the access attributes of each field and the security attributes) and the function in the specified information, the classification and labeling can be performed manually, or a manual instruction can be given to control the device to classify, and the first category registers and the second category registers can be labeled differently to distinguish them from the third category registers. It is understandable that not all SOC chips involve the first category registers and / or the second category registers.

[0105] In one implementation mode, it is assumed that the original register specification file in the SOC chip after sorting is as shown in Table 2.

[0106] Table 2

[0107]

[0108] Based on Table 2, it can be seen that after the corresponding bit [3:0] of reg_C is written to 1, only reset can clear it to zero. It can be seen that reg_C does not follow the conventional readable and writable properties, so reg_C can be classified as a special register. Perform two consecutive write operations on register reg_C, the first write value is 0xf, the second write value is 0x3, and then the register is read. If it is a normal register, the second write value 0x3 will be read, but the register read value is 0xf, because the function description of the register is "After the corresponding bit [3:0] of the register is written to 1, only reset can clear it to zero. For example, after writing 0x1, then writing 0x0, the read value is still 0x1". Therefore, unless a reset operation is performed, after bit [3:0] is written to 1, the subsequent write operation of any bit [3:0] to 0 will be invalid. According to the example just now, there is no reset operation in the middle, so the second write 0x3, the [3:2] bit is written to 0, the operation is invalid, so 0xf is still read.

[0109] reg_A and reg_B are the specified registers mentioned above, and a directional test sequence needs to be generated. Both registers will affect the test of other registers in the SOC chip. reg_D and reg_E are common registers that meet the requirements of random testing.

[0110] In using the above Figure 1 When the SOC chip shown performs a register test, its test process may be: first, preload the register test file into the memory; when the SOC chip is powered on, the processor automatically reads the register test file in the memory via the on-chip network; after the processor obtains the register test file, it parses it, and according to the content contained in the test rules in the register test file, issues a test access request to the corresponding register to access the above-mentioned IP-A, IP-B, IP-C, and IP-N; the test access request issued by the processor is forwarded to each IP via the on-chip network. During this process, the processor records the access information of the test access request in real time to obtain the test result. After the register access is completed, the processor writes the test result recorded during the access process into the memory; after the processor has accessed all registers according to the requirements of the register test file, it ends this access, and then obtains the test results stored in the memory, as well as the expected results (which can be stored in the memory), and compares the test results with the same test identifier with the expected results of the register, and outputs the test log.

[0111] In a possible implementation manner, the schematic diagram of the above register testing method can be as follows: Figure 2As shown. First, according to the original register specification file of the SOC chip, the registers in the SOC chip are classified, such as classified into the first type of registers, the second type of registers, and the third type of registers, and the registers of different types are merged in the specified order to obtain a register information file in json format. According to the register information file and the test rules, the expected results are determined and stored in the memory for subsequent comparison, and according to the register information file and the test rules, a directional test sequence and a random test sequence are generated (if the SOC chip does not contain the first type of registers and / or the second type of registers, only a random test sequence will be generated), and the sequence is merged to generate a register test sequence, which is converted into an excitation test instruction and compiled to generate a register test file; then, according to the test rules in the register test file, the registers to be tested in the SOC chip are accessed and tested, and the test results are stored in the memory; the test results with the same test identifier are compared with the expected results of the register, and the test log is output.

[0112] The register test method shown in this application can cover the test scenarios of switching CPU EL level (secure / unsecure state) to access registers with different security attributes, can automatically record abnormal information during the test, can automatically detect test results, and output test logs. It can optimize the result detection of register tests, reduce the manual intervention process during the test, and improve the test efficiency of registers.

[0113] The present application also provides a register test method for the above-mentioned SOC chip. Figure 3 The register testing method provided in the embodiment of the present application is described.

[0114] S1: The processor reads a register test file from the memory.

[0115] The register test file can be stored in the memory in advance, and when used later, the register test file can be directly read from the memory, wherein the register test file contains test rules for testing the registers to be tested in the SOC chip, which can be obtained according to the register information file and the test rules. For example, in one implementation, a directional test sequence can be generated according to the first type of registers, the second type of registers and the preset test rules in the register information file, and a random test sequence can be generated according to the third type of registers in the register information file and the preset test rules; the directional test sequence and the random test sequence are combined to generate a register test sequence, wherein each test mode of each register in the register test sequence has a unique test identifier; the register test sequence is converted into a stimulus test instruction and compiled to generate a register test file.

[0116] In one implementation mode, the step of obtaining a register information file may include: extracting specified information of each register according to an original register specification file of the SOC chip; wherein the specified information includes a register address, a name, a reset value, access attributes of each field, security attributes, and a function; classifying the registers of the SOC chip according to the attribute information and the function in the specified information to obtain first-category registers, second-category registers, and third-category registers; merging the first-category registers, the second-category registers, and the third-category registers in a specified order to obtain a register information file of a specified format containing all registers.

[0117] S2: The processor performs an access test on the register to be tested in the SOC chip according to the test rules in the register test file to obtain a test result.

[0118] After reading the register test file from the memory, the processor performs an access test on the register to be tested in the SOC chip according to the test rules in the register test file to obtain a test result. The access test includes at least one of continuous writing, continuous reading, and alternating reading and writing when the processor is at a specified level, the specified level includes a security level and / or a non-security level, and the written value includes at least one of a register maximum value, a reset value, a reset value inverse, and a random value.

[0119] In one implementation mode, the implementation process of S2 above may be: the processor parses the test rules in the register test file, wherein the test rules include: attribute information of the register to be tested, access address, access method, level to be switched by the processor, test identifier, and access data; the processor issues a test access request to the corresponding register according to the content contained in the test rules; the processor records the access information of the test access request to obtain the test result.

[0120] In one implementation mode, multiple registers to be tested include a first type of registers, and the implementation process of the above S2 may be: the processor performs secure read access, secure write access and the write value is the maximum value of the register, non-secure read access, secure read access, non-secure write access and the write value is the reset value, non-secure read access, secure read access, secure write access and the write value is the reset value, non-secure write access and the write value is the maximum value of the register, secure read access, secure write access and the write value is the reset value, and secure read access on the first type of register in sequence according to the test rules in the register test file.

[0121] In one implementation, multiple registers to be tested include second-category registers, and the implementation process of the above S2 may be: the processor performs secure read reset value access, secure write access with the write value being the register maximum value, and secure read access on the second-category register in sequence according to the test rules in the register test file.

[0122] In one implementation mode, multiple registers to be tested include a third type of register, and the implementation process of the above S2 may be: the processor performs secure read access, secure write access and the write value is the maximum value of the register, non-secure read access, secure read access, non-secure write access and the write value is the reset value, non-secure read access, secure read access, random access, secure write access and the write value is the reset value, non-secure write access and the write value is the maximum value of the register, secure read access, secure write access and the write value is the reset value, and secure read access on the third type of register in sequence according to the test rules in the register test file.

[0123] In one implementation, the above-mentioned register testing method also includes: storing the test results in a memory; the processor reads the test results from the memory, and compares the test results with the same test identifier with the expected results of the register, and outputs a test log, wherein the test log includes the test identifier, the level of the processor, the register information to be tested, the access method, and the comparison result of the access data; wherein the expected result is determined based on the register information file and the preset test rules, and the expected result is used to verify the test result, and has the same dimension parameter type as the test result.

[0124] In one implementation, the above-mentioned register testing method also includes: the processor records the test address of the register tested during the test process, and compares the recorded test address with the address bin to calculate the test coverage; wherein the address bin records the addresses of all registers to be tested in the SOC chip; if the test coverage is lower than the threshold, the processor performs an access test on the uncovered registers in the address bin according to the test rules in the register test file.

[0125] The register testing method provided in the embodiment of the present application has the same implementation principle and technical effects as those in the aforementioned SOC chip embodiment. For the sake of brief description, for matters not mentioned in the method embodiment, reference may be made to the corresponding contents in the aforementioned SOC chip embodiment.

[0126] like Figure 4 As shown, Figure 4 The electronic device 200 provided in the embodiment of the present application is shown in the structural block diagram. The electronic device 200 comprises: a transceiver 210, a memory 220, a communication bus 230 and a processor 240.

[0127] The transceiver 210, the memory 220, and the processor 240 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses 230 or signal lines, or connected through an on-chip network. Among them, the transceiver 210 is used to send and receive data. The memory 220 is used to store computer programs, wherein the computer program includes at least one software function module that can be stored in the memory 220 in the form of software or firmware (Firmware) or solidified in the operating system (Operating System, OS) of the electronic device 200. The processor 240 is used to execute the software function module or computer program stored in the memory 220 to execute the above-mentioned register testing method.

[0128] Among them, the memory 220 can be, but is not limited to, random access memory (Random Access Memory, RAM), read only memory (Read Only Memory, ROM), programmable read-only memory (Programmable Read-Only Memory, PROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, EPROM), electrically erasable read-only memory (Electric Erasable Programmable Read-Only Memory, EEPROM), etc.

[0129] The processor 240 may be an integrated circuit chip with signal processing capabilities. The above-mentioned processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), a microprocessor, etc.; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The various methods, steps and logic block diagrams disclosed in the embodiments of the present application may be implemented or executed. Alternatively, the processor 240 may also be any conventional processor, etc.

[0130] The electronic device 200 mentioned above includes but is not limited to a mobile phone, a tablet, a computer, a server, etc.

[0131] An embodiment of the present application further provides a non-volatile computer-readable storage medium (hereinafter referred to as storage medium), on which a computer program is stored. When the computer program is run by a computer such as the above-mentioned electronic device 200, the register testing method shown above is executed.

[0132] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0133] In several embodiments provided in the present application, it should be understood that the disclosed method can also be implemented in other ways. The embodiments described above are merely schematic, for example, the flowcharts and block diagrams in the accompanying drawings show the possible implementation architecture, functions and operations of the methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of the boxes in the block diagram and / or the flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0134] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0135] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a computer-readable storage medium, including several instructions for a computer device (which can be a personal computer, a laptop, a server, or an electronic device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned computer-readable storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0136] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A register testing method, characterized in that: Applied to a SOC chip, the SOC chip includes a processor, a memory, and a plurality of registers to be tested, the processor is connected to the memory and the plurality of registers, and the method includes: The processor reads a register test file from the memory, wherein the register test file includes a test rule for testing a register to be tested in the SOC chip; The processor performs an access test on the register to be tested in the SOC chip according to the test rules in the register test file to obtain a test result; Among them, the access test includes at least one of continuous writing, continuous reading, and alternating reading and writing when the processor is at a specified level, the specified level includes a security level and / or a non-security level, and the write value includes at least one of a register maximum value, a reset value, a reset value inverted, and a random value.

2. The method according to claim 1, characterized in that The processor tests the register to be tested in the SOC chip according to the test rules in the register test file, including: The processor parses the test rules in the register test file, wherein the test rules include: attribute information of the register to be tested, access address, access mode, level to be switched by the processor, test identifier, and access data; The processor issues a test access request to a corresponding register according to the content contained in the test rule; The processor records the access information of the test access request and obtains a test result.

3. The method according to claim 1, characterized in that The plurality of registers to be tested include first-category registers, and the processor performs access testing on the registers to be tested in the SOC chip according to the testing rules in the register testing file, including: The processor performs secure read access, secure write access and the written value is the maximum value of the register, non-secure read access, secure read access, non-secure write access and the written value is the reset value, non-secure read access, secure read access, secure write access and the written value is the reset value, non-secure read access, secure read access, secure write access and the written value is the reset value, non-secure write access and the written value is the maximum value of the register, secure read access, secure write access and the written value is the reset value, and secure read access on the first type of register in sequence according to the test rules in the register test file.

4. The method according to claim 1, characterized in that: The plurality of registers to be tested include second-category registers, and the processor performs access testing on the registers to be tested in the SOC chip according to the test rules in the register test file, including: The processor performs secure read reset value access, secure write access with the write value being the register maximum value, and secure read access on the second type of register in sequence according to the test rules in the register test file.

5. The method according to claim 1, characterized in that The plurality of registers to be tested include third-category registers, and the processor performs access testing on the registers to be tested in the SOC chip according to the test rules in the register test file, including: The processor performs secure read access, secure write access and the write value is the maximum value of the register, non-secure read access, secure read access, non-secure write access and the write value is the reset value, non-secure read access, secure read access, random access, secure write access and the write value is the reset value, non-secure write access and the write value is the maximum value of the register, secure read access, secure write access and the write value is the reset value, and secure read access on the third category register in sequence according to the test rules in the register test file.

6. The method according to any one of claims 1 to 5, characterized in that The step of obtaining the register test file comprises: Obtaining a register information file of a register to be tested in the SOC chip; Generate a directional test sequence according to the first type of registers, the second type of registers and the preset test rules in the register information file, and generate a random test sequence according to the third type of registers in the register information file and the preset test rules; Combining the directional test sequence and the random test sequence to generate the register test sequence, wherein each test mode of each register in the register test sequence has a unique test identifier; The register test sequence is converted into stimulus test instructions and compiled to generate the register test file.

7. The method according to claim 6, characterized in that The step of obtaining the register information file comprises: Extracting the specified information of each register according to the original register specification file of the SOC chip; wherein the specified information includes the register address, name, reset value, access attributes of each field, security attributes, and function; Classifying the registers of the SOC chip according to the attribute information and the function in the designated information to obtain first-category registers, second-category registers, and third-category registers; The first category registers, the second category registers and the third category registers are merged in a specified order to obtain the register information file in a specified format including all registers.

8. The method according to claim 1, characterized in that The method further comprises: The processor stores the test result in the memory; the processor reads the test result from the memory, and compares the test result with the same test identifier with the expected result of the register, and outputs a test log, wherein the test log includes the test identifier, the level of the processor, the register information to be tested, the access mode, and the comparison result of the access data; The expected result is determined according to the register information file and preset test rules, and the expected result is used to verify the test result, and has a parameter type of the same dimension as the test result.

9. The method according to claim 1, characterized in that: The method further comprises: The processor records the test addresses of the registers tested during the test, and compares the recorded test addresses with the address bins to calculate the test coverage; wherein the address bins record the addresses of all the registers to be tested in the SOC chip; If the test coverage is lower than a threshold, the processor performs an access test on the uncovered registers in the address bin according to the test rules in the register test file.

10. A SOC chip, characterized in that: include: Multiple registers to be tested; A memory, used to store a register test file, wherein the register test file includes a test rule for testing a register to be tested in the SOC chip; A processor is connected to the memory and the plurality of registers via an on-chip network, and the processor is configured to: read a register test file from the memory, and perform an access test on the registers to be tested in the SOC chip according to the test rules in the register test file to obtain a test result; wherein the access test includes at least one of continuous writing, continuous reading, and alternating reading and writing when the processor is at a specified level, the specified level includes a security level and / or a non-security level, and the write value includes at least one of a register maximum value, a reset value, an inverse of a reset value, and a random value.

11. An electronic device, characterized in that: include: A memory and a processor, wherein the processor is connected to the memory via an on-chip network; The memory is used to store programs; The processor is used to call the program stored in the memory to execute the method according to any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor, the method according to any one of claims 1 to 9 is executed.

Citation Information

Cited By

  • Chip testing method, device, equipment and medium

    CN121027804A

  • Methods, apparatus, devices, and media for chip testing

    CN121027804B

  • Kernel unit test method based on EL2 hierarchy

    CN121144215A

  • Kernel unit test method based on el2 level

    CN121144215B