MCU verification method, system and terminal device

Register configuration messages are generated and compared through a universal verification platform, which solves the problems of heavy workload and difficulty in platform migration in existing MCU verification methods, and achieves efficient MCU system-level and module-level verification.

CN113076227BActive Publication Date: 2024-10-18SHENZHEN YSPRING TECH
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202110469341.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-28
Publication Date
2024-10-18
Estimated Expiration
2041-04-28

AI Technical Summary

Technical Problem

Existing MCU verification methods require the development of a large number of instruction programs and the construction of verification platforms for specific modules, resulting in a heavy workload and difficulty in realizing platform migration between different projects, and the inability to effectively verify system-level and module-level functions.

Method used

A universal verification platform is used to generate a register configuration message and write it into the MCU's storage unit, triggering the MCU to operate on the target register, and sending the message to the reference model for comparison to verify the system functions and module functions of the MCU.

Benefits of technology

It greatly reduces the workload, improves verification efficiency, facilitates platform migration between different projects, and can effectively verify the system-level and module-level functions of the MCU, improving code coverage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113076227B_ABST
    Figure CN113076227B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides an MCU verification method, system and terminal device, the method comprising: generating a corresponding register configuration message according to the test stimulus of the target register, writing the address index and pre-configured value contained in the register configuration message into the storage unit of the MCU, so that the MCU operates the target register in the corresponding module; at the same time, sending the configuration message to the reference model corresponding to the MCU, and comparing the expected response output by the reference model with the actual response output by the MCU to verify the system function of the MCU and / or the function of the corresponding module. The present application delegates most of the functions to the module level for verification, and only needs to build a unified module-level simulation platform. Compared with the existing verification method, it avoids the need to develop a large number of instruction programs, and also avoids building many verification platforms for specific modules. It can not only effectively verify the MCU, but also improve the utilization rate of the general verification platform.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of chip verification technology, and in particular to an MCU verification method, system and terminal device. Background Art

[0002] With the development of IC (integrated circuit) process technology and EDA (electronic design automation) design level, the ability and technology of using IP (intellectual property) cores to design MCU (Microcontroller Unit) have been greatly improved. The application of unified bus specifications can ignore the differences in ports between IP cores, making it simple to interconnect multiple IP cores. The entire system including microprocessors, on-chip buses, memory modules and I / O peripherals can be integrated into one chip. While realizing multiple functions, it reduces the area of ​​PCB (printed circuit board), improves the reliability of the entire system, and reduces the power consumption of the equipment. However, the more functions a chip has, the higher the complexity of the chip, and the more difficult the verification work is. How to quickly and effectively perform functional verification is one of the important research directions of IC design today. For example, for a series of MCU products, a corresponding verification platform can be constructed according to its functional characteristics, so that the verification platform can be applied to different products in the same series. It is also one of the methods to improve verification efficiency, shorten verification time, and accelerate the time to market. Summary of the invention

[0003] The embodiments of the present application provide an MCU verification method, system and terminal device, which can realize effective verification of the MCU. Compared with the existing verification methods, it avoids the need to develop a large number of instruction programs and build many verification platforms for specific modules, which can greatly reduce the workload. In addition, it also makes full use of the inherent components of the general verification platform, and facilitates platform migration between different projects.

[0004] An embodiment of the present application provides an MCU verification method, which is applied to a general verification platform. The general verification platform is constructed with a reference model with the same function as the MCU to be verified. The method includes:

[0005] Generate a corresponding register configuration message according to the obtained test stimulus of the target register, wherein the register configuration message includes an address index and a preconfigured value of the target register, and a read-write control value;

[0006] Writing the address index, the preconfigured value and the read / write control value into a storage unit of the MCU, and triggering the MCU to operate the target register in the corresponding module according to the read / write control value;

[0007] Sending the register configuration message to the reference model so that the reference model performs a response output according to the register configuration message;

[0008] The expected response output by the reference model and the monitored actual response output by the MCU are compared and a comparison result is output, wherein the comparison result is used to verify the system function of the MCU and / or the function of the corresponding module.

[0009] In some embodiments, the generation of the test stimulus of the target register includes:

[0010] Obtain relevant information of a target register corresponding to the function of the module to be verified according to the unified register addressing information of the MCU;

[0011] Generate a test stimulus for the target register according to the relevant information of the target register.

[0012] In some embodiments, before writing the address index, the preconfigured value, and the read / write control value into the storage unit of the MCU, the method further includes:

[0013] Functionally assigning storage spaces corresponding to three addresses in the storage unit of the MCU through a firmware program, wherein the storage space corresponding to the first address is used to store the address index, the storage space corresponding to the second address is used to store the preconfigured value, and the storage space corresponding to the third address is used to store the synchronization signal value and the read-write control value;

[0014] Performing path mapping on the target register based on a top-level design method, wherein the path is used for backdoor access to the register;

[0015] The step of writing the address index and the pre-configured value into a storage unit of the MCU comprises:

[0016] The address index and the pre-configured value are respectively written into the storage space corresponding to the first address and the second address in the MCU through a backdoor access method.

[0017] In some embodiments, the MCU includes a CPU and a storage unit connected to the CPU, and the triggering of the MCU to operate the register in the corresponding module according to the read-write control value includes:

[0018] Setting the synchronization signal value to a set state, wherein the synchronization signal value in the set state is used to trigger the CPU to read the read-write control value and perform a register operation on the corresponding module according to the address index in the storage unit according to the read-write control value;

[0019] If it is detected that the synchronization signal value changes from the set state to the cleared state, it is determined that the register configuration operation is completed.

[0020] In some embodiments, performing register operations on corresponding modules according to the address index in the storage unit according to the read / write control value includes:

[0021] If the read / write control value indicates a write operation, the CPU sends the preconfigured value in the storage unit to the target register specified by the address index;

[0022] If the read / write control value indicates a read operation, the CPU transfers the data stored in the target register specified by the address index in the storage unit to the preconfigured value.

[0023] In some embodiments, using the comparison result to verify whether the system function of the MCU and / or the function of the corresponding module is normal includes:

[0024] If the expected response is consistent with the actual response, it is determined that the system function of the MCU and / or the function of the corresponding module is correct;

[0025] If the expected response and the actual response are inconsistent, the abnormality of the system function of the MCU and / or the function of the corresponding module is further determined.

[0026] An embodiment of the present application also provides an MCU verification system, comprising: an MCU to be verified and a universal verification platform, wherein the universal verification platform is connected to the MCU to be verified, and the universal verification platform is also constructed with a reference model with the same function as the MCU; wherein the universal verification platform is used to execute the above-mentioned method to verify the MCU.

[0027] In some embodiments, the universal verification platform includes a sequencer, a driver, a monitor and a scoreboard, wherein the driver and the monitor are connected to the MCU through a physical interface respectively, the sequencer is connected to the driver, the driver, the reference model and the scoreboard are connected in sequence through a first-in-first-out data buffer respectively, and the monitor is connected to the scoreboard through a first-in-first-out data buffer;

[0028] The sequencer is used to generate a corresponding register configuration message according to the obtained test stimulus of the target register, wherein the register configuration message includes an address index and a preconfigured value of the target register, and a read-write control value;

[0029] The driver is used to write the address index, the preconfigured value and the read-write control value into a storage unit of the MCU, and trigger the MCU to operate the target register in the corresponding module according to the read-write control value;

[0030] The driver is further used to send the register configuration message to the reference model, so that the reference model responds and outputs according to the register configuration message;

[0031] The monitor is used to monitor the actual response of the MCU output;

[0032] The scoreboard is used to record the expected response output by the reference model, and compare the expected response with the actual response and output the comparison result, and the comparison result is used to verify the system function of the MCU and / or the function of the corresponding module.

[0033] An embodiment of the present application further provides a terminal device, which includes a processor and a memory, wherein the memory stores a computer program, and the processor is used to execute the computer program to implement the above-mentioned MCU verification method.

[0034] An embodiment of the present application further provides a readable storage medium storing a computer program, wherein the computer program implements the above-mentioned MCU verification method when running on a processor.

[0035] The embodiments of the present application have the following beneficial effects:

[0036] The MCU verification method of the embodiment of the present application generates a corresponding register configuration message according to the test stimulus of the target register, and writes the address index and pre-configured value contained in the register configuration message into the storage unit of the MCU, so that the MCU operates the target register in the corresponding module; at the same time, the register configuration message is sent to the reference model corresponding to the MCU, and the expected response output by the reference model is compared with the actual response output by the MCU to verify whether the system function of the MCU and / or the function of the corresponding module are correct. The present application delegates most of the functions to the module level for verification, which can not only effectively verify the system-level and / or module-level functions of the MCU, but also avoids the need to develop a large number of instruction programs (such as assembly and C programs, etc.) compared to the existing verification methods, and also avoids building respective verification platforms for specific modules, so the workload can be greatly reduced. In addition, the utilization rate of the general verification platform is also improved, and it is easy to realize platform migration between different projects. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0038] Figure 1 A schematic diagram of the workflow of the UVM verification platform of an embodiment of the present application is shown;

[0039] Figure 2 A schematic diagram of the architecture of the UVM verification platform of an embodiment of the present application is shown;

[0040] Figure 3 A first flow chart of the MCU verification method according to an embodiment of the present application is shown;

[0041] Figure 4 A second flow chart of the MCU verification method according to an embodiment of the present application is shown;

[0042] Figure 5 A schematic diagram of address allocation in a storage unit of an MCU according to an embodiment of the present application is shown;

[0043] Figure 6 A coverage indication diagram of an MCU verification result of the MCU verification method of an embodiment of the present application is shown;

[0044] Figure 7 A schematic diagram of the structure of the MCU verification system of an embodiment of the present application is shown. DETAILED DESCRIPTION

[0045] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments.

[0046] The components of the embodiments of the present application generally described and shown in the drawings herein may be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0047] Hereinafter, the terms "including", "having" and their cognates, which may be used in various embodiments of the present application, are intended only to indicate specific features, numbers, steps, operations, elements, components, or combinations of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing items or adding the possibility of one or more features, numbers, steps, operations, elements, components, or combinations of the foregoing items.

[0048] Furthermore, the terms “first”, “second”, “third”, etc. are merely used for distinguishing descriptions and are not to be understood as indicating or implying relative importance.

[0049] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present application belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present application.

[0050] In the embodiments of the present application, MCU is the abbreviation of microcontroller unit, sometimes also called microcomputer or single-chip microcomputer, which usually includes CPU (Central Process Unit, central processing unit), memory, counter (Timer), USB (serial communication interface), analog digital conversion (A / D) module, UART interface, I 2 C bus, SPI bus, etc., and different combinations can be designed according to different application scenarios.

[0051] At present, there are two main methods for MCU verification: 1. Take the entire system as the verification target, build a verification platform, write a system-level firmware program, and achieve the purpose of verification through the interaction between the system-level firmware program and the verification platform. 2. Split the entire system into modules, build a corresponding verification platform for each module, and then complete the functional behavior verification of each module, and then do integrated verification. Among them, the above two methods can use Universal Verification Methodology (UVM) to build a verification platform and use the UVM platform framework for verification.

[0052] For the first method mentioned above, the whole system is used as the verification target. Since the MCU system includes the CPU, each use case needs to write a global firmware program that takes the CPU into consideration during verification, which will cause the following problems: 1) The workload is large; 2) Each verification personnel needs to have the ability to design a global firmware program; 3) The global firmware program interacts closely with the verification platform, which makes it difficult to migrate platforms between different projects; 4) Since the function of the CPU cannot be simulated in the reference model of the UVM platform, the system-level firmware program cannot be used, and the automatic comparison between the reference model and the MCU cannot be achieved. In other words, although the verification platform is built based on the UVM verification methodology, the utilization rate of the available components provided in the UVM framework is not high, such as the automatic comparison function of the reference model and the monitor is not used; 5) Since the use of the system-level firmware program that needs to consider the CPU function is difficult to achieve randomization, it is difficult to construct complex use cases and abnormal use cases, which leads to low code coverage.

[0053] For the second method mentioned above, the entire system is split into modules for separate verification. A verification platform is built for each module, and use cases are written to complete the verification. This method requires more manpower and time. For example, if a system includes 20 modules, this means that 20 verification platforms need to be built, which is a lot of work. In addition, the coverage data can only be given for each module separately, and cannot form a complete coverage data.

[0054] To this end, an embodiment of the present application proposes a new MCU verification method to solve at least one of the shortcomings of the above-mentioned two existing solutions. The MCU verification method can realize effective verification of the MCU. In addition, it also makes full use of the inherent components of the general verification platform. On the one hand, it can greatly reduce the workload. On the other hand, it is also easy to realize platform migration between different projects.

[0055] This application embodiment will also use the UVM verification method to build a verification platform, see Figure 1 As shown, a UVM verification platform built, in the verification process, mainly simulates the peripheral components when the MCU actually works by developing corresponding verification components, and then integrates these verification components with the virtual prototype (usually can be designed as gate-level circuits with delay, etc.) of the MCU. Develop a test program at the same time, load the memory image file generated by compiling and connecting into the corresponding memory model, so that the memory model can fetch and execute, thereby reaching the simulation MCU internal processing flow to carry out various verification work. Below in conjunction with specific embodiments, this MCU verification method is described.

[0056] Example 1

[0057] Please refer to Figure 2 This embodiment proposes an MCU verification method, which can be applied to a universal verification platform. When the MCU needs to be verified, the MCU to be verified can be connected to the built universal verification platform, so as to verify whether the function of the MCU is normal through the interaction between the universal verification platform and the MCU. This embodiment will perform simulation verification based on the UVM verification platform.

[0058] See also Figure 2 A UVM verification platform architecture is shown, which can include components such as a sequencer, a driver, a monitor, a scoreboard, an agent, and a reference model, and the actual verification platform required is built specifically through the transaction level. Figure 2 As shown, the sequence generator is connected to the driver, and the driver, reference model and scoreboard are connected in sequence through a first-in-first-out data buffer (FIFO), and the monitor is also connected to the scoreboard through a first-in-first-out data buffer (FIFO), and finally the verification report is printed out by the scoreboard.

[0059] Among them, the agent can be used to instantiate the sequencer, driver and monitor, and the driver and the sequencer are connected through an interface. It is also used to use the TLM mechanism to prepare the data obtained by the monitor and send it to the scoreboard, etc. The user can customize the configuration according to actual needs. Among them, the above-mentioned TLM (transaction level modeling) mechanism is a transaction-based communication method. The sequencer can be used to receive input test cases or test stimuli, and generate test data packets that meet the format requirements through transactions and send them to the driver, etc. The driver establishes a connection with the device under test (DUT) through a physical interface, requests a test sequence from the sequencer, and sends the obtained data packets to the DUT and the reference model, etc. The reference model is a model with the same function as the DUT. It is developed based on the hardware description language according to the needs of each module, and can also be understood as a mirror image of the DUT. Unlike the actual DUT, the reference model focuses on the functions and behaviors of the input and output of the DUT, but does not pay too much attention to its internal logic.

[0060] Generally, an MCU may include a CPU and various modules connected to the CPU through a bus, such as a storage module including an SRAM chip, an AD conversion module, and a UART interface, a USB interface module, etc. Before verifying the MCU, its corresponding reference model is first constructed. For example, the reference sub-models of various modules in the MCU may be constructed based on the gate-level circuit design with delay provided by the MCU, and then each reference sub-model is encapsulated into a reference model with the same function as the MCU.

[0061] In the existing verification methods, the UVM verification platform mainly builds a UVM module-level simulation platform and / or a UVM system-level simulation platform according to the object to be verified. The difference between the two lies mainly in the different angles of attention, that is, the system-level simulation platform mainly focuses on the behavior above the module, that is, whether the interconnection and interaction between the modules are normal under the participation of the CPU; while the module-level simulation platform goes deep into the corresponding module and pays attention to whether the functions and behaviors inside the specific module are normal. For example, for the system-level verification of the MCU, it can be verified whether the response between the modules is normal under the participation of the CPU, and for a certain module, such as the UART interface, it can be verified whether it can read data from the outside or send data.

[0062] However, in the embodiment of the present application, a unified module-level platform is built, and most of the functions are delegated to the module level for verification, with only a small amount of work being done at the system level. In this way, when verifying the module-level functions, the system-level functions are also verified by the way, which greatly reduces the workload of writing global firmware programs for each use case.

[0063] As an example, here we will build Figure 2 The module-level platform shown in the figure will be verified, and the system top-level (TOP) method will be used to verify the code design. In this way, the configuration will be sent to a certain module through the unified channel of the MCU system through the system top-level. When a certain operation is needed on a certain module, the operation can be performed at the system top-level and the operation can be transmitted to the target module through the conduction between modules inside the MCU.

[0064] In one embodiment, the register unified addressing information of the MCU can be used as the basis for the top-level design of the system. Among them, the above-mentioned register unified addressing information can be obtained by the design scheme of the MCU, which is mainly used to describe the situation that the input and output ports (i.e., I / O ports) of each module in the MCU are mapped to the physical address space of the CPU. Generally, most peripherals are operated by registers on the read-write device, and the peripheral registers are also called I / O ports. The physical addresses of all peripheral I / O ports can be mapped to a physical address space of the CPU and uniformly addressed in the physical address space. In this way, the CPU can access the peripheral I / O ports as if accessing a memory unit without setting up special peripheral I / O instructions. It can be understood that the functional verification of each module requires the corresponding I / O port to respond, so by configuring the specific registers in the corresponding module, it can be used to verify whether the corresponding function of the corresponding module is normal.

[0065] When verifying the MCU, most functions can be delegated to the module level for verification. It is worth noting that while verifying the functions of the corresponding modules through register configuration operations, since the configuration is issued using the existing channels in the MCU system, if the configuration operation is successful or the associated module responds, it means that the interaction and interconnection between the modules are normal, which means that the system-level functions are verified.

[0066] The following will be a general verification process description of one of the module functions of a to-be-verified MCU. The to-be-verified MCU includes a CPU and multiple modules connected to the CPU, including a memory (storage unit), multiple interface modules, etc. A UVM module-level verification platform is built based on the to-be-verified MCU. The UVM verification platform will be pre-built with a reference model with the same function as the to-be-verified MCU. For example, Figure 3 As shown, the MCU verification method includes the following steps:

[0067] Step S110, generating a corresponding register configuration message according to the obtained test stimulus of the target register, wherein the register configuration message includes the address index and pre-configured value of the target register, and a read-write control value.

[0068] Exemplarily, the sequencer component in the verification platform will receive a test stimulus testcase of the target register corresponding to the function of the module to be verified in the MCU input by the user or generated by the platform, and then use the test stimulus to generate a corresponding register configuration message, wherein the register configuration message may include multiple parameters related to the target register configuration, such as the address index of the register, pre-configured value, etc.

[0069] In one implementation, the register configuration message may include definition parameters sfr_addr, sfr_data, and sfr_wrd, wherein sfr_addr is used to store the address index of the register to be accessed; for sfr_data, if it is a write operation, the data to be written to the corresponding register stored in sfr_addr may be stored; if it is a read operation, the data read from the corresponding register stored in sfr_addr may be stored; sfr_wrd is a read-write control bit, which is used in conjunction with sfr_addr and sfr_data, for example, when it is 0, it indicates a read register operation; when it is 1, it indicates a write register operation.

[0070] Among them, for the acquisition of the test stimulus of the above-mentioned target register, such as Figure 4 As shown, in one embodiment, the following steps may be included:

[0071] Step S201, obtaining relevant information of a target register corresponding to the function of the module to be verified according to the unified register addressing information of the MCU.

[0072] Step S202: Generate a test stimulus for the target register according to the relevant information of the target register.

[0073] Exemplarily, since the unified addressing information of the MCU's registers reflects the unified addressing status of the accessible registers in each module, the corresponding register of a certain module can be determined, and then the unified addressing information of the registers can be queried to obtain relevant information of the target register, for example, including but not limited to the register address, the number of register bits, the definition of each bit, etc.

[0074] Then, the corresponding test stimulus can be designed according to the relevant information of the above target register. For example, when a certain bit is in the set state, other modules can be triggered to respond. Therefore, when generating the test stimulus, the corresponding bit can be set to the value corresponding to the set state to monitor the response of other modules, etc. It can be understood that the test stimulus is usually designed according to specific functional requirements.

[0075] For the above step S110, after generating the register configuration message, the driver inputs it into the MCU and also sends it to the reference model, that is, executing steps S120 and S130 respectively. Since the reference model corresponds to the actual module in the MCU, by comparing whether the output response of the MCU is consistent with that of the reference module, it can be verified whether the corresponding function meets expectations. It can be understood that this embodiment will make full use of the components supported by the verification platform for verification, which can reduce the workload of verification, etc.

[0076] Step S120, writing the address index, preconfigured value and read / write control value into a storage unit of the MCU, and triggering the MCU to operate the target register in the corresponding module according to the read / write control value.

[0077] Exemplarily, after the driver establishes a connection with the MCU through a physical interface, the address index and pre-configured value in the register configuration message are written into the storage unit of the MCU, usually the memory. Then, the driver cooperates with the minimum firmware program running in the MCU to write the pre-configured value into the corresponding register in the corresponding module in the MCU, thus realizing the register configuration operation.

[0078] Before the MCU operates, a minimum firmware program will be designed. Exemplarily, the main workflow of the minimum firmware program is as follows: the storage space corresponding to the three addresses in the storage unit of the MCU is functionally allocated, wherein the storage space corresponding to the first address is used to store the above address index, that is, corresponding to sfr_addr; the storage space corresponding to the second address is used to store the above pre-configured value sfr_data, and the storage space corresponding to the third address is used to store the synchronization signal value and the above read-write control value.

[0079] For example, Figure 5 As shown, the storage space corresponding to the three addresses 2045, 2046, and 2047 of the 2K*32bit SARM (static random access memory) in the MCU can be used, where address 2047 is used to store the 32-bit register address; address 2046 is used to store the 32-bit register configuration value; address 2045 takes the lower 2 bits, namely bit1 and bit0, to store the synchronization signal value and the read-write control value respectively. Among them, bit1 represents the synchronization signal between the driver and the CPU, which is set by the driver and cleared by the minimum firmware program; bit0 represents the read-write control flag, which is set and cleared by the driver. When it is 1, it means that the register is written this time; when it is 0, it means that the register is read this time.

[0080] In addition, in order to directly write the above-mentioned address index and pre-configured value, before verification, the mapping path of each accessible register in the MCU will be set based on the top-level design, and this path is used to implement backdoor access to the register. Among them, the above-mentioned backdoor access is an access method that can directly read or modify register variables through the signal path of the associated register. Because it passes through the bus protocol in the MCU, it can also effectively capture bus errors and then verify the access path of the bus.

[0081] For the above step S120, exemplarily, the driver will write the above address index and pre-configured value into the storage space corresponding to the first address and the second address in the MCU respectively through the backdoor access method. Afterwards, the driver sets the synchronization signal value to the set state (i.e. 1'b1), which will trigger the CPU to read the above read-write control value and perform register operations on the corresponding module according to the address index in the storage unit according to the read-write control value; if it is detected that the synchronization signal value changes from the set state to the cleared state, it is determined that the register configuration operation is completed.

[0082] In one embodiment, if the read-write control value is a write operation, the CPU sends the preconfigured value in the storage unit to the target register specified by the address index; if the read-write control value is a read operation, the data stored in the target register specified by the address index is passed to the preconfigured value.

[0083] by Figure 5 Taking the SARM shown in the figure as an example, sfr_addr is written to the storage space corresponding to address 2047; sfr_data is written to the storage space corresponding to address 2046. In addition, the driver will set bit0 to 0 (read) or 1 (write) according to whether the register configuration message is a read or write register operation. Then, the driver sets the above synchronization signal value bit1 to the set state (i.e. 1'b1), and then the CPU can start to execute the corresponding register operation. After completing the above operations, the driver starts to detect the value of bit1 until it detects that bit1 changes from the set state to the cleared state.

[0084] For the minimum firmware program running on the CPU, the synchronization signal value will be continuously detected. If bit1=1, the value of bit0 will be determined. If bit0=1, the minimum firmware program directly sends the sfr_data data to the address specified by sfr_addr in the MCU; if bit0=0, the minimum firmware program sends the data stored at the address specified by sfr_addr to sfr_data. After completing the above operations, the minimum firmware program sets bit1 to 0 (i.e., cleared state). Therefore, after the driver detects that bit1 changes from 1 to 0, it determines that the register configuration operation is completed. Optionally, the next register configuration message can be sent.

[0085] Step S130: sending the register configuration message to the reference model, so that the reference model performs a response output according to the register configuration message.

[0086] The reference module has the functions corresponding to those of the MCU, and when the test stimulus is input for simulation, the correct expected response signal can be obtained. Exemplarily, the driver will also send a register configuration report to the reference model so that the reference model can make the correct action or output according to the functional requirements. It can be understood that the result output by the reference model is the expected result.

[0087] Step S140, comparing the expected response output by the reference model with the actual response output by the monitored MCU and outputting a comparison result, wherein the comparison result is used to verify whether the system function of the MCU and / or the function of the corresponding module is normal.

[0088] Exemplarily, the monitor in the verification platform can be connected to the MCU through a physical interface to monitor the actual response of the MCU after performing the above-mentioned register configuration operation, and then automatically compare the two responses to obtain the verification result. For example, if the expected response is consistent with the actual response, it is determined that the function of the corresponding module of the MCU is normal, that is, the output and behavior are correct and meet expectations. For system functions, it can be specifically determined whether the function currently being verified involves interactive interconnection with other modules. If so, it can also be verified that the corresponding system-level function is normal. On the contrary, if the expected response is inconsistent with the actual response, it is necessary to further judge the abnormality of the system function of the MCU and / or the function of the corresponding module. It can be understood that after verifying one function, the verification of the next function can be continued, and the above steps S110-S140 are also used for verification.

[0089] Compared with the existing first method, the MCU verification method of this embodiment greatly reduces the workload of writing firmware programs for each use case by delegating most of the functions to the module level for verification, and only doing very little work at the system level; since there is no need for the participation of global firmware programs, it is easy to achieve platform migration between different projects; in addition, since the module level does not require too much CPU participation, register configuration operations are mainly performed by running the minimum firmware program, which is convenient for complex use cases and abnormal use cases, and the code coverage rate is very high; it can be understood that the role of the CPU in this method is mainly to assist in the implementation of register configuration. In addition, this method can also make full use of the inherent components of the verification platform such as FIFO, TLM mechanism, transaction, reference model and monitor, which can improve the resource utilization rate of the verification platform and thus reduce the verification workload.

[0090] Compared with the existing second method, the MCU verification method of this embodiment adopts the system top-level design, which can make use of the rich interfaces and channels naturally formed between the internal modules of the DUT. Therefore, when verifying each module, there is no need to build a separate verification platform for each module, but only a unified module-level simulation platform is needed, which greatly reduces the workload; in addition, since there is only one unified verification platform, a complete coverage data can be generated. For example, Figure 6 The figure shows the verification test results of the coverage data of a certain MCU. It can be seen that the verification results of the functions of each module of the entire MCU can be presented on the same verification platform.

[0091] Example 2

[0092] Please refer to Figure 7 Based on the method of the above embodiment 1, this embodiment proposes an MCU verification system. Exemplarily, the MCU verification system includes an MCU to be verified and a universal verification platform. The universal verification platform is connected to the MCU to be verified, wherein the universal verification platform also constructs a reference model with the same function as the MCU to be verified. In this embodiment, the universal verification platform can adopt the UVM verification platform in the above embodiment 1.

[0093] For example, Figure 2 As shown, the UVM verification platform mainly includes components such as a sequencer, a driver, a monitor and a scoreboard, wherein the driver and the monitor are connected to the MCU to be verified through a physical interface respectively, the sequencer is connected to the driver, the driver, the reference model and the scoreboard are connected in sequence through FIFO respectively, and the monitor is connected to the scoreboard through FIFO.

[0094] During the MCU verification process, the sequencer is used to generate a corresponding register configuration message according to the obtained test stimulus of the target register, wherein the register configuration message includes the address index and pre-configured value of the target register, and the read-write control value.

[0095] The driver is used to write the address index, the preconfigured value and the read / write control value into the storage unit of the MCU, and trigger the MCU to operate the target register in the corresponding module according to the read / write control value. The driver is also used to send the register configuration message to the reference model so that the reference model responds and outputs according to the register configuration message.

[0096] Monitor is used to monitor the actual response of MCU output. Scoreboard is used to record the expected response of reference model output, and compares the expected response and the actual response and outputs the comparison result report. Wherein, the comparison result is used to verify whether the system function of MCU and / or the function of corresponding module are normal. It can be understood that the optional items about UVM verification platform in above embodiment 1 are also applicable to the present embodiment, so it is not repeated here.

[0097] The present application also provides a terminal device. Exemplarily, the terminal device includes a processor and a memory, wherein the memory stores a computer program, and the processor runs the computer program to enable the terminal device to execute the functions of each module in the above-mentioned MCU verification method or the above-mentioned MCU verification device.

[0098] The present application also provides a readable storage medium for storing the computer program used in the above-mentioned terminal device.

[0099] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, 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 an alternative implementation, 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 structure diagram and / or the flow diagram, and the combination of boxes in the structure diagram and / or the flow diagram, 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.

[0100] In addition, the functional modules or units 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.

[0101] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned 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 disk or an optical disk.

[0102] The above description is only a specific implementation manner 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.

Claims

1. A MCU verification method, characterized in that: Applied to a general verification platform, the general verification platform is constructed with a reference model with the same function as the MCU to be verified, the MCU includes a CPU and a storage unit connected to the CPU, the method includes: Generate a corresponding register configuration message according to the test stimulus of the target register obtained based on the register unified addressing information of the MCU, wherein the register configuration message includes the address index and pre-configured value of the target register, and the read-write control value; Functionally assigning storage spaces corresponding to three addresses in the storage unit of the MCU through a firmware program, wherein the storage space corresponding to the first address is used to store the address index, the storage space corresponding to the second address is used to store the preconfigured value, and the storage space corresponding to the third address is used to store the synchronization signal value and the read-write control value; Performing path mapping on the target register based on a top-level design method, wherein the path is used for backdoor access to the register; Writing the address index and the pre-configured value into the storage space corresponding to the first address and the second address in the MCU respectively through a backdoor access method; The synchronization signal value is set to a set state, and the synchronization signal value in the set state is used to trigger the CPU to read the read-write control value and perform a register operation on the corresponding module according to the address index in the storage unit according to the read-write control value; if it is detected that the synchronization signal value changes from the set state to the cleared state, it is determined that the register configuration operation is completed; Sending the register configuration message to the reference model so that the reference model performs a response output according to the register configuration message; The expected response output by the reference model and the monitored actual response output by the MCU are compared and a comparison result is output, wherein the comparison result is used to verify the system function of the MCU and / or the function of the corresponding module.

2. The MCU verification method according to claim 1, characterized in that: The generation of the test stimulus of the target register includes: Obtain relevant information of a target register corresponding to the function of the module to be verified according to the unified register addressing information of the MCU; Generate a test stimulus for the target register according to the relevant information of the target register.

3. The MCU verification method according to claim 1, characterized in that: The performing register operations on the corresponding module according to the address index in the storage unit according to the read / write control value includes: If the read / write control value indicates a write operation, the CPU sends the preconfigured value in the storage unit to the target register specified by the address index; If the read / write control value indicates a read operation, the CPU transfers the data stored in the target register specified by the address index in the storage unit to the preconfigured value.

4. The MCU verification method according to claim 1, characterized in that: Verifying the system function of the MCU and / or the function of the corresponding module by using the comparison result includes: If the expected response is consistent with the actual response, it is determined that the system function of the MCU and / or the function of the corresponding module is correct; If the expected response and the actual response are inconsistent, the abnormality of the system function of the MCU and / or the function of the corresponding module is further determined.

5. An MCU verification system, characterized in that: include: An MCU to be verified and a universal verification platform, wherein the universal verification platform is connected to the MCU to be verified, and the universal verification platform is also constructed with a reference model with the same functions as the MCU; wherein the universal verification platform is used to execute the method described in any one of claims 1 to 4 to verify the MCU.

6. The system according to claim 5, characterized in that The universal verification platform includes a sequencer, a driver, a monitor and a scoreboard, wherein the driver and the monitor are connected to the MCU via a physical interface respectively, the sequencer is connected to the driver, the driver, the reference model and the scoreboard are connected via a first-in-first-out data buffer respectively, and the monitor is connected to the scoreboard via a first-in-first-out data buffer; The sequencer is used to generate a corresponding register configuration message according to the obtained test stimulus of the target register, wherein the register configuration message includes an address index and a preconfigured value of the target register, and a read-write control value; The driver is used to perform functional allocation on the storage spaces corresponding to the three addresses in the storage unit of the MCU through a firmware program, wherein the storage space corresponding to the first address is used to store the address index, the storage space corresponding to the second address is used to store the preconfigured value, and the storage space corresponding to the third address is used to store the synchronization signal value and the read-write control value; path mapping is performed on the target register based on the top-level design method, and the path is used to perform backdoor access to the register; The driver is also used to write the address index and the pre-configured value into the storage space corresponding to the first address and the second address in the MCU respectively through a backdoor access method; set the synchronization signal value to a set state, and the synchronization signal value in the set state is used to trigger the CPU to read the read-write control value and perform a register operation on the corresponding module according to the address index in the storage unit according to the read-write control value; if it is detected that the synchronization signal value changes from the set state to the cleared state, it is determined that the register configuration operation is completed; The driver is further used to send the register configuration message to the reference model, so that the reference model responds and outputs according to the register configuration message; The monitor is used to monitor the actual response of the MCU output; The scoreboard is used to record the expected response output by the reference model, and compare the expected response with the actual response and output the comparison result, and the comparison result is used to verify the system function of the MCU and / or the function of the corresponding module.

7. A terminal device, characterized in that: The terminal device includes a processor and a memory, the memory stores a computer program, and the processor is used to execute the computer program to implement the MCU verification method according to any one of claims 1 to 4.

8. A readable storage medium, characterized in that: The computer program stores a computer program, and when the computer program is run on a processor, the MCU verification method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Method for realizing microprogrammed control unit (MCU) verification platform based on verification methodology of verification methodology manual (VMM)

    CN102096628A

  • Verification platform and verification method for symmetric encryption algorithm based on UVM

    CN110618929A

  • Simulation test method for realizing FPGA universal serial port based on verification platform of UVM

    CN112559264A

  • UVM verification system and method based on UART bus of UVM

    CN112579381A

  • ROM testing method for micro controller unit bycheck-sum

    KR1020060018644A