A method and system for implementing dynamic automatic frequency tuning of a clock system of a SystemC-based embedded simulation system

CN117453341BActive Publication Date: 2026-09-29SHENZHEN ACAD OF AEROSPACE TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311232278.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-22
Publication Date
2026-09-29
Estimated Expiration
2043-09-22

AI Technical Summary

Technical Problem

[0005]为了克服现有技术的不足,本发明提供一种实现基于SystemC的嵌入式仿真系统的时钟系统动态自动调频的方法及系统,用于解决现有基于SystemC的嵌入式仿真系统依据时间量子进行调度准确性和实时性不高,并且无法做到自动调频的技术问题,从而达到了嵌入式仿真系统的时序级别建模要求,又达到了嵌入式仿真系统的时钟系统动态自动调频的功能

Benefits of technology

[0036](1)本发明所提供的方法舍弃原有的时间量子的调度方案,改用基于时钟系统动态自动调频的方案,实现一种全新的嵌入式仿真系统的调度方式,使嵌入式仿真系统在尽可能满足仿真性能的情况下,还能严格满足时序的要求;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117453341B_ABST
    Figure CN117453341B_ABST
Patent Text Reader

Abstract

The application discloses a kind of method and system for realizing the dynamic automatic frequency modulation of clock system of SystemC-based embedded simulation system, comprising the following steps: creating simulation component by embedded simulation system, and the port of simulation component is mutually bound;Through embedded simulation system, load user code and execute user code according to default crystal oscillator frequency;When user code changes the clock signal of embedded simulation system, the clock signal required for core operation is updated synchronously, so as to achieve the dynamic automatic frequency modulation of clock system of embedded simulation system.The application is used to solve the technical problems that the existing SystemC-based embedded simulation system has low scheduling accuracy and real-time performance according to time quantum, and cannot achieve automatic frequency modulation, so as to achieve the timing level modeling requirements of embedded simulation system, and achieve the function of dynamic automatic frequency modulation of clock system of embedded simulation system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of embedded simulation system technology, and specifically to a method and system for implementing dynamic automatic frequency adjustment of a clock system in a SystemC-based embedded simulation system. Background Technology

[0002] SystemC is an object-oriented modeling language, a hardware description language developed based on C++. This makes it very convenient for software developers familiar with C / C++. SystemC adds several hardware features to C++, such as digital signals, timing, concurrency, hazards, and race conditions. Because SystemC's digital signal model provides a discrete-event-based simulation kernel, users can use this kernel to develop, test, and verify simulation devices. SystemC is not only a new hardware description language but also a system description language; using the SystemC framework, a fully standard embedded simulation system can be quickly built.

[0003] Traditional embedded simulation systems developed based on SystemC have a fixed instruction execution cycle. This is because SystemC-based simulation systems must set the time quantum, time unit, and time precision before simulation begins. After simulation starts, the system's scheduling is based on the time quantum. While scheduling based on the time quantum improves the performance of the embedded simulation system, it sacrifices accuracy and real-time performance. Furthermore, the embedded simulation system's time system cannot automatically adjust its frequency, rendering it merely decorative when used by the user.

[0004] Currently, SystemC has become the standard in the simulation industry, and products from major EDA vendors are compatible with the SystemC standard. Therefore, there is an urgent need to develop a technical solution that enables embedded simulation systems to meet simulation performance requirements as much as possible while strictly adhering to timing requirements. Summary of the Invention

[0005] To overcome the shortcomings of existing technologies, this invention provides a method and system for realizing dynamic automatic frequency adjustment of the clock system in a SystemC-based embedded simulation system. This method addresses the technical problems of existing SystemC-based embedded simulation systems having low accuracy and real-time performance in scheduling based on time quantum mechanics, and being unable to achieve automatic frequency adjustment. Thus, it meets the timing-level modeling requirements of embedded simulation systems and also achieves the function of dynamic automatic frequency adjustment of the clock system in embedded simulation systems.

[0006] To solve the above problems, the technical solution adopted by the present invention is as follows:

[0007] A method for implementing dynamic automatic frequency adjustment of a clock system in a SystemC-based embedded simulation system includes the following steps:

[0008] Simulation components are created using an embedded simulation system, and the ports of these simulation components are bound together.

[0009] The user code is loaded through the embedded simulation system and executed at the default crystal oscillator frequency;

[0010] When the user code changes the clock signal of the embedded simulation system, the clock signal required for core operation will be updated synchronously, thereby achieving dynamic automatic frequency adjustment of the clock system of the embedded simulation system.

[0011] In a preferred embodiment of the present invention, the creation of simulation components and their mutual binding includes:

[0012] Create and implement the CPU module and clock management simulation module of the embedded simulation system;

[0013] Within the embedded simulation system, the system clock signal port of the CPU module is bound to the system clock signal of the clock management simulation module.

[0014] In a preferred embodiment of the present invention, the process of creating simulation components and binding them together further includes:

[0015] A clock signal for a CPU instruction execution cycle is defined inside the CPU module;

[0016] The clock management simulation module defines various clock signals required for the operation of the embedded simulation system.

[0017] Bind the system clock signal port of the CPU module to the various clock signals of the clock management simulation module;

[0018] The system clock signal includes various clock signals, including the CPU instruction execution clock signal.

[0019] In a preferred embodiment of the present invention, when the user code changes the clock signal of the simulation system, it includes:

[0020] During the execution of the user code at the default crystal oscillator frequency, it is determined whether the user code involves configuring the clock management simulation module. If so, the clock management simulation module modifies its internal registers according to the user's settings, thereby modifying the period of the various clock signals.

[0021] In a preferred embodiment of the present invention, the process of synchronizing and updating the clock signal required for core operation includes:

[0022] The clock signal of the CPU module changes with the period of the various clock signals of the clock management simulation module.

[0023] In a preferred embodiment of the present invention, when the clock system of the embedded simulation system achieves dynamic automatic frequency adjustment, it includes:

[0024] The embedded simulation system calls the simulation scheduler function once after executing each CPU instruction, and passes in the instruction cycle parameter to achieve dynamic automatic frequency adjustment of the clock system of the embedded simulation system.

[0025] In a preferred embodiment of the present invention, the above method further includes:

[0026] The operating environment of the embedded simulation system is divided into a non-SystemC operating environment and a SystemC operating environment. CPU instructions are executed in the non-SystemC operating environment.

[0027] In a preferred embodiment of the present invention, the above method further includes:

[0028] After the CPU module finishes executing a CPU instruction, the simulation scheduler function is called and the instruction cycle parameter obtained by the clock management module is dynamically passed in, thereby entering the SystemC runtime environment to run a simulation of a specified cycle length.

[0029] In a preferred embodiment of the present invention, the above method further includes:

[0030] After the simulation scheduler function call ends, the embedded simulation system returns to the non-SystemC runtime environment to execute the next CPU instruction.

[0031] A system for implementing dynamic automatic frequency adjustment of a clock system in an embedded simulation system based on SystemC, comprising:

[0032] Port binding unit: used to bind the ports of the simulation components to each other after the simulation components are created in the embedded simulation system;

[0033] User code execution unit: used to execute the user code at the default crystal oscillator frequency after the user code is loaded into the embedded simulation system;

[0034] Automatic frequency adjustment unit: used to synchronize and update the clock signal required for core operation when the user code changes the clock signal of the embedded simulation system, thereby achieving dynamic automatic frequency adjustment of the clock system of the embedded simulation system.

[0035] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0036] (1) The method provided by the present invention abandons the original time quantum scheduling scheme and adopts a scheme based on dynamic automatic frequency adjustment of the clock system to realize a brand-new scheduling method for embedded simulation system, so that the embedded simulation system can meet the timing requirements while satisfying the simulation performance as much as possible.

[0037] (2) Based on the method provided by the present invention, the embedded simulation system runs in a cyclical manner, which not only meets the timing level modeling requirements of the simulation system, but also achieves the function of dynamic automatic frequency adjustment of the clock system of the simulation system, thereby satisfying users who require precise timing and whose timing can be dynamically adjusted.

[0038] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments. Attached Figure Description

[0039] Figure 1 - This is a flowchart illustrating the steps of a method for implementing dynamic automatic frequency adjustment of a clock system in an embedded simulation system based on SystemC, according to an embodiment of the present invention.

[0040] Figure 2 - is an overall framework diagram of the embedded simulation system dynamic automatic frequency tuning according to an embodiment of the present invention;

[0041] Figure 3 - This is a flowchart illustrating the specific implementation of dynamic automatic frequency adjustment in the embedded simulation system according to an embodiment of the present invention. Detailed Implementation

[0042] The present invention provides a method for implementing dynamic automatic frequency adjustment of a clock system in a SystemC-based embedded simulation system, such as... Figure 1 As shown, it includes the following steps:

[0043] Step S1: Create simulation components using the embedded simulation system and bind the ports of the simulation components to each other;

[0044] Step S2: Load the user code through the embedded simulation system and execute the user code at the default crystal oscillator frequency;

[0045] Step S3: When the user code changes the clock signal of the embedded simulation system, the clock signal required for core operation is updated synchronously, thereby achieving dynamic automatic frequency adjustment of the clock system of the embedded simulation system.

[0046] In step S1 above, the creation of simulation components and their mutual binding include:

[0047] Create and implement the CPU module and clock management simulation module of the embedded simulation system;

[0048] Within the embedded simulation system, the system clock signal port of the CPU module is bound to the system clock signal of the clock management simulation module.

[0049] In step S1 above, when creating simulation components and binding them together, the following is also included:

[0050] Define a clock signal for a CPU instruction execution cycle within the CPU module;

[0051] Define the various clock signals required for the operation of the embedded simulation system in the clock management simulation module;

[0052] Bind the system clock signal port of the CPU module to various clock signals of the clock management simulation module;

[0053] The system clock signal includes various clock signals, including the CPU instruction execution clock signal.

[0054] In step S3 above, when the user code changes the clock signal of the simulation system, it includes:

[0055] During the execution of user code at the default crystal oscillator frequency, it is determined whether the user code involves configuring the clock management simulation module. If so, the clock management simulation module modifies its internal registers according to the user's settings, thereby modifying the period of various clock signals.

[0056] In step S3 above, when synchronizing and updating the clock signal required for core operation, the following is included:

[0057] The CPU module's clock signal changes according to the cycle of various clock signals from the clock management simulation module.

[0058] In step S3 above, when the clock system of the embedded simulation system achieves dynamic automatic frequency adjustment, it includes:

[0059] The embedded simulation system calls the simulation scheduler function once after executing each CPU instruction, and passes in the instruction cycle parameter to achieve dynamic automatic frequency adjustment of the embedded simulation system's clock system.

[0060] The method provided by this invention also includes:

[0061] The operating environment of the embedded simulation system is divided into a non-SystemC operating environment and a SystemC operating environment. CPU instructions are executed in the non-SystemC operating environment.

[0062] The method provided by this invention also includes:

[0063] After the CPU module finishes executing a CPU instruction, the simulation scheduler function is called and the instruction cycle parameter obtained from the clock management module is dynamically passed in, thereby entering the SystemC runtime environment to run the simulation for the specified cycle length.

[0064] The method provided by this invention also includes:

[0065] After the simulation scheduler function call ends, the embedded simulation system returns to the non-SystemC runtime environment to execute the next CPU instruction.

[0066] The system for dynamic automatic frequency adjustment of a clock system in an embedded simulation system based on SystemC provided by this invention includes: a port binding unit, a user code execution unit, and an automatic frequency adjustment unit.

[0067] Port Binding Unit: Used to bind the ports of simulation components to each other after the simulation components are created in the embedded simulation system.

[0068] User code execution unit: Used to execute user code at the default crystal oscillator frequency after the user code is loaded into the embedded simulation system.

[0069] Automatic frequency adjustment unit: When the user code changes the clock signal of the embedded simulation system, it will synchronously update the clock signal required for core operation, thereby achieving dynamic automatic frequency adjustment of the clock system of the embedded simulation system.

[0070] The following embodiments are further illustrations of the present invention, but the scope of the present invention is not limited thereto.

[0071] Traditional embedded simulation systems mostly rely on quantum time as the basis for system scheduling. Since quantum time cannot be modified after simulation begins, quantum time-based embedded simulation systems cannot meet the requirements for precise timing or automatic frequency adjustment. This embodiment provides an innovative technical approach that enables dynamic automatic frequency adjustment in the embedded simulation system's timing system. This effectively meets the precise timing requirements and dynamic automatic frequency adjustment requirements of embedded simulation systems, making the timing experience of the embedded simulation system identical to that of a real device.

[0072] Figure 2 This is the overall framework diagram of the embedded simulation system dynamic automatic frequency tuning in this embodiment. (See diagram below.) Figure 2As shown, the user creates simulation components through the embedded simulation system and binds the ports of the simulation components together. The embedded simulation system then loads the user code and executes it at the default crystal oscillator frequency. When the user code changes the clock signal of the embedded simulation system, the clock signal required for core operation is updated synchronously, thus achieving the dynamic automatic frequency adjustment function of the embedded simulation system. The specific implementation of the dynamic automatic frequency adjustment of the embedded simulation system is as follows... Figure 3 As shown, the specific process is as follows:

[0073] 1) Implement the CPU module of the embedded simulation system, defining a clock signal core_clk for the CPU instruction execution cycle within the CPU module. Implement the clock management module (RCC) of the embedded simulation system, defining various clock signals required for the operation of the embedded simulation system, including the CPU instruction execution clock signal.

[0074] 2) Within the embedded simulation system, bind the clock signal port of the CPU module to the signal of the clock management module: CPU->core_clk (RCC->core_clk).

[0075] 3) After the embedded simulation system starts, it first runs the user code at the default crystal oscillator frequency. When the user code involves configuring the clock management module, the clock management module will modify its internal registers according to the user's settings, thereby modifying the period of the clock output signal. Since the CPU's clock signal port is bound to the core clock signal of the clock management module, the CPU's clock signal will change as the core_clk of the clock management module changes.

[0076] 4) After each CPU instruction is executed, the embedded simulation system calls the simulation scheduler function sc_start and passes in the instruction cycle parameter to realize the dynamic automatic frequency adjustment function of the embedded simulation system's clock system.

[0077] The principle of this embodiment is as follows:

[0078] SystemC is an internationally standardized hardware description language that is widely supported by tools provided by various EDA vendors. SystemC is particularly suitable for modeling architectures, developing transaction-level models, and verifying models. Traditional embedded simulation systems developed based on SystemC are mostly aperiodic, precise simulation systems based on time quantum mechanics, which cannot perform dynamic frequency tuning. This fails to meet the needs of users who require precise timing and dynamic timing adjustment.

[0079] According to the SystemC syntax, the global time quantum cannot be modified after the simulation starts. Based on the immutability of the global time quantum after the simulation starts, how can the CPU instruction execution cycle be dynamically adjusted during the simulation process of the embedded simulation system? This is the core of the solution provided in this embodiment.

[0080] This solution abandons the traditional transaction-level modeling approach, removing the global time quantum from the embedded simulation system. It divides the embedded simulation system's runtime environment into a non-SystemC runtime environment and a SystemC runtime environment. CPU instructions are executed in the non-SystemC runtime environment. After the CPU completes an instruction, it calls the SystemC simulation start function `sc_start`, dynamically passing in the CPU clock cycle parameter obtained from the clock management unit. This allows it to enter the SystemC runtime environment to run the simulation for a specified cycle length. After the `sc_start` function finishes, the embedded simulation system returns to the non-SystemC runtime environment to execute the next CPU instruction. As described above, the embedded simulation system operates in a cyclical manner, achieving both the timing-level modeling requirements and the dynamic automatic frequency adjustment function of the embedded simulation system's clock system.

[0081] The above embodiments are merely preferred embodiments of the present invention and should not be construed as limiting the scope of protection of the present invention. Any non-substantial changes and substitutions made by those skilled in the art based on the present invention shall fall within the scope of protection claimed by the present invention.

Claims

1. A method for implementing dynamic automatic frequency adjustment of a clock system in an embedded simulation system based on SystemC, characterized in that, Includes the following steps: An embedded simulation system is used to create simulation components, and the ports of the simulation components are bound together. The creation of the simulation components includes: creating a CPU module and a clock management simulation module to implement the embedded simulation system; defining a clock signal for a CPU instruction execution cycle within the CPU module; and defining various clock signals required for the operation of the embedded simulation system within the clock management simulation module. The user code is loaded through the embedded simulation system and executed at the default crystal oscillator frequency; When the user code changes the clock signal of the embedded simulation system, the clock signal required for core operation will be updated synchronously, thereby achieving dynamic automatic frequency adjustment of the clock system of the embedded simulation system. Wherein, when the user code changes the clock signal of the simulation system, it includes: During the execution of the user code at the default crystal oscillator frequency, it is determined whether the user code involves configuring the clock management simulation module. If so, the clock management simulation module modifies its internal registers according to the user's settings, thereby modifying the period of the various clock signals. When synchronizing and updating the clock signals required for kernel operation, the following is included: The clock signal of the CPU module will change with the period of the various clock signals of the clock management simulation module. When the clock system of the embedded simulation system achieves dynamic automatic frequency adjustment, it includes: The embedded simulation system calls the simulation scheduler function once after executing each CPU instruction, and passes in the instruction cycle parameter to achieve dynamic automatic frequency adjustment of the clock system of the embedded simulation system. The operating environment of the embedded simulation system is divided into a non-SystemC operating environment and a SystemC operating environment. CPU instructions are executed in the non-SystemC operating environment. After the CPU module finishes executing a CPU instruction, the simulation scheduler function is called and the instruction cycle parameter obtained by the clock management module is dynamically passed in, thereby entering the SystemC runtime environment to run a simulation of a specified cycle length. After the simulation scheduler function call ends, the embedded simulation system returns to the non-SystemC runtime environment to execute the next CPU instruction.

2. The method for implementing dynamic automatic frequency adjustment of a clock system in an embedded simulation system based on SystemC according to claim 1, characterized in that, When performing mutual binding, the following are included: Within the embedded simulation system, the system clock signal port of the CPU module is bound to the system clock signal of the clock management simulation module.

3. The method for implementing dynamic automatic frequency adjustment of a clock system in an embedded simulation system based on SystemC according to claim 2, characterized in that, When performing mutual binding, it also includes: Bind the system clock signal port of the CPU module to the various clock signals of the clock management simulation module; The system clock signal includes various clock signals, including the CPU instruction execution clock signal.

4. A system for implementing dynamic automatic frequency adjustment of a clock system in an embedded simulation system based on SystemC, characterized in that, This system is applied to a method for dynamic automatic frequency adjustment of a clock system in a SystemC-based embedded simulation system, as described in any one of claims 1 to 3, the system comprising: Port binding unit: used to bind the ports of the simulation components to each other after the simulation components are created in the embedded simulation system; User code execution unit: used to execute the user code at the default crystal oscillator frequency after the user code is loaded into the embedded simulation system; Automatic frequency adjustment unit: used to synchronize and update the clock signal required for core operation when the user code changes the clock signal of the embedded simulation system, thereby achieving dynamic automatic frequency adjustment of the clock system of the embedded simulation system.

Citation Information

Patent Citations

  • Virtual simulation verification method and system based on SystemC

    CN116306401A

  • Capturing Time-Slice of Emulation Data for Offline Embedded Software Debug

    US20170255728A1