Encapsulation file generation method and device, electronic equipment and storage medium
By automatically converting the packaging formats between different EDA software, the problem of packaging format incompatibility is solved, design efficiency and resource sharing are improved, error rates and costs are reduced, and technical exchanges are promoted.
Patent Information
- Application Number
- CN202510367247.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-26
- Publication Date
- 2025-08-01
AI Technical Summary
The incompatibility of packaging formats between different EDA software makes it difficult to share and reuse design resources, inefficient design and prone to errors, increasing design costs and risks.
By obtaining the file in the first packaging format, reading the packaging information of the components, determining the packaging element to be converted, and converting it into the second packaging format required by the target electronic design automation software, and building the corresponding packaging file.
It realizes the conversion of packaging formats between different EDA software, improves design efficiency, reduces error rates, promotes the sharing and reuse of design resources, reduces design complexity and cost, and promotes technical exchanges and knowledge sharing.
Smart Images

Figure CN120407519A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of package file generation, and particularly to a method for generating a package file, an apparatus for generating a package file, an electronic device, and a computer-readable storage medium. Background Art
[0002] EDA is the abbreviation of Electronic Design Automation, which means "Electronic Design Automation" in Chinese. Briefly speaking, EDA software is a series of computer software tools used to assist electronic engineers in designing, analyzing, verifying, and manufacturing electronic products (such as integrated circuits, printed circuit boards, etc.).
[0003] A PCB circuit board, whose full name is Printed Circuit Board and Chinese name is printed circuit board, is simply a board used to connect electronic components and provide electrical connections. It is like the "skeleton" of an electronic device, carrying various electronic components and connecting them through pre-designed circuit traces to form a complete circuit.
[0004] With the rapid development of technology, circuit schematic design has fully relied on EDA software tools. In schematic design, the modeling of components is crucial, and the correctness of its model directly determines the success or failure of PCB circuit board design. However, there are a variety of EDA software used in the current electronic design industry, and there are significant incompatibilities between the package formats of different EDA software, which directly leads to difficulties in sharing and reusing design resources and seriously hinders the improvement of design efficiency. Facing this format barrier, the traditional manual conversion method is not only inefficient but also extremely prone to errors, further increasing the design cost and risk. Summary of the Invention
[0005] Embodiments of the present invention provide a method, an apparatus, an electronic device, and a computer-readable storage medium for generating a package file to overcome or at least partially solve the above problems.
[0006] Embodiments of the present invention disclose a method for generating a package file, including:
[0007] Obtain a first package file expressed in a first package format;
[0008] Read the package information of components from the first package file;
[0009] Determine the package elements to be converted of the components based on the package information;
[0010] Determine the target electronic design automation software and a second package format for the target electronic design automation software;
[0011] Convert the element to be encapsulated and transformed into a target element expressed in the second encapsulation format;
[0012] Use the target element to construct a second encapsulation file for the target electronic design automation software.
[0013] Optionally, the step of reading the encapsulation information of the component from the first encapsulation file includes:
[0014] Read the first encapsulation element sub-information of the component from the first encapsulation file based on lexical analysis and syntactic analysis methods;
[0015] Read the second encapsulation element sub-information of the component from the first encapsulation file based on regular expression matching methods;
[0016] Read the third encapsulation element sub-information of the component from the first encapsulation file based on a pre-constructed parsing library for the first encapsulation file;
[0017] Determine the encapsulation information using the first encapsulation element sub-information, and / or the second encapsulation element sub-information, and / or the third encapsulation element sub-information.
[0018] Optionally, the step of reading the first encapsulation element sub-information of the component from the first encapsulation file based on lexical analysis and syntactic analysis methods includes:
[0019] Decompose the text stream of the first encapsulation file into independent lexical units;
[0020] Determine the syntax rules of the first encapsulation file, and organize the lexical units into an abstract syntax tree according to the syntax rules;
[0021] Traverse the abstract syntax tree and extract the first encapsulation element sub-information for expressing the component.
[0022] Optionally, the step of reading the second encapsulation element sub-information of the component from the first encapsulation file based on regular expression matching methods includes:
[0023] Determine the target pattern of the second encapsulation element sub-information in the first encapsulation file;
[0024] Determine the regular expression corresponding to the target pattern;
[0025] Read the second encapsulation element sub-information of the component from the first encapsulation file based on the regular expression.
[0026] Optionally, the step of converting the encapsulation element to be converted into a target element expressed in the second encapsulation format includes:
[0027] Determine the correspondence between the encapsulation element to be converted and the target element;
[0028] Develop a corresponding conversion function for the encapsulation element to be converted based on the correspondence;
[0029] Traverse the encapsulation element to be converted to determine the element type of the encapsulation element to be converted;
[0030] Take the encapsulation element to be converted as input, call the corresponding conversion function according to the element type, and output the target element.
[0031] Optionally, the step of converting the encapsulation element to be converted into a target element expressed in the second encapsulation format includes:
[0032] Determine the element type of the encapsulation element to be converted, and create a segment template for the second encapsulation format based on the element type; the segment template contains placeholders;
[0033] Fill the encapsulation element to be converted into the placeholder to generate a target element code segment for the encapsulation element to be converted;
[0034] Combine the code segments to generate a target element expressed in the second encapsulation format.
[0035] Optionally, the encapsulation information includes encapsulation attribute content, encapsulation label text, encapsulation pattern drawing, and encapsulation pin definition.
[0036] The embodiment of the present invention also discloses an encapsulation file generation device, including:
[0037] A first encapsulation file acquisition module, configured to acquire a first encapsulation file expressed in a first encapsulation format;
[0038] An encapsulation information reading module, configured to read the encapsulation information of components from the first encapsulation file;
[0039] An encapsulation element to be converted determination module, configured to determine the encapsulation element to be converted of the component based on the encapsulation information;
[0040] A second encapsulation format determination module, configured to determine the target electronic design automation software and the second encapsulation format for the target electronic design automation software;
[0041] An element conversion module, configured to convert the encapsulation element to be converted into a target element expressed in the second encapsulation format;
[0042] A second package file construction module, configured to construct a second package file for the target electronic design automation software by using the target elements.
[0043] An embodiment of the present invention also discloses an electronic device, including a processor, a communication interface, a memory, and a communication bus. Among them, the processor, the communication interface, and the memory complete communication with each other through the communication bus;
[0044] The memory is used to store a computer program;
[0045] When the processor is used to execute the program stored in the memory, the method described in the embodiment of the present invention is implemented.
[0046] An embodiment of the present invention also discloses a computer-readable storage medium, on which instructions are stored. When executed by one or more processors, the processors are caused to execute the method described in the embodiment of the present invention.
[0047] The embodiment of the present invention has the following advantages:
[0048] In the embodiment of the present invention, by obtaining a first package file expressed in a first package format; reading the package information of components from the first package file; determining the package elements to be converted of the components based on the package information; determining the target electronic design automation software and a second package format for the target electronic design automation software; converting the package elements to be converted into target elements expressed in the second package format; and constructing a second package file for the target electronic design automation software by using the target elements, the conversion of the package formats between different EDA software is realized, and the problem of incompatibility of the package formats between different EDA software is solved.
[0049] Furthermore, the following beneficial effects are also achieved:
[0050] Improve design efficiency: Through the automated conversion process, the cumbersome work of manually re-creating or editing package information is avoided, the design cycle is greatly shortened, and the design efficiency is improved.
[0051] Reduce error rate: Automated conversion can reduce errors caused by manual operations, ensure the accuracy of the converted package information, and reduce subsequent design problems caused by incorrect package information.
[0052] Promote the sharing and reuse of design resources: Enable package information resources that could originally only be used in specific EDA software to be shared and reused between different software platforms, avoid duplicate labor, and save design costs.
[0053] Reduce the complexity and cost of design conversion: Compared with manual conversion, this solution can reduce the complexity of conversion and reduce labor costs and time costs.
[0054] Promote technical communication and knowledge sharing in the electronics industry: By implementing the conversion of packaging formats, it helps to share design resources between different teams and organizations, promoting technical communication and knowledge sharing.
[0055] Support a more flexible design process: Designers can choose the most suitable EDA software according to project requirements without being restricted by compatibility issues of packaging formats, thus achieving a more flexible design process. Description of the Drawings
[0056] Figure 1 is a flowchart of the steps of a method for generating a packaging file provided in an embodiment of the present invention;
[0057] Figure 2 is a schematic diagram of the process of a method for generating a packaging file provided in an embodiment of the present invention;
[0058] Figure 3 is a block diagram of the structure of a device for generating a packaging file provided in an embodiment of the present invention;
[0059] Figure 4 is a block diagram of the hardware structure of an electronic device provided in an embodiment of the present invention;
[0060] Figure 5 is a schematic diagram of a computer-readable medium provided in an embodiment of the present invention. Detailed Embodiments
[0061] To make the above objects, features, and advantages of the present invention more obvious and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0062] In practical applications, with the development of technology, almost all circuit PCB designs are carried out by EDA software tools. And a crucial part of PCB design is the modeling of component packages. The correctness of the component package model will directly affect the success or failure of the entire PCB circuit board design. Currently, there are a large number of EDA software types for circuit diagram design in the electronic design industry, and the PCB package formats of each EDA software are incompatible with each other. In the field of electronic design, with the wide application of EDA software, the diversity of PCB package formats has led to difficulties in sharing and reusing design resources. To improve design efficiency and reduce errors caused by format incompatibility, the conversion of PCB package formats has become crucial. This conversion not only promotes the compatibility of design resources but also helps to reduce the complexity and cost of design conversion. At the same time, it also promotes technical exchanges and knowledge sharing in the electronics industry, and has a significant promoting effect on education, research, and global project cooperation. Although it is difficult to achieve a unified format in reality, the necessity of format conversion has become increasingly prominent in electronic design.
[0063] Referring to Figure 1 , the flowchart of the steps of a method for generating a package file provided in an embodiment of the present invention is shown, which may specifically include the following steps:
[0064] Step 101, obtain a first package file expressed in a first package format;
[0065] Step 102, read the package information of the components from the first package file;
[0066] Step 103, determine the package elements to be converted of the components based on the package information;
[0067] Step 104, determine the target electronic design automation software and the second package format for the target electronic design automation software;
[0068] Step 105, convert the package elements to be converted into target elements expressed in the second package format;
[0069] Step 106, construct a second package file for the target electronic design automation software using the target elements.
[0070] In practical applications, KiCad is an open-source EDA software suite that provides complete circuit design tools, including schematic capture, PCB layout, component library management, etc. KiCad is popular for its free and cross-platform features, especially in the open-source hardware community and small design teams. Its package format is its custom format.
[0071] PADS (PowerPCB Advanced Design System) is a commercial-grade EDA software. Widely used across industry, especially for designing complex, high-performance circuit boards, PADS offers powerful functionality and a comprehensive ecosystem, including proprietary packaging formats.
[0072] An embodiment of the present invention can be applied to a system for converting the package format in a PCB circuit board design drawing. Taking KiCad and PADS as examples, the system is used to convert a KiCad-readable package file into a PADS-readable package file. That is, illustratively, the first package file can be a KiCad package file, and the second package file can be a PADS package file.
[0073] Of course, the first package file and the second package file may also be package files that comply with the package format of other electronic design automation software, which is not limited in this embodiment of the present invention.
[0074] A package file is a specific file that contains all the design information of a component, such as a .d file; a package format defines the rules and standards for how to organize and store this information in a package file, such as the .d file format of PADS.
[0075] In a specific implementation, the embodiment of the present invention may obtain a first encapsulation file expressed in a first encapsulation format;
[0076] When the initial electronic design automation software is KiCad, the first package file is a KiCad package file, and the first package format is a format readable by KiCad for package files, the conversion process begins with obtaining the source file to be converted. The KiCad package file is a file used in KiCad to store component package information and is the target of subsequent operations.
[0077] This embodiment of the present invention clarifies the input source file by acquiring a first package file expressed in a first package format, determines the starting object for conversion, and lays the foundation for subsequent data reading and processing. For example, the first package file expressed in the first package format can be a KiCad package file of .KiCad_mod. By acquiring the first package file, the solution can process package files of specific EDA software.
[0078] The embodiment of the present invention can read the packaging information of the component from the first packaging file to parse the KiCad packaging file.
[0079] Optionally, the package information may include package attribute content, package label text, package pattern drawing, package pin definition, package barrier definition, and package 3D model mapping.
[0080] Encapsulation attribute content: Such as the name, model, manufacturer, supplier, material code of the encapsulation, etc. These are the attributes describing the basic information of the encapsulation.
[0081] Encapsulation label text: Refers to the text identification on the encapsulation, such as pin numbers, component values, polarity markings, etc. These information help to identify and use the encapsulation.
[0082] Encapsulation pattern drawing: This is the key part describing the physical shape of the encapsulation, including the shape, size, position of the pads, and graphic elements such as the outline, silkscreen, solder mask, etc., as well as their dimensions and layouts.
[0083] Encapsulation pin definition: Details the information such as the number, name, type (such as power, signal, ground), and electrical characteristics of each pin of the encapsulation. This is the key to connecting the circuit.
[0084] Encapsulation layer definition: For multi-layer boards, the encapsulation may need to define the pads and connection methods on different layers, such as the definition of vias, blind vias, and buried vias.
[0085] Encapsulation 3D model mapping: Refers to associating the encapsulation with a 3D model for 3D visualization, mechanical interference checking, etc. The 3D model can provide more intuitive encapsulation appearance and dimension information.
[0086] In the embodiment of the present invention, by reading the encapsulation information of the components from the first encapsulation file, necessary data is provided for subsequent conversion. By structuring the information in the original file, it is convenient for subsequent analysis and conversion.
[0087] The embodiment of the present invention can determine the encapsulation elements to be converted of the components based on the encapsulation information, so as to screen out the elements that need to be format-converted. Exemplarily, the encapsulation elements to be converted may include the title definition of the encapsulation, encapsulation attribute text, encapsulation pin definition, coordinates, line types, line widths, combination relationships, etc. of the encapsulation pattern drawing.
[0088] In practical applications, not all the information read from the KiCad encapsulation file needs or can be directly converted to the PADS format. By determining the encapsulation elements to be converted of the components based on the encapsulation information, the following beneficial effects can be achieved:
[0089] Improve conversion efficiency: Only process the elements that need to be converted, avoiding unnecessary calculations and operations.
[0090] Enhance the accuracy of conversion: Focus on the conversion of core elements, reducing errors caused by irrelevant information.
[0091] Flexibility: Allow selecting the elements to be converted according to actual needs.
[0092] Embodiments of the present invention can determine a target electronic design automation software and a second packaging format for the target electronic design automation software to clarify the target platform and target file format for conversion. This is a key prerequisite for format conversion.
[0093] Exemplarily, when it is determined that the converted file will be used for PADS software and needs to meet the format requirements of PADS packaging files, in this case, the target electronic design automation software can be PADS software, the second packaging file is a PADS packaging file, and the second packaging format is the readable format of the packaging file by PADS software.
[0094] Embodiments of the present invention can convert the to-be-converted packaging elements into target elements expressed in the second packaging format, so as to convert the packaging information extracted from the KiCad format into an expression conforming to the PADS format.
[0095] Exemplarily, assume that a simple rectangular packaging element is to be converted currently.
[0096] 1. Understand the expression of rectangular elements in KiCad:
[0097] In the.KiCad_mod file of KiCad, a rectangular packaging element as a to-be-converted packaging element may be represented by the following text instruction:
[0098] (fp_rect(start -1 -1)(end 1 1)(layer F.SilkS)(width 0.15)), where:
[0099] (fp_rect...): Indicates that this is a rectangular element.
[0100] (start -1 -1): The coordinates of a corner point of the rectangle are (-1, -1).
[0101] (end 1 1): The coordinates of the other corner point of the rectangle's diagonal are (1, 1).
[0102] (layer F.SilkS): This rectangle is located on the top silk screen layer.
[0103] (width 0.15): The line width of the rectangle is 0.15.
[0104] 2. Understand the expression of rectangular elements in PADS:
[0105] In the.d file of PADS, a rectangular packaging element may be represented by the following text instruction:
[0106] SHAPE RECT-100 -100 100 100 15SILKSCREEN TOP, where:
[0107] SHAPE RECT: Indicates that this is a rectangular element.
[0108] -100 -100: The coordinates of a corner point of the rectangle are (-100, -100).
[0109] 100 100: The coordinates of the other corner point of the rectangle's diagonal are (100, 100).
[0110] 15: The line width of the rectangle is 15 (note that the units may be different and need to be converted).
[0111] SILKSCREEN TOP: This rectangle is located on the top silk screen layer.
[0112] 3. Conversion process:
[0113] Now, it is necessary to convert the rectangular element in KiCad into a rectangular element in PADS. This involves the following steps:
[0114] Extract the parameters of the KiCad rectangular element: Extract the starting coordinates (-1, -1), ending coordinates (1, 1), layer (F.SilkS), and line width (0.15) from the KiCad text instruction.
[0115] Determine the corresponding parameters in PADS:
[0116] Coordinate conversion: It is necessary to consider whether the coordinate units and origin positions used in KiCad and PADS are consistent. Assume that the unit used in PADS is 100 times that of KiCad, then the coordinates in KiCad need to be multiplied by 100. Therefore, (-1, -1) is converted to (-100, -100), and (1, 1) is converted to (100, 100).
[0117] Layer name mapping: It is necessary to map the layer name F.SilkS in KiCad to the layer name SILKSCREENTOP in PADS. This requires a layer name mapping table.
[0118] Line width conversion: Similarly, unit conversion needs to be considered. Assume that the line width unit in PADS is 100 times that of KiCad, then the line width in KiCad needs to be multiplied by 100. Therefore, 0.15 is converted to 15.
[0119] Generate the text instruction for the PADS rectangular element (target element): According to the converted parameters, generate the text instruction for PADS:
[0120] SHAPE RECT-100 -100 100 100 15SILKSCREEN TOP
[0121] The above example shows how to convert a simple rectangular package element from KiCad format to PADS format. The actual conversion process will be more complex because more element types need to be processed (such as circles, arcs, texts, pins, etc.), and the detailed differences between different software need to be considered. Those skilled in the art can use any other method to convert the package element to be converted into the target element expressed in the second package format, and the embodiments of the present invention do not limit this.
[0122] By converting the package element to be converted into the target element expressed in the second package format, the following beneficial effects can be achieved:
[0123] Achieve format compatibility: Convert package information in different formats into a format recognizable by the target software, and solve the problem of format incompatibility.
[0124] Data conversion: Map and convert the source data according to the requirements of the target format to ensure the accurate transmission of information.
[0125] The embodiments of the present invention can also use the target element to construct a second package file for the target electronic design automation software, so as to organize and write the converted target element according to the format specification of the PADS package file to generate the final PADS package file.
[0126] By using the target element to construct a second package file for the target electronic design automation software, the following beneficial effects can be achieved:
[0127] Generate an available file: Create a package file that can be directly used in PADS software, and realize the migration of the package format from KiCad to PADS.
[0128] Automated conversion: Improve the conversion efficiency and reduce manual operations through the automated construction process.
[0129] Resource reuse: Enable the package resources that could originally only be used in KiCad to be used in PADS, and realize the sharing and reuse of design resources.
[0130] In an embodiment of the present invention, a first encapsulated file expressed in a first encapsulation format is obtained; the encapsulation information of components is read from the first encapsulated file; the encapsulated elements to be converted of the components are determined based on the encapsulation information; a target electronic design automation (EDA) software and a second encapsulation format for the target EDA software are determined; the encapsulated elements to be converted are converted into target elements expressed in the second encapsulation format; and a second encapsulated file for the target EDA software is constructed using the target elements, thereby realizing the conversion of the encapsulation format between different EDA softwares and solving the problem of incompatibility of the encapsulation formats between different EDA softwares.
[0131] Furthermore, the following beneficial effects are also achieved:
[0132] Improve design efficiency: Through the automated conversion process, the cumbersome work of manually re-creating or editing encapsulation information is avoided, greatly shortening the design cycle and improving the design efficiency.
[0133] Reduce error rate: Automated conversion can reduce errors caused by manual operations, ensure the accuracy of the converted encapsulation information, and reduce subsequent design problems caused by incorrect encapsulation information.
[0134] Promote the sharing and reuse of design resources: Enable the encapsulation information resources that could originally only be used in specific EDA softwares to be shared and reused between different software platforms, avoiding duplicate labor and saving design costs.
[0135] Reduce the complexity and cost of design conversion: Compared with manual conversion, this solution can reduce the complexity of conversion and reduce the labor cost and time cost.
[0136] Facilitate technical communication and knowledge sharing in the electronics industry: By realizing the conversion of the encapsulation format, it helps to share design resources between different teams and organizations, promoting technical communication and knowledge sharing.
[0137] Support a more flexible design process: Designers can choose the most suitable EDA software according to project requirements without being restricted by the compatibility problem of the encapsulation format, thus realizing a more flexible design process.
[0138] Based on the above embodiment, a variant embodiment of the above embodiment is proposed. Here, it should be noted that for the sake of brief description, only the differences from the above embodiment are described in the variant embodiment.
[0139] In an optional embodiment of the present invention, the step of reading the encapsulation information of components from the first encapsulated file includes:
[0140] Read the first package element sub - information of the component from the first package file based on the method of lexical analysis and syntactic analysis;
[0141] Read the second package element sub - information of the component from the first package file based on the method of regular expression matching;
[0142] Read the third package element sub - information of the component from the first package file based on the pre - built parsing library for the first package file;
[0143] Determine the package information by using the first package element sub - information, and / or the second package element sub - information, and / or the third package element sub - information.
[0144] 1. Method based on lexical analysis and syntactic analysis:
[0145] Implementation:
[0146] Use a lexical analyzer (Lexer) to break down the text stream of the KiCad package file into individual lexical units (Tokens).
[0147] Use a syntactic analyzer (Parser) to organize the lexical units into an abstract syntax tree (AST) or other intermediate representation forms according to the syntax rules of the KiCad package file.
[0148] Traverse the AST to extract the required first package element sub - information. The first package element sub - information may include package attribute content, package label text, package pattern drawing, and package pin definition.
[0149] Advantages:
[0150] High accuracy: It can be parsed strictly according to the syntax rules of the KiCad package file to ensure the accuracy of information.
[0151] Strong scalability: When the format of the KiCad package file changes, only the rules of the lexical analyzer and syntactic analyzer need to be updated.
[0152] Structured data: Parse the file content into structured data for convenient subsequent processing and conversion.
[0153] Applicable scenarios: When in - depth understanding and precise parsing of the KiCad package file are required.
[0154] 2. Method based on regular expression matching:
[0155] Implementation:
[0156] Use regular expressions to match specific patterns in KiCad footprint files, where these patterns correspond to the syntax structures of footprint attribute content, footprint label text, footprint pattern drawing, and footprint pin definitions.
[0157] Based on this specific pattern, the matched text information will be extracted as the second encapsulated element sub-information.
[0158] Advantages:
[0159] Simple to implement: Compared with lexical analysis and syntactic analysis, regular expression matching is usually easier to implement.
[0160] Relatively efficient: For simple file structures, regular expression matching can be relatively efficient.
[0161] Applicable scenarios: When the structure of the KiCad footprint file is relatively simple and stable, or as a method for rapid prototype verification.
[0162] 3. Method based on the existing KiCad footprint file parsing library:
[0163] Implementation method:
[0164] Utilize pre-built KiCad footprint file parsing libraries. These parsing libraries have already implemented the parsing function for KiCad footprint files.
[0165] Call the interfaces provided by the parsing library to obtain the required third encapsulated element sub-information.
[0166] Advantages:
[0167] High development efficiency: There is no need to write parsing code from scratch, which can save development time.
[0168] Verified: Existing parsing libraries usually undergo extensive testing and use, and have high reliability.
[0169] Applicable scenarios: When a suitable KiCad footprint file parsing library is available, the reading of footprint information can be quickly achieved.
[0170] 4. Mix and use multiple methods:
[0171] Implementation method:
[0172] Among the first encapsulated element sub-information, the second encapsulated element sub-information, and the third encapsulated element sub-information, any one of the element sub-information may be part of the footprint information or all of the footprint information. The above methods can be used alone or in combination. For example, first use regular expressions to quickly locate the key areas in the text stream, and then use lexical analysis and syntactic analysis to perform more precise parsing on these areas.
[0173] Advantages:
[0174] Balance efficiency and accuracy: An appropriate method can be selected according to actual needs to achieve a balance between efficiency and accuracy.
[0175] Improve robustness: By combining the advantages of multiple methods, the adaptability to different format changes can be improved.
[0176] Applicable scenarios: When the structure of the KiCad package file is relatively complex and both efficiency and accuracy need to be considered.
[0177] In an alternative embodiment of the present invention, the step of the method based on lexical analysis and syntactic analysis for reading the first package element sub-information of components from the first package file includes:
[0178] Decompose the text stream of the first package file into independent lexical units;
[0179] Determine the syntax rules of the first package file, and organize the lexical units into an abstract syntax tree according to the syntax rules;
[0180] Traverse the abstract syntax tree to extract the first package element sub-information for expressing components.
[0181] Exemplarily, a fragment of the KiCad package file (the first package file):
[0182] (module MyComponent(layer F.Cu)
[0183] (attr smd)
[0184] (fp_line(start - 1 0)(end 1 0)(layer F.SilkS)(width 0.15))
[0185] (pad 1 smd rect(at 1 1)(size 0.8 1.5)(layers F.Cu F.Paste F.Mask)) )
[0187] 1. Lexical analysis (Lexer):
[0188] The lexical analyzer will decompose the above text stream into individual lexical units (Tokens). Each Token contains a type and a value.
[0189] For the above example, the lexical analyzer may generate the following Token sequence:
[0190] LPAREN / / (
[0191] IDENTIFIER "module"
[0192] IDENTIFIER "MyComponent"
[0193] LPAREN / / (
[0194] IDENTIFIER "layer"
[0195] IDENTIFIER "F.Cu"
[0196] RPAREN / / )
[0197] RPAREN / / )
[0198] LPAREN / / (
[0199] IDENTIFIER "attr"
[0200] IDENTIFIER "smd"
[0201] RPAREN / / )
[0202] LPAREN / / (
[0203] IDENTIFIER "fp_line"
[0204] LPAREN / / (
[0205] IDENTIFIER "start"
[0206] NUMBER "-1"
[0207] NUMBER "0"
[0208] RPAREN / / )
[0209] LPAREN / / (
[0210] IDENTIFIER "end"
[0211] NUMBER "1"
[0212] NUMBER "0"
[0213] RPAREN / / )
[0214] LPAREN / / (
[0215] IDENTIFIER "layer"
[0216] IDENTIFIER "F.SilkS"
[0217] RPAREN / / )
[0218] LPAREN / / (
[0219] IDENTIFIER "width"
[0220] NUMBER "0.15"
[0221] RPAREN / / )
[0222] RPAREN / / )
[0223] LPAREN / / (
[0224] IDENTIFIER "pad"
[0225] NUMBER "1"
[0226] IDENTIFIER "smd"
[0227] IDENTIFIER "rect"
[0228] LPAREN / / (
[0229] IDENTIFIER "at"
[0230] NUMBER "1"
[0231] NUMBER "1"
[0232] RPAREN / / )
[0233] LPAREN / / (
[0234] IDENTIFIER "size"
[0235] NUMBER "0.8"
[0236] NUMBER "1.5"
[0237] RPAREN / / )
[0238] LPAREN / / (
[0239] IDENTIFIER "layers"
[0240] IDENTIFIER "F.Cu"
[0241] IDENTIFIER "F.Paste"
[0242] IDENTIFIER "F.Mask"
[0243] RPAREN / / )
[0244] RPAREN / / )
[0245] RPAREN / / )
[0246] 2. Syntax Analysis (Parser):
[0247] The parser will organize the above Token sequence into an Abstract Syntax Tree (AST) according to the syntax rules of the KiCad footprint file. The AST can clearly represent the structure and relationships in the file.
[0248] For the above example, the structure of the AST may be as follows (simplified representation):
[0249]
[0250]
[0251] 3. Traverse the Abstract Syntax Tree AST to Extract Information:
[0252] With the Abstract Syntax Tree AST, it is possible to traverse this tree structure and extract the required footprint information. For example, the following can be extracted:
[0253] Footprint Name: Traverse the ModuleNode to obtain the value of the name attribute, "MyComponent".
[0254] Footprint Layer: Traverse the ModuleNode to obtain the value of the layer attribute, "F.Cu".
[0255] Silk Screen Line Information: Traverse the graphicElements, find the LineNode, and obtain the values of its start, end, layer, and width attributes.
[0256] Pad Information: Traverse the pads, find the PadNode, and obtain the values of its number, type, shape, position, size, and layers attributes.
[0257] Through lexical analysis and syntax analysis, the embodiments of the present invention can convert the KiCad footprint file into a structured data representation (AST), thereby facilitating the extraction of various footprint information. This method can accurately understand the structure of the file and provide a reliable data basis for subsequent format conversion.
[0258] In an embodiment of the present invention, the text stream of the first package file is decomposed into independent lexical units; the syntax rules of the first package file are determined, and the lexical units are organized into an abstract syntax tree according to the syntax rules; the abstract syntax tree is traversed, and the first package element sub-information for expressing components is extracted, so that the KiCad package file can be accurately parsed to extract structured information. This method is generally more powerful and reliable than regular expressions, especially when dealing with complex syntax structures.
[0259] In an optional embodiment of the present invention, the step of reading the second package element sub-information of the component from the first package file by the method based on regular expression matching includes:
[0260] Determine the target pattern of the second package element sub-information in the first package file;
[0261] Determine the regular expression corresponding to the target pattern;
[0262] Read the second package element sub-information of the component from the first package file based on the regular expression.
[0263] Exemplarily, a fragment of the KiCad package file (the first package file):
[0264] (module MyComponent(layer F.Cu)
[0265] (attr smd)
[0266] (fp_line(start - 1 0)(end 1 0)(layer F.SilkS)(width 0.15))
[0267] (pad 1 smd rect(at 1 1)(size 0.8 1.5)(layers F.Cu F.Paste F.Mask)) )
[0269] Regular expressions can be defined for different package elements.
[0270] 1. Extract the package name and layer information:
[0271] The following regular expression can be used to match the module statement:
[0272] Code segment
[0273] \(module\s+(?P <name>\w+)\s+\(layer\s+(?P <layer>\S+)\)
[0274] (module\s+: Match (one or more spaces follow module.)
[0275] (?P <name>\w+): Matches one or more letters, digits, or underscores and captures them into a group named name.
[0276] \s+\(layer\s+: Matches one or more whitespace characters, then (layer followed by one or more whitespace characters.
[0277] (?P <layer>\S+): Matches one or more non-whitespace characters and captures them into a group named layer.
[0278] \): Matches a right parenthesis.
[0279] Applying this regular expression to the above example file snippet, the following can be extracted:
[0280] name: "MyComponent"
[0281] layer: "F.Cu"
[0282] 2. Extract silk screen line information:
[0283] The following regular expression can be used to match the fp_line statement:
[0284] Code segment:
[0285] \(fp_line\s+\(start\s+(?P<start_x>-?\d+\.?\d*)\s+(?P<start_y>-?\d+\.?\d*)\)\s+\(end\s+(?P<end_x>-?\d+\.?\d*)\s+(?P<end_y>-?\d+\.?\d*)\)\s+\(layer\s+(?P \S+)\)\s+\(width\s+(?P <width>\d+\.?\d*)\)\)
[0286] This regular expression is relatively complex, but it attempts to match the key information in the fp_line statement, such as the starting coordinates, ending coordinates, layer, and line width, and capture them into different groups.
[0287] Applying this regular expression, the following can be extracted:
[0288] start_x:"-1"
[0289] start_y:"0"
[0290] end_x:"1"
[0291] end_y:"0"
[0292] line_layer:"F.SilkS"
[0293] width:"0.15"
[0294] 3. Extract pad information:
[0295] A similar regular expression can be used to match the pad statement and extract the pad number, type, shape, location, size, and layer information. For example, the regular expression to extract the pad number can be:
[0296] Code segment:
[0297] \(pad\s+(?P<pad_number>\d+)\s+
[0298] Advantages:
[0299] Simple to implement: Compared with lexical analysis and syntactic analysis, regular expression matching is usually easier to implement, especially for files with a relatively fixed structure.
[0300] High efficiency: For simple matching tasks, regular expression matching can be very efficient.
[0301] Regarding step 1 of the above example: Determine the target pattern of the second package element sub-information in the first package file;
[0302] In this example, assume that the following second package element sub-information needs to be extracted:
[0303] The name and layer information of the package.
[0304] The starting coordinates, ending coordinates, layer, and line width of the silk screen line.
[0305] Then, the target pattern of this information in the KiCad package file is:
[0306] The structure of (module...(layer...)).
[0307] The structure of (fp_line(start...)(end...)(layer...)(width...)).
[0308] Step 2: Determine the regular expression corresponding to the target pattern;
[0309] According to the target pattern determined in Step 1, the corresponding regular expression can be written:
[0310] For the module statement:
[0311] Code segment:
[0312] (module\s+(?P <name>\w+)\s+\(layer\s+(?P <layer>\S+)\)
[0313] This regular expression matches the pattern that starts with (module followed by the package name and layer information.
[0314] For the fp_line statement:
[0315] Code segment:
[0316] \(fp_line\s+\(start\s+(?P<start_x>-?\d+\.?\d*)\s+(?P<start_y>-?\d+\.?\d*)\)\s+\(end\s+(?P<end_x>-?\d+\.?\d*)\s+(?P<end_y>-?\d+\.?\d*)\)\s+\(layer\s+(?P<line_layer>\S+)\)\s+\(width\s+(?P <width>\d+\.?\d*)\)\)
[0317] This regular expression matches a pattern starting with (fp_line and containing start coordinates, end coordinates, layer, and line width information.
[0318] Step 3: Read the second package element sub-information of the component from the first package file based on the regular expression.
[0319] Now, the regular expression written in Step 2 can be used to process the example file fragment:
[0320] Use the regular expression of module:
[0321] The regular expression \(module\s+(?P <name>\w+)\s+\(layer\s+(?P <layer>Applying \S+) to the example file snippet, the following can be matched:
[0322] name: "MyComponent"
[0323] layer: "F.Cu"
[0324] Regular expression for using fp_line:
[0325] The regular expression \(fp_line\s+\(start\s+(?P<start_x>-?\d+\.?\d*)\s+(?P<start_y>-?\d+\.?\d*)\)\s+\(end\s+(?P<end_x>-?\d+\.?\d*)\s+(?P<end_y>-?\d+\.?\d*)\)\s+\(layer\s+(?P <width>\d+\.?\d*)\)\) applied to the sample file fragment can match the second encapsulation element sub - information:
[0326] start_x:"-1"
[0327] start_y:"0"
[0328] end_x:"1"
[0329] end_y:"0"
[0330] line_layer:"F.SilkS"
[0331] width:"0.15"
[0332] By this, determine the target pattern of the second encapsulation element sub - information in the first encapsulation file; determine the regular expression corresponding to the target pattern; based on the regular expression, read the second encapsulation element sub - information of the component from the first encapsulation file, and successfully extract the relevant information of the package name, layer information, and silk - screen line from the KiCad package file fragment using the method of regular expression matching. This illustrates the feasibility and effectiveness of this method.
[0333] In an optional embodiment of the present invention, the step of converting the encapsulation element to be converted into a target element expressed in the second encapsulation format can be executed in the following manner.
[0334] 1. Method based on mapping rules and conversion functions:
[0335] Implementation method:
[0336] Establish mapping rules: Define in detail the correspondence between KiCad encapsulation elements to be converted (title definition of the package, package attribute text, package pin definition, coordinates, line type, line width, combination relationship, etc. of the package pattern drawing) and PADS target elements. This may require in - depth understanding of the syntax and semantics of the two formats.
[0337] Develop conversion functions: Develop corresponding conversion functions for each KiCad encapsulation element to be converted. The function receives the information of the KiCad encapsulation element to be converted as input and outputs the target element information in line with the PADS format.
[0338] Convert element by element: Traverse the encapsulation elements to be converted extracted from the KiCad file, and call the corresponding conversion function according to their types to generate target elements in the PADS format.
[0339] Advantages:
[0340] Precise control: The conversion process of each element can be precisely controlled to ensure the accuracy of conversion.
[0341] Easy to maintain: When the PADS format changes, only the corresponding conversion function needs to be updated.
[0342] Strong scalability: Support for new KiCad element types can be easily added.
[0343] Applicable scenarios: When fine control of the conversion process is required and the PADS format is relatively stable.
[0344] 2. Method based on intermediate data model:
[0345] Implementation method:
[0346] Define the intermediate data model: Design an intermediate data model independent of the specific EDA software format to represent various package information of components.
[0347] Convert to the intermediate model: Convert the package elements to be converted extracted from the KiCad file into this intermediate data model.
[0348] Convert from the intermediate model to the PADS format: Convert the information in the intermediate data model into target elements that conform to the PADS format.
[0349] Advantages:
[0350] Good decoupling: Separate the conversion logics of the KiCad format and the PADS format, improving the code reusability and maintainability.
[0351] Support for multiple formats: If more EDA software formats need to be supported, only the conversion with the intermediate data model needs to be implemented.
[0352] Applicable scenarios: When conversions between multiple EDA software formats need to be supported.
[0353] 3. Method based on code generation:
[0354] Implementation method:
[0355] Define the template: Create a template for the PADS package file fragment, which contains placeholders for filling in the information converted from the KiCad package elements to be converted.
[0356] Generate the code: Fill in the placeholders in the template according to the information converted from the KiCad package elements to be converted, and generate a complete description of the target elements in the PADS format.
[0357] Advantages:
[0358] Clear structure: The structure of the PADS format can be clearly seen, which is convenient for understanding and debugging.
[0359] Applicable scenarios: When the structure of the PADS package file is relatively fixed and can be generated using a template.
[0360] 4. Use existing format conversion tools or libraries:
[0361] Implementation method:
[0362] Look for existing pre-created format conversion tools or libraries that may already implement KiCad to PADS or other format conversion capabilities.
[0363] Call the interfaces of these tools or libraries and pass the KiCad package elements to be converted to them for conversion.
[0364] advantage:
[0365] High development efficiency: No need to write conversion code from scratch, which can save development time.
[0366] Proven: Existing tools or libraries have generally been extensively tested and used, and are therefore highly reliable.
[0367] Limited flexibility: The functionality of a tool or library may not fully meet specific needs.
[0368] In an optional embodiment of the present invention, the step of converting the to-be-converted encapsulated element into a target element expressed in the second encapsulation format includes:
[0369] Determine the corresponding relationship between the encapsulated element to be converted and the target element;
[0370] Developing a corresponding conversion function for the packaged element to be converted based on the corresponding relationship;
[0371] Traversing the packaged elements to be converted, and determining the element type of the packaged elements to be converted;
[0372] The encapsulated element to be converted is taken as input, a corresponding conversion function is called according to the element type, and a target element is output.
[0373] Suppose you need to convert a KiCad line segment (fp_line) element.
[0374] 1. Determine the correspondence between the encapsulated element to be converted and the target element:
[0375] KiCad line segment element:
[0376] (fp_line(start x1 y1)(end x2 y2)(layer layer_name)(width line_width))
[0377] It contains the starting coordinates (x1, y1), ending coordinates (x2, y2), layer name layer_name, and line width line_width.
[0378] PADS line segment element:
[0379] SHAPE LINE x1 y1 x2 y2 line_width layer_name
[0380] It contains the starting coordinates x1 y1, ending coordinates x2 y2, line width line_width, and layer name layer_name.
[0381] It can be seen that the fp_line element in KiCad corresponds to the SHAPE LINE element in PADS in expressing line segment information. Such a mapping relationship needs to be established as the corresponding relationship.
[0382] 2. Develop a corresponding conversion function for the encapsulation element to be converted based on the corresponding relationship:
[0383] A function needs to be developed that receives the information of the KiCad line segment element and outputs the text instruction of the PADS line segment element.
[0384]
[0385]
[0386]
[0387] 3. Traverse the encapsulation element to be converted and determine the element type of the encapsulation element to be converted;
[0388] Suppose an encapsulation element to be converted is parsed from a KiCad file, and its type needs to be determined.
[0389] For example, it can be judged by the keyword of the element.
[0390]
[0391] 4. Take the encapsulation element to be converted as the input, call the corresponding conversion function according to the element type, and output the target element.
[0392] Call the corresponding conversion function according to the element type.
[0393]
[0394]
[0395] #Processing of other element types...
[0396] In an alternative embodiment of the present invention, the step of converting the to-be-converted encapsulated element into a target element expressed in the second encapsulation format includes:
[0397] Determine the element type of the to-be-converted encapsulated element, and create a fragment template for the second encapsulation format based on the element type; the fragment template contains placeholders;
[0398] Fill the to-be-converted encapsulated element into the placeholder to generate a target element code fragment for the to-be-converted encapsulated element;
[0399] Combine the code fragments to generate a target element expressed in the second encapsulation format.
[0400] 1. Determine the element type of the to-be-converted encapsulated element, and create a fragment template for the second encapsulation format based on the element type; the fragment template contains placeholders;
[0401] Type of the to-be-converted encapsulated element: KiCad's pad element.
[0402] Corresponding target element in PADS: PADS's pad command.
[0403] Create a fragment template for a PADS pad, containing placeholders:
[0404] PAD{pad_number}{pad_shape}{pad_x}{pad_y}{pad_size_x}{pad_size_y}{pad_layer}{pad_drill}
[0405] {pad_number}: Pad number
[0406] {pad_shape}: Pad shape (e.g., RECT, CIRCLE)
[0407] {pad_x}: X coordinate of the pad center
[0408] {pad_y}: Y coordinate of the pad center
[0409] {pad_size_x}: Pad size in the X direction
[0410] {pad_size_y}: Pad size in the Y direction
[0411] {pad_layer}: Pad layer
[0412] {pad_drill}: Hole diameter (if any)
[0413] 2. Fill the placeholder with the element to be converted, generating a target element code snippet for the element to be converted;
[0414] Assume that a pad element is parsed from a KiCad file:
[0415]
[0416] The information of this KiCad pad needs to be filled into the PADS template.
[0417] Python
[0418] pad_number = kicad_pad['number']
[0419] pad_shape = kicad_pad['shape'].upper() # Convert to the uppercase shape name in PADS
[0420] pad_x = kicad_pad['position']['x']
[0421] pad_y = kicad_pad['position']['y']
[0422] pad_size_x = kicad_pad['size']['x']
[0423] pad_size_y = kicad_pad['size']['y']
[0424] # The pad layer in PADS may need to be mapped, simplified here
[0425] pad_layer = 'TOP'
[0426] # SMD pads usually have no holes
[0427] pad_drill = '0'
[0428] pads_pad_fragment = f"PAD{pad_number}{pad_shape}{pad_x}{pad_y}{pad_size_x}{pad_size_y}{pad_layer}{pad_drill}"
[0429] In this way, a code snippet of the PADS pad is generated:
[0430] PAD 1RECT 1 1 0.8 1.5TOP 0
[0431] 3. Combine the code snippets to generate the target element expressed in the second packaging format.
[0432] If a package contains multiple elements such as pads and lines, corresponding code snippets need to be generated for each element, and then they are combined to form the complete content of the PADS package file.
[0433] For example, a simple PADS package file may have the following structure:
[0434] PCBNEW NETLIST ...
[0436] PAD 1RECT 1 1 0.8 1.5TOP 0
[0437] PAD 2CIRCLE 2 2 0.5 0.5BOTTOM 0.6 ...
[0439] END
[0440] The generated pad code snippet needs to be inserted into the corresponding position of the PADS package file.
[0441] To enable those skilled in the art to better understand the embodiments of the present invention, the following uses an example to illustrate the embodiments of the present invention.
[0442] Refer to Figure 2 , Figure 2 which is a schematic flowchart of a method for generating a package file provided in the embodiments of the present invention;
[0443] (1) A KiCad package file with the extension.KiCad_mod can be imported, and the package attribute content, package label text, package pattern drawing, and package pin definition can be recognized from the first text expression instruction of the KiCad package file.
[0444] (2) From the recognized package attribute content, package label text, package pattern drawing, and package pin definition, all package elements constituting the package pattern are extracted. The package elements include the title definition of the package, package attribute text, package pin definition, coordinates, line type, line width, combination relationship, etc. of the package pattern drawing.
[0445] (3) According to the second text expression instruction (PCB package file expression instruction) of PADS software, all the package elements that make up the package pattern are converted one by one into package elements that conform to the PADS package format, so as to automatically reconstruct the PADS package file (a file with the extension.d) that contains all the original package components.
[0446] A file with the extension.d can refer to the PCB package file format used by PADS software of Mentor Graphics (now Siemens EDA).
[0447] Detailed explanation:
[0448] PADS software: PADS Logic and PADS Layout are very popular PCB design software.
[0449] .d file:.d file is a specific file format used by PADS software to store PCB package information. In PADS, PCB package information (also known as symbol information) is usually stored in files with the extension.d. These files contain information about all the elements that make up the package, such as pads, traces, text, silkscreen, etc., as well as their attributes, dimensions, positions, and electrical characteristics.
[0450] The role of.d files in the PADS design process:
[0451] Package definition: Designers use PADS software to create or import the packages of components, and this package information is saved in.d files.
[0452] Symbol library management:.d files are usually stored in symbol libraries for easy calling and management during the PCB design process.
[0453] PCB layout: During PCB layout, designers will select the required component packages from the symbol library, and PADS software will read the corresponding.d files and load the package information into the design.
[0454] Data exchange:.d files can be used to share package information between different PADS users.
[0455] Comparison with other PCB package formats:
[0456] Different EDA software uses different package file formats. For example, KiCad uses.kicad_mod files, and Altium Designer uses.pcblib or.PcbLib files. Therefore, if you need to share package information between different EDA software, format conversion is required.
[0457] It should be noted that, for the method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the embodiments of the present invention are not limited by the described action sequences, because according to the embodiments of the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily essential for the embodiments of the present invention.
[0458] Referring to Figure 3 , a structural block diagram of a packaging file generation device provided in an embodiment of the present invention is shown, which may specifically include the following modules:
[0459] The first packaging file acquisition module 301 is configured to acquire a first packaging file expressed in a first packaging format;
[0460] The packaging information reading module 302 is configured to read the packaging information of components from the first packaging file;
[0461] The packaging element to be converted determination module 303 is configured to determine the packaging elements to be converted of the components based on the packaging information;
[0462] The second packaging format determination module 304 is configured to determine a target electronic design automation software and a second packaging format for the target electronic design automation software;
[0463] The element conversion module 305 is configured to convert the packaging elements to be converted into target elements expressed in the second packaging format;
[0464] The second packaging file construction module 306 is configured to construct a second packaging file for the target electronic design automation software by using the target elements.
[0465] For the device embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and for the relevant parts, refer to the partial description of the method embodiments.
[0466] In addition, an embodiment of the present invention further provides an electronic device, as Figure 4 shown, including a processor 401, a communication interface 402, a memory 403, and a communication bus 404. Among them, the processor 401, the communication interface 402, and the memory 403 complete mutual communication through the communication bus 404.
[0467] The memory 403 is used to store a computer program;
[0468] The processor 401, when executing the program stored in the memory 403, implements the packaging file generation method described in any one of the above embodiments:
[0469] The communication bus mentioned in the above terminal may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience in representation, only a thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0470] The communication interface is used for communication between the above terminal and other devices.
[0471] The memory may include a Random Access Memory (RAM), or may also include a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located far from the aforementioned processor.
[0472] The above-mentioned processor may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0473] As Figure 5 shown, in another embodiment provided by the present invention, a computer-readable storage medium 501 is further provided. Instructions are stored in the computer-readable storage medium. When it runs on a computer, it causes the computer to execute the package file generation method described in the above embodiment.
[0474] The embodiments of the present invention have been described above in conjunction with the accompanying drawings. However, the present invention is not limited to the above specific embodiments. The above specific embodiments are merely illustrative and not restrictive. Under the inspiration of the present invention, those of ordinary skill in the art can also make many forms without departing from the purpose of the present invention and the scope protected by the claims, and all of them belong to the protection scope of the present invention.
[0475] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in the embodiments of the present invention can be implemented by electronic hardware, or by a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0476] Those skilled in the art can clearly understand that for the convenience and conciseness of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments, and will not be elaborated herein.
[0477] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of devices or units can be in an electrical, mechanical, or other form.
[0478] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place, or they can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0479] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.
[0480] When the above-mentioned functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical discs that can store program codes.
[0481] As described above, the above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of changes or substitutions, which should all be covered by the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.< / width> < / layer> < / name> < / width> < / layer> < / name> < / width> < / layer> < / name> < / layer> < / name>
Claims
1. A method for generating a packaging file, characterized in that including: obtaining a first encapsulated file expressed in a first encapsulation format; reading the encapsulation information of components from the first encapsulated file; determining the encapsulation elements to be converted of the components based on the encapsulation information; determining a target electronic design automation software and a second encapsulation format for the target electronic design automation software; converting the encapsulation elements to be converted into target elements expressed in the second encapsulation format; constructing a second encapsulated file for the target electronic design automation software using the target elements.
2. The method according to claim 1, wherein The step of reading the encapsulation information of components from the first encapsulated file includes: reading the first encapsulated element sub-information of components from the first encapsulated file based on a lexical analysis and syntax analysis method; reading the second encapsulated element sub-information of components from the first encapsulated file based on a regular expression matching method; reading the third encapsulated element sub-information of components from the first encapsulated file based on a parsing library pre-constructed for the first encapsulated file; determining the encapsulation information using the first encapsulated element sub-information, and / or the second encapsulated element sub-information, and / or the third encapsulated element sub-information.
3. The method according to claim 2, characterized in that, The step of reading the first encapsulated element sub-information of components from the first encapsulated file based on a lexical analysis and syntax analysis method includes: decomposing the text stream of the first encapsulated file into independent lexical units; determining the syntax rules of the first encapsulated file and organizing the lexical units into an abstract syntax tree according to the syntax rules; traversing the abstract syntax tree to extract the first encapsulated element sub-information for expressing components.
4. The method according to claim 2, wherein The step of reading the second encapsulated element sub-information of components from the first encapsulated file based on a regular expression matching method includes: determining the target pattern of the second encapsulated element sub-information in the first encapsulated file; determining the regular expression corresponding to the target pattern; reading the second encapsulated element sub-information of components from the first encapsulated file based on the regular expression.
5. The method according to claim 1, wherein The step of converting the encapsulation elements to be converted into target elements expressed in the second encapsulation format includes: determining the correspondence between the encapsulation elements to be converted and the target elements; developing corresponding conversion functions for the encapsulation elements to be converted based on the correspondence; traversing the encapsulation elements to be converted to determine the element types of the encapsulation elements to be converted; taking the encapsulation elements to be converted as input, calling the corresponding conversion functions according to the element types, and outputting the target elements.
6. The method according to claim 1, characterized in that, The step of converting the encapsulation elements to be converted into target elements expressed in the second encapsulation format includes: determining the element types of the encapsulation elements to be converted and creating a fragment template for the second encapsulation format based on the element types; the fragment template contains placeholders; filling the encapsulation elements to be converted into the placeholders to generate target element code fragments for the encapsulation elements to be converted; combining the code fragments to generate target elements expressed in the second encapsulation format.
7. The method according to claim 1, characterized in that, The encapsulation information includes encapsulation attribute content, encapsulation label text, encapsulation pattern drawing, and encapsulation pin definition.
8. An encapsulation file generation device, characterized in that, Comprising: A first package file acquisition module, configured to acquire a first package file expressed in a first package format; A package information reading module, configured to read the package information of components from the first package file; A package element to be converted determination module, configured to determine the package elements to be converted of the components based on the package information; A second package format determination module, configured to determine a target electronic design automation software and a second package format for the target electronic design automation software; An element conversion module, configured to convert the package elements to be converted into target elements expressed in the second package format; A second package file construction module, configured to construct a second package file for the target electronic design automation software by using the target elements.
9. An electronic device, characterized in that, Comprising a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete communication with each other through the communication bus; The memory is used for storing a computer program; The processor is configured to implement the method according to any one of claims 1-7 when executing the program stored on the memory.
10. A computer-readable storage medium, on which instructions are stored, and when executed by one or more processors, cause the processors to execute the method according to any one of claims 1-7.
Citation Information
Patent Citations
Application program code conversion method and device, electronic equipment and storage medium
CN111708539A
Code conversion processing method and device and client
CN116541037A
PCB design data conversion method and device, equipment and medium
CN117931739A
Method, device and equipment for creating three-dimensional model of electronic component and storage medium
CN119026554A
Electronic design automation in multi-tool design environment
US20230394205A1
Cited By
Symbol file generation method and device, electronic equipment and storage medium
CN120469972A