A method and device for simultaneous packaging layout of field programmable gate arrays
By combining simulated annealing algorithm and iterative optimization technology in FPGA, the mixed boxing and layout process is solved, and the global optimization problem caused by the separation of boxing and layout in traditional technology is improved, and the timing performance of the circuit is improved.
Patent Information
- Application Number
- CN202411067329.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-06
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-08-06
AI Technical Summary
The traditional FPGA boxing and layout stages are carried out separately, resulting in the optimization of the boxing and layout stages that can only be targeted at this stage, and cannot achieve global optimization effects, and cannot reduce the number of CLBs in critical paths, resulting in the inability to meet user requirements.
A method of simultaneous boxing layout of field programmable door arrays is adopted. Through the steps of pre-boxing, initial layout, global layout, configurable logical block CLB packing and detailed layout, combined with simulated annealing algorithm, iterative optimization, dynamic programming, etc. Technology, mix boxing and layout processes, optimize boxing results for improved global performance.
By simultaneously optimizing the packing and layout process, the timing performance of the circuit is improved, making the FPGA boxing results more conducive to global performance optimization and meet the timing requirements of users.
Smart Images

Figure CN118586338B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of field programmable gate arrays (FPGAs) in digital integrated circuits, and in particular to a method for simultaneous packaging and layout of field programmable gate arrays, and a device for simultaneous packaging and layout of field programmable gate arrays. Background Art
[0002] FPGA (Field-Programmable Gate Array) is a general-purpose logic circuit, and is known as one of the three general-purpose signal processing devices along with CPU and DSP. It has the advantages of high flexibility, high parallelism, and low development risk. It has been widely used in industrial control, aerospace, communications, automotive electronics, data centers, intelligent processing and other fields, and occupies an increasing market share.
[0003] The design process of FPGA EDA (Electronic Design Automation) software mainly includes multiple steps such as design input, synthesis, mapping, boxing, layout, routing, timing analysis, bit stream generation, and downloading. The boxing stage is to divide the basic logic unit BLE (Basic Logic Element) in the synthesized netlist into multiple boxes, so that each box can be mapped to a programmable logic block CLB (Configurable LogicBlock) inside the FPGA chip, and at the same time, the resource constraints need to be met to ensure that the logic of this box can be implemented in this CLB unit. The layout stage is to correspond each CLB to the physical coordinate position inside the FPGA chip and meet the constraints and optimization goals, such as area or timing.
[0004] Traditional FPGA binning and unbinning stages are run separately, with the binning stage running first and the layout stage running second. This means that during the layout stage, the binning result is fixed and cannot be changed. The processing objects and optimization strategies of the binning and layout stages are different, resulting in the optimization of the binning and layout stages being only for this stage, and unable to achieve the effect of global optimization. In particular, in the layout stage, since the binning result cannot be modified, the number of CLBs on the critical path cannot be reduced, so that the delay of the critical path cannot be significantly reduced, resulting in the failure to meet the user's timing requirements. Summary of the invention
[0005] In order to overcome the defects of the prior art, the technical problem to be solved by the present invention is to provide a method for simultaneous boxing and layout of a field programmable gate array, which can take into account the optimization results of the layout during the boxing process, so that the results of boxing and layout are more conducive to the optimization of global performance, thereby improving the timing performance of the circuit.
[0006] The technical solution of the present invention is: the method for simultaneous packaging layout of field programmable gate arrays comprises the following steps:
[0007] (1) Prepackaging: Prepackaging the basic unit blocks of the block random access data memory BRAM and the digital signal processor DSP respectively to generate the logic blocks of the BRAM and DSP;
[0008] (2) Initial layout: First, the netlist of the basic logic units BLE, BRAM and DSP is divided into several clusters according to clock domains and modules. Then, the simulated annealing algorithm is used to perform initial layout of these clusters to determine the layout positions of these clusters. Finally, the initial layout position of each logic block is determined based on the layout position of each cluster and the logic blocks it contains.
[0009] (3) Global layout: The global layout adopts an iterative optimization framework. In each iteration, each wire net in the circuit is first traversed, and the analytical layout equations in the x-direction and y-direction are established respectively, and then the layout position of each logic block is solved; then the layout areas of BLE, BRAM and DSP types are expanded respectively, so that the resources of each layout area meet the requirements, and the layout position of each BLE, BRAM and DSP logic block is determined; finally, the macro cells of the carry chain, BRAM and DSP are legalized respectively, so that each macro cell of the carry chain, BRAM and DSP finds a legal layout position. The condition for the end of the iteration is to reach the maximum number of loops N or the line length progress rate is greater than the parameter P;
[0010] (4) Configurable logic block (CLB) packing: Using an iterative optimization framework, in each iteration, first search for BLEs in the surrounding area of each CLB as candidate BLEs for the CLB, then assign BLEs to the priority CLBs based on the principle of high evaluation scores first, and continue the loop until all BLEs are assigned to the CLBs;
[0011] (5) Detailed layout: The shortest path method is used for detailed layout. First, a list of candidate locations is found for each logic block in the critical path. Then, a dynamic programming method is used to determine the specific location of each logic block under the shortest delay.
[0012] The present invention mixes the FPGA packing and layout processes together and executes them simultaneously. By optimizing the layout and packing processes simultaneously, the optimization results of the layout are taken into account in the packing process, which makes the results of the packing and layout more conducive to the optimization of the global performance, thereby improving the timing performance of the circuit.
[0013] A device for simultaneous packaging and layout of field programmable gate arrays is also provided, comprising:
[0014] A prepacking unit configured to prepack basic unit blocks of a block random access data memory BRAM and a digital signal processor DSP respectively to generate logic blocks of the BRAM and the DSP;
[0015] The initial layout unit is configured to first divide the netlist of the basic logic units BLE, BRAM and DSP into several clusters according to the clock domain and module, and then use the simulated annealing algorithm to perform initial layout of these clusters to determine the layout positions of these clusters. Finally, according to the layout position of each cluster and the logic blocks it contains, the initial layout position of each logic block is determined;
[0016] The global layout unit is configured using an iterative optimization framework. In each iteration, each line network in the circuit is first traversed, and analytical layout equations in the x-direction and y-direction are established respectively, and then the layout position of each logic block is solved; then the layout areas of BLE, BRAM and DSP types are expanded respectively, so that the resources of each layout area meet the requirements, and the layout position of each BLE, BRAM and DSP logic block is determined; finally, the macro units of the carry chain, BRAM and DSP are legalized respectively, so that each macro unit of the carry chain, BRAM and DSP finds a legal layout position. The condition for the end of the iteration is to reach the maximum number of cycles N or the line length progress rate is greater than the parameter P;
[0017] The configurable logic block CLB packing unit is configured using an iterative optimization framework. In each iteration, the BLEs in the surrounding locations of each CLB are first searched as candidate BLEs for the CLB. Then, based on the principle of high evaluation scores, the BLEs are assigned to the priority CLBs. The loop continues until all BLEs are assigned to the CLBs.
[0018] The detailed layout unit is configured to use the shortest path method for detailed layout. First, a list of candidate locations is found for each logic block in the critical path, and then a dynamic programming method is used to determine the specific location of each logic block under the shortest delay. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 A flow chart of a method for simultaneous packaging of field programmable gate arrays according to the present invention is shown.
[0020] Figure 2 This is a flow chart of the expansion of cells in the global layout process.
[0021] Figure 3 Schematic diagram of the macro unit legalization process.
[0022] Figure 4 Schematic diagram of the process of packing CLB. DETAILED DESCRIPTION
[0023] like Figure 1 As shown, the method for simultaneous packaging layout of field programmable gate arrays comprises the following steps:
[0024] (1) Prepackaging: Prepackaging the basic unit blocks of the block random access data memory BRAM and the digital signal processor DSP respectively to generate the logic blocks of the BRAM and DSP;
[0025] (2) Initial layout: First, the netlist of the basic logic units BLE, BRAM and DSP is divided into several clusters according to clock domains and modules. Then, the simulated annealing algorithm is used to perform initial layout of these clusters to determine the layout positions of these clusters. Finally, the initial layout position of each logic block is determined based on the layout position of each cluster and the logic blocks it contains.
[0026] (3) Global layout: The global layout adopts an iterative optimization framework. In each iteration, each wire net in the circuit is first traversed, and the analytical layout equations in the x-direction and y-direction are established respectively, and then the layout position of each logic block is solved; then the layout areas of BLE, BRAM and DSP types are expanded respectively, so that the resources of each layout area meet the requirements, and the layout position of each BLE, BRAM and DSP logic block is determined; finally, the macro cells of the carry chain, BRAM and DSP are legalized respectively, so that each macro cell of the carry chain, BRAM and DSP finds a legal layout position. The condition for the end of the iteration is to reach the maximum number of loops N or the line length progress rate is greater than the parameter P;
[0027] (4) Configurable logic block (CLB) packing: Using an iterative optimization framework, in each iteration, first search for BLEs in the surrounding area of each CLB as candidate BLEs for the CLB, then assign BLEs to the priority CLBs based on the principle of high evaluation scores first, and continue the loop until all BLEs are assigned to the CLBs;
[0028] (5) Detailed layout: The shortest path method is used for detailed layout. First, a list of candidate locations is found for each logic block in the critical path. Then, a dynamic programming method is used to determine the specific location of each logic block under the shortest delay.
[0029] The present invention mixes the FPGA packing and layout processes together and executes them simultaneously. By optimizing the layout and packing processes simultaneously, the optimization results of the layout are taken into account in the packing process, which makes the results of the packing and layout more conducive to the optimization of the global performance, thereby improving the timing performance of the circuit.
[0030] Preferably, in the step (1), the storage unit ram_block type logic block is assembled into an M4K or M9K type logic block; the multiplication unit mac_mult and the accumulation output unit mac_out are assembled into a DSP type logic block.
[0031] Preferably, in step (3), unit expansion is adopted. In each iteration of the global layout, the layout areas of BLE, BRAM and DSP types are expanded respectively according to the layout results obtained by solving the analytical equations, so that the resources of each layout area meet the requirements, and the layout position of each BLE, BRAM and DSP logic block is determined.
[0032] Preferably, in step (3), the unit expansion comprises the following sub-steps:
[0033] (3.1) Traverse each position of the chip to obtain all the crowded areas. The method for obtaining the crowded areas is to traverse any coordinate position in the chip from left to right and from bottom to top, and determine whether the number of logic blocks laid out at this position is greater than the number of resources at this position. If so, a crowded area is generated for this position, and the range is expanded to the right and upward by a unit size respectively. During the expansion to the right or upward, if the added coordinate position is still crowded, the newly added coordinate position is merged into the current crowded area; if the added coordinate position is not crowded, the expansion of the current crowded area to the right or upward is stopped;
[0034] (3.2) Expand each congested area and merge them to generate a set of areas S, so that the number of resources in each area in S meets the resource demand in the area. The method of expanding the congested area is to expand the range of a unit size to the left, right, downward, and upward in turn. During the expansion process in the four directions, if another congested area is encountered, the congested area is merged into the current congested area. If the range of the new area after expansion meets the resource demand of the current area, the expansion of the current area is stopped; if not, the expansion continues until the resource demand is met;
[0035] (3.3) Determine whether there are any unprocessed areas in the area set S. If so, execute step (3.4), otherwise exit;
[0036] (3.4) Take the first region R from S;
[0037] (3.5) Determine whether the number of layout logic blocks in region R exceeds 1. If it exceeds 1, execute step (3.6), otherwise go to step (3.3);
[0038] (3.6) For region R, split it into two parts according to the x and y directions respectively, and obtain four new regions;
[0039] (3.7) For the four divided regions, insert the layout logic blocks of region R into the corresponding regions using the linear interpolation method and assign coordinate positions;
[0040] (3.8) Add the four new regions after segmentation to the set S and go to step (3.3).
[0041] Preferably, in step (3), the macro unit legalization includes the following sub-steps:
[0042] (3.9) Rough legalization: First, for each logic block contained in each macro unit, a square range with a side length of d is divided with the current macro unit logic block as the center point; then, within the square range, the coordinate position with the same resource type as the macro unit logic block is found as the candidate position list of the macro unit logic block; next, a bipartite graph is created from each macro unit logic block to the candidate position; finally, the minimum bipartite graph matching method is called to solve the coordinate position of each macro unit logic block;
[0043] (3.10) Macrocell expansion: First, the layout position of each macrocell is calculated based on the layout position of the logic block contained in each macrocell by using the arithmetic mean calculation method, and the macrocells contained in each column of the chip are obtained; then, each column of the chip is traversed to find the leftmost column c in the resource congestion column; then, the number of macrocells n1 that column c needs to diffuse to the left column and the number of macrocells n2 that need to diffuse to the right column are calculated; then, n1 and n2 macrocells are diffused to the left column and the right column respectively; the expansion process continues until there are no more resource congested columns in the chip;
[0044] (3.11) Precise legalization: First, based on the results of macrocell expansion, calculate the list of carry chain macrocells contained in each column of the chip; then, for each column of the chip, assign the optimal Y coordinate to each carry chain macrocell in the column according to the dynamic programming algorithm; finally, based on the coordinates of each carry chain macrocell, set the coordinates of each logic block contained in the macrocell.
[0045] Preferably, the step (4) comprises the following sub-steps:
[0046] (4.1) Traverse the coordinate positions of the basic logic block types of the chip and establish the box CLB corresponding to each coordinate position;
[0047] (4.2) Determine whether there are any CLBs that have not been traversed. If so, execute step (4.3), otherwise go to step (4.6);
[0048] (4.3) Find the first CLB that has not been traversed from the CLB list;
[0049] (4.4) The BLEs within the range of the initial value r with the CLB coordinates as the circle point are selected as its candidate BLEs;
[0050] (4.5) Based on all the candidate BLEs of the CLB, a greedy algorithm is used , also known as the greedy algorithm, means that when solving a problem, it always makes the best choice at the moment. In other words, without considering the overall optimal solution, the algorithm obtains a local optimal solution in a certain sense. ) Get an optimal BLE set for the CLB and go to step (4.2);
[0051] (4.6) Find the set of BLEs selected by multiple CLBs; for each BLE placed in multiple CLBs, determine the CLB to which the BLE belongs based on the principle of the highest evaluation score;
[0052] (4.7) Fix the coordinate position of BLE in each CLB box;
[0053] (4.8) Determine whether there are BLEs that have not been installed in the appropriate CLB. If so, execute step (4.9), otherwise the CLB packing is completed;
[0054] (4.9) Establish analytical equations for BLE lists without fixed positions and solve for the layout coordinate positions;
[0055] (4.10) Update the radius r = r + Δr of the CLB search candidate BLE; mark all CLBs as unvisited and go to step (4.2).
[0056] Those skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a program, and the program can be stored in a computer-readable storage medium. When the program is executed, it includes the steps of the above-mentioned embodiment method, and the storage medium can be: ROM / RAM, disk, CD, memory card, etc. Therefore, corresponding to the method of the present invention, the present invention also includes a device for packaging and layout of field programmable gate arrays at the same time, and the device is usually represented in the form of functional modules corresponding to the steps of the method. The device includes:
[0057] A prepacking unit configured to prepack basic unit blocks of a block random access data memory BRAM and a digital signal processor DSP respectively to generate logic blocks of the BRAM and the DSP;
[0058] The initial layout unit is configured to first divide the netlist of the basic logic units BLE, BRAM and DSP into several clusters according to the clock domain and module, and then use the simulated annealing algorithm to perform initial layout of these clusters to determine the layout positions of these clusters. Finally, according to the layout position of each cluster and the logic blocks it contains, the initial layout position of each logic block is determined;
[0059] The global layout unit is configured using an iterative optimization framework. In each iteration, each line network in the circuit is first traversed, and analytical layout equations in the x-direction and y-direction are established respectively, and then the layout position of each logic block is solved; then the layout areas of BLE, BRAM and DSP types are expanded respectively, so that the resources of each layout area meet the requirements, and the layout position of each BLE, BRAM and DSP logic block is determined; finally, the macro units of the carry chain, BRAM and DSP are legalized respectively, so that each macro unit of the carry chain, BRAM and DSP finds a legal layout position. The condition for the end of the iteration is to reach the maximum number of cycles N or the line length progress rate is greater than the parameter P;
[0060] The configurable logic block CLB packing unit is configured using an iterative optimization framework. In each iteration, the BLEs in the surrounding locations of each CLB are first searched as candidate BLEs for the CLB. Then, based on the principle of high evaluation scores, the BLEs are assigned to the priority CLBs. The loop continues until all BLEs are assigned to the CLBs.
[0061] The detailed layout unit is configured to use the shortest path method for detailed layout. First, a list of candidate locations is found for each logic block in the critical path, and then a dynamic programming method is used to determine the specific location of each logic block under the shortest delay.
[0062] Preferably, in the prepacking unit, the storage unit ram_block type logic blocks are assembled into M4K or M9K type logic blocks; the multiplication unit mac_mult and the accumulation output unit mac_out are assembled into DSP type logic blocks.
[0063] Preferably, in the global layout unit, unit expansion is adopted. In each iteration of the global layout, the layout areas of BLE, BRAM and DSP types are expanded respectively according to the layout results obtained by solving the analytical equations, so that the resources of each layout area meet the requirements, and the layout position of each BLE, BRAM and DSP logic block is determined;
[0064] The unit expansion performs the following steps:
[0065] (3.1) Traverse each position of the chip to obtain all the crowded areas. The method for obtaining the crowded areas is to traverse any coordinate position in the chip from left to right and from bottom to top, and determine whether the number of logic blocks laid out at this position is greater than the number of resources at this position. If so, a crowded area is generated for this position, and the range is expanded to the right and upward by a unit size respectively. During the expansion to the right or upward, if the added coordinate position is still crowded, the newly added coordinate position is merged into the current crowded area; if the added coordinate position is not crowded, the expansion of the current crowded area to the right or upward is stopped;
[0066] (3.2) Expand each congested area and merge them to generate a set of areas S, so that the number of resources in each area in S meets the resource demand in the area. The method of expanding the congested area is to expand the range of a unit size to the left, right, downward, and upward in turn. During the expansion process in the four directions, if another congested area is encountered, the congested area is merged into the current congested area. If the range of the new area after expansion meets the resource demand of the current area, the expansion of the current area is stopped; if not, the expansion continues until the resource demand is met;
[0067] (3.3) Determine whether there are any unprocessed areas in the area set S. If so, execute step (3.4), otherwise exit;
[0068] (3.4) Take the first region R from S;
[0069] (3.5) Determine whether the number of layout logic blocks in region R exceeds 1. If it exceeds 1, execute step (3.6), otherwise go to step (3.3);
[0070] (3.6) For region R, split it into two parts according to the x and y directions respectively, and obtain four new regions;
[0071] (3.7) For the four divided regions, insert the layout logic blocks of region R into the corresponding regions using the linear interpolation method and assign coordinate positions;
[0072] (3.8) Add the four new regions after segmentation to the set S and go to step (3.3);
[0073] The macrocell performs the following steps for legalization:
[0074] (3.9) Rough legalization: First, for each logic block contained in each macro unit, a square range with a side length of d is divided with the current macro unit logic block as the center point; then, within the square range, the coordinate position with the same resource type as the macro unit logic block is found as the candidate position list of the macro unit logic block; next, a bipartite graph is created from each macro unit logic block to the candidate position; finally, the minimum bipartite graph matching method is called to solve the coordinate position of each macro unit logic block;
[0075] (3.10) Macrocell expansion: First, the layout position of each macrocell is calculated based on the layout position of the logic block contained in each macrocell by using the arithmetic mean calculation method, and the macrocells contained in each column of the chip are obtained; then, each column of the chip is traversed to find the leftmost column c in the resource congestion column; then, the number of macrocells n1 that column c needs to diffuse to the left column and the number of macrocells n2 that need to diffuse to the right column are calculated; then, n1 and n2 macrocells are diffused to the left column and the right column respectively; the expansion process continues until there are no more resource congested columns in the chip;
[0076] (3.11) Precise legalization: First, based on the results of macrocell expansion, calculate the list of carry chain macrocells contained in each column of the chip; then, for each column of the chip, assign the optimal Y coordinate to each carry chain macrocell in the column according to the dynamic programming algorithm; finally, based on the coordinates of each carry chain macrocell, set the coordinates of each logic block contained in the macrocell.
[0077] Preferably, the configurable logic block CLB packing unit performs the following steps:
[0078] (4.1) Traverse the coordinate positions of the basic logic block types of the chip and establish the box CLB corresponding to each coordinate position;
[0079] (4.2) Determine whether there are any CLBs that have not been traversed. If so, execute step (4.3), otherwise go to step (4.6);
[0080] (4.3) Find the first CLB that has not been traversed from the CLB list;
[0081] (4.4) The BLEs within the range of the initial value r with the CLB coordinates as the circle point are selected as its candidate BLEs;
[0082] (4.5) Based on all candidate BLEs of the CLB, a greedy method is used to obtain an optimal BLE set for the CLB, and then go to step (4.2);
[0083] (4.6) Find the set of BLEs selected by multiple CLBs; for each BLE placed in multiple CLBs, determine the CLB to which the BLE belongs based on the principle of the highest evaluation score;
[0084] (4.7) Fix the coordinate position of BLE in each CLB box;
[0085] (4.8) Determine whether there are BLEs that have not been installed in the appropriate CLB. If so, execute step (4.9), otherwise the CLB packing is completed;
[0086] (4.9) Establish analytical equations for BLE lists without fixed positions and solve for the layout coordinate positions;
[0087] (4.10) Update the radius r = r + Δr of the CLB search candidate BLE; mark all CLBs as unvisited and go to step (4.2).
[0088] Preferably, in step (4.5), a greedy method is used to obtain an optimal BLE set for a CLB, and the following steps are performed: first, a BLE with the most input signals is selected as the initial unit among all candidate BLEs of the CLB, and loaded into the CLB; traverse each other candidate BLE e, and calculate the attraction attraction(e) between e and the CLB according to the input signal of e and the input signal of the existing BLE units of the CLB; if e is not packed into the CLB in accordance with the constraint rules of the CLB packing, then attraction(e)=0; select a BLE with the largest attraction and attraction(e)>0, and load it into the CLB. Continue the above steps until the CLB is full or there is no BLE that meets the constraint rules.
[0089] Preferably, in the step (4.6), the method for processing BLE installed in multiple CLBs executes the following steps: first, traverse the BLE set of each CLB, and count the CLB set clb(e) into which each BLE e is installed; for each BLE e, if the number in its CLB set clb(e) is greater than 1, traverse each CLB c in clb(e), and calculate the evaluation score score(c) after e is installed in c according to the signal relationship between e and c; select a CLB with the largest evaluation score as the CLB into which e is installed.
[0090] Preferably, in the step (4.9), a method for establishing an analytical equation for solving the layout coordinate position for a BLE list without a fixed position is performed by performing the following steps: for all BLEs that are not loaded into the CLB, firstly establish an X-direction equation, specifically, establish an equation between the BLE weight matrix A, the single-column matrix B of the BLE X-coordinate value, and the fixed value C, the equation is A×B=C; then establish a Y-direction equation, specifically, establish an equation between the BLE weight matrix A, the single-column matrix B of the BLE Y-coordinate value, and the fixed value C, the equation is A×B=C; then use the sparse matrix solution method to solve the coordinate values in the X and Y directions to obtain the coordinate position of each BLE.
[0091] Preferably, the method for detailed layout of the shortest path performs the following steps: first, a candidate position set is found for each node on the critical path; then, a directed hierarchical graph of the critical path nodes is constructed based on the candidate position set of each node on the critical path; finally, based on the directed hierarchical graph, a dynamic programming method is used to search for the shortest path of the critical path and the node coordinates on the shortest path are used to update the layout position of each node on the critical path.
[0092] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Any simple modification, equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention are still within the protection scope of the technical solution of the present invention.
Claims
1. A method for simultaneous packaging and layout of field programmable gate arrays, characterized in that: It includes the following steps: (1) Prepackaging: Prepackaging the basic unit blocks of the block random access data memory BRAM and the digital signal processor DSP respectively to generate the logic blocks of the BRAM and DSP; (2) Initial layout: First, the netlist of the basic logic units BLE, BRAM and DSP is divided into several clusters according to clock domains and modules. Then, the simulated annealing algorithm is used to perform initial layout of these clusters to determine the layout positions of these clusters. Finally, the initial layout position of each logic block is determined based on the layout position of each cluster and the logic blocks it contains. (3) Global layout: The global layout adopts an iterative optimization framework. In each iteration, each wire net in the circuit is first traversed, and the analytical layout equations in the x-direction and y-direction are established respectively, and then the layout position of each logic block is solved; then the layout areas of BLE, BRAM and DSP types are expanded respectively, so that the resources of each layout area meet the requirements, and the layout position of each BLE, BRAM and DSP logic block is determined; finally, the macro cells of the carry chain, BRAM and DSP are legalized respectively, so that each macro cell of the carry chain, BRAM and DSP finds a legal layout position. The condition for the end of the iteration is to reach the maximum number of loops N or the line length progress rate is greater than the parameter P; (4) Configurable logic block (CLB) packing: Using an iterative optimization framework, in each iteration, first search for BLEs in the surrounding area of each CLB as candidate BLEs for the CLB, then assign BLEs to the priority CLBs based on the principle of high evaluation scores first, and continue the loop until all BLEs are assigned to the CLBs; (5) Detailed layout: The shortest path method is used for detailed layout. First, a list of candidate locations is found for each logic block in the critical path. Then, a dynamic programming method is used to determine the specific location of each logic block under the shortest delay.
2. The method for simultaneous packaging and layout of field programmable gate arrays according to claim 1, characterized in that: In the step (1), the logic blocks of the storage unit ram_block type are assembled into the logic blocks of the M4K or M9K type; and the multiplication unit mac_mult and the accumulation output unit mac_out are assembled into the logic blocks of the DSP type.
3. The method for simultaneous packaging and layout of field programmable gate arrays according to claim 1, characterized in that: In the step (3), unit expansion is adopted. In each iteration of the global layout, the layout areas of BLE, BRAM and DSP types are expanded respectively according to the layout results obtained by solving the analytical equations, so that the resources of each layout area meet the requirements, and the layout position of each BLE, BRAM and DSP logic block is determined.
4. The method for simultaneous packaging and layout of field programmable gate arrays according to claim 3, characterized in that: In step (3), the unit expansion includes the following sub-steps: (3.1) Traverse each position of the chip to obtain all the crowded areas. The method for obtaining the crowded areas is to traverse any coordinate position in the chip from left to right and from bottom to top, and determine whether the number of logic blocks laid out at the position is greater than the number of resources at the position. If so, a crowded area is generated for the position, and the range is expanded to the right and upward by a unit size respectively. During the expansion to the right or upward, if the added coordinate position is still crowded, the added coordinate position is merged into the current crowded area; if the added coordinate position is not crowded, the expansion of the current crowded area to the right or upward is stopped; (3.2) Expand each congested area and merge them to generate a set of areas S, so that the number of resources in each area in S meets the resource demand in the area. The method of expanding the congested area is to expand the range of a unit size to the left, right, downward, and upward in turn. During the expansion process in the four directions, if another congested area is encountered, the congested area is merged into the current congested area. If the range of the new area after expansion meets the resource demand of the current area, the expansion of the current area is stopped; if not, the expansion continues until the resource demand is met; (3.3) Determine whether there are any unprocessed areas in the area set S. If so, execute step (3.4), otherwise exit; (3.4) Take the first region R from S; (3.5) Determine whether the number of layout logic blocks in region R exceeds 1. If it exceeds 1, execute step (3.6), otherwise go to step (3.3); (3.6) For region R, split it into two parts according to the x and y directions respectively, and obtain four new regions; (3.7) For the four divided regions, insert the layout logic blocks of region R into the corresponding regions using the linear interpolation method and assign coordinate positions; (3.8) Add the four new regions after segmentation to the set S and go to step (3.3).
5. The method for simultaneous packaging and layout of field programmable gate arrays according to claim 4, characterized in that: In step (3), the macro unit legalization includes the following sub-steps: (3.9) Rough legalization: First, for each logic block contained in each macro unit, a square range with a side length of d is divided with the current macro unit logic block as the center point; then, within the square range, the coordinate position with the same resource type as the macro unit logic block is found as the candidate position list of the macro unit logic block; next, a bipartite graph is created from each macro unit logic block to the candidate position; finally, the minimum bipartite graph matching method is called to solve the coordinate position of each macro unit logic block; (3.10) Macrocell expansion: First, the layout position of each macrocell is calculated based on the layout position of the logic block contained in each macrocell by using the arithmetic mean calculation method, and the macrocells contained in each column of the chip are obtained; then, each column of the chip is traversed to find the leftmost column c in the resource congestion column; then, the number of macrocells n1 that column c needs to diffuse to the left column and the number of macrocells n2 that need to diffuse to the right column are calculated; then, n1 and n2 macrocells are diffused to the left column and the right column respectively; the expansion process continues until there are no more resource congested columns in the chip; (3.11) Precise legalization: First, based on the results of macrocell expansion, calculate the list of carry chain macrocells contained in each column of the chip; then, for each column of the chip, assign the optimal Y coordinate to each carry chain macrocell in the column according to the dynamic programming algorithm; finally, based on the coordinates of each carry chain macrocell, set the coordinates of each logic block contained in the macrocell.
6. The method for simultaneous packaging and layout of field programmable gate arrays according to claim 1, characterized in that: The step (4) comprises the following sub-steps: (4.1) Traverse the coordinate positions of the basic logic block types of the chip and establish the box CLB corresponding to each coordinate position; (4.2) Determine whether there are any CLBs that have not been traversed. If so, execute step (4.3), otherwise go to step (4.6); (4.3) Find the first CLB that has not been traversed from the CLB list; (4.4) The BLEs within the range of the initial value r with the CLB coordinates as the circle point are selected as its candidate BLEs; (4.5) Based on all candidate BLEs of the CLB, a greedy method is used to obtain an optimal BLE set for the CLB, and then go to step (4.2); (4.6) Find the set of BLEs selected by multiple CLBs; for each BLE placed in multiple CLBs, determine the CLB to which the BLE belongs based on the principle of the highest evaluation score; (4.7) Fix the coordinate position of BLE in each CLB box; (4.8) Determine whether there are BLEs that have not been installed in the appropriate CLB. If so, execute step (4.9), otherwise the CLB packing is completed; (4.9) Establish analytical equations for BLE lists without fixed positions and solve for the layout coordinate positions; (4.10) Update the radius r = r + Δr of the CLB search candidate BLE; mark all CLBs as unvisited and go to step (4.2).
7. A device for simultaneous packaging and layout of field programmable gate arrays, characterized in that: It includes: A prepacking unit configured to prepack basic unit blocks of a block random access data memory BRAM and a digital signal processor DSP respectively to generate logic blocks of the BRAM and the DSP; The initial layout unit is configured to first divide the netlist of the basic logic units BLE, BRAM and DSP into several clusters according to the clock domain and module, and then use the simulated annealing algorithm to perform initial layout of these clusters to determine the layout positions of these clusters. Finally, according to the layout position of each cluster and the logic blocks it contains, the initial layout position of each logic block is determined; The global layout unit is configured using an iterative optimization framework. In each iteration, each line network in the circuit is first traversed, and analytical layout equations in the x-direction and y-direction are established respectively, and then the layout position of each logic block is solved; then the layout areas of BLE, BRAM and DSP types are expanded respectively, so that the resources of each layout area meet the requirements, and the layout position of each BLE, BRAM and DSP logic block is determined; finally, the macro units of the carry chain, BRAM and DSP are legalized respectively, so that each macro unit of the carry chain, BRAM and DSP finds a legal layout position. The condition for the end of the iteration is to reach the maximum number of cycles N or the line length progress rate is greater than the parameter P; The configurable logic block CLB packing unit is configured using an iterative optimization framework. In each iteration, the BLEs in the surrounding locations of each CLB are first searched as candidate BLEs for the CLB. Then, based on the principle of high evaluation scores, the BLEs are assigned to the priority CLBs. The loop continues until all BLEs are assigned to the CLBs. The detailed layout unit is configured to use the shortest path method for detailed layout. First, a list of candidate locations is found for each logic block in the critical path, and then a dynamic programming method is used to determine the specific location of each logic block under the shortest delay.
8. The device for simultaneous packaging and layout of field programmable gate arrays according to claim 7, characterized in that: In the prepacking unit, the storage unit ram_block type logic blocks are assembled into M4K or M9K type logic blocks; the multiplication unit mac_mult and the accumulation output unit mac_out are assembled into DSP type logic blocks.
9. The device for simultaneous packaging and layout of field programmable gate arrays according to claim 7, characterized in that: In the global layout unit, unit expansion is adopted. In each iteration of the global layout, the layout areas of BLE, BRAM and DSP types are expanded respectively according to the layout results obtained by solving the analytical equations, so that the resources of each layout area meet the requirements, and the layout position of each BLE, BRAM and DSP logic block is determined; The unit expansion performs the following steps: (3.1) Traverse each position of the chip to obtain all the crowded areas. The method for obtaining the crowded areas is to traverse any coordinate position in the chip from left to right and from bottom to top, and determine whether the number of logic blocks laid out at the position is greater than the number of resources at the position. If so, a crowded area is generated for the position, and the range is expanded to the right and upward by a unit size respectively. During the expansion to the right or upward, if the added coordinate position is still crowded, the added coordinate position is merged into the current crowded area; if the added coordinate position is not crowded, the expansion of the current crowded area to the right or upward is stopped; (3.2) Expand each congested area and merge them to generate a set of areas S, so that the number of resources in each area in S meets the resource demand in the area. The method of expanding the congested area is to expand the range of a unit size to the left, right, downward, and upward in turn. During the expansion process in the four directions, if another congested area is encountered, the congested area is merged into the current congested area. If the range of the new area after expansion meets the resource demand of the current area, the expansion of the current area is stopped; if not, the expansion continues until the resource demand is met; (3.3) Determine whether there are any unprocessed areas in the area set S. If so, execute step (3.4), otherwise exit; (3.4) Take the first region R from S; (3.5) Determine whether the number of layout logic blocks in region R exceeds 1. If it exceeds 1, execute step (3.6), otherwise go to step (3.3); (3.6) For region R, split it into two parts according to the x and y directions respectively, and obtain four new regions; (3.7) For the four divided regions, insert the layout logic blocks of region R into the corresponding regions using the linear interpolation method and assign coordinate positions; (3.8) Add the four new regions after segmentation to the set S and go to step (3.3); The macrocell performs the following steps for legalization: (3.9) Rough legalization: First, for each logic block contained in each macro unit, a square range with a side length of d is divided with the current macro unit logic block as the center point; then, within the square range, the coordinate position with the same resource type as the macro unit logic block is found as the candidate position list of the macro unit logic block; next, a bipartite graph is created from each macro unit logic block to the candidate position; finally, the minimum bipartite graph matching method is called to solve the coordinate position of each macro unit logic block; (3.10) Macrocell expansion: First, the layout position of each macrocell is calculated based on the layout position of the logic block contained in each macrocell by using the arithmetic mean calculation method, and the macrocells contained in each column of the chip are obtained; then, each column of the chip is traversed to find the leftmost column c in the resource congestion column; then, the number of macrocells n1 that column c needs to diffuse to the left column and the number of macrocells n2 that need to diffuse to the right column are calculated; then, n1 and n2 macrocells are diffused to the left column and the right column respectively; the expansion process continues until there are no more resource congested columns in the chip; (3.11) Precise legalization: First, based on the results of macrocell expansion, calculate the list of carry chain macrocells contained in each column of the chip; then, for each column of the chip, assign the optimal Y coordinate to each carry chain macrocell in the column according to the dynamic programming algorithm; finally, based on the coordinates of each carry chain macrocell, set the coordinates of each logic block contained in the macrocell.
10. The device for simultaneous packaging and layout of field programmable gate arrays according to claim 7, characterized in that: The configurable logic block CLB packing unit performs the following steps: (4.1) Traverse the coordinate positions of the basic logic block types of the chip and establish the box CLB corresponding to each coordinate position; (4.2) Determine whether there are any CLBs that have not been traversed. If so, execute step (4.3), otherwise go to step (4.6); (4.3) Find the first CLB that has not been traversed from the CLB list; (4.4) The BLEs within the range of the initial value r with the CLB coordinates as the circle point are selected as its candidate BLEs; (4.5) Based on all candidate BLEs of the CLB, a greedy method is used to obtain an optimal BLE set for the CLB, and then go to step (4.2); (4.6) Find the set of BLEs selected by multiple CLBs; for each BLE placed in multiple CLBs, determine the CLB to which the BLE belongs based on the principle of the highest evaluation score; (4.7) Fix the coordinate position of BLE in each CLB box; (4.8) Determine whether there are BLEs that have not been installed in the appropriate CLB. If so, execute step (4.9), otherwise the CLB packing is completed; (4.9) Establish analytical equations for BLE lists without fixed positions and solve for the layout coordinate positions; (4.10) Update the radius r = r + Δr of the CLB search candidate BLE; mark all CLBs as unvisited and go to step (4.2).
