AIG redundant logic optimization method and device

By combining sub-graph replacement, simulated real value table and XOR random simulation processing in AIG logic optimization, the redundancy problem in AIG logic functions is solved, and more efficient logic optimization effect is achieved.

CN118607426BActive Publication Date: 2024-11-08SUZHOU YIGE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411076126.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-07
Publication Date
2024-11-08
Estimated Expiration
2044-08-07

AI Technical Summary

Technical Problem

The existing AIG logic optimization methods may have redundant or inefficient parts in logical functions. The traditional sub-graph replacement method mainly focuses on the structural level and fails to deeply optimize the logical functions.

Method used

By obtaining the target AIG graph, sub-graph replacement optimization is performed, the simulation real value table is calculated and redundant nodes are cleared, and redundant edges are deleted in combination with the XOR random simulation processing, so as to achieve optimization of the slave node and edge dimensions.

Benefits of technology

It effectively reduces the size of AIG, reduces the time-consuming process of subsequent redundant logic optimization, improves the logic optimization effect, more fully covers the optimization space, and improves the optimization effect of AIG.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118607426B_ABST
    Figure CN118607426B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of logic optimization technology, and in particular to an AIG redundant logic optimization method and device, the method comprising: first obtaining an input target AIG graph, performing replacement optimization processing on the AIG subgraph in the target AIG graph, and obtaining a preliminary optimized AIG graph; then calculating the analog truth table corresponding to each node in the preliminary optimized AIG graph, and removing the redundant nodes in the preliminary optimized AIG graph based on the analog truth table; after the redundant nodes are removed, performing XOR random simulation processing on each edge in the preliminary optimized AIG graph, deleting the redundant edges in the preliminary optimized AIG graph based on the XOR random simulation processing result, and finally outputting the final AIG graph after logic optimization. The present invention starts from the two dimensions of nodes and edges in redundant logic optimization, and further improves the optimization space and optimization effect of the target AIG graph from the perspective of redundant logic, thereby improving the optimization effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of logic optimization, and in particular to an AIG redundant logic optimization method and device. Background Art

[0002] AIG (And Inverter Graph) is a graph structure used to represent Boolean functions. It consists of AND gates and INVERTER gates and is often used in the field of logic optimization. AIG provides an intuitive way to analyze and transform Boolean expressions. In AIG, each node represents a Boolean expression, and the edge represents the relationship between these expressions.

[0003] Currently, many AIG logic optimization methods rely on subgraph replacement technology, which optimizes AIG by identifying subgraphs (i.e., a set of connected nodes) in AIG and then replacing them with equivalent subgraphs in a predefined AIG library. However, this method mainly focuses on the structural level of AIG, i.e., the connection between nodes and edges, without in-depth consideration of the logical functions represented by these structures.

[0004] Therefore, even if structural optimization is achieved through subgraph replacement, AIG may still have redundant or inefficient parts in terms of logical functions. For example, two or more nodes at different locations in AIG perform the same or similar logical operations, and these redundancies may not be eliminated by simple structural replacement. Summary of the invention

[0005] In view of this, the present invention provides an AIG redundant logic optimization method and device to solve the problem that the existing AIG logic optimization method may still have redundant or inefficient parts in the logic function.

[0006] In a first aspect, the present invention provides an AIG redundant logic optimization method, the method comprising:

[0007] Get the input target AIG graph;

[0008] Performing replacement optimization processing on the AIG subgraph in the target AIG graph, and obtaining a preliminary optimized AIG graph;

[0009] Calculating a simulation truth table corresponding to each node in the preliminary optimized AIG graph, and removing redundant nodes in the preliminary optimized AIG graph based on the simulation truth table;

[0010] After the redundant nodes are cleared, each edge in the preliminary optimized AIG graph is subjected to XOR random simulation processing, and the redundant edges in the preliminary optimized AIG graph are deleted based on the XOR random simulation processing result, and the final AIG graph after logic optimization is output.

[0011] The above scheme first performs the classic AIG optimization method before performing redundant logic optimization, thereby reducing the size of AIG. In practice, it can reduce the time consumption of subsequent redundant logic optimization links to a certain extent. Afterwards, the redundant logic optimization starts from the two dimensions of nodes and edges, and cooperates with the subsequent node and edge cleaning operations to further improve the optimization space and optimization effect of AIG from the perspective of redundant logic, more fully covering the optimization space and improving the optimization effect.

[0012] In an optional implementation, before performing the replacement optimization process on the subgraph in the target AIG graph, the method further includes:

[0013] Obtaining constraints of the target AIG graph; the constraints include the number of input signals and the number of input nodes;

[0014] The target AIG graph is checked based on the constraint conditions, and when the target AIG graph satisfies the constraint conditions, a subsequent logic optimization procedure of the target AIG graph is executed.

[0015] In an optional implementation, performing replacement optimization processing on the AIG subgraph in the target AIG graph and obtaining a preliminary optimized AIG graph includes:

[0016] Traversing the AIG subgraph in the target AIG graph;

[0017] Acquire an equivalent optimized subgraph of the AIG subgraph in a predefined AIG library;

[0018] Based on the equivalent optimized subgraph, the AIG subgraph is replaced and optimized, and a preliminary optimized AIG graph is obtained.

[0019] In an optional implementation, the calculating of the simulation truth table corresponding to each node in the preliminary optimized AIG graph includes:

[0020] Based on the number of inputs in the preliminary optimized AIG graph, generating a simulation input sequence of the preliminary optimized AIG graph;

[0021] Based on the simulation input sequence, a simulation truth table corresponding to each node in the preliminary optimized AIG graph is calculated.

[0022] In an optional implementation, the removing redundant nodes in the preliminary optimized AIG graph based on the simulation truth table includes:

[0023] Comparing the simulated truth tables corresponding to each node in the preliminary optimized AIG graph to identify nodes with the same logic;

[0024] Get and record the maximum fan-out-free cone of two logically identical nodes;

[0025] Compare the number of nodes in the maximum fan-out cones of the two nodes, and select the node corresponding to the maximum fan-out cone with a smaller number of nodes as a reserved node, and select the node corresponding to the maximum fan-out cone with a larger number of nodes as a redundant node;

[0026] All fan-outs of the redundant node are transferred to the reserved node, and the redundant node and the largest no-fan-out cone of the redundant node are deleted.

[0027] In an optional implementation, performing XOR random simulation processing on each edge in the preliminary optimized AIG graph includes:

[0028] Traversing each edge in the preliminary optimized AIG graph;

[0029] An XOR is constructed for each edge in the preliminary optimized AIG graph, and random simulation processing is performed to obtain the XOR result of each edge.

[0030] In an optional implementation, the method of deleting redundant edges in the preliminary optimized AIG graph based on the XOR random simulation processing result and outputting the final AIG graph after logic optimization includes:

[0031] If there is a target edge whose XOR result is always 0, perform SAT solver verification processing on the XOR corresponding to the XOR result, and obtain a SAT solution result;

[0032] If the SAT solution result indicates that there is no input that makes the XOR result 1, then determining that the target edge is a redundant edge in the preliminary optimized AIG graph;

[0033] The redundant edges in the preliminary optimized AIG graph are deleted, and the related nodes corresponding to the redundant edges are optimized to output the final AIG graph after logic optimization.

[0034] In a second aspect, the present invention provides an AIG redundant logic optimization device, the device comprising:

[0035] AIG graph acquisition module, used to acquire the input target AIG graph;

[0036] A preliminary optimization acquisition module, used for performing replacement optimization processing on the AIG subgraph in the target AIG graph, and obtaining a preliminary optimized AIG graph;

[0037] A redundant node removal module, used to calculate a simulation truth table corresponding to each node in the preliminary optimized AIG graph, and remove redundant nodes in the preliminary optimized AIG graph based on the simulation truth table;

[0038] The redundant edge deletion module is used to perform XOR random simulation processing on each edge in the preliminary optimized AIG graph after the redundant nodes are cleared, delete the redundant edges in the preliminary optimized AIG graph based on the XOR random simulation processing results, and output the final AIG graph after logic optimization.

[0039] 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 computer instructions to thereby execute an AIG redundant logic optimization method of the first aspect or any corresponding embodiment thereof.

[0040] 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 an AIG redundant logic optimization method according to the first aspect or any corresponding embodiment thereof.

[0041] In a fifth aspect, the present invention provides a computer program product, including computer instructions, where the computer instructions are used to enable a computer to execute an AIG redundant logic optimization method according to the first aspect or any corresponding embodiment thereof.

[0042] The technical solution provided by the present invention may include the following beneficial effects:

[0043] The present invention first performs the classic AIG optimization method before performing redundant logic optimization, thereby reducing the size of the AIG. In practice, it can reduce the time consumption of subsequent redundant logic optimization links to a certain extent; then, starting from the two dimensions of nodes and edges in redundant logic optimization, the subsequent node and edge cleaning operations are coordinated to further improve the optimization space and optimization effect of AIG from the perspective of redundant logic, more fully cover the optimization space, and improve the optimization effect.

[0044] In addition, before using the SAT solver to optimize the redundant logic of the edge, the present invention first uses a random simulation method to determine whether the target edge is redundant. If the result of the XOR device is found to be 1 during the random simulation process, it proves that the target edge is not redundant, and there is no need to perform subsequent SAT solving operations. This method can greatly reduce the running time compared to directly using the SAT solving operation. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] 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.

[0046] Figure 1 is a schematic diagram of the structure of an AIG diagram according to an embodiment of the present invention;

[0047] Figure 2 is a flow chart of an AIG redundant logic optimization method according to an embodiment of the present invention;

[0048] Figure 3 is a flow chart of another AIG redundant logic optimization method according to an embodiment of the present invention;

[0049] Figure 4 is a flow chart of another AIG redundant logic optimization method according to an embodiment of the present invention;

[0050] Figure 5 is a flowchart of redundant node clearing according to an embodiment of the present invention;

[0051] Figure 6 is a schematic structural diagram of another AIG diagram according to an embodiment of the present invention;

[0052] Figure 7 is a flow chart of edge redundancy logic optimization according to an embodiment of the present invention;

[0053] Figure 8 is a schematic diagram of the operation of another AIG graph and its corresponding XOR device according to an embodiment of the present invention;

[0054] Fig. 9 is a structural block diagram of an AIG redundant logic optimization device according to an embodiment of the present invention;

[0055] Fig.10 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0056] 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.

[0057] It should be noted that each AIG graph in the present invention is an And Inverter Graph, which is a graph that can be used to express a Boolean function. The AIG graph is composed of nodes and edges. Each node is an AND gate or an input or output signal. Each edge can be added with a non-logic. See Figure 1 A schematic diagram of the structure of an AIG diagram is shown. Figure 1 This is an example of an AIG graph, where a, b, c, d are input signals, o is the output signal, nodes 1, 2, and 3 are all AND gates (AND logic gates), the lines between signals and nodes and between nodes are edges, and the solid black dots on the edges represent the inversion of the signals on the edges (non-logical). For example, the signal between node 1 and node 3 is a inverted edge (assuming that the output signal of node 1 is 0, then the input signal to node 3 becomes 1 after passing through the inverted edge).

[0058] According to an embodiment of the present invention, an embodiment of an AIG redundant logic optimization 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.

[0059] In this embodiment, a method for optimizing AIG redundant logic is provided. Figure 2 is a flow chart of an AIG redundant logic optimization method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0060] Step S201, obtaining an input target AIG graph.

[0061] Furthermore, as a starting point of the optimization process, this embodiment needs to load or receive a target AIG graph to be optimized as input.

[0062] Step S202: performing replacement optimization processing on the AIG subgraph in the target AIG graph, and obtaining a preliminary optimized AIG graph.

[0063] For further information, see Figure 3A flowchart of another AIG redundant logic optimization method is shown. The input of this embodiment is an AIG graph, and the output is an optimized AIG graph. The input target AIG graph is first optimized based on AIG subgraph replacement, and the optimization is implemented based on the existing classic AIG optimization method.

[0064] When applying the existing classic AIG optimization method (i.e., the subgraph replacement method) for preliminary optimization, this embodiment first traverses the AIG subgraphs in the target AIG graph, and attempts to find a more efficient (e.g., fewer nodes or shorter critical paths) equivalent subgraph in the predefined AIG library for replacement. After the replacement is completed, a preliminarily optimized AIG graph is obtained, i.e., the above-mentioned preliminary optimized AIG graph. This embodiment can reduce the number of nodes in the graph, simplify the logical expression, or improve the performance of the circuit through preliminary optimization processing. After the replacement is completed, a preliminarily optimized AIG graph is obtained, which is logically equivalent to the original target AIG graph, but has fewer nodes and edges in structure.

[0065] Step S203, calculating the simulation truth table corresponding to each node in the preliminary optimized AIG graph, and removing redundant nodes in the preliminary optimized AIG graph based on the simulation truth table.

[0066] Further, such as Figure 3 As shown, after preliminary optimization using the existing classic AIG optimization method, this embodiment performs redundant logic optimization on the preliminary optimized AIG graph to obtain an AIG graph after the nodes and edges are optimized again. That is, in order to further optimize the AIG graph, this embodiment first determines the redundant nodes in the preliminary optimized AIG graph. A redundant node refers to a node whose output can be replaced by other nodes or logical expressions without affecting the overall logical function. This embodiment completes the removal of redundant nodes by calculating the simulated truth table of each node. The simulated truth table is used to show the output value of each node under all input combinations. By comparing the simulated truth tables of different nodes, nodes whose outputs are always the same, that is, the above-mentioned redundant nodes, can be identified and removed from the preliminary optimized AIG graph to complete the logic optimization of redundant nodes.

[0067] Step S204, after the redundant nodes are cleared, each edge in the preliminary optimized AIG graph is subjected to XOR random simulation processing, the redundant edges in the preliminary optimized AIG graph are deleted based on the XOR random simulation processing result, and the final AIG graph after logic optimization is output.

[0068] Furthermore, the final optimization of this embodiment is to further analyze and optimize the remaining edges in the preliminary optimized AIG graph after the redundant nodes are optimized. Since the AIG graph often contains XOR gates, each edge can be subjected to random XOR simulation to identify edges that will not affect the final result under any logical conditions, i.e., redundant edges. Deleting each redundant edge can further simplify the AIG graph and reduce the connections and potential delays in the circuit. After completing all optimization steps, this embodiment outputs the final logic-optimized AIG graph, which is logically equivalent to the original input graph, but has improvements in structure and performance.

[0069] In summary, this embodiment first performs the classic AIG optimization method before performing redundant logic optimization, thereby reducing the size of the AIG. In practice, the time consumption of the subsequent redundant logic optimization link can be reduced to a certain extent. Afterwards, the redundant logic optimization is started from the two dimensions of nodes and edges, and the subsequent node and edge cleaning operations are coordinated to further improve the optimization space and optimization effect of the AIG from the perspective of redundant logic, more fully cover the optimization space, and improve the optimization effect.

[0070] In this embodiment, another AIG redundant logic optimization method is provided. Figure 4 FIG. 4 is a flowchart of another AIG redundant logic optimization method according to an embodiment of the present invention. Figure 4 As shown, the process includes the following steps:

[0071] Step S401, obtaining an input target AIG graph.

[0072] Furthermore, the target AIG graph represents the logic circuit that needs to be optimized.

[0073] Step S402, obtaining the constraint conditions of the target AIG graph; the constraint conditions include the number of input signals and the number of input nodes.

[0074] Furthermore, in order to ensure the operation efficiency of this embodiment, this embodiment supports adding two types of constraints to the input target AIG graph: 1. The number of input signals n of the input target AIG graph; 2. The number of nodes c of the input target AIG graph. If the input target AIG graph does not meet the constraints, the program terminates and returns to the original input.

[0075] Step S403: Check the target AIG graph based on the constraint condition, and execute a subsequent logic optimization program of the target AIG graph when the target AIG graph satisfies the constraint condition.

[0076] Furthermore, the constraints define acceptable boundary conditions during the optimization process. In this step, it is necessary to clarify the number of input signals and the number of input nodes. Before optimization, this embodiment first needs to ensure that the target AIG graph satisfies all constraints. If so, the subsequent optimization procedure will continue; if not, the input may need to be adjusted.

[0077] Step S404: Perform replacement optimization processing on the AIG subgraph in the target AIG graph, and obtain a preliminary optimized AIG graph.

[0078] In an optional implementation, step S404 includes:

[0079] Traverse the AIG subgraph in the target AIG graph;

[0080] Obtaining an equivalent optimized subgraph of the AIG subgraph in a predefined AIG library;

[0081] Based on the equivalent optimized subgraph, the AIG subgraph is replaced and optimized, and a preliminary optimized AIG graph is obtained.

[0082] Furthermore, this embodiment first applies the existing classic AIG optimization method, traverses the subgraphs in the target AIG graph, and attempts to find a more efficient (such as one with fewer nodes or a shorter critical path) equivalent subgraph in the predefined AIG library for replacement. After the replacement is completed, a preliminary optimized AIG graph is obtained.

[0083] Step S405, calculating the simulation truth table corresponding to each node in the preliminary optimized AIG graph, and removing the redundant nodes in the preliminary optimized AIG graph based on the simulation truth table.

[0084] In an optional implementation, the "calculating the simulation truth table corresponding to each node in the preliminary optimized AIG graph" in step S405 includes:

[0085] Based on the number of inputs in the preliminary optimized AIG graph, generating a simulation input sequence of the preliminary optimized AIG graph;

[0086] Based on the simulation input sequence, a simulation truth table corresponding to each node in the preliminary optimized AIG graph is calculated.

[0087] In an optional implementation, the step S405 of “clearing redundant nodes in the preliminary optimized AIG graph based on the simulation truth table” includes:

[0088] Compare the simulated truth tables corresponding to each node in the preliminary optimized AIG graph to identify nodes with the same logic;

[0089] Get and record the maximum fan-out cone of two logically identical nodes; the maximum fan-out cone of any node is the node with the node as the root node, including the node and all transitive fan-in nodes with no external fan-out corresponding to the node with the node as the root node (the transitive fan-in node is the node with a path to the root node).

[0090] Compare the number of nodes in the maximum fan-out cones of the two nodes, and select the node corresponding to the maximum fan-out cone with a smaller number of nodes as a reserved node, and select the node corresponding to the maximum fan-out cone with a larger number of nodes as a redundant node;

[0091] All fan-outs of the redundant node are transferred to the reserved node, and the redundant node and the largest no-fan-out cone of the redundant node are deleted.

[0092] Furthermore, the redundant logic optimization link in this embodiment includes two steps, namely node redundant logic optimization and edge redundant logic optimization, wherein the node redundant logic optimization includes two steps, namely simulation truth table calculation and redundant node removal. This embodiment identifies logically identical nodes by calculating the simulation truth table of each node, and then selects and deletes redundant nodes by comparing the maximum fan-out cone of these nodes (i.e., the set of nodes that have no output to other nodes), and at the same time transfers its fan-out to the retained nodes. This step further simplifies the AIG graph. Among them, the simulation truth table calculation link first generates a simulation input sequence based on the number of inputs in the preliminary optimization AIG graph. The simulation input sequence is: 2m-1 1s plus 2m-1 0s, repeated 2n-m times, where n is the number of inputs of the AIG, and m is the number of the input. For example, a two-input Boolean function may have all inputs of 00, 01, 10, 11. A three-input Boolean function is 000, 001, 010, 011, 100, 101, 110, 111. By analogy, we can see that for a two-input Boolean function, the input sequence of the first input is 1010, and the input sequence of the second input is 1100. For a three-input Boolean function, the input sequence of the first input is: 10101010, the input sequence of the second input is: 11001100, and the input sequence of the third input is: 11110000.

[0093] After having the input sequence, this embodiment can calculate the simulation truth table of each node in the target AIG graph based on the topological order. For example, the two input sequences of an AND gate node are 11110000 and 10101010 respectively, and its simulation truth table is the result of bitwise AND of the two input sequences, that is, 10100000. If the simulation truth tables of two nodes are the same, it can be considered that the logics of the two nodes are exactly the same. After obtaining the simulation truth tables of all nodes, all nodes are traversed again, and redundant nodes are cleared for nodes with the same simulation truth tables. Nodes with the same logic are nodes with the same simulation truth tables.

[0094] See also Figure 5 The flowchart of redundant node removal is shown in FIG. Figure 5 As shown, for two nodes with the same simulation truth table (i.e., nodes with the same logic), first find and record the MFFC (maximum fan-free cone) of the node. If the maximum fan-free cone MFFC of the node has been recorded, there is no need to find the maximum fan-free cone MFFC of the node. Then compare the number of nodes in the maximum fan-free cone MFFC corresponding to the two nodes, and record the node corresponding to the maximum fan-free cone MFFC with a smaller number of nodes as node A (i.e., the above-mentioned reserved node), and the node corresponding to the maximum fan-free cone MFFC with a larger number of nodes as node B (i.e., the above-mentioned redundant node). Then, all fan-out (fan-out is output) nodes of node B are transferred to node A (for example, if node B is connected to an output node C, then the connection relationship between node B and node C is fanned out, so that node C will have an input vacancy, and the input is connected to the output of node A. When node B has multiple output nodes, the transfer is performed in the same way). At this point, the output of node B is no longer connected to any node. Finally, all the maximum fan-free cone MFFCs corresponding to node B are deleted.

[0095] See also Figure 6 Another structural diagram of an AIG graph is shown in FIG. A maximum non-fan-out cone MFFC consists of a root node and all its transitive fan-in nodes without external fan-out (a transitive fan-in node is a node that has a path with the root node). Figure 6 For example, all of its transitive fan-in nodes are node 6, node 9, and node 0. However, node 9 has an external fan-out to node 5 (external fan-out means that the fan-out node is not a transitive fan-in of the root node), so node 9 is not counted in the MFFC with node 3 as the root node. The maximum no-fan-out cone MFFC with node 3 as the root node is: {node 3, node 6, node 0}. Similarly, if the maximum no-fan-out cone MFFC with node 2 as the root node is: {node 2, node 4, node 5, node 8, node 7}.

[0096] The advantage of using the maximum fan-free cone MFFC is that if the root node of the maximum fan-free cone MFFC can be optimized and removed from the AIG graph, then the nodes in the entire maximum fan-free cone MFFC can be removed from the AIG graph. Figure 4 For example, suppose Figure 4 Node 3 in the figure can be removed without affecting the function of the entire AIG graph. After removing node 3, the output of node 6 will be left floating, which will not affect the AIG function and can be removed. Similarly, after removing node 6, the output of node 0 will not affect the AIG function and can be removed from the entire AIG. At this point, all the maximum fan-out cone MFFCs with node 3 as the root node have been removed from the preliminary optimized AIG graph.

[0097] Step S406, after the redundant nodes are cleared, each edge in the preliminary optimized AIG graph is subjected to XOR random simulation processing, and the redundant edges in the preliminary optimized AIG graph are deleted based on the XOR random simulation processing result, and the final AIG graph after logic optimization is output.

[0098] In an optional implementation, the "performing XOR random simulation processing on each edge in the preliminary optimized AIG graph" in step S406 includes:

[0099] Traverse each edge in the preliminary optimized AIG graph;

[0100] An XOR is constructed for each edge in the preliminary optimized AIG graph, and random simulation processing is performed to obtain the XOR result of each edge.

[0101] In an optional implementation, the step S406 of "deleting redundant edges in the preliminary optimized AIG graph based on the XOR random simulation processing result, and outputting the final AIG graph after logic optimization" includes:

[0102] If there is a target edge whose XOR result is always 0, perform SAT solver verification processing on the XOR corresponding to the XOR result, and obtain the SAT solution result;

[0103] If the SAT solution result indicates that there is no input that makes the XOR result 1, then the target edge is determined to be a redundant edge in the preliminary optimized AIG graph;

[0104] The redundant edges in the preliminary optimized AIG graph are deleted, and the related nodes corresponding to the redundant edges are optimized to output the final AIG graph after logic optimization.

[0105] For further information, see Figure 7 The flowchart of edge redundancy logic optimization is shown as Figure 7As shown in the figure, based on the preliminary optimized AIG graph after node redundant logic optimization, all its edges are traversed, and an XOR is built each time an edge is traversed. Then, the XOR is randomly simulated. If the result of the XOR is always 0 during the simulation, the SAT (Boolean satisfiability problem) is solved for the XOR. If the result of the solution is 0, that is, the SAT solution is not satisfied, it is proved that the logic of the edge is redundant logic. Then, the edge is deleted and the corresponding node is optimized, and the next edge is traversed.

[0106] In the random simulation link, if the result of the XOR is not always 0, it proves that the logic of the edge is not redundant, and directly traverses another edge. The SAT solution in this embodiment uses a mature SAT solution tool. The input of the SAT solution tool is a sum product expression (for example, (a+b)(b+c)), and each element in the expression is an input signal or the input signal is negated. This embodiment is based on AIG implementation. Therefore, before using the SAT tool, the AIG-based XOR must first be converted into a sum product form. In this embodiment, another conversion tool is used, which can convert a multi-input, single-output logic gate netlist into a sum product form as the input of the SAT solution tool. That is, when performing the SAT solver verification process, this embodiment converts the XOR result into the form of a sum product expression as the input of the SAT solver, and outputs whether there is at least one set of input signals through the SAT solver, so that the result of the XOR is 1. If the SAT solution result is 0 (that is, SAT is not satisfied), it means that no input signal is found that makes the XOR result 1, proving that the two AIG graphs are equivalent under all input conditions. Therefore, the original edge can be considered redundant and can be safely deleted. If the SAT solution result is not 0, it means that an input signal is found that makes the XOR result 1, proving that the edge is not redundant and should be retained.

[0107] In the construction of the XOR in this embodiment, the preliminary optimized AIG graph after node redundancy logic optimization is first copied, and the traversed edge is converted into a constant signal. Then, all the output signals in the preliminary optimized AIG graph after node redundancy logic optimization are XORed with the corresponding output signals in the copied AIG graph, and finally, each group of XOR results is ORed. Figure 8Another AIG graph and its corresponding XOR operation schematic diagram are shown. During the random simulation process, if the final OR operation result is 1, it proves that there is at least one set of original output signals that are different from the new output signals, which proves that the edge cannot be equivalent to a constant signal, so the edge must not be optimized and the next edge is traversed directly. If the final OR operation result during the random simulation process is always 0, it proves that the edge may be equivalent to a constant signal, and thus the SAT solution is started. The SAT solution is essentially to find a set of input signals that make the final result of the XOR device 1. If SAT is not satisfied, it means that such a signal cannot be found, which also means that the two AIGs are completely equivalent, that is, the traversed edge can be completely replaced by a constant value, and then the edge can be deleted and the corresponding node can be optimized. That is, when constructing the XOR device, this embodiment copies the preliminary optimized AIG graph after node redundancy logic optimization to obtain a copied AIG graph, and replaces the current edge of the copied AIG graph with a constant signal, and then performs an XOR operation on the corresponding output signals of the preliminary optimized AIG graph after node redundancy logic optimization and the copied AIG graph. Since some edges in the copied AIG graph have been converted into constant signals, the output signals of the two AIG graphs will be different in some cases. The purpose of the XOR operation is to capture these differences. Finally, each pair of XOR operation results are subjected to an OR operation, so that all possible differences are summarized into a single result.

[0108] In an AIG graph, all AND gate nodes have two inputs, so when one input is equivalent to a constant value, the node can be optimized. If the input of an AND gate node is 1, then the value of the output signal of the AND gate node is exactly the same as the other input signal of the AND gate node, so that the other input signal of the AND gate node can be connected to the output signal (the signal can be understood as an edge, so if both connected signals have non-logic, there will be no non-logic after the connection, and if only one signal has non-logic, then the non-logic is retained after the connection). If one input of an AND gate node is a constant value of 0, then the output of the node is always 0. For this case, first delete the node and its corresponding maximum fan-out cone MFFC, and then use 0 as the input signal of the output node of the node. If the edge connecting the node and the output node does not contain non-logic, then the output of the output node will also become a constant value of 0, and the same processing will be performed on the output node. If the edge connecting the node and the output node has non-logic, then the situation is the same as the case where the input is 1, and it is processed according to the case where the input is 1.

[0109] In this embodiment, after the redundant logic optimization of the edge is completed, the redundant logic optimization phase ends, and the final AIG graph after the logic optimization is obtained.

[0110] In summary, this embodiment first performs the classic AIG optimization method before performing redundant logic optimization, thereby reducing the size of the AIG. In practice, the time consumption of the subsequent redundant logic optimization link can be reduced to a certain extent. Afterwards, the redundant logic optimization is started from the two dimensions of nodes and edges, and the subsequent node and edge cleaning operations are coordinated to further improve the optimization space and optimization effect of the AIG from the perspective of redundant logic, more fully cover the optimization space, and improve the optimization effect.

[0111] In addition, before using the SAT solver to optimize the redundant logic of the edge, this embodiment first uses a random simulation method to determine whether the target edge is redundant. If the result of the XOR device is found to be 1 during the random simulation process, it proves that the target edge is not redundant, and there is no need to perform subsequent SAT solving operations. This method can greatly reduce the running time compared to directly using the SAT solving operation.

[0112] In this embodiment, an AIG redundant logic optimization device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements 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 conceivable.

[0113] This embodiment provides an AIG redundant logic optimization device, such as Fig. 9 As shown, including:

[0114] AIG graph acquisition module 901, used to acquire an input target AIG graph;

[0115] A preliminary optimization acquisition module 902 is used to perform replacement optimization processing on the AIG subgraph in the target AIG graph and obtain a preliminary optimized AIG graph;

[0116] A redundant node removal module 903 is used to calculate a simulation truth table corresponding to each node in the preliminary optimized AIG graph, and remove redundant nodes in the preliminary optimized AIG graph based on the simulation truth table;

[0117] The redundant edge deletion module 904 is used to perform XOR random simulation processing on each edge in the preliminary optimized AIG graph after the redundant nodes are cleared, delete the redundant edges in the preliminary optimized AIG graph based on the XOR random simulation processing results, and output the final AIG graph after logic optimization.

[0118] In some optional embodiments, the device is further used for:

[0119] Obtaining constraints of the target AIG graph; the constraints include the number of input signals and the number of input nodes;

[0120] The target AIG graph is checked based on the constraint condition, and when the target AIG graph satisfies the constraint condition, a subsequent logic optimization procedure of the target AIG graph is executed.

[0121] In some optional implementations, the preliminary optimization acquisition module 902 is further used to:

[0122] Traverse the AIG subgraph in the target AIG graph;

[0123] Obtaining an equivalent optimized subgraph of the AIG subgraph in a predefined AIG library;

[0124] Based on the equivalent optimized subgraph, the AIG subgraph is replaced and optimized, and a preliminary optimized AIG graph is obtained.

[0125] In an optional implementation, the redundant node clearing module 903 is further used to:

[0126] Based on the number of inputs in the preliminary optimized AIG graph, generating a simulation input sequence of the preliminary optimized AIG graph;

[0127] Based on the simulation input sequence, a simulation truth table corresponding to each node in the preliminary optimized AIG graph is calculated.

[0128] In an optional implementation, the redundant node clearing module 903 is further used to:

[0129] Compare the simulated truth tables corresponding to each node in the preliminary optimized AIG graph to identify nodes with the same logic;

[0130] Get and record the maximum fan-out-free cone of two logically identical nodes;

[0131] Compare the number of nodes in the maximum fan-out cones of the two nodes, and select the node corresponding to the maximum fan-out cone with a smaller number of nodes as a reserved node, and select the node corresponding to the maximum fan-out cone with a larger number of nodes as a redundant node;

[0132] All fan-outs of the redundant node are transferred to the reserved node, and the redundant node and the largest no-fan-out cone of the redundant node are deleted.

[0133] In an optional implementation, the redundant edge deletion module 904 is further configured to:

[0134] Traverse each edge in the preliminary optimized AIG graph;

[0135] An XOR is constructed for each edge in the preliminary optimized AIG graph, and random simulation processing is performed to obtain the XOR result of each edge.

[0136] In an optional implementation, the redundant edge deletion module 904 is further configured to:

[0137] If there is a target edge whose XOR result is always 0, perform SAT solver verification processing on the XOR corresponding to the XOR result, and obtain the SAT solution result;

[0138] If the SAT solution result indicates that there is no input that makes the XOR result 1, then the target edge is determined to be a redundant edge in the preliminary optimized AIG graph;

[0139] The redundant edges in the preliminary optimized AIG graph are deleted, and the related nodes corresponding to the redundant edges are optimized to output the final AIG graph after logic optimization.

[0140] 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.

[0141] In this embodiment, an AIG redundant logic optimization device 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.

[0142] See also Fig.10 , Fig.10 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Fig.10 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.10 A processor 10 is taken as an example.

[0143] 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.

[0144] 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.

[0145] 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.

[0146] 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.

[0147] 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.10 The example of connecting through bus is taken in the following.

[0148] 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, a pointer, 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 display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display.

[0149] 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.

[0150] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, 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 may be any available computer-readable storage medium or communication medium accessible to the computer.

[0151] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A method for optimizing AIG redundant logic. It is characterized in that The method comprises: Obtaining an input target AIG graph; the target AIG graph is used to indicate a logic circuit to be optimized; Performing replacement optimization processing on the AIG subgraph in the target AIG graph, and obtaining a preliminary optimized AIG graph; Calculating a simulation truth table corresponding to each node in the preliminary optimized AIG graph, and removing redundant nodes in the preliminary optimized AIG graph based on the simulation truth table; After the redundant nodes are cleared, each edge in the preliminary optimized AIG graph is subjected to XOR random simulation processing, the redundant edges in the preliminary optimized AIG graph are deleted based on the XOR random simulation processing result, and a final AIG graph after logic optimization is output to reduce the connections in the logic circuit; The step of removing redundant nodes in the preliminary optimized AIG graph based on the simulation truth table comprises: Comparing the simulated truth tables corresponding to each node in the preliminary optimized AIG graph to identify nodes with the same logic; Get and record the maximum fan-out-free cone of two logically identical nodes; Compare the number of nodes in the maximum fan-out cones of the two nodes, and select the node corresponding to the maximum fan-out cone with a smaller number of nodes as a reserved node, and select the node corresponding to the maximum fan-out cone with a larger number of nodes as a redundant node; Transfer all fan-outs of the redundant node to the reserved node, and delete the redundant node and the largest no-fan-out cone of the redundant node; The method of deleting redundant edges in the preliminary optimized AIG graph based on the XOR random simulation processing result and outputting the final AIG graph after logic optimization includes: If there is a target edge whose XOR result is always 0, perform SAT solver verification processing on the XOR corresponding to the XOR result, and obtain a SAT solution result; If the SAT solution result indicates that there is no input that makes the XOR result 1, then determining that the target edge is a redundant edge in the preliminary optimized AIG graph; The redundant edges in the preliminary optimized AIG graph are deleted, and the related nodes corresponding to the redundant edges are optimized to output the final AIG graph after logic optimization.

2. The method according to claim 1, It is characterized in that Before performing the replacement optimization process on the subgraph in the target AIG graph, the method further includes: Obtaining constraints of the target AIG graph; the constraints include the number of input signals and the number of input nodes; The target AIG graph is checked based on the constraint conditions, and when the target AIG graph satisfies the constraint conditions, a subsequent logic optimization procedure of the target AIG graph is executed.

3. The method according to claim 1, It is characterized in that The replacing and optimizing the AIG subgraph in the target AIG graph and obtaining a preliminary optimized AIG graph includes: Traversing the AIG subgraph in the target AIG graph; Acquire an equivalent optimized subgraph of the AIG subgraph in a predefined AIG library; Based on the equivalent optimized subgraph, the AIG subgraph is replaced and optimized, and a preliminary optimized AIG graph is obtained.

4. The method according to claim 1, It is characterized in that The calculating of the simulation truth table corresponding to each node in the preliminary optimized AIG graph includes: Based on the number of inputs in the preliminary optimized AIG graph, generating a simulation input sequence of the preliminary optimized AIG graph; Based on the simulation input sequence, a simulation truth table corresponding to each node in the preliminary optimized AIG graph is calculated.

5. The method according to claim 1, It is characterized in that The performing XOR random simulation processing on each edge in the preliminary optimized AIG graph includes: Traversing each edge in the preliminary optimized AIG graph; An XOR is constructed for each edge in the preliminary optimized AIG graph, and random simulation processing is performed to obtain the XOR result of each edge.

6. An AIG redundant logic optimization device, It is characterized in that The device comprises: An AIG graph acquisition module is used to acquire an input target AIG graph; the target AIG graph is used to indicate a logic circuit to be optimized; A preliminary optimization acquisition module, used for performing replacement optimization processing on the AIG subgraph in the target AIG graph, and obtaining a preliminary optimized AIG graph; A redundant node removal module, used to calculate a simulation truth table corresponding to each node in the preliminary optimized AIG graph, and remove redundant nodes in the preliminary optimized AIG graph based on the simulation truth table; A redundant edge deletion module is used to perform XOR random simulation processing on each edge in the preliminary optimized AIG graph after the redundant nodes are cleared, delete the redundant edges in the preliminary optimized AIG graph based on the XOR random simulation processing result, and output the final AIG graph after logic optimization to reduce the connections in the logic circuit; The redundant node clearing module is further used for: Comparing the simulated truth tables corresponding to each node in the preliminary optimized AIG graph to identify nodes with the same logic; Get and record the maximum fan-out-free cone of two logically identical nodes; Compare the number of nodes in the maximum fan-out cones of the two nodes, and select the node corresponding to the maximum fan-out cone with a smaller number of nodes as a reserved node, and select the node corresponding to the maximum fan-out cone with a larger number of nodes as a redundant node; Transfer all fan-outs of the redundant node to the reserved node, and delete the redundant node and the largest no-fan-out cone of the redundant node; The redundant edge deletion module is further used for: If there is a target edge whose XOR result is always 0, perform SAT solver verification processing on the XOR corresponding to the XOR result, and obtain a SAT solution result; If the SAT solution result indicates that there is no input that makes the XOR result 1, then determining that the target edge is a redundant edge in the preliminary optimized AIG graph; The redundant edges in the preliminary optimized AIG graph are deleted, and the related nodes corresponding to the redundant edges are optimized to output the final AIG graph after logic optimization.

7. 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 AIG redundant logic optimization method according to any one of claims 1 to 5 by executing the computer instructions.

8. 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 an AIG redundant logic optimization method according to any one of claims 1 to 5.