FPGA layout crowding prediction method based on DBSCAN clustering algorithm
The DBSCAN clustering algorithm is used to cluster and calculate the congestion degree of the line network of the FPGA chip, which solves the problem of the inability to accurately estimate the resource congestion degree in the existing technology, and achieves more accurate layout planning and improved wiring efficiency.
Patent Information
- Application Number
- CN202411046640.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-01
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2044-08-01
AI Technical Summary
Existing FPGA chips cannot accurately estimate resource congestion during the layout stage, especially after the introduction of long-term resources, which causes the BBox area to expand, affecting the layout congestion estimation results.
The DBSCAN clustering algorithm is used to cluster the starting point and end point of the line network, divide the local boundary box, calculate the local and overall hierarchical congestion degree of each physical resource block, and obtain the congestion degree of each physical resource block through superposition and normalization processing. final crowding degree.
It achieves a more accurate estimation of FPGA chip resource congestion, improves the accuracy and efficiency of layout, and avoids the problem of long wiring time or failure.
Smart Images

Figure CN118569177B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of FPGA layout, and in particular relates to an FPGA layout congestion prediction method based on a DBSCAN clustering 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 communication, 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 posed a great challenge to related EDA (Electronic Design Automation) tools. In the design process of FPGA, layout and routing are two very important steps. At the same time, the rationality of layout greatly affects the success of routing. Line length and timing are very important issues in layout. The shorter the line length, the shorter the time required for signal transmission, and the better the timing. Therefore, layout is to optimize the layout results iteratively with line length and timing as optimization targets. However, the detailed values of line length and timing can only be calculated after routing is completed. Therefore, most scholars will adopt some strategies to estimate line length during layout. However, if only line length and timing are considered, the physical resource blocks (tiles) laid out will be too dense, and the device resources within the tile will compete fiercely for the routing resources between tiles, resulting in problems such as long routing time or even routing failure. Therefore, during layout, the congestion level must be estimated in advance and the distribution of tiles must be reasonably allocated so that the router can quickly lay out the network.
[0003] The current FPGA congestion analysis methods can be divided into three categories. The first is the congestion analysis method based on the routing probability distribution. The model building process is very simple, so the running speed is very fast and the estimated congestion is relatively accurate. If the estimation accuracy is to be improved, the model building needs to be more in line with the routing strategy. The second is the congestion analysis method based on the global router. This method is more in line with the routing strategy, so the estimation accuracy is very high, but the router needs to be wired in advance, so the running speed is very slow. The third is the congestion analysis method based on machine learning. This method is fast and accurate, but the model building process is relatively complicated, and it has high requirements for sample quality and quantity to obtain satisfactory accuracy. The initial establishment of a machine learning model requires a lot of effort and takes a lot of time to collect samples. At the same time, different models need to be established for different chips, which is time-consuming, and the interpretability of the neural network model is poor.
[0004] In order to meet higher circuit design requirements, the scale of FPGA chips continues to increase, and the device wiring resources are also constantly changing. In terms of wiring resources, many FPGA manufacturers have introduced long-line resources (12, 18 times the line). As far as the BBoxOverlap (boundary box overlap) method is concerned, the introduction of long lines will inevitably lead to a further expansion of the BBox (boundary box) area, especially when the starting point (src) and the end point (dst) of the wiring are very far apart, the BBox will become very large, causing the layout congestion estimation results to deteriorate. In summary, the resource architecture of existing FPGA chips has undergone major changes, and the above-mentioned technology can no longer accurately estimate the resource congestion of existing chips during the layout stage. Summary of the invention
[0005] In order to solve the above problems existing in the prior art, the present invention provides an FPGA layout congestion estimation method based on the DBSCAN clustering algorithm. The technical problem to be solved by the present invention is achieved through the following technical solutions:
[0006] One aspect of the present invention provides an FPGA layout congestion prediction method based on a DBSCAN clustering algorithm, comprising:
[0007] S1: Get the starting and ending points of all the network to be laid out, and initialize the minimum number of neighborhood points and the minimum neighborhood radius of the DBSCAN clustering algorithm and the congestion of all physical resource blocks in the FPGA chip;
[0008] S2: Use the DBSCAN clustering algorithm to cluster the starting point and all end points of the line network to obtain the clustering result of the current line network;
[0009] S3: obtaining a global boundary box of the current network and an overall hierarchical congestion degree of each physical resource block in the global boundary box according to the location information of the starting point and the end point of the current network;
[0010] S4: Divide the local boundary box of each cluster set according to the clustering result of the current network, obtain the local hierarchical congestion of the physical resource block in each local boundary box, and overwrite the overall hierarchical congestion as the final congestion of the physical resource block corresponding to the current network;
[0011] S5: superimpose the final congestion of the physical resource block corresponding to the current network and the historical congestion of the corresponding physical resource block in the previous network on a physical resource block by physical resource block basis, repeat S2-S5 until all networks are traversed, and obtain the preliminary congestion of each physical resource block on the entire FPGA chip;
[0012] S6: normalizing the preliminary congestion to obtain the normalized congestion of each physical resource block, and deleting the low congestion area to obtain the final estimated congestion of each physical resource block.
[0013] In one embodiment of the present invention, the S1 includes:
[0014] S1.1: Get the starting and ending points of all the nets to be laid out;
[0015] S1.2: Count all starting points and end points of all line networks, obtain the average number of points contained in each line network and use the average number of points as the minimum neighborhood point number minpt of the DBSCAN clustering algorithm, initialize the minimum neighborhood radius R of the DBSCAN clustering algorithm, and initialize the congestion of all physical resource blocks in the FPGA chip to 0.
[0016] In one embodiment of the present invention, the S2 includes:
[0017] S2.1: Select an unvisited network from all networks, obtain point information of all points of the current network to form a point set, wherein all points include the starting point and all end points of the current network, and the point information includes coordinate data of all points, and the coordinate data is the coordinate data of the physical resource block to which the starting point or the end point belongs;
[0018] S2.2: Initialize the label values of all points in the current line network to -1;
[0019] S2.3: Select an unvisited point p from the point set, draw a circle with the point p as the center and the minimum neighborhood radius R as the radius to form a neighborhood area, and count the points in the neighborhood area;
[0020] S2.4: Compare the number of points contained in the neighborhood area with the minimum number of neighborhood points minpt. If the number of points contained in the neighborhood area is greater than or equal to the minimum number of neighborhood points minpt, mark the point p as a core point, mark the label value for the point p and execute step S2.5; if the number of points contained in the neighborhood area is less than the minimum number of neighborhood points minpt, mark the point p as a noise point;
[0021] S2.5: adding all points contained in the neighborhood area to the same cluster set as the point p;
[0022] S2.6: taking all remaining points in the neighborhood area as selected points in turn, and repeating S2.3 to S2.5 until no new points are added to the current cluster set;
[0023] S2.7: Select another unvisited point from the point set, and repeat S2.3 to S2.6 until all points in the current network are marked with label values, thereby obtaining a clustering result.
[0024] In one embodiment of the present invention, S3 includes:
[0025] S3.1: Select a point from the point set of the current line network, read the row value and column value of the physical resource block where the current point is located, as the initial maximum horizontal coordinate, initial maximum horizontal coordinate, initial minimum horizontal coordinate, and initial minimum horizontal coordinate of the global bounding box;
[0026] S3.2: re-read the row value and column value of the physical resource block where another point is located from the point set, compare them with the maximum horizontal coordinate, maximum horizontal coordinate, minimum horizontal coordinate and minimum horizontal coordinate of the current global bounding box, and update the maximum horizontal coordinate, maximum horizontal coordinate, minimum horizontal coordinate and minimum horizontal coordinate of the global bounding box according to the comparison result;
[0027] S3.3: Repeat step S3.2 until all points of the current line grid are visited, and obtain the maximum horizontal coordinate, maximum vertical coordinate, minimum horizontal coordinate and minimum vertical coordinate of the global bounding box;
[0028] S3.4: Calculate the line length of the current network using the perimeter of the global boundary box and obtain the overall hierarchical congestion of all physical resource blocks in the global boundary box corresponding to the current network according to the line length of the current network.
[0029] In one embodiment of the present invention, the S3.4 includes:
[0030] The perimeter of the global bounding box is used to calculate the line length of the current line network, and the calculation formula is:
[0031] ,
[0032] Wherein, L represents the line length of the current line network, BB represents the perimeter of the global bounding box, β represents the preset fine-tuning parameter, q represents the impact factor, q The expression is:
[0033] ,
[0034] in, represents the width of the global bounding box, represents the length of the global bounding box, represents the number of points contained in the global bounding box, Indicates taking the maximum value, Indicates taking the minimum value;
[0035] The overall hierarchical congestion of all physical resource blocks in the global boundary box corresponding to the current network is obtained using the line length of the current network. The calculation formula is:
[0036] ,
[0037] Among them, C represents the overall hierarchical crowding, and A represents the area of the global bounding box.
[0038] In one embodiment of the present invention, the S4 includes:
[0039] S4.1: Obtain a cluster set of the same label value in the current network. If the label value is expressed as non-noise, obtain the local bounding box of the current cluster set, calculate the local hierarchical congestion of the current local bounding box, and overwrite the existing overall hierarchical congestion of the physical resource block inside the current local bounding box; if the label value is expressed as noise, assign the congestion of the physical resource block where the corresponding point is located and the physical resource blocks at a predetermined distance around it to 0.4;
[0040] S4.2: Repeat step S4.1 until all points in the network are visited, and obtain the local hierarchical congestion of the physical resource block corresponding to the current network.
[0041] In one embodiment of the present invention, the S6 includes:
[0042] All preliminary congestion degrees on the FPGA chip obtained in step S5 are normalized to obtain the normalized congestion degree of each physical resource block. The normalization formula is:
[0043] ,
[0044] in, represents the normalized congestion of the current physical resource block, and is the adjustment parameter set. is the maximum value of the initial congestion in all physical resource blocks, x represents the initial congestion of the current physical resource block before normalization;
[0045] Compare whether the normalized congestion is greater than the set threshold. If so, retain the normalized congestion of the current physical resource block as the final congestion of the current physical resource block. If not, change the final congestion of the current physical resource block to 0.
[0046] Another aspect of the present invention provides a storage medium storing a computer program for executing the steps of the FPGA layout congestion estimation method based on the DBSCAN clustering algorithm described in any one of the above embodiments.
[0047] 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 congestion estimation method based on the DBSCAN clustering algorithm as described in any one of the above embodiments are implemented.
[0048] Compared with the prior art, the present invention has the following beneficial effects:
[0049] 1. The present invention provides an FPGA layout congestion estimation method based on the DBSCAN clustering algorithm. First, the starting point and the end point in the line network are clustered, and then the local boundary box of each cluster set is divided according to the clustering result of the current line network. The local hierarchical congestion of the physical resource block corresponding to the current line network is obtained according to the local boundary box, so that a more accurate estimated congestion is finally obtained through a more accurate division of the local boundary box.
[0050] 2. Compared with the prior art, the present invention adopts the DBSCAN clustering algorithm to cluster the starting points and end points of the line network first, which helps the congestion prediction method to make more accurate and detailed congestion prediction for the local area and realize accurate prediction of congestion degree.
[0051] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 It is a flow chart of a method for estimating FPGA layout congestion based on a DBSCAN clustering algorithm provided by an embodiment of the present invention;
[0053] Figure 2 is a schematic diagram of a DBSCAN clustering algorithm provided by an embodiment of the present invention;
[0054] Figure 3 It is a schematic diagram of the distribution of the starting point and the end point of a line network on an FPGA physical resource block provided by an embodiment of the present invention;
[0055] Figure 4 is a schematic diagram of label initialization provided by an embodiment of the present invention;
[0056] Figure 5 It is a schematic diagram of obtaining a neighborhood area with point P as the center provided by an embodiment of the present invention;
[0057] Figure 6 is a schematic diagram of a clustering process provided by an embodiment of the present invention;
[0058] Figure 7 is a schematic diagram of a clustering result provided by an embodiment of the present invention;
[0059] Figure 8 is a schematic diagram of a global bounding box obtained according to an embodiment of the present invention;
[0060] Fig. 9 It is a schematic diagram of a local bounding box obtained according to an embodiment of the present invention. DETAILED DESCRIPTION
[0061] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the flowchart of the FPGA layout congestion estimation method based on the DBSCAN clustering algorithm proposed by the present invention is described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0062] 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.
[0063] 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.
[0064] Embodiment 1
[0065] See also Figure 1 , Figure 1 The present invention provides a flowchart of an FPGA layout congestion estimation method based on a DBSCAN clustering algorithm (density-based clustering algorithm). The FPGA layout congestion estimation method includes:
[0066] S1: Get the starting and ending points of all the wire nets to be laid out, and initialize the minimum number of neighborhood points and the minimum neighborhood radius of the DBSCAN clustering algorithm and the congestion of all physical resource blocks in the FPGA chip.
[0067] Specifically, step S1 of this embodiment includes the following steps:
[0068] S1.1: Get the starting and ending points of all the nets to be laid out.
[0069] S1.2: Count all the starting points and end points of all the wire nets, obtain the average number of points contained in each wire net, use the average number of points as the minimum neighborhood point number minpt of the DBSCAN clustering algorithm, initialize the minimum neighborhood radius R of the DBSCAN clustering algorithm, and initialize the congestion of all physical resource blocks in the FPGA chip to 0.
[0070] Usually, each network includes only one starting point and may include one or more end points. For example, assuming that the number of all network is 3, the first network has 1 starting point and 1 end point, the second network has 1 starting point and 3 end points, and the third network has 1 starting point and 4 end points, then the total number of points includes the total number of all starting points and the total number of all end points, which is equal to 3 + (1 + 3 + 4) = 11, 11 / 3 = 3.67. Since the number of points can only be integers, the minimum number of neighborhood points minpt of the DBSCAN clustering algorithm is 4 after rounding.
[0071] Here, we briefly describe the DBSCAN clustering algorithm. The parameters of the DBSCAN clustering algorithm mainly include the minimum number of neighborhood points minpt and the minimum neighborhood radius R. The parameters are adjustable. Assume that the minimum number of neighborhood points minpt is 5. Figure 2 , Figure 2 Schematic diagram of a DBSCAN clustering algorithm provided by an embodiment of the present invention. The minimum neighborhood radius R is Figure 2 The radius of the circle in Figure 2 All the points in are the total sample distribution diagram. At the beginning of the algorithm, the labels of all points are initialized to -1, which means that they have not been traversed, that is, the point has not been clustered.
[0072] In the process of DBSCAN clustering algorithm, all points are traversed first, and a circle is drawn with the current point as the center and the minimum neighborhood radius R as the radius. If the number of points contained in the circle is greater than or equal to the minimum number of neighborhood points minpt, then the current point can be regarded as a core object, such as Figure 2 If the circle contains another core object (another circle can be drawn, containing 5 or more points), it means that the sample points contained in these two circles are density-reachable and can be regarded as the same label class. Similarly, all density-reachable sample sequences are found and marked as the same label set. Figure 2 As shown, the left side is a sample sequence, which is the same label data 1, and the four circles on the right are another sample sequence, which can be marked as another label data 2. The remaining sample points that are not in the circle are regarded as noise points and can be marked as label data -2.
[0073] S2: Use the DBSCAN clustering algorithm to cluster the starting point and all end points of the line network to obtain the clustering result of the current line network.
[0074] Step S2 of this embodiment specifically includes the following steps:
[0075] S2.1: Select an unvisited network from all networks, obtain point information of all points of the current network to form a point set, all points include the starting point and all end points of the current network, the point information includes coordinate data of all points, and the coordinate data is the coordinate data of the physical resource block to which the starting point or end point belongs.
[0076] S2.2: Initialize the label values of all points in the current network, and initialize the label values to -1, indicating that the points have not been visited.
[0077] S2.3: Select an unvisited point p from the point set, draw a circle with point p as the center point and the minimum neighborhood radius R as the radius to form a neighborhood area, and count the points in the neighborhood area. The unvisited points here refer to the points that have not yet completed clustering, that is, the points with a label value of -1.
[0078] S2.4: Compare the number of points contained in the neighborhood area with the minimum number of neighborhood points minpt. If the number of points contained in the neighborhood area is greater than or equal to the minimum number of neighborhood points minpt, point p is marked as a core point, and a label value is marked for point p, for example, marked as 1, and step S2.5 is executed; if the number of points contained in the neighborhood area is less than the minimum number of neighborhood points minpt, the label value of point p is marked as -2, indicating that it is a noise point and is not included in any cluster.
[0079] S2.5: With point p as the center point, all points in the neighborhood area are added to the same cluster set as point p, that is, marked with the same label value as point p. In this embodiment, all are marked as 1.
[0080] S2.6: Take all remaining points in the neighborhood area as center points in turn, and repeat S2.3 to S2.5 until no new points are added to the current cluster set, that is, the label values of all points in the cluster set are 1.
[0081] S2.7: Select another unvisited point from the point set, repeat S2.3 to S2.6 to form another cluster set, until all points in the current network are marked with label values, and the clustering result is obtained.
[0082] It should be noted that when clustering is performed with different unvisited points as center points, different label values are marked for different cluster sets to distinguish different cluster sets.
[0083] S3: According to the position information of the starting point and the end point of the current network, the global boundary box of the current network and the overall hierarchical congestion of each physical resource block in the global boundary box are obtained.
[0084] In this embodiment, step S3 includes:
[0085] S3.1: Select a point from the point set of the current line network (either the starting point or the end point), read the row value and column value of the physical resource block where the point is located, as the maximum horizontal coordinate max_row, the maximum vertical coordinate max_col, the minimum horizontal coordinate min_row and the minimum vertical coordinate min_col of the global boundary box. It can be understood that at this time, the maximum horizontal coordinate max_row and the minimum horizontal coordinate min_row of the global boundary box are equal, both are the row values of the physical resource block where the selected point is located, and the maximum vertical coordinate max_col and the minimum vertical coordinate min_col of the global boundary box are equal, both are the column values of the physical resource block where the selected point is located.
[0086] S3.2: Re-read the row and column values of the physical resource block where another point is located from the point set, and compare them with the maximum horizontal coordinate max_row, maximum vertical coordinate max_col, minimum horizontal coordinate min_row and minimum vertical coordinate min_col of the current global bounding box (that is, those obtained in step S3.1), and update the maximum horizontal coordinate max_row, maximum vertical coordinate max_col, minimum horizontal coordinate min_row and minimum vertical coordinate min_col of the global bounding box according to the comparison results.
[0087] Specifically, read in the row value and column value of the physical resource block where another point is located. If the row value is greater than the current maximum horizontal coordinate max_row of the global bounding box, the row value is used to replace the current maximum horizontal coordinate max_row. If the row value is less than the current minimum horizontal coordinate min_row of the global bounding box, the row value is used to replace the current minimum horizontal coordinate min_row. If the column value is greater than the current maximum vertical coordinate max_col of the global bounding box, the column value is used to replace the current maximum vertical coordinate max_col. If the column value is less than the current minimum vertical coordinate min_col of the global bounding box, the column value is used to replace the current minimum vertical coordinate min_col, thereby updating the maximum horizontal coordinate max_row, the maximum vertical coordinate max_col, the minimum horizontal coordinate min_row and the minimum vertical coordinate min_col of the global bounding box.
[0088] S3.3: Repeat step S3.2 until all points of the current wire mesh are visited, and obtain the maximum horizontal coordinate max_row, the maximum vertical coordinate max_col, the minimum horizontal coordinate min_row and the minimum vertical coordinate min_col of the final global bounding box, thereby obtaining the boundary of the global bounding box of the WLPA (Wirelength Per Area) algorithm.
[0089] S3.4: Calculate the line length of the current network using the perimeter of the global boundary box and obtain the overall hierarchical congestion of all physical resource blocks in the global boundary box corresponding to the current network according to the line length of the current network.
[0090] Specifically, the perimeter line length calculation method is used to calculate the line length of the current line network using the perimeter of the global bounding box. The calculation formula is:
[0091] ,
[0092] Where L represents the length of the current wire mesh, BB represents the perimeter of the global bounding box, and β represents the preset fine-tuning parameter. q represents the impact factor, q The expression is:
[0093] ,
[0094] in, represents the width of the global bounding box, represents the length of the global bounding box, represents the number of points contained in the global bounding box, Indicates taking the maximum value, Indicates taking the minimum value.
[0095] Then, the overall hierarchical congestion of all physical resource blocks in the global boundary box corresponding to the current network is obtained using the line length of the current network. The calculation formula is:
[0096] ,
[0097] Wherein, C represents the overall hierarchical congestion, and A represents the area of the global boundary box. The overall hierarchical congestion is assigned to each physical resource block in the global boundary box, and at this time, the congestion of each physical resource block in the global boundary box is the same.
[0098] S4: Divide the local boundary box of each cluster set according to the clustering result of the current network, obtain the local hierarchical congestion of the physical resource block in each local boundary box, and overwrite the overall hierarchical congestion as the final congestion of the physical resource block corresponding to the current network.
[0099] Step S4 of this embodiment specifically includes:
[0100] S4.1: Obtain a cluster set with the same label value in the current line network. If the label value indicates non-noise, obtain the local boundary box of the current cluster set, find the local hierarchical congestion of the current local boundary box, and overwrite the existing overall hierarchical congestion of the physical resource block inside the current local boundary box; if the label value indicates noise, assign the congestion of the physical resource block where the corresponding point is located and the surrounding physical resource blocks with a distance of 1 to 0.4. In this embodiment, the noise label is -2.
[0101] S4.2: Repeat step S4.1 until all points in the network are visited, so as to obtain the local hierarchical congestion of the physical resource blocks corresponding to the current network. After this step, within the global boundary box corresponding to the current network, the physical resource blocks in each local boundary box have the same local hierarchical congestion, and the physical resource blocks in different local boundary boxes have different local hierarchical congestion.
[0102] It should be noted that, assuming that the routing is done as the shortest path as possible, the routing freedom becomes smaller and smaller when the starting point moves toward a certain end point, so the probability of routing the physical resource blocks around the end point should be greater. However, for the WLPA algorithm, the routing probability inside the boundary box is consistent. At the same time, the calculation of congestion requires the line length L and the boundary box area A. The line length is much smaller than the growth rate of the area. Therefore, the smaller the area, the greater the probability of routing. Therefore, the points of the wire network are clustered and analyzed to plan smaller and more accurate local boundary boxes, and the routing probability is processed by levels, which is more in line with the routing process and can more accurately estimate the routing congestion.
[0103] S5: Superimpose the final congestion of the physical resource block corresponding to the current network with the historical congestion required by the corresponding physical resource block in the previous network, and repeat S2-S5 until all networks are traversed to obtain the preliminary congestion of each physical resource block on the entire FPGA chip.
[0104] Specifically, as shown above, at the time of initialization, all logical resource blocks on the entire FPGA chip store an initial congestion value of 0. One round processes one network, and after traversing one network, a set of congestion is obtained and assigned to the corresponding physical resource block. The congestion obtained at this time is added to all physical resource blocks in the global boundary box corresponding to the current network, and the congestion of the entire FPGA chip is obtained. In the next round, the next network is processed, and another set of congestion is obtained. At this time, based on the previous time, the congestion obtained at this time is added to all physical resource blocks in the global boundary box corresponding to the network, so as to update the congestion of the entire FPGA chip, and so on, until all networks are traversed, and the congestion of all physical resource blocks on the entire FPGA chip is obtained. This congestion is the preliminary congestion, and further processing is required.
[0105] S6: Normalize the preliminary congestion to obtain the normalized congestion of each physical resource block, delete the low congestion area using the set threshold, increase the gradient of the high congestion area and the low congestion area, obtain the final congestion of each physical resource block, and use the final congestion as the cost function of the layout device.
[0106] After clustering by DBSCAN clustering algorithm, each physical resource block on FPGA chip can get a preliminary congestion. However, the preliminary congestion obtained by DBSCAN clustering algorithm needs to be processed, because the preliminary congestion estimate usually obtained has a large range, ranging from 0 to hundreds, and it cannot be directly added to the layout cost function. Therefore, it is necessary to process the preliminary congestion estimate of each physical resource block estimated by DBSCAN clustering algorithm.
[0107] In this embodiment, the activation function of the neural network is used as a data processing method to maximize the cost between the low-congestion area and the high-congestion area, so that the pressure of the high-congestion area can be better dispersed to the surrounding areas.
[0108] Specifically, all the preliminary congestion degrees on the FPGA chip obtained in step S5 are normalized to obtain the normalized congestion degree of each physical resource block. The normalization formula is:
[0109] ,
[0110] in, represents the normalized congestion of the current physical resource block, and is the adjustment parameter set. is the maximum value of the initial congestion in all physical resource blocks, x represents the initial congestion of the current physical resource block before normalization;
[0111] Compare whether the normalized congestion is greater than the set threshold. If so, retain the normalized congestion of the current physical resource block as the final congestion of the current physical resource block. If not, change the final congestion of the current physical resource block to 0.
[0112] Embodiment 2
[0113] Based on the first embodiment, this embodiment provides an example of an FPGA layout crowding estimation method based on the DBSCAN clustering algorithm. Assume that the target FPGA is 10 For a tile array of 10, the number of physical resource blocks is 100. To simplify the calculation process, only one wire network is used for calculation.
[0114] See also Figure 3 , Figure 3 The present invention provides a schematic diagram of the distribution of the starting point and the end point of a line network on an FPGA physical resource block. The line network has a starting point (src) and eight end points (dst).
[0115] The FPGA layout congestion estimation method of this embodiment specifically includes the following steps:
[0116] Step 1: Import the start and end points of all network lines and initialize the parameters.
[0117] Assuming that the number of all wire nets in this embodiment is 100, the total number of points of all wire nets is 178, and the average number of points contained in each wire net is calculated as: 178 / 100=1.78. Since the number of points can only be integers, the minimum number of neighborhood points minpt of the DBSCAN clustering algorithm is 2 after rounding, and the initial minimum neighborhood radius is 2, and the congestion of all physical resource blocks in the FPGA chip is initialized to 0.
[0118] Step 2: Use the DBSCAN clustering algorithm to cluster the starting points and all end points in the selected line network to obtain the clustering results of the current line network.
[0119] In this embodiment, select Figure 3 The line network shown uses the DBSCAN clustering algorithm to cluster all points. The specific steps include:
[0120] Step 2.1: Initialize the label values of all points in the current network to -1, indicating unvisited points, such as Figure 4 shown.
[0121] Step 2.2: Select an unvisited point P from the point set of all the above points. In this embodiment, point (0,9) is selected. A circle is drawn with point P as the center and 2 as the minimum neighborhood radius to obtain the neighborhood area. The points in the neighborhood area are counted, and the count is 1. Since 1 here is less than the minimum number of neighborhood points minpt=2, the point is a noise point and is labeled -2. Figure 5 shown.
[0122] Step 2.3: Reselect point P(5,8), and draw a circle with point (5,8) as the center and 2 as the minimum neighborhood radius. The number of points in the current neighborhood is 3, where 3 is greater than the minimum number of neighborhood points minpt=2. First, label all points in the neighborhood as 1, and then redraw the circle with other points in the neighborhood as core points and search for points in the circle. For example, reselect point P(6,9) in the circle as the center, count the points after drawing the circle, and when the number of points is greater than or equal to minpt, all points in the circle are marked as 1, as they have already been marked here. Then continue to draw circles and cluster with points in label 1 as core points until no new points are found, and obtain a cluster set in which all points are marked as 1, such as Figure 6 shown.
[0123] Step 2.4: Repeat steps 2.2 and 2.3 until all points on the current line network are traversed and all points are clustered and labeled, such as Figure 7 As shown, in this embodiment, all points of the current line network are divided into three cluster sets, and the points in each cluster set have different label data, which are marked as 1, 2, and 3 respectively.
[0124] Step 3: According to the location information of the starting point and the end point of the current network, the WLPA algorithm is used to obtain the overall hierarchical congestion of each physical resource block in the global boundary box.
[0125] Specifically, the position information of the physical resource blocks where all the points of the line network are located is brought in, and the length and width of the global bounding box are obtained to be 9 and 8, and the specific process is referred to step S3.1 to step S3.3 in embodiment 1, which will not be repeated here. The result is as follows Figure 8 shown.
[0126] Using the perimeter line length calculation method, half of the perimeter of the global bounding box is used to calculate the line length of the current line network. The calculation formula is:
[0127] ,
[0128] Where L represents the length of the current wire mesh, BB represents the perimeter of the global bounding box, and β represents the preset fine-tuning parameter. q represents the impact factor, q The expression is:
[0129] ,
[0130] in, represents the width of the global bounding box, represents the length of the global bounding box, represents the number of points contained in the global bounding box, Indicates taking the maximum value, Indicates taking the minimum value.
[0131] Specifically, assuming β = 0.2, q= 8×6=48, L =(8+9)+0.2 48=17+9.6=26.6, so the overall hierarchical congestion C=26.6 / 72=0.37. Therefore, at this time, the congestion of each physical resource block in the global boundary box is the same, which is 0.37.
[0132] Step 4: Divide the local boundary box of each cluster set according to the clustering result of the current network, obtain the local hierarchical congestion of the physical resource block in each local boundary box, and overwrite the overall hierarchical congestion as the final congestion of the physical resource block corresponding to the current network.
[0133] like Fig. 9 As shown in the figure, for the physical resource blocks where the points of the same cluster are located, the local bounding box is first calculated. The solution process is similar to that of the global bounding box. Then, the local hierarchical congestion degree C = (2+2) / (2 2)=1, and then the local hierarchical congestion is used to cover the overall hierarchical congestion corresponding to the physical resource block. For the noise point, the congestion of the surrounding 8 physical resource blocks is all set to a fixed value, for example, 0.4. If the noise point is at the boundary, only the overlapping area with the local boundary box is taken.
[0134] Step 5: Superimpose the final congestion of the physical resource block corresponding to the current network with the historical congestion of the physical resource block required by the previous round of network, and repeat S2-S5 until all networks are traversed to obtain the preliminary congestion of each physical resource block on the entire FPGA chip.
[0135] Specifically, as shown above, at the time of initialization, all logical resource blocks (tiles) on the entire FPGA chip store an initial congestion value of 0. One round processes one network, and after traversing one network, a set of congestion is obtained. The congestion obtained at this time is added to all physical resource blocks in the global boundary box corresponding to the current network, and the congestion of the entire FPGA chip is obtained. In the next round, the next network is processed, and another set of congestion is obtained. At this time, based on the previous time, the congestion obtained at this time is added to all physical resource blocks in the global boundary box corresponding to the network, so as to update the congestion of the entire FPGA chip, and so on, until all networks are traversed, and the congestion of all physical resource blocks on the entire FPGA chip is obtained. This congestion is the preliminary congestion, and further processing is required.
[0136] Step 6: Normalize the preliminary congestion to obtain the normalized congestion of each physical resource block, and use the set threshold to delete the low congestion area, increase the gradient of the high congestion area and the low congestion area, obtain the final congestion of each physical resource block, and use the final congestion as the cost function of the layout device.
[0137] All preliminary congestion degrees on the FPGA chip obtained in step 5 are normalized to obtain the normalized congestion degree of each physical resource block. The normalization formula is:
[0138] ,
[0139] in, and The adjustment parameters set can map the congestion to a reasonable range. maxcong is the maximum value of the initial congestion among all physical resource blocks. Assume that the initial congestion of the physical resource block at position (5,5) calculated in step 5 is 300. maxcong is 500, =2, =0.5, then the normalized congestion of the physical resource block (5,5) is about 0.5498. According to the above calculation process, the normalized congestion of each physical resource block can be obtained.
[0140] Then, it is compared whether the normalized congestion is greater than the set threshold. If so, the normalized congestion of the current physical resource block is retained as the final congestion. If not, the final congestion of the current physical resource block is changed to 0. The threshold set in this embodiment is 0.3, that is, if the calculated normalized congestion of the physical resource block is greater than 0.3, the congestion of the physical resource block is retained. If it is less than 0.3, the congestion is changed to 0 to delete the low congestion area. Finally, the congestion of each physical resource block is obtained as the cost function input of the layout.
[0141] In summary, the present invention provides an FPGA layout congestion prediction method based on the DBSCAN clustering algorithm. First, the starting point and the end point in the line network are clustered and divided. According to the clustering result of the current line network, the local boundary box of each cluster set is divided, and the local hierarchical congestion of the physical resource block corresponding to the current line network is obtained according to the local boundary box, so as to obtain a more accurate estimated congestion by more accurately dividing the boundary box. Compared with the prior art, the DBSCAN clustering algorithm is used to cluster the starting point and the end point of the line network first, which helps the congestion prediction method to make more accurate and detailed congestion predictions for local areas and achieve accurate predictions of congestion.
[0142] 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 crowding prediction method based on the DBSCAN clustering 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 crowding prediction method based on the DBSCAN clustering 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 magnetic disk or an optical disk.
[0143] 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 scope of protection of the present invention.
Claims
1. A method for estimating FPGA layout crowding based on DBSCAN clustering algorithm, characterized in that: include: S1: Get the starting and ending points of all the network to be laid out, and initialize the minimum number of neighborhood points and the minimum neighborhood radius of the DBSCAN clustering algorithm and the congestion of all physical resource blocks in the FPGA chip; S2: Use the DBSCAN clustering algorithm to cluster the starting point and all end points of the line network to obtain the clustering result of the current line network; S3: obtaining a global boundary box of the current network and an overall hierarchical congestion degree of each physical resource block in the global boundary box according to the location information of the starting point and the end point of the current network; S4: Divide the local boundary box of each cluster set according to the clustering result of the current network, obtain the local hierarchical congestion of the physical resource block in each local boundary box, and overwrite the overall hierarchical congestion as the final congestion of the physical resource block corresponding to the current network; S5: superimpose the final congestion of the physical resource block corresponding to the current network and the historical congestion of the corresponding physical resource block in the previous network on a physical resource block by physical resource block basis, repeat S2-S5 until all networks are traversed, and obtain the preliminary congestion of each physical resource block on the entire FPGA chip; S6: normalizing the preliminary congestion to obtain the normalized congestion of each physical resource block, and deleting the low congestion area to obtain the final estimated congestion of each physical resource block.
2. The FPGA layout congestion estimation method based on the DBSCAN clustering algorithm according to claim 1, characterized in that: The S1 includes: S1.1: Get the starting and ending points of all the nets to be laid out; S1.2: Count all starting points and end points of all line networks, obtain the average number of points contained in each line network and use the average number of points as the minimum neighborhood point number minpt of the DBSCAN clustering algorithm, initialize the minimum neighborhood radius R of the DBSCAN clustering algorithm, and initialize the congestion of all physical resource blocks in the FPGA chip to 0.
3. The FPGA layout congestion estimation method based on the DBSCAN clustering algorithm according to claim 1, characterized in that: The S2 includes: S2.1: Select an unvisited network from all networks, obtain point information of all points of the current network to form a point set, wherein all points include the starting point and all end points of the current network, and the point information includes coordinate data of all points, and the coordinate data is the coordinate data of the physical resource block to which the starting point or the end point belongs; S2.2: Initialize the label values of all points in the current line network to -1; S2.3: Select an unvisited point p from the point set, draw a circle with the point p as the center and the minimum neighborhood radius R as the radius to form a neighborhood area, and count the points in the neighborhood area; S2.4: Compare the number of points contained in the neighborhood area with the minimum number of neighborhood points minpt. If the number of points contained in the neighborhood area is greater than or equal to the minimum number of neighborhood points minpt, mark the point p as a core point, mark the label value for the point p and execute step S2.5; if the number of points contained in the neighborhood area is less than the minimum number of neighborhood points minpt, mark the point p as a noise point; S2.5: adding all points contained in the neighborhood area to the same cluster set as the point p; S2.6: taking all remaining points in the neighborhood area as selected points in turn, and repeating S2.3 to S2.5 until no new points are added to the current cluster set; S2.7: Select another unvisited point from the point set, and repeat S2.3 to S2.6 until all points in the current network are marked with label values, thereby obtaining a clustering result.
4. The FPGA layout crowding estimation method based on the DBSCAN clustering algorithm according to claim 3 is characterized in that: The S3 includes: S3.1: Select a point from the point set of the current line network, read the row value and column value of the physical resource block where the current point is located, as the initial maximum horizontal coordinate, initial maximum vertical coordinate, initial minimum horizontal coordinate and initial minimum vertical coordinate of the global bounding box; S3.2: re-read the row value and column value of the physical resource block where another point is located from the point set, compare them with the maximum horizontal coordinate, maximum vertical coordinate, minimum horizontal coordinate and minimum vertical coordinate of the current global bounding box, and update the maximum horizontal coordinate, maximum vertical coordinate, minimum horizontal coordinate and minimum vertical coordinate of the global bounding box according to the comparison result; S3.3: Repeat step S3.2 until all points of the current line grid are visited, and obtain the maximum horizontal coordinate, maximum vertical coordinate, minimum horizontal coordinate and minimum vertical coordinate of the global bounding box; S3.4: Calculate the line length of the current network using the perimeter of the global boundary box and obtain the overall hierarchical congestion of all physical resource blocks in the global boundary box corresponding to the current network according to the line length of the current network.
5. The FPGA layout congestion estimation method based on the DBSCAN clustering algorithm according to claim 4 is characterized in that: The S3.4 includes: The perimeter of the global bounding box is used to calculate the line length of the current line network, and the calculation formula is: , Wherein, L represents the line length of the current line network, BB represents the perimeter of the global bounding box, β represents the preset fine-tuning parameter, q represents the impact factor, q The expression is: , in, represents the width of the global bounding box, represents the length of the global bounding box, represents the number of points contained in the global bounding box, Indicates taking the maximum value, Indicates taking the minimum value; The overall hierarchical congestion of all physical resource blocks in the global boundary box corresponding to the current network is obtained using the line length of the current network. The calculation formula is: , Among them, C represents the overall hierarchical crowding, and A represents the area of the global bounding box.
6. The FPGA layout crowding estimation method based on the DBSCAN clustering algorithm according to claim 1, characterized in that: The S4 includes: S4.1: Obtain a cluster set of the same label value in the current network. If the label value is expressed as non-noise, obtain the local bounding box of the current cluster set, calculate the local hierarchical congestion of the current local bounding box, and overwrite the existing overall hierarchical congestion of the physical resource block inside the current local bounding box; if the label value is expressed as noise, assign the congestion of the physical resource block where the corresponding point is located and the physical resource blocks at a predetermined distance around it to 0.4; S4.2: Repeat step S4.1 until all points in the network are visited, and obtain the local hierarchical congestion of the physical resource block corresponding to the current network.
7. The FPGA layout crowding estimation method based on the DBSCAN clustering algorithm according to claim 1, characterized in that: The S6 includes: All preliminary congestion degrees on the FPGA chip obtained in step S5 are normalized to obtain the normalized congestion degree of each physical resource block. The normalization formula is: , in, represents the normalized congestion of the current physical resource block, and is the adjustment parameter set. is the maximum value of the initial congestion in all physical resource blocks, x represents the initial congestion of the current physical resource block before normalization; Compare whether the normalized congestion is greater than the set threshold. If so, retain the normalized congestion of the current physical resource block as the final congestion of the current physical resource block. If not, change the final congestion of the current physical resource block to 0.
8. A storage medium storing a computer program, characterized in that: The computer program is used to execute the steps of the FPGA layout congestion prediction method based on the DBSCAN clustering algorithm as described in any one of claims 1 to 7.
9. An electronic device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor calls the computer program in the memory, the processor implements the steps of the FPGA layout congestion prediction method based on the DBSCAN clustering algorithm as described in any one of claims 1 to 7.
