An automated method of querying circuit code load, electronic device and storage medium
By using an automated method to query circuit code loads, and by matching load drive signal names with specific operators, the problem of low efficiency in circuit load querying is solved, achieving efficient and accurate load information retrieval and circuit problem localization.
Patent Information
- Application Number
- CN202211041069.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-29
- Publication Date
- 2025-12-19
- Estimated Expiration
- 2042-08-29
AI Technical Summary
In large-scale circuit design, manually finding circuit loads is inefficient, time-consuming, and prone to omissions. Existing technologies cannot efficiently and accurately locate circuit loads.
By obtaining the name of the load drive signal, traversing the circuit code file, and using specific operators and matching rules, the load information is automatically found. The automated query is implemented using Python scripts, including line-by-line traversal and regular expression matching.
It improves the efficiency and accuracy of load queries, enabling rapid location of circuit problems and understanding of circuit operation.
Smart Images

Figure CN115391488B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of digital circuit design, in particular to an automatic circuit code load query method, an electronic device and a storage medium. BACKGROUND
[0002] When designing and debugging a circuit, a digital circuit engineer needs to find the load of the circuit in the circuit code, so as to conveniently locate the problem or better understand the working condition of the circuit.
[0003] Currently, when querying the load of the circuit, the engineer manually checks the circuit code. This method depends on electronic design automation tools and needs to spend most of the time on reading the code. In large-scale circuit design or in the case of a large number of loads, the manual load query method is inefficient, time-consuming and prone to omission. SUMMARY
[0004] The purpose of the embodiments of the present application is to provide an automatic circuit code load query method and device, an electronic device and a storage medium, so as to improve the efficiency and accuracy of load query.
[0005] The present application is implemented as follows:
[0006] In a first aspect, the embodiments of the present application provide an automatic circuit code load query method, comprising: obtaining a load drive signal name of a load to be queried; wherein the load to be queried is a circuit code load; traversing a circuit code file to find load information corresponding to the load drive signal name from the circuit code file; and outputting the queried load information.
[0007] In the embodiments of the present application, the load drive signal name of the load to be queried is obtained, and then the circuit code file is traversed to find the load information corresponding to the load drive signal name from the circuit code file. The load information is the load to be queried. It can be seen that, by this method, the corresponding load of the circuit code file can be automatically queried based on the load drive signal name of the load to be queried, thereby improving the efficiency and accuracy of load query.
[0008] With reference to the technical scheme provided in the first aspect above, in some possible implementation manners, the traversing the circuit code file to find the load information corresponding to the load driving signal name comprises: traversing the circuit code file line by line, and when the load driving signal name is found, judging whether there is a specific operator in the line where the load driving signal name is located; the specific operator is used to represent the corresponding relationship between the circuit code load and the load driving signal in the circuit code file; if there is, the load information is determined; and the load information is the circuit code load name corresponding to the line where the circuit code load name is located.
[0009] In the embodiments of the present application, by traversing the circuit code file line by line, when the load driving signal name is found, it is judged whether there is a specific operator in the line where the load driving signal name is located, and in this way, it can be queried in the circuit code whether there is an assignment operation for the load driving signal, and if there is, the load name corresponding to the load driving signal name is directly output, and this information is the load to be queried. It can be seen that by this way, the load to be queried can be effectively detected.
[0010] With reference to the technical scheme provided in the first aspect above, in some possible implementation manners, the specific operator comprises an equal sign, a greater-than-or-equal-to sign or a less-than-or-equal-to sign.
[0011] With reference to the technical scheme provided in the first aspect above, in some possible implementation manners, the traversing the circuit code file to find the load information corresponding to the load driving signal name comprises: executing a first finding script to traverse the circuit code file line by line, and when the load driving signal name is found, judging whether there is a specific operator in the line where the load driving signal name is located; the specific operator is used to represent the corresponding relationship between the circuit code load and the load driving signal in the circuit code file; if there is, the load information is determined; and the load information is the circuit code load name corresponding to the line where the circuit code load name is located.
[0012] In the embodiments of the present application, the circuit code load name can be automatically found by the first finding script configured.
[0013] With reference to the technical scheme provided in the first aspect above, in some possible implementation manners, the traversing the circuit code file and finding the load information corresponding to the load driving signal name from the circuit code file comprises: traversing the circuit code file line by line, and when the load driving signal name is found, performing matching based on a preset matching rule to determine the load information; wherein the matching rule is used to determine whether the load driving signal corresponding to the load driving signal name is an input of a module; and the load information is a module in which the load driving signal name is located.
[0014] In the embodiment of the present application, by traversing the circuit code file line by line, when the load driving signal name is found, matching is performed based on a preset matching rule. If matching is found, it means that the load driving signal is an input of a certain module, and the load of the load driving signal is inside the module. At this time, the determined load information is the module in which the load driving signal name is located. It can be seen that, by this way, the module in which the load to be queried is located can be determined, so as to facilitate subsequent determination of the load to be queried based on the module.
[0015] With reference to the technical scheme provided in the first aspect above, in some possible implementation manners, the matching rule is a rule executed by using a regular expression; and the regular expression is defined as a dot appearing before a character before the load driving signal name to be found.
[0016] In the embodiment of the present application, the matching rule can be accurately defined by using a regular expression, thereby improving the accuracy of the query.
[0017] With reference to the technical scheme provided in the first aspect above, in some possible implementation manners, the traversing the circuit code file and finding the load information corresponding to the load driving signal name from the circuit code file comprises: executing a second finding script to traverse the circuit code file line by line, and when the load driving signal name is found, performing matching based on a preset matching rule to determine the load information; wherein the matching rule is used to determine whether the load driving signal corresponding to the load driving signal name is an input of a module; and the load information is a module in which the load driving signal name is located.
[0018] In the embodiment of the present application, the module in which the load is located can be automatically found by using the configured second finding script.
[0019] With reference to the technical scheme provided in the first aspect above, in some possible implementation manners, the first finding script and the second finding script are scripts written based on a Python (a kind of computer programming language) language.
[0020] In the embodiments of the present application, the first search script and the second search script are written in Python language, which is simple and efficient.
[0021] With reference to the technical solution of the first aspect, in some possible implementation manners, after outputting the queried load information, the method further includes: marking the load information in the circuit code file, so that the load information is highlighted in the circuit code file.
[0022] In the embodiments of the present application, after outputting the queried load information, the load information is marked in the circuit code file, so that subsequent engineers can quickly locate the problem and understand the working condition of the circuit.
[0023] In the second aspect, the embodiments of the present application provide an electronic device, including: a processor and a memory, which are connected; the memory is used to store a program; the processor is used to call the program stored in the memory to execute the method provided in the embodiments of the first aspect and / or some possible implementation manners in combination with the embodiments of the first aspect.
[0024] In the third aspect, the embodiments of the present application provide a computer readable storage medium, which stores a computer program, and the computer program is used to execute the method provided in the embodiments of the first aspect and / or some possible implementation manners in combination with the embodiments of the first aspect when being run by a processor. BRIEF DESCRIPTION OF DRAWINGS
[0025] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments of the present application. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be regarded as a limitation on the scope, and for those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.
[0026] Figure 1 A module block diagram of an electronic device provided in the embodiments of the present application.
[0027] Figure 2 A step flowchart of an automatic circuit code load query method provided in the embodiments of the present application.
[0028] Figure 3 A flowchart of an automatic circuit code load query method provided in the embodiments of the present application.
[0029] Figure 4 A flowchart of an automatic circuit code load query method provided in the embodiments of the present application.
[0030] Icon: 100 - electronic device; 110 - processor; 120 - memory. DETAILED DESCRIPTION
[0031] The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings in the embodiments of the present application.
[0032] Please refer to Figure 1 The present embodiment provides a schematic structural block diagram of an electronic device 100 applying an automatic query circuit code load method. In the present embodiment, the electronic device 100 can be a terminal or a server. The terminal can be, but is not limited to, a personal computer (PC), a smart phone, a tablet computer, a personal digital assistant (PDA), a mobile Internet device (MID), etc. The server can be, but is not limited to, a network server, a database server, a cloud server, or a server integrated by multiple sub-servers, etc. Of course, the above-mentioned devices are only used to facilitate the understanding of the present embodiment, and should not be regarded as a limitation of the present embodiment.
[0033] In structure, the electronic device 100 can include a processor 110 and a memory 120.
[0034] The processor 110 is directly or indirectly electrically connected with the memory 120 to realize the transmission or interaction of data. For example, these elements can be electrically connected through one or more communication buses or signal lines.
[0035] The processor 110 can be an integrated circuit chip with signal processing capability. The processor 110 can also be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor (DSP), an application specific integrated circuit (ASIC), a discrete gate or transistor logic device, a discrete hardware component, which can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present application. In addition, the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0036] The memory 120 can be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), and an electrically erasable programmable read-only memory (EEPROM). The memory 120 is used to store a program, which is executed by the processor 110 upon receiving an execution instruction.
[0037] It should be noted that, Figure 1 The structure shown is only schematic, and the electronic device 100 provided by the embodiments of the present application can also have fewer or more components, or have a different configuration from that shown. Figure 1 In addition, Figure 1 The components shown can be implemented by software, hardware, or a combination thereof. Figure 1
[0038] Please refer to Figure 2 , Figure 2 The step flow chart of the automatic circuit code load query method provided by the embodiments of the present application is applied to the electronic device 100 shown. Figure 1 It should be noted that the automatic circuit code load query method provided by the embodiments of the present application is not limited by the order shown below, and the method comprises steps S101-S103. Figure 2
[0039] Step S101: Obtain the load drive signal name of the load to be queried.
[0040] First, the user can input the load drive signal name of the load to be queried, so that the electronic device obtains the load drive signal name of the load to be queried.
[0041] For example, the load drive signal name includes driver, driver&xxxx, etc., which is not limited by the present application.
[0042] It should be noted that the load referred to by the present application is a circuit code load, i.e., a load in a circuit code file, which is defined as a part of an expression in a text file in the process of front-end design of a digital IC (integrated circuit). The load drive signal is a signal used to drive the load, which can correspond to the driving signal generated by the driving module in the actual circuit.
[0043] Step S102: traversing the circuit code file to find the load information corresponding to the load driving signal name from the circuit code file.
[0044] After the electronic device obtains the load driving signal name of the load to be queried, the electronic device calls the circuit code file and traverses the circuit code file to find the load information corresponding to the load driving signal name from the circuit code file.
[0045] As an implementation, the above query process can specifically include: performing line-by-line traversal in the circuit code file, when the load driving signal name is found, determining whether there is a specific operator in the line where the load driving signal name is located; if there is, determining the load information; and the load information is the circuit code load name corresponding to the line where the circuit code load name is located.
[0046] The specific operator is used to represent the correspondence between the circuit code load and the load driving signal in the circuit code file. In the embodiments of the present application, the specific operator can be, but is not limited to, an equal sign, a greater than or equal to sign, or a less than or equal to sign.
[0047] Specifically, the above query process can specifically be: when the load driving signal name is found in the circuit code file, determining whether there is an equal sign on the left side of the load driving signal name in the line where the load driving signal name is located; if there is, determining the load information; and the load information is the load name on the left side of the equal sign.
[0048] For example, the circuit code file can include the following circuit code:
[0049] always@(*) begin
[0050] load = driver;
[0051] end
[0052] assign load = driver;
[0053] In the above circuit code, driver represents the load driving signal name, and load represents the load name, that is, the determined load information.
[0054] It should be noted that in the embodiments of the present application, the line-by-line traversal is performed in the circuit code file, when the load driving signal name is found, it is determined whether there is an equal sign in the line where the load driving signal name is located, and in this way, it can be determined in the circuit code whether there is an assignment operation for the load driving signal, if there is, the load name corresponding to the load driving signal name is directly output, and this information is the load to be queried. It can be seen that through this way, the load to be queried can be effectively detected.
[0055] In addition, it should be noted that as long as an equal sign is detected to exist on the left side of the load driving signal name in the line, the load name on the left side of the equal sign is determined as the load information. Of course, in the code in other digital circuit designs, the load driving signal can also be defined as the left side of a specific operator, and the circuit code load is defined as the right side of the specific operator, so that when an equal sign is detected to exist on the right side of the load driving signal name in the line, the load name on the right side of the equal sign is determined as the load information.
[0056] As another implementation, the process of the above query can specifically include: performing line-by-line traversal in the circuit code file, when a load driving signal name is found, performing matching based on a preset matching rule to determine the load information; wherein the matching rule is used to determine whether the load driving signal corresponding to the load driving signal name is an input of a module; and the load information is a module in which the load driving signal name is located.
[0057] For example, the circuit code file can include the following circuit code:
[0058] Sub_module u_rst(
[0059] .xxx(abc),
[0060] .xxx(driver), );
[0062] In the above circuit code, driver represents the load driving signal name, and Sub_module represents the module name, i.e., the determined load information.
[0063] In an embodiment, the matching rule is a rule executed by a regular expression. The matching rule can be accurately defined by the regular expression, thereby improving the accuracy of the query.
[0064] In the embodiment of the application, the regular expression is defined as a dot appearing before the character before the load driving signal name to be found.
[0065] Taking the above circuit code as an example, the regular expression can be.xxx(y); wherein y represents any load driving signal name, and x represents any character.
[0066] In other embodiments, different regular expressions can be configured according to different circuit code files. In addition, in other embodiments, the matching rule can also be to directly detect whether the load driving signal name appears a dot, and the application is not limited in this regard.
[0067] To sum up, in the embodiment of the present application, by traversing the circuit code file line by line, when the load driving signal name is found, matching is performed based on the preset matching rule. If matching is found, it means that the load driving signal is the input of a certain module, and the load of the load driving signal is inside the module. At this time, the determined load information is the module in which the load driving signal name is located. If no matching is found, it means that the load driving signal is not the input of a certain module. It can be seen that, by this method, the module in which the load to be queried is located can be determined, so as to facilitate subsequent determination of the load to be queried based on the module.
[0068] In addition, the above-mentioned query process can be implemented based on a script. Specifically, the above-mentioned query process can specifically include: executing a first search script to traverse the circuit code file line by line, and when the load driving signal name is found, judging whether the line where the load driving signal name is located exists a specific operator; wherein the specific operator is used to represent the corresponding relationship between the circuit code load and the load driving signal in the circuit code file; if it exists, the load information is determined; the load information is the circuit code load name corresponding to the line where the circuit code load name is located.
[0069] The above-mentioned query process can also include: executing a second search script to traverse the circuit code file line by line, and when the load driving signal name is found, matching is performed based on a preset matching rule to determine the load information; wherein the matching rule is used to determine whether the load driving signal corresponding to the load driving signal name is the input of a module; the load information is the module in which the load driving signal name is located.
[0070] It can be seen that, in the embodiment of the present application, the first search script and the second search script can be configured to automatically find the load information.
[0071] It should be noted that the above-mentioned first search script and second search script can be configured to be executed simultaneously, or the first search script can be executed first, and then the second search script is executed, or the second search script can be executed first, and then the first search script is executed. The present application does not limit this.
[0072] In an embodiment, the first search script and the second search script are scripts written based on Python language. The first search script and the second search script are written by Python language, which is simple and efficient.
[0073] In other embodiments, the first search script and the second search script can also be scripts written based on Shell, which are not limited by the present application.
[0074] Step S103: output the queried load information.
[0075] After the load information is found, the found load information is output, for example, when the load information is determined by the aforementioned equal sign judgment method, the output is the load name, such as load. When the load information is determined by the matching rule, the output is the module name, such as Sub_module.
[0076] For example, refer to Figure 3 After the load driving signal name of the load to be queried is acquired, the electronic device executes a first finding script to perform line-by-line traversal in the circuit code file. When the load driving signal name is found, it is determined whether there is a specific operator in the line where the load driving signal name is located. If there is, the load information is determined. The load information is the circuit code load name corresponding to the line where the circuit code load name is located, that is, the final output circuit code load name.
[0077] For example, refer to Figure 4 After the load driving signal name of the load to be queried is acquired, the electronic device executes a second finding script to perform line-by-line traversal in the circuit code file. When the load driving signal name is found, it is matched based on a preset matching rule to determine the load information. The load information is the module where the load driving signal name is located, that is, the final output module name.
[0078] In addition, it should be noted that the above steps S101-S103 can also be implemented by a script, for example, a script written in Python language to implement the above steps S101-S103. The present application does not limit this.
[0079] In summary, in the embodiment of the present application, the load driving signal name of the load to be queried is acquired, and then the circuit code file is traversed to find the load information corresponding to the load driving signal name from the circuit code file. The load information is the load to be queried. It can be seen that by this method, the corresponding load in the circuit code file can be automatically queried based on the load driving signal name of the load to be queried, which improves the efficiency and accuracy of load query.
[0080] Optionally, after the load information found in step S103 is output, the method further includes marking the load information in the circuit code file to highlight the load information in the circuit code file.
[0081] The marking method can be to display the load information in the circuit code file in different colors, or to add an underline below the load information. The present application does not limit the marking method.
[0082] In the embodiments of the present application, after the output of the queried load information, the load information is marked in the circuit code file, so that subsequent engineers can quickly locate the problem and understand the working condition of the circuit.
[0083] Based on the same inventive concept, the embodiments of the present application also provide a computer readable storage medium, which stores a computer program, and the computer program performs the method provided in the above embodiments when being executed.
[0084] The storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. integrated with one or more available media sets. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)), etc.
[0085] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division, and there can be another division manner in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some communication interfaces, and can be electrical, mechanical or other forms.
[0086] In addition, the units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e. they can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiments.
[0087] Furthermore, the functional modules in each of the embodiments of the present application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0088] In this document, the relationship terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between the entities or operations.
[0089] The above merely provides an example of the present application, and is not used to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.
Claims
1. An automated method of querying a circuit code load, the method comprising: The method comprises: obtaining a load driving signal name of a to-be-inquired load; wherein the to-be-inquired load is a circuit code load; traversing a circuit code file to find load information corresponding to the load driving signal name from the circuit code file; outputting the inquired load information; wherein the traversing the circuit code file to find the load information corresponding to the load driving signal name comprises: traversing the circuit code file line by line, and when the load driving signal name is found, judging whether there is a specific operator in the line where the load driving signal name is located; wherein the specific operator is used to represent the corresponding relationship between the circuit code load and the load driving signal in the circuit code file; if there is, the load information is determined; the load information is the circuit code load name corresponding to the line where the circuit code load name is located; and / or, traversing the circuit code file line by line, and when the load driving signal name is found, matching based on a preset matching rule to determine the load information; wherein the matching rule is used to determine whether the load driving signal name corresponding to the load driving signal is used as the input of a module; the load information is the module where the load driving signal name is located.
2. The method of claim 1, wherein, The specific operator comprises an equal sign, a greater-than-or-equal-to sign or a less-than-or-equal-to sign.
3. The method of claim 1, wherein, The traversing the circuit code file to find the load information corresponding to the load driving signal name comprises: executing a first finding script to traverse the circuit code file line by line, and when the load driving signal name is found, judging whether there is a specific operator in the line where the load driving signal name is located; wherein the specific operator is used to represent the corresponding relationship between the circuit code load and the load driving signal in the circuit code file; if there is, the load information is determined; the load information is the circuit code load name corresponding to the line where the circuit code load name is located.
4. The method of claim 1, wherein, The matching rule is a rule executed by using a regular expression; the regular expression is defined as a dot before the characters before the found load driving signal name.
5. The method of claim 1, wherein, The traversing the circuit code file to find the load information corresponding to the load driving signal name comprises: executing a second finding script to traverse the circuit code file line by line, and when the load driving signal name is found, matching based on a preset matching rule to determine the load information; wherein the matching rule is used to determine whether the load driving signal name corresponding to the load driving signal is used as the input of a module; the load information is the module where the load driving signal name is located.
6. The method of claim 1, wherein, After the outputting the inquired load information, the method further comprises: marking the load information in the circuit code file to highlight the load information in the circuit code file.
7. An electronic device, comprising: The method comprises: a processor and a memory, the processor and the memory are connected; the memory is used to store a program; The processor is configured to execute a program stored in the memory to perform the method of any of claims 1-6.
8. A computer-readable storage medium, characterized in that, A computer program product having stored thereon a computer program which, when executed by a computer, performs the method of any of claims 1-6.