A kind of high-level synthesis method and system
Technical field
The present invention relates to a kind of method and system that designs hardware circuit, especially a kind of scheduling and resource based on compatible figure distributed high-level synthesis method and the system that combines.
Background technology
Scheduling and resource allocation algorithm flow process are the focuses in the research in the High Level Synthesis field.
Dispatching algorithm is classified according to its implementation, mainly can be divided into structured approach, converter technique and integral linear programming method.Described structured approach is to select first an operation at every turn, select again a suitable control step, then in this operation scheduling being gone on foot to selected control, until all being scheduled, all operations finish, yet, the key of structured approach is next step scheduling operation of How to choose, and the suitable control of How to choose goes on foot to place selected operation; Described converter technique is at first to select the dispatching algorithm (for example ASAP) that is simple and easy to realize to obtain an initial scheduling scheme, then this scheduling scheme is carried out iterated transform, is used for obtaining optimum scheduling result; Described integral linear programming (ILP) method is scheduling problem to be converted into the integral linear programming problem find the solution.And distribution can adopt the methods such as graph-theoretical algorithm, integral linear programming to solve for the resource in the High Level Synthesis.This is similar with the method that solves scheduling.Described graph-theoretical algorithm mainly comprises clique partitioning algorithm, weight bipartite graph algorithm, compatible nomography etc.
Conventional High Level Synthesis system dispatches respectively with resource to distribute.; because in the process of operation dispatching; its design constraint normally determine to produce according to artificial experience; it generally includes only the hardware resource information of number; and do not comprise the hardware interconnect information; therefore, by the circuit structure that this system produces, it often can not satisfy the design requirement of area optimum.
Summary of the invention
In order to solve the technical matters of above-mentioned existence, the purpose of this invention is to provide a kind of high-level synthesis method of satisfied design hardware circuit area optimum.
Another object of the present invention provides a kind of High Level Synthesis system of satisfied design hardware circuit area optimum.
The technical solution used in the present invention is: a kind of high-level synthesis method, and described method step comprises:
A, obtain the digital circuit behavior description, and then the generated data flow graph;
B, according to data flow diagram, carry out hardware resource predistribution, and then generate the resource constraint tabulation;
C, according to resource constraint tabulation and data flow diagram, dispatch;
D, carry out resource according to the result of scheduling and distribute;
E, generate hardware circuit according to resource allocation result and scheduling result.
Further, described step B adopts compatible nomography to carry out predistribution.
Further, described step B comprises:
B1, make up compatible figure according to data flow diagram, and set up the resource constraint tabulation;
B2, search longest path according to compatible figure;
The longest path that B3, basis are searched is put into the resource constraint tabulation successively with each node that described longest path relates to;
The longest path that B4, basis are searched is deleted node and the limit that relates in the described longest path in compatible figure, and the weight on remaining each limit among the compatible figure is recomputated;
B5, judge whether also there is node among the compatible figure, if exist, return execution in step B2; If do not exist, generate the resource constraint tabulation, step B finishes.
Further, described step B2 adopts longest path algorithm to search longest path.
Further, described step B1 makes up the weight on the limit and each limit that comprise the node that makes up compatible figure, compatible figure among the compatible figure.
Further, whether the limit of described compatible figure is according to existing data dependence relation or common input end mouth to make up between two nodes.
Further, the computing method that make up each limit weight are:
W
i,j=(α*dependency
i,j+β*NIN
i,j)
Wherein α, β are coefficient, dependency
I, jBe Boolean, i and j are any two nodes, if node i and j have data dependence relation, and dependency then
I, jBeing 1, then is not 0; NIN
I, jBe integer, the input port number that representation node i and j are common.
Another technical solution used in the present invention is: a kind of High Level Synthesis system comprises:
The data flow diagram generation unit is used for obtaining the digital circuit behavior description, and then the generated data flow graph;
The predistribution unit is used for according to data flow diagram, carries out hardware resource predistribution, and then generates the resource constraint tabulation;
Scheduling unit is used for dispatching according to resource constraint tabulation and data flow diagram;
Resource allocation unit is used for carrying out the resource distribution according to the result of scheduling;
The circuit evolving unit is used for generating hardware circuit according to resource allocation result and scheduling result.
Further, described predistribution unit comprises:
Composition table module is used for making up compatible figure according to data flow diagram, and sets up the resource constraint tabulation;
Search module, be used for searching longest path according to compatible figure;
Modified module, be used for according to the longest path of searching, each node that longest path relates to is put into the resource constraint tabulation successively, and in compatible figure, delete node and the limit that relates in the longest path, and the weight on remaining each limit among the compatible figure is recomputated;
Judge execution module, be used for judging whether compatible figure also exists node, if exist, return and search module; If do not exist, generate the resource constraint tabulation, and provide resource constraint to tabulate to scheduling unit.
The invention has the beneficial effects as follows: the application of the invention, when operation dispatching, not only comprise the hardware resource information of number, the information that also comprises the hardware interconnection, and the operation of resource constraint in the scheduling is determined in rejecting by artificial experience, therefore, can generate more rapidly hardware circuit like this, and effectively reduce the interconnection expense in the hardware circuit.
Another beneficial effect of the present invention is: the application of the invention, when operation dispatching, not only comprise the hardware resource information of number, the information that also comprises the hardware interconnection, and the operation of resource constraint in the scheduling is determined in rejecting by artificial experience, therefore, can generate more rapidly hardware circuit like this, and effectively reduce the interconnection expense in the hardware circuit.
Description of drawings
Below in conjunction with accompanying drawing the specific embodiment of the present invention is described further:
Fig. 1 is flow chart of steps of the present invention;
Fig. 2 is the substep process flow diagram of step B of the present invention;
Fig. 3 is data flow diagram schematic diagram of the present invention;
Fig. 4 is compatible figure schematic diagram of the present invention;
Fig. 5 is the longest path schematic diagram of compatible figure in the predistribution of the present invention;
Fig. 6 is the resource constraint tabulation schematic diagram that generates in the predistribution of the present invention;
Fig. 7 is system chart of the present invention;
Fig. 8 is the subsystem diagram of predistribution of the present invention unit.
Embodiment
By Fig. 1 and Fig. 2 as can be known, a kind of high-level synthesis method, described method step comprises:
A, obtain the digital circuit behavior description, and then the generated data flow graph;
B, according to data flow diagram, carry out hardware resource predistribution, and then generate the resource constraint tabulation;
C, according to resource constraint tabulation and data flow diagram, dispatch;
D, carry out resource according to the result of scheduling and distribute;
E, generate hardware circuit according to resource allocation result and scheduling result.
Above-mentioned data flow diagram as shown in Figure 3, node represents dissimilar operation among the figure, arrow represents the direction of data stream, namely each the operation between data dependence relation; Described scheduling be will operation allotment to the process in each control step, it is corresponding functional unit to be distributed in operation calculate, variable is distributed to that specific functional unit is stored and interconnection line distributed to the process that the interconnect resource such as Port Multiplier, bus communicate that described resource is distributed.
Be further used as preferred embodiment, described step B adopts compatible nomography to carry out predistribution.
Be further used as preferred embodiment, described step B comprises:
B1, make up compatible figure according to data flow diagram, and set up the resource constraint tabulation;
B2, search longest path according to compatible figure;
The longest path that B3, basis are searched is put into the resource constraint tabulation successively with each node that described longest path relates to;
The longest path that B4, basis are searched is deleted node and the limit that relates in the described longest path in compatible figure, and the weight on remaining each limit among the compatible figure is recomputated;
B5, judge whether also there is node among the compatible figure, if exist, return execution in step B2; If do not exist, represent that namely all nodes all have been placed in the resource constraint tabulation among the compatible figure, generate the resource constraint tabulation, step B finishes, and represents that namely predistribution finishes.
Be further used as preferred embodiment, described step B2 adopts longest path algorithm to search longest path.
Be further used as preferred embodiment, described step B1 makes up the weight on the limit and each limit that comprise the node that makes up compatible figure, compatible figure among the compatible figure.The node of described compatible figure is the same with the node of described data flow diagram, all represents dissimilar operation.
Be further used as preferred embodiment, whether the limit of described compatible figure is according to existing data dependence relation or common input end mouth to make up between two nodes.
Be further used as preferred embodiment, the computing method that make up each limit weight are:
W=(α*dependency
i,j+β*NIN
i,j)
Wherein α, β are coefficient, dependency
I, jBe Boolean, i and j are any two nodes, if node i and j have data dependence relation, and dependency then
I, jBeing 1, then is not 0; NIN
I, jBe integer, the input port number that representation node i and j are common.
For example, as shown in Figure 4, step B is the predistribution of carrying out about add operation, and the node among the compatible figure represents an add operation, and every limit represents two operations and has the possibility of sharing same hardware resource.Therefore, have as seen from the figure four add operations, correspond respectively to the node (n1, n2, n3 and n5) among the compatible figure.In addition, operation n1, n2 and n3 and operation n5 have data dependence relation, and operation n2 and n3 have common input port, so utilize the limit that above-mentioned relation is showed.Next need to calculate the weight on every limit, take limit n2 → n3 as example, because there is not data dependence relation between them, so dependency
N2, n3Be 0, again because have a common input port in_3 between them, so NIN
N2, n3Be 1.Choose α=1 here, β=2, therefore, the weight of limit n2 → n3 is W
N2, n3=(α * dependency
N2, n3+ β * NIN
N2, n3)=(1 * 0+2 * 1)=2.
As shown in Figure 5, it is the longest path schematic diagram of compatible figure in the predistribution.It is according to compatibility figure shown in Figure 4, longest path n2 → n3 that employing longest path algorithm (The Longest Path Algorithm) is searched in compatible figure → n5.
Resource constraint tabulation as shown in Figure 6, it represents all add operations among the compatible figure, and namely all nodes need to use two totalizers, wherein operate n2, n3 and n5 and share a totalizer, and operation n1 uses a totalizer.
By Fig. 7 and Fig. 8 as can be known, a kind of High Level Synthesis system comprises:
The data flow diagram generation unit is used for obtaining the digital circuit behavior description, and then the generated data flow graph;
The predistribution unit is used for according to data flow diagram, carries out hardware resource predistribution, and then generates the resource constraint tabulation;
Scheduling unit is used for dispatching according to resource constraint tabulation and data flow diagram;
Resource allocation unit is used for carrying out the resource distribution according to the result of scheduling;
The circuit evolving unit is used for generating hardware circuit according to resource allocation result and scheduling result.
Be further used as preferred embodiment, described predistribution unit comprises:
Composition table module is used for making up compatible figure according to data flow diagram, and sets up the resource constraint tabulation;
Search module, be used for searching longest path according to compatible figure;
Modified module, be used for according to the longest path of searching, each node that longest path relates to is put into the resource constraint tabulation successively, and in compatible figure, delete node and the limit that relates in the longest path, and the weight on remaining each limit among the compatible figure is recomputated;
Judge execution module, be used for judging whether compatible figure also exists node, if exist, return and search module; If do not exist, generate the resource constraint tabulation, and provide resource constraint to tabulate to scheduling unit.
More than be that better enforcement of the present invention is specified, but the invention is not limited to described embodiment, those of ordinary skill in the art make all equivalent variations or replacement also can doing under the prerequisite of spirit of the present invention, the distortion that these are equal to or replace all is included in the application's claim limited range.