Training method and generating method of verification incentive generation model, device and medium

By generating and optimizing the stimulus code of the advanced timer for motor control based on the pre-trained model, the problem of low efficiency in the existing technology is solved, and the automated stimulus generation and coverage optimization are realized, which improves the coverage and verification completeness of complex boundary scenarios.

CN123157183APending Publication Date: 2026-11-24BEIJING CEC HUADA ELECTRONIC DESIGN CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611256796.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-18
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

In the current verification of Advanced Timer for Motor Control (ATIM), test stimulus generation is inefficient, manual programming is time-consuming, random generation is blind and coverage convergence is slow, existing methods are difficult to reach complex boundary scenarios, and stimulus generation and coverage analysis are disconnected in the existing verification process, the generator cannot actively adjust the strategy.

Method used

An initial incentive code is generated by using a pre-trained target domain-specific incentive understanding model. The model is then optimized through simulation verification and coverage data. A reward function value is used for reward and punishment mechanism. The simulation verification and model optimization are performed iteratively until optimized incentive code that meets the preset conditions is generated.

Benefits of technology

It significantly improves the efficiency of validation stimulus generation and coverage convergence speed, can deeply cover complex boundary scenarios that are difficult to reach by traditional methods, lowers the validation threshold, reduces manual intervention, and realizes an automated stimulus generation and optimization process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123157183A_ABST
    Figure CN123157183A_ABST
Patent Text Reader

Abstract

This disclosure provides a training method, generation method, apparatus, and medium for verifying a motivation generation model. The training method includes: generating initial motivation code based on a pre-trained target domain-specific motivation understanding model; inputting the initial motivation code into a verification environment to perform simulation verification, collecting simulation results and coverage data; calculating a reward function value based on the simulation results and coverage data, and optimizing the current target domain-specific motivation understanding model using a reward and penalty mechanism based on the reward function value; generating optimized motivation code based on the optimized target domain-specific motivation understanding model, and iteratively executing the simulation verification and model optimization steps until the optimized motivation code meets preset conditions, thereby obtaining a trained target domain-specific motivation understanding model. This disclosure addresses the problems of low efficiency in manual coding, blind random generation, and slow coverage convergence.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure belongs to the field of integrated circuit verification technology, specifically relating to a training method, generation method, apparatus, and medium for a verification stimulus generation model. Background Technology

[0002] The Advanced Timer for Motor Control (ATIM) is a core module of the motor driver chip, responsible for generating complex pulse-width modulation (PWM) waveforms to achieve precise motor control. It typically includes complex logic such as multi-channel comparison, dead-time control, brake protection, and encoder interfaces. Verifying its completeness directly determines system reliability. In the ATIM verification process, test stimulus generation is a crucial step in ensuring functional coverage convergence. However, existing test stimulus generation methods have significant drawbacks. Manually writing test cases is inefficient; facing dozens of operating modes and hundreds of register combinations, the stimulus writing cycle for a single module often takes 4-5 weeks. Constrained random stimulus generation methods are highly unreliable; the generator cannot perceive the coverage status, resulting in a large number of simulation cycles being wasted on already covered scenarios, and complex boundary scenarios (such as asynchronous interaction between dead time and brake signals) are difficult to handle. Furthermore, in existing verification processes, stimulus generation and coverage analysis are disconnected; the generator cannot proactively adjust its strategy based on coverage gaps, leading to low convergence efficiency. In recent years, although some studies have attempted to use artificial intelligence to generate test stimuli, general models lack an understanding of ATIM domain knowledge (such as complementary PWM timing constraints and braking response priority), and the generated stimuli often violate basic timing specifications. At the same time, there is a lack of a mechanism to verify the effectiveness of the stimuli, and reinforcement learning is difficult to balance between exploring new scenarios and utilizing known scenarios, and is prone to getting trapped in local optima. Summary of the Invention

[0003] In view of the above problems, the present disclosure provides a training method, generation method, apparatus and medium for a verification stimulus generation model, which aims to realize the automatic generation and closed-loop optimization of test stimuli in the environment to be verified, shorten the writing cycle, improve the coverage of complex boundary scenes, and solve the problems of low efficiency of manual writing, blind random generation and slow coverage convergence.

[0004] According to a first aspect of the present disclosure, a method for verifying the training of an incentive generation model is provided, comprising:

[0005] Initial incentive code is generated based on a pre-trained target domain-specific incentive understanding model.

[0006] The initial stimulus code is input into the environment to be verified to perform simulation verification, and simulation results and coverage data are collected.

[0007] Based on the simulation results and coverage data, the reward function value is calculated, and the current target domain-specific incentive understanding model is optimized using a reward and punishment mechanism based on the reward function value.

[0008] Based on the optimized target domain-specific incentive understanding model, optimized incentive code is generated, and simulation verification and model optimization steps are iteratively executed until the optimized incentive code meets the preset conditions, thus obtaining the trained target domain-specific incentive understanding model.

[0009] Optionally, before generating the initial incentive code, the training method based on the pre-trained target domain-specific incentive understanding model further includes:

[0010] A target domain knowledge base is constructed, and the data in the target domain knowledge base is cleaned and formatted to obtain training data. The training data is in the form of input instructions and stimulus output pairs. The target domain knowledge base includes the user manual of the environment to be verified, hardware design specification documents, RTL code and its signal dictionary, a high coverage stimulus sequence library that has been verified in historical verification projects, and a typical fault mode library.

[0011] Based on the training data, a pre-trained target domain-specific incentive understanding model is obtained by training the basic large language model.

[0012] Optionally, based on the simulation results and coverage data, the reward function value is calculated, including:

[0013] Based on the simulation results, the initial stimulus code is subjected to a validity check.

[0014] Based on the inspection results and coverage data, positive rewards, negative rewards, and exploration rewards are determined;

[0015] The reward function value is calculated based on the positive reward, negative reward, and exploration reward.

[0016] Optionally, different weights are assigned to each reward item according to its importance, and the reward function value is calculated based on the weighted sum of the positive rewards, negative rewards, and exploration rewards.

[0017] The positive rewards include: accuracy rewards, coverage improvement rewards, and key scenario hit rewards;

[0018] The negative rewards include: invalid incentive penalties and duplicate coverage penalties;

[0019] The validity checks include: syntax checks, register configuration correctness checks, runtime protocol compliance checks, and repeatability checks.

[0020] Optionally, the current target domain-specific incentive understanding model is optimized using a reward and penalty mechanism based on the reward function value, including:

[0021] Define an incentive generation environment, which includes a state space, an action space, and the reward function value; wherein, the state space includes the current coverage state, the value of the internal registers of the environment to be verified, the current working mode, and historical incentive sequence characteristics; the action space includes register configuration actions, waiting actions, triggering actions, and assertion checking actions;

[0022] Based on the incentive generation environment, a reinforcement learning algorithm is used to optimize the action selection strategy of the current target domain-specific incentive understanding model, resulting in an optimized target domain-specific incentive understanding model.

[0023] Optionally, the optimized target domain-specific incentive understanding model generates optimized incentive code and iteratively executes simulation verification and model optimization steps until the optimized incentive code meets preset conditions, thereby obtaining a trained target domain-specific incentive understanding model, including:

[0024] After each simulation verification, the reward function value is calculated based on the collected simulation results and coverage data. Based on the reward function value, a reward and punishment mechanism is used to optimize the current target domain-specific incentive understanding model.

[0025] Based on an optimized target domain-specific incentive understanding model, optimized incentive code is generated.

[0026] The simulation verification and model optimization steps are executed iteratively until the optimized stimulus code meets the preset conditions, resulting in a well-trained target domain-specific stimulus understanding model.

[0027] Optionally, the optimized target domain-specific incentive understanding model generates optimized incentive code and iteratively executes simulation verification and model optimization steps until the optimized incentive code meets preset conditions, thereby obtaining a trained target domain-specific incentive understanding model, including:

[0028] After performing a predetermined number of simulation verifications, based on the collected simulation results and coverage data from the predetermined number of simulation verifications, one or more first incentive codes are selected from the optimized incentive codes corresponding to the predetermined number of simulation verifications, and the coverage data corresponding to the one or more first incentive codes is greater than a preset value.

[0029] By mining the one or more first incentive code patterns, common incentive codes are obtained;

[0030] The common incentive code is added to the target domain knowledge base to guide subsequent iterations of simulation verification and model optimization steps until the optimized incentive code meets the preset conditions, resulting in a trained target domain-specific incentive understanding model.

[0031] Optionally, the optimized target domain-specific incentive understanding model generates optimized incentive code and iteratively executes simulation verification and model optimization steps until the optimized incentive code meets preset conditions, thereby obtaining a trained target domain-specific incentive understanding model, including:

[0032] After performing a predetermined number of simulation verifications, the coverage convergence curve is analyzed based on the collected simulation results and coverage data from the predetermined number of simulations to identify long-term uncovered coverage vulnerabilities.

[0033] The current target domain-specific incentive understanding model is invoked to perform targeted analysis on the coverage vulnerability, generating exploratory incentive code;

[0034] The simulation verification and model optimization steps are performed based on the exploratory incentive code to cover the coverage vulnerability.

[0035] Optionally, when generating initial and / or optimized incentive codes based on the current target domain-specific incentive understanding model, a few-shot learning mechanism is employed to provide one or more incentive examples similar to the current validation target in the prompt words, so as to guide the current target domain-specific incentive understanding model to generate incentive codes that conform to the temporal specifications of the target domain.

[0036] Optionally, the environment to be verified is a motor control advanced timer verification environment; the coverage data includes at least one of the following: counting mode switching coverage point, comparison matching coverage point, output mode coverage point, dead time coverage point, brake response coverage point, encoder coverage point.

[0037] Optionally, the training method further includes:

[0038] Optimized incentive code that meets the preset conditions is stored in the incentive library.

[0039] According to a second aspect of the present disclosure, a method for generating verification stimuli is provided, comprising:

[0040] Generate input instructions based on the current verification target;

[0041] The input instruction is input into the target domain-specific incentive understanding model trained by the training method described above, and the trained target domain-specific incentive understanding model outputs incentive code.

[0042] According to a third aspect of the present disclosure, a training apparatus for verifying an incentive generation model is provided, comprising:

[0043] The initial stimulus code unit is used to generate initial stimulus code based on a pre-trained target domain-specific stimulus understanding model.

[0044] The simulation verification unit is used to input the initial stimulus code into the environment to be verified to perform simulation verification and collect simulation results and coverage data.

[0045] The model optimization unit is used to calculate the reward function value based on the simulation results and coverage data, and to optimize the current target domain-specific incentive understanding model based on the reward function value using a reward and punishment mechanism.

[0046] The iterative execution unit is used to generate optimized incentive code based on the optimized target domain-specific incentive understanding model, and iteratively execute simulation verification and model optimization steps until the optimized incentive code meets the preset conditions, thus obtaining the trained target domain-specific incentive understanding model.

[0047] According to a fourth aspect of the present disclosure, a verification stimulus generation apparatus is provided, comprising:

[0048] An input instruction generation unit is used to generate input instructions based on the current verification target;

[0049] The incentive code generation unit is used to input the input instruction into the target domain-specific incentive understanding model trained by the training method described above, and the trained target domain-specific incentive understanding model outputs incentive code.

[0050] According to a fifth aspect of the present disclosure, an electronic device is provided, the electronic device including a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for implementing connection communication between the processor and the memory, wherein the program is executed by the processor to implement the method described above.

[0051] According to a sixth aspect of the present disclosure, a computer-readable storage medium is provided that stores one or more programs, which can be executed by one or more processors to implement the method described above.

[0052] The embodiments disclosed herein bring the following beneficial effects:

[0053] The training method for verifying the incentive generation model provided in this disclosure includes: generating initial incentive code based on a pre-trained target domain-specific incentive understanding model; inputting the initial incentive code into a verification environment to perform simulation verification; collecting simulation results and coverage data; calculating a reward function value based on the simulation results and coverage data; optimizing the current target domain-specific incentive understanding model using a reward and penalty mechanism based on the reward function value; generating optimized incentive code based on the optimized target domain-specific incentive understanding model; and iteratively executing the simulation verification and model optimization steps until the optimized incentive code meets preset conditions, thereby obtaining a trained target domain-specific incentive understanding model. In this way, the initial incentive code is automatically generated through the pre-trained target domain-specific incentive understanding model. The method iteratively executes simulation verification and model optimization steps based on simulation verification results and coverage data. The target domain-specific incentive understanding model can autonomously iterate and optimize based on simulation results and coverage data. Based on the trained target domain-specific incentive understanding model, it can output optimized incentive code that meets preset conditions, effectively improving the generation efficiency of verification incentives and the coverage convergence speed, significantly shortening the development cycle of incentive code, and significantly reducing the number of simulation iterations required to achieve the target coverage. At the same time, through a reward and punishment mechanism, the model optimization is continuously guided, enabling the incentive generation process to actively perceive the coverage status and dynamically adjust, deeply covering complex boundary scenarios that are difficult to reach by traditional manual writing or constrained random methods, significantly improving the completeness and reliability of verification. In addition, this method lowers the verification threshold and reduces manual intervention. Verification personnel only need to set the test function requirements and coverage targets to automatically complete the entire process of incentive generation, simulation verification, and optimization.

[0054] Other features and advantages of embodiments of this disclosure will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing embodiments of this disclosure. The objects and other advantages of embodiments of this disclosure are realized and obtained through the structures particularly pointed out in the description and the drawings.

[0055] To make the above-described objects, features and advantages of the embodiments of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0056] The above and other objects, features and advantages of the present disclosure will become clearer from the following description of embodiments of the present disclosure with reference to the accompanying drawings, in which:

[0057] Figure 1 This is a schematic diagram of the structure of a verification stimulus generation system provided according to an embodiment of the present disclosure;

[0058] Figure 2This is a flowchart illustrating a training method for a verification stimulus generation model according to an embodiment of the present disclosure;

[0059] Figure 3 A schematic diagram illustrating the generation of a pre-trained target domain-specific incentive understanding model according to an embodiment of the present disclosure;

[0060] Figure 4 This is a schematic diagram illustrating the iterative execution of simulation verification and model optimization according to an embodiment of the present disclosure;

[0061] Figure 5 This is a flowchart illustrating a verification stimulus generation method according to an embodiment of the present disclosure;

[0062] Figure 6 This is a schematic diagram of the structure of a training apparatus for a verification stimulus generation model provided according to an embodiment of the present disclosure;

[0063] Figure 7 This is a schematic diagram of a verification stimulus generation apparatus provided according to an embodiment of the present disclosure;

[0064] Figure 8 This is a schematic diagram of the structure of an electronic device provided according to an embodiment of the present disclosure. Detailed Implementation

[0065] Various embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. In the various drawings, the same elements are indicated by the same or similar reference numerals. For clarity, the various portions in the drawings are not drawn to scale.

[0066] Figure 1 This is a schematic diagram of the structure of a verification stimulus generation system provided according to an embodiment of the present disclosure. Figure 1 As shown, the validation stimulus generation system 100 includes a validation stimulus generation module 110, a scoreboard 120, a monitor 130, a validator 140, a coverage collection module 150, and a validation environment 160 within the test layer. The validation stimulus generation module 110, as the core processing unit of the system, includes a training module 112, a target domain-specific stimulus understanding model 111, and a reinforcement learning module 113.

[0067] Training module 112 is used to construct a target domain knowledge base, clean and format the data in the target domain knowledge base to obtain training data, and train the basic large language model (LLM) based on the training data to obtain a pre-trained target domain-specific incentive understanding model 111. The verification environment 160 is used to receive the incentive code output by the verification incentive generation module 110 and perform simulation verification; its output is connected to monitor 130. Monitor 130 acquires the simulation output results of the verification environment 160 and sends the simulation output results to verifier 140. Verifier 140 compares the simulation output results with the expected data to check the validity of the incentive code and outputs the validity check results to scoring board 120. Scoring board 120 scores the incentive code based on the validity check results of verifier 140 and the input incentive code, and feeds the scoring results back to reinforcement learning module 113. The coverage collection module 150 is connected to both the environment to be verified 160 and the verification incentive generation module 110. It collects coverage data (including functional coverage and code coverage data) for simulation verification and sends this data to the verification incentive generation module 110. The reinforcement learning module 113 receives the scoring results and coverage data, calculates the reward function value, and optimizes the current target domain-specific incentive understanding model 111 using a reward and penalty mechanism based on the reward function value. Subsequently, based on the optimized target domain-specific incentive understanding model 111, optimized incentive code is generated, and the simulation verification and model optimization steps are iteratively executed until the optimized incentive code meets preset conditions, resulting in a trained target domain-specific incentive understanding model 111.

[0068] Figure 2 This is a flowchart illustrating a training method for a verification stimulus generation model according to an embodiment of the present disclosure. Figure 2 As shown, the training method for the verification stimulus generation model in this embodiment includes:

[0069] Step S210: Generate initial stimulus code based on the pre-trained target domain-specific stimulus understanding model.

[0070] Step S220: Input the initial stimulus code into the environment to be verified to perform simulation verification and collect simulation results and coverage data.

[0071] Step S230: Calculate the reward function value based on the simulation results and coverage data, and optimize the current target domain-specific incentive understanding model based on the reward function value using a reward and punishment mechanism.

[0072] Step S240: Based on the optimized target domain-specific incentive understanding model, generate optimized incentive code, and iteratively execute simulation verification and model optimization steps until the optimized incentive code meets the preset conditions, thus obtaining the trained target domain-specific incentive understanding model.

[0073] Steps S210 to S240 form a closed-loop iterative process. When it is determined that the optimized stimulus code does not meet the preset conditions, the process returns to step S220 to continue the next round of simulation verification and model optimization.

[0074] The following is combined with Figure 1 and Figure 2 The training method of the verification stimulus generation model according to the embodiments of this disclosure is described in detail.

[0075] In some embodiments, before performing step S210, the training module 112 constructs a target domain knowledge base, cleans and formats the data in the target domain knowledge base to obtain training data, and trains the basic large language model based on the training data to obtain a pre-trained target domain-specific incentive understanding model 111. Figure 3 The diagram shown is a schematic of generating a pre-trained target domain-specific incentive understanding model according to an embodiment of the present disclosure, the process including steps S310 to S350.

[0076] In step S310, training module 112 constructs a target domain knowledge base, including collecting user manuals, hardware design specifications, register-transfer level code and its signal dictionary, a high-coverage stimulus sequence library verified in historical verification projects, and a typical fault mode library. In step S320, training module 112 cleans and formats the raw data in the target domain knowledge base, removing redundant and noisy information, and converts the cleaned data into a unified structured format to obtain structured training data suitable for model training. In step S330, training module 112 generates training samples based on the structured training data, transforming domain knowledge into input instructions and stimulus output pairs suitable for model training. In step S340, training module 112 uses the training samples to train the basic large language model, for example, by employing Low-Rank Adaptation (LoRA) to efficiently fine-tune the parameters of the basic large language model, enabling it to deeply understand the temporal semantics and stimulus generation rules of the target domain, resulting in a pre-trained target domain-specific stimulus understanding model 111. In step S350, the training module 112 tests the effectiveness of the pre-trained target domain-specific incentive understanding model 111, that is, tests whether the optimized incentive code generated by the pre-trained target domain-specific incentive understanding model 111 meets preset conditions. For example, it tests the syntax correctness, register configuration correctness, protocol compliance, and coverage guidance capability of the generated incentive code. If the generated optimized incentive code meets the preset conditions, that is, the model effect reaches the preset effect, the pre-trained target domain-specific incentive understanding model 111 is saved for the verification incentive generation module 110 in the verification incentive generation system 100 to call to generate the initial incentive code; otherwise, it returns to step S320 to re-clean and format the data, and executes steps S330 to S350 in sequence until the model effect meets the preset requirements.

[0077] Understandably, by constructing a target domain knowledge base that includes user manuals, hardware design specifications, RTL code and signal dictionaries, a historical high-coverage stimulus sequence library, and a typical fault mode library, and by using formatted training data to perform domain-adapted training on the basic large language model, the model gains a deep understanding of the timing semantics, register configuration rules, and stimulus generation specifications of the target domain (such as advanced timers for motor control). This effectively overcomes the technical shortcomings of general AI models that generate invalid stimuli that violate basic timing specifications and cannot pass simulation due to a lack of domain-specific knowledge. It ensures that the model can continuously enhance its understanding of the timing semantics and stimulus generation rules of the target domain during iterative optimization, and stably output stimulus code that conforms to the target domain specifications.

[0078] In step S210, the verification stimulus generation module 110 calls the pre-trained target domain-specific stimulus understanding model 111 output by the training module 112 to generate initial stimulus code based on the design specifications of the target domain (such as an advanced timer for motor control) and the current verification objective. Specifically, the pre-trained target domain-specific stimulus understanding model 111 receives input containing prompts including test function requirements, coverage targets, and currently uncovered function points. Utilizing its deep understanding of domain temporal semantics and stimulus generation rules, it guides the generation of compileable and executable initial stimulus code. In some examples, the initial stimulus code is C code.

[0079] In step S220, the verification stimulus generation module 110 verifies the generated initial stimulus code (e.g., Figure 1The stimulus code 1) shown is input as a test stimulus to the environment to be verified 160 to start the simulation. After the environment to be verified 160 executes the simulation, the monitor 130 obtains the simulation output result of the environment to be verified 160 and sends the simulation output result to the verifier 140. The verifier 140 compares the simulation output result with the expected data, performs a validity check on the initial stimulus code, and outputs the validity check result to the scoreboard 120. In some embodiments, the validity check includes syntax checking, register configuration correctness checking, protocol compliance checking, and repeatability checking to ensure that the stimulus code conforms to the timing specifications and design constraints of the target domain. At the same time, the coverage collection module 150 collects coverage data during the simulation verification process, including code coverage (line coverage, condition coverage, state machine coverage), functional coverage (coverage groups defined according to the verification plan), assertion coverage, and vulnerability rate, and sends the coverage data to the verification stimulus generation module 110. The scoreboard 120 scores the input stimulus code based on the validity check result of the verifier 140 and the content of the input stimulus code, and generates a score result. It should be noted that, in some embodiments, the environment to be verified 160 is, for example, an Advanced Timer for Motor Control (ATIM) verification environment. The coverage data includes at least one of the following: counting mode switching coverage points, comparison matching coverage points, output mode coverage points, dead time coverage points, brake response coverage points, and encoder coverage points. Specifically, the counting mode switching coverage points are used to verify the switching between edge-aligned mode and center-aligned mode and their respective operating states; the comparison matching coverage points are used to verify the matching behavior when the comparison value is at different positions relative to the counting period; the output mode coverage points are used to verify the waveform output under different configurations such as complementary output, independent output, and output enable on or off; the dead time coverage points are used to verify the timing relationship of complementary channels under different dead time value configurations; the brake response coverage points are used to verify the response behavior when the brake signal arrives at different times within the counting period; and the encoder coverage points are used to verify the counting and direction recognition functions of the encoder interface under forward and reverse rotation and different speeds. By collecting the above multi-dimensional coverage data, the verification completeness of each functional module of the Advanced Timer can be comprehensively evaluated, and refined feedback signals can be provided for the calculation of the reinforcement learning reward function.

[0080] In step S230, the reinforcement learning module 113 receives the scoring results output by the scoreboard 120 and the coverage data sent by the coverage collection module 150, calculates the reward function value, and constructs the incentive generation environment. In some embodiments, the reinforcement learning module 113 defines a state space, an action space, and a reward function. The state space includes the current coverage state, the value of the internal registers of the module to be verified, the current working mode, and historical incentive sequence characteristics; the action space includes register configuration actions, waiting actions, triggering actions, and assertion checking actions. The reward function includes positive rewards, negative rewards, and exploration rewards. Positive rewards include correctness rewards generated when the initial incentive code or optimized incentive code is executed correctly, coverage improvement rewards corresponding to the coverage improvement amount, and key scenario hit rewards. Correctness rewards are used to provide positive feedback when the incentive sequence passes validity verification (e.g., validity verification includes syntax checking, register configuration correctness checking, and timing protocol compliance checking). Coverage improvement rewards are used to provide positive feedback when new coverage lines of code, new trigger function coverage points, or coverage increments reach a preset threshold. The critical scene hit reward provides high positive feedback when a pre-defined boundary scene coverage point is hit (e.g., triggering a braking event within the dead zone, or concurrent operations of encoder direction switching and comparison matching). Negative rewards include invalid stimulus penalties and repeated coverage penalties. Invalid stimulus penalties provide negative feedback when register configuration is incorrect, protocol specifications are violated, or the stimulus sequence fails the repeatability check. Repeated coverage penalties provide negative feedback when no new coverage is generated for multiple consecutive simulation cycles or when the system remains in a covered scene for an extended period. Exploration rewards provide additional positive feedback when accessing an unexplored state space, trying new register configuration combinations, or triggering an uncovered operating mode, encouraging reinforcement learning module 113 to escape local optima.

[0081] In some embodiments, the reinforcement learning module 113 determines positive rewards, negative rewards, and exploration rewards based on the inspection results and coverage data, and calculates a reward function value based on the positive rewards, negative rewards, and exploration rewards.

[0082] Furthermore, different weights are assigned to each reward item according to its importance, and the reward function value is calculated based on the weighted sum of the positive rewards, negative rewards, and exploration rewards. Through this weighting mechanism, the reinforcement learning module 113 can balance the relationship between exploring the unknown state space and cultivating high-yield coverage areas, avoiding getting trapped in local optima. In some embodiments, the reinforcement learning module 113 optimizes the action selection strategy of the current target domain-specific incentive understanding model 111 based on the defined incentive generation environment using a reinforcement learning algorithm (e.g., the GRPO (Group Relative Policy Optimization) algorithm), resulting in an optimized target domain-specific incentive understanding model 111.

[0083] In step S240, based on the optimized target domain-specific stimulus understanding model 111, optimized stimulus code is generated, and simulation verification and model optimization steps are iteratively executed until the optimized stimulus code meets preset conditions, thus obtaining the trained target domain-specific stimulus understanding model 111. Figure 4 The diagram illustrates an iterative simulation verification and model optimization process according to an embodiment of this disclosure. A three-layer architecture is used to demonstrate the model iterative optimization process. In one iteration of simulation verification and model optimization, in the target domain pre-trained model layer, the pre-trained target domain-specific incentive understanding model 111 generates initial incentive code or optimized incentive code based on the current strategy. In the simulation verification layer, the environment to be verified 160 receives and executes the initial incentive code or optimized incentive code. After the environment to be verified 160 performs the simulation, the monitor 130 acquires the simulation output results of the environment to be verified 160 and sends the simulation output results to the verifier 140. The verifier 140 compares the simulation output results with the expected data, performs a validity check on the incentive code, and outputs the validity check results to the scoreboard 120. Simultaneously, the coverage collection module 150 collects coverage data during the simulation verification process. In the reinforcement learning optimization layer, the reinforcement learning module 113 receives the scoring results output by the scoreboard 120 and the coverage data sent by the coverage collection module 150, calculates the reward function value, and constructs an incentive generation environment. Based on the defined incentive generation environment, it uses a reinforcement learning algorithm to optimize the action selection strategy of the current target domain-specific incentive understanding model 111, adjusts the model parameters, and obtains the optimized target domain-specific incentive understanding model 111. In the next iteration cycle, in the target domain pre-training model construction layer, based on the optimized target domain-specific incentive understanding model 111, optimized incentive code is generated to further perform simulation verification and model optimization steps until the optimized incentive code output by the target domain-specific incentive understanding model 111 meets the preset conditions, thus obtaining the trained target domain-specific incentive understanding model 111.

[0084] In some embodiments, the above iterative optimization process corresponds to a short-term optimization loop mechanism. Specifically, after each simulation verification is completed, the reinforcement learning module 113 calculates the reward function value corresponding to this simulation based on the collected simulation results and coverage data, i.e., the scoring results output by the scoreboard 120 and the coverage data sent by the coverage collection module 150. The reward function value is determined based on the weighted sum of positive reward, negative reward, and exploration reward. Based on the calculated reward function value, the reinforcement learning module 113 updates the policy parameters of the current target domain-specific incentive understanding model 111 using a reinforcement learning algorithm, adjusting the action selection probability of the model in the state space so that the model tends to generate action sequences that can produce higher coverage gains. After the policy update, an optimized target domain-specific incentive understanding model 111 is obtained. The verification incentive generation module 110 calls the optimized model and generates a new optimized incentive code based on the current state space information (including the latest coverage state, register values, and historical incentive sequence characteristics). The optimized incentive code is then input into the verification environment 160 to execute the next round of simulation verification, and the above reward calculation, policy optimization, and incentive code generation steps are repeated to form a closed-loop iteration. The iterative process continues until the optimized incentive code meets preset conditions, such as reaching a preset coverage threshold (e.g., functional coverage exceeding 97%), the coverage increment in consecutive iterations being lower than a preset proportion, or the reward function value converging to a stable level. At this point, a well-trained target domain-specific incentive understanding model is obtained. Through the aforementioned short-term optimization loop of updating the policy after each simulation, the system can quickly respond to coverage feedback, enabling the model to gradually learn to increase the probability of effective actions in the key state space (e.g., near comparison values, within dead time windows) during the iteration process, thereby accelerating the rapid convergence of coverage.

[0085] In some embodiments, the above iterative optimization process corresponds to a mid-term pattern mining loop mechanism. Specifically, after completing a predetermined number of N (N is an integer greater than 1) simulation verifications (e.g., every 10 iterations), the training module 112 or the verification stimulus generation module 110 performs statistical analysis on the coverage data generated by the most recent N simulations, and selects one or more first stimulus codes from the optimized stimulus codes corresponding to the predetermined number of simulation verifications. The first stimulus code refers to a high coverage stimulus code whose corresponding coverage data is greater than a preset value (e.g., the functional coverage increment exceeds the average increment, or it hits a critical boundary scene coverage point). Subsequently, pattern mining is performed on the selected one or more first stimulus codes to extract common features of these high coverage stimulus codes in terms of register configuration order, timing wait relationship, trigger action timing, etc., to obtain common stimulus codes or common stimulus patterns. For example, in the field of advanced timers for motor control, pattern mining may find that stimulus codes that hit the "braking within dead time" coverage point generally have the common features of "dead time value set between 30-80 clock cycles" and "braking trigger time concentrated within ±5 clock cycles of the comparison value". The common incentive codes or their structured descriptions obtained through mining are added to the target domain knowledge base, and can also serve as example templates for few-shot learning. During subsequent iterations of simulation verification and model optimization, the training module 112 or the verification incentive generation module 110 calls the updated target domain knowledge base, providing these common incentive codes as high-coverage examples in the prompts, guiding the target domain-specific incentive understanding model 111 to generate incentive sequences that conform to the verified effective patterns. By feeding back the empirical knowledge obtained from mid-term pattern mining to the knowledge base, the system avoids the blind exploration of local optima in reinforcement learning, improving the generation quality and coverage convergence efficiency of incentive codes in subsequent iterations, until the preset conditions are finally met, resulting in the trained target domain-specific incentive understanding model 111.

[0086] In some embodiments, the iterative optimization process described above corresponds to a long-term policy adjustment loop mechanism. Specifically, after each predetermined number of simulation verifications M (M is an integer greater than 1) (e.g., every 100 iterations, and M is greater than N in the mid-term pattern mining loop), the reinforcement learning module 113 or the training module 112 plots and analyzes the coverage convergence curve based on the coverage data collected by the coverage collection module 150. By analyzing the coverage of each functional coverage point and code coverage point in different iteration cycles, coverage vulnerabilities (also known as "hard holes") that are consistently uncovered or have extremely low coverage during long-term iterations are identified, such as abnormal timing scenarios or extreme boundary conditions under specific register configuration combinations. For the identified coverage vulnerabilities, the system calls the current target domain-specific incentive understanding model 111 for targeted analysis. Specifically, the descriptive information of the coverage vulnerabilities (such as the name of the uncovered functional point, the address of the relevant register, the expected timing conditions, etc.) is constructed as targeted prompts and input into the model, enabling the model to generate exploratory incentive code specifically for the coverage vulnerabilities based on its in-depth understanding of the timing semantics and incentive generation rules of the target domain. For example, when the "braking behavior with a dead time of 0" is identified as having been uncovered for a long time, the model is invoked for targeted analysis to generate exploratory incentive code that configures a dead time of 0 and precisely triggers braking at the comparison matching moment. The generated exploratory incentive code is input into the verification environment 160 for simulation verification. The reinforcement learning module 113 calculates the reward function value based on the simulation verification results and coverage data, and uses a reward and punishment mechanism to optimize the current model, guiding the model to explore and cover the state space corresponding to the vulnerability. Through the above long-term strategy adjustment loop, the system can proactively escape local optima, target persistent coverage vulnerabilities, ensure comprehensive coverage of complex boundary scenarios, and ultimately optimize the incentive code to meet preset conditions, resulting in a well-trained target domain-specific incentive understanding model 111.

[0087] In some embodiments, a few-shot learning mechanism is employed when generating initial and / or optimized incentive codes based on the current target domain-specific incentive understanding model 111. Specifically, when constructing input prompts, one or more high-coverage incentive examples similar to the current verification target are provided, preferably one to three. These incentive examples can be derived from a library of high-coverage test incentive sequences validated in historical verification projects, or from high-coverage incentive sequences verified during previous simulations. By embedding these incentive examples into the prompts, the target domain-specific incentive understanding model can quickly capture the timing specifications, register configuration patterns, and incentive construction logic of the target domain (such as an advanced timer for motor control), thereby generating syntactically correct incentive codes that comply with protocol requirements. This mechanism effectively overcomes the problem of general-purpose large language models generating invalid incentives due to a lack of domain-specific knowledge, significantly improves the quality and coverage hit rate of initial incentives, reduces blind exploration in the early stages of reinforcement learning, and accelerates verification convergence.

[0088] In some embodiments, the training method further includes storing optimized incentive code that meets the preset conditions into an incentive library. When storing the incentive library, the optimized incentive code is categorized and stored according to functional type, such as dead-time type, braking type, encoder type, comparison output type, etc. The constructed high-coverage incentive library can be directly used for regression testing and validation reuse in subsequent projects, and can also serve as an example source in few-shot learning mechanisms to guide the generation of new incentive code for the target domain-specific incentive understanding model 111. By continuously accumulating high-coverage incentive code to form reusable validation assets, the incentive development cycle of subsequent validation projects can be significantly shortened, reducing reliance on senior validation engineers.

[0089] As an example, the following detailed description of this disclosure is based on a specific embodiment of the "dead time and braking interaction" function in the advanced timer for motor control. This embodiment is applied to the advanced timer module for motor control integrated in an industrial servo drive, and needs to verify the complex boundary scenario of "braking event occurring within the dead time". This scenario requires that when the PWM is outputting a complementary waveform and is within the dead time interval, the braking signal arrives, and the timer should be able to set the output to an idle (invalid) state within a specified time. The difficulty of traditional methods: Manually constructing this scenario requires precise control of the PWM period, comparison value, dead time value, and arrival time of the braking signal so that the braking signal falls exactly within the dead time window. Engineers usually need to write dozens of lines of C code, repeatedly adjust parameters, and spend hours or even days to successfully hit the target once.

[0090] In this embodiment of the disclosure, the implementation process of obtaining the trained target domain-specific incentive understanding model 111 through iterative execution of simulation verification and model optimization steps is as follows:

[0091] Step 1: Knowledge Base Construction and Model Fine-tuning. Training module 112 collects ATIM module user manuals, specification design documents, RTL code and its signal dictionary, and collects excitation sequence libraries (containing 1000 verified high-coverage excitation sequences) from 10 advanced timers for motor control in historical projects. LoRA technology is used to fine-tune the basic large language model, training for 5 epochs to obtain a pre-trained target domain-specific excitation understanding model 111.

[0092] Step 2: Generate initial stimulus code. Verify that the stimulus generation module 110 calls the pre-trained target domain-specific stimulus understanding model 111 and inputs the prompt: "Please generate a stimulus sequence that makes the timer work in center-aligned mode, the PWM output complementary waveform, the dead time is set to 50 clock cycles, and then triggers the braking event within the dead time. It needs to include the necessary register configuration and timing waits."

[0093] Model outputs initial activation code:

[0094] void test_deadtime_brake_interaction(void) {

[0095] / / Configure timer

[0096] TIM1->CR1 = 0x30; / / Center alignment mode

[0097] TIM1->CCEN = 0x05; / / Enable CH1 and CH1N

[0098] TIM1->AF1 = 0x1; / / Enable GPIO braking

[0099] TIM1->BDT = 0x9C32; / / Enable the main brake switch, enable output, dead time 50 clock cycles.

[0100] TIM1->ARR = 1000; / / Period 1000

[0101] TIM1->CC1 = 300; / / Comparison value 300

[0102] for(int brake_pos = 50; brake_pos<= 500; brake_pos++) {

[0103] TIM1->CR1 |= 0x01; / / Start the counter

[0104] / / Waiting for the specified counter value

[0105] while((TIM1->CNT) <brake_pos);

[0106] / / Trigger the brakes

[0107] HAL_GPIO_WritePin(BKIN_GPIO_Port, BKIN_Pin, GPIO_PIN_SET);

[0108] / / Check output status

[0109] CHECK_OUTPUT_DEADTIME_BRAKE();

[0110] / / Restore output

[0111] RECOVER_OUTPUT_FROM_BRAKE();

[0112] / / Stop counter

[0113] TIM1->CR1&= ~0x01;

[0114] HAL_Delay(1);

[0115] }

[0116] }

[0117] The above C code is used as the initial stimulus code and input into the environment to be verified 160 (ATIM verification environment) to perform simulation verification and obtain the execution results and coverage values.

[0118] Step 3: Define the incentive generation environment. Reinforcement learning module 113 constructs the incentive generation environment, defining the state space, action space, and reward function.

[0119] (1) Define the state space:

[0120] Current coverage status: Dead time coverage points (0-255), brake trigger coverage points (different positions within the cycle), mode coverage points, etc.;

[0121] Timer internal states: current count value, compare value, dead-time counter, output state;

[0122] (2) Define the action space:

[0123] Register write operations: TIMx_CR1 (control register), TIMx_CC1 (compare register), TIMx_BDT (dead time register), etc.;

[0124] Trigger action: Generates a braking signal (BKIN pin is set high);

[0125] Waiting action: Wait for N clock cycles;

[0126] (3) Define the reward function:

[0127] Braking within the dead zone when hitting a target coverage point: +10;

[0128] First time covering any new coverage point: +5;

[0129] Ineffective stimulus (e.g., continuing to attempt configuration after braking): -2;

[0130] No new coverage for 1000 consecutive periods: -1.

[0131] Step 4: Large Language Model Reinforcement Learning Optimization. The reinforcement learning module 113 uses the above template as the initial policy and starts reinforcement learning and exploration in the simulation environment using the GRPO algorithm, trying different braking trigger times (triggered at different positions such as counter values ​​of 280, 290, 300, 310, etc.) and observing the coverage feedback.

[0132] After 20 rounds of simulation, it was found that: (1) When the brake is triggered between the counter value of 295 and 305, it can stably hit the coverage point of "brake within dead time"; (2) When the brake is triggered when the counter value is less than 280, it falls during the high level of PWM and hits different coverage points; (3) When the brake is triggered when the counter value is greater than 310, it falls during the low level of PWM and also hits different coverage points.

[0133] The target domain-specific incentive understanding model 111 gradually focuses its exploration on the boundary region through learning, while maintaining moderate exploration of other regions. After 100 rounds of simulation to collect coverage data, it was found that: (1) Dead time related coverage points: increased from the initial 0% to 85%; (2) Braking related coverage points: increased from the initial 0% to 92%; (3) "Braking within dead time" specific cross coverage points: hit rate reached 60%.

[0134] Step 5: Intelligent iterative optimization.

[0135] Short-term optimization loop mechanism: After each simulation, reinforcement learning module 113 updates the policy network parameters based on the coverage increment. The model gradually learns to increase the probability of braking action when the counter value is close to the comparison value.

[0136] Mid-term pattern mining loop mechanism: After every 10 rounds of simulation, the training module 112 performs pattern mining on the high coverage stimulus code generated in the most recent 10 rounds of simulation, and analyzes the common patterns of the high coverage stimulus sequences. It was found that the sequences that hit "braking within the dead time" have the following common characteristics: (1) the braking trigger time is concentrated within ±5 clock cycles around the comparison value; (2) the hit rate is highest when the dead time value is set between 30 and 80. These common stimulus patterns are stored in the target domain knowledge base for subsequent large language model generation prompts.

[0137] Long-term strategy adjustment loop mechanism: Analysis revealed that the coverage point of "braking behavior when dead time = 0" was consistently missed. The stimulus generation module 110 verified that it invoked the target domain-specific stimulus understanding model 111 for targeted analysis. The model suggested: "When the dead time is 0, the falling edge of CH1 (i.e., output channel 1) and the rising edge of CH1N (i.e., the complementary output channel of output channel 1) occur simultaneously. If the braking signal arrives at this exact moment, it may produce special behavior. It is recommended to generate a configuration with dead time = 0 and precisely trigger braking at the comparison matching moment." Based on this suggestion, the reinforcement learning module 113 adjusted its exploration strategy, increasing attempts at the dead time = 0 configuration and intensively exploring near the comparison matching moment. Ultimately, the coverage point was successfully hit.

[0138] Step 6: Stimulus library construction. Store the final optimized stimulus sequence into the stimulus library.

[0139] Example of the final optimized stimulus sequence (in C code):

[0140] void test_deadtime_brake_interaction(void) {

[0141] / / Configure timer

[0142] TIM1->CR1 = 0x30; / / Center alignment mode

[0143] TIM1->CCEN = 0x05; / / Enable CH1 and CH1N

[0144] TIM1->AF1 = 0x1; / / Enable GPIO braking

[0145] TIM1->BDT = 0x9C32; / / Enable the main brake switch, enable output, dead time 50 clock cycles.

[0146] TIM1->ARR = 1000; / / Period 1000

[0147] TIM1->CC1 = 300; / / Comparison value 300

[0148] for(int dt = 0; dt<= 100; dt += 10) {

[0149] TIM1->BDT = (TIM1->BDT&0xFF00) | dt; / / Iterate through different dead time zones

[0150] for(int brake_pos = 290; brake_pos<= 310; brake_pos++) {

[0151] TIM1->CR1 |= 0x01; / / Start the counter

[0152] / / Waiting for the specified counter value

[0153] while((TIM1->CNT) <brake_pos);

[0154] / / Trigger the brakes

[0155] HAL_GPIO_WritePin(BKIN_GPIO_Port, BKIN_Pin, GPIO_PIN_SET);

[0156] / / Check output status

[0157] CHECK_OUTPUT_DEADTIME_BRAKE();

[0158] if(dt == 0&&brake_pos == 300) {

[0159] / / Special check: Dead time is 0 and braking is triggered at the comparison moment

[0160] CHECK_OUTPUT_DEADTIME_ZERO_BRAKE();

[0161] }

[0162] / / Restore output

[0163] RECOVER_OUTPUT_FROM_BRAKE();

[0164] / / Stop counter

[0165] TIM1->CR1&= ~0x01;

[0166] HAL_Delay(1);

[0167] }

[0168] }

[0169] }

[0170] The generated high-coverage stimulus sequences were stored in a stimulus library and categorized by function: Dead Time (500 sequences): covering different dead time values ​​and different PWM modes; Braking (300 sequences): covering braking at different times and different braking pulse widths; Interaction (200 sequences): covering interaction scenarios such as dead time and braking, encoder and comparison. These stimulus sequences were used for regression testing in subsequent projects, significantly shortening the verification cycle.

[0171] Figure 5 This is a flowchart illustrating a verification stimulus generation method according to an embodiment of the present disclosure. Figure 5 As shown, the verification stimulus generation method in this embodiment includes:

[0172] In step S510, an input instruction is generated based on the current verification target.

[0173] In step S520, the input instruction is input into the target domain-specific incentive understanding model trained by the training method described above, and the trained target domain-specific incentive understanding model outputs incentive code.

[0174] Since the specific process of the verification stimulus generation method according to the embodiments of this disclosure has been described in detail above, it will not be repeated here.

[0175] Figure 6 This is a schematic diagram of the structure of a training apparatus for a verification stimulus generation model provided according to an embodiment of the present disclosure. Figure 6 As shown, the training device 600 includes an initial stimulus code unit 610, a simulation verification unit 620, a model optimization unit 630, and an iterative execution unit 640.

[0176] Initial stimulus code unit 610 is used to generate initial stimulus code based on a pre-trained target domain-specific stimulus understanding model.

[0177] The simulation verification unit 620 is used to input the initial stimulus code into the environment to be verified to perform simulation verification and collect simulation results and coverage data.

[0178] The model optimization unit 630 is used to calculate the reward function value based on the simulation results and coverage data, and to optimize the current target domain-specific incentive understanding model based on the reward function value using a reward and punishment mechanism.

[0179] The iterative execution unit 640 is used to generate optimized incentive code based on the optimized target domain-specific incentive understanding model, and iteratively execute simulation verification and model optimization steps until the optimized incentive code meets the preset conditions, thereby obtaining the trained target domain-specific incentive understanding model.

[0180] Since the specific process of training the verification stimulus generation model according to the embodiments of this disclosure has been described in detail above, it will not be repeated here.

[0181] Figure 7 This is a schematic diagram of a verification stimulus generation apparatus provided according to an embodiment of the present disclosure. Figure 7 As shown, the verification stimulus generation device 700 includes an input instruction generation unit 710 and a stimulus code generation unit 720.

[0182] The input instruction generation unit 710 is used to generate input instructions based on the current verification target.

[0183] The incentive code generation unit 720 is used to input the input instruction into the target domain-specific incentive understanding model trained by the training method described above, and the trained target domain-specific incentive understanding model outputs incentive code.

[0184] Since the specific process of the verification stimulus generation method according to the embodiments of this disclosure has been described in detail above, it will not be repeated here.

[0185] This disclosure also provides an electronic device 800, including:

[0186] At least one processor, and,

[0187] A memory that is communicatively connected to at least one processor; wherein,

[0188] The memory stores instructions that are executed by at least one processor to cause the at least one processor to perform the method as described in any of the above embodiments of this application when executing the instructions.

[0189] The following is combined with Figure 8 The hardware structure of the electronic device is described in detail. The electronic device includes: a processor 810, a memory 820, an input / output interface 830, a communication interface 840, and a bus 850.

[0190] The processor 810 can be implemented using a general-purpose central processing unit (CPU), microprocessor, application specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this disclosure.

[0191] The memory 820 can be implemented as a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 820 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 820 and is called and executed by the processor 810.

[0192] The input / output interface 830 is used to implement information input and output;

[0193] The communication interface 840 is used to enable communication and interaction between this device and other devices. Communication can be achieved via wired means (e.g., USB, Ethernet cable) or wireless means (e.g., mobile network, Wi-Fi, Bluetooth).

[0194] Bus 850 transmits information between various components of the device (e.g., processor 810, memory 820, input / output interface 830, and communication interface 840);

[0195] The processor 810, memory 820, input / output interface 830 and communication interface 840 are connected to each other within the device via bus 850.

[0196] This application also provides a computer-readable storage medium storing one or more programs that can be executed by one or more processors to implement the methods of the above embodiments, which will not be described again here.

[0197] Finally, it should be noted that the above embodiments are merely examples for clearly illustrating this disclosure and are not intended to limit the implementation. Those skilled in the art can make other variations or modifications based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations here. However, obvious variations or modifications derived therefrom are still within the scope of this disclosure.

Claims

1. A method for validating the training of a stimulus-generated model, comprising: Initial incentive code is generated based on a pre-trained target domain-specific incentive understanding model. The initial stimulus code is input into the environment to be verified to perform simulation verification, and simulation results and coverage data are collected. Based on the simulation results and coverage data, the reward function value is calculated, and the current target domain-specific incentive understanding model is optimized using a reward and punishment mechanism based on the reward function value. Based on the optimized target domain-specific incentive understanding model, optimized incentive code is generated, and simulation verification and model optimization steps are iteratively executed until the optimized incentive code meets the preset conditions, thus obtaining the trained target domain-specific incentive understanding model.

2. The training method of claim 1, wherein, Before generating the initial incentive code, the training method based on the pre-trained target domain-specific incentive understanding model further includes: A target domain knowledge base is constructed, and the data in the target domain knowledge base is cleaned and formatted to obtain training data. The training data is in the form of input instructions and stimulus output pairs. The target domain knowledge base includes the user manual of the environment to be verified, hardware design specification documents, RTL code and its signal dictionary, a high coverage stimulus sequence library that has been verified in historical verification projects, and a typical fault mode library. Based on the training data, a pre-trained target domain-specific incentive understanding model is obtained by training the basic large language model.

3. The training method of claim 1, wherein, Based on the simulation results and coverage data, the reward function value is calculated, including: Based on the simulation results, the initial stimulus code is subjected to a validity check. Based on the inspection results and coverage data, positive rewards, negative rewards, and exploration rewards are determined; The reward function value is calculated based on the positive reward, negative reward, and exploration reward.

4. The training method of claim 3, wherein, The reward function value is calculated by assigning different weights to each reward item according to its importance, and by weighting the positive rewards, negative rewards and exploration rewards. The positive rewards include: accuracy rewards, coverage improvement rewards, and key scenario hit rewards; The negative rewards include: invalid incentive penalties and duplicate coverage penalties; The validity checks include: syntax checks, register configuration correctness checks, runtime protocol compliance checks, and repeatability checks.

5. The training method of claim 3, wherein, Based on the reward function value, a reward and punishment mechanism is used to optimize the current target domain-specific incentive understanding model, including: Define an incentive generation environment, which includes a state space, an action space, and the reward function value; wherein, the state space includes the current coverage state, the value of the internal registers of the environment to be verified, the current working mode, and historical incentive sequence characteristics; the action space includes register configuration actions, waiting actions, triggering actions, and assertion checking actions; Based on the incentive generation environment, a reinforcement learning algorithm is used to optimize the action selection strategy of the current target domain-specific incentive understanding model, resulting in an optimized target domain-specific incentive understanding model.

6. The training method of claim 5, wherein, The optimized target domain-specific incentive understanding model generates optimized incentive code and iteratively executes simulation verification and model optimization steps until the optimized incentive code meets preset conditions, resulting in a trained target domain-specific incentive understanding model, including: After each simulation verification, the reward function value is calculated based on the collected simulation results and coverage data. Based on the reward function value, a reward and punishment mechanism is used to optimize the current target domain-specific incentive understanding model. Based on an optimized target domain-specific incentive understanding model, optimized incentive code is generated. The simulation verification and model optimization steps are executed iteratively until the optimized stimulus code meets the preset conditions, resulting in a well-trained target domain-specific stimulus understanding model.

7. The training method of claim 5, wherein, The optimized target domain-specific incentive understanding model generates optimized incentive code and iteratively executes simulation verification and model optimization steps until the optimized incentive code meets preset conditions, resulting in a trained target domain-specific incentive understanding model, including: After performing a predetermined number of simulation verifications, based on the collected simulation results and coverage data from the predetermined number of simulation verifications, one or more first incentive codes are selected from the optimized incentive codes corresponding to the predetermined number of simulation verifications, and the coverage data corresponding to the one or more first incentive codes is greater than a preset value. By mining the one or more first incentive code patterns, common incentive codes are obtained; The common incentive code is added to the target domain knowledge base to guide subsequent iterations of simulation verification and model optimization steps until the optimized incentive code meets the preset conditions, resulting in a trained target domain-specific incentive understanding model.

8. The training method of claim 5, wherein, The optimized target domain-specific incentive understanding model generates optimized incentive code and iteratively executes simulation verification and model optimization steps until the optimized incentive code meets preset conditions, resulting in a trained target domain-specific incentive understanding model, including: After performing a predetermined number of simulation verifications, the coverage convergence curve is analyzed based on the collected simulation results and coverage data from the predetermined number of simulations to identify long-term uncovered coverage vulnerabilities. The current target domain-specific incentive understanding model is invoked to perform targeted analysis on the coverage vulnerability, generating exploratory incentive code; The simulation verification and model optimization steps are performed based on the exploratory incentive code to cover the coverage vulnerability.

9. The training method of claim 1, wherein, When generating initial and / or optimized incentive codes based on the current target domain-specific incentive understanding model, a few-shot learning mechanism is employed. One or more incentive examples similar to the current validation target are provided in the prompt words to guide the current target domain-specific incentive understanding model to generate incentive codes that conform to the temporal specifications of the target domain.

10. The training method of claim 1, wherein, The environment to be verified is a motor control advanced timer verification environment; the coverage data includes at least one of the following: counting mode switching coverage point, comparison matching coverage point, output mode coverage point, dead time coverage point, brake response coverage point, encoder coverage point.

11. The training method of claim 1, wherein, The training method also includes: Optimized incentive code that meets the preset conditions is stored in the incentive library.

12. A method for generating verification stimuli, comprising: Generate input instructions based on the current verification target; The input instruction is input into the target domain-specific incentive understanding model trained by the training method as described in any one of claims 1 to 11, and the trained target domain-specific incentive understanding model outputs incentive code.

13. A training apparatus for validating a stimulus generation model, comprising: The initial stimulus code unit is used to generate initial stimulus code based on a pre-trained target domain-specific stimulus understanding model. The simulation verification unit is used to input the initial stimulus code into the environment to be verified to perform simulation verification and collect simulation results and coverage data. The model optimization unit is used to calculate the reward function value based on the simulation results and coverage data, and to optimize the current target domain-specific incentive understanding model based on the reward function value using a reward and punishment mechanism. The iterative execution unit is used to generate optimized incentive code based on the optimized target domain-specific incentive understanding model, and iteratively execute simulation verification and model optimization steps until the optimized incentive code meets the preset conditions, thus obtaining the trained target domain-specific incentive understanding model.

14. A verification stimulus generation apparatus, comprising: An input instruction generation unit is used to generate input instructions based on the current verification target; The incentive code generation unit is used to input the input instruction into the target domain-specific incentive understanding model trained by the training method as described in any one of claims 1 to 11, and to output incentive code from the trained target domain-specific incentive understanding model.

15. An electronic device comprising a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for enabling communication between the processor and the memory, wherein the program is executed by the processor to implement the method as described in any one of claims 1-12.

16. A computer-readable storage medium storing one or more programs, said one or more programs being executable by one or more processors to implement the method as described in any one of claims 1-12.