Hierarchical netlist reconstruction method and device, electronic equipment and storage medium
By splitting instance references and reconnecting signal lines in the initial hierarchical netlist, the problem of reverse reconstruction of the hierarchical netlist after flattening is solved, realizing the restoration of the integrity and accuracy of the hierarchical netlist and improving readability and analyzability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SUZHOU YIGE TECH CO LTD
- Filing Date
- 2026-05-14
- Publication Date
- 2026-06-12
AI Technical Summary
In electronic design automation processes, the flattened hierarchical netlist is difficult to reconstruct in reverse, resulting in low reconstruction integrity and accuracy, which affects subsequent applications.
By splitting the initial hierarchical netlist into instance references, constructing instance mapping relationships, and reconnecting signal lines based on the connection relationships, the original hierarchical structure is restored.
It achieves completeness and accuracy in the reverse reconstruction of hierarchical netlists, improves readability and analyzability, and avoids hierarchical errors caused by inaccurate location speculation.
Smart Images

Figure CN122197753A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electronic design technology, and more specifically to a method, apparatus, electronic device, and storage medium for hierarchical netlist reconstruction. Background Technology
[0002] In electronic design automation (EDA) workflows, logic synthesis tools typically take hardware description languages (HMRs) as input and generate hierarchical netlists after optimization. These netlists preserve the modular division and hierarchical structure of the design, facilitating functional analysis, debugging, and subsequent optimization. However, in practical engineering, synthesis tools often flatten the hierarchical netlists to enable cross-level logic optimization. This flattening reduces the readability and analyzability of the netlist, making it difficult to correlate with the original HMR code. Reverse engineering from the flattened netlist is challenging, resulting in low completeness and accuracy, thus impacting its subsequent applications. Summary of the Invention
[0003] This invention provides a hierarchical netlist reconstruction method, apparatus, electronic device, and storage medium to solve the problems of high difficulty, low reconstruction integrity, and low accuracy in the reverse reconstruction of flat netlists.
[0004] In a first aspect, the present invention provides a hierarchical netlist reconstruction method, the method comprising: The initial hierarchical netlist is split by instance references to obtain the first-level netlist corresponding to the initial hierarchical netlist; Match and orient the first-level netlist with the flat netlist corresponding to the initial-level netlist to construct the instance mapping relationship between the first-level netlist and the flat netlist; Based on the connection relationships corresponding to the flat netlist, the connection relationships corresponding to the first-level netlist, and the instance mapping relationships, signal lines are reconnected to obtain the target-level netlist.
[0005] In one optional implementation, the initial hierarchical netlist is split by instance references to obtain the first-level netlist corresponding to the initial hierarchical netlist, including: Based on the instance reference relationships between modules in the initial hierarchical netlist, the modules to be split are identified that have multiple instance reference relationships; Based on the number of instance references to the module to be split, the module to be split is copied to obtain multiple copied modules; Based on the instance reference relationships of the modules to be split, an instance reference relationship is assigned and connected for each of the multiple copied modules to obtain the first-level netlist.
[0006] In one optional implementation, the first-level netlist is matched and directed with the flat netlist corresponding to the initial-level netlist to construct an instance mapping relationship between the first-level netlist and the flat netlist, including: Traverse the first-level netlist to obtain the hierarchical path names of each instance of the first-level netlist; Match the hierarchical path name of the hierarchical netlist instance with the flat netlist instance in the flat netlist; Establish an instance mapping relationship between the first successfully matched flat netlist instance and the corresponding first-level netlist instance; Based on the location of the second flat netlist instance that failed to match, the second level netlist instance corresponding to the second flat netlist instance is inserted into the first level netlist, and the instance mapping relationship between the second flat netlist instance and the corresponding second level netlist instance is constructed.
[0007] In one optional implementation, based on the location of the second flat netlist instance that failed to match, a second-level netlist instance corresponding to the second flat netlist instance is inserted into the first-level netlist, including: Based on the signal connection relationship corresponding to the flat netlist, determine the driver instance corresponding to the second flat netlist instance; In the first-level netlist, the driver instance corresponding to the second flat netlist instance is searched and located to determine the module corresponding to the second flat netlist instance. Create a second-level netlist instance corresponding to the second flat netlist instance, and insert the corresponding second-level netlist instance into the module corresponding to the second flat netlist instance.
[0008] In one optional implementation, creating a second-level netlist instance corresponding to the second flat netlist instance includes: Create a second-level netlist instance and copy the instance properties of the corresponding second-level flat netlist instance; If there are multiple hierarchical netlist instances in the first-level netlist that correspond to the second-flat netlist instance, then port mapping is performed based on the port calls of the multiple hierarchical netlist instances corresponding to the second-flat netlist instance to obtain the port calls corresponding to the second-level netlist instance.
[0009] In an optional implementation, after establishing an instance mapping relationship between the first successfully matched flat netlist instance and the corresponding first-level netlist instance, the method further includes: Search the first-level netlist to determine the referenced module corresponding to the first-level netlist instance; Based on the signal connection relationships corresponding to the flat netlist, determine the reference module corresponding to the first flat netlist instance; If the reference module corresponding to the first-level netlist instance is inconsistent with the reference module corresponding to the first flat netlist instance, the reference module corresponding to the first-level netlist instance shall be modified based on the reference module corresponding to the first flat netlist instance.
[0010] In one optional implementation, signal lines are reconnected based on the connection relationships corresponding to the flat netlist, the connection relationships corresponding to the first-level netlist, and the instance mapping relationships to obtain the target-level netlist, including: Disconnect connections in the first-level netlist that do not exist in the flat netlist, and update the port mappings in the first-level netlist; Based on instance mapping relationships, the flat netlist is mapped to the hierarchical structure of the target level netlist; Configure port calls for the target level netlist based on instance mapping relationships and port mapping of the first-level netlist.
[0011] In a second aspect, the present invention provides a hierarchical netlist reconstruction apparatus, the apparatus comprising: The instance reference splitting module is used to split the initial hierarchical netlist into instance references to obtain the first-level netlist corresponding to the initial hierarchical netlist. The mapping relationship construction module is used to match and orient the first-level netlist with the flat netlist corresponding to the initial-level netlist, and construct the instance mapping relationship between the first-level netlist and the flat netlist; The signal line connection module is used to reconnect signal lines based on the connection relationships corresponding to the flat netlist, the connection relationships corresponding to the first-level netlist, and the instance mapping relationships to obtain the target-level netlist.
[0012] Thirdly, the present invention provides an electronic device, comprising: 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 computer instructions to perform the hierarchical netlist reconstruction method described in the first aspect or any corresponding embodiment thereof.
[0013] Fourthly, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to perform the hierarchical netlist reconstruction method of the first aspect or any corresponding embodiment thereof.
[0014] Fifthly, the present invention provides a computer program product, including computer instructions for causing a computer to execute the hierarchical netlist reconstruction method of the first aspect or any corresponding embodiment thereof.
[0015] The hierarchical netlist reconstruction method provided in this invention performs instance reference decomposition on the initial hierarchical netlist to obtain the first-level netlist corresponding to the initial hierarchical netlist. This ensures the uniqueness of instance references between modules in the initial hierarchical netlist, avoids reference conflicts between different instances, and improves the consistency and accuracy of establishing the instance mapping relationship between the first-level netlist and the flat netlist. The method then matches and orients the first-level netlist with the flat netlist corresponding to the initial hierarchical netlist, establishing a precise instance mapping relationship between the two. This accurately determines the precise location of each module or instance, avoiding hierarchical errors caused by inaccurate location estimation during subsequent reverse reconstruction. Based on the connection relationships corresponding to the flat netlist, the connection relationships corresponding to the first-level netlist, and the instance mapping relationship, signal lines are reconnected to obtain the target hierarchical netlist. This allows for accurate restoration of the original hierarchical structure during reverse reconstruction, improving the integrity of the reconstruction. Attached Figure Description
[0016] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0017] Figure 1 This is a first flowchart of a hierarchical netlist reconstruction method according to an embodiment of the present invention; Figure 2 This is a second flowchart of the hierarchical netlist reconstruction method according to an embodiment of the present invention; Figure 3 This is an example diagram of the initial hierarchical netlist in the hierarchical netlist reconstruction method according to an embodiment of the present invention; Figure 4 This is an example diagram of the first-level netlist in the hierarchical netlist reconstruction method according to an embodiment of the present invention; Figure 5 This is a third flowchart of the hierarchical netlist reconstruction method according to an embodiment of the present invention; Figure 6 This is an example diagram of port multiplexing in the hierarchical netlist reconstruction method according to an embodiment of the present invention; Figure 7 This is a fourth flowchart of the hierarchical netlist reconstruction method according to an embodiment of the present invention; Figure 8 This is an example diagram of a flat netlist in the hierarchical netlist reconstruction method according to an embodiment of the present invention; Figure 9 This is an example diagram of the first-level netlist in the hierarchical netlist reconstruction method according to an embodiment of the present invention; Figure 10 This is an example diagram of the modified first-level netlist in the hierarchical netlist reconstruction method according to an embodiment of the present invention; Figure 11 This is a structural block diagram of a hierarchical netlist reconstruction apparatus according to an embodiment of the present invention; Figure 12 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] It is understood that before using the technical solutions disclosed in the various embodiments of the present invention, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in the present invention and their authorization should be obtained in accordance with relevant laws and regulations through appropriate means.
[0020] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0021] In electronic design automation (EDA) workflows, logic synthesis tools typically take hardware description languages (HDLs) as input and generate hierarchical netlists after optimization. These netlists preserve the modular division and hierarchical structure of the design, facilitating functional analysis, debugging, and subsequent optimization. However, in actual engineering, synthesis tools often perform flattening after generating the hierarchical netlist, expanding the hierarchical structure into a flat netlist structure (flat netlist) to enable cross-level logic optimization, such as gate merging across modules, logic sharing, and redundancy elimination. While flattening benefits the synthesizer's global optimization and effectively improves timing performance and area utilization, it disrupts the original hierarchical structure information. The boundary information of the original modules, signal and instance names may be renamed or merged, making it difficult to directly correspond to the original HDL code. This reduces readability and analyzability, increases the difficulty of design analysis and debugging, and makes reverse reconstruction from the flat netlist back to the original hierarchical structure highly challenging. Furthermore, since cross-level optimization may change the signal topology, instance boundaries, or even replace some sub-modules, traditional reconstruction methods based on name matching or simple pattern matching are prone to failure, resulting in incomplete or incorrect reconstruction results.
[0022] To address the aforementioned technical problems, this invention provides a hierarchical netlist reconstruction method. The method involves splitting instance references in the initial hierarchical netlist to obtain a first-level netlist corresponding to the initial hierarchical netlist. This ensures the uniqueness of instance references between modules in the initial hierarchical netlist, avoids reference conflicts between different instances, and improves the consistency and accuracy of establishing instance mapping relationships between the first-level netlist and the flat netlist. The method then matches and orients the first-level netlist with the flat netlist corresponding to the initial hierarchical netlist, establishing a precise instance mapping relationship between the two. This accurately determines the precise location of each module or instance, preventing hierarchical errors caused by inaccurate location estimation during subsequent reverse reconstruction. Based on the connection relationships corresponding to the flat netlist, the connection relationships corresponding to the first-level netlist, and the instance mapping relationships, signal lines are reconnected to obtain the target hierarchical netlist. This allows for accurate restoration of the original hierarchical structure during reverse reconstruction, improving the integrity of the reconstruction.
[0023] According to an embodiment of the present invention, a hierarchical netlist reconstruction method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0024] This embodiment provides a hierarchical netlist reconstruction method that can be used in any electronic design tool. Figure 1 This is a flowchart of a first type of hierarchical netlist reconstruction method according to an embodiment of the present invention, such as... Figure 1 As shown, the process includes the following steps: Step S101: Perform instance reference splitting on the initial hierarchical netlist to obtain the first-level netlist corresponding to the initial hierarchical netlist.
[0025] In this embodiment of the invention, the initial hierarchical netlist is a structured netlist in electronic design, which retains the hierarchical information of electronic design. Each module is described as an independent unit in the initial hierarchical netlist, and different modules are connected through instantiation. The same module can be instantiated and referenced at different levels and multiple times.
[0026] In this embodiment of the invention, in the initial hierarchical netlist, modules with multiple instance references are split into multiple modules with one instance reference and independent module definitions, to obtain the first-level netlist corresponding to the initial hierarchical netlist, thereby avoiding reference conflicts between different instances and ensuring the consistency of subsequent instance mapping relationship establishment and reverse reconstruction.
[0027] Step S102: Match and orient the first-level netlist with the flat netlist corresponding to the initial-level netlist to construct the instance mapping relationship between the first-level netlist and the flat netlist.
[0028] In this embodiment of the invention, the flat netlist corresponding to the initial hierarchical netlist refers to the netlist structure obtained after flattening the initial hierarchical netlist. Instance matching is performed on the first-level netlist and the flat netlist to determine the matching instances. Based on the instance matching relationship, an instance mapping relationship between the first-level netlist and the flat netlist is constructed. Simultaneously, for instances that fail to match in the flat netlist, based on the context relationship of the instance in the flat netlist, they are directed in the first-level netlist to determine their position in the first-level netlist, and based on this, an instance mapping relationship between the first-level netlist and the flat netlist is constructed.
[0029] Step S103: Based on the connection relationships corresponding to the flat netlist, the connection relationships corresponding to the first-level netlist, and the instance mapping relationships, reconnect the signal lines to obtain the target-level netlist.
[0030] In this embodiment of the invention, signal lines are reconnected by combining the connection relationships corresponding to the flat netlist and the connection relationships corresponding to the first-level netlist through instance mapping relationships, thereby performing reverse reconstruction to obtain the target-level netlist.
[0031] The hierarchical netlist reconstruction method provided in this invention performs instance reference decomposition on the initial hierarchical netlist to obtain the first-level netlist corresponding to the initial hierarchical netlist. This ensures the uniqueness of instance references between modules in the initial hierarchical netlist, avoids reference conflicts between different instances, and improves the consistency and accuracy of establishing the instance mapping relationship between the first-level netlist and the flat netlist. The method then matches and orients the first-level netlist with the flat netlist corresponding to the initial hierarchical netlist, establishing a precise instance mapping relationship between the two. This accurately determines the precise location of each module or instance, avoiding hierarchical errors caused by inaccurate location estimation during subsequent reverse reconstruction. Based on the connection relationships corresponding to the flat netlist, the connection relationships corresponding to the first-level netlist, and the instance mapping relationship, signal lines are reconnected to obtain the target hierarchical netlist. This allows for accurate restoration of the original hierarchical structure during reverse reconstruction, improving the integrity of the reconstruction.
[0032] This embodiment provides a hierarchical netlist reconstruction method that can be used in any electronic design tool. Figure 2 This is a second flowchart of the hierarchical netlist reconstruction method according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps: Step S201: Perform instance reference splitting on the initial hierarchical netlist to obtain the first-level netlist corresponding to the initial hierarchical netlist.
[0033] Specifically, step S201 includes: Step S2011: Based on the instance reference relationships between modules in the initial hierarchical netlist, determine the modules to be split that have multiple instance reference relationships.
[0034] In this embodiment of the invention, an instance reference relationship of a module refers to the relationship in which that module references an instance in another module. If a module references an instance in another module, then that module has an instance reference relationship with the other module. Modules with multiple instance reference relationships in the initial hierarchical netlist are identified as modules to be split, so that these modules can be split in subsequent steps, thereby ensuring that each module has only one instance reference. For example, Figure 3 This is an example diagram of the initial hierarchical netlist in the hierarchical netlist reconstruction method according to an embodiment of the present invention, such as... Figure 3 As shown, module A has instances a and b, module B has instances c and d, and module c has instances e and f. Module B references instance a in module A, module C references instance b in module A, and module C references instance d in module B. Figure 3 In the example, module C has two instance references, therefore module C is considered as the module to be split.
[0035] Step S2012: Based on the number of instance reference relationships of the module to be split, the module to be split is copied to obtain multiple copied modules.
[0036] In this embodiment of the invention, the module to be split is copied into multiple copies according to the number of instance reference relationships it has. The final total number of copies and the original module is consistent with the number of instance reference relationships the original module has. Figure 3 Taking module C as an example, module C has two instance references, so module C is copied once.
[0037] Step S2013: Based on the instance reference relationship of the modules to be split, assign and connect an instance reference relationship for each of the multiple copied modules to obtain the first-level netlist.
[0038] In this embodiment of the invention, the multiple instance reference relationships of the module to be split are respectively assigned to the multiple copied modules, and each copied module is assigned only one instance reference relationship. Each copied module is connected to the corresponding module according to the assigned instance reference relationship to obtain the first-level netlist. Figure 4 This is an example diagram of the first-level netlist in the hierarchical netlist reconstruction method according to an embodiment of the present invention. Figure 4 The first-level netlist shown is Figure 3 The first-level netlist corresponding to the initial-level netlist shown is as follows: Figure 4 As shown, module C is copied once to obtain module C'. An instance reference relationship is assigned to the original module C and module C' respectively, so that module C references instance b in module A, and module C' references instance d in module B. This results in a first-level netlist. In the first-level netlist, each module has only one instance reference, thus making the instance references in the first-level netlist unique.
[0039] Step S202 involves matching and orienting the first-level netlist with the corresponding flat netlist of the initial-level netlist to construct the instance mapping relationship between the first-level netlist and the flat netlist. For details, please refer to [link to details]. Figure 1 Step S102 of the illustrated embodiment will not be described again here.
[0040] Step S203: Based on the connection relationships corresponding to the flat netlist, the connection relationships corresponding to the first-level netlist, and the instance mapping relationships, reconnect the signal lines to obtain the target-level netlist. For details, please refer to [link to relevant documentation]. Figure 1 Step S103 of the illustrated embodiment will not be described again here.
[0041] The hierarchical netlist reconstruction method provided in this invention determines modules to be split based on instance reference relationships between modules in the initial hierarchical netlist. Based on the number of instance reference relationships in each module to be split, the module is copied to obtain multiple copied modules. Based on the instance reference relationships of the modules to be split, an instance reference relationship is assigned and connected to each of the multiple copied modules. This ensures the uniqueness of instance references between modules in the initial hierarchical netlist, avoids reference conflicts between different instances, and improves the consistency and accuracy of the subsequent establishment of instance mapping relationships between the first-level netlist and the flat netlist.
[0042] This embodiment provides a hierarchical netlist reconstruction method that can be used in any electronic design tool. Figure 5 This is a third flowchart of the hierarchical netlist reconstruction method according to an embodiment of the present invention, such as... Figure 5 As shown, the process includes the following steps: Step S501: Instance reference splitting is performed on the initial hierarchical netlist to obtain the first-level netlist corresponding to the initial hierarchical netlist. For details, please refer to [link to relevant documentation]. Figure 1 Step S101 of the illustrated embodiment will not be described again here.
[0043] Step S502: Match and orient the first-level netlist with the flat netlist corresponding to the initial-level netlist to construct the instance mapping relationship between the first-level netlist and the flat netlist.
[0044] Specifically, step S502 includes: Step S5021: Traverse the first-level netlist to obtain the hierarchical path name of each instance of the first-level netlist.
[0045] In this embodiment of the invention, the hierarchical netlist instance is a primitive instance. The first-level netlist is traversed sequentially from top to bottom until the hierarchical netlist instance in the first-level netlist is reached. The module names traversed in the path from the top of the first-level netlist to the hierarchical netlist instance are concatenated, and the module names are concatenated with a separator to obtain the hierarchical path name of the hierarchical netlist instance.
[0046] Step S5022: Match the hierarchical path name of the hierarchical netlist instance with the flat netlist instance in the flat netlist.
[0047] In this embodiment of the invention, the hierarchical path name of the hierarchical netlist instance is matched with the instance name of the flat netlist instance in the flat netlist. If the hierarchical path name of the hierarchical netlist instance matches the instance name of the flat netlist instance, it indicates that the hierarchical netlist instance and the flat netlist instance are successfully matched. If the hierarchical path name of the hierarchical netlist instance does not match the instance name of the flat netlist instance, it indicates that the hierarchical netlist instance and the flat netlist instance are not matched.
[0048] Step S5023: Establish an instance mapping relationship between the first successfully matched flat netlist instance and the corresponding first-level netlist instance.
[0049] In this embodiment of the invention, the first flat netlist instance and the first hierarchical netlist instance are successfully matched instances. Therefore, an instance mapping relationship is directly established between the first flat netlist instance and the corresponding first hierarchical netlist instance.
[0050] In one optional implementation, after establishing an instance mapping relationship between the successfully matched first flat netlist instance and the corresponding first-level netlist instance, the first-level netlist is searched to determine the reference module corresponding to the first-level netlist instance; based on the signal connection relationship corresponding to the flat netlist, the reference module corresponding to the first flat netlist instance is determined; if the reference module corresponding to the first-level netlist instance is inconsistent with the reference module corresponding to the first flat netlist instance, it indicates that the instance was replaced during the flattening process of the initial level netlist. Therefore, based on the reference module corresponding to the first flat netlist instance, the reference module corresponding to the first-level netlist instance is modified, so that when the reference module of the first-level netlist instance is inconsistent with the reference module of the corresponding first flat netlist instance, the first-level netlist instance is redirected to the correct module definition.
[0051] Step S5024: Based on the location of the second flat netlist instance that failed to match, insert the second level netlist instance corresponding to the second flat netlist instance into the first level netlist, and construct the instance mapping relationship between the second flat netlist instance and the corresponding second level netlist instance.
[0052] In this embodiment of the invention, the second flat netlist instance is an instance that failed to match in the flat netlist. Since instances may be renamed or merged during the flattening process of the initial hierarchical netlist, instances in the flat netlist may not be able to match instances in the initial hierarchical netlist or the first hierarchical netlist. Therefore, the context information of the failed-matching instance, i.e., the second flat netlist instance, is used to locate the position of the renamed or merged instance corresponding to the second flat netlist instance in the first hierarchical netlist. The second hierarchical netlist instance corresponding to the second flat netlist instance is then inserted into the located position. At the same time, an instance mapping relationship between the second flat netlist instance and the corresponding second hierarchical netlist instance is constructed. Thus, an instance mapping relationship between the successfully matched first flat netlist instance and the corresponding first hierarchical netlist instance, as well as an instance mapping relationship between the failed-matching second flat netlist instance and the corresponding second hierarchical netlist instance, are constructed respectively. This achieves the construction of instance mapping relationships corresponding to all instances in the flat netlist, ensuring the integrity of subsequent reverse reconstruction.
[0053] In an optional implementation, step S5024, based on the location of the second flat netlist instance that failed to match, inserting the second-level netlist instance corresponding to the second flat netlist instance into the first-level netlist may include the following steps: Step a1: Based on the signal connection relationship corresponding to the flat netlist, determine the driver instance corresponding to the second flat netlist instance.
[0054] In step a1, the instances in the flat netlist are sorted topologically according to the signal connection relationships between the instances, thereby determining the instance in the flat netlist that provides the input signal to the second flat netlist instance, which is the driver instance corresponding to the second flat netlist instance.
[0055] Step a2: Search and locate the driver instance corresponding to the second flat netlist instance in the first-level netlist to determine the module corresponding to the second flat netlist instance.
[0056] In step a2, the driver instance corresponding to the second flat netlist instance is searched in the first-level netlist to locate the module where the driver instance corresponding to the second flat netlist instance is located. The nearest common ancestor module of the module where the driver instance corresponding to the second flat netlist instance is located is calculated and used as the module corresponding to the second flat netlist instance.
[0057] The least common ancestor module of the module containing the driver instance corresponding to the second flat netlist instance is the lowest-level common parent module in the hierarchical structure of the driver instance corresponding to the second flat netlist instance. For example, if the driver instances corresponding to a second flat netlist instance are instance a and instance b, where instance a is located in module A and instance b is located in module B, and the top-level module of both module A and module B is module C, then the module corresponding to the second flat netlist instance is module C.
[0058] Step a3: Create a second-level netlist instance corresponding to the second flat netlist instance, and insert the corresponding second-level netlist instance into the module corresponding to the second flat netlist instance.
[0059] In step a3, a second-level netlist instance is created, and the instance attributes of the corresponding second flat netlist instance are copied to ensure logical consistency of the netlist. Meanwhile, since the flat netlist itself does not store information about instance replacement, merging, or splitting, it registers a port mapping table during optimization to serve as reference information for port mapping during hierarchical netlist reconstruction. When creating a second-level netlist instance, if multiple hierarchical netlist instances corresponding to the second flat netlist instance exist in the first-level netlist (meaning the second flat netlist instance was obtained through instance merging), the port mapping table is used to perform port mapping based on the port calls of the multiple hierarchical netlist instances corresponding to the second flat netlist instance. This allows for direct reuse of the port calls of the merged instance corresponding to the second flat netlist instance, without the need for additional port expansion.
[0060] For example, Figure 6 This is an example diagram of port multiplexing in the hierarchical netlist reconstruction method according to an embodiment of the present invention, such as... Figure 6 As shown, instance a is formed by merging instance eb and instance c. Therefore, when inserting instance a into the first-level netlist, the port a.p1 of instance a reuses the port of instance eb, that is, the port is mapped from ebp1 to a.p1. The port a.p2 of instance a reuses the port of instance c, that is, the port is mapped from c.p1 to a.p2.
[0061] Step S503: Based on the connection relationships corresponding to the flat netlist, the connection relationships corresponding to the first-level netlist, and the instance mapping relationships, reconnect the signal lines to obtain the target-level netlist. For details, please refer to [link to details]. Figure 1 Step S103 of the illustrated embodiment will not be described again here.
[0062] The hierarchical netlist reconstruction method provided in this invention traverses the first-level netlist to obtain the hierarchical path names of each hierarchical netlist instance in the first-level netlist. It then matches the hierarchical path names of the hierarchical netlist instances with the flat netlist instances in the flat netlist. For successfully matched first flat netlist instances, an instance mapping relationship is established between them and their corresponding first-level netlist instances. Based on the location of unmatched second flat netlist instances, a second-level netlist instance corresponding to the second flat netlist instance is inserted into the first-level netlist, and an instance mapping relationship is constructed between the second flat netlist instances and their corresponding second-level netlist instances. This achieves the construction of instance mapping relationships for all instances in the flat netlist, ensuring the integrity of subsequent reverse reconstruction.
[0063] This embodiment provides a hierarchical netlist reconstruction method that can be used in any electronic design tool. Figure 7 This is a fourth flowchart of the hierarchical netlist reconstruction method according to an embodiment of the present invention, such as... Figure 7 As shown, the process includes the following steps: Step S701: Perform instance reference splitting on the initial hierarchical netlist to obtain the first-level netlist corresponding to the initial hierarchical netlist. For details, please refer to [link to relevant documentation]. Figure 1 Step S101 of the illustrated embodiment will not be described again here.
[0064] Step S702 involves matching and orienting the first-level netlist with the corresponding flat netlist of the initial-level netlist to construct the instance mapping relationship between the first-level netlist and the flat netlist. For details, please refer to [link to relevant documentation]. Figure 1 Step S102 of the illustrated embodiment will not be described again here.
[0065] Step S703: Based on the connection relationships corresponding to the flat netlist, the connection relationships corresponding to the first-level netlist, and the instance mapping relationships, reconnect the signal lines to obtain the target-level netlist.
[0066] Specifically, step S703 includes: Step S7031: Disconnect the connections in the first-level netlist that do not exist in the flat netlist, and update the port mappings of the first-level netlist.
[0067] In this embodiment of the invention, the connection relationship refers to the connection relationship between the driver port and the load port in the netlist, that is, the connection relationship between the output port of the driver instance and the input port of the driven instance. Based on the instance mapping relationship, the connection relationship between the corresponding driver port and load port in the first-level netlist and the flat netlist is compared, and the connection relationship in the first-level netlist that does not exist in the flat netlist is disconnected.
[0068] For example, Figure 8 This is an example diagram of a flat netlist in the hierarchical netlist reconstruction method according to an embodiment of the present invention. Figure 9 This is an example diagram of the first-level netlist in the hierarchical netlist reconstruction method according to an embodiment of the present invention. Figure 10 This is an example diagram of the modified first-level netlist in the hierarchical netlist reconstruction method according to an embodiment of the present invention, for comparison. Figure 8 and Figure 9 It can be seen that in the first-level netlist, the set of instances of port D driver is {1, 2, 3, 4, 5}. The flattened netlist removes instance 1 from the set of instances of port D driver. The corresponding connection relationship is: port D driver {5}, instance 1 driver {2, 3, 4}. Therefore, as... Figure 10 As shown, disconnect port D from instance 1-4 in the first-level netlist.
[0069] In this embodiment of the invention, after disconnecting connections in the first-level netlist that do not exist in the flat netlist, the port mappings of the first-level netlist are updated to avoid inconsistencies between port reuse and port connections. Specifically, if an intermediate driver disconnects from a top-level port or primitive instance port, the mapping relationship between the intermediate driver and the load connected to it is retained. Figure 10 For example, Figure 10 If driver d is disconnected from its top-level port D, then the mapping from port D to driver d is removed, while the mapping from driver d to instances 2-4, namely drivers a, b, and c, is retained.
[0070] Step S7032: Based on the instance mapping relationship, map the flat netlist to the hierarchical structure of the target hierarchical netlist.
[0071] In this embodiment of the invention, all connection points driven by each instance are obtained from the flat netlist, that is, all load ports driven by the driver ports of each instance are obtained. Based on the instance mapping relationship, the positions of the driver ports and load ports in the hierarchical netlist are determined, for example, which module in the hierarchical netlist they are located in. Based on the located positions, the driver ports and load ports of each instance are mapped to the corresponding positions in the hierarchical netlist. At the same time, combined with the instance mapping relationship, the hierarchical position of each instance is determined. Combined with the module location of each instance, the Lowest Common Ancestor (LCA) algorithm is used to determine the signal connection relationship between each instance. The instances between each module are connected according to the signal connection relationship to construct the hierarchical structure of the target hierarchical netlist.
[0072] Step S7033: Configure port calls for the target level netlist based on instance mapping relationships and port mapping of the first-level netlist.
[0073] In this embodiment of the invention, based on the instance mapping relationship, the port mapping corresponding to each instance in the target hierarchical netlist obtained by the flat netlist mapping is determined in the first hierarchical netlist. According to the corresponding port mapping in the first hierarchical netlist, the port calls in the target hierarchical netlist are configured in the same way. In this way, by utilizing the port reuse mapping relationship obtained in the preprocessing, it is ensured that the ports of each instance in the target hierarchical netlist can reuse the ports configured in the first hierarchical netlist.
[0074] This embodiment also provides a hierarchical netlist reconstruction apparatus for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0075] This embodiment provides a hierarchical netlist reconstruction device, such as Figure 11 As shown, it includes: The instance reference splitting module 1101 is used to split the initial hierarchical netlist into instance references to obtain the first-level netlist corresponding to the initial hierarchical netlist. The mapping relationship construction module 1102 is used to match and orient the first-level netlist with the flat netlist corresponding to the initial-level netlist, and construct the instance mapping relationship between the first-level netlist and the flat netlist. The signal line connection module 1103 is used to reconnect signal lines based on the connection relationship corresponding to the flat netlist, the connection relationship corresponding to the first-level netlist, and the instance mapping relationship to obtain the target-level netlist.
[0076] In one alternative implementation, the instance reference splitting module 1101 includes: The module to be split unit is used to determine the module to be split that has multiple instance reference relationships based on the instance reference relationships between modules in the initial hierarchical netlist. The module copying unit is used to copy the module to be split based on the number of instance reference relationships it has, resulting in multiple copied modules; The instance reference relationship allocation unit is used to allocate and connect an instance reference relationship for multiple copied modules based on the instance reference relationship of the modules to be split, so as to obtain the first-level netlist.
[0077] In one optional implementation, the mapping relationship construction module 1102 includes: The hierarchical path name determination unit is used to traverse the first-level netlist to obtain the hierarchical path name of each instance of the first-level netlist. The instance matching unit is used to match the hierarchical path name of a hierarchical netlist instance with the flat netlist instance in the flat netlist. The mapping relationship establishment unit is used to establish an instance mapping relationship between the first successfully matched flat netlist instance and the corresponding first-level netlist instance. The mapping relationship establishment unit is also used to insert the second-level netlist instance corresponding to the second flat netlist instance into the first-level netlist based on the location of the second flat netlist instance that failed to match, and to construct the instance mapping relationship between the second flat netlist instance and the corresponding second-level netlist instance.
[0078] In one optional implementation, the mapping relationship establishment unit includes: The driver instance determination sub-unit is used to determine the driver instance corresponding to the second flat netlist instance based on the signal connection relationship corresponding to the flat netlist. The driver instance location subunit is used to search and locate the driver instance corresponding to the second flat netlist instance in the first-level netlist, and determine the module corresponding to the second flat netlist instance. The hierarchical netlist instance insertion sub-unit is used to create a second-level netlist instance corresponding to the second-flat netlist instance, and insert the corresponding second-level netlist instance into the module corresponding to the second-flat netlist instance.
[0079] In one optional implementation, the mapping relationship establishment unit further includes: The hierarchical netlist instance creation sub-unit is used to create a second-level netlist instance and copy the instance attributes of the corresponding second flat netlist instance; The port mapping subunit is used to perform port mapping based on the port calls of the multiple hierarchical netlist instances corresponding to the second flat netlist instance if there are multiple hierarchical netlist instances in the first hierarchical netlist instance, so as to obtain the port calls corresponding to the second hierarchical netlist instance.
[0080] In an optional implementation, the mapping relationship construction module 1102 further includes: The first reference module determination unit is used to search the first-level netlist and determine the reference module corresponding to the first-level netlist instance; The second reference module determination unit is used to determine the reference module corresponding to the first flat netlist instance based on the signal connection relationship corresponding to the flat netlist. The reference module modification unit is used to modify the reference module corresponding to the first-level netlist instance based on the reference module corresponding to the first flat netlist instance if the reference module corresponding to the first-level netlist instance is inconsistent with the reference module corresponding to the first flat netlist instance.
[0081] In one optional implementation, the signal line connection module 1103 includes: The connection disconnection unit is used to disconnect connections in the first-level netlist that do not exist in the flat netlist, and to update the port mapping of the first-level netlist. The netlist mapping unit is used to map a flat netlist to the hierarchical structure of the target level netlist based on the instance mapping relationship. The port call configuration unit is used to configure port calls for the target level netlist based on instance mapping relationships and port mapping of the first-level netlist.
[0082] The hierarchical netlist reconstruction apparatus provided in this embodiment of the invention can execute the hierarchical netlist reconstruction method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects for executing the method. Further functional descriptions of the various modules and units described above are the same as in the corresponding embodiments described above, and will not be repeated here.
[0083] Figure 12 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.
[0084] The following is a detailed reference. Figure 12 The diagram illustrates a structural schematic suitable for implementing an electronic device according to embodiments of the present invention. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 1201, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 1202 or a program loaded from memory 1208 into random access memory (RAM) 1203. The RAM 1203 also stores various programs and data required for the operation of the electronic device. The processor 1201, ROM 1202, and RAM 1203 are interconnected via a bus 1204. An input / output (I / O) interface 1205 is also connected to the bus 1204.
[0085] Typically, the following devices can be connected to I / O interface 1205: input devices 1206 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 1207 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 1208 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1209. Communication device 1209 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 12 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.
[0086] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 1209, or installed from a memory 1208, or installed from a ROM 1202. When the computer program is executed by the processor 1201, it performs the functions defined in the hierarchical netlist reconstruction method of the embodiments of the present invention.
[0087] Figure 12 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.
[0088] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as recordable on a storage medium, or implemented as computer code originally stored on a remote storage medium or a non-transitory machine-readable storage medium and subsequently stored on a local storage medium after being downloaded via a network. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the hierarchical netlist reconstruction method shown in the above embodiments is implemented.
[0089] A portion of this invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to the invention through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.
[0090] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. A hierarchical netlist reconstruction method, characterized in that, The method includes: The initial hierarchical netlist is split by instance reference to obtain the first-level netlist corresponding to the initial hierarchical netlist; Match and orient the first-level netlist with the flat netlist corresponding to the initial-level netlist to construct an instance mapping relationship between the first-level netlist and the flat netlist; Based on the connection relationships corresponding to the flat netlist, the connection relationships corresponding to the first-level netlist, and the instance mapping relationships, signal lines are reconnected to obtain the target-level netlist.
2. The method according to claim 1, characterized in that, The step of splitting the initial hierarchical netlist by instance reference to obtain the first-level netlist corresponding to the initial hierarchical netlist includes: Based on the instance reference relationships between modules in the initial hierarchical netlist, the modules to be split are determined that have multiple instance reference relationships; Based on the number of instance reference relationships of the module to be split, the module to be split is copied to obtain multiple copied modules; Based on the instance reference relationships of the modules to be split, an instance reference relationship is assigned and connected to each of the multiple copied modules to obtain the first-level netlist.
3. The method according to claim 1, characterized in that, The step of matching and orienting the first-level netlist with the flat netlist corresponding to the initial-level netlist to construct the instance mapping relationship between the first-level netlist and the flat netlist includes: Traverse the first-level netlist to obtain the hierarchical path name of each instance of the first-level netlist; Match the hierarchical path name of the hierarchical netlist instance with the flat netlist instance in the flat netlist; Establish the instance mapping relationship between the first successfully matched flat netlist instance and the corresponding first-level netlist instance; Based on the location of the second flat netlist instance that failed to match, the second level netlist instance corresponding to the second flat netlist instance is inserted into the first level netlist, and an instance mapping relationship between the second flat netlist instance and the corresponding second level netlist instance is constructed.
4. The method according to claim 3, characterized in that, The step of inserting a second-level netlist instance corresponding to the second flat netlist instance into the first-level netlist based on the location of the second flat netlist instance that failed to match includes: Based on the signal connection relationship corresponding to the flat netlist, determine the driver instance corresponding to the second flat netlist instance; In the first-level netlist, the driver instance corresponding to the second flat netlist instance is searched and located to determine the module corresponding to the second flat netlist instance; Create a second-level netlist instance corresponding to the second flat netlist instance, and insert the corresponding second-level netlist instance into the module corresponding to the second flat netlist instance.
5. The method according to claim 4, characterized in that, The creation of the second-level netlist instance corresponding to the second flat netlist instance includes: Create a second-level netlist instance and copy the instance attributes of the corresponding second flat netlist instance; If there are multiple hierarchical netlist instances corresponding to the second flat netlist instance in the first hierarchical netlist, then port mapping is performed based on the port calls of the multiple hierarchical netlist instances corresponding to the second flat netlist instance to obtain the port calls corresponding to the second hierarchical netlist instance.
6. The method according to claim 3, characterized in that, After establishing the instance mapping relationship between the first successfully matched flat netlist instance and the corresponding first-level netlist instance, the method further includes: Search the first-level netlist to determine the reference module corresponding to the first-level netlist instance; Based on the signal connection relationship corresponding to the flat netlist, the reference module corresponding to the first flat netlist instance is determined. If the reference module corresponding to the first-level netlist instance is inconsistent with the reference module corresponding to the first-flat netlist instance, the reference module corresponding to the first-level netlist instance shall be modified based on the reference module corresponding to the first-flat netlist instance.
7. The method according to claim 1, characterized in that, The step of reconnecting signal lines based on the connection relationships corresponding to the flat netlist, the connection relationships corresponding to the first-level netlist, and the instance mapping relationships to obtain the target-level netlist includes: Disconnect any connections in the first-level netlist that do not exist in the flat netlist, and update the port mappings of the first-level netlist. Based on the instance mapping relationship, the flat netlist is mapped to the hierarchical structure of the target hierarchical netlist; Based on the instance mapping relationship and the port mapping of the first-level netlist, the port calls of the target-level netlist are configured.
8. A hierarchical netlist reconstruction device, characterized in that, The device includes: The instance reference splitting module is used to split the instance references of the initial hierarchical netlist to obtain the first-level netlist corresponding to the initial hierarchical netlist. The mapping relationship construction module is used to match and orient the first-level netlist with the flat netlist corresponding to the initial-level netlist, and construct the instance mapping relationship between the first-level netlist and the flat netlist; The signal line connection module is used to reconnect signal lines based on the connection relationship corresponding to the flat netlist, the connection relationship corresponding to the first-level netlist, and the instance mapping relationship to obtain the target-level netlist.
9. An electronic device, characterized in that, include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the hierarchical netlist reconstruction method according to any one of claims 1 to 7 by executing the computer instructions.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing a computer to perform the hierarchical netlist reconstruction method according to any one of claims 1 to 7.