Digital circuit logic optimization method based on matrix semi-tensor product
By using matrix semi-tensor product and precise synthesis technology in digital circuit logic optimization, the problems of low optimization efficiency and unstable resolution in logic optimization in traditional Boolean re-substitution algorithms are solved, and more efficient and stable logic optimization is achieved.
Patent Information
- Application Number
- CN202510694277.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-28
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2045-05-28
AI Technical Summary
In the process of logic optimization, traditional Boolean re-substitution algorithms are prone to low optimization efficiency due to premature convergence of greedy search strategies, and lack of quantitative evaluation models, which leads to the sensitivity of solution quality to the initial conditions and search order, making it difficult to ensure optimization stability.
The digital circuit logic optimization method based on matrix semi-tensor product is adopted. By traversing the logical network in topological order, reconvergence driver cutting and maximum fan-out free cone are calculated, divisors are collected, simulation and simplified, dependency functions are calculated using semi-tensor product, and the logical network is optimized through precise synthesis technology.
It significantly improves optimization capabilities and stability, can explore solutions more comprehensively, improve optimization quality, and is suitable for ultra-large-scale integrated circuit scenarios.
Smart Images

Figure CN120217971A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of digital circuit electronic design automation, and particularly relates to a digital circuit logic optimization method based on matrix semi-tensor product. Background Art
[0002] As a core technology of Electronic Design Automation (EDA), logic synthesis undertakes the key task of transforming the register transfer level circuit description into an optimized gate-level netlist. Among them, logic optimization is a crucial step, and its core optimization goal is to minimize the number of gates after technology mapping through the logic network. Boolean Resubstitution is a classical digital circuit logic optimization method, and its core idea is to use the nodes (referred to as divisors) in the existing network to re-express the function of the target node, and replace the original implementation with a new implementation, that is, replace the maximum fanout free cone (MFFC) of the target node to achieve logic simplification. If this replacement can effectively reduce the scale of the logic network, a more efficient circuit structure can be obtained.
[0003] The traditional Boolean Resubstitution algorithm uses a heuristic enumeration strategy to achieve the reconstruction of the target node, and its standard process includes: 1) calculating the re-convergence driving cut of the target node to determine the available divisors and the scale parameters of the maximum fanout free cone m ; 2) under the gate insertion amount constraint i ≤ min { m-1,3}, starting from i=0 to perform a progressive enumeration search, and incrementally enumerate new implementation schemes level by level; 3) terminate immediately when a feasible solution is detected or i reaches the m-1 upper bound but no solution is obtained; 4) when i increases to the threshold ( i =3 ), trigger heuristic decomposition: select j divisors ( j ∈ { 1,2}) to decompose the objective function. Since j logic gates need to be inserted, the constraint condition is updated synchronously to i≤ { m - 1 - j, 3} and i=0 is reset, and then the core processing flow is recursively executed for the decomposed objective function until the constraint condition is met. When a feasible solution is found by this process, the maximum fanout free cone of the target node will be immediately replaced with this feasible solution.
[0004] The limitations of the traditional Boolean resubstitution algorithm are as follows: 1) The premature convergence problem of the greedy search strategy - terminating the iteration when the first cost-reducing solution is found, and only being able to traverse a limited subset of the solution space; 2) The systematic lack of a mathematical framework - the lack of a quantitative evaluation model for optimizing path selection, resulting in the solution quality being sensitive to the initial conditions and search order, and it is difficult to ensure optimization stability. This double defect causes the traditional Boolean resubstitution algorithm to be prone to low optimization efficiency and quality fluctuations in the very large scale integrated circuit scenario. Summary of the Invention
[0005] The technical problem to be solved by the present invention is to provide a digital circuit logic optimization method based on matrix semi-tensor product (Semi-Tensor Product, STP) with significantly improved optimization ability and stability in view of the deficiencies of the prior art.
[0006] The technical solution adopted by the present invention to solve the above technical problem is: A digital circuit logic optimization method based on matrix semi-tensor product, and the method is as follows: Traverse the logic network of the digital circuit to be optimized in topological order, and select a node in the logic network n as the target node to be optimized, calculate the reconvergence-driven cut and the maximum fanout free cone (MFFC, Maximum Fanout Free Cone) of the node n , and then collect the divisors to obtain a divisor set; simulate the internal nodes of the maximum fanout free cone of the node n and the nodes in the divisor set, and then perform a reduction operation on the divisor set according to the simulation results to obtain a divisor set with redundant divisors removed; then use semi-tensor product to calculate all feasible dependency functions of the node n with respect to the divisor set with redundant divisors removed; Select a dependency function with a smaller implementation scale of the logic network from all feasible dependency functions, and synthesize a new implementation of the node n based on this dependency function; if the number of logic gates in the new implementation of the node n is less than the number of internal nodes of the maximum fanout free cone of the node n , then replace the maximum fanout free cone of the node n with the new implementation of the node n ; Traverse all target nodes in the logic network according to the above method to complete the circuit size optimization.
[0007] Preferably, the digital circuit logic optimization method based on matrix semi-tensor product of the present invention specifically includes the following steps: Step 1: Traverse the logic network of the digital circuit to be optimized in topological order, select a node in the logic network n as the target node to be optimized, calculate the reconvergence-driven cut and the maximum fan-out free cone of the node n , and then collect the divisors to obtain a divisor set; The reconvergence-driven cut and the divisors of the node n constitute a subnetwork in the logic network. Consider the n leaf nodes of the reconvergence-driven cut of the node q as the primary inputs of this subnetwork, and characterize the internal nodes of the maximum fan-out free cone of the node n and the nodes in the collected divisor set as the Boolean functions of these q leaf nodes. Simulate the internal nodes of the maximum fan-out free cone of the node n and the nodes in the collected divisor set, and then perform a reduction operation on the collected divisor set according to the simulation results to obtain a divisor set with redundant divisors removed; Step 2: Use semi-tensor product to calculate all feasible dependence functions of the node n with respect to the divisor set with redundant divisors removed; Step 3: Use the open-source logic synthesis tool Espresso to solve the problem. According to the solution results, select a dependence function with a smaller implementation scale in the logic network from all feasible dependence functions. If the support of the obtained dependence function is not greater than 4, directly perform exact synthesis on it to obtain a new implementation of the node n . Otherwise, call the dec command in the open-source logic synthesis tool also to decompose the obtained dependence function into a LUT network composed of 4-LUTs, and perform exact synthesis on each LUT in this LUT network to obtain a new implementation of the node n ; If the number of logic gates in the new implementation of the node n is less than the number of internal nodes of the maximum fan-out free cone of the node n , then replace the maximum fan-out free cone of the node n with the new implementation of the node n ; Step 4: Repeat Step 1 to Step 3 until all target nodes in the logic network are traversed to complete the circuit size optimization.
[0008] Preferably, in Step 1, the method for performing a reduction operation on the collected divisor set is as follows: Step 1.1: Given a theorem, based on this theorem, convert the problem of reducing the divisor set into a covering set problem. The specific description of this theorem is as follows: Define variables X= { x 1, x 2 , ... , x q}, based on this variable X Given a Boolean function f ( X ) and an initial divisor set { z 1 , z 2 , ... , z p}, where p , q are positive integers, and the p divisors in this initial divisor set are all Boolean functions of X : g z1 ( X ) ,g z2 ( X ) , ... ,g zp ( X ), if and only if there does not exist a pair of minterms ( M i , M j ) such that f ( M i ) ≠ f ( M j ), where i, j ∈{ 1, 2, ... ,2 q},but for all k ∈{ 1, 2, ... ,p} there is g zk ( M i ) = g zk ( M j ), then the Boolean function f ( X ) is re-expressed as z 1 , z 2 , ... , z p}, f (X ) = h(g z1 ( X ) , g z2 ( X ) , ... ,g zp ( X ))), where the Boolean function h is defined as a dependency function; Step 1.2. The minterm pairs distinguished by the node n form a set M . Divisors are iteratively selected from the initial divisor set of the node n . In each iteration, the divisor that can cover the largest number of minterm pairs not covered in the set M is selected until the set M is completely covered, at which point the iteration stops, and a divisor set with redundant elements removed is obtained.
[0009] Preferably, in Step 2, the method for calculating all feasible dependency functions of the node n with respect to the divisor set with redundant elements removed is as follows: Step 2.1. Denote the divisor set with redundant elements removed as { d 1 , d 2 , ... , d p}, and denote the n leaf nodes of the re-convergence-driven cut of the node q as ( x 1 , x 2 , ... , x q ). Enter Step 2.2, and describe the Boolean logic of the node n and the divisor set with redundant elements removed through a structure matrix; Step 2.2. Define the structure matrix of the Boolean function of the node n with respect to the original input as: ; where , m f each column f j in is a binary column vector taking values from the set pThe Boolean function structure matrix of a divisor with respect to the original input is: ; where , , m c Each column in di j is a binary column vector taking values from the set S v ; Step 2.3. Represent the structure matrix of the dependency function as: ; where , m x Each column in f j ’ is a binary column vector taking values from the set S v , and establish the following equation: ; Normalize to where , and at this time equation (4) is transformed into: ; where m f is known, while m y is obtained through calculation, and thus m x is deduced. Let m y be the calculation result of: ; Since each column of each matrix encountered in the process of calculating all feasible dependency functions of the divisor set at the calculation node n has only one non-zero element 1, let the element that is the only 1 in the m y th column of the matrix j be in the r ( j )-th row, where j ∈ { 1,2,…,2 q} and r ( j ) ∈ { 1,2,…,2 p}. When performing the matrices m x and my After multiplication, establish the following equation: ; In addition, if for any j ∈ { 1,2,…,2 q}, there exists k ∈ { 1,2,…,2 p} such that r ( j ) ≠ k , then f ’ k can be either or , and they both satisfy equation (5). Therefore, through a single calculation using equation (7), all feasible dependence functions of node n with respect to the divisor set can be obtained.
[0010] Compared with the prior art, the present invention has the following advantages: The digital circuit logic optimization method based on the matrix semi-tensor product of the present invention is a new re-replacement algorithm. This digital circuit logic optimization method is based on a rigorous mathematical framework, and its optimization ability and stability are significantly improved. The core of the method of the present invention is the matrix semi-tensor product theory and the exact synthesis technology. By performing matrix semi-tensor product operations, an algebraic representation model of Boolean logic relations is constructed, and systematic mathematical derivations are carried out in combination with the exact synthesis technology, breaking through the local convergence limitation of the traditional heuristic enumeration algorithm. The exact synthesis technology is innovatively incorporated into the re-replacement process, systematically enhancing the solution space exploration ability and improving the optimization quality. For each target node of the logic network of the digital circuit to be optimized, all feasible dependence functions can be calculated at once by the method of the present invention, which is the basis of the powerful digital circuit logic optimization ability. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 A sub-network of the logic network of the digital circuit to be optimized as an example; Figure 2 The result of the exact synthesis of the dependence function in the embodiment; Figure 3 For the node n after the maximum fan-out free cone is replaced by a new implementation. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0012] The present invention will be further described in detail below in conjunction with the embodiments of the drawings.
[0013] Embodiment: Figure 1A sub-network of the logic network of the digital circuit to be optimized as an example, the logic network is optimized by using the digital circuit logic optimization method based on the matrix semi-tensor product of the present invention, including the following steps: Step 1, traverse the logic network of the digital circuit to be optimized in topological order, and select a node n as the target node to be optimized, calculate the reconvergence drive cut and the maximum fan-out free cone of the node n , and then collect the divisors to obtain a divisor set. Figure 1 Shows the reconvergence drive cut and divisors of the node n , Figure 1 There are 6 AND gates in total. The reconvergence drive cut of the node n has 4 leaf nodes x 1 , x 2 , x 3 , x 4 , and the collected divisors are x 1 , x 2 , x 3 , x 4 , z 5 , z 6 , z 7 , z 8 , where x 1 , x 2 , x 3 , x 4 is both a leaf node of the reconvergence drive cut of the node n and a divisor. And the nodes n and the node n’ are nodes in the maximum fan-out free cone of the node n . The reconvergence drive cut and divisors of the node n constitute a sub-network in the logic network. Regarding the leaf nodes x 1 , x 2 , x 3 , x 4 as the original inputs of this sub-network, and the node nThe internal nodes of the maximum fan-out free cone and the nodes in the collected divisor set are characterized as Boolean functions of the 4 leaf nodes. For node n The internal nodes of the maximum fan-out free cone and the nodes in the collected divisor set are simulated. The simulation results are as follows: x 1 : 0xaaaa, x 2 : 0xcccc, x 3 : 0xe0e0, x 4 : 0xee00, z 1 :0x8888, z 2 : 0x0a0a, z 3 :0x0088, z 4 : 0x000a, n: 0x0008, n’: 0x000e 。
[0014] Then, based on the simulation results, a reduction operation is performed on the collected divisor set. The method of the reduction operation is as follows: Step 1.1: Given a theorem, based on this theorem, the problem of reducing the divisor set is transformed into a problem of covering sets. The specific description of this theorem is as follows: Define variables X= { x 1 , x 2 , ... , x q}, based on these variables X Given a Boolean function f ( X ) and an initial divisor set { z 1 , z 2 , ... , z p}, where p , q are positive integers. In this initial divisor setp Each divisor is a Boolean function of X : g z1 ( X ) ,g z2 ( X ) , ... ,g zp ( X ), if and only if there does not exist a pair of minterms ( M i , M j ) such that f ( M i ) ≠ f ( M j ), where i, j ∈{ 1, 2, ... ,2 q}, but for all k ∈{ 1, 2, ... ,p} there is g zk ( M i ) = g zk ( M j ), then the Boolean function f ( X ) is re-expressed by the initial divisor set { z 1 , z 2 , ... , z p} as f ( X ) = h(g z1 ( X ) , g z2 ( X ) , ... ,g zp ( X )), where the Boolean function h is defined as the dependency function; Step 1.2. The pairs of minterms distinguished by the node n form a set M , starting from the noden The divisors are iteratively selected from the initial divisor set, and in each iteration, the divisor that can cover the largest number of the smallest item pairs not covered in the set M is selected until the set M is completely covered, at which point the iteration stops, and a divisor set with redundant ones removed is obtained, which contains two divisors: z 7 , z 8 .
[0015] Step 2. Use semi-tensor product to calculate all feasible dependency functions of the node n with respect to the divisor set with redundant ones removed. The method is as follows: Step 2.1. Denote the divisor set with redundant ones removed as { d 1 , d 2}, where d 1 is z 7 , d 2 is z 8 . Denote the 4 leaf nodes of the re-convergence-driven cut of the node n as ( x 1 , x 2 , x 3 , x 4 ), and enter Step 2.2. Describe the Boolean logic of the node n and the divisor set with redundant ones removed through a structure matrix; Step 2.2. The structure matrix of the Boolean function of the node n with respect to the original input is: ; where , m f each column in is a binary column vector taking values from the set . Similarly, the structure matrices of the Boolean functions of the 2 divisors in the divisor set with redundant ones removed with respect to the original input are: ; ; where , , m c each column in is a binary column vector taking values from the set Sv ; Step 2.3. Represent the structure matrix of the dependent function as: ; where , m x each column in is a binary column vector with values in the set S v . Establish the following equation: ; Normalize to , where . At this time, the above equation is transformed into: ; where m f is known, while m y is obtained through calculation. From this, it is deduced that m x . Let m y be the calculation result of: ; Obtain all feasible dependent functions of node n with respect to the divisor set through a single calculation of equation (7) as 0x8 .
[0016] Step 3. Use the open-source logic synthesis tool Espresso to solve the problem. Select a dependent function with a smaller logical network implementation scale from all feasible dependent functions according to the solution result. Since in this embodiment, all feasible dependent functions of node n with respect to the divisor set after removing redundancy are unique, and the support size of this dependent function is 3, the dependent function can be directly and precisely synthesized to obtain a new implementation of node n . Among them, the result of the precise synthesis of the dependent function is as shown in Figure 2 .
[0017] Since the number of logic gates in the new implementation of node n is 1, which is less than the number 2 of the internal nodes of the maximum fan-out free cone of node n , the maximum fan-out free cone of node n is replaced with the new implementation of node n . Figure 3 shows the sub-network after the maximum fan-out free cone of node n is replaced with the new implementation, that is, the optimized sub-network.
[0018] Step 4: Repeat Steps 1 to 3 until all target nodes in the logic network are traversed, completing the circuit size optimization.
Claims
1. A digital circuit logic optimization method based on the semi-tensor product of matrices, characterized in that The method is as follows: Traverse the logic network of the digital circuit to be optimized in topological order, and select a node in the logic network n as the target node to be optimized, calculate the reconvergence-driven cut and the maximum fan-out free cone of the node n , then collect the divisors to obtain the divisor set; simulate the internal nodes of the maximum fan-out free cone of the node n and the nodes in the divisor set, and then perform a reduction operation on the divisor set according to the simulation results to obtain a divisor set with redundant divisors removed; then use semi-tensor product to calculate all feasible dependence functions of the node n with respect to the divisor set with redundant divisors removed; Select a dependency function with a smaller logical network implementation scale from all feasible dependency functions, and synthesize new implementations of nodes based on this dependency function. n If the number of logic gates in the new implementation of node n is less than the number of internal nodes in the maximum fan-out free cone of node n , then replace the maximum fan-out free cone of node n with the new implementation of node n . Traverse all target nodes in the logic network according to the above method to complete the circuit size optimization.
2. The digital circuit logic optimization method based on the semi-tensor product of matrices according to claim 1, wherein This method specifically includes the following steps: Step 1. Traverse the logic network of the digital circuit to be optimized in topological order, select a node in the logic network n as the target node to be optimized, calculate the reconvergence-driven cut and the maximum fanout free cone of the node n , and then collect the divisors to obtain the divisor set; Node n 's re-convergence driven cut and divisors form a sub-network in the logic network, taking the nodes n 's re-convergence driven cut q leaf nodes as the original inputs of this sub-network, and characterizing the internal nodes of the maximum fan-out free cone of the nodes n and the nodes in the collected divisor set as the Boolean functions of these q leaf nodes, simulating the internal nodes of the maximum fan-out free cone of the nodes n and the nodes in the collected divisor set, and then performing a reduction operation on the collected divisor set according to the simulation results to obtain a divisor set with redundant ones removed; Step 2, calculate nodes using semi-tensor product n All feasible dependency functions regarding eliminating redundant divisor sets; Step 3: Use the open-source logic synthesis tool Espresso for solving. According to the solution result, select a dependency function with a smaller logical network implementation scale from all feasible dependency functions. If the support of the obtained dependency function is not greater than 4, directly perform exact synthesis on it to obtain a new implementation of the node n , otherwise, call the dec command in the open-source logic synthesis tool also to decompose the obtained dependency function into a LUT network composed of 4-LUTs, and perform exact synthesis on each LUT in the LUT network to obtain a new implementation of the node n ; If the number of logic gates in the new implementation of a node n is less than the number of internal nodes in the maximum fan-out free cone of a node n , then replace the maximum fan-out free cone of the node n with the new implementation of the node n ; Step 4: Repeat Steps 1 to 3 until all target nodes in the logic network are traversed to complete the circuit size optimization.
3. The digital circuit logic optimization method based on the semi-tensor product of matrices according to claim 2, wherein In the said Step 1, the method for performing a reduction operation on the collected divisor set is: Step 1.
1. Given a theorem, based on this theorem, the problem of reducing the divisor set is transformed into a problem of covering sets. The specific description of this theorem is as follows: Define variables X= { x 1 , x 2 , ... , x q}, based on this variable X Given a Boolean function f ( X ) and an initial divisor set { z 1 , z 2 , ... , z p}, where p , q are positive integers. The p divisors in this initial divisor set are all Boolean functions of X : g z1 ( X ) ,g z2 ( X ) , ... ,g zp ( X ). If and only if there does not exist a pair of minterms ( M i , M j ) such that f ( M i ) ≠ f ( M j ), where i, j ∈{ 1, 2, ... ,2 q}, but for all k ∈{ 1, 2, ... ,p} there is g zk ( M i ) = g zk ( M j ), then the Boolean function f ( X ) is covered by the initial divisor set { z 1 , z 2 , ... , z p} reformulated as f ( X ) =h(g z1 ( X ) , g z2 ( X ) , ... ,g zp ( X ))), where the Boolean function h is defined as a dependency function; Step 1.
2. The minterms pairs distinguished by node n form a set M . Divisors are iteratively selected from the initial divisor set of node n . In each iteration, the divisor that can cover the largest number of uncovered minterms pairs in set M is selected. The iteration stops until set M is completely covered, and a divisor set with redundant elements removed is obtained.
4. The digital circuit logic optimization method based on the semi-tensor product of matrices according to claim 3, wherein In the said step 2, the semi-tensor product is used to calculate the nodes n The method for eliminating all feasible dependence functions of redundant divisor sets is as follows: Step 2.
1. Denote the divisor set with redundant elements removed as { d 1 , d 2 , ... , d p}, and denote the n leaf nodes of the re-convergence-driven cut of node q as ( x 1 , x 2 , ... , x q ). Proceed to Step 2.2 and describe the Boolean logic of node n and the divisor set with redundant elements removed through a structure matrix; Step 2.2, Define nodes n The Boolean function structure matrix for the original input is as follows: ; Among them , m f each column in f j is a binary column vector, taking values from the set , similarly, define the Boolean function structure matrix of the p divisors in the redundant divisor set removed with respect to the original input as: ; Among them , , m c each column of di j is a binary column vector, taking values from the set S v ; Step 2.3: Represent the structure matrix of the dependency function as: ; Among them , m x each column in f j ’ is a binary column vector, taking values from the set S v , and establish the following equation: ; Convert to the normalized form , where , and at this time, equation (4) is converted to: ; Among them m f is known, and m y is obtained by calculation, and thus it is deduced that m x , let m y The calculation result of is: ; Since in the computing node n in each column of each matrix encountered in all feasible dependency function processes regarding the divisor set, there is only one non-zero element 1. Let the matrix m y the only element equal to 1 in the j th column is in the r ( j )th row, where j ∈{ 1, 2,…,2 q} and r ( j ) ∈{ 1,2,…,2 p}. After performing the multiplication of matrices m x and m y , the following equation is established: ; In addition, if for any j ∈ { 1,2,…,2 q}, there exists k ∈ { 1,2,…,2 p} such that r ( j ) ≠ k , then f ’ k can be either or , and they both satisfy equation (5). Therefore, all feasible dependency functions of node n with respect to the divisor set can be obtained through a single calculation using equation (7).
Citation Information
Patent Citations
Method for obtaining simulation node truth table, electronic equipment and storage medium
CN117391007A
Circuit logic reconstruction and process mapping method and device based on structure selection
CN119294313A
Integrated circuit (IC) optimization using Boolean resynthesis
US10740517B1