CN116301775A - Code generation method, device, equipment and medium based on reset tree prototype graph - Google Patents
Code generation method, device, equipment and medium based on reset tree prototype graph Download PDFInfo
- Publication number
- CN116301775A CN116301775A CN202310297062.2A CN202310297062A CN116301775A CN 116301775 A CN116301775 A CN 116301775A CN 202310297062 A CN202310297062 A CN 202310297062A CN 116301775 A CN116301775 A CN 116301775A
- Authority
- CN
- China
- Prior art keywords
- module
- change
- prototype graph
- code
- change module
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/31—Programming languages or programming paradigms
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/34—Graphical or visual programming
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/30—Computing systems specially adapted for manufacturing
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Stored Programmes (AREA)
Abstract
The invention relates to a code generation method based on a reset tree prototype graph, which relates to the technical field of chips, and comprises the following steps: acquiring a change reset tree prototype graph and an original reset tree prototype graph; acquiring a change module which is changed compared with an original reset tree prototype graph in the change reset tree prototype graph and an original module which is consistent compared with the original reset tree prototype graph; acquiring connection information of a change module in a change reset tree prototype graph; acquiring a code template corresponding to the change module, and generating a code segment of the change module according to the connection information of the change module and the code template of the change module; acquiring codes of an original reset tree prototype graph, and extracting code segments of an original module from the codes of the original reset tree prototype graph; code for altering the reset tree prototype graph is generated based on the code segment of the altering module and the code segment of the original module. Therefore, the code for changing the reset tree prototype graph can be automatically generated according to the method, the research and development period is effectively shortened, and the iteration efficiency is improved.
Description
Technical Field
The present invention relates to the field of chip technologies, and in particular, to a method, an apparatus, a device, and a medium for generating codes based on a reset tree prototype graph.
Background
The chip market demand and the application scene have uncertainty, so that the chip specification is continuously changed during the chip design, and the most common specification is changed: newly added IP core (Intellectual Property Core ), newly added reset source, modified reset mode, etc. Frequent changes in reset requirements result in the need for chip design engineers to frequently modify Verilog code and reset tree prototypes for iteration, which can create problems with design, verification inefficiency, and longer development cycles.
Disclosure of Invention
The invention provides a code generation method, a device, equipment and a medium based on a reset tree prototype graph, which are used for solving the problems of low verification efficiency and long research and development period caused by frequently modifying Verilog codes and the reset tree prototype graph.
In a first aspect, the present invention provides a code generation method based on a reset tree prototype graph, the method comprising:
acquiring a change reset tree prototype graph and an original reset tree prototype graph;
Acquiring a change module which is changed compared with the original reset tree prototype graph in the change reset tree prototype graph and an original module which is consistent compared with the original reset tree prototype graph;
acquiring connection information of the change module in the change reset tree prototype graph;
acquiring a code template corresponding to the change module, and generating a code segment of the change module according to the connection information of the change module and the code template of the change module;
acquiring codes of an original reset tree prototype graph, and extracting code segments of the original module from the codes of the original reset tree prototype graph;
and generating codes of the change reset tree prototype graph based on the code segments of the change modules and the code segments of the original modules.
The further technical scheme is that the obtaining a change module which changes compared with the original reset tree prototype graph in the change reset tree prototype graph and an original module which keeps consistent compared with the original reset tree prototype graph includes:
analyzing and acquiring a first module contained in the change reset tree prototype graph, and an input object and an output object of the first module;
Analyzing and acquiring a second module contained in the original reset tree prototype graph, and an input object and an output object of the second module;
judging whether a second module with the same module type, input object and output object as the first module exists in the original reset tree prototype graph or not;
if a second module with the same module type, input object and output object as the first module exists in the original reset tree prototype graph, judging that the first module is the original module;
and if the original reset tree prototype graph does not have a second module with the same module type, input object and output object as the first module, judging that the first module is the change module.
The further technical scheme is that the code segment of the change module is generated according to the connection information of the change module and the code template of the change module, and the method comprises the following steps:
determining input information and output information of the change module according to the connection information of the change module;
and generating a code segment of the change module according to the input information, the output information and the code template of the change module.
The further technical scheme is that the code segment of the change module is generated according to the input information, the output information and the code template of the change module, and the method comprises the following steps:
Determining the input attribute of a code template of the change module according to the input information of the change module;
determining the output attribute of the code template of the change module according to the output information of the change module;
and adding the input attribute and the output attribute into a code template of the change module to obtain a code segment of the change module.
The further technical scheme is that the obtaining the connection information of the change module in the change reset tree prototype graph includes:
and acquiring an input object and an output object of the change module in the change reset tree prototype graph to obtain the connection information of the change module.
The further technical scheme is that the determining the input information and the output information of the changing module according to the connection information of the changing module includes:
acquiring first signal information output by an input object of the change module to the change module as input information of the change module;
and acquiring second signal information output by the changing module to an output object of the changing module as output information of the changing module.
The further technical scheme is that the obtaining the code template corresponding to the changing module comprises the following steps:
Judging whether a code template corresponding to the change module exists in a preset code library or not;
if the code template corresponding to the change module exists in a preset code library, acquiring the code template corresponding to the change module from the code library;
if the code template corresponding to the change module does not exist in the preset code library, the name of the change module is sent to a preset target terminal;
and receiving a code template corresponding to the change module returned by the target terminal.
In a second aspect, the present invention provides a code generating device based on a reset tree prototype graph, which includes a unit for executing the code generating method based on the reset tree prototype graph according to any one of the embodiments of the first aspect.
In a third aspect, an embodiment of the present invention further provides a computer device, including a memory and a processor, where the memory stores a computer program, and the processor implements the method according to any one of the embodiments of the first aspect when executing the computer program.
In a fourth aspect, an embodiment of the present invention further provides a computer readable storage medium, on which a computer program is stored, the computer program implementing the steps of the code generation method based on a reset tree prototype graph according to any one of the embodiments of the first aspect when being executed by a processor.
Compared with the prior art, the technical scheme provided by the embodiment of the invention has the following advantages:
according to the method provided by the embodiment of the invention, the code templates of the modules of the reset tree prototype graph are written in advance, and after the reset tree prototype graph is modified, a modified module which is modified compared with the original reset tree prototype graph in the modified reset tree prototype graph and an original module which is consistent compared with the original reset tree prototype graph are obtained; acquiring connection information of the change module in the change reset tree prototype graph; acquiring a code template corresponding to the change module, and generating a code segment of the change module according to the connection information of the change module and the code template of the change module; acquiring codes of an original reset tree prototype graph, and extracting code segments of the original module from the codes of the original reset tree prototype graph; and generating codes of the change reset tree prototype graph based on the code segments of the change modules and the code segments of the original modules. Therefore, when the requirements change, namely the reset tree prototype graph needs to be updated iteratively, engineers only need to design the layout of each module of the reset tree prototype graph in a targeted manner so as to optimize the chip area and the power consumption and obtain the changed reset tree prototype graph. The code for changing the reset tree prototype graph can be automatically generated according to the method of the invention, thereby effectively shortening the research and development period and improving the iteration efficiency.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the invention or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, and it will be obvious to a person skilled in the art that other drawings can be obtained from these drawings without inventive effort.
FIG. 1 is a schematic flow chart of a code generation method based on a reset tree prototype graph according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a code generating device based on a prototype graph of a reset tree according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be understood that the terms "comprises" and "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in this specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
As used in this specification and the appended claims, the term "if" may be interpreted as "when..once" or "in response to a determination" or "in response to detection" depending on the context. Similarly, the phrase "if a determination" or "if a [ described condition or event ] is detected" may be interpreted in the context of meaning "upon determination" or "in response to determination" or "upon detection of a [ described condition or event ]" or "in response to detection of a [ described condition or event ]".
Fig. 1 is a flow chart of a code generation method based on a reset tree prototype graph according to an embodiment of the present invention. The embodiment of the invention provides a code generation method based on a reset tree prototype graph, and particularly relates to fig. 1, wherein the code generation method based on the reset tree prototype graph comprises the following steps S101-S106.
S101, acquiring a change reset tree prototype graph and an original reset tree prototype graph.
In specific implementation, an engineer analyzes a document design according to requirements, connects a plurality of modules to form a reset tree prototype graph, stores the reset tree prototype graph in a preset storage unit, and obtains the reset tree prototype graph from the preset storage unit by a controller. When the design requirement of the chip changes, engineers need to redraw the reset tree prototype graph of the chip, and correspondingly, the codes of the reset tree prototype graph also need to be updated synchronously.
The original reset tree prototype graph is the reset tree prototype graph before being changed, and the reset tree prototype graph is changed, namely the reset tree prototype graph obtained after improvement is put forward on the basis of the original reset tree prototype graph. The original reset tree prototype is stored in a preset storage unit.
The invention provides a code automatic updating method for changing a reset tree prototype graph, which can effectively shorten the research and development period and improve the efficiency.
S102, acquiring a change module which is changed compared with the original reset tree prototype graph in the change reset tree prototype graph and an original module which is consistent compared with the original reset tree prototype graph.
In specific implementation, analyzing the change reset tree prototype graph to obtain a module contained in the change reset tree prototype graph; and analyzing the original reset tree prototype graph to obtain a module contained in the original reset tree prototype graph. The module which is changed compared with the original reset tree prototype graph in the change reset tree prototype graph, namely a change module, can be obtained by comparing the module which is contained in the change reset tree prototype graph with the module which is contained in the original reset tree prototype graph; and obtaining a module which is consistent with the original reset tree prototype graph in the changed reset tree prototype graph, namely the original module.
It should be noted that, the modules in the reset tree prototype graph may include: at least one of an asynchronous reset synchronous release module, a synchronizer module, a counter module and a standard digital logic gate module. The description of each module is as follows:
the asynchronous reset synchronous release module is not synchronous by a clock signal when a reset signal arrives, but synchronous by the clock signal when the reset signal is released, wherein the input of the asynchronous reset synchronous release module is a reset signal and a clock signal, the output of the asynchronous reset synchronous release module is a reset signal after clock synchronization, and the synchronized reset signal cannot be burred. Asynchronous reset means that after reset signal reset_n is asynchronously reset, reset signal rst_n will be pulled down, i.e. asynchronous reset is realized. When the reset signal reset_n is removed, the reset signal rst_n is not removed along with the removal of the reset signal reset_n due to the double buffer circuit (double register).
And the synchronizer module outputs an input signal after clock synchronization, and the synchronized output signal cannot be subjected to burr. Burrs are typically caused by metastables. Metastable refers to a state in which a flip-flop cannot reach a determinable state within a specified period of time. When a flip-flop enters a metastable state, neither the output level of the cell nor when the output can settle at a correct level can be predicted. During this settling period, the flip-flops output some intermediate level, or may be in an oscillating state, and this unwanted output level may propagate down the cascade of flip-flops on the signal path. In the synchronizer module, the input signals are output after clock synchronization, so that burrs of the output signals can be effectively avoided.
And the counter module counts the input clock pulse, and the counted target value is used as a reset release condition.
The standard digital logic gate module is characterized in that the chip IP can be reset (sw_rst) by register software besides global reset (glb_rst_n), wherein a write-read (WR) signal can be read and written by a register to flexibly control the reset and reset release time; writing 1 clear 0 (W1 AC) signals into 1 reset IP by a register, and after resetting, clearing 0 by the register and automatically releasing the reset; the write 0 and set 1 (W0 AS) signals are written into a reset IP by a register, and after the reset, the register is set 1 and the reset is automatically released.
In one embodiment, the above step S102 includes steps S201-S205:
s201, analyzing and obtaining a first module contained in the change reset tree prototype graph, and an input object and an output object of the first module.
In the embodiment of the invention, in order to facilitate distinguishing, the module included in the change reset tree prototype graph is defined as the first module. Meanwhile, an input object and an output object of the first module are acquired. Specifically, the first module includes an input interface and an output interface, and an object connected with the input interface of the first module is an input object of the first module. It will be appreciated that the input object of the first module is the other first module of the change-over-reset tree prototype graph, or the input object of the first module is a device external to the change-over-reset tree prototype graph (i.e., the external device outputs a signal to the first module of the change-over-reset tree prototype graph).
Further, the object connected with the output interface of the first module is the output object of the first module. It will be appreciated that the output object of the first module is another first module that alters the tree-prototype graph, or the output object of the first module is a device external to the tree-prototype graph (i.e., the first module that alters the tree-prototype graph outputs a signal to an external device).
S202, analyzing and obtaining a second module contained in the original reset tree prototype graph, and an input object and an output object of the second module.
In the embodiment of the invention, in order to facilitate distinguishing, the module contained in the original reset tree prototype graph is defined as the second module. Meanwhile, an input object and an output object of the second module are acquired. Specifically, the second module includes an input interface and an output interface, and an object connected with the input interface of the second module is an input object of the second module. It will be appreciated that the input object of the second module is the other second module of the original reset tree prototype graph, or the input object of the second module is a device external to the original reset tree prototype graph (i.e., the external device outputs a signal to the second module of the original reset tree prototype graph).
Further, the object connected with the output interface of the second module is the output object of the second module. It will be appreciated that the output object of the second module is the other second module of the original reset tree prototype graph, or the output object of the second module is a device external to the original reset tree prototype graph (i.e., the second module of the original reset tree prototype graph outputs a signal to an external device).
Or in an embodiment, the second module contained in the original reset tree prototype graph, and the input object and the output object of the second module are read from preset storage positions. In the embodiment of the invention, the original reset tree prototype graph can be changed from other reset tree prototype graphs. For example, in one embodiment, the reset tree prototype graph has a total of three versions, where the second version of the reset tree prototype graph is a modified reset tree prototype graph of the first version of the reset tree prototype graph, while the second version of the reset tree prototype graph is also the original reset tree prototype graph of the third version of the reset tree prototype graph. When the codes of the original reset tree prototype graph are generated, the original reset tree prototype graph is analyzed, and a second module contained in the original reset tree prototype graph, and an input object and an output object of the second module are obtained. And storing a second module contained in the original reset tree prototype graph and an input object and an output object of the second module into a preset storage position so as to be convenient for being directly read from the preset storage position without repeatedly analyzing the original reset tree prototype graph.
And S203, judging whether a second module with the same module type, input object and output object as the first module exists in the original reset tree prototype graph.
In specific implementation, for each first module in the change reset tree prototype graph, whether a second module with the same module type, input object and output object as the first module exists in the original reset tree prototype graph is judged. It will be appreciated that if the module type, input object, and output object of the first module are the same as those of the second module, then the first module is determined to be the same as the second module.
And S204, if a second module with the same module type, input object and output object as the first module exists in the original reset tree prototype graph, judging that the first module is the original module.
In specific implementation, if there is a second module in the initial reset tree prototype graph, where the module type, the input object and the output object are the same as the first module, it is determined that the first module is unchanged, that is, the first module is an original module.
And S205, if a second module with the same module type, input object and output object as the first module does not exist in the original reset tree prototype graph, judging that the first module is the change module.
In specific implementation, if there is no second module in the initial reset tree prototype, where the module type, the input object and the output object are the same as the first module, it is determined that the first module is changed, that is, the first module is a changed module.
Based on the judging mode, the change module in the change reset tree prototype graph can be rapidly and accurately determined, and in the subsequent step, only the code of the change module is required to be obtained, so that the code generation efficiency is greatly improved, and meanwhile, the calculated amount is smaller.
S103, obtaining connection information of the change module in the change reset tree prototype graph.
In a specific implementation, determining the connection information of the change module refers to determining what the input object and the output object of the change module are respectively. Therefore, the input object and the output object of the change module in the change-reset tree prototype graph are acquired, and the connection information of the change module is obtained. In a specific implementation, the change module includes an input interface and an output interface, and an object connected with the input interface of the change module is an input object of the change module. It will be appreciated that the input object of the change module is another change module that changes the reset tree prototype graph, or the input object of the change module is a device external to the change reset tree prototype graph (i.e., the external device outputs a signal to the change module that changes the reset tree prototype graph).
Further, the object connected with the output interface of the change module is the output object of the change module. It will be understood that the output object of the change module is another change module for changing the reset tree prototype graph, or the output object of the change module is a device outside the change reset tree prototype graph (i.e., the change module for changing the reset tree prototype graph outputs a signal to the external device).
For example, in one embodiment, the changing module is module a, and the module b is connected to the input interface of module a, and then the module b is the input object of module a. And the module c is connected with the output interface of the module a, and is an output object of the module a.
S104, acquiring a code template corresponding to the change module, and generating a code segment of the change module according to the connection information of the change module and the code template of the change module.
In particular implementations, code templates corresponding to modules of the reset tree prototype graph are typically compiled using Verilog language. Code templates for each type of module are typically pre-written by one skilled in the art and pre-stored in a pre-built code library. The code template is reserved with an input attribute filling position and an output attribute filling position. And determining the input attribute of the change module and the output attribute of the change module based on the connection information of the change module, and respectively filling the input attribute of the change module and the output attribute of the change module into the input attribute filling position and the output attribute filling position in the code template to obtain the code segment of the change module.
In one embodiment, the above steps generate a code segment of the change module according to the connection information of the change module and the code template of the change module, and include the following steps: S301-S302.
S301, determining input information and output information of the change module according to the connection information of the change module.
In a specific implementation, the connection information of the change module includes an input object and an output object of the change module. In specific implementation, the change module comprises an input interface and an output interface, and an object connected with the input interface of the change module is an input object of the change module; the object connected with the output interface of the change module is the output object of the change module. After determining an input object and an output object of a change module, acquiring first signal information output by the input object of the change module to the change module as input information of the change module; and acquiring second signal information output by the changing module to an output object of the changing module as output information of the changing module. The first signal information may specifically include an input signal name. The second signal information may specifically include an output signal name.
S302, generating a code segment of the change module according to the input information, the output information and the code template of the change module.
In a specific implementation, the input information is first signal information output to the changing module by the input object of the changing module. The output information is second signal information output by the changing module to an output object of the changing module. The input attribute of the change module is determined based on the first signal information, and the output attribute of the change module is determined based on the second signal information. And respectively filling the input attribute of the change module and the output attribute of the change module into the input attribute filling position and the output attribute filling position in the code template to obtain the code segment of the change module.
In one embodiment, the step S302 specifically includes: determining the input attribute of a code template of the change module according to the input information of the change module; determining the output attribute of the code template of the change module according to the output information of the change module; and adding the input attribute and the output attribute into a code template of the change module to obtain a code segment of the change module.
In a specific implementation, the input information is first signal information output to the changing module by the input object of the changing module. The output information is second signal information output by the changing module to an output object of the changing module. The first signal information includes an input signal name. The second signal information includes an output signal name. And taking the name of the input signal as the input attribute of the code template of the change module. And taking the output signal name as the output attribute of the code template of the change module. The code template is reserved with an input attribute filling position and an output attribute filling position. And respectively adding the input signal name and the output signal name to an input attribute filling position and an output attribute filling position in a code template of the change module to obtain a code segment of the change module.
In an embodiment, the step of obtaining the code template corresponding to the change module includes the following steps: S401-S404
S401, judging whether a code template corresponding to the change module exists in a preset code library.
In specific implementation, codes of the various types of modules are written in advance by a person skilled in the art, and the codes of the various types of modules are stored in a preset code library. Therefore, firstly, whether the code template corresponding to the change module exists in the code library is judged, and if the code template corresponding to the change module exists in the code library, the code template corresponding to the change module can be directly obtained from the code library, so that the obtaining efficiency is improved.
S402, if a code template corresponding to the changing module exists in a preset code library, acquiring the code template corresponding to the changing module from the code library.
In a specific implementation, if a code template corresponding to the change module exists in a preset code library, the code template corresponding to the change module is obtained from the code library, and the code template can be used for generating codes of a change reset tree prototype graph in a subsequent step.
S403, if the code template corresponding to the change module does not exist in the preset code library, the name of the change module is sent to a preset target terminal.
In specific implementation, if the code template corresponding to the change module does not exist in the preset code library, the code template of the change module is not recorded in the code library, at this time, the name of the change module is sent to a preset target terminal, an engineer writes the code template of the change module, and the code template corresponding to the change module is input through the target terminal.
S404, receiving a code template corresponding to the change module returned by the target terminal.
In specific implementation, the code template corresponding to the change module returned by the target terminal is received, and the code template corresponding to the change module is stored in the code library, so that the code template corresponding to the change module can be directly obtained from the code block later.
S105, acquiring codes of an original reset tree prototype graph, and extracting code segments of the original module from the codes of the original reset tree prototype graph.
In particular embodiments, the code of the original reset tree prototype graph is comprised of code segments of modules comprised by the original reset tree prototype graph. The original reset tree prototype graph includes the original module. Thus, the code segments of the original module can be extracted directly from the code of the original reset tree prototype graph.
S106, generating codes of the change reset tree prototype graph based on the code segments of the change module and the code segments of the original module.
In specific implementation, the code of the change reset tree prototype graph is formed by combining the code segment of the change module and the code segment of the original module.
Compared with the prior art, the technical scheme provided by the embodiment of the invention has the following advantages:
according to the method provided by the embodiment of the invention, the code templates of the modules of the reset tree prototype graph are written in advance, and after the reset tree prototype graph is modified, a modified module which is modified compared with the original reset tree prototype graph in the modified reset tree prototype graph and an original module which is consistent compared with the original reset tree prototype graph are obtained; acquiring connection information of the change module in the change reset tree prototype graph; acquiring a code template corresponding to the change module, and generating a code segment of the change module according to the connection information of the change module and the code template of the change module; acquiring codes of an original reset tree prototype graph, and extracting code segments of the original module from the codes of the original reset tree prototype graph; and generating codes of the change reset tree prototype graph based on the code segments of the change modules and the code segments of the original modules. Therefore, when the requirements change, namely the reset tree prototype graph needs to be updated iteratively, engineers only need to design the layout of each module of the reset tree prototype graph in a targeted manner so as to optimize the chip area and the power consumption and obtain the changed reset tree prototype graph. The code for changing the reset tree prototype graph can be automatically generated according to the method of the invention, thereby effectively shortening the research and development period and improving the iteration efficiency.
Example 2
Referring to fig. 2, the embodiment of the present invention further provides a code generating apparatus 600 based on a reset tree prototype graph, where the code generating apparatus based on the reset tree prototype graph includes:
a first obtaining unit 31 for obtaining a change reset tree prototype graph and an original reset tree prototype graph;
a second obtaining unit 32, configured to obtain a change module in the change reset tree prototype graph that is changed compared to the original reset tree prototype graph and an original module that is consistent compared to the original reset tree prototype graph;
a third obtaining unit 33, configured to obtain connection information of the change module in the change-reset tree prototype graph;
a first generating unit 34, configured to obtain a code template corresponding to the changing module, and generate a code segment of the changing module according to the connection information of the changing module and the code template of the changing module;
an extracting unit 35, configured to obtain a code of an original reset tree prototype, and extract a code segment of the original module from the code of the original reset tree prototype;
a second generating unit 36, configured to generate a code of the change reset tree prototype graph based on the code segment of the change module and the code segment of the original module.
In an embodiment, the obtaining the change module of the change reset tree prototype graph that changes compared to the original reset tree prototype graph and the original module that keeps consistent compared to the original reset tree prototype graph includes:
analyzing and acquiring a first module contained in the change reset tree prototype graph, and an input object and an output object of the first module;
analyzing and acquiring a second module contained in the original reset tree prototype graph, and an input object and an output object of the second module;
judging whether a second module with the same module type, input object and output object as the first module exists in the original reset tree prototype graph or not;
if a second module with the same module type, input object and output object as the first module exists in the original reset tree prototype graph, judging that the first module is the original module;
and if the original reset tree prototype graph does not have a second module with the same module type, input object and output object as the first module, judging that the first module is the change module.
In an embodiment, the generating the code segment of the change module according to the connection information of the change module and the code template of the change module includes:
Determining input information and output information of the change module according to the connection information of the change module;
and generating a code segment of the change module according to the input information, the output information and the code template of the change module.
In one embodiment, the generating the code segment of the change module according to the input information, the output information and the code template of the change module includes:
determining the input attribute of a code template of the change module according to the input information of the change module;
determining the output attribute of the code template of the change module according to the output information of the change module;
and adding the input attribute and the output attribute into a code template of the change module to obtain a code segment of the change module.
In an embodiment, the obtaining the connection information of the change module in the change-reset tree prototype graph includes:
and acquiring an input object and an output object of the change module in the change reset tree prototype graph to obtain the connection information of the change module.
In an embodiment, the determining the input information and the output information of the change module according to the connection information of the change module includes:
Acquiring first signal information output by an input object of the change module to the change module as input information of the change module;
and acquiring second signal information output by the changing module to an output object of the changing module as output information of the changing module.
In an embodiment, the obtaining the code template corresponding to the change module includes:
judging whether a code template corresponding to the change module exists in a preset code library or not;
if the code template corresponding to the change module exists in a preset code library, acquiring the code template corresponding to the change module from the code library;
if the code template corresponding to the change module does not exist in the preset code library, the name of the change module is sent to a preset target terminal;
and receiving a code template corresponding to the change module returned by the target terminal.
As shown in fig. 3, fig. 3 is a schematic block diagram of a computer device according to an embodiment of the present invention. The computer device 500 may be a terminal or a server, where the terminal may be a computer device with a communication function, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant, and a wearable device. The server may be an independent server or a server cluster formed by a plurality of servers.
The computer device 500 includes a processor 502, a memory, and a network interface 505, connected by a system bus 501, where the memory may include a non-volatile storage medium 503 and an internal memory 504.
The non-volatile storage medium 503 may store an operating system 5031 and a computer program 5032. The computer program 5032, when executed, causes the processor 502 to perform a method of generating code based on a reset tree prototype graph as provided by the above method embodiments.
The processor 502 is used to provide computing and control capabilities to support the operation of the overall computer device 500.
The internal memory 504 provides an environment for the execution of a computer program 5032 in the non-volatile storage medium 503, which computer program 5032, when executed by the processor 502, causes the processor 502 to perform a code generation method based on a reset tree prototype graph provided by the above method embodiment.
The network interface 505 is used for network communication with other devices. It will be appreciated by those skilled in the art that the foregoing structure is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device 500 to which the present inventive arrangements may be implemented, and that a particular computer device 500 may include more or less components than those shown, or may be combined with certain components, or have a different arrangement of components.
Wherein the processor 502 is adapted to run a computer program 5032 stored in a memory.
It should be appreciated that in an embodiment of the invention, the processor 502 may be a central processing unit (Central Processing Unit, CPU), the processor 502 may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSPs), application specific integrated circuits (Application Specific Integrated Circuit, ASICs), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. Wherein the general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Those skilled in the art will appreciate that all or part of the flow in a method embodying the above described embodiments may be accomplished by computer programs instructing the relevant hardware. The computer program may be stored in a storage medium that is a computer readable storage medium. The computer program is executed by at least one processor in the computer system to implement the flow steps of the embodiments of the method described above.
Accordingly, the present invention also provides a storage medium. The storage medium may be a computer readable storage medium. The storage medium stores a computer program. The computer program, when executed by a processor, causes the processor to execute a code generation method based on a reset tree prototype graph provided by the above method embodiment.
The storage medium is a physical, non-transitory storage medium, and may be, for example, a U-disk, a removable hard disk, a Read-Only Memory (ROM), a magnetic disk, or an optical disk. The computer readable storage medium may be nonvolatile or may be volatile.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps described in connection with the embodiments disclosed herein may be embodied in electronic hardware, in computer software, or in a combination of the two, and that the elements and steps of the examples have been generally described in terms of function in the foregoing description to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the several embodiments provided by the present invention, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the device embodiments described above are merely illustrative. For example, the division of each unit is only one logic function division, and there may be another division manner in actual implementation. For example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed.
The steps in the method of the embodiment of the invention can be sequentially adjusted, combined and deleted according to actual needs. The units in the device of the embodiment of the invention can be combined, divided and deleted according to actual needs. In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The integrated unit may be stored in a storage medium if implemented in the form of a software functional unit and sold or used as a stand-alone product. Based on such understanding, the technical solution of the present invention is essentially or a part contributing to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a terminal, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention.
In the foregoing embodiments, the descriptions of the embodiments are focused on, and for those portions of one embodiment that are not described in detail, reference may be made to the related descriptions of other embodiments.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present invention without departing from the spirit or scope of the invention. Thus, it is intended that the present invention also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.
While the invention has been described with reference to certain preferred embodiments, it will be understood by those skilled in the art that various changes and substitutions of equivalents may be made and equivalents will be apparent to those skilled in the art without departing from the scope of the invention. Therefore, the protection scope of the invention is subject to the protection scope of the claims.
Claims (10)
1. A method for generating codes based on a reset tree prototype graph, the method comprising:
acquiring a change reset tree prototype graph and an original reset tree prototype graph;
acquiring a change module which is changed compared with the original reset tree prototype graph in the change reset tree prototype graph and an original module which is consistent compared with the original reset tree prototype graph;
Acquiring connection information of the change module in the change reset tree prototype graph;
acquiring a code template corresponding to the change module, and generating a code segment of the change module according to the connection information of the change module and the code template of the change module;
acquiring codes of an original reset tree prototype graph, and extracting code segments of the original module from the codes of the original reset tree prototype graph;
and generating codes of the change reset tree prototype graph based on the code segments of the change modules and the code segments of the original modules.
2. The method of claim 1, wherein the obtaining the change module in the change-reset tree prototype graph that changes compared to the original reset tree prototype graph and the original module that remains consistent compared to the original reset tree prototype graph comprises:
analyzing and acquiring a first module contained in the change reset tree prototype graph, and an input object and an output object of the first module;
analyzing and acquiring a second module contained in the original reset tree prototype graph, and an input object and an output object of the second module;
judging whether a second module with the same module type, input object and output object as the first module exists in the original reset tree prototype graph or not;
If a second module with the same module type, input object and output object as the first module exists in the original reset tree prototype graph, judging that the first module is the original module;
and if the original reset tree prototype graph does not have a second module with the same module type, input object and output object as the first module, judging that the first module is the change module.
3. The method of claim 1, wherein the generating the code segment of the change module from the connection information of the change module and the code template of the change module comprises:
determining input information and output information of the change module according to the connection information of the change module;
and generating a code segment of the change module according to the input information, the output information and the code template of the change module.
4. The method of claim 3, wherein the generating the code segment of the change module from the input information, the output information, and the code template of the change module comprises:
determining the input attribute of a code template of the change module according to the input information of the change module;
Determining the output attribute of the code template of the change module according to the output information of the change module;
and adding the input attribute and the output attribute into a code template of the change module to obtain a code segment of the change module.
5. The method of claim 3, wherein the obtaining connection information of the change module in the change-reset tree prototype graph comprises:
and acquiring an input object and an output object of the change module in the change reset tree prototype graph to obtain the connection information of the change module.
6. The method of claim 5, wherein determining the input information and the output information of the change module according to the connection information of the change module comprises:
acquiring first signal information output by an input object of the change module to the change module as input information of the change module;
and acquiring second signal information output by the changing module to an output object of the changing module as output information of the changing module.
7. The method of claim 1, wherein the obtaining the code template corresponding to the change module comprises:
Judging whether a code template corresponding to the change module exists in a preset code library or not;
if the code template corresponding to the change module exists in a preset code library, acquiring the code template corresponding to the change module from the code library;
if the code template corresponding to the change module does not exist in the preset code library, the name of the change module is sent to a preset target terminal;
and receiving a code template corresponding to the change module returned by the target terminal.
8. A code generating device based on a reset tree prototype graph, comprising means for performing the method according to any of claims 1-7.
9. A computer device, characterized in that it comprises a memory on which a computer program is stored and a processor which, when executing the computer program, implements the method according to any of claims 1-7.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method according to any of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310297062.2A CN116301775A (en) | 2023-03-23 | 2023-03-23 | Code generation method, device, equipment and medium based on reset tree prototype graph |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310297062.2A CN116301775A (en) | 2023-03-23 | 2023-03-23 | Code generation method, device, equipment and medium based on reset tree prototype graph |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116301775A true CN116301775A (en) | 2023-06-23 |
Family
ID=86779579
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310297062.2A Pending CN116301775A (en) | 2023-03-23 | 2023-03-23 | Code generation method, device, equipment and medium based on reset tree prototype graph |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116301775A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117313622A (en) * | 2023-10-27 | 2023-12-29 | 深圳华芯盛软件科技有限公司 | Method, equipment and medium for adjusting module hierarchy in chip design |
-
2023
- 2023-03-23 CN CN202310297062.2A patent/CN116301775A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117313622A (en) * | 2023-10-27 | 2023-12-29 | 深圳华芯盛软件科技有限公司 | Method, equipment and medium for adjusting module hierarchy in chip design |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP6793838B2 (en) | Blockchain-based data processing methods and equipment | |
US20160070844A1 (en) | Selectively reducing graph based analysis pessimism | |
US9633148B2 (en) | Static timing analysis in circuit design | |
US9177096B2 (en) | Timing closure using transistor sizing in standard cells | |
US9569575B2 (en) | Digital circuit design method and associated computer program product | |
US10534883B1 (en) | Local path-based analysis for circuit place and route optimization | |
US10296700B1 (en) | Multimode circuit place and route optimization | |
CN116301775A (en) | Code generation method, device, equipment and medium based on reset tree prototype graph | |
US10534878B1 (en) | Circuit place and route optimization based on path-based timing analysis | |
US8042074B2 (en) | Circuit design device, circuit design program, and circuit design method | |
CN117907812B (en) | Circuit detection method and device, electronic device, storage medium, and program product | |
US9576085B2 (en) | Selective importance sampling | |
US11550978B2 (en) | Circuit design assistance system and computer readable medium | |
CN116933697B (en) | Method and device for converting natural language into hardware description language | |
US8990741B2 (en) | Circuit design support device, circuit design support method and program | |
US10691854B1 (en) | Graph-based timing analysis timing calibration | |
CN106709116B (en) | Method and device for generating RTL (real time language) level IP (Internet protocol) core | |
US8751983B1 (en) | Method for design partitioning at the behavioral circuit design level | |
US12073159B2 (en) | Computing device and method for detecting clock domain crossing violation in design of memory device | |
US11068632B2 (en) | Simulation apparatus, description conversion method and simulation method | |
CN104915352B (en) | A kind of method and apparatus that data correctness is handled under verification MapReduce environment | |
US8726206B1 (en) | Deadlock detection method and related machine readable medium | |
JP4901702B2 (en) | Circuit design method | |
JP6473023B2 (en) | Performance evaluation module and semiconductor integrated circuit incorporating the same | |
US10311188B2 (en) | Circuit design support apparatus, circuit design support method, and computer readable medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |