A circuit design method compatible with runge-kutta method and adams method

By designing a circuit that is compatible with the Runge-Kutta and Adams methods, flexible switching of algorithms and application scenarios can be achieved in hardware circuits, which improves computing efficiency and parallelism, solves the problems of insufficient flexibility and real-time performance in existing technologies, and meets the needs of multiple algorithms and large-scale solutions.

CN119990004BActive Publication Date: 2025-10-10HEFEI UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510071037.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-16
Publication Date
2025-10-10
Estimated Expiration
2045-01-16

AI Technical Summary

Technical Problem

Existing technologies lack flexibility and parallelism in application scenarios with high real-time requirements, and are difficult to be compatible with circuit designs for multiple algorithms and multiple application scenarios. In particular, they cannot meet the requirements of hardware circuits when solving large-scale initial values.

Method used

A circuit compatible with the Runge-Kutta method and the Adams method is designed. Through the collaborative work of the state control module, variable cache module, algorithm iteration module and data path control module, compatibility with multiple algorithms and application scenarios is achieved. The main state machine and the sub-state machine are used to switch between single-step and multi-step calculations, dynamically allocate storage units and reconstruct the calculation path, supporting the efficient operation of the fourth-order algorithm.

Benefits of technology

It improves the flexibility and computing efficiency of algorithm switching, meets high-precision computing requirements, reduces hardware resource consumption, and achieves compatibility with multiple algorithms and application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119990004B_ABST
    Figure CN119990004B_ABST
Patent Text Reader

Abstract

The application discloses a circuit design method compatible with Runge-Kutta method and Adams method, and relates to the technical field of digital signal processing. The method realizes efficient solution of initial value problems of ordinary differential equations through a modular circuit architecture. The method designs a state control module, a variable cache module, an algorithm iteration module, an ordinary differential equation calculation module and a data path control module. Through cooperation of a main state machine and an auxiliary state machine, flexible switching of single-step method and multi-step method is realized. When the single-step method is selected, the system only performs calculation of the Runge-Kutta method. When the multi-step method is selected, the system first performs calculation of the Runge-Kutta method, calculates initial values for the multi-step method, and then performs iterative calculation of the Adams method. The method is suitable for ordinary differential equations with different complexities, can meet high-precision and real-time requirements through dynamic adjustment of use of hardware resources, and is particularly suitable for engineering application fields requiring fast solution of ordinary differential equations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of digital signal processing, and in particular to a circuit design method compatible with the Runge-Kutta method and the Adams method. Background Art

[0002] Initial value problems for ordinary differential equations are widely used in fields such as physics, engineering, and biology. In classical mechanics, initial value conditions can be used to predict the position and velocity of an object at a certain moment in the future. In control systems and signal processing, the relationship between current and voltage in a circuit can be modeled using differential equations, and initial value conditions help determine the system's initial state. In ecological models, by setting the initial population size, future population trends can be analyzed.

[0003] Existing techniques typically model these application scenarios using software. While this approach can quickly analyze object models, it lacks flexibility in scenarios requiring high real-time performance or when evaluating the accuracy of multiple algorithms. Furthermore, it lacks sufficient parallelism for solving large-scale initial values. Hardware circuits can meet both parallelism and real-time requirements, but lack compatibility with multiple algorithms and application scenarios.

[0004] Therefore, it is urgent to propose a circuit design method that is compatible with multiple algorithms and can meet multiple application scenarios by reconstructing some modules. Summary of the Invention

[0005] The purpose of the present invention is to provide a circuit design method that is compatible with the Runge-Kutta method and the Adams method, which realizes compatibility with multiple algorithms and multiple application scenarios through a set of circuits, while meeting the needs of fast and large-scale solutions.

[0006] The technical solution of the present invention is to provide a circuit design method compatible with the Runge-Kutta method and the Adams method, the method comprising:

[0007] Initializing the ordinary differential equation problem: Receives initial values ​​of the ordinary differential equation and related configuration data input by the user, and adjusts the configuration of each module in the circuit design according to the selected algorithm, including the Runge-Kutta method and the Adams method;

[0008] According to the selected algorithm, the main state machine in the state control module enters different states; the main state machine first enters the data uplink and downlink state, transfers the initial value data to the variable cache module, and dynamically allocates the storage unit in the variable cache module; then, according to the selected algorithm, the main state machine enters the single-step state or the multi-step state;

[0009] When executing the single-step method calculation, the main state machine enters the single-step method state, and the first sub-state machine executes the state jumps of RK1, RK2, RK3 and RK4 in sequence to complete the calculation of the fourth-order Runge-Kutta method; if the termination condition is met, the main state machine returns to the data uplink and downlink state; if the termination condition is not met, the first sub-state machine continues to loop and execute the calculations of RK1 to RK4 until the termination condition is met;

[0010] When executing multi-step calculations, the main state machine first enters the single-step state. The first sub-state machine first executes the state jumps of RK1, RK2, RK3 and RK4 in sequence to complete the calculation of the fourth-order Runge-Kutta method and provide initial values ​​for the multi-step calculation. The main state machine jumps to the multi-step state, and the second sub-state machine executes the calculations of Adams1 and Adams2 until the termination condition is met or all calculations are completed.

[0011] After all calculations are completed, the main state machine returns to the data uplink and downlink state and outputs the final result to the external device; after the data output is completed, the system will reset, clear the data in the variable cache module, and return the main state machine to the idle state to prepare for the next calculation task.

[0012] In any of the above technical solutions, further, the circuit designed by the method includes the following modules:

[0013] A state control module is used to control the overall operating state of the circuit; the state control module includes a main state machine, a first sub-state machine, and a second sub-state machine; the main state machine is used to control the switching of the circuit's operating state; the first sub-state machine is used to control the circuit to perform second to fourth order calculations in the Runge-Kutta method; the second sub-state machine is used to control the circuit to perform calculations in the fourth-order explicit Adams method, the fourth-order implicit Adams method, and the fourth-order Adams prediction-correction system;

[0014] The variable cache module dynamically allocates storage units based on the form of the ordinary differential equation and the selected algorithm to store the input variables, intermediate variables, and operation results of the ordinary differential equation. The variable cache module consists of several storage units. If the user enters a system of differential equations, the storage units will be increased or decreased according to the number of differential variables.

[0015] The algorithm iteration module includes a set of logic operation units. The state control module sends different instructions to the algorithm iteration module based on the selected algorithm. The algorithm iteration module adjusts the configuration of the logic operation units according to the instructions and performs iterative calculations. The logic operation units include multiple adders and multipliers. For a fourth-order algorithm, the operation of each variable requires three adders and six multipliers.

[0016] The ordinary differential equation calculation module calculates numerical solutions through a unified interface, allowing users to customize differential equation calculation units based on actual problems. The ordinary differential equation calculation module reconstructs the calculation pipeline according to the given ordinary differential equation form, and the pipeline adopts the organizational form of a pipeline;

[0017] The data path control module consists of a decoder and several control signals and selection signals. The data path control module is used to realize dynamic scheduling of data flow between modules to meet the requirements of calculation paths when switching between different algorithms.

[0018] In any of the above technical solutions, further, in the multi-step calculation, after the state control module completes three rounds of Runge-Kutta method calculation, if the termination condition is still not met, the iteration is stopped and the results of the first three rounds of calculation are used as the initial values ​​of the multi-step calculation, and the second sub-state machine continues to execute the Adams method calculation.

[0019] In any of the above technical solutions, further, the ordinary differential equation input by the user is a first-order ordinary differential equation system, and the initial value problem of the equation system is as follows:

[0020]

[0021] where a <t≤b;

[0022] Restructure the variable cache module and ordinary differential equation calculation module. The variable cache module requires two sets of variable cache units and an intermediate variable storage module during the operation process to store the result values ​​calculated by the ordinary differential equation at each iteration. The ordinary differential equation calculation module is reorganized to calculate f(t, y, z) and g(t, y, z).

[0023] The fourth-order Adams prediction-correction algorithm in the linear multi-step method is selected. A group of variable cache units in the variable cache module is divided into four independent variable storage sub-units, each of which stores the numerical solution of one-step iteration;

[0024] The main state machine performs multi-step calculations. The main state machine first enters the single-step state, and the algorithm iteration module is reconstructed to meet the following form of the fourth-order classic Runge-Kutta method:

[0025]

[0026] The first sub-state machine performs three rounds of operations from RK1 to RK4 to generate the initial value variables required to start the linear multi-step method. The main state machine enters the multi-step method state, the first sub-state machine jumps back to the idle state, and the second sub-state machine jumps to Adams1. At the same time, the algorithm iteration module is reconstructed into the form that satisfies the following fourth-order Adams prediction-correction system:

[0027] predict:

[0028]

[0029] Correction:

[0030]

[0031] The data path control module controls the algorithm iteration module and the ordinary differential equation calculation module to read the variable cache value from the equation variable cache module. Then the ordinary differential equation calculation module starts the operation and outputs the equation result to the algorithm iteration module, and outputs the intermediate variable result to the intermediate variable storage unit in the variable cache module. After receiving the transferred result, the algorithm iteration module performs the algorithm operation corresponding to the Adams1 state in the second sub-state machine and outputs the result to the ordinary differential equation calculation module. After all variables are calculated, a data flow loop is completed, and the second sub-state machine is controlled to enter Adams2 from Adams1.

[0032] Repeat the above data flow loop. After all variables are calculated, if the iteration termination condition is not met, control the second state machine from Adams2 to Adams1. Repeat the above second state machine loop until the iteration termination condition is met.

[0033] When the iteration termination condition is met, the second sub-state machine jumps back to the idle state from Adams2, and the main state machine jumps back to the data uplink and downlink state from the multi-step method state. At this point, the initial value problem of the above ordinary differential equation is solved.

[0034] In any of the above technical solutions, further, the specific process of the first sub-state machine performing three rounds of operations RK1 to RK4 includes:

[0035] The data path control module controls the algorithm iteration module and the ordinary differential equation calculation module to read the variable cache value from the equation variable cache module. Then the ordinary differential equation calculation module starts the operation and outputs the equation result to the algorithm iteration module, and outputs the intermediate variable result to the intermediate variable storage unit in the variable cache module. After receiving the transferred result, the algorithm iteration module performs the algorithm operation corresponding to the RK1 state in the first sub-state machine and outputs the result to the ordinary differential equation calculation module. After all variables are calculated, a data flow loop is completed, and the first sub-state machine is controlled to enter RK2 from RK1.

[0036] The data path control module controls the algorithm iteration module and the ordinary differential equation calculation module to read the differential variable values ​​from the equation variable cache module. The ordinary differential equation calculation module then starts the operation and outputs the differential variable results to the algorithm iteration module, and outputs the intermediate variable results to the intermediate variable storage unit in the variable cache module. After receiving the transferred results, the algorithm iteration module performs the algorithm operation corresponding to the RK2 state and outputs the results to the variable cache module. After all variables are calculated, the first sub-state machine is controlled to enter RK3 from RK2.

[0037] Repeat the above data flow loop, and after all variables are calculated, control the first state machine to enter RK4 from RK3; repeat again to make RK4 enter RK1, and continue to repeat until three rounds of RK4 calculations are completed to generate the initial value variables required to start the linear multi-step method.

[0038] In any of the above technical solutions, the method further includes: for a group of ordinary differential equations in piecewise form, each time a new segment is entered, the system will re-enable the single-step method to calculate the initial value and provide the initial value for the subsequent multi-step method.

[0039] In any of the above technical solutions, further, the method also includes: for high-order ordinary differential equations, converting the high-order differential equations into a group of first-order ordinary differential equations and inputting them into the circuit for calculation.

[0040] The beneficial effects of the present invention are:

[0041] The technical solution in the present invention realizes seamless switching between single-step method and multi-step method through the collaboration of the main state machine and the sub-state machine. When executing the multi-step method, the system first calculates the initial value in the single-step method state, and then automatically jumps to the multi-step method state for iterative calculation. This design improves the flexibility of algorithm switching and can efficiently schedule calculation tasks according to actual needs.

[0042] The algorithm iteration module dynamically reconfigures to adapt to the needs of different algorithms. For fourth-order algorithms, it uses optimized adder and multiplier configurations to reduce hardware resource consumption. Furthermore, the variable cache module's dynamic storage allocation and pipelined computing structure maximize hardware resource utilization, meeting high-precision computing requirements while significantly improving computational efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] The advantages of the above and additional aspects of the present invention will become apparent and readily understood from the following description of the embodiments with reference to the accompanying drawings, in which:

[0044] Figure 1 is a schematic flow chart of a circuit design method compatible with the Runge-Kutta method and the Adams method according to an embodiment of the present invention;

[0045] Figure 2 is a schematic block diagram of a circuit design method compatible with the Runge-Kutta method and the Adams method according to an embodiment of the present invention;

[0046] Figure 3 This is a schematic diagram of a main state machine jump according to a circuit design method compatible with the Runge-Kutta method and the Adams method according to an embodiment of the present invention;

[0047] Figure 4 This is a first state machine jump diagram of a circuit design method compatible with the Runge-Kutta method and the Adams method according to an embodiment of the present invention;

[0048] Figure 5 This is a second state machine jump diagram of a circuit design method compatible with the Runge-Kutta method and the Adams method according to an embodiment of the present invention;

[0049] Figure 6 1 is a structural diagram of a single data cycle process of a circuit design method compatible with the Runge-Kutta method and the Adams method according to an embodiment of the present invention;

[0050] Figure 7 1. A schematic diagram of a data path reconstruction scheme for the first step variable operation of a fourth-order classical Runge-Kutta method, a circuit design method compatible with the Runge-Kutta method and the Adams method, according to an embodiment of the present invention;

[0051] Figure 8 1. A schematic diagram of a data path reconstruction scheme for the second step variable operation of the fourth-order classical Runge-Kutta method, a circuit design method compatible with the Runge-Kutta method and the Adams method, according to an embodiment of the present invention;

[0052] Figure 9 1. A schematic diagram of a data path reconstruction scheme for the third step variable operation of the fourth-order classical Runge-Kutta method, a circuit design method compatible with the Runge-Kutta method and the Adams method, according to an embodiment of the present invention;

[0053] Figure 10 1. A schematic diagram of a data path reconstruction scheme for the fourth step variable operation of the fourth-order classical Runge-Kutta method, a circuit design method compatible with the Runge-Kutta method and the Adams method, according to an embodiment of the present invention;

[0054] Figure 111. A schematic diagram of a data path reconstruction scheme for predictor variable calculation of a fourth-order Adams predictor-corrector system according to a circuit design method compatible with the Runge-Kutta method and the Adams method according to an embodiment of the present invention;

[0055] Figure 12 1 is a schematic diagram of a data path reconstruction scheme for correction variable calculation of a fourth-order Adams prediction-correction system according to a circuit design method compatible with the Runge-Kutta method and the Adams method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0056] In order to more clearly understand the above-mentioned objects, features and advantages of the present invention, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present invention and the features therein can be combined with each other without conflict.

[0057] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the scope of protection of the present invention is not limited to the specific embodiments disclosed below.

[0058] like Figure 1 As shown, this embodiment provides a circuit design method compatible with the Runge-Kutta method and the Adams method, and builds Figure 2 The circuit design model shown in FIG. 1 includes:

[0059] Initialize the ordinary differential equation problem: The user needs to enter the initial value of the ordinary differential equation and related configuration data, and determine the algorithm to be used. The system will adjust the configuration of the state control module, variable cache module, algorithm iteration module and ordinary differential equation calculation module according to the selected algorithm.

[0060] Configure the state control module: Depending on the selected algorithm, the main state machine in the state control module will enter different states; the main state machine first enters the data uplink and downlink state, passing the initial value data to the variable cache module; then, depending on the selected algorithm, the main state machine enters the single-step method state (state 1) or the multi-step method state (state 2); the single-step method is suitable for simple problems, and each step is calculated independently. The multi-step method is suitable for complex problems and uses previous results to reduce the amount of calculation.

[0061] Configure the variable cache module: The variable cache module dynamically allocates storage units based on the form of the ordinary differential equation. If the ordinary differential equation is given by a system of first-order differential equations, the number of storage units corresponding to the number of differential variables needs to be increased. If it is a system of higher-order differential equations, the number of storage units needs to be increased or decreased based on the number of higher-order differential variables. This process ensures that all initial values, iterative variables, and intermediate results can be effectively stored.

[0062] Configure the algorithm iteration module: The algorithm iteration module is dynamically reconfigured based on the selected algorithm through instructions from the state control module. For a fourth-order algorithm, this module has three adders and six multipliers, which can efficiently perform the corresponding mathematical operations to ensure that the algorithm's computational requirements are met.

[0063] Configure the ordinary differential equation calculation module: The ordinary differential equation calculation module calculates the numerical solutions of ordinary differential equations through a unified interface. The calculation units of this module are also customized according to the form of ordinary differential equations, and adopt a pipeline calculation structure to improve computational efficiency.

[0064] The data path control module is used to implement dynamic scheduling of data flows between modules and support the reconstruction of internal paths within modules to meet the needs of different algorithms and application scenarios.

[0065] After receiving the ordinary differential equation and its initial value problem input by the user and selecting the algorithm, the main state machine in the state control module enters the data uplink and downlink state, and passes the initial value data to the variable cache module. Then the main state machine switches to the single-step method state (state 1) or the multi-step method state (state 2) according to the algorithm selection; the variable cache module dynamically allocates storage units according to the number of equation variables to store initial values, iterative variables and intermediate results; the algorithm iteration module dynamically reconstructs the logical operation unit according to the specific steps of the algorithm; the ordinary differential equation calculation module calculates the numerical solution of the target equation through a unified interface.

[0066] like Figure 4 As shown, the calculation process of the single-step method (Runge-Kutta method) is as follows:

[0067] 1) The main state machine enters the single-step state, and the first sub-state machine executes the state jumps of RK1, RK2, RK3 and RK4 in sequence. (RK1 represents the first step of the Runge-Kutta method, and so on.)

[0068] 2) In the RK1 stage, the state machine control reads the initial variable value from the variable cache module, and the ordinary differential equation calculation module starts the first step of operation; the calculation result is output to the algorithm iteration module, and the algorithm iteration module performs the algorithm operation according to the passed result and returns the result to the ordinary differential equation calculation module.

[0069] 3) In the RK2 stage, the data reading and calculation process is repeated to generate the calculation results of the second step; if the second-order Runge-Kutta method is selected, the result is directly output to the variable cache module, otherwise continue to the next stage.

[0070] 4) In the RK3 and RK4 stages, continue to execute the same process and complete the calculations of the third and fourth steps in sequence; after the fourth-order Runge-Kutta method completes all calculations, determine whether it meets the termination condition. If not, return to RK1 for iteration until the final result meets the termination condition, and return the calculation result to the main state machine.

[0071] like Figure 3 As shown, the state control module enters the data uplink and downlink state after receiving the ordinary differential equation and its initial value problem input by the user. When the selected algorithm enters the single-step method state, the system is operated according to the above single-step method calculation process. When the selected algorithm enters the multi-step method state, it is still necessary to first perform the above single-step method calculation process to calculate the initial value required for the multi-step method. Different from the above method, if the termination condition is still not met after three rounds of iteration, the iteration is stopped and the calculation results of the first three rounds are used as the initial value. The main state machine jumps from state 1 to state 2 and performs the following remaining calculation process:

[0072] like Figure 5 As shown, the remaining calculation process of the multi-step method (Adams method) is as follows:

[0073] 1) The main state machine switches to the multi-step state, and the second sub-state machine enters the Adams1 stage.

[0074] 2) In the Adams1 stage, the variable cache module provides the calculation results of the previous steps, the ordinary differential equation calculation module completes the prediction operation, and outputs it to the algorithm iteration module.

[0075] 3) In the Adams2 stage, the ordinary differential equation calculation module performs correction operations and makes adjustments based on the predicted results and actual calculation results; when the iteration termination condition is met, it returns to the main state machine; if not, it continues to repeat the iterative process of Adams1 and Adams2.

[0076] For piecewise ODEs, the system re-enables the single-step method at the beginning of each segment to calculate the initial values ​​required for the multi-step method.

[0077] When solving high-order differential equations, the system will convert the high-order differential equations into a set of first-order ordinary differential equations and perform calculations according to the above process.

[0078] After all calculations are completed, the main state machine returns to the data uplink and downlink state and outputs the final result to the external device; after the data output is completed, the system will reset, clear the data in the variable cache module, and return the main state machine to the idle state to prepare for the next calculation task.

[0079] In the execution circuit of the above method, the state control module consists of a main state machine and two sub-state machines, which are used to control the working state of the circuit; the main state machine is responsible for switching the overall process, including the idle state, data uplink and downlink state, single-step state and multi-step state; the first sub-state machine is used to control the operation process of the second to fourth-order Runge-Kutta methods in the single-step method, and the second sub-state machine is used to control the operation process of the fourth-order explicit Adams method, implicit Adams method and prediction-correction system in the multi-step method.

[0080] The variable cache module is used to store the input variables, intermediate variables and calculation results of the equation. The module adopts a dynamic cache structure and can increase or decrease storage units, such as register groups, RAM or DDR memory, according to the complexity of the ordinary differential equation.

[0081] The algorithm iteration module contains a set of logical operation units, which can be reconfigured through the state control module to adapt to different algorithm requirements. In the fourth-order algorithm, this module includes three adders and six multipliers, which can efficiently complete the required mathematical operations.

[0082] The ordinary differential equation calculation module provides a unified calculation interface, supports users to customize differential equation calculation units according to actual problems, and adopts a pipeline structure to achieve efficient calculation.

[0083] In another embodiment of the present invention, assuming that the target ordinary differential equation is a first-order ordinary differential equation system, the initial value problem of the equation system is as follows:

[0084]

[0085] where a <t≤b。

[0086] After receiving the given initial value problem of the ordinary differential equation, the variable cache module and the ordinary differential equation calculation module are reconstructed according to the characteristics of the equation. The variable cache module requires two sets of variable cache units and an intermediate variable storage module during the operation process to store the result values ​​calculated by the corresponding ordinary differential equation at each iteration. At the same time, the ordinary differential equation calculation module is reorganized into the form of calculating f(t,y,z) and g(t,y,z).

[0087] By default, the set of equations can meet the iterative step size requirements of the linear multi-step method. The fourth-order Adams prediction-correction algorithm in the linear multi-step method is selected. A group of variable cache units in the variable cache module is divided into four independent variable storage sub-units, each of which stores the numerical solution of one-step iteration.

[0088] After all modules are ready, an external unit transmits initial value data to the state control module. The main state machine then transitions from the idle state to the data uplink and downlink state, controlling data distribution to the corresponding variable cache modules. After data distribution is complete, if the ordinary differential equation does not require initial intermediate variables, the main state machine enters state 1, where the single-step iteration begins, calculating the initial values ​​required for the linear multi-step method.

[0089] At this time, the state jumps from the idle state to the RK1 state, and a data flow loop begins in this state. The direction of the data flow in a data flow loop is as follows: Figure 6 As shown, the algorithm iteration module is reconstructed into the form that satisfies the following fourth-order classic Runge-Kutta method:

[0090]

[0091] The algorithm iteration module after reconstruction is as follows Figure 7 As shown, in this data flow loop, the data path control module controls the algorithm iteration module and the ordinary differential equation calculation module to read the variable cache value from the equation variable cache module. Then the ordinary differential equation calculation module starts the operation and outputs the equation result to the algorithm iteration module, and outputs the intermediate variable result to the intermediate variable storage unit in the variable cache module. After receiving the transferred result, the algorithm iteration module performs the algorithm operation corresponding to the RK1 state in the first sub-state machine, and outputs the result to the ordinary differential equation calculation module. After all variables are calculated, a data flow loop is completed, and the first sub-state machine is controlled to enter RK2 from RK1. At the same time, the algorithm iteration module is reconstructed as follows Figure 8 The structure shown.

[0092] The data path control module controls the algorithm iteration module and the ordinary differential equation calculation module to read the differential variable values ​​from the equation variable cache module. Then the ordinary differential equation calculation module starts the operation and outputs the differential variable results to the algorithm iteration module, and outputs the intermediate variable results to the intermediate variable storage unit in the variable cache module. After receiving the transferred results, the algorithm iteration module performs the algorithm operation corresponding to the RK2 state. If the second-order Runge-kutta method is selected, the result is output to the variable cache module. At this time, a second-order Runge-kutta method iteration is completed. If not, the result is output to the ordinary differential equation calculation module. After all variables are calculated, the first sub-state machine is controlled to enter RK3 from RK2. At the same time, the algorithm iteration module is reconstructed as follows Figure 9 The structure shown.

[0093] Repeat the above data flow loop, and after all variables are calculated, control the first state machine to enter RK4 from RK3. At the same time, reconstruct the algorithm iteration module as follows Figure 10 The structure shown.

[0094] Repeat the above data flow loop, and after all variables are calculated, the first state machine enters RK1 from RK4. At the same time, the algorithm iteration module is reconstructed as follows Figure 7 The structure shown. Repeat the above algorithm twice until the initial value variables required for the linear multi-step method startup are generated. At this time, the main state machine is controlled to enter state 2 from state 1, jump back to the idle state from RK4 from state 1, and jump from the idle state to Adams1 from state 2. Figure 11 As shown, the algorithm iteration module is reconstructed into a form that satisfies the following fourth-order Adams prediction-correction system:

[0095] predict:

[0096]

[0097] Correction:

[0098]

[0099] The data path control module controls the algorithm iteration module and the ordinary differential equation calculation module to read the variable cache value from the equation variable cache module. Then the ordinary differential equation calculation module starts the operation and outputs the equation result to the algorithm iteration module, and outputs the intermediate variable result to the intermediate variable storage unit in the variable cache module. After receiving the transferred result, the algorithm iteration module performs the algorithm operation corresponding to the Adams1 state in the second sub-state machine and outputs the result to the ordinary differential equation calculation module. After all variables are calculated, a data flow loop is completed, and the second sub-state machine is controlled to enter Adams2 from Adams1. At the same time, the algorithm iteration module is reconstructed as follows Figure 12 The structure shown.

[0100] Repeat the above data flow loop. After all variables are calculated, if the iteration termination condition is not met, control the second state machine from Adams2 to Adams1. At the same time, reconstruct the algorithm iteration module as follows Figure 11 The structure shown in FIG. Repeat the loop of the second state machine until the iteration termination condition is met.

[0101] When the iteration termination condition is met, the second sub-state machine can be controlled to jump from Adams2 back to the idle state, while the main state machine jumps from State 2 back to the data uplink and downlink state. In this state, variable values ​​are read from the variable cache module and passed to other user-defined units. This completes the solution to the initial value problem of the ordinary differential equation.

[0102] In summary, the present invention proposes a circuit design method that is compatible with the Runge-Kutta method and the Adams method, including:

[0103] Initialize the ordinary differential equation problem: Receive the initial values ​​of the ordinary differential equation and related configuration data input by the user, and adjust the configuration of each module in the circuit design according to the selected algorithm, which includes the Runge-Kutta method and the Adams method.

[0104] According to the selected algorithm, the main state machine in the state control module enters different states; the main state machine first enters the data uplink and downlink state, passes the initial value data to the variable cache module, and dynamically allocates the storage units in the variable cache module; then, according to the selected algorithm, the main state machine enters the single-step state or the multi-step state.

[0105] When executing the single-step method calculation, the main state machine enters the single-step method state, and the first sub-state machine executes the state jumps of RK1, RK2, RK3 and RK4 in sequence to complete the calculation of the fourth-order Runge-Kutta method; if the termination condition is met, the main state machine returns to the data uplink and downlink state; if the termination condition is not met, the first sub-state machine continues to loop and execute the calculations of RK1 to RK4 until the termination condition is met.

[0106] When executing multi-step calculations, the main state machine first enters the single-step state, and the first sub-state machine executes the state jumps of RK1, RK2, RK3 and RK4 in sequence to complete the calculation of the fourth-order Runge-Kutta method and provide initial values ​​for the multi-step calculations. The main state machine jumps to the multi-step state, and the second sub-state machine executes the calculations of Adams1 and Adams2 until the termination condition is met or all calculations are completed.

[0107] After all calculations are completed, the main state machine returns to the data uplink and downlink state and outputs the final result to the external device; after the data output is completed, the system will reset, clear the data in the variable cache module, and return the main state machine to the idle state to prepare for the next calculation task.

[0108] The steps in the present invention can be adjusted in sequence, combined, or deleted according to actual needs.

[0109] The units in the device of the present invention can be combined, divided and deleted according to actual needs.

[0110] Although the present invention has been disclosed in detail with reference to the accompanying drawings, it should be understood that these descriptions are merely illustrative and are not intended to limit the application of the present invention. The scope of the present invention is defined by the appended claims and includes various modifications, variations, and equivalents made to the invention without departing from the scope and spirit of the present invention.

Claims

1. A circuit design method compatible with the Runge-Kutta method and the Adams method, characterized in that: The method comprises: Initializing the ordinary differential equation problem: Receives initial values ​​of the ordinary differential equation and related configuration data input by the user, and adjusts the configuration of each module in the circuit design according to the selected algorithm, including the Runge-Kutta method and the Adams method; According to the selected algorithm, the main state machine in the state control module enters different states; the main state machine first enters the data uplink and downlink state, transfers the initial value data to the variable cache module, and dynamically allocates the storage unit in the variable cache module; then, according to the selected algorithm, the main state machine enters the single-step state or the multi-step state; When executing the single-step method calculation, the main state machine enters the single-step method state, and the first sub-state machine executes the state jumps of RK1, RK2, RK3 and RK4 in sequence to complete the calculation of the fourth-order Runge-Kutta method; if the termination condition is met, the main state machine returns to the data uplink and downlink state; if the termination condition is not met, the first sub-state machine continues to loop and execute the calculations of RK1 to RK4 until the termination condition is met; When executing multi-step calculations, the main state machine first enters the single-step state. The first sub-state machine first executes the state jumps of RK1, RK2, RK3 and RK4 in sequence to complete the calculation of the fourth-order Runge-Kutta method and provide initial values ​​for the multi-step calculation. The main state machine jumps to the multi-step state, and the second sub-state machine executes the calculations of Adams1 and Adams2 until the termination condition is met or all calculations are completed. After all calculations are completed, the main state machine returns to the data uplink and downlink state and outputs the final result to the external device; after the data output is completed, the system will reset, clear the data in the variable cache module, and return the main state machine to the idle state to prepare for the next calculation task.

2. The circuit design method compatible with the Runge-Kutta method and the Adams method according to claim 1, characterized in that: The circuit designed by the method includes the following modules: The state control module is used to control the overall working state of the circuit; the state control module includes a main state machine, a first sub-state machine, and a second sub-state machine; the main state machine is used to control the switching of the circuit working state; The first state machine is used to control the circuit to perform second to fourth order calculations in the Runge-Kutta method; the second state machine is used to control the circuit to perform calculations of the fourth order explicit Adams method, the fourth order implicit Adams method and the fourth order Adams prediction-correction system; The variable cache module dynamically allocates storage units based on the form of the ordinary differential equation and the selected algorithm to store the input variables, intermediate variables, and operation results of the ordinary differential equation. The variable cache module consists of several storage units. If the user enters a system of differential equations, the storage units will be increased or decreased according to the number of differential variables. The algorithm iteration module includes a set of logic operation units. The state control module sends different instructions to the algorithm iteration module based on the selected algorithm. The algorithm iteration module adjusts the configuration of the logic operation units according to the instructions and performs iterative calculations. The logic operation units include multiple adders and multipliers. For a fourth-order algorithm, the operation of each variable requires three adders and six multipliers. The ordinary differential equation calculation module calculates numerical solutions through a unified interface, allowing users to customize differential equation calculation units based on actual problems. The ordinary differential equation calculation module reconstructs the calculation pipeline according to the given ordinary differential equation form, and the pipeline adopts the organizational form of a pipeline; The data path control module consists of a decoder and several control signals and selection signals. The data path control module is used to realize dynamic scheduling of data flow between modules to meet the requirements of calculation paths when switching between different algorithms.

3. The circuit design method compatible with the Runge-Kutta method and the Adams method according to claim 1, characterized in that: In the multi-step calculation, after completing three rounds of Runge-Kutta method calculation, if the termination condition is still not met, the state control module stops iteration and uses the results of the first three rounds of calculation as the initial values ​​of the multi-step calculation, and the second sub-state machine continues to perform the Adams method calculation.

4. The circuit design method compatible with the Runge-Kutta method and the Adams method according to any one of claims 1 to 3, characterized in that: The ordinary differential equation input by the user is a first-order ordinary differential equation system, and the initial value problem of the equation system is as follows: where a <t≤b; Reconstruct the variable cache module and the ordinary differential equation calculation module. The variable cache module requires two sets of variable cache units and an intermediate variable storage module during the operation process to store the result values ​​calculated by the corresponding ordinary differential equation at each iteration; the ordinary differential equation calculation module is reorganized to calculate f(t, y, z) and g(t, y, z); The fourth-order Adams prediction-correction algorithm in the linear multi-step method is selected. A group of variable cache units in the variable cache module is divided into four independent variable storage sub-units, each of which stores the numerical solution of one-step iteration; The main state machine performs multi-step calculations. The main state machine first enters the single-step state, and the algorithm iteration module is reconstructed to meet the following form of the fourth-order classic Runge-Kutta method: The first sub-state machine performs three rounds of operations from RK1 to RK4 to generate the initial value variables required to start the linear multi-step method. The main state machine enters the multi-step method state, the first sub-state machine jumps back to the idle state, and the second sub-state machine jumps to Adams1. At the same time, the algorithm iteration module is reconstructed into the form that satisfies the following fourth-order Adams prediction-correction system: predict: Correction: The data path control module controls the algorithm iteration module and the ordinary differential equation calculation module to read the variable cache value from the equation variable cache module. Then the ordinary differential equation calculation module starts the operation and outputs the equation result to the algorithm iteration module, and outputs the intermediate variable result to the intermediate variable storage unit in the variable cache module. After receiving the transferred result, the algorithm iteration module performs the algorithm operation corresponding to the Adams1 state in the second sub-state machine and outputs the result to the ordinary differential equation calculation module. After all variables are calculated, a data flow loop is completed, and the second state machine is controlled to enter Adams2 from Adams1; Repeat the above data flow loop. After all variables are calculated, if the iteration termination condition is not met, control the second state machine from Adams2 to Adams1. Repeat the above second state machine loop until the iteration termination condition is met. When the iteration termination condition is met, the second sub-state machine jumps back to the idle state from Adams2, and the main state machine jumps back to the data uplink and downlink state from the multi-step method state. At this point, the initial value problem of the above ordinary differential equation is solved.

5. The circuit design method compatible with the Runge-Kutta method and the Adams method according to claim 4, characterized in that: The specific process of the first state machine performing three rounds of operations RK1 to RK4 includes: The data path control module controls the algorithm iteration module and the ordinary differential equation calculation module to read the variable cache value from the equation variable cache module. Then the ordinary differential equation calculation module starts the operation and outputs the equation result to the algorithm iteration module, and outputs the intermediate variable result to the intermediate variable storage unit in the variable cache module. After receiving the transferred result, the algorithm iteration module performs the algorithm operation corresponding to the RK1 state in the first sub-state machine and outputs the result to the ordinary differential equation calculation module. After all variables are calculated, a data flow loop is completed, and the first sub-state machine is controlled to enter RK2 from RK1. The data path control module controls the algorithm iteration module and the ordinary differential equation calculation module to read the differential variable values ​​from the equation variable cache module. The ordinary differential equation calculation module then starts the operation and outputs the differential variable results to the algorithm iteration module, and outputs the intermediate variable results to the intermediate variable storage unit in the variable cache module. After receiving the transferred results, the algorithm iteration module performs the algorithm operation corresponding to the RK2 state and outputs the results to the variable cache module. After all variables are calculated, the first sub-state machine is controlled to enter RK3 from RK2. Repeat the above data flow loop, and after all variables are calculated, control the first state machine to enter RK4 from RK3; repeat again to make RK4 enter RK1, and continue to repeat until three rounds of RK4 calculations are completed to generate the initial value variables required to start the linear multi-step method.

6. The circuit design method compatible with the Runge-Kutta method and the Adams method according to claim 1, characterized in that: The method also includes: for a piecewise ordinary differential equation system, whenever entering a new segment, the system will re-enable the single-step method to calculate the initial value and provide the initial value for the subsequent multi-step method.

7. The circuit design method compatible with the Runge-Kutta method and the Adams method according to claim 1, characterized in that: The method further comprises: for a high-order ordinary differential equation, converting the high-order differential equation into a group of first-order ordinary differential equations and inputting the groups into the circuit for calculation.

Citation Information

Patent Citations

  • Hardware acceleration device and acceleration method for solving differential equations

    CN106527999A

  • Non-linear ordinary differential equation recognition method based on machine learning

    CN115408932A