Simulator simulation method, system, device and medium based on event library

Through the simulation method based on event library and time wheel, the shortcomings of existing emulators in synchronous events and consistency issues are solved, and the simulation effect of the emulator's clock accuracy requirements and correct calculation order is achieved.

CN116011371BActive Publication Date: 2025-09-02BEIJING TANWEIXINLIAN TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310103707.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-30
Publication Date
2025-09-02
Estimated Expiration
2043-01-30

AI Technical Summary

Technical Problem

Existing emulators cannot effectively support synchronous events such as semaphores, message delivery, and task delays, and cannot extend other types of synchronization events and consistency problems, cannot achieve timing analysis of the target module, and the simulation time accuracy adjustment is inconvenient.

Method used

Using the simulation method based on the event library and time round, through the binary tree event library and time round step processing, it supports synchronous events such as semaphore, message delivery and task delay, expands other types of synchronization events, and realizes synchronization and asynchronousness at all levels in the hardware through behavioral simulation to ensure the correct calculation order.

Benefits of technology

It realizes the clock accuracy level requirements of the emulator, supports a variety of synchronization events and consistency problems, and can adjust the simulation time accuracy according to the actual system accuracy requirements to ensure the correct calculation order.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116011371B_ABST
    Figure CN116011371B_ABST
Patent Text Reader

Abstract

The present invention proposes an event library-based simulator simulation method, system, device, and medium, relating to the field of simulation. The method comprises: starting the simulation process of the corresponding module in response to a simulation start signal; inserting received events from different processes into a binary tree event library; traversing the binary tree event library in sequence based on a time wheel stepping process to query node event status; retrieving the corresponding node event based on the query result, analyzing the node event, parsing the corresponding source event instance and destination event instance, and updating the event instance attributes according to a preset parsing protocol; sending the node event to the event instance for processing based on the destination event instance to obtain corresponding event execution status information; and printing the step time, event name, event list, and event execution status information. By optimizing the simulation processing flow, the method can achieve the simulator's clock accuracy requirements and facilitate timing analysis and adjustment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of simulation, and in particular to an event library-based simulator simulation method, system, device and medium. Background Art

[0002] An emulator can simulate and debug a logical system design consisting of one or more modules. Emulators replicate one system using another. They differ from computer simulations in that emulators mimic the system's appearance and behavior rather than simulating an abstract model of the system.

[0003] In the existing technology, the simulator cannot support various synchronization events such as semaphores, message passing, and task delays, and cannot expand other types of synchronization events and consistency issues. It cannot perform timing analysis of the target module and cannot conveniently adjust the simulation time accuracy according to the accuracy requirements of the actual system. Summary of the Invention

[0004] The purpose of the present invention is to provide a simulator simulation method, system, device and medium based on an event library, which completes the clock precision level implementation requirements through the event library and the time wheel, can support various synchronization events such as semaphores, message passing and task delays, and can also easily expand other types of synchronization events and consistency issues. By obtaining the execution sequence information of the model simulation, the timing analysis of the target module can be realized, and the time accuracy of the simulation can be conveniently adjusted according to the accuracy requirements of the actual system. Through behavioral level simulation, the synchronization and asynchrony of various levels in the hardware can be realized, ensuring the correct calculation order and achieving synchronization.

[0005] The embodiment of the present invention is achieved as follows:

[0006] In a first aspect, an embodiment of the present application provides a simulator simulation method based on an event library, comprising the following steps:

[0007] In response to the simulation start signal, the simulation process of the corresponding module is started; events of different processes are received and the events are inserted into the binary tree event library; based on the time wheel stepping processing, the binary tree event library is traversed in sequence, the node event status is queried, and the corresponding query results are obtained; based on the query results, the corresponding node event is retrieved, the node event is analyzed, the corresponding source event instance and the destination event instance are parsed, and the event instance attributes are updated according to the preset parsing protocol; based on the destination event instance, the node event is sent to the event instance for processing to obtain the corresponding event execution status information; the stepping time, event name, event list and event execution status information are printed.

[0008] In some embodiments of the present invention, the corresponding module in the above-mentioned simulation process step of starting the corresponding module in response to the simulation start signal is a simulation module related to the simulation start signal in the simulator, wherein any simulation module among the multiple simulation modules includes an event linked list for maintenance, and only the event linked lists of connected simulation modules or nodes can interact and share processing with each other.

[0009] In some embodiments of the present invention, the implementation of the clock signal between the simulation modules includes: using a clock signal with a preset period as a reference clock and a communication delay clock.

[0010] In some embodiments of the present invention, before executing each operation event process, any port of the above-mentioned simulation module will initialize the corresponding execution sequence, and process the function pointers to be executed sequentially in the corresponding queue accordingly, and at the same time, the position of the pointer of the function currently to be executed in the queue will be indicated in the pointer in the corresponding execution module.

[0011] In some embodiments of the present invention, the simulation module is modeled based on a transaction-level modeling method.

[0012] In some embodiments of the present invention, the transaction-level modeling method includes: modeling the functions of the simulation module and the communication between the simulation modules separately, representing the communication between the simulation modules with transactions, using the TF method without pin details for the interface, and using the TF method for the function.

[0013] In a second aspect, an embodiment of the present application provides a simulator simulation system based on an event library, comprising:

[0014] The process startup module is used to start the simulation process of the corresponding module in response to the simulation start signal; the event receiving module is used to receive events of different processes and insert the events into the binary tree event library; the event query module is used to traverse the binary tree event library in sequence based on the time wheel stepping processing, query the node event status, and obtain the corresponding query results; the node parsing module is used to extract the corresponding node event based on the query result, analyze the node event, parse the corresponding source event instance and destination event instance, and update the event instance attributes according to the preset parsing protocol; the event execution module is used to send the node event to the event instance for processing based on the destination event instance to obtain the corresponding event execution status information; the printing processing module is used to print the step time, event name, event list and event execution status information.

[0015] In a third aspect, an embodiment of the present application provides an electronic device comprising a memory for storing one or more programs and a processor. When the one or more programs are executed by the processor, the method described in any one of the first aspects is implemented.

[0016] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method as described above in any one of the first aspects.

[0017] Compared with the prior art, the embodiments of the present invention have at least the following advantages or beneficial effects:

[0018] The embodiment of the present invention proposes a simulator simulation method based on an event library, which optimizes the processing flow of the simulator simulation process. By combining the event library with the time wheel, it can be used to meet the implementation requirements of the simulator clock accuracy level, and can support various synchronization events such as semaphores, message passing, and task delays. It can also easily expand other types of synchronization events and consistency issues. By obtaining the execution sequence information of the model simulation, the timing analysis of the target module can be achieved, and the time accuracy of the simulation can be conveniently adjusted according to the accuracy requirements of the actual system. Through behavioral level simulation, the synchronization and asynchrony of various levels in the hardware can be achieved, ensuring the correct calculation order and achieving synchronization. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0020] Figure 1 A flowchart of an embodiment of a simulator simulation method based on an event library of the present invention;

[0021] Figure 2 A schematic diagram of a processing flow according to an embodiment of the present invention;

[0022] Figure 3 A schematic diagram of the structure between simulation modules when modeling is performed based on a transaction-level modeling method in one embodiment of the present invention;

[0023] Figure 4 This is a schematic diagram of the relationship between event states according to an embodiment of the present invention;

[0024] Figure 5 This is a structural block diagram of an embodiment of a simulator simulation system based on an event library of the present invention;

[0025] Figure 6 This is a structural block diagram of an electronic device provided by an embodiment of the present invention.

[0026] Icons: 1. Process startup module; 2. Event receiving module; 3. Event query module; 4. Node parsing module; 5. Event execution module; 6. Print processing module; 7. Processor; 8. Memory; 9. Data bus. DETAILED DESCRIPTION

[0027] To make the objectives, technical solutions, and advantages of the embodiments of the present application more clear, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Generally, the components of the embodiments of the present application described and shown in the drawings herein can be arranged and designed in various different configurations.

[0028] The following describes some embodiments of the present application in detail with reference to the accompanying drawings. In the absence of conflict, the following embodiments and features thereof may be combined with each other.

[0029] Example 1

[0030] See also Figure 1-2 The embodiment of the present application provides a simulator simulation method based on an event library, which completes the clock precision level implementation requirements through the event library and the time wheel, can support various synchronization events such as semaphores, message passing, and task delays, and can also easily expand other types of synchronization events and consistency issues. By obtaining the execution sequence information of the model simulation, the timing analysis of the target module can be realized, and the time accuracy of the simulation can be conveniently adjusted according to the accuracy requirements of the actual system. Through behavioral level simulation, the synchronization and asynchrony of various levels in the hardware can be realized, ensuring the correct calculation order and achieving synchronization. This simulator simulation method based on an event library includes the following steps:

[0031] Step S101: starting a simulation process of a corresponding module in response to a simulation start signal.

[0032] In the above steps, simulation is a technique that uses computers to build, verify, and run models of actual systems to analyze and study the model's behavioral characteristics. A process is a computer program's execution of a data set. It is the fundamental unit of resource allocation and scheduling in the system and the foundation of the operating system structure. A process is an actual instance of a program in operation. Several processes may be associated with the same program, and each process can run independently, either synchronously or asynchronously. After starting the simulation process for the corresponding module, events can be received, laying the foundation for subsequent processing.

[0033] In some embodiments of the present invention, the corresponding modules in the above steps are simulation modules related to the simulation start signal in the simulator, wherein any simulation module in the multiple simulation modules includes an event chain list for maintenance, and only the event chain lists of the connected simulation modules or nodes can interact with each other and share processing. In this way, only the event chain lists of the connected simulation modules or nodes can generate relationships, including between nodes. The interaction between the event chain lists is related to the current simulation running time, which is convenient for realizing the synchronization and asynchrony of each level in the hardware, and ensuring that the calculation order is correct and provides corresponding technical support. In addition, the realization of the clock signal between the above-mentioned simulation modules includes: based on the clock signal of the preset cycle generated as the reference clock and the communication delay clock, so as to realize the accurate setting of the clock signal between the two simulation modules, and ensure the synchronous or asynchronous operation requirements between the different processes in the simulator.

[0034] In some embodiments of the present invention, the above-mentioned simulation module is modeled based on a transaction-level modeling method. The transaction-level modeling method includes: modeling the functions of the simulation module and the communication between the simulation modules separately, representing the communication between the simulation modules with transactions, using the TF method without pin details for the interface, and using the TF method for the function. The so-called TF method is the use of the timed function TF (Timed Functional), which is an abstract method for system modeling. The execution of its processes and data transmission are allocated a limited time, and whether the cycle is determined according to needs. It greatly speeds up the system simulation by improving the level of abstraction and integrating the communication protocol processing functions scattered in each simulation module into a dedicated communication module. That is, the communication between the simulation modules is achieved using the function call method. In this way, the modules do not need to pay attention to port definitions and port timing, thereby achieving faster modeling speed and faster final simulation operation processing speed.

[0035] Transaction-level modeling is an advanced digital system modeling approach that separates the details of communication between simulation modules from the details of functional units or communication architectures. Transactions refer to the interaction of data and events between simulation modules. Data exchange can be a single word, multiple words, or a data architecture, while synchronization or interruption refer to event interactions. Transactions can be data transfers of varying sizes or used to coordinate or manage behavior between simulation modules during simulator system synchronization, ensuring the effective transfer of behavior between simulation modules.

[0036] For example, Figure 3As shown, the transaction-level model (module M, module S, and channel) forms a system. Module M is the master device that initiates events in the system, while module S is the slave device. Modules M and S are independent processes that describe different behaviors. The ports corresponding to the channel between modules M and S are bound to the interface provided by the channel to achieve communication, thus separating computation and communication functions. The interface includes the communication protocol, which consists of a set of pure virtual functions and can be defined as a C++ abstract class. A channel inherits one or more interfaces to implement virtual functions, which are the specific implementations of the interface communication protocol. Virtual functions are member functions modified by the virtual keyword.

[0037] In some embodiments of the present invention, any port of the above-mentioned simulation module will initialize the corresponding execution sequence before executing each operation event process, and will process the function pointers to be executed in sequence in the corresponding queue accordingly, and at the same time, the position of the pointer of the function to be executed currently in the queue will be indicated in the pointer in the corresponding execution module. The execution sequence of each operation event is fixed, the simulator module strictly follows the timing, and the communication follows a roughly accurate timing. The various states and state transitions of any event in its life cycle are as follows: Figure 4 shown.

[0038] Step S102: receiving events from different processes and inserting the events into the binary tree event library.

[0039] Arrays are convenient for searching data structures, as they can be directly indexed, but deleting or inserting certain elements is more cumbersome. Linked lists, on the other hand, are fast for deleting and inserting elements, but slow for searching. By inserting events from different processes into a binary tree event library, a corresponding binary tree-sorted data structure is constructed. This approach combines the advantages of linked lists with those of arrays, achieving both efficient element deletion and insertion and efficient element search for processing large amounts of dynamic event data.

[0040] Step S103: Based on the time wheel stepping process, the binary tree event library is traversed in sequence to query the node event status and obtain the corresponding query result.

[0041] In the above steps, for the events stored in the binary tree event library, traversal query is performed based on the time wheel step processing. The event library and the time wheel can be combined to meet the clock accuracy requirements of the simulator and can be used to conveniently support various synchronization events such as semaphores, message passing, and task delays. In addition, other types of synchronization events and consistency issues can be easily expanded. By obtaining the execution sequence information of the model simulation, the timing analysis of the target module can be achieved, and the time accuracy of the simulation can be conveniently adjusted according to the accuracy requirements of the actual system. Among them, the time wheel can only move forward, and can only enter the next time slice after the events in one time slice are processed. In addition, the events occurring in the same time slice are parallel in hardware, which can facilitate the processing of discrete time, states, and variables.

[0042] Step S104: based on the query result, the corresponding node event is retrieved, the node event is analyzed, the corresponding source event instance and destination event instance are parsed, and the event instance attributes are updated according to the preset parsing protocol.

[0043] Step S105: Based on the destination event instance, the node event is sent to the event instance for processing to obtain corresponding event execution status information.

[0044] Step S106: Print the step time, event name, event list and event execution status information.

[0045] In the above steps, printing includes at least one of the following processes: describing the periodic and non-periodic tasks of the real-time system; describing various synchronization events and time-related behavioral characteristics; describing the time delay characteristics of communication and calculation between tasks in the system; describing the timing analysis based on simulation results, such as task response time and execution time and delay, etc.

[0046] Example 2

[0047] See also Figure 5 , an embodiment of the present application provides a simulator simulation system based on an event library, which includes:

[0048] The process startup module 1 is used to start the simulation process of the corresponding module in response to the simulation start signal; the event receiving module 2 is used to receive events of different processes and insert the events into the binary tree event library; the event query module 3 is used to traverse the binary tree event library in sequence based on the time wheel stepping processing, query the node event status, and obtain the corresponding query results; the node parsing module 4 is used to extract the corresponding node event based on the query result, analyze the node event, parse the corresponding source event instance and the destination event instance, and update the event instance attributes according to the preset parsing protocol; the event execution module 5 is used to send the node event to the event instance for processing based on the destination event instance to obtain the corresponding event execution status information; the printing processing module 6 is used to print the step time, event name, event list and event execution status information.

[0049] For the specific implementation process of the above system, please refer to the simulator simulation method based on the event library provided in Example 1, which will not be described in detail here.

[0050] Example 3

[0051] See also Figure 6 The embodiment of the present application provides an electronic device, which includes at least one processor 7, at least one memory 8, and a data bus 9; wherein: the processor 7 and the memory 8 communicate with each other via the data bus 9; the memory 8 stores program instructions that can be executed by the processor 7, and the processor 7 calls the program instructions to execute an event library-based simulator simulation method. For example, the following is implemented:

[0052] In response to the simulation start signal, the simulation process of the corresponding module is started; events of different processes are received and the events are inserted into the binary tree event library; based on the time wheel stepping processing, the binary tree event library is traversed in sequence, the node event status is queried, and the corresponding query results are obtained; based on the query results, the corresponding node event is retrieved, the node event is analyzed, the corresponding source event instance and the destination event instance are parsed, and the event instance attributes are updated according to the preset parsing protocol; based on the destination event instance, the node event is sent to the event instance for processing to obtain the corresponding event execution status information; the stepping time, event name, event list and event execution status information are printed.

[0053] Among them, the memory 8 can be, but is not limited to, a random access memory (RAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc.

[0054] The processor 7 can be an integrated circuit chip with signal processing capabilities. The processor 7 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0055] I understand. Figure 6 The structure shown is only for illustration, and the electronic device may also include Figure 6 More or fewer components than shown, or with Figure 6 Different configurations shown. Figure 6 Each component shown in the figure can be implemented by hardware, software or a combination thereof.

[0056] Example 4

[0057] The present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor 7, a simulator simulation method based on an event library is implemented. For example, the following is implemented:

[0058] In response to the simulation start signal, the simulation process of the corresponding module is started; events of different processes are received and the events are inserted into the binary tree event library; based on the time wheel stepping processing, the binary tree event library is traversed in sequence, the node event status is queried, and the corresponding query results are obtained; based on the query results, the corresponding node event is retrieved, the node event is analyzed, the corresponding source event instance and the destination event instance are parsed, and the event instance attributes are updated according to the preset parsing protocol; based on the destination event instance, the node event is sent to the event instance for processing to obtain the corresponding event execution status information; the stepping time, event name, event list and event execution status information are printed.

[0059] If the above functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute 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 magnetic disk or an optical disk.

[0060] It will be apparent to those skilled in the art that the present application is not limited to the details of the exemplary embodiments described above and that the present application can be implemented in other specific forms without departing from the spirit or essential characteristics of the present application. Therefore, the embodiments should be considered in all respects as illustrative and non-restrictive, and the scope of the present application is defined by the appended claims, not the foregoing description, and all variations within the meaning and range of equivalents of the claims are intended to be included therein. Any reference sign in a claim should not be construed as limiting the claim to which it relates.

Claims

1. A simulator simulation method based on an event library, characterized in that: The following steps are involved: In response to a simulation start signal, start a simulation process of a corresponding module; Receive events from different processes and insert the events into the binary tree event library; Based on the time wheel stepping process, the binary tree event library is traversed in sequence to query the node event status and obtain the corresponding query results; Based on the query results, the corresponding node event is retrieved, the node event is analyzed, the corresponding source event instance and destination event instance are parsed, and the event instance attributes are updated according to the preset parsing protocol; Based on the destination event instance, the node event is sent to the event instance for processing to obtain the corresponding event execution status information; Prints step time, event name, event list, and event execution information.

2. The simulator simulation method based on the event library according to claim 1, characterized in that: The corresponding module in the simulation process step of starting the corresponding module in response to the simulation start signal is a simulation module related to the simulation start signal in the simulator, wherein any simulation module among the multiple simulation modules includes an event linked list for maintenance, and only the event linked lists of connected simulation modules or nodes can interact and share processing with each other.

3. The simulator simulation method based on the event library as claimed in claim 2, characterized in that: The implementation of the clock signal between the simulation modules includes: The clock signal based on the preset period is used as the reference clock and communication delay clock.

4. The simulator simulation method based on the event library as claimed in claim 2, characterized in that: Before executing each operation event process, any port of the simulation module will initialize the corresponding execution sequence, and process the function pointers to be executed sequentially in the corresponding queue accordingly, and at the same time, the pointer in the corresponding execution module will indicate the position of the pointer of the function currently to be executed in the queue.

5. The simulator simulation method based on the event library as claimed in claim 2, characterized in that: The simulation module is modeled based on a transaction-level modeling method.

6. The simulator simulation method based on the event library as claimed in claim 5, characterized in that: The transaction-level modeling method includes: The functions of the simulation modules and the communication between the simulation modules are modeled separately. The communication between the simulation modules is represented by transactions. The interface adopts the TF method without pin details, and the function adopts the TF method.

7. An event library-based simulator simulation system, characterized in that: include: A process starting module, configured to start a simulation process of a corresponding module in response to a simulation starting signal; The event receiving module is used to receive events from different processes and insert the events into the binary tree event library; The event query module is used to traverse the binary tree event library in sequence based on the time wheel stepping process, query the node event status, and obtain the corresponding query results; The node parsing module is used to retrieve the corresponding node event based on the query result, analyze the node event, parse the corresponding source event instance and destination event instance, and update the event instance attributes according to the preset parsing protocol; The event execution module is used to send the node event to the event instance for processing based on the destination event instance to obtain the corresponding event execution status information; The printing processing module is used to print step time, event name, event list and event execution status information.

8. An electronic device, characterized in that: The method comprises at least one processor, at least one memory and a data bus; wherein: the processor and the memory communicate with each other via the data bus; the memory stores program instructions executed by the processor, and the processor calls the program instructions to execute the method according to any one of claims 1 to 6.

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

Citation Information

Patent Citations

  • Method and system for managing event queue of software simulator of microprocessor

    CN104657108A

  • Analog simulation method and device based on event network, and computer equipment

    CN113609697A