A script-based mcu register test automation method and system thereof

CN122925207APending Publication Date: 2026-10-16INGENIC SEMICON CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510430825.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-08
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

整个过程不仅耗费人力、物力,而且随着软件版本的迭代更新,每一次变更都可能引发新的问题,需要重新进行全面的REG测试,严重拖慢了设计开发周期

Benefits of technology

[0045] Compared to traditional REG testing methods, the scripting technology used in this invention significantly improves efficiency. Taking a medium-sized MCU system as an example, this MCU involves registers containing various states, commands, and control information, with at least around 2000 registers. In the traditional manual testing mode, completing a full round of REG testing requires approximately three days for testers. This includes tedious steps such as manually setting up the test environment, writing and inputting test data one by one, and manually observing and recording results. Furthermore, due to the error-prone nature of manual operation, additional time is required for error troubleshooting and retries.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122925207A_ABST
    Figure CN122925207A_ABST
Patent Text Reader

Abstract

The application provides a script-based MCU register test automation method and system, which improves the register test efficiency of MCU chips through the automation method and system, and changes the test work which originally needs several days of engineers into an automatic process, and automatically compares the results, so that manual inspection is not needed, time is saved, and the possibility of errors is reduced. The method and system are related to the field of MCU testing, and in particular to a method and system for speeding up register testing by using scripts.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of MCU testing technology, and specifically relates to a script-based automated method and system for MCU register testing. Background Technology

[0002] In today's digital age, MCU systems are becoming increasingly complex with numerous functional modules. Registers (REGs), as a crucial part of software-hardware interaction, require comprehensive and efficient testing. Register testing is a core step in ensuring test quality, stability, and reliability, while REG testing directly relates to whether the software can accurately manipulate hardware resources and achieve the intended functionality. With the continuous expansion of software scale, traditional manual REG testing methods are becoming increasingly inefficient and unable to meet the demands of rapid iterative development. This invention aims to significantly improve testing efficiency and shorten the testing cycle by innovatively applying scripting technology to automate and batch execute the REG testing process.

[0003] Solutions based on packaging design reduce radiation by adding shielding materials to the outside of the chip; for example, adding a protective shell that can absorb radiation or contact pins that can reduce radiation. Solutions based on filtering devices use dedicated devices to filter unwanted radiation; for example, capacitors can filter some of the radiation energy, and reactance can filter some of the radiation energy.

[0004] However, the problem with the existing technology is that:

[0005] MCU chips have a large number of registers, making test case writing a significant undertaking. This requires testers to have an extremely deep understanding of the chip's logic. They must consider various normal and extreme operating scenarios, from normal use and operation to the system's response under high concurrency and large data volumes, as well as potential device anomalies and hardware failures. Each functional point can potentially generate dozens of different test scenarios, making test case writing an enormous workload.

[0006] During the test case execution phase, testers must manually input test data one by one and carefully observe the running status of the test cases. Due to the large number of test cases, this process is extremely tedious, and prolonged repetitive operation can easily lead to fatigue and oversights. After each test case is executed, the test results, including actual output, register status, system response time, and other detailed information, must be accurately recorded. If the test results are found to be inconsistent with expectations, testers must rely on experience and understanding of the system to attempt to initially locate the problem, which undoubtedly further increases the difficulty and complexity of the testing.

[0007] After testing is completed, analyzing the large number of test results is also a challenging task. Testers need to compare the actual results of each test case with the expected results, filter out the failed test cases, and then delve into the root causes of the failures. This may involve repeated communication with the development team, checking code logic, hardware settings, and even tracing back to whether there were any misunderstandings during the requirements analysis phase. The entire process is not only costly in terms of manpower and resources, but also, with each iteration and update of the software version, each change may cause new problems, requiring a complete REG test to be performed again, which seriously slows down the design and development cycle.

[0008] Most existing technologies address general problems; however, register testing in MCU chips is difficult to solve using general methods. Special logic always needs to be added on top of existing technologies, which leads to a lot of manual modifications later and can easily cause errors. If special logic is also generated automatically, the automation scripts become very redundant, verbose, and complex, making them difficult to debug and reuse. Using only existing solutions greatly increases testing costs and is difficult to promote in MCU designs where project time is critical. Some special non-general application scenarios require specialized testing, which is difficult to meet customer needs even if cost is not a concern.

[0009] In addition, the relevant technical terms are as follows:

[0010] ASIC (Application-Specific Integrated Circuit): This refers to a custom integrated circuit designed according to specific application requirements.

[0011] SOC: System on a chip, which implements a system on a single chip, including CPU, memory, peripherals, etc.

[0012] REG: Register, stores configuration information, configured after power-on.

[0013] CPU: Central Processing Unit, which executes an instruction set. Programs are compiled and executed on the CPU. UVM: Universal Verification Methodology.

[0014] MCU: Microcontroller.

[0015] FSM: Finite State Machine, which controls logic operation through a finite number of state transitions. PWM: Pulse Width Modulation Unit, which controls the pulse width of the output signal. Summary of the Invention

[0016] To address the aforementioned problems, the purpose of this invention is to improve the efficiency of MCU chip register testing through an automated testing method and system; to transform a testing process that previously required several days of engineer time into an automated process; and to automate the comparison of results without requiring manual inspection, thereby saving time and reducing the possibility of errors. This method and system pertain to the field of MCU testing, and particularly to a method and system for accelerating register testing using scripts.

[0017] Specifically, the present invention is a script-based automated method for testing MCU registers, the method comprising the following steps:

[0018] S1, Input register information: Read the register definition and read / write control information from the design document. The information includes the register address, name, read / write attributes, and expected value.

[0019] S2, Script Reading and Parsing: Use a scripting language to read and parse the register information, and convert it into a data structure that the script can recognize and process;

[0020] S3, Generate test modes: Generate multiple test cases based on the parsed register information, that is, generate multiple test modes based on the readable and writable bits of the register. The test modes include, but are not limited to, all 1, all 0, and alternating 01 / 10 modes, to perform read and write tests.

[0021] S4, execute the test cases and check if the tests pass:

[0022] If the test fails, debug and correct the test cases, and return to step S3 to re-execute the test;

[0023] If the test passes, collect the test results and logs, and generate a test report.

[0024] In step S2, the input information for the script includes: the designer records the definition and read / write control information of registers in the document, assuming:

[0025] 1.REGA={"addr":0x1000,"name":Status,"op":readonly,"expect":0xfefe} 2.REGB={"addr":0x1004,"name":Cmd,"op":wronly,"expect":0x0004}

[0026] This information details the address, name, read / write attributes, and expected value of each register, serving as input to the method script and providing foundational data for subsequent testing.

[0027] Step S4 further includes:

[0028] S4.1, Automated Test Case Execution: Batch and automatically run test cases, automatically compare test results, and monitor all results during the testing process;

[0029] S4.2, Utilizing System Tools: Using tools provided by the operating system for error capture and result comparison; S4.3, Meeting Special Needs: Outputting intermediate files that engineers can manually modify to meet special needs; the intermediate files allow engineers to manually add or modify test requirements for special registers; S4.4, Multi-core Parallel Acceleration: Utilizing multi-core processors to execute test tasks in parallel to accelerate the testing process;

[0030] S4.5, Test Result Inspection and Correction: Check the test results according to the log file records. If there are any errors, correct them and retest.

[0031] In step S4.4, the multi-core parallel acceleration step, the test tasks are reasonably allocated to different cores to make full use of the performance advantages of multi-core processors.

[0032] In step S4.5, the test result checking and correction step, the log file is used to record all operations and results during the test process to facilitate error checking and correction.

[0033] The scripting language is Python.

[0034] The system tools include a diff tool, which is used to quickly compare differences between different test results.

[0035] This application also relates to a script-based automated system for testing MCU registers, the system being applicable to any of the methods described above, comprising:

[0036] The input module is used to read register definitions and read / write control information from the design document;

[0037] The script parsing module is used to read and parse the register information using a scripting language;

[0038] The test mode generation module generates various test modes based on the readable and writable bits of registers; the automated execution module automatically runs test cases in batches and automatically compares the test results; including:

[0039] The system tool unit is used to perform error capture and result comparison using tools provided by the operating system; the special requirements processing unit is used to output intermediate files and allow engineers to modify them manually.

[0040] Multi-core parallel unit, used to execute test tasks in parallel using multi-core processors;

[0041] The result checking and correction unit is used to check and correct the test results recorded in the log file.

[0042] The scripting language is Python.

[0043] The system tool unit includes a diff tool, which is used to quickly compare differences between different test results.

[0044] The beneficial effects of this invention include:

[0045] Compared to traditional REG testing methods, the scripting technology used in this invention significantly improves efficiency. Taking a medium-sized MCU system as an example, this MCU involves registers containing various states, commands, and control information, with at least around 2000 registers. In the traditional manual testing mode, completing a full round of REG testing requires approximately three days for testers. This includes tedious steps such as manually setting up the test environment, writing and inputting test data one by one, and manually observing and recording results. Furthermore, due to the error-prone nature of manual operation, additional time is required for error troubleshooting and retries.

[0046] By employing the scripting technology of this invention, the script can automatically and quickly build a test environment based on preset configurations, batch import pre-written test cases, and execute them automatically. Through a parallel processing mechanism, it fully utilizes the performance advantages of multi-core processors, simultaneously operating on multiple test cases. Thousands of test cases that previously required manual execution can now complete the first round of testing within hours. Furthermore, during design iterations and updates, only minor adjustments to the script are needed to quickly restart testing, significantly increasing the testing frequency and ensuring that the design keeps pace with changing requirements for timely verification, thereby greatly improving overall development efficiency. Attached Figure Description

[0047] The accompanying drawings, which are provided to further illustrate the invention and form part of this application, are not intended to limit the scope of the invention.

[0048] Figure 1 This is a schematic diagram of the method flow of this application.

[0049] Figure 2 This is a schematic diagram illustrating the method code example of this application.

[0050] Figure 3 A flowchart illustrating an embodiment of the method in this application.

[0051] Figure 4 This is a block diagram of the system of this application. Detailed Implementation

[0052] To better understand the technical content and advantages of the present invention, the present invention will now be described in further detail with reference to the accompanying drawings.

[0053] This invention relates to a script-based register testing method for MCUs. Addressing the issue of low efficiency and error-prone manual testing of the large number of registers required for MCU testing, this invention introduces a basic script-based register testing method. Furthermore, it addresses the unique non-standard requirements of MCUs, particularly the diverse sources of register modifications beyond standard bus operations, such as those from various state machines and counters. The invention improves and adapts these methods to automate register testing on MCU-like chips.

[0054] This invention proposes a script-based automated solution for register testing on MCUs, aiming to solve problems such as low efficiency in MCU chip register testing and errors in manual testing.

[0055] In current MCU testing, REG testing is a crucial step in ensuring the smooth operation of software and hardware. The proper functioning of both digital and analog circuits depends on the precise operation of registers, and the comprehensiveness and accuracy of REG testing directly impact the performance, stability, and reliability of the entire MCU system.

[0056] Manual testing of REG registers is inefficient and prone to errors. As MCU systems become increasingly complex and the number of registers increases, manual testing requires a significant investment of time and effort. Furthermore, prolonged repetitive operations can lead to tester fatigue, resulting in oversights and affecting the accuracy of test results.

[0057] Script input information: Designers record register definitions and read / write control information in the documentation, for example:

[0058] 1).REGA={"addr":0x1000,"name":Status,"op":readonly,"expect":0xfefe}

[0059] 2).REGB={"addr":0x1004,"name":Cmd,"op":wronly,"expect":0x0004}

[0060] This information details the address, name, read / write attributes, and expected value of each register, serving as input to the script of this invention and providing basic data for subsequent testing.

[0061] Script Information Reading: Ordinary scripts (such as Python) can read the register information described in the documentation. Python has powerful text processing and data parsing capabilities, easily reading documents containing register information and converting them into data structures that the script can recognize and process, facilitating subsequent operations based on testing needs.

[0062] Test Mode Generation: Based on testing requirements, multiple test modes are generated for the read / write bits (RW) of each register, such as all 1s, all 0s, and alternating 01 / 10 modes for read / write testing. These different test modes comprehensively detect whether the register's read / write functionality is normal under various conditions, covering more potential error scenarios.

[0063] Advantages of Automated Test Case Execution: Automated test case execution avoids the limitations of traditional manual testing. It can automatically run test cases in batches, greatly shortening the testing cycle. At the same time, the script automatically compares test results, not only avoiding the errors caused by human intervention, but also accurately monitoring all results during the testing process. Through automatic comparison, even minor register errors can be detected in a timely manner, preventing project delays caused by problems discovered later.

[0064] Utilizing system tools: Employ operating system-provided tools, such as general-purpose scripts like diff, for error capture. Diff tools can quickly compare differences between various test results, helping testers accurately pinpoint errors. This approach avoids repetitive work for engineers, ensures a continuous and stable testing process, and achieves efficient and reliable testing.

[0065] Meeting Special Needs: Considering that each MCU may have unique requirements, such as special, non-general-purpose registers that require manual modification, the automated script outputs intermediate files that engineers can directly modify to add specific requirements. This design balances the efficiency of automated testing with the flexible interfaces of the MCU chip and the specificity of non-general-purpose needs.

[0066] Multi-core parallel acceleration: Based on the generated final file, all tests can be executed using multi-core parallel execution to accelerate the process. Test servers typically have multi-core processors; by rationally allocating test tasks to different cores, the performance advantages of multi-core processors can be fully utilized, further shortening test time and improving test efficiency.

[0067] Test Result Checking and Correction: After execution, the system checks the log file for errors. If no errors are found, the test is complete; if errors are found, they are corrected, and the test is repeated. This log-based error checking and correction mechanism ensures the accuracy and completeness of the test, guaranteeing the quality of the MCU chip registers.

[0068] like Figure 1 As shown, a script-based automated method for testing MCU registers includes the following steps:

[0069] S1, Input register information: Read the register definition and read / write control information from the design document. The information includes the register address, name, read / write attributes, and expected value.

[0070] S2, Script Reading and Parsing: Use a scripting language to read and parse the register information, and convert it into a data structure that the script can recognize and process;

[0071] S3, Generate test modes: Generate multiple test cases based on the parsed register information, that is, generate multiple test modes based on the readable and writable bits of the register. The test modes include, but are not limited to, all 1, all 0, and alternating 01 / 10 modes, to perform read and write tests.

[0072] S4, execute the test cases and check if the tests pass:

[0073] If the test fails, debug and correct the test cases, and return to step S3 to re-execute the test;

[0074] If the test passes, collect the test results and logs, and generate a test report.

[0075] Step S4 further includes:

[0076] S4.1, Automated Test Case Execution: Batch and automatically run test cases, automatically compare test results, and monitor all results during the testing process;

[0077] S4.2, Utilizing system tools: Using tools provided by the operating system for error capture and result comparison; S4.3, Meeting special needs: Outputting intermediate files that engineers can manually modify to meet specific requirements;

[0078] The intermediate files allow engineers to manually add or modify test requirements for special registers. S4.4, Multi-core Parallel Acceleration: Utilizes multi-core processors to execute test tasks in parallel, thereby accelerating the testing process;

[0079] S4.5, Test Result Inspection and Correction: Check the test results according to the log file records. If there are any errors, correct them and retest.

[0080] like Figure 2 The image shown is a code example, including:

[0081] Read the register file;

[0082] Initialize register values;

[0083] Analyze the register format;

[0084] Generate register contents;

[0085] Generate register test;

[0086] Perform register tests and verify the results: return a success flag if the test passes, and report an error message if the test fails.

[0087] like Figure 3 As shown, the specific implementation flow of this method includes:

[0088] Enter REG description: First, enter the description information of the register, including address, name, read / write attributes, and expected value.

[0089] Script input description: Use a scripting language (such as Python) to read and parse the input register description information, and convert it into a data structure that the script can recognize and process.

[0090] Generate test cases: Based on the parsed register information, generate various test cases, including all 1s, all 0s, alternating 01 / 10 test modes, etc.

[0091] Test pass / fail: Execute the generated test cases and check if the test passes.

[0092] No: If the test fails, proceed to the test case debugging step.

[0093] Yes: If the test passes, proceed to the report collection step.

[0094] Debug test cases: Debug test cases that fail, find the problems and fix them, and then re-execute the test.

[0095] Report Collection: After the test passes, collect the test results and logs, and generate a test report.

[0096] This process ensures the automation and efficiency of MCU register testing, while allowing for debugging and correction in case of test failures.

[0097] like Figure 4 As shown, the system framework of this application, the system being applicable to any of the methods described above, includes:

[0098] The input module is used to read register definitions and read / write control information from the design document;

[0099] The script parsing module is used to read and parse the register information using a scripting language;

[0100] The test mode generation module generates various test modes based on the readable and writable bits of registers; the automated execution module automatically runs test cases in batches and automatically compares the test results; including:

[0101] The system tool unit is used to perform error capture and result comparison using tools provided by the operating system; the special requirements processing unit is used to output intermediate files and allow engineers to modify them manually.

[0102] Multi-core parallel unit, used to execute test tasks in parallel using multi-core processors;

[0103] The result checking and correction unit is used to check and correct the test results recorded in the log file.

[0104] Compared to similar solutions in existing technologies, which are designed for specific bus interfaces or specific module structures and cannot flexibly meet the needs of MCU chips that require manual modification.

[0105] In summary, this invention employs automated test scripts to automate register testing, improving engineer efficiency, reducing testing time, and minimizing repetitive work. Whenever register logic is modified, simple regression testing can verify the correctness of the changes. Furthermore, it also accommodates manual modifications; by generating intermediate files based on automated testing, engineers can directly modify them to meet the flexible interface requirements of the MCU or non-general-purpose requirements specific to this chip.

[0106] The MCU chips involved in this technical solution can be applied to all series of chips from Ingenic Semiconductor and similar chips, as well as MCU chips suitable for Lumissil.

[0107] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, various modifications and variations can be made to the embodiments of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A script-based automated method for testing MCU registers, characterized in that, The method includes the following steps: S1, Input register information: Read the register definition and read / write control information from the design document. The information includes the register address, name, read / write attributes, and expected value. S2, Script Reading and Parsing: Use a scripting language to read and parse the register information, and convert it into a data structure that the script can recognize and process; S3, Generate test modes: Generate multiple test cases based on the parsed register information, that is, generate multiple test modes based on the readable and writable bits of the register. The test modes include, but are not limited to, all 1, all 0, and alternating 01 / 10 modes, to perform read and write tests. S4, execute the test cases and check if the tests pass: If the test fails, debug and correct the test cases, and return to step S3 to re-execute the test; If the test passes, collect the test results and logs, and generate a test report.

2. The script-based automated MCU register testing method according to claim 1, characterized in that, In step S2, the input information for the script includes: the designer records the definition and read / write control information of registers in the document, assuming:

1. REGA = {"addr":0x1000,"name":Status,"op":readonly,"expect":0xfefe} 2. REGB = {"addr":0x1004,"name":Cmd,"op":wronly,"expect":0x0004} This information details the address, name, read / write attributes, and expected value of each register, serving as input to the script for this method and providing foundational data for subsequent testing.

3. The script-based automated MCU register testing method according to claim 1, characterized in that, Step S4 further includes: S4.1, Automated Test Case Execution: Batch and automatically run test cases, automatically compare test results, and monitor all results during the testing process; S4.2, Utilizing System Tools: Using tools provided by the operating system for error capture and result comparison; S4.3, Meeting Special Needs: Outputting intermediate files that engineers can manually modify to meet special needs; the intermediate files allow engineers to manually add or modify test requirements for special registers; S4.4, Multi-core Parallel Acceleration: Utilizing multi-core processors to execute test tasks in parallel to accelerate the testing process; S4.5, Test Result Inspection and Correction: Check the test results according to the log file records. If there are any errors, correct them and retest.

4. The script-based automated method for MCU register testing according to claim 1, characterized in that, In step S4.4, the multi-core parallel acceleration step, the test tasks are reasonably allocated to different cores to make full use of the performance advantages of multi-core processors.

5. The script-based automated method for MCU register testing according to claim 1, characterized in that, In step S4.5, the test result checking and correction step, the log file is used to record all operations and results during the test process to facilitate error checking and correction.

6. The script-based automated method for MCU register testing according to claim 1, characterized in that, The scripting language is Python.

7. The script-based automated method for testing MCU registers according to claim 1, characterized in that, The system tools include a diff tool, which is used to quickly compare differences between different test results.

8. A script-based automated system for testing MCU registers, characterized in that, The system is applicable to the method described in any one of claims 1-7 above, comprising: The input module is used to read register definitions and read / write control information from the design document; The script parsing module is used to read and parse the register information using a scripting language; The test mode generation module is used to generate multiple test modes based on the readable and writable bits of the registers; The automated execution module is used to automatically run test cases in batches and automatically compare test results; it includes: The system tool unit is used to perform error capture and result comparison using tools provided by the operating system; the special requirements processing unit is used to output intermediate files and allow engineers to modify them manually. Multi-core parallel unit, used to execute test tasks in parallel using multi-core processors; The result checking and correction unit is used to check and correct the test results recorded in the log file.

9. The script-based automated MCU register testing system according to claim 8, characterized in that, The scripting language is Python.

10. The script-based automated MCU register testing system according to claim 8, characterized in that, The system tool unit includes a diff tool, which is used to quickly compare differences between different test results.