Method and device for determining resource utilization rate
By using predictive models in the FPGA development process, including data collection, iterative dichotomizer algorithms, and multiple linear regression modules, resource usage is automatically determined, solving the problem of resource usage being difficult to determine efficiently in FPGA development and improving development efficiency and accuracy. sex.
Patent Information
- Application Number
- CN202410706067.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-31
- Publication Date
- 2024-08-30
AI Technical Summary
During the FPGA development process, existing technology is difficult to efficiently determine resource usage, resulting in increased development time, increased costs, and reduced development efficiency.
A predictive model is used, including a data collection module, an iterative dichotomizer algorithm module and a multiple linear regression module, to generate resource usage through historical design parameters and resource data, and automatically determine the current resource usage through the comparison and optimization module.
It achieves accurate and efficient determination of resource usage, reduces development time and costs, improves development efficiency, and avoids risks caused by repeated adjustments.
Smart Images

Figure CN118569154A
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the computer field, and more specifically, to a method and device for determining resource usage rate. Background Art
[0002] In the traditional FPGA (Field Programmable Gate Array) development process, resource utilization and performance indicators are generally judged based on manual experience. For example, relevant staff write RTL (Register Transfer Level) code based on personal understanding, and then compile and optimize these codes through a series of steps such as synthesis, implementation, and verification to suit a specific FPGA architecture. Since the code must be compiled and optimized again after each adjustment, once the code is adjusted multiple times throughout the process, it will increase development time and cost, lead to uncertainty in the workflow, and reduce predictability. In addition, in related technologies, the code is generally modified in the late stage, which will pay a greater price when the FPGA resources are under-utilized or over-utilized, is time-consuming and prone to errors, thereby reducing the development efficiency of the entire process.
[0003] Therefore, in the related art, during the FPGA development process, there is a technical problem of how to efficiently determine resource utilization.
[0004] Regarding the technical problem of how to efficiently determine resource utilization during FPGA development in related technologies, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present application provide a method and device for determining resource utilization rate, so as to at least solve the technical problem of how to efficiently determine resource utilization rate in the FPGA development process in the related art.
[0006] According to an embodiment of the present application, a method for determining resource utilization is provided, which is applied to an FPGA prototype verification platform, including: inputting current design parameters provided by a target object into a prediction model, and obtaining the current resource utilization output by the prediction model in the following manner: sending current FPGA resource data obtained after the data collection module runs the current design parameters to an iterative bisection algorithm module of the prediction model, so that the iterative bisection algorithm module generates a first resource utilization based on the current design parameters and the current FPGA resource data; and sending the current FPGA resource data to a multiple linear regression module of the prediction model, so that the multiple linear regression module generates a first resource utilization based on the current design parameters. and the current FPGA resource data to generate a second resource utilization rate; sending the first resource utilization rate and the second resource utilization rate to the comparison and optimization module of the prediction model, so that the comparison and optimization module compares the first resource utilization rate and the second resource utilization rate, and determines the current resource utilization rate of the FPGA prototype verification platform according to the comparison result; wherein the prediction model at least includes the data collection module, the iterative bisection algorithm module, the multivariate linear regression module, and the comparison and optimization module, and the prediction model is trained with the historical design parameters provided by the target object as input samples and the historical resource utilization rates corresponding to the historical design parameters as output samples.
[0007] In an exemplary embodiment, before inputting the current design parameters provided by the target object into the prediction model, the method further includes: inputting the historical design parameters into the data collection module; obtaining historical FPGA resource data generated by the data collection module based on the historical design parameters, wherein the historical FPGA resource data includes at least: the number of lookup tables, the usage rate of the lookup tables, the number of registers, the usage rate of the registers, the usage of random access memory, and the usage of the digital signal processor unit.
[0008] In an exemplary embodiment, the current FPGA resource data obtained after the data collection module runs the current design parameters is sent to the iterative binary algorithm module of the prediction model, so that the iterative binary algorithm module generates a first resource utilization rate based on the current design parameters and the current FPGA resource data, including: establishing an iterative binary algorithm model in the iterative binary algorithm module, and obtaining multiple historical resource features corresponding to the historical FPGA resource data; for each of the multiple historical resource features, calculating the conditional entropy of each historical resource feature, performing weighted summation on the data subsets corresponding to each historical resource feature, and obtaining the overall entropy of the multiple historical resource features, wherein each historical resource feature represents a historical design parameter, and the data subset corresponding to each historical resource feature represents the historical resource utilization rate under the one historical design parameter; obtaining information gain according to the difference between the overall entropy and the conditional entropy; comparing multiple information gains, first selecting the first historical resource feature corresponding to the largest information gain as the root node to recursively divide the first data subsets of the first historical resource feature until all the first data subsets belong to the same category; In the case of one category, if it is determined that the historical resource utilization rate of at least one first data subset among all the first data subsets is greater than a first preset threshold, it is determined that the historical resource utilization rate corresponding to the first historical resource feature is unqualified; in the case that all the first data subsets belong to the second category, for the remaining historical resource features except the first historical resource feature among the multiple historical resource features, the second historical resource feature corresponding to the largest information gain is selected from the remaining historical resource features as a leaf node to recursively divide the second data subsets of the second historical resource feature until all the second data subsets belong to the same category; under the condition that all the second data subsets belong to the second category and the historical resource utilization rate corresponding to the second historical resource feature is qualified, if it is determined that the second historical resource feature is consistent with the current resource feature corresponding to the current resource data, the historical resource utilization rate corresponding to the second historical resource feature is determined as the first resource utilization rate; the actual resource utilization rate obtained by monitoring the FPGA prototype verification platform is obtained, the first mean square error between the first resource utilization rate and the actual resource utilization rate is calculated, and the first mean square error and the first resource utilization rate are sent to the comparison and optimization module.
[0009] In an exemplary embodiment, the current FPGA resource data is sent to the multivariate linear regression module of the prediction model so that the multivariate linear regression module generates a second resource utilization rate based on the current design parameters and the current FPGA resource data, including: establishing a multivariate linear equation group based on the historical design parameters and the historical resource utilization rate in the multivariate linear regression module; using the least squares method to calculate all unknown parameters of the multivariate linear equation group to obtain a target multivariate linear equation group; inputting the current design parameters into the target multivariate linear equation group, calculating the predicted resource utilization rate corresponding to the current design parameters, and determining the predicted resource utilization rate as the second resource utilization rate; obtaining the actual resource utilization rate obtained by monitoring the FPGA prototype verification platform, calculating the second mean square error between the second resource utilization rate and the actual resource utilization rate, and sending the second mean square error and the second resource utilization rate to the comparison and optimization module.
[0010] In an exemplary embodiment, the first resource utilization rate and the second resource utilization rate are sent to the comparison and optimization module so that the comparison and optimization module compares the first resource utilization rate and the second resource utilization rate, and determines the current resource utilization rate of the FPGA prototype verification platform according to the comparison result, including: obtaining the difference between the first resource utilization rate and the second resource utilization rate; when it is determined that the difference between the first resource utilization rate and the second resource utilization rate is less than a second preset threshold, determining the current resource utilization rate based on the first resource utilization rate and the second resource utilization rate; wherein, determining the current resource utilization rate based on the first resource utilization rate and the second resource utilization rate includes: when it is determined that the first resource utilization rate is greater than the second resource utilization rate, determining the current resource utilization rate according to the first resource utilization rate; when it is determined that the first resource utilization rate is less than the second resource utilization rate, determining the current resource utilization rate according to the second resource utilization rate.
[0011] In an exemplary embodiment, after obtaining the difference between the first resource utilization rate and the second resource utilization rate, the method further includes: when it is determined that the difference between the first resource utilization rate and the second resource utilization rate is greater than a second preset threshold, comparing the first mean square error and the second mean square error; if it is determined that the first mean square error is less than the second mean square error, optimizing the multivariate linear regression module based on the comparison and optimization module; and using the optimized multivariate linear regression model to recalculate the third resource utilization rate, so that the comparison and optimization module determines the current resource utilization rate based on the first resource utilization rate and the third resource utilization rate.
[0012] In an exemplary embodiment, the method also includes: if the first mean square error is greater than or equal to the second mean square error, optimizing the iterative binary algorithm module based on the comparison and optimization module; using the optimized iterative binary algorithm module to recalculate the fourth resource utilization rate, so that the comparison and optimization module determines the current resource utilization rate based on the fourth resource utilization rate and the second resource utilization rate.
[0013] According to another embodiment of the present application, a device for determining resource utilization is provided, comprising: an acquisition module, used to input the current design parameters provided by the target object into the prediction model, and obtain the current resource utilization output by the prediction model in the following manner: a first generation module, used to send the current FPGA resource data obtained after the data collection module runs the current design parameters to the iterative bisection algorithm module of the prediction model, so that the iterative bisection algorithm module generates a first resource utilization based on the current design parameters and the current FPGA resource data; a second generation module, used to send the current FPGA resource data to the multivariate linear regression module of the prediction model, so that the multivariate linear regression module generates a first resource utilization based on the current design parameters and the current FPGA resource data. The first resource utilization rate and the second resource utilization rate are generated by the previous design parameters and the current FPGA resource data; a determination module is used to send the first resource utilization rate and the second resource utilization rate to the comparison and optimization module, so that the comparison and optimization module compares the first resource utilization rate and the second resource utilization rate, and determines the current resource utilization rate of the FPGA prototype verification platform according to the comparison result; wherein the prediction model at least includes the data collection module, the iterative bisection algorithm module, the multivariate linear regression module, and the comparison and optimization module, and the prediction model is trained by taking the historical design parameters provided by the target object as input samples and the historical resource utilization rates corresponding to the historical design parameters as output samples.
[0014] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.
[0015] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0016] According to another embodiment of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0017] Through this application, after the current design parameters provided by the target object are input into the prediction model, the current FPGA resource data obtained after the current design parameters are run by the data collection module of the prediction model, and then the current FPGA resource data is sent to the iterative bisection algorithm module of the prediction model and the multivariate linear regression module of the prediction model respectively, and the first resource utilization rate is generated based on the current design parameters and the current FPGA resource data by the iterative bisection algorithm module, and the second resource utilization rate is generated based on the current design parameters and the current FPGA resource data by the multivariate linear regression module, and then the first resource utilization rate and the second resource utilization rate are sent to the comparison and optimization module of the prediction model, so that the comparison and optimization module compares the first resource utilization rate and the second resource utilization rate, and determines the current resource utilization rate of the FPGA prototype verification platform according to the comparison result of the comparison, thereby using advanced data collection technology, algorithm analysis technology and optimization technology to realize automatic determination of resource utilization rate, while improving the accuracy and determination efficiency of resource utilization rate, with obvious time advantages and higher reliability. In addition, through algorithm prediction, an accurate understanding of resource usage can be obtained at an early stage, thereby avoiding the cost and risk brought by repeated adjustments. Therefore, the technical problem of how to efficiently determine resource utilization during FPGA development can be solved, thereby achieving the technical effect of efficiently determining resource utilization. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a hardware structure block diagram of a server device according to a method for determining resource utilization rate in an embodiment of the present application;
[0019] Figure 2 is a flow chart of a method for determining resource utilization rate according to an embodiment of the present application;
[0020] Figure 3 is a schematic diagram of obtaining resource utilization rate based on a prediction model according to an embodiment of the present application;
[0021] Figure 4 is a schematic diagram of a process for predicting resource usage based on an iterative binary divider algorithm module according to an embodiment of the present application;
[0022] Figure 5 is a schematic diagram of the operating principle of an iterative binary divider algorithm module according to an embodiment of the present application;
[0023] Figure 6 is a schematic diagram of the operating principle of another iterative binary divider algorithm module according to an embodiment of the present application;
[0024] Figure 7is a schematic diagram of a process for determining resource utilization based on a comparison and optimization module according to an embodiment of the present application;
[0025] Figure 8 It is a structural diagram of a device for determining resource utilization rate according to an embodiment of the present application. DETAILED DESCRIPTION
[0026] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0028] The method embodiments provided in the embodiments of the present application can be executed in a server device or a similar computing device. Taking running on a server device as an example, Figure 1 1 is a hardware structure block diagram of a server device of a method for determining resource utilization rate in an embodiment of the present application. Figure 1 As shown, the server device may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or FPGA) and a memory 104 for storing data, wherein the server device may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above server device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0029] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for determining resource utilization in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the server device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0030] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the server device. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0031] Next, the technologies used in this application are described:
[0032] Vivado: An integrated circuit design tool developed by Xilinx, which is a high-level synthesis (HLS) tool used to develop FPGA (field programmable gate array) and SoC (system on chip) designs. Vivado provides various functions such as design, simulation, synthesis and implementation, enabling technicians to design and develop integrated circuits in a more efficient way.
[0033] FPGA: Field-Programmable Gate Array, refers to a programmable logic device (PLD) that can create and implement digital circuits by configuring feasible connections and logic functions inside the device. Unlike fixed-function integrated circuits, FPGAs can reprogram and adjust their functions and connections to meet different application requirements. FPGAs are composed of programmable logic cells (look-up tables), registers, triggers, and input / output (IO) pins. FPGAs are characterized by flexibility and configurability during the design process. Technicians can use hardware description languages (such as VHDL or Verilog) to describe the required circuit functions, and then use development tools to compile them into configuration files for FPGAs.
[0034] ASIC: Application Specific Integrated Circuit, refers to an integrated circuit designed and manufactured to meet specific user requirements and the needs of specific electronic systems.
[0035] FPGA prototype verification: It is an ASIC verification method based on FPGA. Generally, after the front-end RTL design and RTL simulation stages are completed and before the ASIC is taped out, the various functions of the ASIC are verified as much as possible on the FPGA prototype.
[0036] FPGA prototype verification platform: A computing platform used for FPGA prototype verification, configured with the hardware and software required for verification.
[0037] RTL: Register Transfer Level, in integrated circuit design, abstractly describes the operation of synchronous digital circuits.
[0038] In this embodiment, a method for determining resource utilization is provided. Figure 2 is a flow chart of a method for determining resource utilization rate according to an embodiment of the present application, which is applied to an FPGA prototype verification platform, such as Figure 2 As shown, the process includes the following steps:
[0039] Step S202: input the current design parameters provided by the target object into the prediction model, and obtain the current resource usage rate output by the prediction model in the following manner:
[0040] Step S204, sending the current FPGA resource data obtained after the data collection module runs the current design parameters to the iterative binary algorithm module of the prediction model, so that the iterative binary algorithm module generates a first resource usage rate based on the current design parameters and the current FPGA resource data;
[0041] Step S206, and sending the current FPGA resource data to the multiple linear regression module of the prediction model, so that the multiple linear regression module generates a second resource usage rate based on the current design parameters and the current FPGA resource data;
[0042] Step S208, sending the first resource utilization rate and the second resource utilization rate to the comparison and optimization module of the prediction model, so that the comparison and optimization module compares the first resource utilization rate and the second resource utilization rate, and determines the current resource utilization rate of the FPGA prototype verification platform according to the comparison result;
[0043] Among them, the prediction model at least includes the data collection module, the iterative bisection algorithm module, the multivariate linear regression module, and the comparison and optimization module. The prediction model is trained with the historical design parameters provided by the target object as input samples and the historical resource utilization rate corresponding to the historical design parameters as output samples.
[0044] Through the above steps, after the current design parameters provided by the target object are input into the prediction model, the current FPGA resource data obtained after the current design parameters are run by the data collection module of the prediction model, and then the current FPGA resource data is sent to the iterative bisection algorithm module of the prediction model and the multivariate linear regression module of the prediction model respectively, and the first resource utilization rate is generated based on the current design parameters and the current FPGA resource data by the iterative bisection algorithm module, and the second resource utilization rate is generated based on the current design parameters and the current FPGA resource data by the multivariate linear regression module, and then the first resource utilization rate and the second resource utilization rate are sent to the comparison and optimization module of the prediction model, so that the comparison and optimization module compares the first resource utilization rate and the second resource utilization rate, and determines the current resource utilization rate of the FPGA prototype verification platform according to the comparison result, thereby using advanced data collection technology, algorithm analysis technology and optimization technology to realize automatic determination of resource utilization rate, while improving the accuracy and determination efficiency of resource utilization rate, with obvious time advantages and higher reliability. In addition, through algorithm prediction, an accurate understanding of resource usage can be obtained at an early stage, thereby avoiding the cost and risk caused by repeated adjustments. Therefore, the technical problem of how to efficiently determine resource utilization during FPGA development can be solved, thereby achieving the technical effect of efficiently determining resource utilization.
[0045] Optionally, the execution entity of the above steps may be a server, a computer terminal, etc., but is not limited thereto.
[0046] Optionally, the process of determining the current resource usage rate of the FPGA prototype verification platform according to the comparison result may include: when the first resource usage rate is greater than the second resource usage rate, determining the first resource usage rate as the current resource usage rate, or, when the first resource usage rate is less than the second resource usage rate, determining the second resource usage rate as the current resource usage rate. If it is then determined that the current resource usage rate is greater than or equal to a third preset threshold value (for example, 70%), a bitstream file is generated and downloaded to the FPGA for prototype verification. If the current resource usage rate is less than the third preset threshold value (for example, 70%), the user is prompted that the current resource usage rate is unqualified.
[0047] In an exemplary embodiment, before inputting the current design parameters provided by the target object into the prediction model in step S202, the following steps are further included: step S11, inputting the historical design parameters into the data collection module; step S12, obtaining historical FPGA resource data generated by the data collection module based on the historical design parameters, wherein the historical FPGA resource data includes at least: the number of lookup tables, the usage rate of the lookup tables, the number of registers, the usage rate of the registers, the usage of the random access memory, and the usage of the digital signal processor unit.
[0048] In this embodiment, for example, the data collection module can import the user's design file from the Vivado platform and run synthesis to generate a resource utilization report. The FPGA resource data in the resource utilization report includes: the number of lookup tables, the usage percentage of the lookup tables, the number of registers, the usage percentage of registers, the usage of random access memory, and the usage of digital signal processor units. The usage percentage is the usage rate.
[0049] This embodiment can effectively utilize a large amount of historical data and accurately analyze and predict resource consumption by applying an iterative bisection algorithm and a multivariate linear regression algorithm. Compared with traditional experience-based methods, it can not only utilize historical data and trends to guide the current design solution, but also greatly reduce the uncertainty of the design solution caused by different design concepts of technicians during the design process, and enable technicians to not be limited to the design ideas of solutions that have been implemented, thereby expanding the scope of design ideas.
[0050] It is understandable that when performing resource evaluation on a prototype evaluation resource platform based on FPGA (field programmable gate array), the FPGA resources include:
[0051] 1. Logic Resources:
[0052] LookUp Tables (LUTs LookUp Tables): Basic building blocks for implementing combinational logic that can be configured into various logic functions.
[0053] Registers (FlipFlops / Registers): used to store data and implement sequential logic.
[0054] 2. Programmable Interconnect Resources: The interconnect network inside the FPGA that allows data exchange between logic blocks.
[0055] 3.I / O Resources: Input / output pins used to communicate with the outside world. For example, dedicated I / O blocks such as differential inputs, high-speed serial interfaces, etc.
[0056] 4.Memory Resources:
[0057] Block RAM: used to implement large-capacity memory.
[0058] Distributed RAM: Distributed inside the FPGA, can be used to meet small storage requirements.
[0059] 5. Clock management resources of the Clock Management Units: used for clock distribution and clock domain crossing.
[0060] 6. DSP Slices: Resources specifically used for high-speed mathematical operations, such as multiplication and accumulation.
[0061] 7. Power Management Resources: Power management resources inside the FPGA, such as power controllers and voltage regulators.
[0062] 8. Soft processor resources: microprocessor cores that can be embedded in FPGAs, such as ARM or MIPS cores.
[0063] 9. Specialty Blocks: such as PCIe controller, Ethernet controller and other resources.
[0064] 10. Thermal Design Resources: FPGA thermal management capabilities, including heat dissipation and power optimization resources.
[0065] When evaluating FPGA resources, the availability, efficiency, and performance of the above resources are usually considered to ensure the feasibility and performance requirements of the design. As a key step in the development process, FPGA resource evaluation can help technicians understand how many resources their designs require when implemented on FPGAs, as well as possible performance bottlenecks. This is crucial for design optimization, cost estimation, and project planning.
[0066] In an exemplary embodiment, the process of sending the current FPGA resource data obtained after the data collection module runs the current design parameters to the iterative bisection algorithm module of the prediction model in step S204 so that the iterative bisection algorithm module generates a first resource utilization rate based on the current design parameters and the current FPGA resource data further includes: establishing an iterative bisection algorithm model in the iterative bisection algorithm module to obtain multiple historical resource features corresponding to the historical FPGA resource data; for each of the multiple historical resource features, calculating the conditional entropy of each historical resource feature, performing weighted summation on the data subsets corresponding to each historical resource feature, and obtaining the overall entropy of the multiple historical resource features, wherein each historical resource feature represents a historical design parameter, and the data subset corresponding to each historical resource feature represents the historical resource utilization rate under the one historical design parameter; obtaining information gain according to the difference between the overall entropy and the conditional entropy; comparing multiple information gains, first selecting the first historical resource feature corresponding to the largest information gain as the root node to recursively divide the first data subsets of the first historical resource feature until all first data subsets belong to the same category; In the case where all data subsets belong to the first category, if it is determined that the historical resource utilization rate of at least one first data subset among all the first data subsets is greater than the first preset threshold, it is determined that the historical resource utilization rate corresponding to the first historical resource feature is unqualified; in the case where all the first data subsets belong to the second category, for the remaining historical resource features except the first historical resource feature among the multiple historical resource features, the second historical resource feature corresponding to the largest information gain is selected from the remaining historical resource features as a leaf node to recursively divide the second data subsets of the second historical resource feature until all the second data subsets belong to the same category; under the condition that all the second data subsets belong to the second category and the historical resource utilization rate corresponding to the second historical resource feature is qualified, if it is determined that the second historical resource feature is consistent with the current resource feature corresponding to the current resource data, the historical resource utilization rate corresponding to the second historical resource feature is determined as the first resource utilization rate; the actual resource utilization rate obtained by monitoring the FPGA prototype verification platform is obtained, the first mean square error between the first resource utilization rate and the actual resource utilization rate is calculated, and the first mean square error and the first resource utilization rate are sent to the comparison and optimization module.
[0067] like Figure 6 As shown, the first category indicates, for example, that B01 is high. The second category indicates, for example, that B01 is medium or low. Figure 7As shown, the first category indicates, for example, that A0X is high, and the second category indicates, for example, that A0X is medium or low.
[0068] In this embodiment, in the iterative bipartition algorithm module, based on the operation principle of the iterative binary tree, different FPGA resource data features can be used to predict the comprehensive resource utilization rate of the iterative bipartition (i.e., the first resource utilization rate). Specifically, the optimal branch feature is selected according to the information gain and conditional entropy to form a tree algorithm model that can predict the comprehensive resource utilization rate of the iterative bipartition, and calculate the first mean square error corresponding to the iterative bipartition, and send the first mean square error and the comprehensive resource utilization rate to the comparison and optimization module.
[0069] For iterative algorithms, information gain is generally used to represent the degree of decrease in event impurity. The feature with the largest information gain is used as the root node. Each child node under the root node is further divided according to the size of the information gain. The iteration is repeated until the samples in the node belong to the same category, and the tree growth is stopped. Entropy is used to represent the measure of data impurity. For example, for each data in the data set, the product of the corresponding probability of occurrence and the logarithm of this probability is calculated, and all these products are added and the negative value is taken as entropy. For each feature in the data set, the data set is divided into several subsets according to the different values of the feature, and the entropy of each subset is calculated. The weighted sum is taken by the size of each subset to obtain the overall entropy after the data set is divided according to this feature. Further, referring to the above content, the iterative bipartition algorithm module selects the optimal branch feature according to information gain and conditional entropy to form a tree algorithm model that can perform iterative bipartition comprehensive resource utilization prediction. It can be understood as: using information gain to represent the difference between the original entropy of the data set and the conditional entropy after the feature is divided. Then compare the information gains of all features and select the feature with the largest information gain as the split point; use the selected features to split the data set and repeat the above process for each subset until all instances belong to the same category.
[0070] Then, the iterative binary tree is used to predict the comprehensive resource utilization rate of the iterative bipartitioner according to different FPGA resource data characteristics (such as the above-mentioned historical resource characteristics and current resource characteristics). Starting from the root node, according to the value of the characteristic value, the corresponding branch is selected according to the judgment condition; after entering the next node, according to the judgment condition of the current node and the value of the characteristic value, the corresponding branch is selected to enter the next node; from the root node to the leaf node, the branch selection is carried out according to the value of the characteristic value until the leaf node is reached, and the leaf node corresponds to the prediction result of the comprehensive resource utilization rate of the iterative bipartitioner.
[0071] Finally, the mean square error of the iterative bisection is calculated. For each pair of predicted values and actual values, the difference between them is calculated, each difference is squared, all square differences are summed up, and divided by the total number of predicted values and actual values to obtain the first mean square error corresponding to the iterative bisection.
[0072] Optionally, in one embodiment, when the condition that all the second data subsets belong to the second category and the historical resource utilization rate corresponding to the second historical resource feature is not met, the above process of selecting other historical resource features corresponding to the largest information gain from the remaining historical resource features as leaf nodes to recursively divide other data subsets of the other historical resource features is repeated until the condition that all the second data subsets belong to the second category and the historical resource utilization rate corresponding to the second historical resource feature is met.
[0073] Optionally, all the second data subsets belong to the second category, and the historical resource usage rate corresponding to the second historical resource feature is qualified, such as Figure 6 As shown, B11, B12, etc. of most of the historical samples corresponding to B03 as a child node are no more than 70%.
[0074] In an exemplary embodiment, the implementation scheme for sending the current FPGA resource data to the multivariate linear regression module of the prediction model in step S206 so that the multivariate linear regression module generates a second resource utilization rate based on the current design parameters and the current FPGA resource data further includes: establishing a multivariate linear equation group based on the historical design parameters and the historical resource utilization rate in the multivariate linear regression module; using the least squares method to calculate all unknown parameters of the multivariate linear equation group to obtain a target multivariate linear equation group; inputting the current design parameters into the target multivariate linear equation group, calculating the predicted resource utilization rate corresponding to the current design parameters, and determining the predicted resource utilization rate as the second resource utilization rate; obtaining the actual resource utilization rate obtained by monitoring the FPGA prototype verification platform, calculating the second mean square error between the second resource utilization rate and the actual resource utilization rate, and sending the second mean square error and the second resource utilization rate to the comparison and optimization module.
[0075] In this embodiment, in the multivariate linear regression module, the algorithm model corresponding to the multivariate linear regression algorithm can be used to predict the comprehensive resource utilization rate (i.e., the second resource utilization rate) of the multivariate linear regression of FPGA resources. According to the parameters obtained in the construction process of the algorithm model, a linear equation containing multiple characteristic variables is formed to predict the result, and the multivariate linear regression mean square error of the algorithm model is calculated.
[0076] It can be understood that the mathematical expression of the multivariate linear regression model is Y = β0 + β1X1 + β2X2 + ... + β n X n , where Y is the comprehensive resource utilization rate, X1, X2, ..., X n are the remaining features, representing independent variables, β0, β1, β2, ..., β n are the parameters of the model, representing the intercept and the coefficients of each variable respectively; the least squares method is used to estimate the model parameters, and the model parameters are solved by minimizing the gap between the actual observations and the model predictions. In the process of model construction, the optimal parameter values are found to minimize the sum of squares of the residuals between the model predictions and the actual observations.
[0077] Referring to the above content, the following multiple linear regression equations can be constructed for the multiple linear regression module algorithm model:
[0078]
[0079] By using the least squares method, we can solve all the parameters β in the equations. 11 To β nn , and calculate the mean square error MSE2 between the predicted value and the actual value.
[0080] In an exemplary embodiment, the implementation scheme of sending the first resource utilization rate and the second resource utilization rate to the comparison and optimization module in the above step S208 so that the comparison and optimization module compares the first resource utilization rate and the second resource utilization rate, and determines the current resource utilization rate of the FPGA prototype verification platform according to the comparison result may include the following steps: step S21, obtaining the difference between the first resource utilization rate and the second resource utilization rate; step S22, when it is determined that the difference between the first resource utilization rate and the second resource utilization rate is less than a second preset threshold, determining the current resource utilization rate based on the first resource utilization rate and the second resource utilization rate.
[0081] Among them, the process of determining the current resource usage rate based on the first resource usage rate and the second resource usage rate in step S22 further includes: when it is determined that the first resource usage rate is greater than the second resource usage rate, determining the current resource usage rate according to the first resource usage rate; when it is determined that the first resource usage rate is less than the second resource usage rate, determining the current resource usage rate according to the second resource usage rate.
[0082] Based on the above content, the comparison and optimization module can compare the difference between the comprehensive resource utilization rate of the iterative bisection device and the comprehensive resource utilization rate of the multivariate linear regression. For example, when the difference between the two is less than a second preset threshold (for example, 3%), the one with the larger comprehensive resource utilization rate is determined as the current resource utilization rate, thereby improving the accuracy of the comprehensive resource utilization rate.
[0083] Furthermore, in the above embodiments, for the current design parameters, the iterative bisection algorithm model or the multivariate linear regression model has been optimized and calibrated in the comparison and optimization module, and the difference between the resource utilization rates obtained by these two methods will not exceed the preset threshold. Therefore, in the prediction stage, the predicted values obtained by substituting the current design parameters into the two models respectively can directly take the larger one of the two as the final predicted current resource utilization rate.
[0084] Optionally, in an exemplary embodiment, after obtaining the difference between the first resource utilization rate and the second resource utilization rate, the first mean square error and the second mean square error may be compared when it is determined that the difference between the first resource utilization rate and the second resource utilization rate is greater than a second preset threshold; if it is determined that the first mean square error is less than the second mean square error, the multivariate linear regression module is optimized based on the comparison and optimization module; and the optimized multivariate linear regression model is used to recalculate the third resource utilization rate, so that the comparison and optimization module determines the current resource utilization rate based on the first resource utilization rate and the third resource utilization rate.
[0085] In this embodiment, for the case where the difference between the first resource utilization rate and the second resource utilization rate is greater than a second preset threshold value (such as 3%), the first mean square error corresponding to the iterative bipartitioner and the second mean square error corresponding to the multivariate linear regression model are compared. Specifically: when the first mean square error corresponding to the iterative bipartitioner is smaller than the second mean square error corresponding to the multivariate linear regression model, the multivariate linear regression algorithm is optimized by adding a regularization term to the linear equation to reduce the complexity of the model parameters.
[0086] Regularization refers to the process of constraining and reducing the complexity of model parameters by adding an additional penalty term to the loss function, and determining the optimal value of the regularization coefficient through grid search and cross-validation. In this process, different values of the regularization strength parameter will be traversed, and the performance of the model under different values will be compared. The best parameter value will be selected based on the average cross-validation score. After determining the optimal regularization strength, it will be optimized.
[0087] After the multivariate linear regression module is optimized, the third resource utilization rate and the second mean square error of the multivariate linear regression module are calculated again according to the same algorithm logic, and the current resource utilization rate is re-determined according to the third resource utilization rate and the second mean square error of the multivariate linear regression module and the third resource utilization rate and the second mean square error of the multivariate linear regression model. If the current resource utilization rate is greater than 70%, a bitstream file is generated on Vivado using a comparison unit, and then the bitstream file is downloaded to the FPGA for actual prototype verification. Otherwise, a notification message of unqualified resource utilization is sent to the target object.
[0088] Among them, the process of determining the current resource usage rate based on the first resource usage rate and the third resource usage rate can refer to the process of determining the current resource usage rate based on the first resource usage rate and the second resource usage rate, and this application will not repeat it here.
[0089] Optionally, in an exemplary embodiment, if the first mean square error is greater than or equal to the second mean square error, the iterative binary algorithm module is optimized based on the comparison and optimization module; the fourth resource utilization rate is recalculated using the optimized iterative binary algorithm module, so that the comparison and optimization module determines the current resource utilization rate based on the fourth resource utilization rate and the second resource utilization rate.
[0090] In this embodiment, for the case where the difference between the first resource utilization rate and the second resource utilization rate is greater than a second preset threshold value (such as 3%), the first mean square error corresponding to the iterative bipartitioner and the second mean square error corresponding to the multivariate linear regression model are compared. Specifically: when the first mean square error corresponding to the iterative bipartitioner is greater than or equal to the second mean square error corresponding to the multivariate linear regression model, the iterative bipartitioner algorithm is optimized by using a pruning strategy to reduce the risk of overfitting of the iterative bipartitioner.
[0091] The pruning strategy refers to calculating the change in accuracy before and after pruning for each leaf node. If the accuracy does not drop, prune the leaf node to become the parent node of a leaf node, and predict the node as the category with the highest frequency. Otherwise, determine the accuracy of the next leaf node after pruning; prune upward step by step until the performance of all leaf nodes after pruning results in an accuracy of <90%, where the accuracy is calculated by calculating the number of accurately predicted samples between the label array predicted by the model and the label array of the collected data, and dividing the number of accurately predicted samples by the number of collected data samples multiplied by the percentage.
[0092] After the iterative binary algorithm module completes the optimization process, the fourth resource utilization rate and the first mean square error of the iterative binary are calculated again according to the same algorithm logic, and the current resource utilization rate is re-determined based on the fourth resource utilization rate and the first mean square error of the iterative binary, and the second resource utilization rate and the second mean square error of the multivariate linear regression model. If the current resource utilization rate is greater than 70%, a bitstream file is generated on Vivado using a comparison unit, and then the bitstream file is downloaded to the FPGA for actual prototype verification. Otherwise, a notification message of unqualified resource utilization is sent to the target object.
[0093] Based on the above embodiment, the comparison and optimization module can be further divided into the following according to its function: Figure 3 The comparison unit and the optimization unit shown are two parts. The comparison unit is used to compare the difference between the comprehensive resource utilization rate of the iterative binary divider and the comprehensive resource utilization rate of the multivariate linear regression. When the difference between the two is less than 3%, the larger one is determined as the final prediction result (i.e., the current data utilization rate). Otherwise, the size of the first mean square error corresponding to the iterative binary divider and the second mean square error corresponding to the multivariate linear regression model is compared. Through continuous comparison and optimization, the system can adaptively adjust the algorithm model to reduce the prediction error and ensure the credibility of the result. This means that only when the model reaches a certain accuracy threshold, the system will continue to generate the bit stream, thereby saving time and resources that may be caused by incorrect predictions; secondly, such a system avoids premature or unnecessary prototype verification, reducing the risk of invalid verification and additional expenses.
[0094] Optionally, for the optimization process of the iterative bisection algorithm module or the multivariate linear regression module by the above comparison and optimization module, the stage of optimizing the performance of both can be oriented to the model training scenario using historical design parameters. The present application is not limited to comparing the mean square error only during the training and optimization process.
[0095] Among them, the process of determining the current resource usage rate based on the fourth resource usage rate and the second resource usage rate can refer to the process of determining the current resource usage rate based on the first resource usage rate and the second resource usage rate, and this application will not repeat it here.
[0096] Based on the above embodiments, a method for resource evaluation for an FPGA prototype verification platform can be provided. Through data collection, analysis, and prediction, resource analysis can be accurately and efficiently performed in the early stages of development to solve the pain points in the traditional development process. In this process, on the one hand, invalid prototype verification can be reduced: since the prototype verification process is time-consuming and costly, the optimization decision support in the system can ensure that the FPGA prototype is only verified when the prediction results show high accuracy, thereby reducing the risk and additional overhead of invalid verification. On the other hand, automated prediction is achieved: that is, with accurate prediction models, these models can be reused to automatically perform fast and accurate resource analysis on similar designs. When the model's generalization ability for data is strong enough, accurate results can be predicted with fewer samples. At the same time, time can also be saved. Using historical data to calibrate the model is a low-cost way to improve prediction accuracy, without having to run Vivado every time to obtain a resource utilization report. Further, it is no longer necessary to frequently run Vivado to obtain resource utilization during the development phase, because the model has provided enough information to evaluate the feasibility of the design. Only when the model predicts that the resource usage is higher than the set accuracy threshold (for example, more than 70%), the verification system will continue to generate the bitstream file and perform actual FPGA prototype verification. If the prediction result is less accurate, a failure notification will be issued, so that the design can be optimized at an earlier stage, and then the actual hardware prototype verification will be performed after the model verification. Such a process reduces invalid or redundant operations and improves the efficiency of the entire design and verification process.
[0097] Further, combined with Figure 3 The process of building a prediction model is described, which includes:
[0098] Step 1: The data collection module sends the generated resource utilization report.
[0099] The data collection module imports the design file provided by the user into the Vivado platform and runs the synthesis process to generate a resource utilization report. The resource utilization report includes FPGA resource data such as the number and usage percentage of lookup tables, the number and usage percentage of registers, the usage of random access memory, and the usage of digital signal processor units. The FPGA resource data is then sent to the iterative bisection algorithm module and the multivariate linear regression module.
[0100] Step 2, the iterative bisection algorithm module uses the iterative bisection to predict the result of the FPGA resource data and establish an iterative bisection algorithm model;
[0101] Specifically, Figure 4 The following steps are shown:
[0102] Step S401, collecting data;
[0103] Step S402, calculating information gain;
[0104] Step S403, determining the segmentation point;
[0105] Step S404, dividing into subsets;
[0106] Step S405, determine whether all data points belong to the same category, if so, execute step S406, if not, execute step S402.
[0107] Step S406, the iterative bisection model is constructed;
[0108] Step S407, determining the comprehensive resource usage rate predicted by the iterative binary divider;
[0109] Step S408, calculating the mean square error.
[0110] Through the above steps, the conditional entropy is calculated for each feature, and the weighted sum is taken by the size of each subset to obtain the overall entropy after the data set is divided according to this feature. The information gain is obtained based on the difference between the original entropy of the data set and the conditional entropy after the feature is divided. The information gain of all features is compared, and the feature with the largest information gain is selected as the split point to recursively divide the subsets until all instances belong to the same category. Then, from the root node to the leaf node, branch selection is performed according to the value of the feature until the leaf node is reached. The predicted comprehensive resource utilization rate is obtained and the mean square error is calculated, and the mean square error is sent to the comparison and optimization module.
[0111] At the same time, the multivariate linear regression module uses the multivariate linear regression algorithm to predict the results of FPGA resource data. Specifically, a multivariate linear regression model is constructed, and the least squares method is used to find the optimal parameter value in the multivariate linear regression equation group so that the sum of squares of the residuals between the model prediction value and the actual observation value is minimized. Finally, the predicted comprehensive resource utilization rate is calculated according to the multivariate linear regression equation, and then the mean square error is calculated and sent to the comparison and optimization module.
[0112] Step 3, the comparison unit in the comparison and optimization module receives the comprehensive resource utilization rate and mean square error predicted by the iterative binary algorithm module, and the comprehensive resource utilization rate and mean square error predicted by the multivariate linear regression module, and performs final prediction result determination and optimization processing.
[0113] Specific as Figure 5 The following steps are shown:
[0114] Step S501, calculating the difference between the comprehensive resource utilization rate predicted by the iterative bisection module and the comprehensive resource utilization rate predicted by the multivariate linear regression module;
[0115] Step S502, determine whether the difference between the two is less than 3%; if so, execute step S503, if not, execute step S504;
[0116] Step S503: when the difference between the two is less than 3%, the larger one is determined as the final prediction result;
[0117] Step S504, when the difference between the two is greater than or equal to 3%, compare the first mean square error corresponding to the iterative bisection device and the second mean square error corresponding to the multivariate linear regression model;
[0118] Step S505, determine whether the former is greater than the latter, if so, execute step S506, if not, execute step S507;
[0119] Step S506, regularization optimization of the multivariate linear regression model;
[0120] When it is determined that the first mean square error corresponding to the iterative bisection algorithm is smaller than the second mean square error corresponding to the multivariate linear regression model, it means that the algorithm accuracy of the iterative bisection algorithm module is high, and the optimization unit optimizes the multivariate linear regression algorithm by adding a regularization term on the basis of the linear regression formula;
[0121] Step S507, when the first mean square error corresponding to the iterative bipartitioner is greater than or equal to the second mean square error corresponding to the multivariate linear regression model, it means that the algorithm accuracy of the multivariate linear regression module is high. The optimization unit optimizes the iterative bipartitioner algorithm and uses a pruning strategy to reduce the risk of overfitting and improve the generalization ability of the model.
[0122] Step 4: After the optimization process, continue to re-compare according to the previous logic until the final prediction result (ie, the above-mentioned current resource utilization rate) is determined.
[0123] Step 5: If the final prediction result is greater than 70%, a bitstream file is generated using Vivado and downloaded to the FPGA for actual prototype verification. Otherwise, a notification of unqualified resource utilization is sent.
[0124] The prediction model constructed based on the above steps has the goal of being able to predict the corresponding comprehensive resource utilization based on the design parameters input by the user, rather than directly using the resource utilization report of the design parameters as input to predict the comprehensive resource utilization. The parameters of the new design (such as logical function, resource requirement estimation, target clock frequency, etc.) can be determined in the early stage of the design.
[0125] Exemplarily, based on the above prediction model, the implementation steps of using the current design parameters to predict the resource usage rate may include:
[0126] Step 1, collect data: add new FPGA design parameters into the Vivado platform.
[0127] Import key design parameters of historical design ("B 01 , B 02 , ..., B 0n ″), for example, a total clock frequency of 1600MHz, an interface such as I2C is used to implement operations such as a random number generator, and a resolution for image processing (such as 1920x1080 pixels). Among them, the key design parameters of the above historical design can be understood as the historical resource features used when training the iterative bisection device.
[0128] Import the historical resource usage including the above key design parameters (″B 11 , B 12 , ..., B 1n ″), which can include the usage of different types of FPGA resources such as LUTs, registers, BRAM, DSP, etc.
[0129] Import the key design parameters of the new design ("A 01 , A 02 , ..., A 0n ″).
[0130] When using the prediction model based on the above data, the comprehensive resource utilization rate ("A 11 , A 12 , ..., A 1n ″), taking into account ″B 01 , B 02 , ..., B 0n ″,″B 11 , B 12 , ..., B 1n ″,″A 01 , A 02 , ..., A 0n ″,″A 11 , A 12 , ..., A 1n There may be nonlinear or linear relationships between the data, or linear relationships between individual parameters. Therefore, the iterative dichotomizer model is introduced, which is good at capturing nonlinear and complex data patterns. At the same time, the multivariate linear regression model is introduced, which is suitable for dealing with regression problems and is convenient for explaining linear relationships. This provides a differentiated perspective, and through mutual calibration between the two models, the prediction accuracy and reliability are enhanced to ensure that the optimization goals of the system are achieved.
[0131] Step 2: Use the iterative dichotomizer algorithm module to calculate the comprehensive resource utilization rate. This process is essentially a process of finding the most discriminative features in the data. Briefly, starting from the root node, at each step, select the feature with the largest information gain to split the data, so as to construct a path from a specific feature value to a specific category. The end point of the path, that is, the leaf node, corresponds to the data classification on this path, which is the regression prediction result, representing a prediction result obtained based on data features, that is, the predicted value of the comprehensive resource utilization rate. Among them, the usage process of historical data is as Figure 6 shown, and the prediction process of the resource utilization rate for the new design is as Figure 7 shown.
[0132] Step 3: Use the multiple linear regression module to calculate the comprehensive resource utilization rate. The multiple linear regression algorithm can be used to find the parameters based on the same resource data. First, construct the following multiple linear regression equations between the historical resource utilization rate corresponding to the historical design parameters and the historical design parameters:
[0133]
[0134] All parameters β 11 to β nn in the equations can be solved by the least squares method, and the mean square error MSE2 between the predicted value and the actual value is calculated. For the new design, substitute the new key design parameters "A 01 , A 02 ,..., A 0n " into the equations to obtain the predicted value of the comprehensive resource utilization rate of the new design "A 11 , A 12 ,..., A 1n ".
[0135] Step 4: Use the comparison and optimization module to determine the final prediction result.
[0136] For historical sample data, calculate the difference Diff between the predicted value obtained by the iterative dichotomizer algorithm module (i.e., the comprehensive resource utilization rate obtained in Step 2) and the predicted value obtained by the multiple linear regression module (i.e., the comprehensive resource utilization rate obtained in Step 3). If Diff < 3%, then take the larger one of the two as the final predicted value. If Diff ≥ 3%, then compare the mean square errors MSE1 and MSE2. If MSE1 < MSE2, then use regularization to optimize the parameters of the multiple linear regression model to obtain the optimized predicted value and mean square error again. If MSE1 ≥ MSE2, then apply the pruning strategy to reduce overfitting and optimize the iterative dichotomizer algorithm model to obtain the optimized predicted value and mean square error again. Use the optimized predicted value for comparison again until Diff < 3% to determine the final prediction result.
[0137] For the key design parameters introduced in the new design, since the comparison and optimization module has calibrated the iterative bisection algorithm model and the multivariate linear regression model, the difference between the predicted values obtained by the two methods will not exceed 3%. Therefore, it is only necessary to substitute the key design parameters into the two models respectively, obtain the predicted values respectively, and take the larger one as the final predicted value.
[0138] Step 5, output prediction results: For new designs, if the final prediction results reach the threshold, a bitstream file is generated using Vivado and downloaded to the FPGA for prototype verification. If the final prediction results do not reach the threshold, a notification of unqualified resource utilization is issued.
[0139] The process of using Vivado to generate a bitstream file and downloading it to the FPGA for prototype verification can usually include the following steps:
[0140] 1. Project creation:
[0141] Open the Vivado IDE and create a new project.
[0142] Select an appropriate project name and storage location.
[0143] Specify the project type (such as HDL Project) and the HDL language (such as VHDL or Verilog).
[0144] 2. Add source files:
[0145] Add design files, such as VHDL or Verilog files, to your project.
[0146] If the design consists of multiple modules, make sure all related files are added.
[0147] 3. Configure project settings:
[0148] Select the "Settings" tab in the "Flow Navigator" and configure the project settings.
[0149] Set simulation parameters, optimization strategies, etc.
[0150] 4. Design constraints:
[0151] Add design constraint files (such as UCF or XDC files) that specify the location of I / O pins, clock constraints, etc.
[0152] 5. General:
[0153] Select the Synthesis tab in the Flow Navigator to run the synthesis tool.
[0154] The synthesis process converts the design into a form that the FPGA can understand.
[0155] 6. Implementation:
[0156] Select the "Implementation" tab in the "Flow Navigator" to perform the implementation process.
[0157] Implementation includes layout (placement) and routing (routing) steps, which determine the use of gate array and interconnect resources.
[0158] 7. Generate bitstream file:
[0159] After the implementation process is completed, select "Generate Bitstream" to generate the bitstream file.
[0160] This file contains all the information needed to download to the FPGA.
[0161] 8. Download the bitstream file:
[0162] Download the bitstream file to the FPGA using JTAG, USBBlaster, or other download cables.
[0163] In Vivado, you can download through the "Open Hardware Manager" window.
[0164] 9. Verification and testing:
[0165] After the download is complete, perform functional verification and testing.
[0166] Use test vectors or other automated testing tools to ensure that the design works as expected.
[0167] 10. Debug (if necessary):
[0168] If a problem is found, Vivado's debugging tools can be used to diagnose the problem.
[0169] It may be necessary to adjust the design or constraints and repeat the implementation and download steps.
[0170] 11. Verify the hardware:
[0171] Verify the physical characteristics of the hardware during testing, such as power consumption, heat distribution, etc.
[0172] 12. Packaging:
[0173] If the verification is successful, the design can be packaged on an FPGA, making it ready for practical applications.
[0174] This process is a standard process for hardware design and verification, ensuring that the design can work properly on the FPGA and meet performance, power consumption and other design requirements. Through Vivado's graphical interface and powerful tool set, technicians can complete these steps more easily.
[0175] By applying the iterative bisection algorithm and the multivariate linear regression algorithm, this embodiment proposes a resource evaluation and optimization method based on an FPGA prototype verification platform, which can utilize a large amount of historical data to accurately analyze and predict resource consumption, greatly reducing the uncertainty in the design process, effectively avoiding resource shortages or waste that may occur in the late design stage, automating and improving the accuracy and efficiency of resource analysis, and has obvious time advantages and higher reliability.
[0176] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0177] In the present embodiment, a device for determining resource utilization is also provided, and the device is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions thereof will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and contemplated.
[0178] Figure 8 is a structural block diagram of a device for determining resource utilization rate according to an embodiment of the present application, such as Figure 8 As shown, the device comprises:
[0179] The acquisition module 802 is used to input the current design parameters provided by the target object into the prediction model, and obtain the current resource usage rate output by the prediction model through the modules shown below:
[0180] A first generating module 804 sends the current FPGA resource data obtained after the data collecting module runs the current design parameters to the iterative binary algorithm module of the prediction model, so that the iterative binary algorithm module generates a first resource usage rate based on the current design parameters and the current FPGA resource data;
[0181] A second generating module 806, configured to send the current FPGA resource data to the multiple linear regression module of the prediction model, so that the multiple linear regression module generates a second resource usage rate based on the current design parameters and the current FPGA resource data;
[0182] A determination module 808 is used to send the first resource utilization rate and the second resource utilization rate to the comparison and optimization module, so that the comparison and optimization module compares the first resource utilization rate and the second resource utilization rate, and determines the current resource utilization rate of the FPGA prototype verification platform according to the comparison result;
[0183] Among them, the prediction model at least includes the data collection module, the iterative bisection algorithm module, the multivariate linear regression module, and the comparison and optimization module. The prediction model is trained with the historical design parameters provided by the target object as input samples and the historical resource utilization rate corresponding to the historical design parameters as output samples.
[0184] Through the above device, after the current design parameters provided by the target object are input into the prediction model, the current FPGA resource data obtained after the current design parameters are run by the data collection module of the prediction model, and then the current FPGA resource data is sent to the iterative bisection algorithm module of the prediction model and the multivariate linear regression module of the prediction model respectively, and the first resource utilization rate is generated based on the current design parameters and the current FPGA resource data by the iterative bisection algorithm module, and the second resource utilization rate is generated based on the current design parameters and the current FPGA resource data by the multivariate linear regression module, and then the first resource utilization rate and the second resource utilization rate are sent to the comparison and optimization module of the prediction model, so that the comparison and optimization module compares the first resource utilization rate and the second resource utilization rate, and determines the current resource utilization rate of the FPGA prototype verification platform according to the comparison result, thereby using advanced data collection technology, algorithm analysis technology and optimization technology to realize automatic determination of resource utilization rate, while improving the accuracy and determination efficiency of resource utilization rate, with obvious time advantages and higher reliability. In addition, through algorithm prediction, an accurate understanding of resource usage can be obtained at an early stage, thereby avoiding the cost and risk caused by repeated adjustments. Therefore, the technical problem of how to efficiently determine resource utilization during FPGA development can be solved, thereby achieving the technical effect of efficiently determining resource utilization.
[0185] In an exemplary embodiment, the above-mentioned resource utilization determination device also includes a historical FPGA resource data acquisition module, which is used to further perform the following steps before inputting the current design parameters provided by the target object into the scheme of the prediction model in executing step S202: step S11, inputting the historical design parameters into the data collection module; step S12, acquiring historical FPGA resource data generated by the data collection module based on the historical design parameters, wherein the historical FPGA resource data includes at least: the number of lookup tables, the utilization rate of the lookup tables, the number of registers, the utilization rate of the registers, the utilization of the random access memory, and the utilization of the digital signal processor unit.
[0186] In an exemplary embodiment, the first generation module is further used to: establish an iterative binary algorithm model in the iterative binary algorithm module to obtain multiple historical resource features corresponding to the historical FPGA resource data; for each of the multiple historical resource features, calculate the conditional entropy of each historical resource feature, perform weighted summation on the data subsets corresponding to each historical resource feature, and obtain the overall entropy of the multiple historical resource features, wherein each historical resource feature represents a historical design parameter, and the data subset corresponding to each historical resource feature represents the historical resource utilization rate under the historical design parameter; obtain information gain according to the difference between the overall entropy and the conditional entropy; compare multiple information gains, first select the first historical resource feature corresponding to the largest information gain as the root node to recursively divide the first data subsets of the first historical resource feature until all the first data subsets belong to the same category; when all the first data subsets belong to the first category, if it is determined that the historical resource utilization rate of at least one first data subset among all the first data subsets is greater than the first a preset threshold, then it is determined that the historical resource utilization rate corresponding to the first historical resource feature is unqualified; when all the first data subsets belong to the second category, for the remaining historical resource features except the first historical resource feature in the multiple historical resource features, the second historical resource feature corresponding to the largest information gain is selected from the remaining historical resource features as a leaf node to recursively divide the second data subsets of the second historical resource feature until all the second data subsets belong to the same category; under the condition that all the second data subsets belong to the second category and the historical resource utilization rate corresponding to the second historical resource feature is qualified, if it is determined that the second historical resource feature is consistent with the current resource feature corresponding to the current resource data, the historical resource utilization rate corresponding to the second historical resource feature is determined as the first resource utilization rate; the actual resource utilization rate obtained by monitoring the FPGA prototype verification platform is obtained, the first mean square error between the first resource utilization rate and the actual resource utilization rate is calculated, and the first mean square error and the first resource utilization rate are sent to the comparison and optimization module.
[0187] In an exemplary embodiment, the second generation module is also used to: establish a multivariate linear equation group in the multivariate linear regression module based on the historical design parameters and the historical resource utilization rate; use the least squares method to calculate all unknown parameters of the multivariate linear equation group to obtain a target multivariate linear equation group; input the current design parameters into the target multivariate linear equation group, calculate the predicted resource utilization rate corresponding to the current design parameters, and determine the predicted resource utilization rate as the second resource utilization rate; obtain the actual resource utilization rate obtained by monitoring the FPGA prototype verification platform, calculate the second mean square error between the second resource utilization rate and the actual resource utilization rate, and send the second mean square error and the second resource utilization rate to the comparison and optimization module.
[0188] In an exemplary embodiment, the above-mentioned determination module is also used to implement the following steps: Step S21, obtaining the difference between the first resource utilization rate and the second resource utilization rate; Step S22, when it is determined that the difference between the first resource utilization rate and the second resource utilization rate is less than a second preset threshold, determining the current resource utilization rate based on the first resource utilization rate and the second resource utilization rate.
[0189] Among them, the above-mentioned determination module is also used to: when it is determined that the first resource usage rate is greater than the second resource usage rate, determine the current resource usage rate according to the first resource usage rate; when it is determined that the first resource usage rate is less than the second resource usage rate, determine the current resource usage rate according to the second resource usage rate.
[0190] In an exemplary embodiment, the above-mentioned determination module is also used to: after obtaining the difference between the first resource utilization rate and the second resource utilization rate, when it is determined that the difference between the first resource utilization rate and the second resource utilization rate is greater than a second preset threshold, compare the first mean square error and the second mean square error; if it is determined that the first mean square error is less than the second mean square error, optimize the multivariate linear regression module based on the comparison and optimization module; use the optimized multivariate linear regression model to recalculate the third resource utilization rate, so that the comparison and optimization module determines the current resource utilization rate based on the first resource utilization rate and the third resource utilization rate.
[0191] In an exemplary embodiment, further, the above-mentioned determination module is also used to: if the first mean square error is greater than or equal to the second mean square error, optimize the iterative binary algorithm module based on the comparison and optimization module; use the optimized iterative binary algorithm module to recalculate the fourth resource utilization rate, so that the comparison and optimization module determines the current resource utilization rate based on the fourth resource utilization rate and the second resource utilization rate.
[0192] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0193] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0194] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0195] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0196] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0197] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.
[0198] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0199] The embodiments of the present application also provide a computer program, which includes computer instructions, which are stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the steps in any one of the above method embodiments.
[0200] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
[0201] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0202] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for determining resource utilization, characterized in that: Applied to field programmable gate array FPGA prototype verification platform, include: The current design parameters provided by the target object are input into the prediction model, and the current resource utilization rate output by the prediction model is obtained in the following manner: Sending the current FPGA resource data obtained by the data collection module after running the current design parameters to the iterative binary algorithm module of the prediction model, so that the iterative binary algorithm module generates a first resource usage rate based on the current design parameters and the current FPGA resource data; and sending the current FPGA resource data to the multiple linear regression module of the prediction model, so that the multiple linear regression module generates a second resource utilization rate based on the current design parameters and the current FPGA resource data; sending the first resource utilization rate and the second resource utilization rate to the comparison and optimization module of the prediction model, so that the comparison and optimization module compares the first resource utilization rate and the second resource utilization rate, and determining the current resource utilization rate of the FPGA prototype verification platform according to the comparison result of the comparison; Among them, the prediction model at least includes the data collection module, the iterative bisection algorithm module, the multivariate linear regression module, and the comparison and optimization module. The prediction model is trained with the historical design parameters provided by the target object as input samples and the historical resource utilization rate corresponding to the historical design parameters as output samples.
2. The method according to claim 1, characterized in that: Before inputting the current design parameters provided by the target object into the prediction model, the method further includes: inputting the historical design parameters into the data collection module; Acquire historical FPGA resource data generated by the data collection module based on the historical design parameters, wherein the historical FPGA resource data includes at least: the number of lookup tables, the usage rate of the lookup tables, the number of registers, the usage rate of the registers, the usage of random access memory, and the usage of a digital signal processor unit.
3. The method according to claim 2, characterized in that Sending the current FPGA resource data obtained by the data collection module after running the current design parameters to the iterative binary algorithm module of the prediction model, so that the iterative binary algorithm module generates a first resource usage rate based on the current design parameters and the current FPGA resource data, including: Establishing an iterative binary divider algorithm model in the iterative binary divider algorithm module to obtain a plurality of historical resource features corresponding to the historical FPGA resource data; For each of the multiple historical resource features, calculate the conditional entropy of each historical resource feature, perform weighted summation on the data subsets corresponding to each historical resource feature, and obtain the overall entropy of the multiple historical resource features, wherein each of the historical resource features represents a historical design parameter, and the data subsets corresponding to each of the historical resource features represent the historical resource utilization rate under the one historical design parameter; Obtaining information gain according to the difference between the overall entropy and the conditional entropy; Comparing multiple information gains, first selecting a first historical resource feature corresponding to the largest information gain as a root node to recursively divide the first data subsets of the first historical resource feature until all first data subsets belong to the same category; In the case that all the first data subsets belong to the first category, if it is determined that the historical resource usage rate of at least one first data subset among all the first data subsets is greater than a first preset threshold, then it is determined that the historical resource usage rate corresponding to the first historical resource feature is unqualified; In the case that all the first data subsets belong to the second category, for the remaining historical resource features except the first historical resource feature among the plurality of historical resource features, a second historical resource feature corresponding to the maximum information gain is selected from the remaining historical resource features as a leaf node to recursively divide the second data subsets of the second historical resource feature until all the second data subsets belong to the same category; Under the condition that all the second data subsets belong to the second category and the historical resource utilization rate corresponding to the second historical resource feature is qualified, if it is determined that the second historical resource feature is consistent with the current resource feature corresponding to the current resource data, the historical resource utilization rate corresponding to the second historical resource feature is determined as the first resource utilization rate; the actual resource utilization rate obtained by monitoring the FPGA prototype verification platform is obtained, the first mean square error between the first resource utilization rate and the actual resource utilization rate is calculated, and the first mean square error and the first resource utilization rate are sent to the comparison and optimization module.
4. The method according to claim 3, characterized in that Sending the current FPGA resource data to the multiple linear regression module of the prediction model so that the multiple linear regression module generates a second resource usage rate based on the current design parameters and the current FPGA resource data, including: Establishing a multivariate linear equation system in the multivariate linear regression module based on the historical design parameters and the historical resource utilization rate; Using the least squares method to calculate all unknown parameters of the multivariate linear equations to obtain a target multivariate linear equations system; Inputting the current design parameters into the target multivariate linear equation group, calculating the predicted resource utilization rate corresponding to the current design parameters, and determining the predicted resource utilization rate as the second resource utilization rate; Acquire an actual resource usage rate obtained by monitoring the FPGA prototype verification platform, calculate a second mean square error between the second resource usage rate and the actual resource usage rate, and send the second mean square error and the second resource usage rate to the comparison and optimization module.
5. The method according to claim 4, characterized in that Sending the first resource usage rate and the second resource usage rate to the comparison and optimization module so that the comparison and optimization module compares the first resource usage rate and the second resource usage rate, and determining the current resource usage rate of the FPGA prototype verification platform according to the comparison result, including: Obtaining a difference between the first resource usage rate and the second resource usage rate; In a case where it is determined that the difference between the first resource usage rate and the second resource usage rate is less than a second preset threshold, determining the current resource usage rate based on the first resource usage rate and the second resource usage rate; The determining the current resource usage rate based on the first resource usage rate and the second resource usage rate includes: In a case where it is determined that the first resource usage rate is greater than the second resource usage rate, determining the current resource usage rate according to the first resource usage rate; In a case where it is determined that the first resource usage rate is less than the second resource usage rate, the current resource usage rate is determined according to the second resource usage rate.
6. The method according to claim 5, characterized in that After obtaining the difference between the first resource usage rate and the second resource usage rate, the method further includes: When it is determined that the difference between the first resource usage rate and the second resource usage rate is greater than a second preset threshold, comparing the first mean square error with the second mean square error; If it is determined that the first mean square error is less than the second mean square error, optimizing the multivariate linear regression module based on the comparison and optimization module; The optimized multivariate linear regression model is used to recalculate the third resource usage rate, so that the comparison and optimization module determines the current resource usage rate based on the first resource usage rate and the third resource usage rate.
7. The method according to claim 6, characterized in that The method further comprises: If the first mean square error is greater than or equal to the second mean square error, optimizing the iterative binarization algorithm module based on the comparison and optimization module; The fourth resource usage rate is recalculated using the optimized iterative binary divider algorithm module, so that the comparison and optimization module determines the current resource usage rate based on the fourth resource usage rate and the second resource usage rate.
8. A device for determining resource utilization, characterized in that: include: The acquisition module is used to input the current design parameters provided by the target object into the prediction model, and obtain the current resource usage rate output by the prediction model in the following manner: A first generating module, sending the current FPGA resource data obtained by the data collecting module after running the current design parameters to the iterative binary algorithm module of the prediction model, so that the iterative binary algorithm module generates a first resource usage rate based on the current design parameters and the current FPGA resource data; A second generating module, configured to send the current FPGA resource data to the multiple linear regression module of the prediction model, so that the multiple linear regression module generates a second resource usage rate based on the current design parameters and the current FPGA resource data; A determination module, configured to send the first resource utilization rate and the second resource utilization rate to the comparison and optimization module, so that the comparison and optimization module compares the first resource utilization rate and the second resource utilization rate, and determines the current resource utilization rate of the FPGA prototype verification platform according to the comparison result; Among them, the prediction model at least includes the data collection module, the iterative bisection algorithm module, the multivariate linear regression module, and the comparison and optimization module. The prediction model is trained with the historical design parameters provided by the target object as input samples and the historical resource utilization rate corresponding to the historical design parameters as output samples.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 7 when executed by a processor.
10. A computer program product, characterized in that The invention comprises a computer program, which implements the steps of the method described in any one of claims 1 to 7 when being executed by a processor.
