Logic network multiplication complexity optimization method based on quantitative Boolean formula
By using precise synthesis and peephole optimization methods in logical networks, combined with quantitative Boolean formulas, the problem of traditional methods ignoring multiple output nodes and irrelevant terms is solved, and the problem of lower multiplication complexity and higher optimization effects are achieved. It is suitable for Encryption and security applications have improved the multiplication complexity optimization capabilities in the field of cryptography.
Patent Information
- Application Number
- CN202411570589.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2024-12-03
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional logic optimization methods ignore multiple output nodes and irrelevant terms when reducing the complexity of multiplication, resulting in insufficient optimization results and local equivalent replacements lose global optimization opportunities.
Using the method of precise synthesis combined with peephole optimization, collect the nodes to be optimized as root gate to build sub-circuits and local circuits, expand the single output circuit to match multiple outputs, and use quantized Boolean formula to effectively optimize the irrelevant terms to ensure that the global circuit is equivalent. .
Reduces the multiplication complexity of logical networks, improves the optimization search space, is suitable for encryption and security applications, especially in the field of cryptography, and further optimizes the well-optimized networks to obtain better solutions. .
Smart Images

Figure CN119065633A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of electronic design automation logic synthesis, and in particular to a logic network multiplication complexity optimization method based on quantized Boolean formulas. Background Art
[0002] In cryptographic and security applications, functions are usually represented by (XOR-AND-Graph XAG). The performance and quality of the circuit are negatively correlated with the number of AND gates, which is called the product complexity. Reducing the multiplication complexity is extremely important in cryptographic security applications, and process-independent logic optimization is an important step in logic synthesis. Existing logic optimization methods include rewriting ( Rewrite ), heavy replacement( Resubstitution ), Reconstruction( Refactor ) and exact synthesis ( Exact synthesis ). ( Exact synthesis ) is a new Boolean optimization method in logic optimization technology. It finds a logic network with the least number of nodes for a given function, and uses the principle of cutting to divide small sub-circuits from the circuit for optimization.
[0003] As a new step in optimizing the multiplication complexity of the logic synthesis network, the quality of the solution is an important factor to consider. The traditional optimization scheme calculates the single output node in the network, which reduces the multiplication complexity of the network, but because it ignores the multi-output nodes in the network, it loses some optimization opportunities, so the result obtained has greater room for optimization. At the same time, the traditional optimization scheme often only performs local equivalent replacements, abandoning the situation of global equivalence caused by the existence of irrelevant items in the circuit, which also loses some optimization opportunities. Summary of the invention
[0004] In view of the shortcomings of the prior art, the present invention provides a method for optimizing the multiplication complexity of a logic network based on a quantized Boolean formula. The optimization method adopts a method of combining precise synthesis with peephole optimization, and expands the matching of a single-output circuit in precise synthesis to multiple outputs, thereby reducing the multiplication complexity of the logic network. At the same time, the optimization method effectively utilizes irrelevant terms in the circuit for optimization, allowing the optimized sub-circuit to be unequal to the sub-circuit before optimization, and only needs to ensure the global circuit equivalence.
[0005] The optimization method of the present invention collects nodes to be optimized as root gates, constructs subcircuits and local circuits with the root gates, and expands the matching of single-output circuits in precise synthesis to multiple outputs, thereby reducing the multiplication complexity of the logic network. At the same time, the optimization method of the present invention effectively utilizes irrelevant items in the circuit for optimization, and the circuit encoding method of quantized Boolean formulas provides the feasibility of these options, thereby improving the optimization search space. The optimization method of the present invention is not only applicable to the security improvement of cryptography and security applications, but also applicable to the optimization of networks rich in XOR in logic synthesis. At the same time, the optimization method of the present invention can further optimize a network whose multiplication complexity has been well optimized to obtain a better solution result. The present invention provides a new idea for the optimization of multiplication complexity of logic synthesis, enriches the automatic design optimization method of multiplication complexity optimization in the field of cryptographic security, and has a strong realistic and practical significance for the multiplication complexity optimization technology of logic synthesis.
[0006] The technical solution adopted by the present invention to solve the above technical problems is: a method for optimizing the multiplication complexity of a logic network based on a quantized Boolean formula, comprising the following steps: 1) Construct a logic network to be optimized based on the functions in encryption or security applications, analyze the topology of the logic network, find the nodes to be optimized in the logic network according to the reconvergence path, and collect subcircuits with the nodes to be optimized as root gates M 1 , calculation subcircuit M 1 The number of AND nodes in the subcircuit M 1 When the number of AND nodes is equal to zero, the subcircuit is determined M 1 The AND node in the subcircuit is not an optimizable node, and the node to be optimized in the logic network is searched again; M 1 When the number of AND nodes is greater than zero, record the subcircuit M 1 Number of AND nodes n 1 , and sub-circuit M 1 As the old subcircuit, the subcircuit M 1 As the area to be optimized in the logic network, proceed to step 2); 2) collecting a local circuit outside the old subcircuit in the logic network; 3) Write a constraint file for the old subcircuit and the local circuit through a quantized Boolean formula; then call the quantized Boolean formula solver to solve the constraint file, obtain a solution that satisfies the constraint within a certain period of time, and parse the obtained solution into a new subcircuit, and calculate the number of AND nodes in the new subcircuit n 2 ; 4) Compare the number of AND nodes in the new subcircuit n 2 The number of AND nodes in the old subcircuit n 1 , retain the subcircuit with the smaller number of AND nodes, and insert the retained subcircuit back into the logic network to obtain an optimized logic network, remove the dangling nodes in the optimized logic network, and obtain a new logic network; 5) Repeat the above steps 1) to 5) repeatedly.
[0007] Preferably, the specific process of step 2) is: 2.1) Collect the subsequent output nodes of the old subcircuit, with the upper limit of the collection being level k 1 , generate a partial set of local circuits N part ; 2.2) Collect the partial circuit set N part The input node of the collection is limited to the number of inputs in the collection. k 2 , generating local circuits N all .
[0008] Preferably, the specific process of step 3) is: write a constraint file by encoding constraints of quantized Boolean formulas for the old subcircuit and the local circuit, wherein the encoding constraints include truth table constraints, topological connection relationship constraints, and equivalence constraints; then call the open source quantized Boolean formula solver QFUN to solve the constraint file, obtain a solution that satisfies the constraints within a certain period of time, and parse the obtained solution into a new subcircuit M 2. Calculate the new subcircuit M 2. Number of AND nodes n 2 .
[0009] Compared with the prior art, the present invention has the following advantages: the optimization method of the present invention adopts the method of combining precise synthesis with peephole optimization, collects the nodes to be optimized as root gates, and constructs subcircuits and local circuits with root gates, so as to expand the matching of single-output circuits in precise synthesis to multiple outputs, and can reduce the multiplication complexity of the logic network. At the same time, the optimization method of the present invention effectively utilizes the irrelevant terms in the circuit for optimization, and the circuit encoding method of quantized Boolean formulas provides the feasibility of these options, thereby improving the optimization search space. The optimization method of the present invention can not only be applied to the security improvement of cryptography and security applications, but also to the optimization of networks rich in XOR in logic synthesis. In addition, the optimization method of the present invention can further optimize the network whose multiplication complexity has been well optimized to obtain better solution results. The present invention provides a new idea for the optimization of multiplication complexity of logic synthesis, enriches the automatic design optimization method of multiplication complexity optimization in the field of cryptographic security, and has a strong practical significance for the multiplication complexity optimization technology of logic synthesis. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 Represent and select the node root for a XAG logical network to be optimized; Figure 2 It is a selection diagram of subcircuits and local circuits in the XAG logic network; Figure 3 This is the optimized XAG logic network; Figure 4 and Figure 5 It is a partial constraint file in QCIR format solved by the open source quantized Boolean formula solver QFUN. DETAILED DESCRIPTION
[0011] The present invention will be further described in detail below in conjunction with the embodiments of the accompanying drawings. The following embodiments only represent one possible implementation of the present invention, not all possible implementations, and are not intended to limit the present invention.
[0012] Figure 1 The figure shows a XAG logic network representation, which includes 6 AND nodes represented by '⊕' and 5 XOR nodes represented by '∧', and the multiplication complexity of the logic network is 6. The logic network has two outputs: O1 and O2, and 5 inputs: a, b, c, d, and e.
[0013] The XAG logic network is used as the logic network to be optimized and optimized by the multiplication complexity optimization method of the present invention, including the following steps: Step 1: Obtain the area to be optimized in the logic network to be optimized; The XAG logic network is used as the underlying data structure to represent functions in encryption or security applications. The XAG logic network only contains two types of operation logic: XOR and AND. The XAG logic network is re-optimized using the precise synthesis of the method of the present invention combined with the peephole optimization method to achieve the purpose of reducing the multiplication complexity of the logic network. The peephole optimization, that is, using the strategy of collecting subcircuits by defining root gates, separates small subcircuits from the logic network for optimization, and then inserts them back into the logic network. The method is based on a given logic network and related calculation parameters. First, according to the topological structure of the logic network, the nodes are collected and stored in the list to be optimized in the topological order of the logic network, and then the reconvergence path in the logic network is calculated. We give priority to nodes on the reconvergence path, and then consider nodes in topological order. If the number of AND nodes near the node is 0, the node is skipped.
[0014] In this embodiment, the actual number of AND nodes is defined as the multiplication complexity in the XAG logic network. In this example, the actual number of AND nodes is N actual , the theoretical minimum number of AND nodes used to implement a Boolean function is N theory , that is, the multiplication complexity currently implemented by the function and the actual multiplication complexity of the function theory are N actual , N theory , the theoretical optimization space of the multiplication complexity of the logic network is defined as:
[0015] Read the XAG logical network to parse its topology and set relevant parameters in the code ( subcircuit_size , local_circuit_level , time ),in subcircuit_size Characterizes the size of the collected subcircuit confined in the circuit, local_circuit_level Characterizes the size of the hierarchy that collects upper and lower bounds of local circuits on a subcircuit basis, time Used to limit calculation time.
[0016] After that, define the set of all nodes contained in the logical network as L , calculate the reconvergent path in the logical network. Collect each node on the path to get the set N We prioritize from the collection N Select nodes from L Select the remaining nodes from . Figure 1 , including XAG logical network representation and root selection.
[0017] Step 2: Use the nodes to be optimized found in the logic network to build a subcircuit for the root gate; In order to ensure the optimization gain after replacement, it is necessary to calculate the number of AND nodes after the subcircuit collection is completed. Different from the prior art, the method of constructing the subcircuit in the present invention is to iteratively collect the input nodes of the root gate and the inputs of the collected nodes, and the upper limit of the collection scale is subcircuit_size The collection rule is to prioritize the node with the least output, followed by the node with the least input, and finally the node with the smallest level.
[0018] In this embodiment, the node to be optimized is defined as root, and the constructed subcircuit is defined as M 1 , subcircuit M 1 The number of AND nodes is n 1 .
[0019] exist n 1 When it is equal to zero, the subcircuit is determined M 1 The AND node is not an optimizable node; exist n 1 When it is greater than zero, the subcircuit is determined M 1 The AND node is an optimizable node. M 1 As the area to be optimized in the logical network, proceed to the next step.
[0020] like Figure 2 As shown in , we collected two nodes downward and finally constructed a tree with three nodes and AND number of nodes. n 1 The subcircuit with a value of 2 is used as the old subcircuit.
[0021] Step 3: Collect a local circuit outside the old subcircuit in the logic network; In order to ensure that the efficiency of the post-encoding solver is not limited or it cannot run due to the circuit being too large, unlike the prior art, after constructing and collecting the old sub-circuit, the present invention continues to collect nodes based on the old sub-circuit, starting from the main output node of the old sub-circuit, and continues to collect nodes towards their output until the level of the current collection node differs from the main output node of the sub-circuit by local_circuit_level , and then collect the inputs of these nodes until the level of the collected nodes differs from the main input node of the subcircuit by local_circuit_level ,These collected nodes are used to construct local circuits.
[0022] like Figure 2 As shown in , here is the setting local_circuit_level The value is 2, the level of the current subcircuit plus local_circuit_level The sum of the values of k 1 We collect two layers of nodes from the root node and the output of the subcircuit. Collect their input nodes, where the number of inputs does not exceed k 2 , which is set to 10 here. Finally, a total of 7 local circuits (including subcircuits) are collected, that is, N all , as the reference circuit structure for subsequent encoding.
[0023] Step 4: Write a constraint file in QCIR format for the old subcircuit and local circuit through the quantized Boolean formula, and then call the quantized Boolean formula solver to solve the constraint file, and obtain a solution that satisfies the constraint within a certain period of time; According to the quantized Boolean formula and the QCIR format encoding method, the old subcircuits and local circuits collected in step 2 and step 3 are encoded according to the rules, and the Boolean chain is used: the Boolean chain is a type of DAG (directed acyclic graph), and each vertex has k Input, execute k Meta-logical operation. Given a m Output function f ={ f 1 ,…, f m}, the input of each output function belongs to the set {x1,…,x n}, then the Boolean chain of these functions can be expressed as a sequence of 𝑟 steps (x n+1 ,…,x n+r ), x n+r represents the set {x1,…,x n+r-1} k input. So we define n is the input of the Boolean chain, m is the output. Definition 1 ≤ i ≤ l and 1 ≤ j ≤ m , l is the length of the Boolean chain, and 1 ≤ i ≤ l, then with the help of constraint variables:
[0024] and Cu(S i ,k): Each node must have exactly k inputs, that is, there must be exactly kThe selection variable is true; Cu(O j ,1): For each 1≤ j ≤ m , there happens to be one i Make O ij True; Co i : Node_value and Node_ definition The two need to be compatible, that is , Get the constraint code:
[0025] This is also the guarantee for the equivalence of the circuit before and after optimization, which is ensured by limiting all outputs of the local circuit to remain unchanged. According to the obtained constraint file, it is input into the open source quantized Boolean formula solver QFUN for solution. Some constraint files are as follows Figure 4 and Figure 5 The solver receives the QCIR format file, performs calculations and solves within a limited time, and returns the result.
[0026] Step 5: Analyze the solution obtained in step 4 into a new subcircuit and calculate the number of AND nodes in the new subcircuit n 2 , compared with the number of AND nodes in the new subcircuit n 2 and the number of AND nodes in the old subcircuit n 1 , retain the subcircuit with the smaller number of AND nodes, and insert the retained subcircuit back into the logic network to obtain an optimized logic network, remove the dangling nodes in the optimized logic network, and obtain a new logic network; exist n 1 Greater than n 2 In the case of , it is determined that the new subcircuit does not bring optimization and the replacement is abandoned; exist n 1 Less than or equal to n 2 In the case of a new subcircuit, it is determined that the new subcircuit brings optimization, the subcircuit is replaced, the new subcircuit is inserted back into the logic network to obtain an optimized logic network, and the dangling nodes in the optimized logic network are scanned and cleared to obtain a new logic network. The XAG logic network optimized by the method of the present invention is shown in FIG. Figure 3 .like Figure 3 As shown, the multiplication complexity of the XAG logic network is reduced to 3 (i.e., the multiplication complexity is reduced by 3), and the circuit security is improved.
[0027] Step 6: Iterate the above steps 1 to 5 and optimize the logic network iteratively until the specified time is reached or the optimization effect reaches the set expected goal.
[0028] In order to verify the technical effect of the present invention, the EPFL benchmark test circuit is tested, and the logic network multiplication complexity optimization method based on quantized Boolean formula proposed in the present invention is applied to the XAG multiplication complexity optimization. The results are shown in Table 1.
[0029]
[0030] The basic benchmark used in the test is the current optimal result. As can be seen from Table 1, the optimization method for the multiplication complexity of the logic network based on the quantized Boolean formula proposed in the present invention improves the optimization result by an average of 15% on the basis of the optimal result. Therefore, the method of the present invention can further optimize the network whose multiplication complexity has been well optimized, enriching the automatic design optimization method for multiplication complexity optimization in the field of cryptographic security.
Claims
1. A method for optimizing the multiplication complexity of a logic network based on quantized Boolean formulas, characterized in that: The following steps are involved: 1) Construct a logic network to be optimized based on the functions in encryption or security applications, analyze the topology of the logic network, find the nodes to be optimized in the logic network according to the reconvergence path, and collect subcircuits with the nodes to be optimized as root gates M 1 , calculation subcircuit M 1 The number of AND nodes in the subcircuit M 1 When the number of AND nodes is equal to zero, the subcircuit is determined M 1 The AND node in the subcircuit is not an optimizable node, and the node to be optimized in the logic network is searched again; M 1 When the number of AND nodes is greater than zero, record the subcircuit M 1 Number of AND nodes n 1 , and sub-circuit M 1 As the old subcircuit, the subcircuit M 1 As the area to be optimized in the logic network, proceed to step 2); 2) collecting a local circuit outside the old subcircuit in the logic network; 3) Write a constraint file for the old subcircuit and the local circuit through a quantized Boolean formula; then call the quantized Boolean formula solver to solve the constraint file, obtain a solution that satisfies the constraint within a certain period of time, and parse the obtained solution into a new subcircuit, and calculate the number of AND nodes in the new subcircuit n 2 ; 4) Compare the number of AND nodes in the new subcircuit n 2 The number of AND nodes in the old subcircuit n 1 , retain the subcircuit with the smaller number of AND nodes, and insert the retained subcircuit back into the logic network to obtain an optimized logic network, remove the dangling nodes in the optimized logic network, and obtain a new logic network; 5) Repeat the above steps 1) to 5) repeatedly.
2. A method for optimizing the multiplication complexity of a logic network based on a quantized Boolean formula as claimed in claim 1, characterized in that: The specific process of step 2) is: 2.1) Collect the subsequent output nodes of the old subcircuit, with the upper limit of the collection being level k 1 , generate a partial set of local circuits N part ; 2.2) Collect the partial circuit set N part The input node of the collection is limited to the number of inputs in the collection. k 2 , generating local circuits N all .
3. The method for optimizing the multiplication complexity of a logic network based on a quantized Boolean formula according to claim 1, characterized in that: The specific process of step 3) is as follows: write a constraint file for the encoding constraints of the quantized Boolean formula for the old subcircuit and the local circuit, wherein the encoding constraints include truth table constraints, topological connection relationship constraints and equivalence constraints; then call the open source quantized Boolean formula solver QFUN to solve the constraint file, obtain a solution that satisfies the constraints within a certain period of time, and parse the obtained solution into a new subcircuit M 2. Calculate the new subcircuit M 2. Number of AND nodes n 2 .
Citation Information
Patent Citations
Multi-stage MPRM logic circuit power consumption optimization method
CN114925640A
Analysis optimization method of digital logic circuit and related equipment
CN116822422A
Logic synthesis method and device based on precise synthesis
CN118709614A
Integrated circuit (IC) optimization using Boolean resynthesis
US10740517B1
Scalable boolean methods in a modern synthesis flow
US20200074019A1
Cited By
Circuit level optimization method based on NAND and XOR majority logic
CN119272681A
