Gate-level netlist pruning method and apparatus, electronic device, and storage medium

By using automated trimming methods to generate empty modules and overloaded macros, the problems of low efficiency and insufficient accuracy in gate-level netlist trimming are solved, achieving an efficient and accurate trimming process.

CN123050290APending Publication Date: 2026-11-06NANJING HOUMO TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611163329.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-31
Publication Date
2026-11-06

AI Technical Summary

Technical Problem

Existing technologies for gate-level netlist trimming are inefficient, and manual trimming is prone to introducing syntax and port connection errors, resulting in low trimming accuracy.

Method used

By reading the pruning configuration data, determining the pruning control target, generating empty modules and overloaded macros, and using conditional compilation macro code to automatically prune the gate-level netlist, the original module name is replaced with an overloaded macro, thus achieving automated pruning.

Benefits of technology

It improves the efficiency and accuracy of gate-level netlist pruning, avoids errors introduced by manual modification, and has the ability to flexibly adjust pruning strategies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123050290A_ABST
    Figure CN123050290A_ABST
Patent Text Reader

Abstract

This disclosure provides a gate-level netlist pruning method, apparatus, electronic device, and storage medium. It reads the pruning configuration data of the gate-level netlist and determines all pruning control targets of the gate-level netlist based on the configuration object name. For each pruning control target, it generates an empty module and overloaded macros corresponding to that pruning control target. Based on the macro switch name and the overloaded macro, original module name, and empty module name corresponding to each pruning control target, it generates conditional compilation macro code. This conditional compilation macro code is used to assign the overloaded macro to the corresponding original module name or empty module name according to the definition state of the macro switch name in the compilation command, and inserts the conditional compilation macro code into the gate-level netlist. For each pruning control target, it replaces the original module name in the original instantiation statement of that pruning control target in the gate-level netlist with the overloaded macro of that pruning control target. This achieves automated pruning of the gate-level netlist, improving pruning efficiency and accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to chip technology, and in particular to a gate-level netlist pruning method, apparatus, electronic device, and storage medium. Background Technology

[0002] A gate-level netlist is a text description file generated after register-transfer level code is synthesized. It consists of basic logic gates (such as AND gates, OR gates, NOT gates, flip-flops, etc.) and their interconnections. It is the foundation for chip post-simulation, formal verification, static timing analysis, and design for testability.

[0003] In the post-simulation stage of the chip, the entire gate-level netlist of the chip needs to be compiled, and the standard delayed timing file needs to be loaded simultaneously before timing simulation can be performed. When the gate-level netlist is large and contains many subsystems or modules, it requires a long compilation time, resulting in low efficiency of post-simulation.

[0004] To improve the efficiency of post-simulation of chips, it is usually necessary to prune the gate-level netlist, that is, remove the content in the gate-level netlist that is not needed for the current post-simulation verification task, and keep only the content to be tested.

[0005] In related technologies, gate-level netlist trimming is mainly achieved manually, that is, chip verification personnel modify the code in the gate-level netlist one by one to trim the gate-level netlist.

[0006] However, the manual trimming of gate-level netlists in related technologies is inefficient, and errors such as syntax and port connections are easily introduced during the manual modification of the code in the gate-level netlist, resulting in low trimming accuracy. Summary of the Invention

[0007] This disclosure provides a gate-level netlist trimming method, apparatus, electronic device, and storage medium.

[0008] According to the first aspect of this disclosure, a gate-level netlist pruning method is provided, comprising: Read the pruning configuration data of the gate-level netlist; wherein, the pruning configuration data includes at least one configuration object name and a macro switch name corresponding to each configuration object name; Determine all pruning control targets of the gate-level netlist based on the configured object name; For each clipping control target, an empty module corresponding to the clipping control target is generated based on the original module corresponding to the clipping control target, and an overloaded macro corresponding to the clipping control target is also generated. Based on the macro switch name and the overloaded macro corresponding to each clipping control target, the original module name of the original module, and the empty module name of the empty module, conditional compilation macro code is generated; wherein, the conditional compilation macro code is used to assign the overloaded macro to the corresponding original module name or empty module name according to the definition state of the macro switch name in the compilation command; Insert the conditional compilation macro code into the gate-level netlist; For each pruning control target, the original module name in the original instantiation statement of the pruning control target in the gate-level netlist is replaced with the overloaded macro of the pruning control target.

[0009] In one optional implementation, the configuration object name includes: a module-level configuration object name and / or an instance-level configuration object name; The macro switch name corresponding to the module-level configuration object name is the module-level macro switch name, and the macro switch name corresponding to the instance-level configuration object name is the instance-level macro switch name.

[0010] In one optional implementation, determining all pruning control targets of the gate-level netlist based on the configuration object name includes: For any module-level configuration object name, if the trimming configuration data contains an instance-level configuration object name for that module-level configuration object name, all module instances belonging to that module-level configuration object name will be used as instance-level trimming control targets. If the instance-level configuration object name corresponding to the module-level configuration object name does not exist in the trimming configuration data, the module corresponding to the module-level configuration object name will be used as the module-level trimming control target.

[0011] In one optional implementation, replacing the original module name in the original instantiation statement of the pruning control target in the gate-level netlist with the overloaded macro of the pruning control target includes: For a module-level trimming control target, identify all module instances belonging to that module-level trimming control target, and replace the original module name in the original instantiation statement of all the module instances with the overloaded macro of that module-level trimming control target; For instance-level pruning control targets, replace the original module name in the original instantiation statement of the instance-level pruning control target with the overloaded macro of the instance-level pruning control target.

[0012] In one optional implementation, the step of generating conditionally compiled macro code based on the macro switch name and the overloaded macro corresponding to each clipping control target, the original module name of the original module, and the empty module name of the empty module includes: For instance-level pruning control targets, instance-level code blocks are generated based on the overloaded macros, original module names, and empty module names corresponding to the instance-level pruning control targets. Identify the first module-level macro switch name and / or the second module-level macro switch name from the module-level macro switch names; wherein, the trimmed configuration data includes the instance-level macro switch name of the first module-level macro switch name, and the trimmed configuration data does not include the instance-level macro switch name of the second module-level macro switch name; For the first module-level macro switch name, generate a module-level code block based on the first module-level macro switch name and the instance-level code blocks of all instance-level clipping control targets under the module corresponding to the first module-level macro switch name; For the second module-level macro switch name, generate a module-level code block based on the second module-level macro switch name, the overloaded macro corresponding to the second module-level macro switch name, the original module name, and the empty module name; The conditional compilation macro code is generated based on each module-level code block.

[0013] In one optional implementation, generating instance-level code blocks based on the overloaded macros, original module names, and empty module names corresponding to the instance-level pruning control target includes: For a first instance-level pruning control target with an instance-level macro switch name, an instance-level conditional statement is generated based on the instance-level macro switch name corresponding to the first instance-level pruning control target. This generates a retained instance branch where the overloaded macro definition is the original module name and a pruning instance branch where the overloaded macro definition is an empty module name. Based on the instance-level conditional statement, the retained instance branch, and the pruning instance branch, a first branch of the first instance-level pruning control target is generated; a second branch of the first instance-level pruning control target where the overloaded macro definition is the original module name or an empty module name is generated. For a second instance-level pruning control target that does not have an instance-level macro switch name, generate a retained instance branch with the overloaded macro definition of the original module name, and generate a pruning instance branch with the overloaded macro definition of the empty module name.

[0014] In one optional implementation, generating a module-level code block for a first module-level macro switch name, based on the first module-level macro switch name and all instance-level clipping control targets belonging to the module corresponding to the first module-level macro switch name, includes: For the first module-level macro switch name, a module-level conditional statement is generated based on the first module-level macro switch name. The first branch and the second branch of the first instance-level pruning control target belonging to the module corresponding to the first module-level macro switch name are respectively inserted into different branches corresponding to the module-level conditional statement. The retained instance branch and the pruning instance branch of the second instance-level pruning control target belonging to the module corresponding to the first module-level macro switch name are respectively inserted into different branches corresponding to the module-level conditional statement. The step of generating a module-level code block based on the second module-level macro switch name, the corresponding overloaded macro, the original module name, and the empty module name includes: For the second module-level macro switch name, generate module-level conditional statements based on the second module-level macro switch name, generate a retained module branch with overloaded macro definitions of the original module name, and generate a trimmed module branch with overloaded macro definitions of empty module names.

[0015] In one optional implementation, generating an empty module corresponding to the trimming control target based on the original module corresponding to the trimming control target includes: Generate an empty module with the same port declaration as the original module; Set the internal logic of the empty module to empty, and assign a fixed value to the output port of the empty module.

[0016] According to a second aspect of this disclosure, a gate-level netlist trimming apparatus is provided, comprising: The reading module is used to read the pruning configuration data of the gate-level netlist; wherein, the pruning configuration data includes at least one configuration object name and a macro switch name corresponding to each configuration object name; The pruning target determination module is used to determine all pruning control targets of the gate-level netlist based on the configured object name; The first generation module is used to generate an empty module corresponding to each clipping control target based on the original module corresponding to the clipping control target, and to generate an overloaded macro corresponding to the clipping control target for each clipping control target. The second generation module is used to generate conditional compilation macro code based on the macro switch name and the overloaded macro corresponding to each clipping control target, the original module name of the original module, and the empty module name of the empty module; wherein, the conditional compilation macro code is used to assign the overloaded macro to the corresponding original module name or empty module name according to the definition state of the macro switch name in the compilation command; The code insertion module is used to insert the conditional compilation macro code into the gate-level netlist; The replacement module is used to replace the original module name in the original instantiation statement of the pruning control target in the gate-level netlist with the overloaded macro of the pruning control target for each pruning control target.

[0017] According to a third aspect of this disclosure, an electronic device is provided, comprising: Memory, used to store computer programs; The processor is configured to execute a computer program stored in the memory, and when the computer program is executed, to implement the above-described gate-level netlist pruning method.

[0018] According to a fourth aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the above-described gate-level netlist pruning method.

[0019] According to a fifth aspect of this disclosure, a computer program product is provided, including computer program instructions that, when executed by a processor, implement the above-described gate-level netlist pruning method.

[0020] Based on the embodiments of this disclosure, by reading the pruning configuration data of the gate-level netlist, all pruning control targets of the gate-level netlist are determined according to the configuration object name; for each pruning control target, an empty module and overloaded macro corresponding to the pruning control target are generated; conditional compilation macro code is generated according to the macro switch name and the overloaded macro, original module name and empty module name corresponding to each pruning control target. The conditional compilation macro code is used to assign the overloaded macro to the corresponding original module name or empty module name according to the definition state of the macro switch name in the compilation command, and the conditional compilation macro code is inserted into the gate-level netlist; for each pruning control target, the original module name in the original instantiation statement of the pruning control target in the gate-level netlist is replaced with the overloaded macro of the pruning control target, thereby realizing the automatic pruning of the gate-level netlist and improving the pruning efficiency and pruning accuracy of the gate-level netlist.

[0021] The technical solutions of this disclosure will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description

[0022] The accompanying drawings, which form part of this specification, illustrate embodiments of this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0023] This disclosure will become clearer with reference to the accompanying drawings and the following detailed description, wherein: Figure 1 A flowchart illustrating a gate-level netlist pruning method provided in an embodiment of this disclosure is shown. Figure 2 A flowchart illustrating another gate-level netlist pruning method provided in an embodiment of this disclosure is shown. Figure 3 A flowchart illustrating yet another gate-level netlist pruning method provided in an embodiment of this disclosure is shown; Figure 4 A flowchart illustrating an instance-level code block generation method provided in an embodiment of this disclosure is shown. Figure 5 A schematic diagram of a gate-level netlist trimming device provided in an embodiment of this disclosure is shown. Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure is shown. Detailed Implementation

[0024] Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that, unless otherwise specifically stated, the relative arrangement, numerical expressions, and values ​​of the components and steps set forth in these embodiments do not limit the scope of the present disclosure.

[0025] Those skilled in the art will understand that the terms "first," "second," etc., in the embodiments of this disclosure are only used to distinguish different steps, devices, or modules, and do not represent any specific technical meaning, nor do they indicate a necessary logical order between them.

[0026] It should also be understood that in the embodiments disclosed herein, "multiple" can refer to two or more, and "at least one" can refer to one, two or more.

[0027] It should also be understood that any component, data or structure mentioned in the embodiments of this disclosure can generally be understood as one or more unless expressly defined or given to the contrary in the context.

[0028] Furthermore, the term "and / or" in this disclosure is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this disclosure generally indicates that the preceding and following related objects have an "or" relationship.

[0029] It should also be understood that the description of the various embodiments in this disclosure emphasizes the differences between the various embodiments, and the similarities or similarities can be referred to each other. For the sake of brevity, they will not be described in detail.

[0030] At the same time, it should be understood that, for ease of description, the dimensions of the various parts shown in the accompanying drawings are not drawn according to actual scale.

[0031] The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit this disclosure or its application or use.

[0032] Techniques, methods, and equipment known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and equipment should be considered part of the specification.

[0033] It should be noted that similar labels and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be discussed further in subsequent figures.

[0034] The embodiments disclosed herein can be applied to electronic devices such as terminal devices, computer systems, and servers, and can operate together with a wide range of other general-purpose or special-purpose computing system environments or configurations. Examples of well-known terminal devices, computing systems, environments, and / or configurations suitable for use with electronic devices such as terminal devices, computer systems, and servers include, but are not limited to: personal computer systems, server computer systems, thin clients, thick clients, handheld or laptop devices, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputer systems, mainframe computer systems, and distributed cloud computing environments including any of the above systems, etc.

[0035] Electronic devices such as terminal devices, computer systems, and servers can be described in the general context of computer system executable instructions (such as program modules) executed by a computer system. Typically, program modules can include routines, programs, object programs, components, logic, data structures, etc., which perform specific tasks or implement specific abstract data types. Computer systems / servers can be implemented in distributed cloud computing environments, where tasks are executed by remote processing devices linked through communication networks. In distributed cloud computing environments, program modules can reside on local or remote computing system storage media, including storage devices.

[0036] Figure 1 This illustration shows a flowchart of a gate-level netlist pruning method provided in an embodiment of this disclosure. The gate-level netlist pruning method provided in this embodiment can be applied to chip verification processes, for example, it can be applied to, but is not limited to, at least one of the following chip verification stages: post-simulation stage, formal verification stage, and / or static timing analysis stage, etc. The chips described in this embodiment include, but are not limited to, at least one of the following: System on Chip (SoC), Microcontroller Unit (MCU), Graphics Processing Unit (GPU), Artificial Intelligence Accelerator Chip (AI Accelerator Chip), and Field-Programmable Gate Array (FPGA), etc.

[0037] Specifically, such as Figure 1 As shown, the method includes the following steps: Step S101: Read the pruning configuration data of the gate-level netlist; wherein, the pruning configuration data includes the configuration object name and the macro switch name corresponding to each configuration object name.

[0038] A gate-level netlist is a file containing gate-level netlists to be trimmed. A gate-level netlist may contain, but is not limited to, at least one of the following types of information: module declaration information (such as module definitions of top-level modules or sub-modules, module port information, etc.), module instantiation information (such as module instantiation statements, module instance names, etc.), signal declaration information (such as signal names and bit widths, etc.), and logic gate instantiation information (such as instantiation and call information of basic logic gates), etc.

[0039] Pre-generate associated pruning configuration data for the gate-level netlist. This pruning configuration data is pre-generated based on user configuration operations and describes the user's custom gate-level netlist pruning control requirements. It records information about how the user wants to prune the gate-level netlist, such as which modules or module instances need pruning control (e.g., pruning or retaining). A module is a functional block in the gate-level netlist defined in a preset format (e.g., starting with "module" and ending with "endmodule"), with independent port declarations and internal logic, such as top-level modules and sub-modules at different levels. A module instance is an object generated by instantiating a defined module using a module instantiation statement. Each module instance has a unique instance name and is bound to the instantiated module name; the same module can correspond to at least one or more module instances.

[0040] The pruning configuration data is stored in a machine-readable format, allowing this step to read the pruning configuration data from the gate-level netlist. For example, the format of the pruning configuration data can include, but is not limited to: spreadsheet files (such as Excel spreadsheets, WPS spreadsheets, etc.), comma-separated values ​​(CSV) files, JSON (JavaScript Object Notation) files, YAML (YAML Ain't Markup Language) files, and XML (Extensible Markup Language) files. This step converts the user's pruning intent into machine-readable pruning configuration data, enabling subsequent automatic pruning of the gate-level netlist based on this configuration data.

[0041] The trimming configuration data includes at least one configuration object name. The configuration object name is the name of the configuration unit that the user enters, on which they wish to have trimmed control. A configuration unit can be one or more netlist units in a gate-level netlist. Netlist units can include modules and / or module instances, and thus configuration units can include modules and / or module instances. The configuration object name can include the module name and / or the module instance name. For example, the configuration object name can include the top-level module name (e.g., dramss, pciess), the sub-module name (e.g., module_a), and / or the module instance name (e.g., u_dramss0, u_dramss1), etc.

[0042] The trimming configuration data also includes the macro switch name corresponding to each configuration object name. The macro switch name is the name of the macro switch assigned by the user to the configuration unit. During the preprocessing stage of hardware description languages ​​(such as Verilog, SystemVerilog, etc.) (usually the first step in the hardware description language compilation process, occurring before formal syntax analysis, logic synthesis, or simulation), the macro switch is controlled by defining or not defining it. The enabling or disabling of the macro switch directly reflects the user's trimming control intention for the corresponding configuration unit during the current chip verification stage. For example, if the macro switch name is DRAMSS_IS_EMPTY, enabling DRAMSS_IS_EMPTY indicates that the user wants to trim the corresponding configuration unit, while disabling DRAMSS_IS_EMPTY indicates that the user wants to retain the corresponding configuration unit.

[0043] For example, the trimmed configuration data can be as shown in Table 1: The configuration object names include: dramss, u_dramss0, u_dramss1, module_a, u_module_a_0, u_module_a_1, pciess, and u_pciess. Here, dramss corresponds to the top-level module dramss, u_dramss0 corresponds to an instance within module dramss, u_dramss1 corresponds to another instance within module dramss, module_a corresponds to the submodule module_a, u_module_a_0 corresponds to an instance within submodule module_a, u_module_a_1 corresponds to another instance within submodule module_a, pciess corresponds to the top-level module pciess, and u_pciess corresponds to an instance under the top-level module pciess. The macro switch for dramss is named DRAMSS_IS_EMPTY, the macro switch for u_dramss0 is named DRAMSS0_IS_PRESENT, and the macro switch for u_dramss1 is named DRAMSS1_IS_PRESENT. If DRAMSS_IS_EMPTY, DRAMSS0_IS_PRESENT, and DRAMSS1_IS_PRESENT are all defined, it indicates that the user intends to trim the module dramss, and during the trimming process, to retain instances u_dramss0 and u_dramss1, while all other instances under the module dramss are trimmed.

[0044] Table 1

[0045] In the specific implementation process, the trimmed configuration data is parsed to extract the names of each configuration object in the trimmed configuration data, as well as the macro switch names corresponding to each configuration object name.

[0046] Step S102: Determine all pruning control targets in the gate-level netlist based on the configured object name.

[0047] The pruning control target is the netlist cell in the gate-level netlist that actually needs to be subject to pruning control; that is, the module or module instance that is ultimately determined to perform retention or pruning operations. The pruning control target is not the same as the configuration cell. The configuration cell is the netlist cell specified by the user in the pruning configuration data. The pruning control target is the netlist cell that actually needs to be subject to independent pruning control, determined based on the configuration object name and corresponding rules.

[0048] The pruning control target and the configuration unit are two different sets, but they have a corresponding intersection. For example, if the module dramss contains three instances, namely u_dramss0, u_dramss1, and u_dramss2, and the pruning configuration data contains the configuration object names dramss, u_dramss0, and u_dramss1, and the pruning control target includes u_dramss0, u_dramss1, and u_dramss2, the two are not completely identical, but they share the same netlist units u_dramss0 and u_dramss1.

[0049] Step S103: For each clipping control target, generate an empty module corresponding to the clipping control target based on the original module corresponding to the clipping control target, and generate an overloaded macro for the clipping control target.

[0050] The original module is a module that already exists in the gate-level netlist and has complete functional logic. The original module contains complete port declarations, internal signal connections, combinational logic and sequential logic gate-level netlists, etc. For example, the pciess module in the gate-level netlist is an original module, which internally implements the complete functional logic of the PCI Express interface controller.

[0051] The module corresponding to the trim control target in the gate-level netlist is the original module corresponding to that trim control target. For example, if the trim control target is a module in the gate-level netlist, then that module itself is the original module of the trim control target; if the trim control target is a module instance in the gate-level netlist, then the module referenced by that module instance in the gate-level netlist (i.e., the module specified by that module instance in the instantiation statement) is the original module of the trim control target.

[0052] Furthermore, for any trimming control target, an empty module corresponding to that trimming control target is generated based on the original module corresponding to that trimming control target. An empty module is a module that does not contain any substantial logical functions internally, and does not generate any actual logic circuits or simulation overhead during compilation.

[0053] In one optional implementation, an empty module can be generated as follows: an empty module with the same port declarations as the original module is generated; the internal logic of the empty module is set to empty, and the output ports in the empty module are assigned fixed values. Specifically, an empty module file corresponding to the empty module is created (e.g., an empty module file pciess_empty.sv for the top-level module pciess). The port declarations of the original module are added to this empty module file so that the empty module has the same port declarations as the original module, thereby ensuring the accuracy of the connection relationship between the empty module and other modules and ensuring the accurate execution of the compilation process. Furthermore, the internal logic of the empty module file is completely set to empty; the empty module file does not contain any registers, state machines, combinational logic, etc., so that complex internal logic compilation is not required when compiling the empty module, improving compilation efficiency. In addition, corresponding assignment statements are generated for each output port to assign a fixed value (such as logic 0, or other specified fixed value) to the output port, ensuring that the output of the empty module is in a deterministic state and avoiding uncertain impacts on other working modules of the chip.

[0054] Furthermore, overloaded macros are generated for each pruning control target, with a one-to-one correspondence between pruning control targets and overloaded macros. Specifically, an overloaded macro is a module name placeholder allocated to a pruning control target. This placeholder is used during the preprocessing stage, occupying the module name position in the instantiation statement of the gate-level netlist. It replaces the hard-coded module name during the preprocessing stage and dynamically points to the original module or an empty module through defined instructions. For example, if the pruning control target is a `u_dramss0` instance, the overloaded macro `DRAMSS0` is allocated to it.

[0055] Step S104: Generate conditional compilation macro code based on the macro switch name and the overloaded macro corresponding to each clipping control target, the original module name of the original module, and the empty module name of the empty module; wherein, the conditional compilation macro code is used to assign the overloaded macro to the corresponding original module name or empty module name according to the definition status of the macro switch name in the compilation command.

[0056] Conditional compilation macro code is a block of code consisting of a series of preprocessor directives. The preprocessor directives contained in conditional compilation macro code mainly include: conditional judgment directives (such as `ifdef / `ifndef), branch jump directives (such as `else), termination directives (such as `endif), and macro definition directives nested inside branches (such as `define).

[0057] In one alternative implementation, the conditional compilation macro code includes: a conditional statement generated by a macro switch name and a conditional statement; a branch statement generated by an overloaded macro, the original module name, and a macro definition instruction that assigns the overloaded macro to the original module name; and another branch statement generated by an overloaded macro, an empty module name, and a macro definition instruction that assigns the overloaded macro to an empty module name.

[0058] During compilation, users can add or omit macro switch names in the compilation command (usually a command added in the preprocessing stage) depending on whether a module or module instance needs to be trimmed or retained during the current verification process. When a macro switch name is defined in the compilation command, the macro switch is activated, leading to the execution of the corresponding branch statement; when no macro switch name is defined in the compilation command, the macro switch is deactivated, leading to the execution of the corresponding branch statement. Therefore, based on the definition status of the macro switch name in the compilation command, overloaded macros can be assigned the corresponding original module name or empty module name.

[0059] Step S105: Insert the conditional compilation macro code into the gate-level netlist.

[0060] The generated conditional compilation macro code is inserted into a preset location in the gate-level netlist. This preset location may include, but is not limited to, at least one of the following: the beginning of the gate-level netlist file (i.e., the starting position of the gate-level netlist, before all module definitions and instantiation code), a separate macro definition file, and the separate macro definition file is referenced in the beginning of the gate-level netlist file using a reference directive (such as `include), after all module declarations in the gate-level netlist file, and before the instantiation code, etc.

[0061] Among them, conditional compilation macro code can be directly inserted into the preset position of the gate-level netlist, or it can be directly inserted into the preset position of the copy of the gate-level netlist, so as not to change the original gate-level netlist content.

[0062] Step S106: For each pruning control target, replace the original module name in the original instantiation statement of the pruning control target in the gate-level netlist with the overloaded macro of the pruning control target.

[0063] For each trim control target, all instantiation statements for that trim control target are searched in the gate-level netlist. These instantiation statements are called the original instantiation statements for that trim control target. The original instantiation statements contain the original module name of the original module corresponding to the trim control target. The original module name is replaced with the overloaded macro of the trim control target. The instantiation statement obtained after the replacement can be called the modified instantiation statement.

[0064] During the preprocessing stage, if the overloaded macro is assigned the original module name, the module instance loads the original module, thus preserving the module instance. If the overloaded macro is assigned an empty module name, the module instance loads the empty module, thus pruning the module instance. Since the empty module has no internal logic, compilation efficiency can be significantly improved. Moreover, the assignment of overloaded macros can be dynamically adjusted through the definition state of macro switch names in the compilation command. When the pruning strategy changes, only the definition state of macro switch names in the compilation command needs to be adjusted, without rewriting the instantiation statements in the gate-level netlist, thus improving the flexibility of gate-level netlist pruning.

[0065] For example, the original instantiation statement for the pruning control target u_dramss0 is: dramss u_dramss0( .clk(clk), .data(data) ... ); If the overloaded macro of the trimming control target u_dramss0 is DRAMSS0, then the modified instantiation statement obtained by replacing the original module name with the overloaded macro of this trimming control target is: `DRAMSS0 u_dramss0( .clk(clk), .data(data) ... ); Therefore, based on the defined value of DRAMSS0, either the original module or an empty module can be loaded. For example, if the defined value of DRAMSS0 is dramss, then the modified instantiation statement is equivalent to: dramss u_dramss0( .clk(clk), .data(data) ...), that is, the u_dramss0 instance loads the original module dramss; if the defined value of DRAMSS0 is dramss_empty, then the modified instantiation statement is equivalent to: dramss_empty u_dramss0( .clk(clk), .data(data) ... ), that is, the u_dramss0 instance loads the empty module dramss_empty. The entire switching process only requires adjusting the definition state of the macro switch, without frequently modifying the instantiation statement itself.

[0066] In this step, replacing the original module name in the original instantiation statement of the pruning control target in the gate-level netlist with the overloaded macro of the pruning control target can replace the original instantiation statement of the gate-level netlist itself, or it can replace the original instantiation statement in the copy of the gate-level netlist.

[0067] In one alternative implementation, in response to a gate-level netlist update, the inserted conditional compilation code and instantiation statements are updated synchronously. For example, if a module or module instance is deleted from the gate-level netlist, the conditional compilation code is updated to remove the pruning control over that module or module instance, and the instantiation statements of that module or module instance are deleted synchronously.

[0068] Therefore, the gate-level netlist pruning method provided in this embodiment of the present disclosure, based on the pruning configuration data of the gate-level netlist, identifies all pruning control targets in the gate-level netlist and generates an empty module and overloaded macro for each pruning control target. It generates conditional compilation macro code based on the macro switch name, overloaded macro, original module name, and empty module name in the pruning configuration data, inserts the conditional compilation macro code into the gate-level netlist, and replaces the original module name in the instantiation statements of the gate-level netlist with the overloaded macro. Thus, when the overloaded macro is assigned the empty module name, the module instance loads the empty module, thereby achieving automatic pruning of the module instance. This approach avoids syntax or port errors introduced by manual modifications, improving the accuracy of gate-level netlist pruning. Furthermore, empty modules have empty internal logic, significantly improving compilation efficiency. Moreover, the assignment of overloaded macros can be dynamically adjusted based on the definition status of macro switch names in the compilation command, thereby dynamically adjusting the pruning range and achieving on-demand pruning. When the pruning strategy changes, only the definition status of macro switch names in the compilation command needs to be adjusted, without modifying the gate-level netlist, reducing the adaptation cost of pruning strategy changes. In addition, the embodiments of this disclosure are not dependent on chip type or specific chip architecture, exhibiting good versatility and portability.

[0069] Figure 2 A flowchart illustrating another gate-level netlist pruning method provided in this disclosure embodiment is shown. The gate-level netlist pruning method provided in this disclosure embodiment can be applied to chip verification processes.

[0070] like Figure 2 As shown, the method specifically includes the following steps: Step S201: Read the pruning configuration data of the gate-level netlist; wherein, the pruning configuration data includes: module-level configuration object name and corresponding module-level macro switch name, and / or instance-level configuration object name and corresponding instance-level macro switch name.

[0071] The trimmed configuration data includes at least one configuration object name and the macro switch name corresponding to each configuration object name. The configuration object name includes module-level configuration object names and / or instance-level configuration object names. Module-level configuration object names are the names of top-level modules or sub-modules, and instance-level configuration object names are the names of module instances. A top-level module is the top-level module in the gate-level netlist, typically corresponding to the entire chip or subsystem; a sub-module is a module nested within other modules; and a module instance is the instance object obtained after instantiating the module.

[0072] The macro switch name corresponding to the module-level configuration object name is called the module-level macro switch name, and the macro switch name corresponding to the instance-level configuration object name is called the instance-level macro switch name. The module-level macro switch name can further include a master switch name and sub-module-level switch names; that is, the master switch name is the module-level macro switch name corresponding to the top-level module name, and the sub-module-level switch name is the module-level macro switch name corresponding to the sub-module name.

[0073] Therefore, the configuration object names and corresponding macro switch names in this embodiment can cover different levels in the gate-level netlist. Users can flexibly configure one or more levels of configuration object names and corresponding macro switch names according to their pruning needs, and then use the macro switches at the corresponding levels for pruning control to meet users' pruning needs at different granularities.

[0074] In one optional implementation, if the configuration object name includes an instance-level configuration object name, the trimmed configuration data also includes the module name corresponding to that instance-level configuration object name. This corresponding module name is the name of the module instantiated by the module instance pointed to by the module instance name. For example, if the u_dramss0 module instance is obtained by instantiating the dramss module, then dramss is the module name corresponding to u_dramss0.

[0075] For example, as shown in Table 2, the configuration object names include: dramss, u_dramss0, u_dramss1, module_a, u_module_a_0, u_module_a_1, and pciess. dramss, pciess, and module_a are module-level configuration object names. dramss and pciess correspond to the top level (top-level module name), and their corresponding macro switch names are the general switch names. module_a corresponds to the sub level (sub-module name), and its corresponding macro switch names are sub-module-level switch names. u_dramss0, u_dramss1, u_module_a_0, and u_module_a_1 are instance-level configuration object names, corresponding to the instance level (module instance name). u_dramss0 and u_dramss1 are obtained after instantiating the top-level drams module, and u_module_a_0 and u_module_a_1 are obtained after instantiating the module_a sub-module. DRAMSS_IS_EMPTY, MODULEA_IS_EMPTY, and PCIESS_IS_EMPTY are the module-level macro switch names corresponding to the top-level module dramss, sub-module module_a, and top-level module pciess, respectively; DRAMSS0_IS_PRESENT, DRAMSS1_IS_PRESENT, MODULEA0_IS_PRESENT, and MODULEA1_IS_PRESENT are the instance-level macro switch names corresponding to the module instances u_dramss0, u_dramss1, u_module_a_0, and u_module_a_1, respectively.

[0076] Table 2

[0077] Step S202: Determine the instance-level pruning control target and / or module-level pruning control target of the gate-level netlist based on the configuration object name.

[0078] In this embodiment, the pruning control objective of the gate-level netlist is divided into instance-level pruning control objectives and module-level pruning control objectives. Each instance-level pruning control objective corresponds to a module instance and has a corresponding overloaded macro during the pruning process. The overloaded macro independently controls the pruning behavior of that module instance. Each module-level pruning control objective corresponds to a module (top-level module or sub-module) and has a corresponding overloaded macro during the pruning process. The overloaded macro controls the overall pruning behavior of all module instances under that module.

[0079] In a specific implementation, for any module-level configuration object name: If the trimming configuration data contains an instance-level configuration object name corresponding to the module-level configuration object name, all module instances belonging to that module-level configuration object name will be used as instance-level trimming control targets. Here, an instance-level configuration object name refers to a module whose mapped instance belongs to the module mapped by that instance-level configuration object name. If the trimming configuration data contains both a module-level configuration object name and at least one instance-level configuration object name under that module-level configuration object name, it indicates that the user has configured both a module-level macro switch name for a module and an instance-level macro switch name for at least one module instance under that module. In this case, the module will no longer be treated as a whole for trimming control; instead, all module instances belonging to that module will be used as separate trimming control targets. In other words, if the trimming configuration data contains both a module-level configuration object name and at least one instance-level configuration object name under that module-level configuration object name, all module instances belonging to that module-level configuration object name will be used as instance-level trimming control targets.

[0080] For example, if the dramss module contains module instances u_dramss0, u_dramss1, and u_dramss2, and the pruning configuration data shown in Table 2 contains the module-level configuration object name dramss, as well as the instance-level configuration object names u_dramss0 and u_dramss1 of dramss, that is, the configuration object name contains both the module-level configuration object name dramss and the instance-level configuration object names u_dramss0 and u_dramss1 of dramss, then the module instances u_dramss0, u_dramss1, and u_dramss2 belonging to the dramss module will each be used as instance-level pruning control targets.

[0081] If the configuration data does not contain an instance-level configuration object name corresponding to the module-level configuration object name, the module corresponding to that module-level configuration object name will be used as the module-level pruning control target. Specifically, if the configuration object name contains only the module-level configuration object name and not any instance-level configuration object names corresponding to that module-level configuration object name, it indicates that the user intends to perform overall pruning control on the module mapped to that module-level configuration object name, and thus the module corresponding to that module-level configuration object name will be used as the module-level pruning control target.

[0082] For example, if the pciess module contains module instances u_pciess0 and u_pciess1, and the pruning configuration data shown in Table 2 contains the module-level configuration object name pciess but does not contain any instance-level configuration object names under pciess, then the pciess module as a whole is treated as a module-level pruning control target.

[0083] Step S203: For each clipping control target, generate an empty module corresponding to the clipping control target based on the original module corresponding to the clipping control target, and generate an overloaded macro corresponding to the clipping control target.

[0084] Generate an empty module corresponding to each trimming control target, meaning there is a one-to-one correspondence between trimming control targets and empty modules. The port declarations of the empty modules corresponding to the trimming control targets are consistent with those of the original modules, and the internal logic of the empty modules is empty, with fixed output values.

[0085] Furthermore, overloaded macros are generated for each clipping control target, with a one-to-one correspondence between clipping control targets and overloaded macros, and different overloaded macros for different clipping control targets.

[0086] Step S204: Generate conditional compilation macro code based on the macro switch name, the overloaded macro corresponding to each clipping control target, the original module name of the original module, and the empty module name of the empty module, and insert the conditional compilation macro code into the gate-level netlist.

[0087] Step S205: For the module-level trimming control target, determine all module instances belonging to the module-level trimming control target, and replace the original module name in the original instantiation statement of all module instances with the overloaded macro of the module-level trimming control target.

[0088] The module-level pruning control objective treats the entire module as the pruning control granularity. For any given module-level pruning control objective, it identifies all module instances belonging to that objective. Each module instance has a corresponding primitive instantiation statement in the gate-level netlist. This primitive instantiation statement contains the original module name of the module-level pruning control objective. The original module name in each primitive instantiation statement corresponding to this module instance is then replaced in batches with the overloaded macro of that module-level pruning control objective. In other words, all module instances share the same overloaded macro, which uniformly controls whether all module instances load the original module or an empty module.

[0089] For example, the trimming configuration data includes the top-level module name "pciess" and does not contain any module instance names under "pciess". Therefore, "pciess" is a module-level trimming control target. As shown in Table 3, the overloaded macro for the module-level trimming control target "pciess" is "PCIESS". "pciess" contains module instances "u_pciess0" and "u_pciess1". "u_pciess0" and "u_pciess1" share the same overloaded macro, replacing the module name "pciess" in the original instantiation statements of "u_pciess0" and "u_pciess1" with the overloaded macro "PCIESS".

[0090] Table 3

[0091] Step S206: For instance-level pruning control targets, replace the original module name in the original instantiation statement of the instance-level pruning control target with the overloaded macro of the instance-level pruning control target.

[0092] Instance-level pruning control targets use a single module instance as the pruning control granularity. For any instance-level pruning control target, its original instantiation statement in the gate-level netlist is determined, and the original module name in the original instantiation statement is replaced with the overloaded macro of that instance-level pruning control target. Thus, an overloaded macro independently controls whether a module instance loads the original module or an empty module.

[0093] For example, the pruning configuration data includes the top-level module name dramss and two module instance names of dramss, namely u_dramss0 and u_dramss1. Step S202 determines that dramss is not a pruning control target, and the three module instances under dramss (u_dramss0, u_dramss1, and u_dramss2) are three instance-level pruning control targets. As shown in Table 4, the overloaded macro for u_dramss0 is DRAMSS0, the overloaded macro for u_dramss1 is DRAMSS1, and the overloaded macro for u_dramss2 is DRAMSS2. The original module name "dramss" in the original instantiation statement of u_dramss0 is replaced with the corresponding overloaded macro "DRAMSS0", the original module name "dramss" in the original instantiation statement of u_dramss1 is replaced with the corresponding overloaded macro "DRAMSS1", and the original module name "dramss" in the original instantiation statement of u_dramss2 is replaced with the corresponding overloaded macro "DRAMSS2".

[0094] Table 4

[0095] Therefore, the gate-level netlist pruning method provided in this embodiment configures object names including module-level configuration object names and / or instance-level configuration object names, and macro switch names including module-level macro switch names and / or instance-level macro switch names. This allows users to achieve batch pruning control of the entire module by configuring module-level object names, and differentiated independent control of different instances within the same module by configuring instance-level object names, meeting users' pruning control needs at different granularities. Furthermore, by identifying two different types of pruning control targets—module-level and instance-level—corresponding overloaded macros can be generated for each type of target. The overloaded macros of module-level pruning control targets uniformly control all module instances under them, while the overloaded macros of instance-level pruning control targets control the corresponding individual module instances, improving the flexibility and control accuracy of gate-level netlist pruning.

[0096] Figure 3 A schematic flowchart of another gate-level netlist pruning method provided in this disclosure embodiment is shown. The gate-level netlist pruning method provided in this disclosure embodiment can be applied to chip verification processes.

[0097] like Figure 3 As shown, the method specifically includes the following steps: Step S301: Read the pruning configuration data of the gate-level netlist; wherein, the pruning configuration data includes: module-level configuration object name and corresponding module-level macro switch name, and / or instance-level configuration object name and corresponding instance-level macro switch name.

[0098] Step S302: Determine the instance-level pruning control target and / or module-level pruning control target of the gate-level netlist based on the configuration object name.

[0099] Step S303: For instance-level pruning control targets, generate instance-level code blocks based on the overloaded macros, original module names, and empty module names corresponding to the instance-level pruning control targets.

[0100] For any instance-level pruning control target, generate the instance-level code block corresponding to that instance-level pruning control target based on its overloaded macros, original module name, and empty module name.

[0101] In one alternative implementation, the instance-level code block can specifically adopt... Figure 4 Steps S3031-S3034 shown are generated as follows: S3031, Identify the type of instance-level pruning control target; if it is the first instance-level pruning control target, execute S3032; if it is the second instance-level pruning control target, execute S3034.

[0102] Based on whether the instance-level clipping control target has a corresponding instance-level macro switch name, instance-level clipping control targets can be divided into two types: first instance-level clipping control targets and second instance-level clipping control targets.

[0103] Specifically, if an instance-level pruning control target has a corresponding instance-level macro switch name, then that instance-level pruning control target is designated as the first instance-level pruning control target; if an instance-level pruning control target does not have a corresponding instance-level macro switch name, then that instance-level pruning control target is designated as the second instance-level pruning control target. That is, the first instance-level pruning control target prunes instance-level pruning control targets whose configuration data displays an instance-level macro switch name, and the second instance-level pruning control target prunes instance-level pruning control targets whose configuration data does not display an instance-level macro switch name. In other words, it refers to instance-level macro switch names whose configuration object names contain the first module-level macro switch name, and instance-level macro switch names whose configuration object names do not contain the second module-level macro switch name.

[0104] For example, if the top-level module dramss contains module instances u_dramss0, u_dramss1, and u_dramss2, and the trimming configuration data contains the module-level configuration object name dramss, as well as the instance-level configuration object names u_dramss0 and u_dramss1, since module instance u_dramss0 has the instance-level macro switch name DRAMSS0_IS_PRESENT, and module instance u_dramss1 has the instance-level macro switch name DRAMSS1_IS_PRESENT, then module instances u_dramss0 and u_dramss1 are the first instance-level trimming control targets; module instance u_dramss2 has no corresponding instance-level macro switch name, therefore module instance u_dramss2 is the second instance-level trimming control target.

[0105] S3032, based on the instance-level macro switch name corresponding to the first instance-level pruning control target, generate instance-level conditional judgment statements, generate a retained instance branch with the overloaded macro definition as the original module name and generate a pruning instance branch with the overloaded macro definition as the empty module name, and generate the first branch of the first instance-level pruning control target based on the instance-level conditional judgment statements, the retained instance branch and the pruning instance branch.

[0106] For any first instance-level clipping control target, an instance-level conditional statement is generated based on the instance-level macro switch name corresponding to that first instance-level clipping control target. For example, an instance-level conditional statement is obtained based on the conditional statement and the instance-level macro switch name corresponding to the first instance-level clipping control target.

[0107] Furthermore, the overloaded macro definition is generated as a reserved instance branch of the original module name, which is a branch of the instance-level conditional statement; and the overloaded macro definition is generated as a trimmed instance branch of the empty module name, which is another branch of the instance-level conditional statement.

[0108] The instance-level conditional statement, the retained instance branch, and the pruned instance branch constitute the first branch of the first instance-level pruning control target.

[0109] For example, the first instance-level pruning control target u_dramss0 has the instance-level macro switch name DRAMSS0_IS_PRESENT, its overloaded macro is DRAMSS0, the original module name is dramss, the empty module name is dramss_empty, and the first branch of the generated first instance-level pruning control target is: `ifdef DRAMSS0_IS_PRESENT `define DRAMSS0 dramss else `define DRAMSS0 dramss_empty `endif In this code, "`ifdef DRAMSS0_IS_PRESENT" is an instance-level conditional statement, "`define DRAMSS0dramss" is the preserve instance branch, and "`define DRAMSS0 dramss_empty" is the prune instance branch. During compilation, if DRAMSS0_IS_PRESENT is defined in the compilation command, the overloaded macro DRAMSS0 loads the original module dramss, thus preserving the module instance u_dramss0; if DRAMSS0_IS_PRESENT is not defined in the compilation command, the overloaded macro DRAMSS0 loads the empty module dramss_empty, thus pruning the module instance u_dramss0.

[0110] S3033 generates the second branch of the first instance-level pruning control target of the original module name or empty module name.

[0111] Generate an overloaded macro definition that is the definition statement of the original module name, or generate an overloaded macro definition that is the definition statement of an empty module name, and use the definition statement as the second branch of the first instance-level pruning control target.

[0112] Specifically, if the module corresponding to the first instance-level pruning control target has a macro switch name of the pruning type, then the definition statement of the overloaded macro as an empty module name is used as the second branch of the first instance-level pruning control target; if the module corresponding to the first instance-level pruning control target has a macro switch name of the reserved type, then the definition statement of the overloaded macro as the original module name is used as the second branch of the first instance-level pruning control target.

[0113] For example, the module corresponding to the first instance-level pruning control target u_dramss0 is the top-level module dramss, and the macro switch name of the top-level module dramss is DRAMSS_IS_EMPTY. DRAMSS_IS_EMPTY is the macro switch name of the pruning type. Then the second branch of the first instance-level pruning control target u_dramss0 is: `define DRAMSS0 dramss_empty.

[0114] S3034 generates a retained instance branch with the overloaded macro definition in the original module name, and a trimmed instance branch with the overloaded macro definition in the empty module name.

[0115] For any second instance-level pruning control target, if the second instance-level pruning control target has no corresponding instance-level macro switch name, then an overloaded macro definition is generated as the definition statement of the original module name, and this definition statement is used as the reserved instance branch of the second instance-level pruning control target; and an overloaded macro definition is generated as the definition statement of an empty module name, and this definition statement is used as the pruning instance branch of the second instance-level pruning control target.

[0116] Step S304: Identify the first module-level macro switch name and / or the second module-level macro switch name from the module-level macro switch names.

[0117] Based on whether the trimmed configuration data contains instance-level macro switch names of module-level macro switch names, module-level macro switch names are divided into first module-level macro switch names and second module-level macro switch names. Specifically, if a module instance is obtained by instantiating a module, then the instance-level macro switch name of that module instance is the instance-level macro switch name of the module-level macro switch name.

[0118] Specifically, the trimmed configuration data includes instance-level macro switch names that contain first-module-level macro switch names, and the trimmed configuration data does not include instance-level macro switch names that contain second-module-level macro switch names.

[0119] For example, as shown in Table 2 above, the trimmed configuration data includes the module-level macro switch names DRAMSS_IS_EMPTY, MODULEA_IS_EMPTY, and PCIESS_IS_EMMPTY. The trimmed configuration data also includes the instance-level macro switch names DRAMSS0_IS_PRESENT and DRAMSS1_IS_PRESENT for DRAMSS_IS_EMPTY, and the instance-level macro switch names MODULEA0_IS_PRESENT and MODULEA1_IS_PRESENT for MODULEA_IS_EMPTY, but does not include any instance-level macro switch name for PCIESS_IS_EMMPTY. Therefore, DRAMSS_IS_EMPTY and MODULEA_IS_EMPTY are the first module-level macro switch names, and PCIESS_IS_EMMPTY is the second module-level macro switch name.

[0120] Step S305: For the first module-level macro switch name, generate a module-level code block based on the first module-level macro switch name and the instance-level code blocks of all instance-level clipping control targets under the module corresponding to the first module-level macro switch name.

[0121] For any first module-level macro switch name, which has at least one instance-level macro switch name, a module-level code block is generated based on the first module-level macro switch name and the instance-level code blocks of all instance-level clipping control targets belonging to the module corresponding to the first module-level macro switch name.

[0122] Specifically, for a first module-level macro switch name, a module-level conditional statement is generated based on that macro switch name. The first and second branches of the first instance-level pruning control target belonging to the module corresponding to the first module-level macro switch name are inserted into different branches corresponding to the module-level conditional statement. Similarly, the retained instance branch and pruning instance branch of the second instance-level pruning control target belonging to the module corresponding to the first module-level macro switch name are inserted into different branches corresponding to the module-level conditional statement, thus forming the module-level code block for the first module-level macro switch name. The first branch is inserted into the branch corresponding to the first module-level macro switch name when it is defined, and the second branch is inserted into the branch where the first module-level macro switch name is not defined. If the first module-level macro switch name corresponds to a pruning operation, then the pruning instance branch of the second instance-level pruning control target is inserted into the branch corresponding to the first module-level macro switch name that is defined, and the retained instance branch of the second instance-level pruning control target is inserted into the branch corresponding to the first module-level macro switch name that is not defined; if the first module-level macro switch name corresponds to a retain operation, then the pruning instance branch of the second instance-level pruning control target is inserted into the branch corresponding to the first module-level macro switch name that is not defined, and the retained instance branch of the second instance-level pruning control target is inserted into the branch corresponding to the first module-level macro switch name that is defined.

[0123] For example, if the top-level module dramss contains module instances u_dramss0 and u_dramss1, and the pruning configuration data contains the macro switch name DRAMSS_IS_EMPTY for dramss, the macro switch name DRAMSS0_IS_PRESENT for u_dramss0, and the macro switch name DRAMSS1_IS_PRESENT for u_dramss1, then DRAMSS_IS_EMPTY is the first module-level macro switch name. All instance-level pruning control targets under the module corresponding to DRAMSS_IS_EMPTY are u_dramss0 and u_dramss1. Both u_dramss0 and u_dramss1 are first instance-level pruning control targets, and there is no second instance-level pruning control target under the macro switch name DRAMSS_IS_EMPTY.

[0124] in: The first branch of u_dramss0 is: `ifdef DRAMSS0_IS_PRESENT `define DRAMSS0 dramss else `define DRAMSS0 dramss_empty `endif The second branch of u_dramss0 is: `define DRAMSS0 dramss_empty` The first branch of u_dramss1 is: `ifdef DRAMSS1_IS_PRESENT `define DRAMSS1 dramss else `define DRAMSS1 dramss_empty `endif The second branch of u_dramss1 is: `define DRAMSS1 dramss_empty` The generated module-level code block is as follows: `ifdef DRAMSS_IS_EMPTY `ifdef DRAMSS0_IS_PRESENT `define DRAMSS0 dramss else `define DRAMSS0 dramss_empty `endif `ifdef DRAMSS1_IS_PRESENT `define DRAMSS1 dramss else `define DRAMSS1 dramss_empty `endif else `define DRAMSS0 dramss `define DRAMSS1 dramss `endif In this module-level code block, the first branch of u_dramss0 and the first branch of u_dramss1 are both inserted into the branch where the result of the module-level conditional statement "`ifdef DRAMSS_IS_EMPTY" is yes. The second branch of u_dramss0 and the second branch of u_dramss1 are inserted into the branch where the result of the module-level conditional statement is no.

[0125] The execution logic of this module-level code block is as follows: If the definition of DRAMSS_IS_EMPTY exists in the compilation command, it further checks whether the definitions of DRAMSS0_IS_PRESENT and DRAMSS1_IS_PRESENT exist in the compilation command. If the definition of DRAMSS0_IS_PRESENT exists, the overloaded macro DRAMSS0 is defined as the original module name dramss, thus retaining u_dramss0. If the definition of DRAMSS0_IS_PRESENT does not exist, the overloaded macro DRAMSS0 is defined as the empty module name dramss_empty, thus pruning u_dramss0. If the definition of DRAMSS1_IS_PRESENT exists, the overloaded macro DRAMSS1 is defined as the original module name dramss, thus retaining u_dramss1. If the definition of DRAMSS1_IS_PRESENT does not exist, the overloaded macro DRAMSS1 is defined as the empty module name dramss_empty, thus pruning u_dramss1. If the definition of DRAMSS_IS_EMPTY does not exist in the compilation command, the overloaded macros DRAMSS0 and DRAMSS1 are both defined as the original module name dramss, thus preserving u_dramss0 and u_dramss1.

[0126] For example, if the top-level module `drams` contains module instances `u_dramss0`, `u_dramss1`, and `u_dramss2`, and the pruning configuration data contains the macro switch name `DRAMSS_IS_EMPTY` for `drams`, the macro switch name `DRAMSS0_IS_PRESENT` for `u_dramss0`, and the macro switch name `DRAMSS1_IS_PRESENT` for `u_dramss1`, then `DRAMSS_IS_EMPTY` is the first module-level macro switch name. All instance-level pruning control targets under the module corresponding to `DRAMSS_IS_EMPTY` are `u_dramss0`, `u_dramss1`, and `u_dramss2`. `u_dramss0` and `u_dramss1` are both first instance-level pruning control targets, and `u_dramss2` is the second instance-level pruning control target.

[0127] in: The reserved instance branch of u_dramss2 is: `define DRAMSS2 dramss` The pruning instance branch of u_dramss2 is: `define DRAMSS2 dramss_empty` The generated module-level code block is as follows: `ifdef DRAMSS_IS_EMPTY `ifdef DRAMSS0_IS_PRESENT `define DRAMSS0 dramss else `define DRAMSS0 dramss_empty `endif `ifdef DRAMSS1_IS_PRESENT `define DRAMSS1 dramss else `define DRAMSS1 dramss_empty `endif `define DRAMSS2 dramss_empty else `define DRAMSS0 dramss `define DRAMSS1 dramss `define DRAMSS2 dramss `endif In this module-level code block, the first branch of u_dramss0, the first branch of u_dramss1, and the pruning instance branch of u_dramss2 are all inserted into branches where the result of the module-level conditional statement "`ifdef DRAMSS_IS_EMPTY" is yes. The second branch of u_dramss0, the second branch of u_dramss1, and the retained instance branch of u_dramss2 are all inserted into branches where the result of the module-level conditional statement is no.

[0128] The execution logic of this module-level code block is as follows: If the compilation command contains the definition of DRAMSS_IS_EMPTY, then the overloaded macro DRAMSS2 is defined as the empty module name dramss_empty, u_dramss2 is truncated, and it is further determined whether the compilation command contains the definition of DRAMSS0_IS_PRESENT and whether the compilation command contains the definition of DRAMSS1_IS_PRESENT. If the compilation command does not contain the definition of DRAMSS_IS_EMPTY, then the overloaded macros DRAMSS0, DRAMSS1, and DRAMSS2 are all defined as the original module dramss, thus retaining u_dramss0, u_dramss1, and u_dramss2.

[0129] Step S306: For the second module-level macro switch name, generate a module-level code block based on the second module-level macro switch name, the overloaded macro corresponding to the second module-level macro switch name, the original module name, and the empty module name.

[0130] For any second-module-level macro switch name, there are no instance-level macro switch names under this second-module-level macro switch name. Therefore, the entire corresponding module can be controlled through the macro switch corresponding to the second-module-level macro switch name.

[0131] Specifically, based on the second module-level macro switch name, a module-level conditional statement is generated, which generates a retained module branch with the overloaded macro definition of the original module name, and a trimmed module branch with the overloaded macro definition of the empty module name.

[0132] For example, if the trimming configuration data includes the module name of the top-level module pciess and the macro switch name PCIESS_IS_EMPTY, but does not include the instance name and instance-level macro switch name of any module instance of pciess, then PCIESS_IS_EMPTY is the second module-level macro switch name, and the overloaded macro of pciess is PCIESS. The generated module-level code block is as follows: `ifdef PCIESS_IS_EMPTY `define PCIESS pciess_empty else `define PCIESS pciess `endif In this module-level code block, "`ifdef PCIESS_IS_EMPTY" is a module-level conditional statement, "`define PCIESS pciess_empty" is a trimmed module branch with an overloaded macro defined as an empty module name, and "`define PCIESS pciess" is a reserved module branch with an overloaded macro defined as the original module name.

[0133] The execution logic of this module-level code block is as follows: If the compilation command contains the definition of PCIESS_IS_EMPTY and the overloaded macro PCIESS is defined as the empty module name pciess_empty, then all module instances under the pciess module are instantiated as pciess_empty, thus pruning all module instances under the entire pciess module; if the compilation command does not contain the definition of PCIESS_IS_EMPTY and the overloaded macro PCIESS is defined as the original module name pciess, then all module instances under the pciess module are instantiated as pciess, thus retaining all module instances under the entire pciess module.

[0134] Step S307: Generate conditional compilation macro code based on each module-level code block.

[0135] The code blocks at each module level together constitute the conditional compilation macro code.

[0136] Step S308: Insert the conditional compilation macro code into the gate-level netlist.

[0137] Conditional compilation macro code is inserted into the corresponding position in the gate-level netlist. During actual compilation, users can define different macro switch names in the compilation command according to actual needs, and then enable or disable the corresponding macro switches during the compilation process, thereby dynamically adjusting the gate-level netlist pruning strategy.

[0138] Step S309: For each pruning control target, replace the original module name in the original instantiation statement of the pruning control target in the gate-level netlist with the overloaded macro of the pruning control target.

[0139] Therefore, the gate-level netlist pruning method provided in this disclosure determines the instance-level pruning control target and / or module-level pruning control target of the gate-level netlist, generates instance-level code blocks for the instance-level pruning control target, and generates a module-level code block nested with instance-level code blocks based on the first module-level macro switch name and the instance-level code blocks of all instance-level pruning control targets belonging to the module corresponding to the first module-level macro switch name, so as to realize instance-level pruning control under the same module; and generates a module-level code block without nested instance-level code blocks based on the second module-level macro switch name, the overloaded macro corresponding to the second module-level macro switch name, the original module name, and the empty module name, so as to realize unified pruning control for the same module. Thus, this disclosure embodiment can generate matching conditional compilation macro code for different pruning control granularity requirements of users, ensuring the matching degree between the pruning result and user requirements, and improving the accuracy of gate-level netlist pruning.

[0140] Figure 5 A schematic diagram of a gate-level netlist trimming device provided in an embodiment of this disclosure is shown. Figure 5 As shown, the device 500 includes: a reading module 510, a cropping target determination module 520, a first generation module 530, a second generation module 540, a code insertion module 550, and a replacement module 560.

[0141] The reading module 510 is used to read the pruning configuration data of the gate-level netlist; wherein, the pruning configuration data includes at least one configuration object name and a macro switch name corresponding to each configuration object name; The pruning target determination module 520 is used to determine all pruning control targets of the gate-level netlist based on the configured object name; The first generation module 530 is used to generate an empty module corresponding to the clipping control target based on the original module corresponding to the clipping control target for each clipping control target, and to generate an overloaded macro corresponding to the clipping control target. The second generation module 540 is used to generate conditional compilation macro code based on the macro switch name and the overloaded macro corresponding to each clipping control target, the original module name of the original module, and the empty module name of the empty module; wherein, the conditional compilation macro code is used to assign the overloaded macro to the corresponding original module name or empty module name according to the definition state of the macro switch name in the compilation command. Code insertion module 550 is used to insert the conditional compilation macro code into the gate-level netlist; Replacement module 560 is used to replace the original module name in the original instantiation statement of the pruning control target in the gate-level netlist with the overloaded macro of the pruning control target for each pruning control target.

[0142] In one optional implementation, the configuration object name includes: a module-level configuration object name and / or an instance-level configuration object name; The macro switch name corresponding to the module-level configuration object name is the module-level macro switch name, and the macro switch name corresponding to the instance-level configuration object name is the instance-level macro switch name.

[0143] In an optional implementation, the trimming target determination module 520 is used to: for any module-level configuration object name, if there is an instance-level configuration object name for that module-level configuration object name in the trimming configuration data, take all module instances belonging to that module-level configuration object name as instance-level trimming control targets; If the instance-level configuration object name corresponding to the module-level configuration object name does not exist in the trimming configuration data, the module corresponding to the module-level configuration object name will be used as the module-level trimming control target.

[0144] In one optional implementation, the replacement module 560 is used to: for a module-level trimming control target, determine all module instances belonging to the module-level trimming control target, and replace the original module name in the original instantiation statement of all module instances with the overloaded macro of the module-level trimming control target; For instance-level pruning control targets, replace the original module name in the original instantiation statement of the instance-level pruning control target with the overloaded macro of the instance-level pruning control target.

[0145] In one optional implementation, the second generation module 540 is used to: generate instance-level code blocks based on the overloaded macros, original module names, and empty module names corresponding to the instance-level pruning control target; Identify the first module-level macro switch name and / or the second module-level macro switch name from the module-level macro switch names; wherein, the trimmed configuration data includes the instance-level macro switch name of the first module-level macro switch name, and the trimmed configuration data does not include the instance-level macro switch name of the second module-level macro switch name; For the first module-level macro switch name, generate a module-level code block based on the first module-level macro switch name and the instance-level code blocks of all instance-level clipping control targets under the module corresponding to the first module-level macro switch name; For the second module-level macro switch name, generate a module-level code block based on the second module-level macro switch name, the overloaded macro corresponding to the second module-level macro switch name, the original module name, and the empty module name; The conditional compilation macro code is generated based on each module-level code block.

[0146] In one optional implementation, the second generation module 540 is configured to: for a first instance-level pruning control target having an instance-level macro switch name, generate an instance-level conditional statement based on the instance-level macro switch name corresponding to the first instance-level pruning control target; generate a retained instance branch with an overloaded macro definition of the original module name and a pruning instance branch with an overloaded macro definition of an empty module name; generate a first branch of the first instance-level pruning control target based on the instance-level conditional statement, the retained instance branch, and the pruning instance branch; and generate a second branch of the first instance-level pruning control target with an overloaded macro definition of the original module name or an empty module name. For a second instance-level pruning control target that does not have an instance-level macro switch name, generate a retained instance branch with the overloaded macro definition of the original module name, and generate a pruning instance branch with the overloaded macro definition of the empty module name.

[0147] In one optional implementation, the second generation module 540 is configured to: generate a module-level conditional judgment statement based on the first module-level macro switch name, insert the first branch and the second branch of the first instance-level pruning control target belonging to the module corresponding to the first module-level macro switch name into different branches corresponding to the module-level conditional judgment statement, and insert the retained instance branch and the pruning instance branch of the second instance-level pruning control target belonging to the module corresponding to the first module-level macro switch name into different branches corresponding to the module-level conditional judgment statement. For the second module-level macro switch name, generate module-level conditional statements based on the second module-level macro switch name, generate a retained module branch with overloaded macro definitions of the original module name, and generate a trimmed module branch with overloaded macro definitions of empty module names.

[0148] In one optional implementation, the first generation module 530 is used to: generate an empty module that has the same port declaration as the original module; Set the internal logic of the empty module to empty, and assign a fixed value to the output port of the empty module.

[0149] The gate-level netlist trimming device of this disclosure corresponds to the embodiments of the netlist trimming method described above, and the relevant content can be referred to each other, which will not be repeated here. The beneficial technical effects of the netlist trimming device of this disclosure can be referred to the corresponding beneficial technical effects of the netlist trimming method described above, which will not be repeated here.

[0150] In addition, this disclosure also provides an electronic device, including: Memory, used to store computer programs; A processor is configured to execute a computer program stored in the memory, wherein when the computer program is executed, it implements the gate-level netlist pruning method described in any of the above embodiments of the present disclosure.

[0151] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure is shown. Below, reference is made to... Figure 6 This describes an electronic device according to embodiments of the present disclosure. The electronic device may be either or both of a first device and a second device, or a standalone device independent of them, which may communicate with the first device and the second device to receive acquired input signals from them.

[0152] like Figure 6 As shown, the electronic device includes one or more processors and memory.

[0153] A processor can be a central processing unit (CPU) or other form of processing unit with data processing and / or instruction execution capabilities, and can control other components in an electronic device to perform desired functions.

[0154] The memory may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor may execute the program instructions to implement the gate-level netlist pruning methods of the various embodiments of this disclosure described above and / or other desired functions.

[0155] In one example, the electronic device may also include input devices and output devices, which are interconnected via a bus system and / or other forms of connection mechanism (not shown).

[0156] In addition, the input device may include, for example, a keyboard, a mouse, etc.

[0157] This output device can output various information to the outside, including determined distance information, direction information, etc. The output device may include, for example, a display, a speaker, a printer, and a communication network and its connected remote output devices, etc.

[0158] Of course, for the sake of simplicity, Figure 6 Only some of the components of the electronic device relevant to this disclosure are shown, omitting components such as buses, input / output interfaces, etc. In addition, the electronic device may include any other suitable components depending on the specific application.

[0159] In addition to the methods and apparatus described above, embodiments of this disclosure may also be computer program products comprising computer program instructions that, when executed by a processor, cause the processor to perform the steps in the gate-level netlist pruning methods according to various embodiments of this disclosure as described in the foregoing portion of this specification.

[0160] The computer program product can be written in any combination of one or more programming languages ​​to perform the operations of the embodiments of this disclosure. The programming languages ​​include object-oriented programming languages ​​such as Java and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code can be executed entirely on a user's computing device, partially on a user's computing device, as a standalone software package, partially on a user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0161] Furthermore, embodiments of this disclosure may also be computer-readable storage media storing computer program instructions thereon, which, when executed by a processor, cause the processor to perform the steps in the gate-level netlist pruning methods according to various embodiments of this disclosure as described in the foregoing portion of this specification.

[0162] The computer-readable storage medium may be any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof.

[0163] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as ROM, RAM, magnetic disk, or optical disk.

[0164] The basic principles of this disclosure have been described above with reference to specific embodiments. However, it should be noted that the advantages, benefits, and effects mentioned in this disclosure are merely examples and not limitations, and should not be considered as essential features of each embodiment of this disclosure. Furthermore, the specific details disclosed above are for illustrative and facilitative purposes only, and are not limitations. These details do not limit the scope of this disclosure to the necessity of employing the aforementioned specific details for implementation.

[0165] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For system embodiments, since they largely correspond to method embodiments, the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.

[0166] The block diagrams of devices, apparatuses, devices, and systems disclosed herein are merely illustrative examples and are not intended to require or imply that they must be connected, arranged, or configured in the manner shown in the block diagrams. As those skilled in the art will recognize, these devices, apparatuses, devices, and systems can be connected, arranged, and configured in any manner. Words such as “comprising,” “including,” “having,” etc., are open-ended terms meaning “including but not limited to,” and are used interchangeably with them. The terms “or” and “and” as used herein refer to the terms “and / or,” and are used interchangeably with them unless the context clearly indicates otherwise. The term “such as” as used herein refers to the phrase “such as but not limited to,” and is used interchangeably with it.

[0167] The methods and apparatus of this disclosure may be implemented in many ways. For example, they may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above-described order of steps for the methods is for illustrative purposes only, and the steps of the methods of this disclosure are not limited to the order specifically described above unless otherwise specifically stated. Furthermore, in some embodiments, this disclosure may also be implemented as a program recorded on a recording medium, the program including machine-readable instructions for implementing the methods according to this disclosure. Thus, this disclosure also covers recording media storing programs for performing the methods according to this disclosure.

[0168] It should also be noted that in the apparatus, devices, and methods of this disclosure, the components or steps can be disassembled and / or recombined. These disassemblies and / or recombinations should be considered as equivalent solutions to this disclosure.

[0169] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use this disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of this disclosure. Therefore, this disclosure is not intended to be limited to the aspects shown herein, but rather to be carried out within the widest scope consistent with the principles and novel features disclosed herein.

[0170] The above description has been given for purposes of illustration and description. Furthermore, this description is not intended to limit the embodiments of this disclosure to the forms disclosed herein. Although numerous exemplary aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, alterations, additions, and sub-combinations therein.

Claims

1. A gate-level netlist pruning method, characterized in that, include: Read the pruning configuration data of the gate-level netlist; wherein, the pruning configuration data includes at least one configuration object name and a macro switch name corresponding to each configuration object name; Determine all pruning control targets of the gate-level netlist based on the configured object name; For each clipping control target, an empty module corresponding to the clipping control target is generated based on the original module corresponding to the clipping control target, and an overloaded macro corresponding to the clipping control target is also generated. Based on the macro switch name and the overloaded macro corresponding to each clipping control target, the original module name of the original module, and the empty module name of the empty module, conditional compilation macro code is generated; wherein, the conditional compilation macro code is used to assign the overloaded macro to the corresponding original module name or empty module name according to the definition state of the macro switch name in the compilation command; Insert the conditional compilation macro code into the gate-level netlist; For each pruning control target, the original module name in the original instantiation statement of the pruning control target in the gate-level netlist is replaced with the overloaded macro of the pruning control target.

2. The method according to claim 1, characterized in that, The configuration object name includes: module-level configuration object name and / or instance-level configuration object name; The macro switch name corresponding to the module-level configuration object name is the module-level macro switch name, and the macro switch name corresponding to the instance-level configuration object name is the instance-level macro switch name.

3. The method according to claim 2, characterized in that, The step of determining all pruning control targets of the gate-level netlist based on the configuration object name includes: For any module-level configuration object name, if the trimming configuration data contains an instance-level configuration object name for that module-level configuration object name, all module instances belonging to that module-level configuration object name will be used as instance-level trimming control targets. If the instance-level configuration object name corresponding to the module-level configuration object name does not exist in the trimming configuration data, the module corresponding to the module-level configuration object name will be used as the module-level trimming control target.

4. The method according to claim 3, characterized in that, The step of replacing the original module name in the original instantiation statement of the pruning control target in the gate-level netlist with the overloaded macro of the pruning control target includes: For a module-level trimming control target, identify all module instances belonging to that module-level trimming control target, and replace the original module name in the original instantiation statement of all the module instances with the overloaded macro of that module-level trimming control target; For instance-level pruning control targets, replace the original module name in the original instantiation statement of the instance-level pruning control target with the overloaded macro of the instance-level pruning control target.

5. The method according to claim 3 or 4, characterized in that, The process of generating conditional macro code based on the macro switch name, the overloaded macro corresponding to each clipping control target, the original module name of the original module, and the empty module name of the empty module includes: For instance-level pruning control targets, instance-level code blocks are generated based on the overloaded macros, original module names, and empty module names corresponding to the instance-level pruning control targets. Identify the first module-level macro switch name and / or the second module-level macro switch name from the module-level macro switch names; wherein, the trimmed configuration data includes the instance-level macro switch name of the first module-level macro switch name, and the trimmed configuration data does not include the instance-level macro switch name of the second module-level macro switch name; For the first module-level macro switch name, generate a module-level code block based on the first module-level macro switch name and the instance-level code blocks of all instance-level clipping control targets under the module corresponding to the first module-level macro switch name; For the second module-level macro switch name, generate a module-level code block based on the second module-level macro switch name, the overloaded macro corresponding to the second module-level macro switch name, the original module name, and the empty module name; The conditional compilation macro code is generated based on each module-level code block.

6. The method according to claim 5, characterized in that, The process of generating instance-level code blocks based on the overloaded macros, original module names, and empty module names corresponding to the instance-level pruning control target includes: For a first instance-level pruning control target with an instance-level macro switch name, an instance-level conditional statement is generated based on the instance-level macro switch name corresponding to the first instance-level pruning control target. This generates a retained instance branch where the overloaded macro definition is the original module name and a pruning instance branch where the overloaded macro definition is an empty module name. Based on the instance-level conditional statement, the retained instance branch, and the pruning instance branch, a first branch of the first instance-level pruning control target is generated; a second branch of the first instance-level pruning control target where the overloaded macro definition is the original module name or an empty module name is generated. For a second instance-level pruning control target that does not have an instance-level macro switch name, generate a retained instance branch with the overloaded macro definition of the original module name, and generate a pruning instance branch with the overloaded macro definition of the empty module name.

7. The method according to claim 6, characterized in that, The step of generating a module-level code block for a first module-level macro switch name, based on the first module-level macro switch name and the instance-level code blocks of all instance-level clipping control targets belonging to the module corresponding to the first module-level macro switch name, includes: For the first module-level macro switch name, a module-level conditional statement is generated based on the first module-level macro switch name. The first branch and the second branch of the first instance-level pruning control target belonging to the module corresponding to the first module-level macro switch name are respectively inserted into different branches corresponding to the module-level conditional statement. The retained instance branch and the pruning instance branch of the second instance-level pruning control target belonging to the module corresponding to the first module-level macro switch name are respectively inserted into different branches corresponding to the module-level conditional statement. The step of generating a module-level code block based on the second module-level macro switch name, the corresponding overloaded macro, the original module name, and the empty module name includes: For the second module-level macro switch name, generate module-level conditional statements based on the second module-level macro switch name, generate a retained module branch with overloaded macro definitions of the original module name, and generate a trimmed module branch with overloaded macro definitions of empty module names.

8. The method according to any one of claims 1-4, characterized in that, The step of generating an empty module corresponding to the trimming control target based on the original module corresponding to the trimming control target includes: Generate an empty module with the same port declaration as the original module; Set the internal logic of the empty module to empty, and assign a fixed value to the output port of the empty module.

9. A gate-level netlist trimming device, characterized in that, include: The reading module is used to read the pruning configuration data of the gate-level netlist; wherein, the pruning configuration data includes at least one configuration object name and a macro switch name corresponding to each configuration object name; The pruning target determination module is used to determine all pruning control targets of the gate-level netlist based on the configured object name; The first generation module is used to generate an empty module corresponding to each clipping control target based on the original module corresponding to the clipping control target, and to generate an overloaded macro corresponding to the clipping control target for each clipping control target. The second generation module is used to generate conditional compilation macro code based on the macro switch name and the overloaded macro corresponding to each clipping control target, the original module name of the original module, and the empty module name of the empty module; wherein, the conditional compilation macro code is used to assign the overloaded macro to the corresponding original module name or empty module name according to the definition state of the macro switch name in the compilation command; The code insertion module is used to insert the conditional compilation macro code into the gate-level netlist; The replacement module is used to replace the original module name in the original instantiation statement of the pruning control target in the gate-level netlist with the overloaded macro of the pruning control target for each pruning control target.

10. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor is configured to execute a computer program stored in the memory, wherein when the computer program is executed, it implements the gate-level netlist pruning method according to any one of claims 1-8.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the gate-level netlist pruning method as described in any one of claims 1-8.

12. A computer program product comprising computer program instructions, characterized in that, When the computer program instructions are executed by the processor, they implement the gate-level netlist pruning method described in any one of claims 1-8.