A FPGA layout method based on differential particle swarm optimization algorithm

Through the differential particle swarm optimization algorithm, combined with the roulette and particle swarm optimization algorithms, the problems of small search range and difficult parameter adjustment of the simulated annealing algorithm in FPGA layout are solved, and the layout quality and convergence speed are improved.

CN118504492BActive Publication Date: 2024-09-13JINAN ZHIDUOJI MICROELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410982507.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-22
Publication Date
2024-09-13
Estimated Expiration
2044-07-22

AI Technical Summary

Technical Problem

The existing simulated annealing algorithm has a small search range, many parameters and is difficult to adjust in FPGA layout, making it difficult to meet the design needs of complex circuits, resulting in poor layout quality.

Method used

Based on the differential particle swarm optimization algorithm, the FPGA layout is optimized through the steps of initializing the particle swarm, fitness evaluation, hybridization pool formation, differential evolution and position update, combined with the roulette and particle swarm optimization algorithms.

Benefits of technology

It improves the FPGA layout quality, enhances global search capabilities, simplifies parameter adjustment, and improves the optimal solution search rate and convergence speed of layout results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118504492B
    Figure CN118504492B
Patent Text Reader

Abstract

The present invention discloses an FPGA layout method based on a differential particle swarm optimization algorithm, including: obtaining the network standard topological connection structure of the logic resource and the physical resource information of the FPGA chip, initializing the physical resource block to obtain the initial particle group; obtaining the fitness value of each particle in the particle group; forming a hybrid pool in a roulette manner and performing differential evolution on the particles in the hybrid pool to form a new particle group; using the fitness value of the particle to update and store the individual optimal value and the global optimal value; using the individual optimal value and the global optimal value, updating the speed and position of each particle in the current particle group; further updating and storing the individual optimal value and the global optimal value; repeating the execution until the termination condition, and obtaining the FPGA layout result. The present invention uses the particle swarm optimization algorithm and the differential evolution algorithm to alternately perform global and local detailed searches, which greatly increases the probability of searching for the optimal solution and improves the layout quality of the FPGA.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of integrated circuits, and in particular relates to an FPGA layout method based on a differential particle swarm optimization algorithm. Background Art

[0002] FPGA (Field Programmable Gate Array) has the characteristics of field configurability, short development cycle, low risk, and rich logic resources. Therefore, it is widely used in communications, graphics and image processing, display control, industrial control, automotive electronics and other fields. With the increase in the scale and integration of FPGA, it has brought great challenges to related EDA (Electronic Design Automation) tools. Layout is one of the important core steps in the FPGA EDA implementation process, which is crucial to the final result and optimization degree of the entire process.

[0003] The simulated annealing algorithm is an existing classic heuristic optimization algorithm, which randomly selects an initial solution and continuously perturbs the initial solution to obtain the optimal solution. Therefore, the simulated annealing algorithm has a small searchable solution space, a small search range, and a small probability of finding the optimal solution. The layout quality is difficult to meet the current design requirements of complex circuits. At the same time, the simulated annealing algorithm has many parameters. For example, it takes a lot of time and effort to make the algorithm model parameters more suitable for the current router architecture. As the complexity and scale of FPGA design circuits grow exponentially, the layout results of the current simulated annealing algorithm are difficult to meet the design requirements of complex circuits. Summary of the invention

[0004] In order to solve the above problems existing in the prior art, the present invention provides an FPGA layout method based on a differential particle swarm optimization algorithm. The technical problem to be solved by the present invention is achieved through the following technical solutions:

[0005] The present invention provides an FPGA layout method based on a differential particle swarm optimization algorithm, comprising:

[0006] S1: Obtain the network topology connection structure of the logic resources to be laid out and the physical resource information of the FPGA chip, randomly initialize the physical resource blocks on the FPGA chip, obtain the initial particle swarm, and initialize the individual optimal value of each particle and the global optimal value of the particle swarm;

[0007] S2: Use the cost function to evaluate the fitness of each particle in the current particle swarm to obtain the fitness value of each particle;

[0008] S3: According to the fitness value of each particle in the current particle swarm, a predetermined number of particles are selected by roulette to form a hybrid pool, and the particles to be evolved in the hybrid pool are differentially evolved to form a new particle swarm;

[0009] S4: Calculate the fitness values ​​of the particles in the new particle swarm obtained in step S3, and update and store the individual optimal value and the global optimal value;

[0010] S5: using the individual optimal value and the global optimal value, updating the speed and position of each particle in the current particle swarm to obtain a new particle swarm;

[0011] S6: Calculate the fitness values ​​of the particles in the new particle swarm obtained in step S5, and update and store the individual optimal value and the global optimal value;

[0012] S7: Repeat S2 to S6 until the termination condition is reached to obtain the FPGA layout result.

[0013] In one embodiment of the present invention, the S1 includes:

[0014] S1.1: limiting the range of the mapping area of ​​the logic resources according to the model of the FPGA chip, wherein the mapping area includes a plurality of physical resource blocks;

[0015] S1.2: Randomly map each logic instance in the network topology connection structure within the mapping area to obtain an initial position vector of each logic instance, and randomly assign an initial velocity vector to each logic instance;

[0016] S1.3: Initializing the speed and logical instance ID of the physical resource blocks in the mapping area that are not mapped by the logical instance;

[0017] S1.4: Repeat S1.1 to S1.3, perform multiple mappings and initialization assignments on all logic instances, obtain a particle each time, and thus obtain an initial particle swarm with multiple particles, and initialize the individual optimal values ​​of all particles and the global optimal value of the initial particle swarm.

[0018] In one embodiment of the present invention, the cost function is expressed as:

[0019] ,

[0020] in, is the cost function value of the current particle, and the fitness value is the inverse of the cost function value. Cost for line length, W is the line length scaling factor, is the time series cost, expressed as:

[0021] ,

[0022] in, EXP is the power function constant, is the timing margin, is the delay value.

[0023] In one embodiment of the present invention, S3 includes:

[0024] S3.1: According to the fitness value of each particle in the current particle swarm, a predetermined number of particles are selected from the particle swarm by using a roulette wheel method to form a hybridization pool;

[0025] S3.2: using a differential evolution algorithm to sequentially perform differential evolution on the particles to be evolved in the hybridization pool to generate the same number of progeny particles as the particles to be evolved;

[0026] S3.3: Use the generated offspring particles to replace the corresponding particles to be evolved, and form a new particle group together with the remaining particles in the current particle group.

[0027] In one embodiment of the present invention, the S4 includes:

[0028] S4.1: Calculate the fitness value of each particle in the new particle swarm obtained in S3 using the cost function, and compare the fitness value of each particle with the fitness value corresponding to the stored individual optimal value of the current particle. If the calculated fitness value is greater than the fitness value corresponding to the stored individual optimal value, save and update the individual optimal value of the current particle, that is, store the position, speed and fitness value corresponding to the individual optimal value;

[0029] S4.2: Compare the fitness value corresponding to the global optimal value in the current iteration with the fitness values ​​corresponding to the individual optimal values ​​of all particles one by one. If the fitness value corresponding to the individual optimal value of a particle in the current particle swarm is greater than the fitness value corresponding to the global optimal value, save and update the position, speed and fitness value corresponding to the individual optimal value of the particle as the global optimal value.

[0030] In one embodiment of the present invention, the S5 includes:

[0031] S5.1: Using the particle swarm optimization algorithm, the speed of each logical instance in each particle in the current particle swarm is updated. The speed update formula is:

[0032] ,

[0033] in, i is the logical instance ID, Indicates the current particle's i The speed of each logical instance; Indicates the current particle's i The speed of each logical instance; Represents the position vector corresponding to the individual optimal value of the current particle, represents the position vector corresponding to the global optimal value, Represents the position vector of the current particle, w is the weight, c 1, c 2 is the set constant, is a random number position vector between 0 and 1;

[0034] S5.2: Update the position of the current particle using the updated velocity of the current particle. The position update formula is:

[0035] ;

[0036] in, Represents the position vector of the current particle after update;

[0037] S5.3: Repeat steps S5.1 to S5.2 to obtain the updated positions and velocities of all particles in the current particle swarm.

[0038] In one embodiment of the present invention, the step S5.1 further includes:

[0039] If the calculated particle speed exceeds the set speed range, the boundary value of the speed range is used to replace the current speed value.

[0040] In one embodiment of the present invention, the S7 includes:

[0041] S2-S6 are repeatedly executed until the termination condition is reached, the global optimal value of the particle swarm after the final iteration is obtained, and the logic instance layout mode in the particle corresponding to the current global optimal value is used as the final FPGA layout result, wherein the termination condition includes: reaching a set maximum number of iterations, the number of consecutive iterations in which the cost function has not decreased is greater than a set threshold, or the timing margin reaches a set threshold.

[0042] Another aspect of the present invention provides a storage medium storing a computer program for executing the steps of the FPGA layout method based on differential particle swarm optimization algorithm described in any one of the above embodiments.

[0043] Another aspect of the present invention provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the processor calls the computer program in the memory, the steps of the FPGA layout method based on the differential particle swarm optimization algorithm described in any one of the above embodiments are implemented.

[0044] Compared with the prior art, the present invention has the following beneficial effects:

[0045] The present invention proposes an FPGA layout method based on a differential particle swarm optimization algorithm, which combines the advantages of a differential evolution algorithm and a particle swarm optimization algorithm, and can greatly improve the quality of FPGA layout. The particle swarm optimization algorithm has a stronger global search capability. By reasonably adjusting the coefficient of the particle swarm optimization algorithm, the global search capability of the particle swarm optimization algorithm is enhanced, so that the particle swarm optimization algorithm can more easily search for a local optimal solution space group in the global solution space. The differential evolution algorithm has the characteristics of being simple, efficient, and having a fast convergence speed. The present invention combines the differential evolution algorithm with the particle swarm optimization algorithm, and uses the differential evolution algorithm to search in detail for the local optimal solution space group obtained by the particle swarm optimization algorithm, so that the new algorithm after the combination of the two algorithms maintains a higher convergence accuracy while maintaining a faster convergence speed. At the same time, the particle swarm optimization algorithm and the differential evolution algorithm are used alternately for global and local detailed searches, so that the probability of the method of the present invention being able to search for the optimal solution is greatly increased, and the layout quality of the FPGA is greatly improved. In addition, compared with the classic simulated annealing algorithm, the particle swarm optimization algorithm and the differential evolution algorithm have fewer parameters and are simpler, so parameter adjustment is more convenient.

[0046] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 It is a simplified diagram of a logic resource netlist diagram and a physical resource array of an FPGA chip provided by an embodiment of the present invention;

[0048] Figure 2 It is a flow chart of an FPGA layout method based on a differential particle swarm optimization algorithm provided by an embodiment of the present invention;

[0049] Figure 3 It is a schematic diagram of an initialization process of an FPGA chip to be laid out provided by an embodiment of the present invention;

[0050] Figures 4a to 4d is a schematic diagram of multiple particles in a particle group provided by an embodiment of the present invention;

[0051] Figure 5 It is a schematic diagram of processing a location update out-of-bounds situation provided by an embodiment of the present invention;

[0052] Figure 6 It is a schematic diagram of the evolution process of a particle provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0053] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the FPGA layout method based on the differential particle swarm optimization algorithm proposed by the present invention is described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0054] The above and other technical contents, features and effects of the present invention are clearly presented in the following detailed description of the specific implementation modes in conjunction with the accompanying drawings. Through the description of the specific implementation modes, the technical means and effects adopted by the present invention to achieve the predetermined purpose can be more deeply and specifically understood. However, the attached drawings are only for reference and explanation purposes and are not used to limit the technical solutions of the present invention.

[0055] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants are intended to cover non-exclusive inclusion, so that an article or device including a series of elements includes not only those elements, but also other elements that are not explicitly listed. In the absence of more restrictions, the elements defined by the statement "including one..." do not exclude the existence of other identical elements in the article or device including the elements.

[0056] Embodiment 1

[0057] See also Figure 1 , Figure 1 It is a simplified diagram of a logic resource netlist diagram and a physical resource array of an FPGA chip provided by an embodiment of the present invention. Figure 1 The left picture in the figure is an abstract logic resource netlist, and the right picture is a simplified picture of the physical resource array of the FPGA chip. The layout process of the FPGA is to map the abstract logic resources on the left to the physical resources on the right one by one through the optimization algorithm. The logic resource points with digital labels on the left picture can also be called logic instances. The digital labels are logic instance IDs. The figure includes 5 logic instances, and the logic instance IDs are 1, 2, 3, 4, and 5 respectively. As shown in the right figure, the logic instance obtained after one mapping can be regarded as a particle on the FPGA. After mapping, each logic instance is called an atom or gene in the figure, which contains information such as position, speed, and logic instance ID.

[0058] See also Figure 2 , Figure 2: is a flow chart of an FPGA layout method based on a differential particle swarm optimization algorithm provided by an embodiment of the present invention. The FPGA layout method of this embodiment includes:

[0059] S1: Obtain the network topology connection structure of the logic resources to be laid out and the physical resource information of the FPGA chip, randomly initialize the physical resource blocks on the FPGA chip, obtain the initial particle swarm, and initialize the individual optimal value of each particle and the global optimal value of the particle swarm.

[0060] Different FPGA chips have different physical resources. The range of the mapping area is limited according to the model of the FPGA chip. The mapping area includes multiple physical resource blocks. Each physical resource block has a fixed position ( x , y ), together constitute the position set A{( x 1, y 1) .... ...、( x n , y n )}, n is the total number of physical resource blocks owned by the FPGA chip, Indicates the first i The position vector of each physical resource block.

[0061] Each logical instance in the network topology connection structure composed of logical resources is randomly mapped in the mapping area, and an initial velocity vector ( V x , V y ). At this time, each physical resource block has a location information ( x , y )、Speed ​​information( V x , V y ) and the logical instance ID. The speeds of the physical resource blocks that are not assigned initial values, that is, not mapped by the logical instance, are initialized to (0,0), and the logical instance IDs are initialized to -1. The initialized speed range is limited to 1 / 4 of the mapping area size, because too large a speed will make it difficult for the algorithm to converge, and too small a speed will make it difficult to quickly find a better global solution.

[0062] Repeat the above steps to map all logical instances and initialize all physical resource blocks to obtain a unique particle. n The number of particles is nA particle swarm. In practice, the number of particles in the particle swarm can be freely set according to actual needs. In practice, each particle corresponds to a possible layout of logical resources. At the same time, the individual optimal value and the global optimal value of the particles in the particle swarm are initialized to 0 and stored in a dedicated storage space. The individual optimal value of the particle contains three types of information: the fitness value of the particle, the position and speed of all logical instances in the particle. The global optimal value of the particle swarm also contains three types of information: the position, speed and fitness value of the particle corresponding to the global optimal value. In other words, the storage space is used to store the position, speed and fitness value of the particle corresponding to the individual optimal value and the position, speed and fitness value of the particle corresponding to the global optimal value, and is continuously updated in the subsequent iteration process. It should be noted that initializing the individual optimal value and the global optimal value is to initialize the corresponding fitness value to 0, and the position and speed corresponding to all logical instances to 0.

[0063] S2: Use the cost function to evaluate the fitness of each particle in the current particle swarm to obtain the fitness value of each particle.

[0064] The cost function is an objective function. The smaller the cost function value is, the better the particle is. The cost function can comprehensively consider the influence of line length, timing, power consumption, and congestion. The cost function of this embodiment is expressed as:

[0065] ,

[0066] in, Represents the cost function value of the current particle, and the fitness value is the inverse of the cost function value. is the line length cost, is the Manhattan distance between physical resource blocks, which is consistent with the characteristics of FPGA arrays. W is the line length scaling factor, 0≤ W ≤1, when W =1, only the influence of line length is considered. W =0 only considers the timing effect, For timing cost, the delay value and timing margin can be considered comprehensively. The function can be expressed as:

[0067] ,

[0068] in, EXP is the power function constant, is the timing margin, is the delay value, when When it is a negative number, It will be big.

[0069] It should be noted that in other embodiments of the present invention, the cost function may also be in other forms, such as comprehensively considering the influence of line length, timing, power consumption, and congestion to construct the cost function, which will not be repeated here.

[0070] S3: According to the fitness value of each particle in the current particle swarm, a predetermined number of particles are selected by roulette to form a hybrid pool, and the particles to be evolved in the hybrid pool are differentially evolved to form a new particle swarm.

[0071] Specifically, step S3 includes:

[0072] S3.1: According to the fitness value of each particle in the current particle swarm, a predetermined number of particles are selected from the particle swarm by using a roulette wheel method to form a hybridization pool.

[0073] In one embodiment of the present invention, 30% of the particles are selected from the current particle group by roulette to form a hybrid pool. Specifically, the fitness values ​​of all particles in the particle group are summed, and the ratio of the fitness value of each particle to the fitness sum result is used as the probability of each particle being drawn, and the larger the fitness value, the easier it is to be drawn.

[0074] S3.2: Use the differential evolution algorithm to perform differential evolution on the particles to be evolved in the hybridization pool in turn, and generate the same number of offspring particles as the particles to be evolved.

[0075] 30% of the particles are selected from the particle swarm by roulette, and a small amount of particles are hybridized to make the algorithm iteration faster. The roulette method makes the hybridization pool more inclined to store better solutions, and it is easier to search for solutions in a local range. Then the particle swarm performs a global search for solutions. By continuously alternating the global and local details of the solution search in the solution space, the method of the present invention makes it easier to find the optimal solution.

[0076] S3.3: Use the generated offspring particles to replace the corresponding particles to be evolved, and form a new particle group together with the remaining particles in the current particle group.

[0077] Specifically, assume that the number of particles in the particle swarm of this embodiment is 100, and the number of particles in the selected hybridization pool is 30. That is to say, the hybridization pool includes 30 particles to be evolved, and the differential evolution algorithm is used to perform differential hybridization on the 30 particles to be evolved in turn to generate 30 offspring particles. These 30 offspring particles are then reorganized with the remaining 70 particles in the particle swarm to form a new particle swarm including 100 particles. It should be noted that in the actual differential evolution process, the differential hybridization rules used can be specifically set and are not limited here. Each particle to be evolved in the hybridization pool is differentially evolved by a pre-set differential evolution rule to obtain a corresponding offspring particle.

[0078] S4: Calculate the fitness values ​​of the particles in the new particle swarm obtained in step S3, and update and store the individual optimal value and the global optimal value.

[0079] Specifically, step S4 of this embodiment includes:

[0080] S4.1: Calculate the fitness value of each particle in the new particle swarm obtained in S3 using the cost function, and compare the fitness value of each particle with the fitness value corresponding to the stored individual optimal value of the current particle. If the calculated fitness value is greater than the fitness value corresponding to the stored individual optimal value, save and update the individual optimal value of the current particle, that is, store the position, speed and fitness value corresponding to the individual optimal value;

[0081] S4.2: Compare the fitness value corresponding to the global optimal value in the current iteration with the fitness values ​​corresponding to the individual optimal values ​​of all particles one by one. If the fitness value corresponding to the individual optimal value of a particle in the current particle swarm is greater than the fitness value corresponding to the global optimal value, save and update the position, speed and fitness value corresponding to the individual optimal value of a particle as the global optimal value.

[0082] S5: Using the individual optimal value and the global optimal value, the speed and position of each particle in the current particle swarm are updated to obtain a new particle swarm.

[0083] Step S5 of this embodiment includes:

[0084] S5.1: Using the particle swarm optimization algorithm, the speed of each logical instance in each particle in the current particle swarm is updated. The speed update formula is:

[0085] ,

[0086] in, i is the logical instance ID, Indicates the current particle's i The speed of each logical instance; Indicates the current particle's i The speed of each logical instance; Represents the position vector corresponding to the individual optimal value of the current particle, represents the position vector corresponding to the global optimal value, Represents the position vector of the current particle, w is the weight, c 1, c 2 is the set constant, A random position vector between 0 and 1.

[0087] S5.2: Update the position of the current particle using the updated velocity of the current particle. The position update formula is:

[0088] ;

[0089] in, Represents the position vector of the current particle after updating.

[0090] S5.3: Repeat steps S5.1 to S5.2 to obtain the updated positions and velocities of all particles in the current particle swarm, thereby obtaining a new particle swarm.

[0091] S6: Calculate the fitness values ​​of the particles in the new particle swarm obtained in step S5, and update and store the individual optimal value and the global optimal value.

[0092] Specifically, after the speed and position of each particle in the particle swarm are updated, the fitness value of each particle is calculated again according to the updated speed and position using the cost function, and the fitness value of each particle is compared with the fitness value corresponding to the individual optimal value updated and stored in step S4. If the fitness value of the particle is larger, the fitness value corresponding to the particle and the speed and position of all logical instances replace the individual optimal value of the particle updated and stored in step S4. After the individual optimal values ​​of all particles are updated, the fitness values ​​corresponding to the individual optimal values ​​of all particles are compared with the global optimal value updated and stored in step S4. If the fitness value corresponding to the individual optimal value of a particle in the particle swarm is larger, the global optimal value updated and stored in step S4 is replaced, thereby realizing the update of the global optimal value of the particle swarm.

[0093] S7: Repeat S2 to S6 until the termination condition is reached to obtain the FPGA layout result.

[0094] Specifically, after obtaining the updated positions and velocities of all particles in the particle swarm after the current iteration by using step S6, repeat S2 to S6 to continue iterating until the termination condition is reached, and the global optimal value of the particle swarm after the final iteration is obtained, and the logic instance layout mode in the particles corresponding to the current global optimal value is used as the final FPGA layout result, wherein the termination condition includes: reaching the set maximum number of iterations, the number of consecutive iterations in which the cost function has not decreased is greater than the set threshold, or the timing margin reaches the set threshold.

[0095] The embodiment of the present invention proposes an FPGA layout method based on a differential particle swarm optimization algorithm, which combines the advantages of the differential evolution algorithm (DE) and the particle swarm optimization algorithm (PSO), and can greatly improve the layout quality. Compared with the DE algorithm, the PSO algorithm has a stronger global search capability. By reasonably adjusting the coefficients of the PSO algorithm, the global search capability of the PSO algorithm is enhanced, so that the PSO algorithm can more easily search for a local optimal solution space group in the global solution space. The DE algorithm has the characteristics of simplicity, high efficiency, and fast convergence speed. The DE algorithm is combined with the PSO algorithm, and the DE algorithm is used to perform a detailed search for the local optimal solution space group obtained by the PSO algorithm, so that the new algorithm after the combination of the two algorithms maintains a higher convergence accuracy while maintaining a faster convergence speed.

[0096] In order to give full play to the characteristics of the DE algorithm, the FPGA layout method of the present invention randomly extracts 30% of the particles from the particle group updated by the PSO algorithm for differential evolution of the DE algorithm. It is known that the PSO algorithm has found a local optimal solution space group close to the optimal solution in the global solution space. Only using some particles to search for the optimal solution can greatly reduce the amount of calculation and avoid spending too much computing time at the local minimum point, thereby further improving the convergence speed of the algorithm.

[0097] Embodiment 2

[0098] Based on the first embodiment, this embodiment provides a specific example of an FPGA layout method based on a differential particle swarm optimization algorithm. The FPGA layout method of this embodiment specifically includes:

[0099] Step 1: Obtain the network topology connection structure of the logical resources to be laid out and the physical resource information of the FPGA chip, randomly initialize the physical resource blocks on the FPGA chip, obtain the initial particle swarm, and initialize the individual optimal value of each particle and the global optimal value of the particle swarm.

[0100] See also Figure 3 , Figure 3This is a schematic diagram of the initialization process of an FPGA chip to be laid out provided by an embodiment of the present invention. Assume that the logic resource netlist contains 5 nodes (1, 2, 3, 4, 5) and 5 edges a, b, c, d, e, that is, the number of logic instances (logic resource points) is 5. The target FPGA to be laid out is a 6×4 grid array, that is, the size of the mapping area is 6×4, the number of physical resources is 24, and the position vector of the mappable range is (0, 0)~(3, 5). Since the initialization speed range is 1 / 4 of the mapping area size, the speed range is (6 / 4, 4 / 4), specifically (-1.5, -1)~(1.5, 1).

[0101] Initialize the physical resources of the target FPGA to be laid out, initialize the logic instance ID in the logic resource netlist to -1, initialize the speed to (0.0, 0.0), and initialize the position to the row and column value. Then randomly map the logic instance within the mappable range of the FPGA chip, and randomly assign the speed within the above speed range. Each random mapping can obtain a particle. Assuming that this embodiment randomly maps 100 times, a particle group with a total number of 100 particles is initialized.

[0102] For the convenience of calculation and expression, this example only uses the first four particles to calculate the fitness value. Figures 4a to 4d , Figures 4a to 4d is a schematic diagram of the first four particles in a particle swarm provided by an embodiment of the present invention. For ease of calculation, the same logic instance in all particles adopts the same speed. For example, the initial speed vector of the logic instance 1 of particle 1 and the initial speed vector of the logic instance 1 of particle 2 are both (0.2, 0.5). At the same time, the individual optimal values ​​and the global optimal values ​​of the particles in the particle swarm are initialized to 0 and stored in an additional storage space. In this embodiment, the number of individual optimal values ​​is equal to the number of particles, that is, 100 particles have 100 individual optimal values, and the global optimal value is equal to the number of particle swarms, and 1 particle swarm has 1 global optimal value.

[0103] Step 2: Use the cost function to evaluate the fitness of each particle in the current particle swarm and obtain the fitness value of each particle. In the first iteration, the current particle swarm is the initial particle swarm.

[0104] To simplify the description, this embodiment only calculates the cost function based on the line length ( WL - WireLength ), without considering the time sequence, that is, the cost function .like Figure 4a As shown in , according to the routing, the total length of particle 1 is (3+2+3+3+5)=16; Figure 4bAs shown, the total length of particle 2 is (3+2+2+1+2)=10; Figure 4c As shown, the total length of particle 3 is (5+2+3+3+3)=16; Figure 4d As shown, the total line length of particle 4 is (8+5+2+2+5)=22. Therefore, the fitness values ​​of particle 1, particle 2, particle 3 and particle 4 are 1 / 16, 1 / 10, 1 / 16 and 1 / 22 respectively.

[0105] Step 3: According to the fitness value of each particle in the current particle swarm, a predetermined number of particles are selected by roulette to form a hybrid pool, and the particles to be evolved in the hybrid pool are differentially evolved to form a new particle swarm.

[0106] This step adopts the roulette method, sums the fitness values ​​of all particles in the particle swarm, and takes the ratio of the fitness value of each particle to the sum of the fitness values ​​as the probability of each particle being drawn. The larger the fitness value, the easier it is to be drawn. Assume that the number of particles in the particle swarm of this embodiment is 100, and the number of particles in the hybridization pool is 30.

[0107] Subsequently, the differential evolution algorithm is used to perform differential hybridization (differential evolution) on the particles to be evolved in the hybridization pool to generate the same number of offspring particles as the particles to be evolved. Assuming that particles 1 to 4 are all drawn into the hybridization pool, that is, particles 1 to 4 are all particles to be evolved, the specific process of hybridization is as follows:

[0108] Assume that it is particle 4's turn to perform differential evolution. Three particles are randomly selected from the hybrid pool (the hybrid pool has not yet been replaced by the sub-base update). X 1, X 2, X 3. Assumptions X 1 is particle 1, X 2 is particle 2, X 3 is particle 3, and particle 4 should be excluded from the hybridization pool during random sampling.

[0109] Then the position vector of the first logical instance of particle 4 is updated as:

[0110] ,

[0111] in, represents the position vector of the first logical instance of particle 4, F represents the scaling factor, Represents particles X 1 is the position vector of the first logical instance in, Represents particles X The position vector of the first logical instance in 2, Represents particles X 3. The position vector of the first logical instance.

[0112] Preferably, the scaling factor F is 0.5, then substituting the value into the value, we get =(0, 0)+0.5×((1, 0)-(4, 0))=(-1.5, 0). Since the position value must be an integer, it becomes (-2, 0) after rounding. See Figure 5 , Figure 5 FIG. 1 is a schematic diagram of a processing method for a location update out of bounds provided by an embodiment of the present invention. Since there is no (-2,0) in the physical location, that is, an out of bounds condition occurs, the following method is used: Figure 5 The measures shown in the figure adjust the data in column 0 to the right end of column 5 according to the periodic boundary rule, so column 4 is equivalent to column -2, and (-2, 0) is equivalent to the position of (4, 0). The velocity of particle 4 remains the same as before (0.2, 0.5). Finally, the position of the first logical instance of particle 4 is (-2, 0) and the velocity is (0.2, 0.5).

[0113] Similarly, the position vector of the second logical instance of particle 4 becomes:

[0114] ,

[0115] Among them, F=0.5, substituting the value into it, we can get =(2, 1)+0.5×((2, 0)-(2, 1))=(2,0.5), rounded to (2, 1), the velocity remains the value of particle 1 (1.2, -1).

[0116] The position vector of the third logical instance of particle 4 becomes: =(1, 2)+0.5 ((3, 1)-(1, 2))=(2, 2.5), rounded to (2, 3), the speed is (-1, 0.8).

[0117] The position vector of the fourth logical instance of particle 4 becomes: =(4, 2)+0.5 ((2, 2)-(5, 1))=(2.5, 1.5), rounded to (3, 2), and the speed is (1.3, 0.5).

[0118] The position vector of the fifth logical instance of particle 4 becomes: =(2, 3)+0.5 ((1, 2)-(3, 2))=(1, 3), and the speed is (0.7, 0.2).

[0119] Thus, the descendant particles of particle 4 are obtained, and the total line length of the descendant particles becomes (3+2+2+3+6)=16, that is, the fitness value is 1 / 16.

[0120] Similarly, differential evolution is performed on particles 1, 2, and 3 to obtain the offspring particles and corresponding fitness values ​​of particles 1, 2, and 3, respectively. It should be noted that in order to accelerate convergence, the fitness values ​​of particles 1 to 4 are calculated. If the fitness value of this particle increases, the particle is retained and updated. If the fitness value decreases after evolution, the current particle is regressed to its original speed and position. Figure 6 As shown, the fitness value of particle 4 is increased from 1 / 22 to 1 / 18, and the evolution is retained. As shown above, the number of particles in the hybrid pool is 30. After all particles in the hybrid pool have undergone differential evolution, 30 offspring particles G1, G2, G3, ..., ... G30 are obtained. The offspring particles G1 to G30 are used to replace the particles to be evolved X1 to X30 in the hybrid pool.

[0121] Step 4: Calculate the fitness values ​​of the particles in the new particle swarm obtained in step 3, and update and store the individual optimal value and the global optimal value.

[0122] Specifically, the cost function is used to calculate the fitness value of each particle in the new particle swarm, and the fitness value of each particle is compared with the fitness value corresponding to the individual optimal value stored by the current particle. If the fitness value of the current particle is greater than the fitness value corresponding to the stored individual optimal value, the individual optimal value of the current particle is saved and updated, that is, the corresponding position, speed and fitness value are stored. Then, the fitness value corresponding to the global optimal value in the current iteration is compared with the fitness values ​​corresponding to the individual optimal values ​​of all particles one by one. If the fitness value corresponding to the individual optimal value of a particle in the current particle swarm is greater than the fitness value corresponding to the global optimal value, the position, speed and fitness value corresponding to the individual optimal value of the current particle is saved and updated as the global optimal value.

[0123] Step 5: Using the individual optimal value and the global optimal value, update the speed and position of each particle in the current particle swarm to obtain a new particle swarm.

[0124] Specifically, the particle swarm optimization algorithm is first used to update the speed of each logical instance of each particle in the current particle swarm. Assuming that only particle 4 in the hybrid pool has evolved, the evolved particles in the hybrid pool are used to cover and update the population. Then, all particles in the particle swarm are optimized.

[0125] Taking the evolved particle 4 as an example, the optimal value of particle 4 in the first iteration is 1 / 18, and the position is (4,0). The current position is also (4,0). The global optimal value of the particle swarm is 1 / 10, and the position is (1,0). The update formula of particle 4 is:

[0126] ,

[0127] Assuming weight w=1.2, c1=2, c2=1.5, rand()=0.5, then in the first iteration, the velocity of the first logical instance of particle 4 is V 1,2 =1.2×(0.2, 0.5)+2×0.5×((4, 0)-(4, 0))+1.5×0.5×((1, 0)-(4, 0))=(-2.01, 0.6), because the speed exceeds V x If the speed limit is -1.5, then V 1,2 =(-1.5, 0.6), the second iteration value = + V 1,2 =(4, 0)+(-1.5, 0.6)=(2.5, 0.6), after rounding =(3, 1), the velocity of particle 4 becomes (-1.5, 0.6).

[0128] Similarly, the new positions and new velocities of all particles are solved, thereby updating the positions and velocities of all particles.

[0129] Step 6: Calculate the fitness values ​​of the particles in the new particle swarm obtained in step S5, and update and store the individual optimal value and the global optimal value.

[0130] Specifically, after the speed and position of each particle in the particle swarm are updated, the fitness value of each particle is calculated again according to the updated speed and position using the cost function, and the fitness value of each particle is compared with the fitness value corresponding to the individual optimal value updated and stored in step 4. If the fitness value of the particle is larger, the fitness value corresponding to the particle and the speed and position of all logical instances replace the individual optimal value of the particle updated and stored in step 4. After the individual optimal values ​​of all particles are updated, the fitness values ​​corresponding to the individual optimal values ​​of all particles are compared with the global optimal value updated and stored in step S4. If the fitness value corresponding to the individual optimal value of a particle in the particle swarm is larger, the global optimal value updated and stored in step 4 is replaced, thereby realizing the update of the global optimal value of the particle swarm.

[0131] Step 7: Repeat steps 2 to 6 until the termination condition is reached. The logic instance layout method in the particle corresponding to the current global optimal value is used as the final FPGA layout result.

[0132] The present invention proposes an FPGA layout method based on a differential particle swarm optimization algorithm, which combines the advantages of a differential evolution algorithm and a particle swarm optimization algorithm, and can greatly improve the quality of FPGA layout. The particle swarm optimization algorithm has a stronger global search capability. By reasonably adjusting the coefficient of the particle swarm optimization algorithm, the global search capability of the particle swarm optimization algorithm is enhanced, so that the particle swarm optimization algorithm can more easily search for a local optimal solution space group in the global solution space. The differential evolution algorithm has the characteristics of being simple, efficient, and having a fast convergence speed. The present invention combines the differential evolution algorithm with the particle swarm optimization algorithm, and uses the differential evolution algorithm to search in detail for the local optimal solution space group obtained by the particle swarm optimization algorithm, so that the new algorithm after the combination of the two algorithms maintains a higher convergence accuracy while maintaining a faster convergence speed. At the same time, the particle swarm optimization algorithm and the differential evolution algorithm are used alternately for global and local detailed searches, so that the probability of the method of the present invention being able to search for the optimal solution is greatly increased, and the layout quality of the FPGA is greatly improved. In addition, compared with the classic simulated annealing algorithm, the particle swarm optimization algorithm and the differential evolution algorithm have few parameters and are simpler, so parameter adjustment is more convenient.

[0133] Another embodiment of the present invention provides a storage medium, wherein a computer program is stored in the storage medium, and the computer program is used to execute the steps of the FPGA layout method based on the differential particle swarm optimization algorithm described in the above embodiment. Another aspect of the present invention provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, the steps of the FPGA layout method based on the differential particle swarm optimization algorithm described in the above embodiment are implemented. Specifically, the above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including several instructions for enabling an electronic device (which can be a personal computer, a server, or a network device, etc.) or a processor (processor) to execute some steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.

[0134] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the protection scope of the present invention.

Claims

1. A FPGA layout method based on differential particle swarm optimization algorithm, characterized in that: include: S1: Obtain the network topology connection structure of the logic resources to be laid out and the physical resource information of the FPGA chip, randomly initialize the physical resource blocks on the FPGA chip, obtain the initial particle swarm, and initialize the individual optimal value of each particle and the global optimal value of the particle swarm; S2: Use the cost function to evaluate the fitness of each particle in the current particle swarm to obtain the fitness value of each particle; S3: According to the fitness value of each particle in the current particle swarm, a predetermined number of particles are selected by roulette to form a hybrid pool, and the particles to be evolved in the hybrid pool are differentially evolved to form a new particle swarm; S4: Calculate the fitness values ​​of the particles in the new particle swarm obtained in step S3, and update and store the individual optimal value and the global optimal value; S5: using the individual optimal value and the global optimal value, updating the speed and position of each particle in the current particle swarm to obtain a new particle swarm; S6: Calculate the fitness values ​​of the particles in the new particle swarm obtained in step S5, and update and store the individual optimal value and the global optimal value; S7: Repeat S2 to S6 until the termination condition is reached to obtain the FPGA layout result.

2. The FPGA layout method based on differential particle swarm optimization algorithm according to claim 1, characterized in that: The S1 includes: S1.1: limiting the range of the mapping area of ​​the logic resources according to the model of the FPGA chip, wherein the mapping area includes a plurality of physical resource blocks; S1.2: Randomly map each logic instance in the network topology connection structure in the mapping area to obtain an initial position vector of each logic instance, and randomly assign an initial velocity vector to each logic instance; S1.3: Initializing the speed and logical instance ID of the physical resource blocks in the mapping area that are not mapped by the logical instance; S1.4: Repeat S1.1 to S1.3, perform multiple mappings and initialization assignments on all logic instances, obtain a particle each time, and thus obtain an initial particle swarm with multiple particles, and initialize the individual optimal values ​​of all particles and the global optimal value of the initial particle swarm.

3. The FPGA layout method based on differential particle swarm optimization algorithm according to claim 1, characterized in that: The cost function is expressed as: , in, is the cost function value of the current particle, and the fitness value is the inverse of the cost function value. Cost for line length, W is the line length scaling factor, is the time series cost, expressed as: , in, EXP is the power function constant, is the timing margin, is the delay value.

4. The FPGA layout method based on differential particle swarm optimization algorithm according to claim 1, characterized in that: The S3 includes: S3.1: According to the fitness value of each particle in the current particle swarm, a predetermined number of particles are selected from the particle swarm by using a roulette wheel method to form a hybridization pool; S3.2: using a differential evolution algorithm to sequentially perform differential evolution on the particles to be evolved in the hybridization pool to generate the same number of progeny particles as the particles to be evolved; S3.3: Use the generated offspring particles to replace the corresponding particles to be evolved, and form a new particle group together with the remaining particles in the current particle group.

5. The FPGA layout method based on differential particle swarm optimization algorithm according to claim 1, characterized in that: The S4 includes: S4.1: Calculate the fitness value of each particle in the new particle swarm obtained in S3 using the cost function, and compare the fitness value of each particle with the fitness value corresponding to the stored individual optimal value of the current particle. If the calculated fitness value is greater than the fitness value corresponding to the stored individual optimal value, save and update the individual optimal value of the current particle, that is, store the position, speed and fitness value corresponding to the individual optimal value; S4.2: Compare the fitness value corresponding to the global optimal value in the current iteration with the fitness values ​​corresponding to the individual optimal values ​​of all particles one by one. If the fitness value corresponding to the individual optimal value of a particle in the current particle swarm is greater than the fitness value corresponding to the global optimal value, save and update the position, speed and fitness value corresponding to the individual optimal value of the particle as the global optimal value.

6. The FPGA layout method based on differential particle swarm optimization algorithm according to claim 1, characterized in that: The S5 includes: S5.1: Using the particle swarm optimization algorithm, the speed of each logical instance in each particle in the current particle swarm is updated. The speed update formula is: , in, i is the logical instance ID, Indicates the current particle's i The speed of each logical instance; Indicates the current particle's i The speed of each logical instance; Represents the position vector corresponding to the individual optimal value of the current particle, represents the position vector corresponding to the global optimal value, Represents the position vector of the current particle, w is the weight, c 1, c 2 is the set constant, is a random number position vector between 0 and 1; S5.2: Update the position of the current particle using the updated velocity of the current particle. The position update formula is: ; in, Represents the position vector of the current particle after update; S5.3: Repeat steps S5.1 to S5.2 to obtain the updated positions and velocities of all particles in the current particle swarm.

7. The FPGA layout method based on differential particle swarm optimization algorithm according to claim 6, characterized in that: The S5.1 and later also include: If the calculated particle speed exceeds the set speed range, the boundary value of the speed range is used to replace the current speed value.

8. The FPGA layout method based on differential particle swarm optimization algorithm according to claim 1, characterized in that: The S7 includes: S2-S6 are repeatedly executed until the termination condition is reached, the global optimal value of the particle swarm after the final iteration is obtained, and the logic instance layout mode in the particle corresponding to the current global optimal value is used as the final FPGA layout result, wherein the termination condition includes: reaching a set maximum number of iterations, the number of consecutive iterations in which the cost function has not decreased is greater than a set threshold, or the timing margin reaches a set threshold.

9. A storage medium, characterized in that: The storage medium stores a computer program, and the computer program is used to execute the steps of the FPGA layout method based on the differential particle swarm optimization algorithm according to any one of claims 1 to 8.

10. An electronic device, characterized in that: The method comprises a memory and a processor, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, the steps of the FPGA layout method based on the differential particle swarm optimization algorithm described in any one of claims 1 to 8 are implemented.