Method for automatically adding connection line and label for floating port of device based on script language
Through the scripting language, the connection and label of the floating port of the device is automatically solved, and the problem of manual processing is time-consuming and error-prone is achieved, and efficient and accurate automated processing and report generation is achieved.
Patent Information
- Application Number
- CN202510478417.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-16
- Publication Date
- 2025-08-01
AI Technical Summary
In electronic circuit design, the device floating port needs to be manually added to the connection and label, which is time-consuming and error-prone, and existing tools are difficult to batch process.
Use scripting language to write automated scripts, traverse the schematic gallery, calculate the center coordinates of the floating port of the device, create orthogonal connections and labels, support different rotation directions, and generate modification reports.
It realizes automatic connection and label addition of device floating ports, improves efficiency, reduces human errors, supports parallel processing of multiple units, and generates reports that are easy to verify.
Smart Images

Figure CN120409401A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of electronic design automation, and specifically relates to a method for automatically adding connections and labels to floating ports of devices based on a scripting language. Background Art
[0002] During the process of electronic circuit design, the floating ports of devices in the schematic diagram need to be manually connected and labeled to ensure signal integrity. The existing technologies have the following defects: designers need to search for floating ports one by one and manually connect them, which is time-consuming and prone to omission; manually inputting label names is likely to cause naming errors or inconsistent formats; existing tools are difficult to handle the floating ports of multiple units or devices at one time. Summary of the Invention
[0003] To solve the problems raised in the above background art, the present invention provides a method for automatically adding connections and labels to floating ports of devices based on a scripting language.
[0004] To achieve the above object, the present invention provides a method for automatically adding connections and labels to floating ports of devices based on a scripting language, including the following steps:
[0005] Step S100: Write a script, import it into the command window of the EDA tool, and execute the script;
[0006] Step S200: Traverse the units in the schematic library and filter out the devices with floating ports;
[0007] Step S300: Calculate the center coordinates of the floating ports of the devices and convert them into the coordinates of the schematic window;
[0008] Step S400: Create orthogonal connections and labels that match the signal names according to the converted coordinates of the schematic window;
[0009] Step S500: Loop and execute the steps S200 to S400 until all units are processed, and then execute step S600;
[0010] Step S600: Output and generate a text format report containing the names of all modified units, and automatically save the modified schematic units.
[0011] Preferably, in the step S200, traverse all units in the schematic library and perform the following operations on each unit:
[0012] Open the schematic window of the unit and obtain the unit name attributes of all devices in the unit;
[0013] Judge whether there is a target device type in the unit. If so, enter step S300; otherwise, jump to the next unit.
[0014] Preferably, in the step S300, the following operations are performed on the target device:
[0015] Obtain the orientation attribute of the device and determine the device rotation direction;
[0016] Extract the port boundary coordinates of the device and obtain the port center coordinates through the center point calculation function;
[0017] Call the coordinate point conversion function to convert the center coordinates into schematic window coordinates as the starting coordinates of the connection line.
[0018] Preferably, in the step S400, based on the starting coordinates and the preset ending coordinates, call the connection line creation function to generate an orthogonal line connecting the starting point and the ending point; call the label creation function at a preset position on the connection line to generate a label matching the signal name, and the rotation direction of the label is consistent with the orientation attribute of the device.
[0019] Preferably, in the step S200, the traversal of the cells includes:
[0020] Obtain all cell lists in the schematic library;
[0021] Open the cell circuit diagram window one by one according to the list and obtain its identification number ID.
[0022] Preferably, the determination method of the target device type is:
[0023] Pre-define a list of cell names of the device to be modified;
[0024] Match the attributes of the current device with the list through conditional statements, and if they match, determine it as the target device.
[0025] Preferably, in the step S300, the method for obtaining the port boundary coordinates is:
[0026] Call the boundary function to extract the lower left coordinate (x i1 , y i1 ) and the upper right coordinate (x i2 , y i2 ) of the port;
[0027] The calculation formula for the center coordinates is:
[0028]
[0029] Preferably, the determination method of the preset ending coordinates is:
[0030] Based on the starting coordinates, extend a preset length along the horizontal or vertical direction to generate the ending point of the orthogonal connection line;
[0031] The extension direction is automatically adjusted according to the device orientation attribute to ensure that the connection is aligned with the device port.
[0032] Preferably, in the step S600, the modification record is written into the TXT file in real time according to the printing function, and the report includes the name of the modified unit, the number of target devices, and the processing status.
[0033] Preferably, the method can support parallel processing of multiple floating ports in the same unit.
[0034] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0035] The present invention can automatically create connections for the floating ports of devices in the schematic diagram, automatically modify the label names according to the signal line names, and can automatically create connections and labels for all targets of different units at one time; ensure the accurate connection position through coordinate conversion and center point calculation; support automatic alignment of device labels in different rotation directions; generate a modification report for design verification and version management. Description of the Drawings
[0036] Figure 1 It is a schematic flow diagram of the modeling method of the present invention. Detailed Embodiments
[0037] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0038] When the script is running, it automatically opens a unit in the schematic library, determines whether there are devices to be modified among the devices included in the unit, and if so, adds connections and labels to the unit with floating ports to be modified. After the program runs, connections can be successfully created for all the floating ports of the devices that need to be modified in the schematic diagram, the label names on the connections are automatically modified as needed, and a text TXT format modification report containing the unit names of the devices with added labels and connections is output (this format is only for example and does not limit the present invention).
[0039] Reference Figure 1 , the technical solution provided by the present invention: a method for automatically adding connections and labels to the floating ports of devices based on a scripting language, including the following steps:
[0040] Step S100, write a script and import it into the command window of the EDA tool and then execute the script.
[0041] Specifically, during the process of connecting the schematic diagram, a script for setting the automatic addition of connection lines and labels to the floating ports of devices in the schematic diagram is written. The script can be imported into the tool platform of the Cadence global management window (Command Interpreter Window, CIW) using the import function, and the script is executed by pressing the Enter key. That is, in one embodiment, the script is written in the Cadence Skill language, loaded into the CIW window through a function, and triggered for execution by user input or a scheduled task.
[0042] Step S200: Traverse the cells in the schematic library and filter out the devices with floating ports.
[0043] Specifically, traverse all cells in the schematic library and perform the following operations for each cell: Open the cell schematic window and obtain the cell name attribute of all devices in the cell; Determine whether there is a target device type in the cell. If so, proceed to step S300; otherwise, jump to the next cell. Obtain the list of all cells in the schematic library through the dbGetLibCells function; Open the cell circuit diagram window one by one through the cell opening function dbOpenCellView and obtain its identification number (ID).
[0044] Step S300: Calculate the center coordinates of the floating ports of the device and convert them into the coordinates in the schematic window.
[0045] For the above-mentioned target device, obtain the orientation attribute of the device, determine the device rotation direction, and extract the port boundary coordinates of the device. Obtain the port center coordinates through the center point calculation function, and then call the coordinate point conversion function to convert the center coordinates into the coordinates in the schematic window as the starting coordinates of the connection line.
[0046] In one embodiment, the method for judging the target device type is as follows: Pre-define a list of cell names of the devices to be modified; Match the cellName attribute of the current device with the list through a conditional statement. If they match, it is determined as the target device. For the devices to be modified (i.e., the target devices), obtain the device orientation attribute. R0, R90, MY, and R270 correspond to the device rotating 0°, 90°, 180°, and 270° respectively.
[0047] Among them, the method for obtaining the above-mentioned port boundary coordinates is as follows: Call the boundary function to extract the lower left coordinates (x i1 , y i1 ) and the upper right coordinates (x i2 , y i2 ) of the port; The calculation formula for the center coordinates is:
[0048]
[0049] Step S400: Create orthogonal connections and labels that match signal names based on the converted schematic window coordinates.
[0050] Specifically, based on the starting coordinates and the preset ending coordinates, call the connection creation function to generate an orthogonal line connecting the starting point and the ending point; at a preset position on the connection, call the label creation function to generate a label that matches the signal name, and the rotation direction of the label is consistent with the orientation attribute of the device.
[0051] In one embodiment, the preset position of the label is the lower left corner of the connection, and the correspondence between the rotation direction of the label and the device orientation attribute is: R0 corresponds to a 0° rotation, R90 corresponds to a 90° rotation, MY corresponds to a 180° rotation, and R270 corresponds to a 270° rotation.
[0052] In one embodiment, the method for determining the preset ending coordinates is: taking the starting coordinates as a reference, extending a preset length along the horizontal or vertical direction to generate the ending point of the orthogonal connection; the extension direction is automatically adjusted according to the device orientation attribute to ensure that the connection is aligned with the device port.
[0053] Step S500: Loop and execute steps S200 to S400 until all units are processed, and then execute step S600;
[0054] Step S600: Output and generate a text format report containing all modified unit names, and automatically save the modified schematic units.
[0055] Specifically, according to the printing function, write the modification records into a TXT file in real time. The report includes the names of the modified units, the number of target devices, and the processing status.
[0056] Through the above description of the solution, it can be understood that the method of the present invention supports parallel processing of multiple floating ports in the same unit. That is, it can automatically create connections and labels for all target floating ports of different units at one time. After the modification is completed, close the program.
[0057] Although the embodiments of the present invention have been shown and described, for those of ordinary skill in the art, it can be understood that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for automatically adding connections and labels to floating ports of a device based on a scripting language, characterized in that, It includes the following steps: Step S100: Write a script, import it into the command window of the EDA tool, and execute the script; Step S200: Traverse the cells in the schematic library and filter out the devices with floating ports; Step S300: Calculate the center coordinates of the floating ports of the devices and convert them into the coordinates in the schematic window; Step S400: Create orthogonal connections and labels matching the signal names according to the converted coordinates in the schematic window; Step S500: Loop and execute Step S200 to Step S400. After all cells are processed, execute Step S600; Step S600: Output and generate a text format report containing the names of all modified cells, and automatically save the modified schematic cells.
2. The method for automatically adding connections and labels to floating ports of devices based on a scripting language according to claim 1, wherein In Step S200, traverse all cells in the schematic library and perform the following operations on each cell: Open the schematic window of the cell and obtain the cell name attributes of all devices in the cell; Judge whether there is a target device type in the cell. If so, enter Step S300; otherwise, jump to the next cell.
3. The method for automatically adding connections and labels to floating ports of devices based on a scripting language according to claim 1, characterized in that, In Step S300, perform the following operations on the target device: Obtain the orientation attribute of the device and determine the rotation direction of the device; Extract the port boundary coordinates of the device and obtain the port center coordinates through the center point calculation function; Call the coordinate point conversion function to convert the center coordinates into the coordinates in the schematic window as the starting coordinates of the connection line.
4. The method for automatically adding connections and labels to floating ports of devices based on a scripting language according to claim 3, characterized in that In Step S400, based on the starting coordinates and the preset ending coordinates, call the connection creation function to generate an orthogonal line connecting the starting point and the ending point; call the label creation function at the preset position of the connection line to generate a label matching the signal name, and the rotation direction of the label is consistent with the orientation attribute of the device.
5. The method for automatically adding connections and labels to floating ports of devices based on a scripting language according to claim 1, characterized in that, In Step S200, the traversal of the cell includes: Obtain all cell lists in the schematic library; Open the circuit diagram window of the cell one by one according to the list and obtain its identification number ID.
6. The method for automatically adding connections and labels to the floating ports of devices based on a scripting language according to claim 2, characterized in that, The judgment method of the target device type is: Pre-define a list of cell names of the devices to be modified; Match the attributes of the current device with the list through conditional statements. If they match, it is determined as the target device.
7. The method for automatically adding connections and labels to floating ports of devices based on a scripting language according to claim 3, characterized in that, In Step S300, the method for obtaining the port boundary coordinates is: Call the boundary function to extract the lower left coordinates (x i1 , y i1 ) and the upper right coordinates (x i2 , y i2 ); The calculation formula for the center coordinates is:
8. The method for automatically adding connections and labels to floating ports of devices based on a scripting language according to claim 4, wherein, The determination method of the preset ending coordinates is: Based on the starting coordinates, extend a preset length along the horizontal or vertical direction to generate the ending point of the orthogonal connection line; The extension direction is automatically adjusted according to the orientation attribute of the device to ensure that the connection line is aligned with the device port.
9. The method for automatically adding connections and labels to floating ports of devices based on a scripting language according to claim 1, wherein In Step S600, write the modification records into the TXT file in real time according to the printing function. The report includes the names of the modified cells, the number of target devices, and the processing status.
10. The method for automatically adding connections and labels to the floating ports of devices based on a scripting language according to any one of claims 1-9, characterized in that, The method can support the parallel processing of multiple floating ports in the same cell.