Simulation workflow timeout monitoring method and device, equipment and medium
By creating operating system timing threads in the SystemC simulation model and using the order of flag update notifications, the timing control problem of simulation events in the SystemC simulation model is solved, and high-precision timeout monitoring is achieved, ensuring the timing accuracy and performance of the simulation process.
Patent Information
- Application Number
- CN202510732539.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-03
- Publication Date
- 2025-08-29
AI Technical Summary
The prior art is difficult to implement precise physical clock timing control of simulation events in the SystemC simulation model, making it difficult for developers to monitor timeouts.
After the SystemC worker thread sets the expected timeout timeout of the target simulation workflow, an operating system timing thread is created, and the target simulation workflow is timed out based on the reception order of the first and second flag update notifications, and combined with the physical clock timing of the operating system timing thread, high-precision timeout monitoring is achieved.
It realizes high-precision physical clock timing control of the SystemC simulation model, which can conveniently and accurately monitor the timeout status of any simulation process without affecting the original execution order and performance of the simulation model.
Smart Images

Figure CN120560947A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a simulation workflow timeout monitoring method, device, equipment and medium. Background Art
[0002] For simulation models built on SystemC, the internal simulation clock in SystemC runs at a nonlinear rate and doesn't precisely map to an external physical clock. Therefore, the simulation clock can only be used to set the relative order of simulation events. It cannot determine the physical time at which a simulation event occurs based on simulation time, nor can it specify that a simulation event trigger at a specific physical clock instant based on simulation time. During the development and commissioning of simulation models, users expect the simulation model to accurately monitor timeouts for certain processes and operations. For example, an access request must return a response within a certain physical timeframe, or an I / O (Input / Output) read or write must complete within a specified physical timeframe. However, due to these limitations of the SystemC simulation clock, developers struggle to achieve precise timing monitoring through SystemC's internal mechanisms, hindering the functionality and performance of the simulation model.
[0003] It can be seen that how to achieve timing control of each processing flow in the simulation model is a problem that needs to be solved by those skilled in the art. Summary of the Invention
[0004] The purpose of the embodiments of the present invention is to provide a simulation workflow timeout monitoring method, apparatus, device, and medium. These methods enable high-precision physical clock timing control of SystemC simulation models, and are applicable to any scenario. For any simulation workflow, simply confirming its timing start and end points allows for convenient and accurate timeout monitoring. The specific implementation is as follows:
[0005] In a first aspect, the present invention provides a simulation workflow timeout monitoring method, which is applied to a SystemC timing thread, comprising:
[0006] After the SystemC worker thread sets the expected timeout duration of the target simulation workflow, an operating system timing thread is created according to the process start signal sent by the SystemC worker thread; the target simulation workflow is the simulation workflow that needs to be monitored for timeout;
[0007] Set the timing duration of the operating system timer thread based on the expected timeout duration;
[0008] Whether the target simulation workflow has timed out is determined based on the order in which the first flag update notification and the second flag update notification are received, and corresponding processing operations are performed based on the corresponding judgment results; the first flag update notification is an update notification of the completion flag corresponding to the completion of the timing by the operating system timing thread based on the timing duration; the second flag update notification is an update notification of the end flag corresponding to the end of the SystemC working thread executing the target simulation workflow.
[0009] Optionally, before creating an operating system timer thread according to a process start signal sent by a SystemC worker thread, the following steps may also be included:
[0010] After the SystemC worker thread sends a process start signal to the SystemC timing thread, it waits for a preset simulation clock cycle and then executes the target simulation workflow.
[0011] Optionally, after setting the timing duration of the operating system timer thread based on the expected timeout duration, the method further includes:
[0012] When the waiting time of the operating system timing thread is equal to the timing time, the operating system timing thread sends a first flag update request to the SystemC kernel, so that the SystemC kernel updates the first flag according to the received first flag update request based on a number of preset simulation clock cycles; the first flag is a completion flag corresponding to the completion of timing by the operating system timing thread based on the timing time;
[0013] Receive a first flag update notification sent by the SystemC kernel.
[0014] Optionally, after setting the timing duration of the operating system timer thread based on the expected timeout duration, the method further includes:
[0015] After the target simulation workflow is completed, the SystemC worker thread updates the second flag; the second flag is an end flag corresponding to the end of the SystemC worker thread executing the target simulation workflow;
[0016] Receive a second flag update notification sent by the SystemC working thread.
[0017] Optionally, judging whether the target simulation workflow has timed out according to the order in which the first flag update notification and the second flag update notification are received, and performing corresponding processing operations based on the corresponding judgment result, including:
[0018] If the first flag update notification is received first, it is determined that the target simulation workflow has timed out, and a preset timeout processing process is executed;
[0019] If the second flag update notification is received first, it is determined that the target simulation workflow has not timed out, and the preset normal processing flow is executed.
[0020] Optionally, after performing corresponding processing operations based on corresponding judgment results, the method further includes:
[0021] After the timeout processing flow or the normal processing flow is completed, the operating system timing thread is destroyed and the computing resources are recovered.
[0022] Optionally, the simulation workflow timeout monitoring method further includes:
[0023] After the operating system timing thread completes timing based on the timing duration, recording the first current moment of the physical clock in the operating system timing thread;
[0024] After the SystemC worker thread finishes executing the target simulation workflow, recording the second current moment of the physical clock corresponding to the SystemC worker thread;
[0025] If the first flag update notification is received first, it is determined that the target simulation workflow has timed out, and a preset timeout processing process is executed;
[0026] If the second flag update notification is received first, wait for receiving the first flag update notification;
[0027] After receiving the first flag update notification, comparing the first current time with the second current time;
[0028] If the first current moment is the earlier of the first current moment and the second current moment, it is determined that the target simulation workflow has timed out, and a preset timeout processing process is executed;
[0029] If the second current moment is an earlier moment between the first current moment and the second current moment, it is determined that the target simulation workflow has not timed out, and a preset normal processing flow is executed.
[0030] In a second aspect, the present invention provides a simulation workflow timeout monitoring device, which is applied to a SystemC timing thread and includes:
[0031] The thread creation module is used to create an operating system timer thread according to a process start signal sent by the SystemC working thread after the SystemC working thread sets the expected timeout duration of the target simulation workflow; the target simulation workflow is the simulation workflow that needs to be monitored for timeout;
[0032] A timing duration setting module is used to set the timing duration of the operating system timing thread based on the expected timeout duration;
[0033] The judgment module is used to judge whether the target simulation workflow has timed out according to the order of receiving the first flag update notification and the second flag update notification, and perform corresponding processing operations based on the corresponding judgment results; the first flag update notification is an update notification of the completion flag corresponding to the timing completed by the operating system timing thread based on the timing duration; the second flag update notification is an update notification of the end flag corresponding to the end of the SystemC working thread executing the target simulation workflow.
[0034] In a third aspect, the present invention provides an electronic device, comprising:
[0035] Memory for storing computer programs;
[0036] A processor is used to execute a computer program to implement the above-mentioned simulation workflow timeout monitoring method.
[0037] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which implements the aforementioned simulation workflow timeout monitoring method when the computer program is executed by a processor.
[0038] In the present invention, after the SystemC working thread sets the expected timeout duration of the target simulation workflow, the SystemC timing thread creates an operating system timing thread according to the process start signal sent by the SystemC working thread; the target simulation workflow is the simulation workflow that needs to be monitored for timeout; then the timing duration of the operating system timing thread is set based on the expected timeout duration; finally, whether the target simulation workflow has timed out is judged according to the receiving order of the first flag update notification and the second flag update notification, and corresponding processing operations are performed based on the corresponding judgment results; the first flag update notification is an update notification of the completion flag corresponding to the completion of timing by the operating system timing thread based on the timing duration; the second flag update notification is an update notification of the corresponding end flag when the SystemC working thread finishes executing the target simulation workflow.
[0039] Beneficial Effects: When the simulation process that needs to be monitored for timeout begins, the present invention sends a timing start signal to a SystemC timing thread, which then creates an operating system timing thread and performs physical clock timing therein. After creating the operating system timing thread, the SystemC timing thread enters a waiting state until the physical timing is completed or the monitored simulation process is completed. It then determines whether there has been a timeout based on the completion status of both and enters the subsequent processing process. In other words, the present invention can perform high-precision physical clock timing control on the SystemC simulation model through the design of the SystemC working thread executing the monitored timeout workflow, the SystemC timing thread executing timeout status monitoring, and the operating system timing thread executing physical timing. This not only has no impact on the original execution order of the monitored process, but also has no significant impact on the simulation performance of the entire simulation model based on the timing method of the external operating system thread, making it convenient and reliable to use. At the same time, through the notification synchronization between various signals and states, it is not only ensured that the SystemC working thread executing the monitored timeout workflow and the operating system timing thread executing the physical timing process start at basically the same physical time, but also ensures that the two are parallel and independent of each other in terms of the physical clock. There is no limit to the usage scenarios. For any simulation process, you only need to confirm its timing start and end points to achieve convenient and accurate timeout monitoring. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the embodiments of the present invention, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0041] Figure 1 A flow chart of a simulation workflow timeout monitoring method provided by an embodiment of the present invention;
[0042] Figure 2 A schematic diagram of a SystemC simulation model framework for precise timing provided by an embodiment of the present invention;
[0043] Figure 3 A timing diagram of a simulation workflow timeout monitoring method provided by an embodiment of the present invention;
[0044] Figure 4 A timing diagram of a modified simulation workflow timeout monitoring method provided by an embodiment of the present invention;
[0045] Figure 5 A flow chart of a specific simulation workflow timeout monitoring method provided by an embodiment of the present invention;
[0046] Figure 6 A schematic structural diagram of a simulation workflow timeout monitoring device provided by an embodiment of the present invention;
[0047] Figure 7 A structural diagram of an electronic device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0048] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts shall fall within the scope of protection of the present invention.
[0049] The terms "including" and "having," as used in the present description and accompanying drawings, and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or elements is not limited to the listed steps or elements and may include steps or elements that are not listed.
[0050] In order to enable those skilled in the art to better understand the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0051] To achieve timing control for each process in a simulation model, developers have proposed several solutions, which can be broadly categorized into two types. One involves calculating the mapping between the simulation clock and the physical clock for a fixed process based on the simulation system's simulation and physical time consumption. This approach then determines the simulation duration corresponding to the physical timeouts specified for certain operations within the fixed process. This approach requires repeated experimentation to determine the approximate clock mapping for a given process. Different simulation processes often use different clock mappings, resulting in low timing accuracy and sometimes even complete failure. Another approach records the physical clock time of the simulation process to be monitored for timeout at the start of the simulation process. After the simulation process begins, new physical clock times are continuously obtained at regular intervals until the simulation process completes or times out. This approach requires repeated acquisition of the physical time within a single simulation thread. Timing accuracy depends on the time interval between physical time recordings. Improving timing accuracy requires shortening this time interval, but a shorter time interval incurs greater resource overhead, significantly impacting simulation performance. In order to solve the above technical problems, the present invention discloses a simulation workflow timeout monitoring method, device, equipment and medium, which can perform high-precision physical clock timing control on SystemC simulation models and has no restrictions on usage scenarios. For any simulation process, it is only necessary to confirm its timing start and end points to achieve convenient and accurate timeout monitoring.
[0052] See also Figure 1 As shown, an embodiment of the present invention provides a simulation workflow timeout monitoring method, which is applied to a SystemC timing thread, including:
[0053] Step S11: After the SystemC working thread sets the expected timeout duration of the target simulation workflow, an operating system timing thread is created according to the process start signal sent by the SystemC working thread; the target simulation workflow is the simulation workflow that needs to be monitored for timeout.
[0054] In the embodiment of the present invention, the SystemC simulation model with precise timing function is as follows Figure 2 As shown, for a simulation workflow that needs to be monitored to see if it exceeds a preset duration, at the start of the workflow, the SystemC worker thread where it is located sets the expected timeout duration Phy_Time for the workflow and sends a monitored workflow start signal to the blocked SystemC timing thread to activate the SystemC timing thread. Figure 3 As shown, after the SystemC worker thread sets the expected timeout duration for the target simulation workflow, the SystemC timer thread creates an operating system timer thread based on the process start signal sent by the SystemC worker thread. However, between the timer monitoring start signal sent by the SystemC worker thread and the start of timing by the operating system timer thread, multiple processing and forwarding steps occur. These processes are very short and have little impact on overall timing accuracy. This is primarily because after the SystemC worker thread sends the timer start signal to the SystemC timer thread, it immediately waits for one simulation clock cycle to ensure that the simulation time slice can be properly transferred to the SystemC timer thread, preventing the monitored process from immediately entering execution and rendering the timed monitoring ineffective. Once the simulation time slice is transferred to the SystemC timer thread, it enters a waiting state after creating the operating system timer thread, resulting in a very short period of time spent occupying simulation resources. The operating system timer thread and the SystemC worker thread run in parallel, eliminating competition for simulation resources. Therefore, within a short period of time after the SystemC worker thread sends the timer monitoring start signal, the monitored workflow begins processing and execution, while the operating system timer thread simultaneously begins physical timing, ensuring timing accuracy. That is, after the SystemC worker thread sends a process start signal to the SystemC timing thread, it waits for a preset simulation clock cycle before executing the target simulation workflow. This ensures timing accuracy together with the operating system timing thread.
[0055] In addition, it should be noted that there are many ways to implement timing operations in the operating system's timing thread, such as making the thread sleep for a preset duration Phy_Time. However, this is not the only implementation step of the present invention, and using other timing methods is also a reasonable implementation solution of the present invention.
[0056] Step S12: Setting the timing duration of the operating system timing thread based on the expected timeout duration.
[0057] In an embodiment of the present invention, after the SystemC timing thread immediately creates the operating system timing thread, it sets the timing duration required by the operating system timing thread according to the aforementioned Phy_Time. It then enters a waiting state until the flag Time_Flag indicating that the operating system timing system thread has completed timing is updated, or the flag Done_Flag indicating that the aforementioned simulation workflow has completed processing is updated. After the timing duration of the operating system timing thread is set based on the expected timeout duration, when the waiting timing duration of the operating system timing thread is equal to the timing duration, the operating system timing thread sends a first flag update request (Time_Flag update request) to the SystemC kernel, so that the SystemC kernel updates the first flag based on the received first flag update request based on several preset simulation clock cycles; the first flag is the completion flag corresponding to the completion of timing by the operating system timing thread based on the timing duration; the SystemC timing thread receives the first flag update notification sent by the SystemC kernel. After the target simulation workflow is completed, the SystemC working thread updates the second flag; the second flag is the end flag corresponding to the end of the SystemC working thread executing the target simulation workflow; the SystemC timing thread receives the second flag update notification sent by the SystemC working thread. Specifically, if Figure 3As shown, after the operating system timer thread is created, it immediately begins timing. After reaching the Phy_Time, it sends a Time_Flag update request to the SystemC kernel. After receiving the update request from the operating system timer thread, the SystemC kernel begins processing the Time_Flag update request after several simulation clock cycles, updating the Time_Flag status. While the operating system timer thread is performing physical clock timing, the SystemC worker thread executes the monitored simulation workflow. After the simulation workflow completes, the SystemC worker thread updates the Done_Flag status. This means that after the operating system timer thread is created and enters physical clock timing, the SystemC timer thread that created the operating system timer thread performs a simulation clock wait (i.e., the wait() operation in SystemC) before the operating system timer thread is destroyed. This means that the SystemC timer thread does not block the entire simulation clock because the operating system timer thread has not yet returned to the timing processing state. Instead, the operating system timer thread performs physical clock timing while the SystemC worker thread processes the monitored process in parallel. Simply put, the timing of the external physical clock and the processing of the monitored process occur simultaneously without interfering with each other, ensuring precise timing and minimal impact on simulation computing resources. Furthermore, due to limitations of the SystemC framework, independent external operating system threads cannot freely communicate with internal SystemC threads. (SystemC threads can access external threads, but parallel external threads cannot directly access SystemC threads, as this would disrupt the parallel state.) Therefore, when the operating system timer thread completes a Phy_Time timer and needs to notify the SystemC timer thread, it must first send an update request to the SystemC kernel. Upon receiving the update request, the SystemC kernel places it in the scheduling queue. After several simulation clock cycles, it processes the update request by calling a callback function provided by the operating system timer thread to update the Time_Flag status. After receiving the Time_Flag update notification, the SystemC timer thread proceeds with further processing. This communication mechanism maintains the parallel state within and outside the SystemC simulation model. However, both the request and the update processing rely on the SystemC kernel, which may introduce some communication latency.
[0058] Step S13, judging whether the target simulation workflow has timed out according to the order of receiving the first flag update notification and the second flag update notification, and performing corresponding processing operations based on the corresponding judgment results; the first flag update notification is an update notification of the completion flag corresponding to the completion of the timing by the operating system timing thread based on the timing duration; the second flag update notification is an update notification of the end flag corresponding to the end of the execution of the target simulation workflow by the SystemC working thread.
[0059] In an embodiment of the present invention, after the above-mentioned first flag and second flag are updated, the SystemC timing thread determines whether the target simulation workflow has timed out based on the order in which the first flag update notification and the second flag update notification are received. If the SystemC timing thread receives the first flag update notification first, it determines that the target simulation workflow has timed out and executes the preset timeout processing flow; if the SystemC timing thread receives the second flag update notification first, it determines that the target simulation workflow has not timed out and executes the preset normal processing flow. Specifically, if the SystemC timing thread in the waiting state receives the update notification of Time_Flag first, it indicates that the simulation workflow has not been completed within the predetermined time length Phy_Time, that is, a timeout occurs, and the SystemC timing thread performs a predetermined timeout processing flow; if the SystemC timing thread receives the update notification of Done_Flag first, it indicates that the simulation workflow has been completed within the predetermined time length Phy_Time, and no timeout occurs, and the SystemC timing thread performs a predetermined normal processing flow. In addition, after the timeout processing flow or the normal processing flow is completed, the operating system timing thread is destroyed and the computing resources are recovered.
[0060] In the embodiments of the present invention, based on the above process, the present invention can accurately synchronize the start time of the monitored workflow with the start time of the physical timing. However, there is a certain delay between the completion of the timing by the operating system timing thread and the receipt of the timer end notification Time_Flag by the SystemC timing thread. This may result in the physical timing ending first, but the SystemC timing thread receiving the monitored workflow completion notification Done_Flag first, which may affect the overall timing accuracy to a certain extent. In order to solve this timing error, the present invention also proposes a correction process, which records the first current moment of the physical clock in the operating system timing thread after the operating system timing thread completes the timing based on the timing duration; after the SystemC working thread completes the execution of the target simulation workflow, records the second current moment of the physical clock corresponding to the SystemC working thread; if the first flag update notification is received first, the target simulation workflow is determined to have timed out, and the preset timeout processing process is executed; if the second flag update notification is received first, wait for the first flag update notification to be received; after receiving the first flag update notification, compare the first current moment with the second current moment; if the first current moment is the earlier of the first current moment and the second current moment, the target simulation workflow is determined to have timed out, and the preset timeout processing process is executed; if the second current moment is the earlier of the first current moment and the second current moment, the target simulation workflow is determined to have not timed out, and the preset normal processing process is executed. Specifically, on the basis of the above process ( Figure 3 As shown), the process of the present invention is as follows Figure 4As shown, after the operating system timing thread completes physical timing, it records the current physical clock time, Time_Stamp_1; after the monitored timeout workflow is executed, it records the current physical clock time, Time_Stamp_2. After the SystemC timing thread receives the Done_Flag notification, it does not immediately enter the scheduled normal processing flow, but continues to wait for the Time_Flag update notification. After the Done_Flag and Time_Flag are updated successively, the SystemC timing thread compares Time_Stamp_1 and Time_Stamp_2. If Time_Stamp_1 is the earlier time, it indicates that the timeout has occurred and the scheduled timeout processing flow is entered; if Time_Stamp_2 is the earlier time, it indicates that the timeout has not occurred and the scheduled normal processing flow is entered. Since Time_Stamp_1 is generated before Time_Flag is updated, it is thread-safe for the SystemC timing thread to access Time_Stamp_1 after receiving the Time_Flag update notification. The present invention adds physical timestamps at the end of these two processing flows as a means of eliminating timing errors in special scenarios, making the entire timing process more accurate. Based on this correction process, the present invention eliminates the time error generated by the SystemC kernel processing Time_Flag, and further improves the timing accuracy.
[0061] In addition, to further improve timing accuracy, in addition to adding physical timestamps at the end of the two processing flows as a means of eliminating timing errors in special scenarios, a physical timestamp can also be recorded at the start of the monitored workflow and the start of the physical timing. In other words, a physical timestamp is added at the beginning of both flows. Then, after Done_Flag and Time_Flag are updated successively, the SystemC timing thread compares the physical timestamps at the start of the monitored workflow and the start of the physical timing, as well as the physical timestamps at the end of the two processing flows, Time_Stamp_1 and Time_Stamp_2. The final determination of timeout is based on the comparison of the start and end timestamps of these two flows. This can avoid the time error caused by SystemC scheduling and ensure the absolute accuracy of timeout determination.
[0062] Beneficial Effects: When the simulation process that needs to be monitored for timeout begins, the present invention sends a timing start signal to a SystemC timing thread, which then creates an operating system timing thread and performs physical clock timing therein. After creating the operating system timing thread, the SystemC timing thread enters a waiting state until the physical timing is completed or the monitored simulation process is completed. It then determines whether there has been a timeout based on the completion status of both and enters the subsequent processing process. In other words, the present invention can perform high-precision physical clock timing control on the SystemC simulation model through the design of the SystemC working thread executing the monitored timeout workflow, the SystemC timing thread executing timeout status monitoring, and the operating system timing thread executing physical timing. This not only has no impact on the original execution order of the monitored process, but also has no significant impact on the simulation performance of the entire simulation model based on the timing method of the external operating system thread, making it convenient and reliable to use. At the same time, through the notification synchronization between various signals and states, it is not only ensured that the SystemC working thread executing the monitored timeout workflow and the operating system timing thread executing the physical timing process start at basically the same physical time, but also ensures that the two are parallel and independent of each other in terms of the physical clock. There is no limit to the usage scenarios. For any simulation process, you only need to confirm its timing start and end points to achieve convenient and accurate timeout monitoring.
[0063] As can be seen from the above, the present invention discloses a simulation workflow timeout monitoring method. Next, the simulation workflow timeout monitoring will be described in detail with reference to specific embodiments.
[0064] like Figure 5 As shown, first, the SystemC worker thread needs to process an I / O write operation and expects it to complete within 5µs, so it sets Phy_Time to 5µs. The SystemC worker thread then sends a timer start signal to the SystemC timer thread, which creates an operating system timer thread and passes in a timer duration of 5µs, Phy_Time. The SystemC worker thread then waits for one simulation clock cycle—wait(sc_time(1, SC_NS)). (In this example, the simulation clock cycle of the SystemC simulation model is 1ns, which is independent of the physical clock.) The SystemC worker thread then executes the I / O write operation.
[0065] After creating the operating system timer thread, the SystemC timer thread waits for an update to the Done_Flag or Time_Flag flags—calling wait(Done_Flag | Time_Flag). Done_Flag is a simulation event indicating the completion of an I / O write operation, and Time_Flag is a simulation event indicating the completion of the operating system timer thread's sleep state. The operating system timer thread enters the sleep state for 5 μs. Upon completion of the sleep state, the operating system timer thread records the current physical clock time, Time_Stamp_1, as 2024-12-18 18:51:20.111222333. The operating system timer thread sends a Time_Flag update request to the SystemC kernel. The SystemC worker thread completes the I / O write operation, records the current physical clock time, Time_Stamp_2, as 2024-12-18 18:51:20.111222433, and executes the Done_Flag update notification—calling Done_Flag.notify(). The SystemC timing thread receives the Done_Flag update notification and continues to wait for the Time_Flag update - wait(Time_Flag).
[0066] The SystemC kernel processes the Time_Flag update request and updates the Time_Flag using Time_Flag.notify(). Upon receiving the Time_Flag update notification, the SystemC timer thread compares Time_Stamp_1 with Time_Stamp_2. Because Time_Stamp_1 (2024-12-18 18:51:20.111222333) is earlier than Time_Stamp_2 (2024-12-18 18:51:20.111222433), the I / O write operation is deemed to have timed out. The SystemC timer thread executes the scheduled timeout handling process and then terminates the operating system timer thread.
[0067] Beneficial effects: In general, the present invention places the physical timing task in an operating system timing thread that is parallel to the SystemC working thread that needs to be monitored for timeout, and uses a SystemC timing thread to manage the operating system timing thread and handle the timeout status. This achieves accurate physical clock timeout monitoring without affecting the processing order and efficiency of the monitored workflow.
[0068] See also Figure 6 As shown, an embodiment of the present invention provides a simulation workflow timeout monitoring device, which is applied to a SystemC timing thread, including:
[0069] The thread creation module is used to create an operating system timer thread according to a process start signal sent by the SystemC working thread after the SystemC working thread sets the expected timeout duration of the target simulation workflow; the target simulation workflow is the simulation workflow that needs to be monitored for timeout;
[0070] A timing duration setting module is used to set the timing duration of the operating system timing thread based on the expected timeout duration;
[0071] The judgment module is used to judge whether the target simulation workflow has timed out according to the order of receiving the first flag update notification and the second flag update notification, and perform corresponding processing operations based on the corresponding judgment results; the first flag update notification is an update notification of the completion flag corresponding to the timing completed by the operating system timing thread based on the timing duration; the second flag update notification is an update notification of the end flag corresponding to the end of the SystemC working thread executing the target simulation workflow.
[0072] Since the embodiments of the device part correspond to the above embodiments, the embodiments of the device part please refer to the description of the embodiments of the method part, and will not be repeated here.
[0073] Beneficial Effects: When the simulation process that needs to be monitored for timeout begins, the present invention sends a timing start signal to a SystemC timing thread, which then creates an operating system timing thread and performs physical clock timing therein. After creating the operating system timing thread, the SystemC timing thread enters a waiting state until the physical timing is completed or the monitored simulation process is completed. It then determines whether there has been a timeout based on the completion status of both and enters the subsequent processing process. In other words, the present invention can perform high-precision physical clock timing control on the SystemC simulation model through the design of the SystemC working thread executing the monitored timeout workflow, the SystemC timing thread executing timeout status monitoring, and the operating system timing thread executing physical timing. This not only has no impact on the original execution order of the monitored process, but also has no significant impact on the simulation performance of the entire simulation model based on the timing method of the external operating system thread, making it convenient and reliable to use. At the same time, through the notification synchronization between various signals and states, it is not only ensured that the SystemC working thread executing the monitored timeout workflow and the operating system timing thread executing the physical timing process start at basically the same physical time, but also ensures that the two are parallel and independent of each other in terms of the physical clock. There is no limit to the usage scenarios. For any simulation process, you only need to confirm its timing start and end points to achieve convenient and accurate timeout monitoring.
[0074] Furthermore, the embodiment of the present application also discloses an electronic device, Figure 7This is a structural diagram of an electronic device according to an exemplary embodiment. The content in the diagram cannot be considered as any limitation on the scope of use of this application. The electronic device may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the simulation workflow timeout monitoring method disclosed in any of the aforementioned embodiments. In addition, the electronic device in this embodiment may specifically be an electronic computer.
[0075] In this embodiment, the power supply 23 is used to provide operating voltage for various hardware devices on the electronic device; the communication interface 24 can create a data transmission channel between the electronic device and external devices. The communication protocol it follows is any communication protocol that can be applied to the technical solution of this application and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world. Its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0076] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or CD, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0077] The operating system 221 is used to manage and control the hardware devices on the electronic device and the computer program 222, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of implementing the simulation workflow timeout monitoring method performed by the electronic device disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program capable of implementing other specific tasks.
[0078] Furthermore, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when executed by a processor, the computer program implements the aforementioned disclosed simulation workflow timeout monitoring method. The specific steps of this method can be referred to the corresponding contents disclosed in the aforementioned embodiments and will not be repeated here.
[0079] Furthermore, the present application discloses a computer program product, including a computer program / instructions; wherein, when executed by a processor, the computer program / instructions implement the aforementioned disclosed simulation workflow timeout monitoring method. The specific steps of this method can be referred to the corresponding contents disclosed in the aforementioned embodiments and will not be repeated here.
[0080] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. Reference can be made to the descriptions of the identical or similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and the relevant parts can be referred to the descriptions of the methods.
[0081] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0082] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0083] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.
[0084] The above is a detailed introduction to the technical solution provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the ideas of the present application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A simulation workflow timeout monitoring method, characterized in that: Applicable to SystemC timed threads, including: After the SystemC worker thread sets an expected timeout duration of a target simulation workflow, an operating system timing thread is created according to a process start signal sent by the SystemC worker thread; the target simulation workflow is a simulation workflow that needs to be monitored for timeout; Setting the timing duration of the operating system timing thread based on the expected timeout duration; Whether the target simulation workflow has timed out is determined according to the order in which the first flag update notification and the second flag update notification are received, and corresponding processing operations are performed based on the corresponding judgment results; the first flag update notification is an update notification of the completion flag corresponding to the completion of timing by the operating system timing thread based on the timing duration; the second flag update notification is an update notification of the end flag corresponding to the end of the execution of the target simulation workflow by the SystemC working thread.
2. The simulation workflow timeout monitoring method according to claim 1, characterized in that: Before creating an operating system timing thread according to a process start signal sent by the SystemC working thread, the method further includes: After sending a process start signal to the SystemC timing thread, the SystemC working thread waits for a preset simulation clock cycle and then executes the target simulation workflow.
3. The simulation workflow timeout monitoring method according to claim 1, characterized in that: After setting the timing duration of the operating system timing thread based on the expected timeout duration, the method further includes: When the to-be-timed duration of the operating system timing thread is equal to the timing duration, the operating system timing thread sends a first flag update request to the SystemC kernel, so that the SystemC kernel updates a first flag according to the received first flag update request based on a plurality of preset simulation clock cycles; the first flag is a completion flag corresponding to the completion of timing by the operating system timing thread based on the timing duration; Receive the first flag update notification sent by the SystemC kernel.
4. The simulation workflow timeout monitoring method according to claim 1, characterized in that: After setting the timing duration of the operating system timing thread based on the expected timeout duration, the method further includes: After the target simulation workflow is completed, the SystemC worker thread updates a second flag; the second flag is an end flag corresponding to the end of the SystemC worker thread executing the target simulation workflow; Receive a second flag update notification sent by the SystemC working thread.
5. The simulation workflow timeout monitoring method according to any one of claims 1 to 4, characterized in that: The determining whether the target simulation workflow has timed out according to the order in which the first flag update notification and the second flag update notification are received, and performing corresponding processing operations based on the corresponding determination result, includes: If the first flag update notification is received first, determining that the target simulation workflow has timed out, and executing a preset timeout processing process; If the second flag update notification is received first, it is determined that the target simulation workflow has not timed out, and a preset normal processing flow is executed.
6. The simulation workflow timeout monitoring method according to claim 5, characterized in that: After performing the corresponding processing operation based on the corresponding judgment result, the method further includes: After the timeout processing flow or the normal processing flow is completed, the operating system timing thread is destroyed and computing resources are recovered.
7. The simulation workflow timeout monitoring method according to claim 1, characterized in that: Also includes: After the operating system timing thread completes timing based on the timing duration, recording a first current moment of the physical clock in the operating system timing thread; After the SystemC worker thread finishes executing the target simulation workflow, recording a second current moment of the physical clock corresponding to the SystemC worker thread; If the first flag update notification is received first, determining that the target simulation workflow has timed out, and executing a preset timeout processing process; If the second flag update notification is received first, then wait to receive the first flag update notification; After receiving the first flag update notification, comparing the first current time with the second current time; If the first current moment is the earlier of the first current moment and the second current moment, determining that the target simulation workflow has timed out, and executing a preset timeout processing process; If the second current moment is an earlier moment between the first current moment and the second current moment, it is determined that the target simulation workflow has not timed out, and a preset normal processing flow is executed.
8. A simulation workflow timeout monitoring device, characterized in that: Applicable to SystemC timed threads, including: A thread creation module is configured to create an operating system timer thread according to a process start signal sent by a SystemC worker thread after the SystemC worker thread sets an expected timeout duration of a target simulation workflow, wherein the target simulation workflow is a simulation workflow that needs to be monitored for timeout. A timing duration setting module, configured to set the timing duration of the operating system timing thread based on the expected timeout duration; A judgment module is used to judge whether the target simulation workflow has timed out according to the order of receiving the first flag update notification and the second flag update notification, and perform corresponding processing operations based on the corresponding judgment results; the first flag update notification is an update notification of the completion flag corresponding to the completion of the timing by the operating system timing thread based on the timing duration; the second flag update notification is an update notification of the end flag corresponding to the end of the execution of the target simulation workflow by the SystemC working thread.
9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor is used to execute a computer program to implement the steps of the simulation workflow timeout monitoring method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that A computer program is stored on a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the simulation workflow timeout monitoring method as described in any one of claims 1 to 7 are implemented.