Boolean function reconstruction solution method, device, computer equipment and storage medium
By calculating the cofactor and performing multi-thread solution, using bit operations and integer variable storage, the problem of low operating efficiency in critical path delay optimization of FPGA chips is solved, and more efficient storage and computing performance are achieved.
Patent Information
- Application Number
- CN202410720086.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-05
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-06-05
AI Technical Summary
Existing FPGA chips have problems with low operating efficiency during the critical path delay optimization process. This is mainly due to the need to construct a two-dimensional vector and the additional steps required to exclude irrelevant input combinations, resulting in large storage space and low operating efficiency, making it difficult to meet optimization needs.
By obtaining the initial lookup table and constraints, calculating the cofactor and performing multi-threaded solution, using bit operations and integer variable storage to avoid constructing a two-dimensional vector, supporting irrelevant input combination calculations, and achieving critical path delay optimization of the FPGA chip.
Under the same memory resources, the critical path delay optimization running speed of the FPGA chip is significantly improved, memory consumption is reduced, and irrelevant input combination calculations are supported, improving optimization efficiency.
Smart Images

Figure CN118295961B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of field programmable gate array technology, and in particular to a Boolean function reconstruction and solving method, device, computer equipment and storage medium. Background Art
[0002] Boolean function reconstruction is common in the FPGA field. In the process of enabling FPGA chips, in order to optimize the critical path delay, it is often necessary to change the input signal arrangement of two consecutive LUTs (lookup tables). Since each LUT itself represents a Boolean function with n (n is generally 6 or less) inputs and a single output, changing the input signal arrangement is essentially a reconstruction of the Boolean function.
[0003] In the related art, the optimization of the critical path delay of the FPGA chip can be achieved through Boolean function reconstruction, which can automatically generate all possible continuous lookup table combinations. However, in the process of optimizing the critical path delay of the FPGA chip, a two-dimensional vector needs to be constructed, which requires a large storage space, and additional steps are required to exclude irrelevant input combinations. The optimization of the critical path delay of the FPGA chip has the problem of low operating efficiency, which is difficult to meet the needs of optimizing the critical path delay of the FPGA chip. Summary of the invention
[0004] In view of this, the present invention provides a Boolean function reconstruction solution method, device, computer equipment and storage medium to solve the problem of low operating efficiency in the existing optimization of the critical path delay of FPGA chips.
[0005] In a first aspect, the present invention provides a Boolean function reconstruction solution method, which is applied to FPGA, and the method comprises:
[0006] Obtaining a first initial lookup table, a second initial lookup table and a constraint condition, wherein an output signal of the first initial lookup table is used as an input signal of one of the second initial lookup tables, the constraint condition is used to limit the number of input signals of the first target lookup table and the second target lookup table respectively, and at least one target input signal is input through a predetermined input port, at least one target input signal is one or more input signals in the first target lookup table, and / or at least one target input signal is one or more input signals in the second target lookup table; the output signal of the first target lookup table is used as an input signal to one of the second target lookup tables;
[0007] Based on the output signal of the first initial lookup table, the input bit of the second initial lookup table corresponding to the output signal, the pre-constructed mask table, the truth table of the second initial lookup table, and the number of input signals of the second initial lookup table, a co-formula of the second initial lookup table is calculated;
[0008] Traversing the input signals of the first initial lookup table and the input signals of the second initial lookup table respectively, and recording the shared input signals of the first initial lookup table and the second initial lookup table;
[0009] Determine the input signal number distribution of the first target lookup table and the second target lookup table and the input signal combination corresponding to the input signal number distribution based on the input signal of the first initial lookup table, the input signal of the second initial lookup table and the constraint condition;
[0010] Input each input signal number distribution and the input signal combination corresponding to the input signal number distribution into different threads;
[0011] Based on the remainder of the second initial lookup table and the shared input signal of the first initial lookup table and the second initial lookup table, multi-threaded solution is performed on each thread to obtain all combinations of the first target lookup table and the second target lookup table, so as to optimize the FPGA critical path delay by utilizing all combinations of the first target lookup table and the second target lookup table.
[0012] In the present invention, the optimization of the critical path delay of the FPGA chip is based on certain restrictions, and the continuous lookup table combination of all possible input signal rearrangements that meet the restricted conditions is output for the input continuous lookup table, which is convenient for users to integrate; the continuous lookup table combination of all possible input signal rearrangements is output, which is convenient for users to select the best solution. By expressing the truth table with the help of the co-formula, all basic operations are implemented using bit operations, and all intermediate variables except the necessary queue storage are stored in integer variables of corresponding bits. In practice, compared with the general optimization method for the critical path delay of the FPGA chip, the running speed of the optimization of the critical path delay of the FPGA chip can be doubled under the condition of the same memory resources. Under the condition of the same number of parallel operations, the memory consumption of the optimization of the critical path delay of the FPGA chip can be reduced by orders of magnitude. Compared with the existing optimization methods for the critical path delay of FPGA chips, in terms of storage, the Boolean function reconstruction solver for the optimization of the critical path delay of FPGA chips does not need to construct a two-dimensional vector, and only uses integer values of different bit widths for intermediate storage, thereby reducing the storage space by orders of magnitude; in terms of operating efficiency, the Boolean function reconstruction solver for the optimization of the critical path delay of FPGA chips uses bit operations as the basic operation method, and adopts multi-threading means, and multiple solutions are performed simultaneously. At the same time, it also supports irrelevant input combination calculations without additional steps, further improving the efficiency of optimizing the critical path delay of FPGA chips.
[0013] In an optional implementation, based on the output signal of the first initial lookup table, the input bit of the second initial lookup table corresponding to the output signal, the pre-constructed mask table, the truth table of the second initial lookup table, and the number of input signals of the second initial lookup table, the co-formula of the second initial lookup table is calculated, including:
[0014] Initializing the mask table based on the output value of the output signal of the first initial lookup table and the input bit of the second initial lookup table corresponding to the output signal to obtain an initial mask;
[0015] The co-formula of the second initial lookup table is obtained by performing a bit operation using the initial mask, the truth table of the second initial lookup table, the bit positions, and the number of input signals of the second initial lookup table.
[0016] In this method, the mask table is initialized by using the output information of the first initial lookup table, and the remainder of the second initial lookup table is obtained by bit operation using the initialized mask. This method has extremely high operating efficiency, and its advantages are more obvious when solving multiple combinations of the first initial lookup table and the second initial lookup table in succession.
[0017] In an optional implementation, the initial mask, the truth table of the second initial lookup table, the bit position, and the number of input signals of the second initial lookup table are used to perform bit operations to obtain a cofactor of the second initial lookup table, including:
[0018] Performing a bitwise AND operation using the initial mask and the truth table of the second initial lookup table to obtain an intermediate value;
[0019] Using the output signal of the second initial lookup table connected to the bit position of the input signal of the second initial lookup table and the number of input signals of the second initial lookup table, combined with the initial mask, the intermediate value is cyclically solved to obtain the intermediate value after the cycle;
[0020] The intermediate value after the loop is shifted to obtain the remainder of the second initial lookup table.
[0021] In this method, the initial mask table is bitwise ANDed with the truth table of the second initial lookup table, and the solution is looped and moved to obtain the remainder of the second initial lookup table, which is convenient for subsequent calculations using the remainder of the second initial lookup table.
[0022] In an optional implementation, based on the co-formula of the second initial lookup table and the shared input signal of the first initial lookup table and the second initial lookup table, multi-threaded solving is performed on each thread to obtain all combinations of the first target lookup table and the second target lookup table, including:
[0023] Determining a shared input signal between a first target lookup table and a second target lookup table based on a shared input signal between the first initial lookup table and the second initial lookup table;
[0024] Based on the shared input signal of the first target lookup table and the second target lookup table, constructing an irrelevant input combination for the first target lookup table to obtain an irrelevant input combination for the first target lookup table;
[0025] and constructing an irrelevant input combination of the second target lookup table based on the shared input signal of the first target lookup table and the second target lookup table to obtain an irrelevant input combination of the second target lookup table;
[0026] Constructing a co-formula of the second target lookup table based on the input signal combination of the first target lookup table, the input signal combination of the second target lookup table, the irrelevant input combination of the first target lookup table, and the irrelevant input combination of the second target lookup table;
[0027] Check whether the remainder of the second target lookup table is constructed successfully;
[0028] When the co-factor of the second target lookup table is successfully constructed, a truth table of the first target lookup table is constructed based on the co-factor of the second target lookup table;
[0029] Based on the co-formula of the second target lookup table and the truth table of the first target lookup table, a truth table of the second target lookup table is generated, and the input signal number distribution of the first target lookup table and the input signal combination corresponding to the input signal number distribution, the input signal number distribution of the second target lookup table and the input signal combination corresponding to the input signal number distribution, the truth table of the first target lookup table and the truth table of the second target lookup table are respectively used as the combination of all the first target lookup table and the second target lookup table;
[0030] When the co-minor of constructing the target output lookup table is unsuccessful, it is determined that there is no legal combination of the first target lookup table and the second target lookup table.
[0031] In this method, support is provided for shared signals between the first initial lookup table and the second initial lookup table. Its characteristic is that it supports the situation where there is shared signal input between the first initial lookup table and the second initial lookup table, and the overall running time and resource overhead will not be significantly degraded compared to the situation without shared input. In the case of more sharing, the performance will even be improved.
[0032] In an optional implementation, checking whether the remainder of the second target lookup table is constructed successfully includes:
[0033] Based on the irrelevant input combinations of the first target lookup table, traverse all input signal combinations of the first target lookup table, and eliminate all irrelevant input combinations in the first target lookup table;
[0034] Based on the irrelevant input combination of the second target lookup table, traverse the input signal combination of the second target lookup table corresponding to the second target lookup table, and construct the co-factor and irrelevant input combination mask of the second target lookup table corresponding to the first target lookup table;
[0035] Based on the irrelevant input combination mask, determining whether the number of independent co-factors corresponding to the second target lookup table is less than or equal to 2;
[0036] When the number of independent co-factors corresponding to the second target lookup table is greater than 2, determining that the co-factor construction of the second target lookup table fails;
[0037] Alternatively, when the number of independent co-factors corresponding to the second target lookup table is less than or equal to 2, the independent co-factors corresponding to the second target lookup table are combined to obtain the co-factor of the second target lookup table.
[0038] In this method, support for shared signals of the first initial lookup table and the second initial lookup table is provided with almost no additional overhead by recording and masking irrelevant input combinations. This greatly reduces the running time and resource overhead compared to the general method of enumerating all possible solutions of the truth table when irrelevant input combinations occur, or the matrix solution method.
[0039] In an optional implementation, based on the irrelevant input combination mask, determining whether the number of independent co-factors corresponding to the second target lookup table is less than or equal to 2 includes:
[0040] Determine whether the queue for recording the remainder of the second target lookup table is empty;
[0041] When the queue for recording the co-factor of the second target lookup table is empty, adding the co-factor of the second target lookup table and the irrelevant input combination mask corresponding to the co-factor of the second target lookup table into the queue;
[0042] Determine whether the queue length is less than or equal to 2;
[0043] When the length of the queue is less than or equal to 2, confirm that the number of independent co-factors corresponding to the second target lookup table is less than or equal to 2;
[0044] Alternatively, when the queue for recording the co-factor of the second target lookup table is not empty, determining whether the co-factor of the second target lookup table is independent;
[0045] When the co-factor of the second target lookup table is independent, the co-factor of the second target lookup table and the corresponding mask are added to the queue;
[0046] Determine whether the queue length is less than or equal to 2;
[0047] When the length of the queue is less than or equal to 2, it is confirmed that the number of independent co-factors corresponding to the second target lookup table is less than or equal to 2.
[0048] In this method, by judging the queue length, the number of independent co-formulas of the second target lookup table is determined, which makes it easier to judge whether the co-formula of the second target lookup table is successfully constructed, and facilitates subsequent calculations to obtain the truth table of the first target lookup table and the second target lookup table, and then determine all combinations of the first target lookup table and the second target lookup table.
[0049] In a second aspect, the present invention provides a Boolean function reconstruction and solving device, the device comprising:
[0050] A data acquisition module, used to acquire a first initial lookup table, a second initial lookup table and a constraint condition, wherein an output signal of the first initial lookup table is used as an input signal of one of the second initial lookup tables, the constraint condition is used to limit the number of input signals of the first target lookup table and the second target lookup table respectively, and at least one target input signal is input through a predetermined input port, at least one target input signal is one or more input signals in the first target lookup table, and / or at least one target input signal is one or more input signals in the second target lookup table; the output signal of the first target lookup table is used as an input signal to one of the second target lookup tables;
[0051] A cofactor calculation module, configured to calculate a cofactor of a second initial lookup table based on an output signal of the first initial lookup table, an input bit of a second initial lookup table corresponding to the output signal, a pre-constructed mask table, a truth table of the second initial lookup table, and the number of input signals of the second initial lookup table;
[0052] A shared input recording module, used to traverse the input signal of the first initial lookup table and the input signal of the second initial lookup table respectively, and record the shared input signal of the first initial lookup table and the second initial lookup table;
[0053] A signal combination determination module, used to determine the input signal number distribution of the first target lookup table and the second target lookup table and the input signal combination corresponding to the input signal number distribution based on the input signal of the first initial lookup table, the input signal of the second initial lookup table and the constraint condition;
[0054] A signal combination input module, used for inputting each input signal number distribution and the input signal combination corresponding to the input signal number distribution into different threads;
[0055] The lookup table solving module is used to perform multi-thread solving on each thread based on the co-formula of the second initial lookup table and the shared input signal of the first initial lookup table and the second initial lookup table to obtain all combinations of the first target lookup table and the second target lookup table, so as to optimize the FPGA critical path delay by using all combinations of the first target lookup table and the second target lookup table.
[0056] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the Boolean function reconstruction and solving method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0057] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the Boolean function reconstruction and solving method of the first aspect or any corresponding embodiment thereof.
[0058] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the Boolean function reconstruction and solving method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0060] Figure 1 It is a schematic diagram of a principle of Boolean function reconstruction according to an embodiment of the present invention.
[0061] Figure 2 It is a flowchart of a Boolean function reconstruction and solving method according to an embodiment of the present invention.
[0062] Figure 3 It is a flowchart of a working method of a Boolean function reconstruction solver according to an embodiment of the present invention.
[0063] Figure 4 It is a schematic flow chart of the internal operation of a Boolean function reconstruction solver according to an embodiment of the present invention.
[0064] Figure 5 It is a flowchart of another Boolean function reconstruction and solving method according to an embodiment of the present invention.
[0065] Figure 6 4 is a flow chart of a method for calculating a cofactor of a second initial lookup table according to an embodiment of the present invention.
[0066] Figure 7 It is a flowchart of another Boolean function reconstruction and solving method according to an embodiment of the present invention.
[0067] Figure 8 It is a schematic diagram of a multi-threaded solution process according to an embodiment of the present invention.
[0068] Fig. 9 It is a schematic diagram of a flow chart of constructing and checking a cofactor according to an embodiment of the present invention.
[0069] Fig.10 It is a schematic diagram of a first initial lookup table and a second initial lookup table, and input signals of the first initial lookup table and the second initial lookup table according to an embodiment of the present invention.
[0070] Fig.11 It is a flowchart of a method for determining the total number of remainder formulas according to an embodiment of the present invention.
[0071] Fig.12 4 is a structural block diagram of a Boolean function reconstruction and solving device according to an embodiment of the present invention.
[0072] Fig.13 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0073] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0074] Figure 1 is a schematic diagram of a Boolean function reconstruction principle according to an embodiment of the present invention, such as Figure 1 As shown, Boolean function reconstruction can be understood as Figure 1 The combination of the left half LUTA (first initial lookup table) and LUTB (second initial lookup table) is transformed into Figure 1The right half of the LUTC (first target lookup table) and LUTD (second target lookup table) combination has the constraint condition for effective conversion that the output signal of O1 is the same when the input signals [I0, I1, I2, I3, I4] are the same (the values of all signals in the Boolean function can only be 0 or 1). The significance of this conversion is to transfer some signals on the critical path (which can be understood as the path with the longest delay) to the non-critical path. For example, assuming that I1 is a signal on the critical path, exchanging I1 with I3 can reduce the number of logic levels of I1 (the number of logic levels can be simply understood as the number of LUTs between input and output, such as in Figure 1 In the left half of the figure, the logic level of I1 is 2, and the logic level of I3 is 1), but at the same time, the logic level of I3 also increases. Therefore, not all valid transformations can bring about delay optimization. In practice, it is often necessary to find all or certain valid transformations within certain conditions.
[0075] In the related art, the optimization of the critical path delay of the FPGA chip can be achieved through Boolean function reconstruction, which can automatically generate all possible continuous lookup table combinations. However, in the process of optimizing the critical path delay of the FPGA chip, a two-dimensional vector needs to be constructed, which requires a large storage space, and additional steps are required to exclude irrelevant input combinations. The optimization of the critical path delay of the FPGA chip has the problem of low operating efficiency, which is difficult to meet the demand for optimizing the critical path delay of the FPGA chip.
[0076] In order to solve the above problems, a Boolean function reconstruction and solving method is provided in an embodiment of the present invention, which is used in a computer device. It should be noted that its execution subject can be a Boolean function reconstruction and solving device, which can be implemented as part or all of a computer device through software, hardware, or a combination of software and hardware. The computer device can be a terminal, a client, or a server. The server can be a single server or a server cluster composed of multiple servers. The terminal in the embodiment of the present application can be a smart phone, a personal computer, a tablet computer, or other intelligent hardware devices. In the following method embodiments, the execution subject is a computer device as an example for explanation.
[0077] The computer device in this embodiment is suitable for the use scenario of the conversion of critical signals to non-critical signals in the optimization of the critical path delay of FPGA chips. The present invention provides a Boolean function reconstruction solution method, and the optimization of the critical path delay of FPGA chips is based on certain restrictions. The continuous lookup table of the input outputs a continuous lookup table combination of all possible input signal rearrangements that meet the restricted conditions, which is convenient for users to integrate; outputs a continuous lookup table combination of all possible input signal rearrangements, which is convenient for users to select the best solution. By expressing the truth table with the help of the co-formula, all basic operations are implemented using bit operations, and all intermediate variables except the necessary queue storage are stored in integer variables of corresponding digits. In practice, compared with the general optimization method for the critical path delay of FPGA chips, the running speed of the optimization of the critical path delay of FPGA chips can be doubled under the same memory resources. Under the same number of parallel operations, the memory consumption of the optimization of the critical path delay of FPGA chips can be reduced by orders of magnitude. Compared with the existing optimization methods for the critical path delay of FPGA chips, in terms of storage, the Boolean function reconstruction solver for the optimization of the critical path delay of FPGA chips does not need to construct a two-dimensional vector, and only uses integer values of different bit widths for intermediate storage, thereby reducing the storage space by orders of magnitude; in terms of operating efficiency, the Boolean function reconstruction solver for the optimization of the critical path delay of FPGA chips uses bit operations as the basic operation method, and adopts multi-threading means, and multiple solutions are performed simultaneously. At the same time, it also supports irrelevant input combination calculations without additional steps, further improving the efficiency of optimizing the critical path delay of FPGA chips.
[0078] According to an embodiment of the present invention, an embodiment of a Boolean function reconstruction solution method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0079] In this embodiment, a Boolean function reconstruction and solving method is provided, which can be used in the above-mentioned computer device and applied to FPGA. Figure 2 is a flow chart of a Boolean function reconstruction solution method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0080] Step S201, obtaining a first initial lookup table, a second initial lookup table and constraint conditions.
[0081] In an embodiment of the present invention, the output signal of the first initial lookup table is used as the input signal of one of the second initial lookup tables, the constraint condition is used to limit the number of input signals of the first target lookup table and the second target lookup table respectively, and at least one target input signal is input through a predetermined input port, at least one target input signal is one or more input signals in the first target lookup table, and / or at least one target input signal is one or more input signals in the second target lookup table; the output signal of the first target lookup table is used as the input signal to one of the second target lookup tables.
[0082] In one example, LUTA is used as the first initial lookup table, LUTB is used as the second initial lookup table, LUTC is used as the first target lookup table, and LUTD is used as the second target lookup table: the input is a set of continuous LUTA and LUTB, wherein the output of LUTA is connected to the input of LUTB; the constraint condition is the input of LUTC and LUTD (including the number of inputs and the connection of input signals with specific input ports), for example, the number of inputs of LUTC and LUTD is required to be not less than 2 at least and not more than 5 at most, or an input signal a is fixedly connected to the 0 bit of LUTC. The specific content of the constraint condition is not limited in the present invention.
[0083] Step S202, based on the output signal of the first initial lookup table, the input bit of the second initial lookup table corresponding to the output signal, the pre-constructed mask table, the truth table of the second initial lookup table, and the number of input signals of the second initial lookup table, calculate the co-formula of the second initial lookup table.
[0084] In one example, based on the input continuous LUTA and LUTB, the co-formula of LUTB is calculated. Based on the truth table of LUTA and the co-formula of LUTB, the Boolean function of continuous LUTA and LUTB can be fully represented by LUTA and the co-formula of LUTB. The advantage is that the storage space can be greatly reduced and the subsequent bit operations are convenient.
[0085] Specifically, an n-input LUTA can be regarded as a Boolean function of n variables, and a Boolean function can be represented by a 2n-bit truth table (for example, a Boolean function f = a&b has 2 variables and a truth table of 1000). Generally, LUTA and LUTB both have 6 inputs. Excluding the inputs directly connected to LUTA and LUTB, a set of continuous LUTA and LUTB represents a Boolean function of 11 variables. Therefore, if the Boolean function is to be fully and explicitly stored, at least 211 bits of space will be required. However, in the embodiment of the present invention, only the truth table of LUTA and the co-formula of LUTB need to be stored (taking 6-input LUT as an example), and the required storage space is 64 bits and 32 bits × 2, respectively, for a total of 128 bits (the co-formula of LUTB has two different co-formulas when the LUTA output is 0 or 1, and the storage space required for each co-formula is 32 bits). This storage advantage is particularly obvious in multi-threaded computing.
[0086] Step S203 , traversing the input signal of the first initial lookup table and the input signal of the second initial lookup table respectively, and recording the shared input signal of the first initial lookup table and the second initial lookup table.
[0087] In one example, after the remainder calculation is completed, the inputs of LUTA and LUTB are traversed, and their shared inputs are recorded in a specific form for subsequent solution steps.
[0088] Specifically, for a simple example, LUTA and LUTB are two 3-input LUTs respectively. The Boolean function represented by such a set of continuous LUTA and LUTB can be regarded as a 5-variable Boolean function F, and the input signal of the variable Boolean function F is recorded as: {a, b, c, d, e}. Assuming that the 0-bit signal of LUTA and the 2-bit signal of LUTB are shared, an input signal a is connected to the 0-bit of LUTA and the 2-bit of LUTB respectively, that is, the lowest bit and the highest bit in the corresponding variable Boolean function F, and the input signal of the variable Boolean function F can be recorded as: {a, b, c, d, a}. The above signals are only used as examples for easy understanding, and the input signals of the first initial lookup table and the second initial lookup table are not limited in the present invention.
[0089] Step S204, based on the input signals of the first initial lookup table, the input signals of the second initial lookup table and the constraints, determine the input signal number distribution of the first target lookup table and the second target lookup table and the input signal combination corresponding to the input signal number distribution.
[0090] In one example, an enumeration method is used to determine the input signal number distribution of the first target lookup table and the second target lookup table and the input signal combination corresponding to the input signal number distribution. The number of inputs of LUTC and LUTD is enumerated according to the constraint conditions (for example, the lower limit of the input is set to 2 and the upper limit is set to 6. Then, for a group of LUTA with 3 inputs and LUTB with 4 inputs, the following combinations {3 input LUTC, 4 input LUTD}, {4 input LUTC, 3 input LUTD}, {2 input LUTC, 5 input LUTD}, {5 input LUTC, 2 input LUTD}) are enumerated. Based on the result of each enumeration, all possible input signal combinations are enumerated (for example, for LUTC with 2 inputs, assuming that there are 3 total input signals, then all possible input signal combinations of LUTC are {[1, 2], [1, 3], [2, 3]}, and the signal combination does not care about the order). The above is used as an example for easy understanding. The number of input signals and the input signal combination of the first target lookup table and the second target lookup table are not limited in the present invention.
[0091] Step S205 , inputting each input signal number distribution and the input signal combination corresponding to the input signal number distribution into different threads.
[0092] In one example, during the enumeration process of the above steps, all signal combinations are added to the multi-thread solution queue.
[0093] Step S206, based on the remainder of the second initial lookup table and the shared input signal of the first initial lookup table and the second initial lookup table, multi-threaded solution is performed on each thread to obtain all combinations of the first target lookup table and the second target lookup table, so as to optimize the FPGA critical path delay by utilizing all combinations of the first target lookup table and the second target lookup table.
[0094] In one example, a multi-threaded solution is performed, and after the solution is completed, a set of all legal (constraint-satisfying and functionally equivalent to LUTA and LUTB combinations) LUTC and LUTD combinations can be obtained.
[0095] In one implementation scenario, Figure 3 FIG. 1 is a flow chart of a working method of a Boolean function reconstruction solver according to an embodiment of the present invention. Figure 3As shown, the input of the solver is a set of continuous LUTA and LUTB, where the output of LUTA is connected to the input of LUTB, and the constraints are the inputs of LUTC and LUTD (including the number of inputs and the connection of input signals to specific input ports), for example, the number of inputs of LUTC and LUTD is required to be no less than 2 and no more than 5, or an input signal a is fixedly connected to the 0 bit of LUTC. After the solver solves, all LUTC and LUTD combinations that meet the constraints and have the same functions as the combination of LUTA and LUTB are obtained.
[0096] Figure 4 FIG. 1 is a schematic diagram of the internal operation of a Boolean function reconstruction solver according to an embodiment of the present invention. Figure 4 As shown, based on the continuous input LUTA and LUTB, the cofactor of LUTB is calculated. After the cofactor calculation is completed, the inputs of LUTA and LUTB will be traversed, and their shared inputs will be recorded in a specific form. Then the number of inputs of LUTC and LUTD will be enumerated according to the constraints. Based on the results of each enumeration, all possible input signal combinations will be enumerated, and all signal combinations will be added to the multi-threaded solution queue during the enumeration process. Then the multi-threaded solution is executed, and after the solution is completed, a set of all legal (and satisfying the constraints and functionally equivalent to the LUTA, LUTB combination) LUTC, LUTD combinations can be obtained.
[0097] The Boolean function reconstruction solution method provided in this embodiment optimizes the critical path delay of the FPGA chip by outputting a continuous lookup table combination of all possible input signal rearrangements that meet the limited conditions based on certain restrictions, which is convenient for users to integrate; outputs a continuous lookup table combination of all possible input signal rearrangements, which is convenient for users to select the best solution. By expressing the truth table with the help of the co-formula, all basic operations are implemented using bit operations, and all intermediate variables except necessary queue storage are stored in integer variables of corresponding bits. In practice, compared with the general optimization method for the critical path delay of the FPGA chip, the running speed of the optimization of the critical path delay of the FPGA chip can be doubled under the same memory resources. Under the same number of parallel operations, the memory consumption of the optimization of the critical path delay of the FPGA chip can be reduced by orders of magnitude. Compared with the existing optimization methods for the critical path delay of FPGA chips, in terms of storage, the Boolean function reconstruction solver for the optimization of the critical path delay of FPGA chips does not need to construct a two-dimensional vector, and only uses integer values of different bit widths for intermediate storage, thereby reducing the storage space by orders of magnitude; in terms of operating efficiency, the Boolean function reconstruction solver for the optimization of the critical path delay of FPGA chips uses bit operations as the basic operation method, and adopts multi-threading means, and multiple solutions are performed simultaneously. At the same time, it also supports irrelevant input combination calculations without additional steps, further improving the efficiency of optimizing the critical path delay of FPGA chips.
[0098] In this embodiment, a Boolean function reconstruction and solving method is provided, which can be used in the above-mentioned computer device and applied to FPGA. Figure 5 is a flowchart of another Boolean function reconstruction solution method according to an embodiment of the present invention. Figure 5 As shown, the process includes the following steps:
[0099] Step S501, obtain the first initial lookup table, the second initial lookup table and the constraint conditions. Figure 2 Step S201 of the illustrated embodiment will not be described in detail here.
[0100] Step S502, based on the output signal of the first initial lookup table, the input bit of the second initial lookup table corresponding to the output signal, the pre-constructed mask table, the truth table of the second initial lookup table, and the number of input signals of the second initial lookup table, calculate the co-formula of the second initial lookup table.
[0101] Specifically, the above step S502 includes:
[0102] Step S5021, based on the output value of the output signal of the first initial lookup table and the input bit of the second initial lookup table corresponding to the output signal, the mask table is initialized to obtain an initial mask.
[0103] Step S5022: Perform bitwise operation using the initial mask, the truth table of the second initial lookup table, the bits, and the number of input signals of the second initial lookup table to obtain a cofactor of the second initial lookup table.
[0104] In some optional implementations, the above step S5022 includes:
[0105] Step a1, performing a bitwise AND operation on the initial mask and the truth table of the second initial lookup table to obtain an intermediate value.
[0106] Step a2, using the output signal of the second initial lookup table connected to the bit position of the input signal of the second initial lookup table and the number of input signals of the second initial lookup table, combined with the initial mask, cyclically solve the intermediate value to obtain the intermediate value after the cycle.
[0107] Step a3, shifting the intermediate value after the loop to obtain the remainder of the second initial lookup table.
[0108] In one example, Figure 6 FIG. 1 is a flow chart of a method for calculating a cofactor of a second initial lookup table according to an embodiment of the present invention. Figure 6 As shown, the calculation of the co-formula of the second initial lookup table includes: The calculation of the co-formula of LUTB can be simply understood as: when the output of LUTA is 0 and the output of LUTA is 1, the truth table of LUTB.
[0109] The output information of LUTA includes the output value of LUTA (0 or 1) and the bit of the input signal of LUTB to which the output of LUTA is connected. The mask table is a pre-constructed set of masks (essentially binary numbers), which is specifically suitable for LUTs with 6 inputs or less (because in practice the number of LUT inputs is generally 6 or less, and each mask can be stored in a 64-bit integer variable). The mask table is specifically {aaaaaaaaaaaaaaaaaa,cccccccccccccccc, f0f0f0f0f0f0f0f0f0, ff00ff00ff00ff00, ffff0000ffff0000,ffffffff00000000} (indicated in hexadecimal for ease of writing. In addition, the mask table can be easily extended to 7, 8 or even more inputs. The extension method follows: the 0th bit is repeated 10, the first bit is repeated 1100, the second bit is repeated 11110000, and the nth bit is repeated 2n 1s plus 2n 0s, and all repetitions are filled until 2n + 1 bits are filled). There are 6 masks in the mask table, each corresponding to an input bit of LUTB (applicable when the LUTB input is less than or equal to 6).
[0110] The mask can be initialized based on the bit of the LUTB input signal connected to the LUTA output and the LUTA output signal. Since the LUTA output has two possibilities, 0 and 1, the mask of the bit of the LUTB input signal corresponding to the LUTA output signal in the mask table is obtained. When the LUTA output is 0, each bit of the mask is inverted; when the LUTA output is 1, the mask remains unchanged to obtain the initial mask. Then, the initial mask is bitwise ANDed with the truth table of LUTB to obtain the intermediate value of the final result. The intermediate value is looped as follows:
[0111] i in range ( index , inputsize -1):
[0112] mid = mid ^( mid <<(1<< i ))
[0113] mid =mid & masklist [ i +1]
[0114] in, index The bit indicating that the output of LUTA is connected to LUTB, inputsize is the number of LUTB inputs, mid is the middle value, masklist is the mask table. The specific operation of looping over the intermediate values is: set an intermediate value to mid , based on the mask table and the bits of LUTA output connected to LUTB, the cyclic operation is updated mid The loop count value is i ,from i=index Start to i =The number of inputs of LUTB - 1, each cycle i +1. Each time the loop is repeated, the original mid Shift value left (1<< i ) bit gets a new mid value, and then the new mid Value and original mid Bitwise i Or the operation is updated to mid value, and finally the updated mid The value is the same as the first i +1 bit performs bitwise AND operation and updates the result to mid middle.
[0115] After completing the above cycle, perform the following operations:
[0116] result=mid >>(1<< inputsize -1)
[0117] in, Result It is the cofactor of LUTB under a LUTA output. Result It is the co-formula of LUTB when the LUTA output is 0 or 1 (there is one co-formula for output 0 and one for output 1 respectively). Result The calculation is obtained by looping through the above mid Shift value right In order to obtain the complete remainder of LUTB, the above processing is performed for the cases where LUTA output is 0 and 1 respectively. The above steps are completely completed through bit operations with extremely high operating efficiency. When solving multiple groups of LUTA and LUTB combinations continuously, the advantage is more obvious.
[0118] In this method, the mask table is initialized by using the output information of the first initial lookup table, and the initialization mask is used to obtain the co-factor of the second initial lookup table through bit operations, which has extremely high operating efficiency. When solving multiple combinations of the first initial lookup table and the second initial lookup table in succession, the advantage is more obvious. The initial mask table is bitwise ANDed with the truth table of the second initial lookup table, and the solution is cyclically solved and moved to obtain the co-factor of the second initial lookup table, which is convenient for subsequent calculation using the co-factor of the second initial lookup table.
[0119] Step S503, respectively traverse the input signal of the first initial lookup table and the input signal of the second initial lookup table, and record the shared input signal of the first initial lookup table and the second initial lookup table. Figure 2 Step S203 of the illustrated embodiment will not be described in detail here.
[0120] Step S504: Based on the input signals of the first initial lookup table, the input signals of the second initial lookup table and the constraint conditions, determine the input signal number distribution of the first target lookup table and the second target lookup table and the input signal combination corresponding to the input signal number distribution. Figure 2 Step S204 of the illustrated embodiment will not be described in detail here.
[0121] Step S505: input each input signal number distribution and the input signal combination corresponding to the input signal number distribution into different threads. Figure 2 Step S205 of the illustrated embodiment will not be described in detail here.
[0122] Step S506: Based on the co-formula of the second initial lookup table and the shared input signal of the first initial lookup table and the second initial lookup table, multi-threaded solution is performed on each thread to obtain all combinations of the first target lookup table and the second target lookup table, so as to optimize the FPGA critical path delay by using all combinations of the first target lookup table and the second target lookup table. For details, please refer to Figure 2 Step S206 of the illustrated embodiment will not be described in detail here.
[0123] The Boolean function reconstruction and solving method provided in this embodiment uses the output information of the first initial lookup table to initialize the mask table, and uses the initialization mask to obtain the co-factor of the second initial lookup table through bit operations. It has extremely high operating efficiency, and the advantage is more obvious when solving multiple groups of combinations of the first initial lookup table and the second initial lookup table in succession. The initial mask table is bitwise ANDed with the truth table of the second initial lookup table, and the solution is cyclically solved and moved to obtain the co-factor of the second initial lookup table, which is convenient for subsequent calculation using the co-factor of the second initial lookup table.
[0124] In this embodiment, a Boolean function reconstruction and solving method is provided, which can be used in the above-mentioned computer device and applied to FPGA. Figure 7 is a flowchart of another Boolean function reconstruction solution method according to an embodiment of the present invention. Figure 7 As shown, the process includes the following steps:
[0125] Step S701, obtain the first initial lookup table, the second initial lookup table and the constraint conditions. Figure 5 Step S501 of the illustrated embodiment will not be described in detail here.
[0126] Step S702, based on the output signal of the first initial lookup table, the input bit of the second initial lookup table corresponding to the output signal, the pre-built mask table, the truth table of the second initial lookup table, and the number of input signals of the second initial lookup table, calculate the co-factor of the second initial lookup table. For details, please refer to Figure 5 Step S502 of the illustrated embodiment will not be described in detail here.
[0127] Step S703, respectively traverse the input signal of the first initial lookup table and the input signal of the second initial lookup table, and record the shared input signal of the first initial lookup table and the second initial lookup table. Figure 5 Step S503 of the illustrated embodiment will not be described in detail here.
[0128] Step S704: Based on the input signals of the first initial lookup table, the input signals of the second initial lookup table and the constraint conditions, determine the input signal number distribution of the first target lookup table and the second target lookup table and the input signal combination corresponding to the input signal number distribution. Figure 5 Step S504 of the illustrated embodiment will not be described in detail here.
[0129] Step S705: input each input signal number distribution and the input signal combination corresponding to the input signal number distribution into different threads. Figure 5 Step S505 of the illustrated embodiment will not be described in detail here.
[0130] Step S706, based on the remainder of the second initial lookup table and the shared input signal of the first initial lookup table and the second initial lookup table, multi-threaded solution is performed on each thread to obtain all combinations of the first target lookup table and the second target lookup table, so as to optimize the FPGA critical path delay by utilizing all combinations of the first target lookup table and the second target lookup table.
[0131] Specifically, the above step S706 includes:
[0132] Step S7061 : determining a shared input signal between the first target lookup table and the second target lookup table based on a shared input signal between the first initial lookup table and the second initial lookup table.
[0133] Step S7062: constructing an irrelevant input combination for the first target lookup table based on the shared input signal of the first target lookup table and the second target lookup table to obtain an irrelevant input combination of the first target lookup table.
[0134] Step S7063, and based on the shared input signal of the first target lookup table and the second target lookup table, construct an irrelevant input combination for the second target lookup table to obtain an irrelevant input combination of the second target lookup table.
[0135] Step S7064, constructing a co-formula of the second target lookup table based on the input signal combination of the first target lookup table, the input signal combination of the second target lookup table, the irrelevant input combination of the first target lookup table, and the irrelevant input combination of the second target lookup table.
[0136] Step S7065, checking whether the remainder of the second target lookup table is constructed successfully.
[0137] In some optional implementations, the above step S7065 includes:
[0138] Step b1, based on the irrelevant input combinations in the first target lookup table, traverse all input signal combinations in the first target lookup table, and eliminate all irrelevant input combinations in the first target lookup table.
[0139] Step b2, based on the irrelevant input combinations of the second target lookup table, traverse the input signal combinations of the second target lookup table corresponding to the second target lookup table, and construct the co-factor and irrelevant input combination mask of the second target lookup table corresponding to the first target lookup table.
[0140] Step b3: based on the irrelevant input combination mask, determine whether the number of independent co-factors corresponding to the second target lookup table is less than or equal to 2.
[0141] In some optional implementations, the above step b3 includes:
[0142] Step b31, determining whether the queue for recording the remainder of the second target lookup table is empty.
[0143] Step b32: when the queue for recording the co-factor of the second target lookup table is empty, add the co-factor of the second target lookup table and the irrelevant input combination mask corresponding to the co-factor of the second target lookup table into the queue.
[0144] Step b33, determine whether the length of the queue is less than or equal to 2.
[0145] Step b34: when the length of the queue is less than or equal to 2, confirm that the number of independent co-factors corresponding to the second target lookup table is less than or equal to 2.
[0146] Step b35, or, when the queue for recording the co-factor of the second target lookup table is not empty, determine whether the co-factor of the second target lookup table is independent.
[0147] Step b36, when the co-factor of the second target lookup table is independent, add the co-factor of the second target lookup table and the corresponding mask to the queue.
[0148] Step b37, determine whether the length of the queue is less than or equal to 2.
[0149] Step b38, when the length of the queue is less than or equal to 2, confirm that the number of independent co-factors corresponding to the second target lookup table is less than or equal to 2.
[0150] Step b4: when the number of independent co-factors corresponding to the second target lookup table is greater than 2, it is determined that the construction of the co-factor of the second target lookup table fails.
[0151] Step b5, or, when the number of independent co-factors corresponding to the second target lookup table is less than or equal to 2, the independent co-factors corresponding to the second target lookup table are combined to obtain the co-factors of the second target lookup table.
[0152] Step S7066, when the co-formula of the second target lookup table is constructed successfully, a truth table of the first target lookup table is constructed based on the co-formula of the second target lookup table.
[0153] Step S7067, based on the remainder of the second target lookup table and the truth table of the first target lookup table, generate the truth table of the second target lookup table, and use the input signal number distribution of the first target lookup table and the input signal combination corresponding to the input signal number distribution, the input signal number distribution of the second target lookup table and the input signal combination corresponding to the input signal number distribution, the truth table of the first target lookup table and the truth table of the second target lookup table as the combination of all the first target lookup tables and the second target lookup tables, respectively.
[0154] Step S7068: when the co-minor of the target output lookup table is not successfully constructed, it is determined that there is no legal combination of the first target lookup table and the second target lookup table.
[0155] In one example, Figure 8 is a schematic diagram of a multi-threaded solution process according to an embodiment of the present invention, such as Figure 8 As shown, the input of the multi-threaded solution is the number of input signals of LUTC and LUTD and their allocation method. The output is the truth table of LUTC and LUTD under the allocation method when there is a legal solution (wherein the input signal and the truth table can be determined by the function of LUT). If there is no legal solution, it ends directly. As a general solver, the sorting problem when a LUT input signal is determined is not considered (for example, there are two signals a and b, as the input signal of a 2-input LUT, then 0 bits are connected to a, 1 bits are connected to b, or 0 bits are connected to b, 1 bits are connected to a, and 1 bits are connected to a. It is equivalent in this scheme because the exact same function can be achieved by changing the truth table). Therefore, only the input signals allocated to LUTC and LUTD are considered, and then each bit of the input signal of LUTC and LUTD is connected to a certain signal. Based on the shared input obtained in the record shared input link in the above steps, the DC of LUTC (don't-care, which can be understood as "irrelevant input combination" in Boolean functions, for example, a 2-input Boolean function has inputs e and f and is limited to e = f, then e = 0, f = 1, and e = 1, f = 0 are both DC because they will never appear) and the DC of LUTD are calculated respectively; then the LUTD cofactor is constructed. If the construction is legal, it means that there are legal LUTC and LUTD under the input signal distribution mode, so as to further construct its truth table, and store this set of LUTC and LUTD in the combination of the first target lookup table and the second target lookup table of the final output.
[0156] Among them, DC construction includes DC construction of LUTC and DC construction of LUTD. Its construction method requires the use of input signal allocation to LUTC and LUTD and the shared input of LUTA and LUTB recorded in the shared input process. The connection method of each bit between all input signals and F represented by LUTA and LUTB is called the original connection method. For the convenience of description, the original connection method is represented by {}. For a simple example, {a, b, c, d, e} is a connection method. The size of this set is 5, and the bits from left to right are 0-4. Assuming that the input signals of 0 bits and 4 bits are shared, a new set of connection methods can be obtained, called shared connection methods, {a, b, c, d, a}. The signal allocation method of LUTC and LUTD is recorded in a similar way. Assuming that the inputs of LUTC and LUTD are both 3, and LUTD has an output whose input is LUTC, the signals allocated to LUTC and LUTD are 3 and 2 respectively. For example, if the signal assigned to LUTC is {a, b, e}, then based on the shared connection mode, the input of LUTC in the shared connection mode can be obtained as {a, b, a}, and the 0 bit and 2 bit inputs of LUTC are the same, thereby obtaining a pair group {0, 2} for recording the DC of LUT, indicating that the corresponding bit inputs of the LUT are the same. Based on the input signal allocation of LUTC and LUTD and the shared connection mode of F, queues for LUTC and LUTD to store pairs describing DC will be obtained respectively.
[0157] Fig. 9 is a schematic diagram of a flow chart of construction and checking of a remainder formula according to an embodiment of the present invention, such as Fig. 9As shown, the construction and checking of the co-factor includes: the input of this link is LUTC, LUTD and its assigned signal and DC, and the co-factor of LUTD is output when there is a legal LUTD co-factor, otherwise it ends directly. After getting the input, first traverse all the input conditions of LUTC (all input conditions are combinations of all inputs, such as a three-input LUT, all its input combinations are 000, 001, 010, 011, 100, 101, 110, 111). In the traversal process, based on the DC pair group obtained in the previous link, skip all DC situations. For example, assuming that a DC pair group of LUTC is {0, 2}, that is, the 0-bit and 2-bit inputs of LUTC are from the same signal, then it is obvious that the four input conditions of 001, 011, 100, and 110 will never appear in the input of LUTC, so such conditions can be directly skipped during the loop traversal process. Each time you traverse an input situation of LUTC, you need to completely traverse the input situation of LUTD once, so as to construct the co-factor and DC mask of LUTD under the input situation of LUTC. After traversing the input situation of LUTD, you can get the corresponding co-factor and DC mask. Next, with the help of the DC mask, determine whether the number of independent co-factors is less than or equal to 2 (because the output of LUTC has only two possibilities of 0 or 1, each output situation corresponds to a co-factor, so the number of independent co-factors must be less than or equal to 2). If not, it ends directly, and the combination of LUTC and LUTD has no solution. If all LUTC inputs are satisfied after traversing, the number of independent co-factors of LUTD is less than or equal to 2, then the combination has a solution, and the co-factor of LUTD is returned.
[0158] Specifically, the method of traversing the LUTD input to construct the DC mask and the LUTD cofactor is as follows:
[0159] DCmask = 0, LUTDcofactor = 0
[0160] i in range (0,1<< LUTDinputsize ):
[0161] if DC exists :
[0162] DCmask = DCmask |( 1<<i )
[0163] else :
[0164] func_id = get_enable ( i , iter )
[0165] LUTAid = getLUTAId ( func_id )
[0166] LUTBid = getLUTBId ( func_id )
[0167] LUTAout = ( LUTAfunc >> LUTAid )&1
[0168] LUTDout = ( LUTBcofactor [ LUTAout ]>> LUTBid )& 1
[0169] LUTDcofactor = LUTDcofactor | ( LUTDout << i )
[0170] in, DCmask is the DC mask, LUTDcofactor is the coformula of LUTD, LUTDinputsize is the number of input signals of LUTD, LUTAout For the analog output of LUTA, LUTAfunc is the truth table of LUTA, LUTDout is the output of LUTD, LUTBcofactor is the coformula of LUTB, LUTAid as well as LUTBid Transform the hypothesis into LUTC and LUTD Specifically, assuming that the input numbers of {a, b, c, d, e} are {0, 1, 2, 3, 4}, they are converted to {b, d, a, c, e} and then to {1, 3, 0, 2, 4}. 0 indicates that the signal is disabled and 1 indicates that the signal is enabled. Assuming that the enable status of the signal {a, b, c, d, e} is {0, 1, 1, 0, 1}, the corresponding LUTAid That is 100 (the enabling conditions corresponding to 1, 3, and 0), LUTBid That is 11 (the enabling conditions corresponding to 2 and 4). The enabling conditions are added by adding a line of code func_id = get_enable ( i, iter ) recorded in func_id Among them i That is, to traverse all possible codes of LUTD input i , iter That is, to traverse all possible LUTC inputs iter, which is not recorded in the code because it is used to describe the code for generating a LUTD cofactor. For each LUTC input condition, a LUTD cofactor must be constructed, and the number of cofactors must not exceed 2. The input condition is the enable condition of the input signal, so the enable condition can be easily obtained.
[0171] Traversing the LUTD input to construct the DC mask and LUTD cofactor specifically includes: first, DCmask as well as LUTDcofactor Initialize to 0; then enter the loop to traverse all LUTD input conditions, for each input condition: if DC exists, then update the DC mask by adding the original DC mask to the Perform a bitwise OR operation; if DC does not exist, perform a remainder calculation, the calculation method is to first obtain the input signal enable status, and LUTAid and LUTBid ; Then calculate the simulated output of LUTA LUTAout , calculated by shifting the truth table of LUTA to the left LUTAid Then perform a bitwise AND operation with 1; based on the obtained LUTAout calculate LUTDout , the calculation method is based on LUTAout Find the cofactor corresponding to LUTB and shift right LUTBid The last bit is ANDed with 1. LUTDout Record the LUTD remainder, that is LUTDcofactor The recording method is LUTDcofactor and LUTDout Shift Left i The analog output value of LUTA is determined in each round when the input conditions of LUTC and LUTD are determined. The use of this value is due to the use of the LUTB cofactor and LUTAfunc To represent the function F constructed by LUTA and LUTB, therefore, in order to determine the output of the final function F and thus obtain the output LUTDout of LUTD, it is necessary to first simulate the value of LUTA under the determined LUTC and LUTD input conditions. The simulation method can be understood by referring to the following example. Assuming that LUTA and LUTB both have 3 inputs, they can represent a 5-input function F.
[0172] Fig.10 is a schematic diagram of a first initial lookup table and a second initial lookup table, and input signals of the first initial lookup table and the second initial lookup table according to an embodiment of the present invention, such as Fig.10As shown, when the inputs of LUTC and LUTD are known, that is, the values of each signal of abcde are known, the corresponding inputs of LUTA and LUTB can be obtained, so that the output of LUTA can be obtained as LUTAout. Afterwards, since the function implemented by LUTC and LUTD is also F, LUTDout must be the same as the output of LUTB (that is, the output of F) when the input signal values of abcde are determined, and the output of LUTB can be combined with the cofactor of LUTB and the output of LUTA through the second to last line of the above pseudo code ( LUTDout = ( LUTBcofactor [ LUTAout ]>> LUTBid )& 1 ) is obtained. The output of LUTB is also the output of LUTD, and is also the value of the ith cofactor of LUTD. Finally, the last line of the pseudocode ( LUTDcofactor = LUTDcofactor | ( LUTDout << i )) Record this bit in the final LUTDcofactor (the remainder of LUTD).
[0173] In addition, the DC existence judgment condition in the above pseudo code is still based on the above DC pair judgment. Fig.10 For example, assuming that signal a and signal e are homologous signals, the input values of a and e must be the same, and a pair of {2, 4} can be obtained, indicating that the second bit and the fourth bit of the function F have the same input. Therefore, during the traversal process, if the second bit and the fourth bit have different values, the corresponding DC is recorded. It should be noted that the DCmask here only depends on i when updating, because the DCmask is essentially a mask acting on the LUTD co-factor, which will be used when determining the total number of co-factors later.
[0174] Fig.11 FIG. 1 is a flow chart of a method for determining the total number of remainder formulas according to an embodiment of the present invention. Fig.11As shown, the judgment of the total number of co-formulas includes: after obtaining a co-formula of LUTD and its corresponding DC mask, first determine whether the queue for recording the co-formula of LUTD is empty: if it is empty, directly add the co-formula of LUTD and its corresponding DC mask to the queue, and then traverse the next LUTC input situation to synchronously build the LUTC truth table. If the co-formula of LUTD already exists, determine whether the co-formula of LUTD is independent: if the co-formula of LUTD is independent, add it to the co-formula queue of LUTD; if the length of the co-formula queue of LUTD is greater than 2, end directly; if it is less than or equal to 2, traverse the next LUTC input situation to synchronously build the LUTC truth table. If the co-formula of LUTD is not independent, update the co-formula of LUTD and its corresponding DC mask. Among them, the method for judging the independence of the co-formula and the method for updating the co-formula and its corresponding DC mask in the queue when the co-formula of LUTD is not an independent co-formula are:
[0175] for pair in list :
[0176] cofactor = pair. firs t
[0177] mask = pair.second
[0178] if (( newcofactor &~ mask ) == ( cofactor &~ newmask )):
[0179] cofactor = cofactor | newcofactor
[0180] mask = mask & newmask
[0181] return true
[0182] in, cofactor is the coformula of LUTD, newcofactor is the cofactor that needs to be judged to be an independent cofactor, newmask The DC mask corresponding to the co-factor that needs to be judged as an independent co-factor. In the above pseudo code, the pair stores the co-factors and the corresponding DC masks that have been recorded in the queue list. newcofactor as well as newmask They are the co-factors that need to be judged as independent co-factors and their corresponding masks, pair is the meaning of the group, a pair There are two values, the first value is recorded as pair.first, the second value is recorded as pair.second The update method specifically includes: list is a list containing a series of pair , pair The first value in is the cofactor, and the second value is the mask. For a new set of cofactors newcofactor And the new mask newmask If satisfied newcofactor and mask The result of the bitwise AND operation is equal to cofactor and newmask If the result of the non-bitwise AND operation is equal, update cofactor and mask ,in cofactor The update method is to cofactor and newcofactor Perform a bitwise OR operation, mask The update method is to mask and newmask Perform a bitwise AND operation.
[0183] The synchronous construction of the LUTC truth table includes: each time a LUTC input situation is traversed, the bit of the LUTC truth table corresponding to the input situation is obtained; at the same time, if the cofactor of LUTD is successfully constructed, then there are at most two cofactors in the cofactor queue of LUTD, and the bit value corresponding to the input situation of the LUTC that generates the cofactor equivalent to the first cofactor is set to a, and the bit value corresponding to the input situation of the LUTC that generates the cofactor equivalent to the second cofactor is set to b, a≠b (a= 0 or 1, b = 0 or 1). In this way, the construction of the LUTC truth table can be gradually completed in the process of traversing each round of LUTC input.
[0184] After obtaining the truth table of LUTC and the cofactor of LUTD, the truth table of LUTD can be constructed based on the truth table of LUTC and the cofactor of LUTD. The cofactor of LUTD corresponding to the LUTC output of 0 is used as the low bit, and the cofactor of LUTD corresponding to the output of 1 is used as the high bit. The truth table of LUTD can be obtained by merging the two cofactors. However, it should be noted that this method of merging to obtain the truth table of LUTD requires that the output port of LUTC be fixedly connected to the highest bit of LUTD first. At this point, a legal solution for the combination of LUTC and LUTD is completed.
[0185] In the present embodiment, a Boolean function reconstruction and solving device is also provided, and the device is used to implement the above-mentioned embodiment and preferred implementation mode, and the description has been made no further. 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 conceived.
[0186] This embodiment provides a Boolean function reconstruction and solving device, such as Fig.12 As shown, including:
[0187] The data acquisition module 1201 is used to acquire the first initial lookup table, the second initial lookup table and the constraint condition, the output signal of the first initial lookup table is used as the input signal of one of the second initial lookup tables, the constraint condition is used to limit the number of input signals of the first target lookup table and the second target lookup table respectively, and at least one target input signal is input through a predetermined input port, at least one target input signal is one or more input signals in the first target lookup table, and / or at least one target input signal is one or more input signals in the second target lookup table; the output signal of the first target lookup table is used as the input signal to one of the second target lookup tables. For details, please refer to Figure 2 Step S201 of the illustrated embodiment will not be described in detail here.
[0188] The cofactor calculation module 1202 is used to calculate the cofactor of the second initial lookup table based on the output signal of the first initial lookup table, the input bit of the second initial lookup table corresponding to the output signal, the pre-built mask table, the truth table of the second initial lookup table, and the number of input signals of the second initial lookup table. For details, please refer to Figure 2 Step S202 of the illustrated embodiment will not be described in detail here.
[0189] The shared input recording module 1203 is used to traverse the input signal of the first initial lookup table and the input signal of the second initial lookup table respectively, and record the shared input signal of the first initial lookup table and the second initial lookup table. Figure 2 Step S203 of the illustrated embodiment will not be described in detail here.
[0190] The signal combination determination module 1204 is used to determine the input signal number distribution of the first target lookup table and the second target lookup table and the input signal combination corresponding to the input signal number distribution based on the input signal of the first initial lookup table, the input signal of the second initial lookup table and the constraint conditions. For details, please refer to Figure 2 Step S204 of the illustrated embodiment will not be described in detail here.
[0191] The signal combination input module 1205 is used to input each input signal number distribution and the input signal combination corresponding to the input signal number distribution into different threads. Figure 2 Step S205 of the illustrated embodiment will not be described in detail here.
[0192] The lookup table solving module 1206 is used to perform multi-thread solving on each thread based on the co-formula of the second initial lookup table and the shared input signal of the first initial lookup table and the second initial lookup table to obtain all combinations of the first target lookup table and the second target lookup table, so as to optimize the FPGA critical path delay by using all combinations of the first target lookup table and the second target lookup table. For details, please refer to Figure 2 Step S206 of the illustrated embodiment will not be described in detail here.
[0193] In some optional implementations, the remainder calculation module 1202 includes:
[0194] The mask initialization unit is used to initialize the mask table based on the output value of the output signal of the first initial lookup table and the input bit of the second initial lookup table corresponding to the output signal to obtain an initial mask.
[0195] The cofactor calculation unit is used to perform bit operations using the initial mask, the truth table of the second initial lookup table, the bits and the number of input signals of the second initial lookup table to obtain the cofactor of the second initial lookup table.
[0196] In some optional implementations, the cofactor calculation unit includes:
[0197] The intermediate value calculation subunit is used to perform a bitwise AND operation using the initial mask and the truth table of the second initial lookup table to obtain an intermediate value.
[0198] The intermediate value loop solving subunit is used to use the output signal of the second initial lookup table connected to the bit position of the input signal of the second initial lookup table and the number of input signals of the second initial lookup table, combined with the initial mask, to loop solve the intermediate value to obtain the intermediate value after the loop.
[0199] The intermediate value shift subunit is used to shift the intermediate value after the cycle to obtain the remainder of the second initial lookup table.
[0200] In some optional implementations, the lookup table solving module 1206 includes:
[0201] The shared input signal determining unit is used to determine the shared input signal of the first target lookup table and the second target lookup table based on the shared input signal of the first initial lookup table and the second initial lookup table.
[0202] The first irrelevant input signal combination solving unit is used to construct irrelevant input combinations of the first target lookup table based on the shared input signals of the first target lookup table and the second target lookup table to obtain irrelevant input combinations of the first target lookup table.
[0203] The second irrelevant input signal solving unit is used to construct irrelevant input combinations of the second target lookup table based on the shared input signals of the first target lookup table and the second target lookup table to obtain irrelevant input combinations of the second target lookup table.
[0204] The co-formula constructing unit is used to construct a co-formula of the second target lookup table based on the input signal combination of the first target lookup table, the input signal combination of the second target lookup table, the irrelevant input combination of the first target lookup table, and the irrelevant input combination of the second target lookup table.
[0205] The co-factor detection unit is used to check whether the co-factor of the second target lookup table is successfully constructed.
[0206] The co-factor construction success unit is used to construct the truth table of the first target lookup table based on the co-factor of the second target lookup table when the co-factor of the second target lookup table is successfully constructed.
[0207] The target lookup table generating unit is used to generate the truth table of the second target lookup table based on the remainder of the second target lookup table and the truth table of the first target lookup table, and use the input signal number distribution of the first target lookup table and the input signal combination corresponding to the input signal number distribution, the input signal number distribution of the second target lookup table and the input signal combination corresponding to the input signal number distribution, the truth table of the first target lookup table and the truth table of the second target lookup table as the combination of all the first target lookup tables and the second target lookup tables, respectively.
[0208] The co-factor construction failure unit is used to determine that there is no legal combination of the first target lookup table and the second target lookup table when the co-factor of the target output lookup table is unsuccessful in construction.
[0209] In some optional embodiments, the cofactor detection unit includes:
[0210] The irrelevant input combination elimination subunit is used to traverse all input signal combinations of the first target lookup table based on the irrelevant input combinations in the first target lookup table, and eliminate all irrelevant input combinations in the first target lookup table.
[0211] The second target lookup table co-factor construction subunit is used to traverse the input signal combination of the second target lookup table corresponding to the second target lookup table based on the irrelevant input combination of the second target lookup table, and construct the co-factor and irrelevant input combination mask of the second target lookup table corresponding to the first target lookup table.
[0212] The independent co-factor number judging subunit is used to judge whether the number of independent co-factors corresponding to the second target lookup table is less than or equal to 2 based on the irrelevant input combination mask.
[0213] The co-factor construction failure subunit is used to determine that the co-factor construction of the second target lookup table fails when the number of independent co-factors corresponding to the second target lookup table is greater than 2.
[0214] The co-factor constructing success unit is used to, when the number of independent co-factors corresponding to the second target lookup table is less than or equal to 2, combine the independent co-factors corresponding to the second target lookup table to obtain the co-factor of the second target lookup table.
[0215] In some optional implementations, the independent cofactor number determination subunit includes:
[0216] The co-factor queue non-empty judgment subunit is used to judge whether the queue for recording the co-factor of the second target lookup table is empty.
[0217] The first queue adding subunit is used to add the co-formula of the second target lookup table and the irrelevant input combination mask corresponding to the co-formula of the second target lookup table to the queue when the queue for recording the co-formula of the second target lookup table is empty.
[0218] The first queue length determination subunit is used to determine whether the length of the queue is less than or equal to 2.
[0219] The first independent co-factor number determining subunit is used for the subunit, and is used to confirm that the number of independent co-factors corresponding to the second target lookup table is less than or equal to 2 when the length of the queue is less than or equal to 2.
[0220] The co-factor independence judgment subunit is used to, when the queue for recording the co-factor of the second target lookup table is not empty, judge whether the co-factor of the second target lookup table is independent.
[0221] The co-factor updating subunit is used to add the co-factor of the second target lookup table and the corresponding mask into the queue when the co-factor of the second target lookup table is independent.
[0222] The second queue length determination subunit is used to determine whether the length of the queue is less than or equal to 2;
[0223] The co-factor number determining subunit is used to confirm that the number of independent co-factors corresponding to the second target lookup table is less than or equal to 2 when the length of the queue is less than or equal to 2.
[0224] In some optional embodiments, the unit includes:
[0225] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0226] The Boolean function reconstruction and solving device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0227] The embodiment of the present invention also provides a computer device having the above Fig.12 The Boolean function reconstruction solution device shown.
[0228] See also Fig.13 , Fig.13 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Fig.13 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Fig.13 A processor 10 is taken as an example.
[0229] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0230] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0231] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer 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.
[0232] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0233] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Fig.13 The example of connecting through bus is taken in the following.
[0234] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device may be a touch screen.
[0235] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0236] A part of the present invention can be applied as a computer program product, such as a computer program instruction, when it is executed by a computer, through the operation of the computer, the method and / or technical solution according to the present invention can be called or provided. It should be understood by those skilled in the art that the existence form of the computer program instruction in the computer-readable medium includes but is not limited to source files, executable files, installation package files, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to the computer. Although the embodiments of the present invention are described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations all fall within the scope defined by the attached claims.
Claims
1. A Boolean function reconstruction solution method, It is characterized in that Applied to FPGA, the method comprises: Obtaining a first initial lookup table, a second initial lookup table and a constraint condition, wherein an output signal of the first initial lookup table is used as an input signal of one of the second initial lookup tables, wherein the constraint condition is used to limit the number of input signals of the first target lookup table and the second target lookup table respectively, and at least one target input signal is input through a predetermined input port, wherein at least one of the target input signals is one or more input signals in the first target lookup table, and / or at least one of the target input signals is one or more input signals in the second target lookup table; and the output signal of the first target lookup table is used as an input signal to one of the second target lookup tables; Based on the output signal of the first initial lookup table, the input bit of the second initial lookup table corresponding to the output signal, the pre-constructed mask table, the truth table of the second initial lookup table, and the number of input signals of the second initial lookup table, a co-formula of the second initial lookup table is calculated; Traversing the input signals of the first initial lookup table and the input signals of the second initial lookup table respectively, and recording the shared input signals of the first initial lookup table and the second initial lookup table; Determine the input signal number distribution of the first target lookup table and the second target lookup table and the input signal combination corresponding to the input signal number distribution based on the input signal of the first initial lookup table, the input signal of the second initial lookup table and the constraint condition; Inputting each of the input signal number distributions and the input signal combinations corresponding to the input signal number distributions into different threads; Based on the remainder of the second initial lookup table and the shared input signal of the first initial lookup table and the second initial lookup table, multi-threaded solving is performed on each thread to obtain all combinations of the first target lookup table and the second target lookup table, so as to optimize the FPGA critical path delay by utilizing all combinations of the first target lookup table and the second target lookup table.
2. The method according to claim 1, It is characterized in that The co-formula of the second initial lookup table is calculated based on the output signal of the first initial lookup table, the input bit of the second initial lookup table corresponding to the output signal, the pre-constructed mask table, the truth table of the second initial lookup table, and the number of input signals of the second initial lookup table, including: Initializing the mask table based on an output value of an output signal of the first initial lookup table and an input bit of the second initial lookup table corresponding to the output signal to obtain an initial mask; A bit operation is performed using the initial mask, the truth table of the second initial lookup table, the bit positions, and the number of input signals of the second initial lookup table to obtain a cofactor of the second initial lookup table.
3. The method according to claim 2, It is characterized in that The bit operation is performed using the initial mask, the truth table of the second initial lookup table, the bit position and the number of input signals of the second initial lookup table to obtain the remainder of the second initial lookup table, including: Performing a bitwise AND operation on the initial mask and the truth table of the second initial lookup table to obtain an intermediate value; Using the bit positions of the input signals of the second initial lookup table connected to the output signals of the second initial lookup table and the number of the input signals of the second initial lookup table, combined with the initial mask, the intermediate value is cyclically solved to obtain the intermediate value after the cycle; The intermediate value after the loop is shifted to obtain a co-factor of the second initial lookup table.
4. The method according to claim 1, It is characterized in that The method of performing multi-threaded solving on each of the threads based on the co-formula of the second initial lookup table and the shared input signal of the first initial lookup table and the second initial lookup table to obtain all combinations of the first target lookup table and the second target lookup table includes: Determining a shared input signal between the first target lookup table and the second target lookup table based on a shared input signal between the first initial lookup table and the second initial lookup table; Based on the shared input signal of the first target lookup table and the second target lookup table, constructing an irrelevant input combination for the first target lookup table to obtain an irrelevant input combination for the first target lookup table; and constructing an irrelevant input combination of the second target lookup table based on a shared input signal of the first target lookup table and the second target lookup table to obtain an irrelevant input combination of the second target lookup table; constructing a co-formula of the second target lookup table based on a combination of input signals of the first target lookup table, a combination of input signals of the second target lookup table, an irrelevant input combination of the first target lookup table, and an irrelevant input combination of the second target lookup table; Check whether the remainder of the second target lookup table is constructed successfully; When the co-factor of the second target lookup table is successfully constructed, constructing a truth table of the first target lookup table based on the co-factor of the second target lookup table; Based on the co-formula of the second target lookup table and the truth table of the first target lookup table, a truth table of the second target lookup table is generated, and the input signal number distribution of the first target lookup table and the input signal combination corresponding to the input signal number distribution, the input signal number distribution of the second target lookup table and the input signal combination corresponding to the input signal number distribution, the truth table of the first target lookup table and the truth table of the second target lookup table are respectively used as all combinations of the first target lookup table and the second target lookup table; When the co-minor of constructing the target output lookup table is unsuccessful, it is determined that there is no legal combination of the first target lookup table and the second target lookup table.
5. The method according to claim 4, It is characterized in that The checking whether the co-factor of constructing the second target lookup table is successful includes: Based on the irrelevant input combinations in the first target lookup table, traverse all input signal combinations in the first target lookup table, and eliminate all irrelevant input combinations in the first target lookup table; Based on the irrelevant input combinations of the second target lookup table, traverse the input signal combinations of the second target lookup table corresponding to the second target lookup table to construct a co-formula and irrelevant input combination mask of the second target lookup table corresponding to the first target lookup table; Based on the irrelevant input combination mask, determining whether the number of independent co-factors corresponding to the second target lookup table is less than or equal to 2; When the number of independent co-factors corresponding to the second target lookup table is greater than 2, determining that construction of the co-factor of the second target lookup table fails; Alternatively, when the number of independent co-factors corresponding to the second target lookup table is less than or equal to 2, the independent co-factors corresponding to the second target lookup table are combined to obtain the co-factor of the second target lookup table.
6. The method according to claim 5, It is characterized in that The determining, based on the irrelevant input combination mask, whether the number of independent co-factors corresponding to the second target lookup table is less than or equal to 2 includes: Determining whether a queue for recording the remainder of the second target lookup table is empty; When the queue for recording the co-factor of the second target lookup table is empty, adding the co-factor of the second target lookup table and the irrelevant input combination mask corresponding to the co-factor of the second target lookup table to the queue; Determine whether the length of the queue is less than or equal to 2; When the length of the queue is less than or equal to 2, confirming that the number of independent co-factors corresponding to the second target lookup table is less than or equal to 2; Alternatively, when the queue for recording the co-factor of the second target lookup table is not empty, determining whether the co-factor of the second target lookup table is independent; When the co-factor of the second target lookup table is independent, adding the co-factor of the second target lookup table and the corresponding mask to the queue; Determine whether the length of the queue is less than or equal to 2; When the length of the queue is less than or equal to 2, it is confirmed that the number of independent co-factors corresponding to the second target lookup table is less than or equal to 2.
7. A Boolean function reconstruction and solving device, It is characterized in that The device comprises: A data acquisition module, used to acquire a first initial lookup table, a second initial lookup table and a constraint condition, wherein an output signal of the first initial lookup table is used as an input signal of one of the second initial lookup tables, the constraint condition is used to limit the number of input signals of the first target lookup table and the second target lookup table respectively, and at least one target input signal is input through a predetermined input port, at least one of the target input signals is one or more input signals in the first target lookup table, and / or at least one of the target input signals is one or more input signals in the second target lookup table; the output signal of the first target lookup table is used as an input signal to one of the second target lookup tables; a co-factor calculation module, configured to calculate a co-factor of the second initial lookup table based on an output signal of the first initial lookup table, an input bit of the second initial lookup table corresponding to the output signal, a pre-constructed mask table, a truth table of the second initial lookup table, and the number of input signals of the second initial lookup table; A shared input recording module, used to traverse the input signal of the first initial lookup table and the input signal of the second initial lookup table respectively, and record the shared input signal of the first initial lookup table and the second initial lookup table; A signal combination determination module, configured to determine the input signal number distribution of the first target lookup table and the second target lookup table and the input signal combination corresponding to the input signal number distribution based on the input signal of the first initial lookup table, the input signal of the second initial lookup table and the constraint condition; A signal combination input module, used for inputting each of the input signal number distributions and the input signal combination corresponding to the input signal number distributions into different threads; A lookup table solving module is used to perform multi-threaded solving on each of the threads based on the remainder of the second initial lookup table and the shared input signal of the first initial lookup table and the second initial lookup table to obtain all combinations of the first target lookup table and the second target lookup table, so as to optimize the FPGA critical path delay by utilizing all combinations of the first target lookup table and the second target lookup table.
8. A computer device, It is characterized in that include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the Boolean function reconstruction and solving method according to any one of claims 1 to 6 by executing the computer instructions.
9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the Boolean function reconstruction and solving method according to any one of claims 1 to 6.
10. A computer program product, It is characterized in that The method comprises computer instructions, wherein the computer instructions are used to cause a computer to execute the Boolean function reconstruction and solving method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Efficient FPGA technology mapping algorithm
CN105488285A
FPGA delay optimization method and device, equipment, storage medium and program product
CN118113660A
