A method and device for automatic generation of clock network based on Python
Through the automatic generation method of clock network based on Python, Excel files are used to automatically generate the key components of the clock network, which solves the problems of high clock network generation complexity and insufficient flexibility in the existing technology, and achieves efficient and accurate clock network design. and maintenance.
Patent Information
- Application Number
- CN202410840502.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2044-06-27
AI Technical Summary
Existing clock network generation methods rely on complex development tools, have high learning costs, lack of flexibility, and manual verification is cumbersome, time-consuming and error-prone, making it difficult to achieve efficient automatic generation of clock networks.
Adopt an automatic generation method based on Python to obtain target information through Excel files, automatically generate instantiation files, constraint files and header files, generate clock processing flow charts, reduce manual writing and configuration workload, improve development efficiency, and through modularization and The hierarchical design makes the clock network clearer and easier to manage.
It significantly improves development efficiency, reduces error rates, simplifies clock network design and maintenance, provides intuitive visualization effects, reduces user professional skill requirements, and supports flexible function adjustment and expansion.
Smart Images

Figure CN118394176B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of software development, and in particular to a method, system, electronic device and storage medium for automatic generation of a clock network based on Python. Background Art
[0002] Clock networks are an integral part of electronic systems, ensuring that components operate synchronously at precise points in time.
[0003] Existing clock network generation methods usually rely on complex development tools, which are powerful but have high learning costs and lack flexibility for specific needs. In addition, the clock networks generated by these tools often require tedious manual verification to ensure their correctness and reliability. As system complexity increases, manually creating and verifying clock networks becomes time-consuming and error-prone.
[0004] Therefore, how to realize the automatic generation of clock networks has become a problem that needs to be solved urgently. Summary of the invention
[0005] The present application provides a method and device for automatic generation of a clock network based on Python, which greatly reduces the workload of manual writing and configuration and significantly improves development efficiency.
[0006] In a first aspect of the present application, a method for automatically generating a clock network based on Python is provided, which is applied to a clock network generation platform. The method comprises:
[0007] In response to an operation of a user inputting an Excel file, acquiring target information from the Excel file, the target information including a clock type, a source clock, and a processing unit;
[0008] Generate an instantiation file, a constraint file and a header file according to the target information through a first preset script, wherein the instantiation file includes the instantiation, connection relationship and control logic of the clock module, the constraint file is used to constrain the timing behavior of the clock, and the header file includes macro definitions and constants for controlling the clock processing unit;
[0009] Generate a clock processing flowchart according to the target information through a second preset script, and save the clock processing flowchart as a picture file or insert it into a target form of the Excel file;
[0010] A clock network is generated according to the instantiation file, the constraint file, the header file and the clock processing flow chart.
[0011] By adopting the above technical solution, the target information is automatically read from the Excel file, and the instantiation file, constraint file, header file and clock processing flowchart are generated accordingly, which greatly reduces the workload of manual writing and configuration and significantly improves the development efficiency. Since the entire process is automated, errors introduced by human factors are reduced. For example, when writing instantiation files, constraint files and header files, it is easy to make mistakes due to negligence or fatigue, and the automated script can ensure that the code generated each time is based on the same logic and template, reducing the error rate. The generated instantiation files, constraint files, header files and clock processing flowcharts are all based on a unified template and logic, which makes subsequent maintenance and expansion relatively easy. If you need to modify or add new functions, you only need to modify the corresponding template or logic. The generated clock processing flowchart can be directly saved as an image file or inserted into an Excel file, providing an intuitive visualization effect. This helps developers better understand the structure and working principle of the clock network, so as to better carry out subsequent development and debugging work. Since the entire process is implemented based on Python scripts, it has strong flexibility. Different functions and requirements can be achieved by modifying Python scripts according to specific needs and scenarios. Users only need to provide an Excel file containing target information to automatically generate the required files and flow charts, without the need for in-depth understanding of the complex clock network design and generation process, reducing the professional skills requirements for users.
[0012] Optionally, the generating the instantiation file, the constraint file and the header file according to the target information by using the first preset script includes:
[0013] Parsing clock information under each form from the target information, the clock information including the name of each clock and the associated processing unit;
[0014] Creating a corresponding single clock instantiation file for each clock according to the clock information;
[0015] Create a form instantiation file to call all individual clock instantiation files under the target form;
[0016] Create a top-level instantiation file to call all form instantiation files.
[0017] By adopting the above technical solution, a corresponding single clock instantiation file is created for each clock, and the modular design of the clock module is realized. This makes the design of the clock network clearer, easier to manage and maintain. The modular design also allows independent testing and optimization of a single clock module, improving development efficiency. A form instantiation file is created to call all the single clock instantiation files under the target form, and a top-level instantiation file is created to call all the form instantiation files, forming a hierarchical clock network structure. This hierarchical structure makes the organization of the clock network more orderly and easy to understand and analyze. At the same time, it also provides a basis for subsequent clock tree balancing, timing analysis and other work. The entire instantiation file generation process is automated. The user only needs to provide an Excel file containing clock information, and the script can automatically parse and generate the required files. Due to the flexibility of the script, the format and content of the generated instantiation file can be adjusted as needed to adapt to different hardware description languages (HDL) or design tools. The generated single clock instantiation file can be called by multiple form instantiation files or top-level instantiation files, realizing code reuse. This not only reduces the workload of repeated code writing, but also improves the consistency and maintainability of the code. This method can be easily used for clock network designs that contain multiple forms (such as different processing units or functional modules). By creating a separate form instantiation file for each form, the clock connection relationship between different forms can be clearly represented. Automatic generation of instantiation files reduces the workload of manual writing and configuration, thereby improving development efficiency. The hierarchical and modular design makes the design of the clock network more intuitive and easy to understand, further accelerating the development progress.
[0018] Optionally, the generating the instantiation file, the constraint file and the header file according to the target information by using the first preset script includes:
[0019] Acquire register data from the target information, wherein the register data includes register type, bit width, and read and write permissions;
[0020] Classify the data according to the type of register, calculate the number of registers of each type, and store the calculation results in the corresponding data structure;
[0021] A new Excel file is created using the same library as the Excel file, a table structure of the new Excel file is determined, and data in the data structure are filled into corresponding cells of the new Excel file.
[0022] By adopting the above technical solutions, the script automatically obtains register data from the original Excel file, avoiding errors that may be introduced by manual input and ensuring data accuracy. The automated processing ensures data consistency because all register data is processed based on the same logic and rules. The script can classify data according to the type of register and calculate the number of registers of each type. This helps designers better understand the distribution of register usage and provide a basis for subsequent optimization or adjustment. Using the same library as the original Excel file to create a new Excel file ensures that the new file is highly consistent with the original file in format and compatibility. Automatically filling data into the corresponding cells of the new Excel file greatly improves work efficiency and reduces duplication of work. The generated new Excel file presents register data in a clear structure and format, making data management and maintenance simpler and more intuitive. Since the data is automatically generated based on the script, when the original data changes, you only need to rerun the script to update the new Excel file without manual modification. The modular design of the script allows expansion and customization according to needs. For example, new register types can be added or the classification logic can be modified to meet different project needs. The flexibility of the script is also reflected in its ability to process Excel files of different structures and formats, which increases its scope of application. The generated new Excel file can be used as input data for subsequent analysis and processing, such as timing analysis, power consumption estimation, etc. Since the data has been classified and counted, these subsequent tasks will be more efficient and accurate.
[0023] Optionally, the generating the instantiation file, the constraint file and the header file according to the target information by using the first preset script includes:
[0024] The clock information is obtained from the target information, and corresponding timing constraints are generated according to the clock information. The clock information includes the name, frequency, phase offset information of the clock and the processing units through which the clock passes. The timing constraints include the period, duty cycle and phase relationship of the clock.
[0025] By adopting the above technical solution, the script automatically extracts the name, frequency, phase offset information of the clock and the processing unit through which the clock passes from the target information, ensuring the accuracy of the clock network design. The generated timing constraints include key parameters such as the clock period, duty cycle, and phase relationship, which are essential to ensure the correct operation of the clock network. Automatic generation of timing constraints greatly reduces the workload of manual writing and configuration and improves design efficiency. The script can quickly generate timing constraints according to preset rules and templates, avoiding duplication of work and possible errors. By accurately analyzing the clock information, the generated timing constraints can guide the design and optimization of the clock network to ensure that the clock signal can meet the performance requirements of the system. For example, the layout and branches of the clock tree can be adjusted according to the frequency and phase relationship of the clock to reduce clock delay and jitter and improve the stability and reliability of the clock signal. If the target information contains information about multiple clocks, the script can generate corresponding timing constraints for each clock and support interaction and synchronization between different clock domains. This helps to handle complex clock network designs and ensure that multi-clock domain systems can work properly. The generated timing constraints can be used as input data for subsequent analysis and verification, such as timing analysis, power analysis, reliability analysis, etc. The flexibility of the script allows the timing constraints to be adjusted and optimized according to actual needs. If you need to modify clock parameters or add new clock domains, just update the target information and rerun the script to generate new timing constraints.
[0026] Optionally, the generating the instantiation file, the constraint file and the header file according to the target information by using the first preset script includes:
[0027] Allocate a base address to each processing unit in each clock domain, and for a target register of each processing unit, combine the base address with a relative address of the target register in the unit to form an offset address of the target register;
[0028] A header file is generated using the offset address, wherein the header file includes a macro definition, an enumeration or a structure.
[0029] By adopting the above technical solution, the address information of the register is encapsulated using macro definitions, enumerations or structures, making the code clearer and easier to understand. When the register address needs to be modified or extended, only the relevant definitions in the header file need to be modified, without having to modify them one by one in multiple codes, which improves the maintainability of the code. Automatically generating header files reduces the workload of manual writing and configuration, and developers can focus more on the implementation of core functions. Since the address information has been automatically calculated and encapsulated in the header file by the script, developers can directly use these definitions to access and operate registers without manually calculating the address or performing tedious bit operations. Automatically generating address information reduces errors caused by manual calculations or input errors. Encapsulating address information using macro definitions, enumerations or structures ensures that these addresses are consistently referenced in the code, reducing program crashes or data errors caused by reference errors. Through macro definitions, enumerations or structures in header files, hardware addresses can be abstracted. In this way, the software code can focus more on the implementation of the function without paying too much attention to the specific hardware address. When the hardware design changes, only the relevant definitions in the header file need to be modified to adapt to the new hardware design without modifying the software code. Since the address information is automatically generated by the script, the same software code can be easily ported to different hardware platforms. When you need to expand new functions or processing units, just add the corresponding register information in the target information and rerun the script to generate a new header file and related address information. For multi-clock domain design, each processing unit under each clock domain has an independent base address. By using the offset address and the definition in the header file, you can easily access and manage the registers under different clock domains.
[0030] Optionally, the generating a clock processing flowchart according to the target information by using a second preset script includes:
[0031] The clock, processing unit and the logical relationship between the clock and the processing unit are obtained from the target information, the nodes of the clock processing flowchart are constructed through the clock and the processing unit, and the edges of the processing flowchart are constructed through the logical relationship, and the clock processing flowchart is generated according to the nodes and edges through the graphics library.
[0032] By adopting the above technical solutions, the generated clock processing flowchart graphically and intuitively shows how the clock signal flows through different processing units in the system, as well as the dependencies and timing relationships between them. This greatly enhances the readability and understandability of the design. The process of automatically generating flowcharts reduces the errors that may be introduced by manual drawing, such as connection errors, missing nodes or edges, etc. This helps to improve the accuracy and reliability of the design. The script can quickly generate flowcharts based on the target information, greatly reducing the time and effort required for manual flowchart drawing. Designers can focus more on analyzing and optimizing the design itself instead of spending too much time on drawing flowcharts. Since the generation of flowcharts is based on target information, when the design changes (such as adding new processing units, modifying clock frequencies, etc.), you only need to update the target information and rerun the script to quickly generate a new flowchart. This flexibility makes design iteration and optimization easier. The graphical clock processing flowchart is easy to communicate and collaborate with other team members (such as hardware engineers, software engineers, test engineers, etc.). It can help people from different backgrounds better understand the design details and timing requirements. The generated clock processing flowchart can be used as the basic input for subsequent work (such as timing analysis, power estimation, code generation, etc.). These subsequent tasks can use the information in the flow chart for more accurate calculations and optimizations.
[0033] Optionally, the generating a clock processing flowchart according to the target information by using a second preset script includes:
[0034] The transmission path of each clock between the clock processing units is determined according to the preset identifier in the Excel file.
[0035] By adopting the above technical solution, the accuracy of the clock transmission path can be ensured by using preset identifiers in the Excel file. These identifiers may be specific values that clearly indicate how the clock signal flows from one processing unit to another in the system. Automatically determining the clock transmission path through preset identifiers can greatly speed up the generation of flowcharts. Compared with manually identifying and processing each clock path, the scripted method can complete the task faster and more accurately. Automated processing reduces the possibility of human error. When manually drawing or analyzing clock processing flowcharts, it is easy to make mistakes due to negligence or misunderstanding. Using preset identifiers and scripted methods can ensure that each clock path is correctly identified and processed. The generated clock processing flowchart can clearly show the flow of clock signals in the system. This is very important for understanding the working mechanism of the system, discovering potential problems, and optimizing performance. When the system design changes (such as adding new clocks, modifying processing units, or adjusting clock paths), you only need to update the corresponding preset identifiers in the Excel file and rerun the script to quickly generate a new clock processing flowchart. This flexibility makes design iteration and optimization easier. The generated clock processing flowchart can serve as a bridge for communication and collaboration between team members. By viewing the flowchart, team members can more clearly understand the transmission of clock signals in the system and work together better. The generated clock processing flowchart can be used as the basic input for subsequent work (such as timing analysis, power estimation, code generation, etc.). These subsequent work can use the clock transmission path information in the flowchart for more accurate calculation and optimization.
[0036] In a second aspect of the present application, a system for automatically generating a clock network based on Python is provided, comprising an information acquisition module, a first script module, a second script module and an execution module, wherein:
[0037] An information acquisition module, configured to acquire target information from the Excel file in response to an operation of a user inputting an Excel file, wherein the target information includes a clock type, a source clock, and a processing unit;
[0038] A first script module is configured to generate an instantiation file, a constraint file and a header file according to the target information through a first preset script, wherein the instantiation file includes the instantiation, connection relationship and control logic of the clock module, the constraint file is used to constrain the timing behavior of the clock, and the header file includes macro definitions and constants for controlling the clock processing unit;
[0039] A second script module is configured to generate a clock processing flowchart according to the target information through a second preset script, and save the clock processing flowchart as a picture file or insert it into a target form of the Excel file;
[0040] An execution module is configured to generate a clock network according to the instantiation file, the constraint file, the header file and the clock processing flow chart.
[0041] In the third aspect of the present application, an electronic device is provided, including a processor, a memory, a user interface and a network interface, the memory is used to store instructions, the user interface and the network interface are both used to communicate with other devices, and the processor is used to execute the instructions stored in the memory so that the electronic device executes any one of the methods described above.
[0042] In a fourth aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores instructions, and when the instructions are executed, any of the methods described above is executed.
[0043] In summary, one or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages:
[0044] 1. It can automatically obtain target information from Excel files and generate multiple key components of the clock network based on this information, such as instantiation files, constraint files, and header files. This greatly reduces the workload of manual writing and configuration and improves the automation level of the design process;
[0045] 2. The automated generation process ensures the accuracy and consistency of the clock network design. Since the script generates files based on preset rules and templates, it reduces the possibility of human errors and improves the reliability of the design.
[0046] 3. Able to quickly respond to user input and generate required files and flow charts in real time. This helps speed up design and shorten project cycles;
[0047] 4. The clock processing flow chart generated by the second preset script graphically displays the flow and processing of clock signals in the system. This makes the design easier to understand and analyze, and facilitates communication and collaboration among team members;
[0048] 5. When the design changes, just update the target information in the Excel file and rerun the script to quickly generate a new design file. This flexibility makes design iteration and optimization easier;
[0049] 6. The generated instantiation files, constraint files and header files are well organized and annotated, making subsequent code maintenance easier. At the same time, since these files are automatically generated based on target information, it can be ensured that these files can be updated accordingly when the design is modified;
[0050] 7. The Python-based scripting method reduces the learning cost. Designers do not need to master complex hardware description languages or graphical design tools, but only need to be familiar with Python and Excel to use this method for clock network design. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 It is a flowchart of a method for automatic generation of a clock network based on Python disclosed in an embodiment of the present application;
[0052] Figure 2 It is a schematic diagram of the architecture of the clock tree disclosed in the embodiment of the present application;
[0053] Figure 3 It is a schematic diagram of the architecture of the instantiation file disclosed in the embodiment of the present application;
[0054] Figure 4 It is an overall schematic diagram of the script generating the corresponding file disclosed in the embodiment of the present application;
[0055] Figure 5 It is a module schematic diagram of a system for automatic generation of a clock network based on Python disclosed in an embodiment of the present application;
[0056] Figure 6 It is a structural schematic diagram of an electronic device disclosed in an embodiment of the present application.
[0057] Explanation of the reference numerals: 501, information acquisition module; 502, first script module; 503, second script module; 504, execution module; 601, processor; 602, communication bus; 603, user interface; 604, network interface; 605, memory. DETAILED DESCRIPTION
[0058] In order to enable technicians in this field to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.
[0059] In the description of the embodiments of the present application, words such as "for example" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "for example" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "for example" or "for example" is intended to present related concepts in a specific way.
[0060] In the description of the embodiments of the present application, the meaning of the term "multiple" refers to two or more. For example, multiple systems refer to two or more systems, and multiple screen terminals refer to two or more screen terminals. In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. The terms "include", "comprise", "have" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.
[0061] This embodiment discloses a method for automatically generating a clock network based on Python, which is applied to a clock network generation platform. Figure 1 is a flow chart of the method for automatically generating a clock network based on Python disclosed in the embodiment of the present application, such as Figure 1 As shown, the method comprises the following steps:
[0062] S110, in response to the user inputting an Excel file, acquiring target information from the Excel file, the target information including a clock type, a source clock, and a processing unit;
[0063] The user needs to input or upload an Excel file containing target information on the clock network generation platform. The Excel file is a predefined template, and the clock network generation platform can identify and process the relevant information in the Excel file. During the parsing of the Excel file, the clock network generation platform reads each worksheet (Sheet), cell (Cell) and the data content in the file. During the parsing of the file, the clock network generation platform will find and identify the specific area or format containing the target information. This target information usually includes: clock type, source clock and processing unit. The clock type describes the characteristics and purpose of the clock signal. In the Excel file, the clock type may be stored in a specific column or cell in the form of text, such as the "Clock_Type" column. The clock network generation platform will identify and extract this text information according to the preset rules or templates. The source clock is the starting point or generation source of the clock signal. In the Excel file, the source clock information may include the name, frequency, phase and other parameters of the source clock. This information may be scattered in multiple columns or cells, but the clock network generation platform will combine them according to the preset rules to form a complete source clock description. A processing unit is a component or module through which a clock signal flows and acts in a clock network generation platform. In an Excel file, the information of a processing unit may include the name, type, input clock, output clock, etc. of the processing unit. This information is usually stored in one or more tables or areas, and the clock network generation platform will identify and extract the data in these tables or areas according to preset rules. After extracting the target information, the clock network generation platform will verify and format the information. The purpose of verification is to ensure the accuracy and completeness of the information, such as checking whether the clock type is legal, whether the source clock parameters are complete, etc. The purpose of formatting is to convert information into a format that the system can understand and process, such as converting text information into a specific data type or object.
[0064] The following are the naming rules and distribution of Excel files:
[0065] The first column is the name of the clk (clock) type, the second column is the source path of the clk, the third column is the input buffer through which the clk passes, and the remaining columns are clock processing sub-modules.
[0066] The clock processing submodule includes:
[0067] Clk_divx: clock divided by x times;
[0068] Clk_deglitch_swx: clock selector, x inputs, one output;
[0069] Clk_ana_fliter: clock filter module;
[0070] Clk_div0_divx: clock undivided or divided by x frequency multiplication module;
[0071] Lsw_occ: test related;
[0072] Clk_cg: clock gating;
[0073] Clk_out(soft): The clock passes through the output buffer. The suffix "soft" indicates that it has a soft reset.
[0074] The entire Excel form is divided into two sheets, one is the common sheet, which stores the common clock. The other is the async sheet, which represents the unique clock. The purpose of dividing into two sheets is that for the common clock, the common sheet can be directly copied when it is used next time, and a new async sheet can be created for the next new demand.
[0075] Taking the naming rule of a clock as an example, the remaining clocks can be added in the Excel form in this format. The number of Excel rows required to describe a clock is: 1+n, where n is the number of clocks derived from the PLL (phase-locked loop). In the following example, n=4.
[0076] The following is an Excel example:
[0077] ;
[0078] The first column naming rules are as follows:
[0079] ;
[0080] The second column naming rules are as follows:
[0081] ;
[0082] The third column naming rules are as follows:
[0083] ;
[0084] The first row of the fourth column is Clk_div2, which means it is a 2-frequency division clock processing unit. The fourth row is marked as 1, indicating that clk_6m enters the 2-frequency division processing unit after passing through the clock buffer unit, and the remaining rows are not marked as 1, which means that the remaining clocks do not enter the 2-frequency division processing unit.
[0085] The first row of the fifth column is Clk_deglitch_sw3, which means it is a 3-to-1 selector. The third, fourth, and fifth rows are all marked as 1, indicating that the three clocks of the previous level have passed through this selector. For the third row of this column, since the previous column is the Clk_div2 processing unit, the third row of the Clk_div2 processing unit is not marked as 1, so the first input clock of the selector continues to trace forward, that is, the output clock of clk_12m after passing through the clock buffer unit. Similarly, the third input clock of the selector is the output clock of clk_133m after passing through the clock buffer unit. The fourth row of Clk_div2 is marked as 1, so the second input clock of the selector is the output clock of the 2-division processing unit.
[0086] The first line of the sixth column is Clk_ana_filter, which means it is a clock filter module. Its third line is 1, and the previous column is the Clk_deglitch_sw3 processing unit, and the third line of Clk_deglitch_sw3 is also 1, so the input of the filter module is the output of Clk_deglitch_sw3. If the third line of Clk_deglitch_sw3 is not marked as 1, then the input of the filter module is not the output of Clk_deglitch_sw3, but continues to trace forward.
[0087] The first row of the seventh column is clk_div0_div2, and the third row is marked as 1. Tracing back, the previous column is the clk_ana_fliter module, and the third row of clk_ana_fliterd is also marked as 1, so the input of clk_div0_div2 is the output of the clk_ana_fliter module.
[0088] The first row of the eighth column is lsw_occ. This clock processing unit requires two input clocks, so the second and third rows are marked as 1. The method for determining the input clock of this module is the same as above.
[0089] Some rows in the column where the clock processing unit is located are marked as 1, which means that the output of the previous stage corresponding to this row has passed through this clock processing unit, and rows not marked as 1 mean that the output of the previous stage corresponding to this row has not passed through this clock processing unit.
[0090] Clock gating (clk_cg) is a power reduction technique that allows the clock signal to be turned off when it is not needed, thereby avoiding unnecessary power consumption. When a logic block or module is idle, clock gating can turn off the clock of the module, thereby stopping the activity of its internal logic. Clock gating is usually a control signal used to turn the clock signal on or off. The clock output (clk_out) is the actual transmission point of the clock signal. It is usually connected to the logic block or module that requires the clock signal. The clock output is the point where the clock signal is passed from the clock source (such as PLL, oscillator, etc.) or the clock gating. The clock tree is the distribution network of the clock signal from the source point to all points that require the clock. It may include multiple clock gating points, buffers, drivers, etc. to ensure that the clock signal can reach all target points accurately and reliably. Since the clock signal needs to arrive at all logic blocks synchronously, the design and optimization of the clock tree is an important part of system design.
[0091] In the embodiment of the present application, a clk_cg is bound to a clk_out, that is, they are two adjacent columns in Excel. Since clk_cg and clk_out may be connected in parallel to form a clock tree, the naming rules are as follows.
[0092] There are two naming methods for clk_cg:
[0093] ;
[0094] max(y[i]) represents the maximum value of all elements y[i] in the set or array y, where y[i] represents a quantity or value associated with the i-th clock gating (clk_cg) or other related factors.
[0095] There are four naming methods for clk_out:
[0096] ;
[0097] Continuing with the above example, columns 9-14 are used to illustrate the naming rules of clk_cg and clk_out and the resulting clock tree structure.
[0098] ;
[0099] Based on the above data, we can form Figure 2 The clock tree shown.
[0100] S120, generating an instantiation file, a constraint file and a header file according to the target information through a first preset script, wherein the instantiation file includes the instantiation, connection relationship and control logic of the clock module, the constraint file is used to constrain the timing behavior of the clock, and the header file includes macro definitions and constants for controlling the clock processing unit;
[0101] The instantiation file contains the instantiation, connection relationship and control logic of the clock module. It describes the content of each component in the clock network being instantiated (i.e. created) and the content of their interconnection. Instantiation of clock modules: The instantiation file lists all clock modules (such as PLL, clock gating, etc.) and assigns unique identifiers and parameters to them. These parameters may include clock frequency, phase, duty cycle, etc. Connection relationship: The file describes how the clock signal flows between various modules. This includes the path from the source clock to the target clock processing unit, as well as any intermediate connections or branches that may exist. Control logic: If the clock network contains dynamic control logic (such as enabling or disabling the clock based on the system state), this logic will also be defined in the instantiation file. Constraint files are used to constrain the timing behavior of the clock. It ensures that the propagation of the clock signal in the system meets specific timing requirements to avoid data loss, timing conflicts or other clock-related problems. Clock frequency and phase: The constraint file defines the frequency and phase requirements of the clock signal, which ensures that all components that depend on the clock can receive and process data within the correct time window. Timing paths: The file may contain constraints on specific timing paths, which are critical paths for data to propagate through the system. By constraining the maximum delay of these paths, you can ensure that the system can meet its performance requirements. Clock jitter and skew: Constraint files may also contain constraints on clock jitter and skew. These parameters describe the stability and consistency of the clock signal and are critical to keeping the system synchronized. Header files contain macro definitions and constants used to control clock processing units. These macros and constants can be referenced by multiple files throughout the design process, thereby maintaining code consistency and maintainability. Macro definitions: Header files may contain macros used to define specific behaviors of the clock network. For example, macros can be defined to control the opening and closing of clock gating, or macros can be defined to identify different clock sources. Constants: Constants are used to store fixed values related to the clock network, such as clock frequency, phase offset, etc. These constants can be referenced in multiple files without repeating the definition. Data types and interfaces: Header files may also contain data type and interface definitions required to interact with the clock processing unit. This helps ensure that data exchange between different modules follows a unified specification.
[0102] In some implementations, generating the instantiation file, the constraint file, and the header file according to the target information by using the first preset script includes:
[0103] Parsing clock information under each form from the target information, the clock information including the name of each clock and the associated processing unit;
[0104] Creating a corresponding single clock instantiation file for each clock according to the clock information;
[0105] Create a form instantiation file to call all individual clock instantiation files under the target form;
[0106] Create a top-level instantiation file to call all form instantiation files.
[0107] Figure 3 This is a schematic diagram of the architecture of the instantiation file disclosed in the embodiment of the present application, combined with Figure 3 The embodiment of the present application is described. The first preset script in the embodiment of the present application includes the Crg.py script. The Crg.py script reads the Excel file and parses the clock information under each form therefrom. This information generally includes the name of each clock, the number of rows and columns they occupy, and the processing units to which they are associated. By identifying these specific information in Excel, the Crg.py script can build a structure (such as a list, a dictionary, or an object) containing all the detailed data of the clock. Based on the clock information extracted from Excel, Crg.py will create a separate Verilog instantiation file (sheetname_clkname.v) for each clock. These files will contain the instantiation code of the clock, including the definition of the clock source, the distribution of the clock signal, and the instantiation of the processing unit through which the clock passes. In this way, the detailed configuration of each clock is encapsulated in a separate file for easy management and maintenance. Crg.py will also create a form instantiation file (sheetname.v), which is used to call all the individual clock instantiation files (sheetname_clkname.v) under the target form. The form instantiation file will organize the calls of these individual clock instantiation files according to the arrangement order of the clocks in the Excel file or a specific logical order. This ensures that all related clock configurations are correctly integrated into one file. After completing the creation of all form instantiation files, Crg.py will further create a top-level instantiation file (top.v). The function of this file is to call all form instantiation files and combine them into a complete Verilog project. The top-level instantiation file is usually located at the top level of the entire Verilog project, and it defines the top-level structure and clock network of the entire system.
[0108] The generated single clock instantiation file, form instantiation file and top-level instantiation file form a clear modular structure, which is conducive to system maintenance and upgrade. The modular design makes the function of each module clearer and more independent, reduces the coupling between modules, and improves the maintainability of the system. For complex systems containing multiple forms and a large number of clocks, the script can quickly generate the required files, improving the development efficiency of the system. Through script processing, the relationship between complex clock networks and processing units can be easily managed, reducing the complexity of system design.
[0109] In some implementations, generating the instantiation file, the constraint file, and the header file according to the target information by using the first preset script includes:
[0110] Acquire register data from the target information, wherein the register data includes register type, bit width, and read and write permissions;
[0111] Classify the data according to the type of register, calculate the number of registers of each type, and store the calculation results in the corresponding data structure;
[0112] A new Excel file is created using the same library as the Excel file, a table structure of the new Excel file is determined, and data in the data structure are filled into corresponding cells of the new Excel file.
[0113] The first preset script in the embodiment of the present application includes a Port.py script. The Port.py script identifies and analyzes the information in the Excel file, especially the data related to the clock and register. The number of rows and columns occupied by each clock is extracted, which helps to locate and store detailed information related to the register. The register data includes the type of register (e.g., status register, control register, etc.), bit width (i.e., the number of data bits that the register can store), and read and write permissions (whether readable, writable, or both). The script classifies the extracted data according to the type of register. For each type of register, the script calculates its number and stores this information in an appropriate data structure, such as a dictionary, list, or custom object. This classification and counting process helps to organize the data and prepare for the creation of a new Excel file in subsequent steps. The script uses the same library (such as openpyxl, xlrd / xlwt, etc.) as the original Excel file to create a new Excel file (port.xlsx). Determine the table structure of the new Excel file, which usually includes defining the header (such as register name, type, bit width, read and write permissions, etc.) and setting the appropriate column width and row height. The Port.py script populates the corresponding cells of the newly created Excel file with the register data previously stored in the data structure. This includes filling in the register type, bit width, read and write permissions, and other information into the corresponding columns according to the predefined table structure. The filling process ensures the accuracy and consistency of the data, while making the generated port.xlsx file easy to read and understand.
[0114] Classify the data according to the type of registers and calculate the number of registers of each type, making the data more orderly and easy to manage. This classification and organization facilitates subsequent data analysis and use, improving the utilization and availability of data. Store the processed data in the corresponding data structure, such as a dictionary, list, or custom object, so that the data has a clear structure and hierarchy. This structured storage facilitates data retrieval and access, and improves the maintainability and scalability of the data. Create a new Excel file using the same library as the original Excel file, and fill the data in the data structure into the corresponding cells according to the preset table structure. This process realizes the automatic export and presentation of data and generates an Excel file with standardized format and content. The generated new Excel file (such as port.xlsx) contains detailed information such as the type, bit width, read and write permissions of the register, which is presented in a table format and is easy to read and understand. This provides intuitive data support for subsequent design, verification, or documentation work. Through the automated processing and organization of register data, it can be ensured that the data used in the design process is accurate and consistent. This helps to improve the accuracy and reliability of the design and reduce errors and defects caused by inconsistent data.
[0115] In some implementations, generating the instantiation file, the constraint file, and the header file according to the target information by using the first preset script includes:
[0116] The clock information is obtained from the target information, and corresponding timing constraints are generated according to the clock information. The clock information includes the name, frequency, phase offset information of the clock and the processing units through which the clock passes. The timing constraints include the period, duty cycle and phase relationship of the clock.
[0117] The first preset script in the embodiment of the present application includes the Sdc.py script. The Sdc.py script reads the Excel file and identifies the clock information contained therein. This includes the number of rows and columns occupied by each clock, so that the clock-related data can be accurately located and extracted. The extracted clock information includes the name, frequency, phase offset information of the clock, and the processing unit through which the clock passes. This information is the basis for the subsequent generation of the timing constraint file. According to the clock information extracted from Excel, the script will form one or more arrays (or other data structures) for storing this information. Each array (or structure) corresponds to a clock and contains all relevant parameters of the clock. According to the parameters such as the name, frequency, phase offset, etc. in the clock information, the script will generate corresponding timing constraints. These timing constraints describe the key attributes of the clock such as the period, duty cycle, and phase relationship. The generated timing constraints will be organized in a specific format (such as the SDC file format) to ensure that subsequent tools can correctly parse and apply these constraints. For each clock, the Sdc.py script will generate an independent timing constraint file (such as clk.sdc), which contains all the timing constraints of the clock. The file name is usually named according to the name of the clock or other identifiers for easy identification and management. In the generated timing constraint file, in addition to basic constraints such as clock period and duty cycle, specific constraints can be added according to the different processing units that the clock passes through. For example, specific delays or phase relationships may need to be set for certain processing units.
[0118] The script generates timing constraints based on accurate clock information (such as name, frequency, phase offset, etc.), avoiding errors and omissions that may be caused by manual input. The generated timing constraint file contains key parameters such as accurate clock period, duty cycle and phase relationship, which helps to improve the accuracy and reliability of the design. Through unified script processing, it can ensure that the timing constraint files in different designs or projects have consistent formats and styles, which is conducive to code reuse and maintenance. Maintaining consistency also helps to reduce differences and misunderstandings caused by human factors and improve the efficiency of team collaboration. The design of the script usually takes into account possible future expansion requirements, so it can easily adapt to new clock information or processing unit types. By modifying the configuration parameters in the script or adding new processing logic, the function of the script can be easily expanded to adapt to more complex design requirements. The generated timing constraint file can be directly used in subsequent processes such as hardware design, simulation and verification, which helps to discover potential timing problems and optimize them. Through accurate timing constraints, it can ensure that the performance of the design is optimal and reduce performance bottlenecks or failures caused by timing problems. The automatically generated timing constraint file helps to ensure the correctness and reliability of the design and reduce errors and defects caused by timing problems. Accurate timing constraints also help improve the predictability and testability of the design, providing strong support for subsequent testing and verification work.
[0119] In some implementations, generating the instantiation file, the constraint file, and the header file according to the target information by using the first preset script includes:
[0120] Allocate a base address to each processing unit in each clock domain, and for a target register of each processing unit, combine the base address with a relative address of the target register in the unit to form an offset address of the target register;
[0121] A header file is generated using the offset address, wherein the header file includes a macro definition, an enumeration or a structure.
[0122] The first preset script in the embodiment of the present application includes a Verify_set.py script. The Verify_set.py script identifies the processing unit under each clock domain in the target information and assigns a unique base address to these processing units. This base address is usually a starting address for identifying the position of the processing unit in the memory or address space. For the target register in each processing unit, the Verify_set.py script combines the previously assigned base address with the relative address of the register in the unit. The relative address refers to the offset of the register inside the processing unit where it is located, which is usually calculated from the base address of the processing unit. By combining the base address and the relative address, a complete offset address of the target register can be formed. This offset address is unique and is used to identify and locate the register in subsequent control and access processes. When the offset address of each target register is obtained, the Verify_set.py script generates a header file (such as verify.h) using these offset addresses. This header file usually contains a series of macro definitions, enumerations or structures for conveniently referencing and using these offset addresses in the code. For example, a header file may contain the following: (1) Macro definition: define a macro for each target register, and the value of the macro is the offset address of the register. In this way, these macros can be used directly in the code to access the corresponding registers; (2) Enumeration: organize the offset addresses of registers into enumeration types, making the code clearer and easier to maintain; (3) Structure: define a structure that contains the offset addresses and other related information of all target registers. This method can make the management of registers more centralized and systematic.
[0123] By assigning a base address to each processing unit under the clock domain and combining the base address with the register relative address to form an offset address, the register address in the code can be made clearer and more organized. The generated header file (such as verify.h) uses macro definitions, enumerations, or structures to encapsulate these offset addresses, making it more intuitive and convenient to use these addresses in the code, improving the readability of the code. When the address of a processing unit or register changes, you only need to modify the base address or relative address in the script and regenerate the header file, without manually modifying a large amount of code, which improves the maintainability of the code. The offset address and header file are generated by automated scripts, avoiding errors and omissions that may occur when manually calculating addresses and writing code. The generated offset address and header file are verified and checked by the script, reducing the possibility of system errors or failures caused by address errors. By assigning a base address to each processing unit under the clock domain through the script, new processing units or registers can be easily added without modifying existing code. The generated header file uses flexible macro definitions, enumerations, or structures to encapsulate offset addresses, and these definitions can be easily modified and extended as needed. The script can handle processing units and registers in multiple clock domains, assign different base addresses to each clock domain, and support data transmission and synchronization across clock domains. This enables the system to support more complex multi-clock domain designs and improves system performance and reliability.
[0124] S130, generating a clock processing flowchart according to the target information through a second preset script, and saving the clock processing flowchart as a picture file or inserting it into a target form of the Excel file;
[0125] The second preset script needs to read the target information, which is usually contained in an Excel file or database, describing the logical relationship, processing steps and timing requirements of the clock processing unit. The second preset script will parse this information and extract the key data required to generate the flowchart, such as the name of the processing unit, the input-output relationship, the processing order, etc. According to the parsed target information, the second preset script will determine the nodes in the flowchart. These nodes usually represent different processing units or steps in the clock processing process. According to the input-output relationship and processing order between the processing units, the second preset script will establish connecting lines between the nodes to indicate the flow direction of data or control signals. Nodes can contain various attributes, such as name, description, color, shape, etc. The second preset script will set these attributes according to the corresponding data in the target information so as to clearly show the characteristics of the clock processing process in the flowchart. Using a graphics library (such as matplotlib, Graphviz, Pillow, etc.), the second preset script will generate a graphical interface of the flowchart based on the nodes, relationships and attributes determined in the above steps. This interface can be an independent window or a graphical control that can be embedded in other applications. After the flowchart's graphical interface is generated, the second preset script can save it in a common image format (such as PNG, JPG, SVG, etc.). This usually involves graphics rendering and file writing operations. The saved image file can be used directly in subsequent project documents or reports. If the flowchart needs to be inserted directly into the target form of the Excel file, the second preset script needs to use a library that can operate Excel files (such as openpyxl, xlwt / xlrd, etc.). The second preset script opens the target Excel file and locates the target form. Then, it creates a suitable cell area in the form to accommodate the flowchart. Next, the second preset script converts the generated flowchart graphical interface into an image format that Excel can recognize (such as PNG or JPG) and inserts it into the specified cell area as a picture object. Finally, the second preset script saves and closes the Excel file.
[0126] In some implementations, generating a clock processing flow chart according to the target information by using a second preset script includes:
[0127] The clock, processing unit and the logical relationship between the clock and the processing unit are obtained from the target information, the nodes of the clock processing flowchart are constructed through the clock and the processing unit, and the edges of the processing flowchart are constructed through the logical relationship, and the clock processing flowchart is generated according to the nodes and edges through the graphics library.
[0128] The second preset script in the embodiment of the present application includes a Graph.py script. The Graph.py script first reads the target information stored in an Excel file (such as data.xlsx). The target information generally includes the number of rows and columns occupied by each clock, as well as the clock, the processing unit (also referred to as the clock processing unit) and the logical relationship between them. The Graph.py script parses the information read from the Excel file and stores the information in an appropriate data structure, such as an array or a dictionary. In particular, it forms an array or data structure storing information to store the values in each column of Excel cells. These values may include clock names, processing unit identifiers, and the connection relationship between them. After parsing and storing the information, the Graph.py script identifies each clock in each form and the processing unit they pass through. This is done by looking up specific identifiers or keywords related to the clock and processing unit in the stored information. Based on the identified clocks and processing units, the Graph.py script begins to build the nodes and edges of the clock processing flow chart. Each clock and processing unit will become a node in the flow chart. The logical relationship between the clock and the processing unit (such as data flow or control flow) will become the edge connecting these nodes. The Graph.py script uses a graphics library (such as matplotlib, Graphviz, etc.) to generate a clock processing flowchart based on the constructed nodes and edges. This flowchart will clearly show how the clock flows through different processing units and the logical relationship between these processing units. After generating the clock processing flowchart, the script also needs to insert the flowchart into the target form of the original Excel file (or a new Excel file, such as graph.xlsx). This usually involves converting the flowchart into a picture format (such as PNG or JPG) and then inserting the picture in the Excel file. In this way, users can view and analyze the clock processing flow directly in Excel.
[0129] Automatically generating clock processing flowcharts greatly improves the efficiency of creating flowcharts and avoids the tedious and time-consuming manual drawing of flowcharts. The script can accurately extract the required data from the target information, reduce the errors that may be caused by human operation, and improve the accuracy of the flowchart. Through the generated clock processing flowchart, the complex clock processing logic can be intuitively presented to the user in a graphical way, making it easier for the user to understand and analyze the entire processing flow. The nodes and edges in the flowchart clearly represent the clocks, processing units, and the logical relationship between them, which helps users quickly identify critical paths and potential problems. If the clock processing logic changes, only the relevant data in the target information needs to be updated and the script can be rerun to generate a new flowchart without manually modifying the existing flowchart. This automated approach can greatly simplify the modification and maintenance process of the flowchart and reduce maintenance costs. The generated clock processing flowchart can not only be directly viewed and analyzed in Excel files, but also exported as pictures or other formats to meet the needs of different application scenarios. These flowcharts can be easily inserted or displayed in project documents, presentations, or meetings to promote project communication and collaboration. Through the generated clock processing flowchart, bottlenecks and potential optimization points in the processing flow can be further analyzed. Based on the analysis results of the flowchart, the processing flow can be optimized and improved to improve the performance and efficiency of the entire system.
[0130] In some implementations, generating a clock processing flow chart according to the target information by using a second preset script includes:
[0131] The transmission path of each clock between the clock processing units is determined according to the preset identifier in the Excel file.
[0132] The second preset script reads the Excel file and locates a specific column containing clock processing unit information. In this column, each row represents a step or state in a possible clock processing flow, and each clock processing unit occupies one or more cells in this column. The second preset script checks whether these cells contain a preset flag (usually the number 1). This flag is used to indicate whether the output of a clock passes through the clock processing unit in the current row. If the cell is marked as 1, it means that the output of the previous level corresponding to the row has passed through this clock processing unit; conversely, if the cell is not marked as 1, it means that the output of the previous level corresponding to the row has not passed through this clock processing unit. By traversing the entire column and identifying all cells marked as 1, the script can construct a clock transmission path between clock processing units. This path starts from the starting point of the clock, moves along the cells marked as 1, passes through each clock processing unit, and reaches the end of the clock or the end of the process. After determining the transmission path of the clock, the script uses the graphics library to generate a clock processing flow chart. In this flowchart, each clock processing unit is represented as a node, and the clock transmission path is represented as the edge connecting these nodes. In this way, the entire clock processing flow can be clearly visualized, making it easier for users to analyze and understand.
[0133] The script can accurately read the preset identifiers (such as the number 1) in the Excel file, so as to clearly identify the specific transmission path of each clock between the various clock processing units. This clear path information is crucial for subsequent analysis, optimization and troubleshooting. Compared with manually analyzing Excel files and determining the transmission path, using scripts for automated processing can greatly improve work efficiency. The script can process a large amount of data in a short time and quickly generate results, thus saving manpower and time costs. When manually analyzing Excel files, human errors are prone to occur due to the large amount of data and complex logical relationships. Using scripts for automated processing can reduce the occurrence of such errors and improve the accuracy and reliability of data processing. After determining the transmission path of each clock, the script can further generate a clock processing flow chart to intuitively display the complex transmission logic in a graphical way. This visual display helps users better understand the clock processing process and quickly identify key nodes and potential problems. The clear transmission path and visual flow chart provide strong support for subsequent analysis and optimization. Based on this information, users can further analyze the performance bottlenecks of the clock processing process, optimize the processing order, reduce unnecessary intermediate links, etc., thereby improving the efficiency and performance of the entire system.
[0134] S140, generating a clock network according to the instantiation file, the constraint file, the header file and the clock processing flow chart.
[0135] Figure 4 It is an overall schematic diagram of the script generating the corresponding file disclosed in the embodiment of the present application, such as Figure 4 As shown, run the Crg.py script to generate the clock top-level instantiation *.v file, run the port.py script to generate port.xlsx, run the sdc.py script to generate the clk.sdc file, run the graph.py script to generate the *.png file, and run the verify_set.py script to generate the verify.h file.
[0136] This embodiment also discloses a system for automatically generating a clock network based on Python. Figure 5 is a module diagram of a system for automatic generation of a clock network based on Python disclosed in an embodiment of the present application, such as Figure 5 As shown, the system includes an information acquisition module 501, a first script module 502, a second script module 503 and an execution module 504, wherein:
[0137] The information acquisition module 501 is configured to acquire target information from the Excel file in response to a user input operation of the Excel file, wherein the target information includes a clock type, a source clock, and a processing unit;
[0138] A first script module 502 is configured to generate an instantiation file, a constraint file and a header file according to the target information through a first preset script, wherein the instantiation file includes the instantiation, connection relationship and control logic of the clock module, the constraint file is used to constrain the timing behavior of the clock, and the header file includes macro definitions and constants for controlling the clock processing unit;
[0139] A second script module 503 is configured to generate a clock processing flowchart according to the target information through a second preset script, and save the clock processing flowchart as a picture file or insert it into a target form of the Excel file;
[0140] The execution module 504 is configured to generate a clock network according to the instantiation file, the constraint file, the header file and the clock processing flow chart.
[0141] In some implementations, the first script module 502 is configured to:
[0142] Parsing clock information under each form from the target information, the clock information including the name of each clock and the associated processing unit;
[0143] Creating a corresponding single clock instantiation file for each clock according to the clock information;
[0144] Create a form instantiation file to call all individual clock instantiation files under the target form;
[0145] Create a top-level instantiation file to call all form instantiation files.
[0146] In some implementations, the first script module 502 is configured to:
[0147] Acquire register data from the target information, wherein the register data includes register type, bit width, and read and write permissions;
[0148] Classify the data according to the type of register, calculate the number of registers of each type, and store the calculation results in the corresponding data structure;
[0149] A new Excel file is created using the same library as the Excel file, a table structure of the new Excel file is determined, and data in the data structure are filled into corresponding cells of the new Excel file.
[0150] In some implementations, the first script module 502 is configured to:
[0151] The clock information is obtained from the target information, and corresponding timing constraints are generated according to the clock information. The clock information includes the name, frequency, phase offset information of the clock and the processing units through which the clock passes. The timing constraints include the period, duty cycle and phase relationship of the clock.
[0152] In some implementations, the first script module 502 is configured to:
[0153] Allocate a base address to each processing unit in each clock domain, and for a target register of each processing unit, combine the base address with a relative address of the target register in the unit to form an offset address of the target register;
[0154] A header file is generated using the offset address, wherein the header file includes a macro definition, an enumeration or a structure.
[0155] In some implementations, the second script module 503 is configured to:
[0156] The clock, processing unit and the logical relationship between the clock and the processing unit are obtained from the target information, the nodes of the clock processing flowchart are constructed through the clock and the processing unit, and the edges of the processing flowchart are constructed through the logical relationship, and the clock processing flowchart is generated according to the nodes and edges through the graphics library.
[0157] In some implementations, the second script module 503 is configured to:
[0158] The transmission path of each clock between the clock processing units is determined according to the preset identifier in the Excel file.
[0159] It should be noted that: when the device provided in the above embodiment realizes its function, only the division of the above functional modules is used as an example. In actual application, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0160] This embodiment also discloses an electronic device, referring to Figure 6 The electronic device may include: at least one processor 601 , at least one communication bus 602 , a user interface 603 , a network interface 604 , and at least one memory 605 .
[0161] The communication bus 602 is used to realize the connection and communication between these components.
[0162] The user interface 603 may include a display screen (Display) and a camera (Camera). The optional user interface 603 may also include a standard wired interface and a wireless interface.
[0163] The network interface 604 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).
[0164] Among them, the processor 601 may include one or more processing cores. The processor 601 uses various interfaces and lines to connect various parts in the entire server, and executes various functions of the server and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 605, and calling data stored in the memory 605. Optionally, the processor 601 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 601 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 601, and it can be implemented separately through a chip.
[0165] Among them, the memory 605 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read-Only Memory). Optionally, the memory 605 includes a non-transitory computer-readable storage medium. The memory 605 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 605 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned method embodiments, etc.; the data storage area may store data involved in the above-mentioned method embodiments, etc. The memory 605 may optionally be at least one storage device located away from the aforementioned processor 601. As Figure 6 As shown, the memory 605 as a computer storage medium may include an operating system, a network communication module, a user interface module, and an application program of a method for automatically generating a clock network based on Python.
[0166] exist Figure 6In the electronic device shown, the user interface 603 is mainly used to provide an input interface for the user and obtain data input by the user; and the processor 601 can be used to call the application program of the method for automatic generation of a clock network based on Python stored in the memory 605. When executed by one or more processors 601, the electronic device executes one or more methods in the above-mentioned embodiments.
[0167] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required for the present application.
[0168] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0169] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0170] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0171] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0172] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory 605, including several instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned memory 605 includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk.
[0173] The above is only an exemplary embodiment of the present disclosure, and the scope of the present disclosure cannot be limited thereto. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the disclosure of the specification and the truth of practice, it will be easy for those skilled in the art to think of other embodiments of the present disclosure. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the technical field that are not recorded in the present disclosure. The description and examples are regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims.
Claims
1. A method for automatic generation of clock networks based on Python, It is characterized in that Applied to a clock network generation platform, the method comprises: In response to an operation of a user inputting an Excel file, acquiring target information from the Excel file, the target information including a clock type, a source clock, and a processing unit; Generate an instantiation file, a constraint file and a header file according to the target information through a first preset script, wherein the instantiation file includes the instantiation, connection relationship and control logic of the clock module, the constraint file is used to constrain the timing behavior of the clock, and the header file includes macro definitions and constants for controlling the clock processing unit; Generate a clock processing flowchart according to the target information through a second preset script, and save the clock processing flowchart as a picture file or insert it into a target form of the Excel file; A clock network is generated according to the instantiation file, the constraint file, the header file and the clock processing flow chart.
2. The method for automatically generating a clock network based on Python according to claim 1, It is characterized in that The generating of the instantiation file, the constraint file and the header file according to the target information by the first preset script comprises: Parsing clock information under each form from the target information, the clock information including the name of each clock and the associated processing unit; Creating a corresponding single clock instantiation file for each clock according to the clock information; Create a form instantiation file to call all individual clock instantiation files under the target form; Create a top-level instantiation file to call all form instantiation files.
3. The method for automatically generating a clock network based on Python according to claim 1, It is characterized in that The generating of the instantiation file, the constraint file and the header file according to the target information by the first preset script comprises: Acquire register data from the target information, wherein the register data includes register type, bit width, and read and write permissions; Classify the data according to the type of register, calculate the number of registers of each type, and store the calculation results in the corresponding data structure; A new Excel file is created using the same library as the Excel file, a table structure of the new Excel file is determined, and data in the data structure are filled into corresponding cells of the new Excel file.
4. The method for automatically generating a clock network based on Python according to claim 1, It is characterized in that The generating of the instantiation file, the constraint file and the header file according to the target information by the first preset script comprises: The clock information is obtained from the target information, and corresponding timing constraints are generated according to the clock information. The clock information includes the name, frequency, phase offset information of the clock and the processing units through which the clock passes. The timing constraints include the period, duty cycle and phase relationship of the clock.
5. The method for automatically generating a clock network based on Python according to claim 1, It is characterized in that The generating of the instantiation file, the constraint file and the header file according to the target information by the first preset script comprises: Allocate a base address to each processing unit in each clock domain, and for a target register of each processing unit, combine the base address with a relative address of the target register in the unit to form an offset address of the target register; A header file is generated using the offset address, wherein the header file includes a macro definition, an enumeration or a structure.
6. The method for automatically generating a clock network based on Python according to claim 1, It is characterized in that The generating of the clock processing flow chart according to the target information by the second preset script includes: The clock, processing unit and the logical relationship between the clock and the processing unit are obtained from the target information, the nodes of the clock processing flowchart are constructed through the clock and the processing unit, and the edges of the processing flowchart are constructed through the logical relationship, and the clock processing flowchart is generated according to the nodes and edges through the graphics library.
7. The method for automatically generating a clock network based on Python according to claim 1, It is characterized in that The generating of the clock processing flow chart according to the target information by the second preset script includes: The transmission path of each clock between the clock processing units is determined according to the preset identifier in the Excel file.
8. A Python-based system for automatically generating clock networks. It is characterized in that It includes an information acquisition module, a first script module, a second script module and an execution module, wherein: An information acquisition module, configured to acquire target information from the Excel file in response to an operation of a user inputting an Excel file, wherein the target information includes a clock type, a source clock, and a processing unit; A first script module is configured to generate an instantiation file, a constraint file and a header file according to the target information through a first preset script, wherein the instantiation file includes the instantiation, connection relationship and control logic of the clock module, the constraint file is used to constrain the timing behavior of the clock, and the header file includes macro definitions and constants for controlling the clock processing unit; A second script module is configured to generate a clock processing flowchart according to the target information through a second preset script, and save the clock processing flowchart as a picture file or insert it into a target form of the Excel file; An execution module is configured to generate a clock network according to the instantiation file, the constraint file, the header file and the clock processing flow chart.
9. An electronic device, It is characterized in that It includes a processor, a memory, a user interface and a network interface, the memory is used to store instructions, the user interface and the network interface are both used to communicate with other devices, and the processor is used to execute the instructions stored in the memory so that the electronic device executes the method as described in any one of claims 1-7.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed, the method according to any one of claims 1 to 7 is executed.
Citation Information
Patent Citations
Integrated system for rule editing, simulation, version control, and business process management
CN110892375A
Cross-clock-domain time sequence constraint file generation method and device and medium
CN111651950A
Asynchronous circuit physical implementation method and system
CN112651207A
Clock network extraction method based on RTL netlist
CN115842615A
Automatic constraint file generation method, device and equipment
CN116050308A
