A method and system for generating register modules in multi-tab Excel spreadsheets
By obtaining information from a multi-tab Excel spreadsheet and converting it into a JSON file, and then generating and integrating the RTL of multiple module registers, the problem of low efficiency in generating multi-tab registers in existing technologies is solved, and efficient and accurate multi-tab register module generation is achieved.
Patent Information
- Application Number
- CN202411651082.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2044-11-19
AI Technical Summary
Existing register generation scripts typically operate on a single tab, which cannot meet the needs of multi-tab applications in large-scale chips. This forces engineers to manually write multi-tab tables, which is inefficient and prone to errors.
By acquiring information from a multi-tab Excel spreadsheet, converting it into a JSON file, generating the RTL for each module register, and integrating it, the process includes generating register user manuals, RALF files, and macro definition files, modifying the RALF format, instantiating common register components, configuring the module register bus to connect with the top-level module, and generating a file list for management.
This system enables the generation of RTL files and related files for multiple module registers at once, improving the efficiency of generating multi-tab information and ensuring the correctness and consistency of the generated register modules.
Smart Images

Figure CN119150763B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of integrated circuits, and in particular to a register module generation method and system based on multi-page Excel. Background Art
[0002] Most of the functional modules in the chip have registers. The processor obtains the module status and configures the function by reading and writing the registers. Design engineers, verification engineers, and software engineers all need to deal with registers, and need a centralized and readable register description file as a basis. Engineers manually write according to each description file, which will waste a lot of time and is prone to errors. Therefore, registers need to be generated through scripts.
[0003] As the chip scale becomes larger and larger, there are more and more modules inside the chip, and more and more registers are needed. The register description table of one form cannot meet the needs, and multiple tabs need to be added to the table. The existing generation script usually generates registers for one tab, and lacks register module generation for multiple tabs. Therefore, a register module generation method based on multi-tab table information is urgently needed. Summary of the invention
[0004] The purpose of the present invention is to provide a register module generation method and system based on multi-tab Excel. The present invention obtains table information of multiple tabs, converts the table information into a JSON file, generates the RTL of each module register, and integrates the RTL of each module register, which is conducive to generating the RTL and other related files integrating multiple module registers at one time, thereby improving the efficiency of generating multiple module register related files from multi-tab information.
[0005] The purpose of the present invention is achieved by the following technical means:
[0006] In a first aspect, the present invention provides a register module generation method based on multi-tab Excel, comprising:
[0007] Get excel table information;
[0008] Generate a json file according to the excel table information;
[0009] Generate the rtl of each module register according to the json file;
[0010] Integrate the rtl of each module register;
[0011] The Excel spreadsheet information includes multiple tabs, and one tab includes information of all registers in a module.
[0012] Preferably, generating the rtl of each module register according to the json file includes:
[0013] Generate a register manual for each module register according to the json file;
[0014] Generate ralf of each module register according to the json file;
[0015] Generate the code of each module register according to the json file and instantiate the common components of the register;
[0016] According to the json file, a macro definition file for each module register is generated.
[0017] Preferably, after generating the ralf of each module register according to the json file, the method further includes:
[0018] The format of RALF generated by each module register is modified, and the RALF of each module register is managed.
[0019] Preferably, the modifying the format of the RALF generated by each module register and managing the RALF of each module register includes:
[0020] Get the ralf generation script;
[0021] Modify the ralf generation script to generate system ralf;
[0022] The system ralf refers to the ralf of each module register, and manages the ralf of each module register.
[0023] Preferably, the step of integrating the RTL of each module register comprises:
[0024] Instantiate each module register into the top-level module;
[0025] Connect the configuration bus of each module register to the configuration bus of the top module;
[0026] Store the rtl of each module register in the same directory;
[0027] A file list is generated to point to the rtl of each module register, and the rtl of each module register is managed.
[0028] Preferably, the step of connecting the configuration bus of each module register to the configuration bus of the top-level module comprises:
[0029] Obtaining the input information and output information of the rtl of each module register;
[0030] Get the configuration bus information of the top-level module;
[0031] Address mapping is set according to the input information of the rtl of each module register, the output information of the rtl of each module register and the configuration bus information of the top-level module to generate a selection signal.
[0032] Preferably, before generating the json file according to the excel table information, the method further includes:
[0033] Perform field check on the Excel table information;
[0034] Determine whether the Excel table information passes the field check;
[0035] When the Excel table information passes the field check, generating the JSON file according to the Excel table information;
[0036] When the Excel table information does not pass the field check, stop generating the register module.
[0037] In a second aspect, the present invention provides a register module generation system based on multi-page tab Excel, applying the above-mentioned register module generation method based on multi-page tab Excel, including:
[0038] Information acquisition module, used to obtain Excel table information;
[0039] A field checking module is used to perform a field check on the Excel table information to determine whether the Excel table information passes the field check;
[0040] A json file generation module is used to generate a json file according to the excel table information;
[0041] The rtl file generation module is used to generate the rtl of each module register according to the json file;
[0042] An rtl file integration module, used for integrating the rtl of each module register;
[0043] The Excel spreadsheet information includes multiple tabs, and one tab includes information of all registers in a module.
[0044] In a third aspect, the present invention provides an electronic device, comprising a processor and a memory, wherein the memory is used to store computer program code, and the computer program code comprises computer instructions. When the processor executes the computer instructions, the electronic device executes the above-mentioned register module generation method based on multi-tab Excel.
[0045] In a fourth aspect, the present invention provides a computer-readable storage medium, in which a computer program is stored. The computer program includes program instructions, and when the program instructions are executed by a processor of an electronic device, the processor executes the above-mentioned register module generation method based on multi-tab Excel.
[0046] Compared with the prior art, the present invention has the following beneficial effects:
[0047] The present invention obtains table information of multiple tabs, converts the table information into a JSON file, generates the RTL of each module register, and integrates the RTL of each module register, which is conducive to generating the RTL and other related files integrating multiple module registers at one time, thereby improving the efficiency of generating multiple module register related files from multiple tab information;
[0048] The present invention generates the RTL of each module register according to the JSON file by running the generation script, which is conducive to the integrated generation of multiple module registers;
[0049] The present invention modifies the RALF generation script, and the generated RALF file references the RALF of each module register, which is beneficial to the RALF integration of the multi-module register verification model;
[0050] The present invention instantiates the module register to the top-level module, manages the module register and the RTL of the top-level module through a file list, is conducive to generating RTL and related files at one time, and generates all files synchronously when the Excel table information is iterated, thereby improving work efficiency;
[0051] The present invention ensures that the generated register module can work as expected by performing field checks on the Excel table information, thereby improving the correctness of the register module generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] 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.
[0053] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0054] Figure 1 A flowchart of a register module generation method based on multi-page Excel provided in this embodiment;
[0055] Figure 2 A schematic diagram of the process of step S30 provided in this embodiment;
[0056] Figure 3 A schematic diagram of the process of step S304 provided in this embodiment;
[0057] Figure 4 A schematic diagram of the process of step S40 provided in this embodiment;
[0058] Figure 5 A schematic diagram of the process of step S402 provided in this embodiment;
[0059] Figure 6 A schematic diagram of the process of step S11 to step S14 provided in this embodiment;
[0060] Figure 7 A schematic diagram of the structure of a register module generation system based on multi-page Excel provided in this embodiment;
[0061] Figure 8 A schematic diagram of the structure of an electronic device provided in this embodiment. DETAILED DESCRIPTION
[0062] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0063] It should be noted that all directional indications (such as up, down, left, right, front, back, etc.) in the embodiments of the present invention are only used to explain the relative position relationship, movement status, etc. between the components in a certain specific posture. If the specific posture changes, the directional indication will also change accordingly.
[0064] In addition, the descriptions of "first", "second", etc. in the present invention are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0065] The present invention obtains table information of multiple tabs, converts the table information into a JSON file, generates an RTL for each module register, and integrates the RTL for each module register, which is conducive to generating the RTL and other related files integrating multiple module registers at one time, thereby improving the efficiency of generating multiple module register related files from multiple tab information.
[0066] The present invention provides a register module generation method based on multi-page excel, such as Figure 1 As shown, the following steps are included:
[0067] S10, obtain excel table information;
[0068] S20, generate a json file based on the excel table information;
[0069] S30, generate the rtl of each module register according to the json file;
[0070] S40, integrating the RTL of each module register;
[0071] The Excel spreadsheet information includes multiple tabs, and one tab includes information of all registers in a module.
[0072] It should be noted that the Excel table is a register table, and its information includes the information of each tab, recording the information of multiple register modules. RTL is the register transfer level, which is a method of describing hardware behavior, describing how registers store data and the data flow between registers, etc. When generating a register module, first extract the information of each tab according to the Excel table, and independently generate the RTL of each register module. The RTL of each register module includes the RTL of multiple registers. The RTL of each register module is integrated to generate the RTL of multiple registers at one time.
[0073] In this embodiment, by obtaining table information of multiple tabs, converting the table information into a json file, generating the rtl of each module register, and integrating the rtl of each module register, it is beneficial to generate the rtl and other related files integrating multiple module registers at one time, thereby improving the efficiency of generating multiple module register related files from multi-tab information.
[0074] In some embodiments, step S30 generates the rtl of each module register according to the json file, such as Figure 2 As shown, the following steps are included:
[0075] S301, generating a register user manual for each module register according to the json file;
[0076] S303, generating ralf of each module register according to the json file;
[0077] S305, generating the code of each module register according to the json file, and instantiating the common components of the register;
[0078] S307, generating a macro definition file for each module register according to the json file.
[0079] It should be noted that when generating a register module, the register description file, i.e., the json file, is used as a basis to generate the rtl and other related files of the module register through the script. The related files include the register user manual, the ralf of the module register, and the macro definition file of the module register. ralf is the verification file of the register verification model, which verifies the read and write behavior and environment of the register. The rtl of each module register can be generated through the reg_gen.py script.
[0080] In this embodiment, by running the generation script, the rtl of each module register is generated according to the json file, which is conducive to the integrated generation of multiple module registers.
[0081] In some embodiments, in step S303, after generating the ralf of each module register according to the json file, such as Figure 2 As shown, the following steps are also included:
[0082] S304, modifying the format of ralf generated by each module register, and managing the ralf of each module register.
[0083] In some embodiments, step S304 modifies the format of the ralf generated by each module register and manages the ralf of each module register, such as Figure 3 As shown, the following steps are included:
[0084] S3041, obtain the ralf generation script;
[0085] S3042, modify the ralf generation script to generate system ralf;
[0086] S3043, the system ralf refers to the ralf of each module register, and the ralf of each module register is managed.
[0087] It should be noted that for the integration of register verification files, the format of ralf file generation needs to be modified. The specific operation is to first generate the ralf of each module register through the reg_gen.py script, modify the ralf.py script nested in the reg_gen.py script, i.e., the ralf generation script, to generate the system.ralf file, i.e., the system ralf, and reference the ralf of each module register in the system.ralf. After that, the system ralf can be converted into register model code through the verification tool.
[0088] In this embodiment, by modifying the RALF generation script, the generated RALF file references the RALF of each module register, which is beneficial to the RALF integration of the multi-module register verification model.
[0089] In some embodiments, step S40 integrates the rtl of each module register, such as Figure 4 As shown, the following steps are included:
[0090] S401, instantiate each module register to the top-level module;
[0091] S402, connecting the configuration bus of each module register to the configuration bus of the top-level module;
[0092] S403, storing the rtl of each module register in the same directory;
[0093] S404, generating a file list pointing to the rtl of each module register, and managing the rtl of each module register.
[0094] It should be noted that the rtl of each module register can be integrated through the integration script reg_release.py. Specifically, multiple module registers are instantiated into a top-level file reg_top.v, and the configuration bus of each module register is connected to the configuration bus of the top-level module. After that, all rtl and reg_top.v can be copied to a folder, and finally a filelist file is generated, which points to all rtl to complete the integration.
[0095] In this embodiment, by instantiating the module register to the top-level module and managing the module register and the RTL of the top-level module through a file list, it is beneficial to generate RTL and related files at one time, and all files are generated synchronously when the Excel table information is iterated, thereby improving work efficiency.
[0096] In some embodiments, step S402 connects the configuration bus of each module register to the configuration bus of the top module, such as Figure 5 As shown, the following steps are included:
[0097] S4021, obtaining the input information and output information of the rtl of each module register;
[0098] S4022, obtaining configuration bus information of the top-level module;
[0099] S4023, set address mapping according to the input information of the rtl of each module register, the output information of the rtl of each module register and the configuration bus information of the top-level module, and generate a selection signal.
[0100] It should be noted that by running the integrated script reg_release.py, the input and output information of the rtl of all module registers is extracted, and the address mapping of the configuration bus signal of reg_top, i.e. the top-level module, and the relevant input and output setting of the module register domain is printed, and the selection signals of different modules are processed according to the address mapping to complete the connection between the configuration bus of the register and the configuration bus of the top-level module.
[0101] In some embodiments, step S20, before generating a json file based on the excel table information, such as Figure 6 As shown, it also includes:
[0102] S11, check the fields of the Excel table information;
[0103] S12, judging whether the Excel table information passes the field check;
[0104] S13, when the Excel table information passes the field check, a JSON file is generated according to the Excel table information;
[0105] S14, when the Excel table information does not pass the field check, stop generating the register module.
[0106] It should be noted that field checking includes defining the register model, generating the register abstraction layer, writing the verification environment, writing test cases, formal verification and simulation verification, which involves the definition and generation of registers, the construction of the test environment and the writing of test cases. When the register information passes the field check, it means that the register can work under various conditions, and when the register information does not pass the field check, the register information needs to be reviewed again.
[0107] In this embodiment, by performing field check on the Excel table information, it is ensured that the generated register module can work as expected, thereby improving the correctness of the register module generation.
[0108] The present invention provides a register module generation system based on multi-page tab Excel, and applies the above-mentioned register module generation method based on multi-page tab Excel, such as Figure 7 As shown, including:
[0109] Information acquisition module, used to obtain Excel table information;
[0110] The field check module is used to check the fields of the Excel table information and determine whether the Excel table information passes the field check;
[0111] JSON file generation module, used to generate JSON files based on Excel table information;
[0112] The rtl file generation module is used to generate the rtl of each module register according to the json file;
[0113] RTL file integration module, used to integrate the RTL of each module register;
[0114] The Excel spreadsheet information includes multiple tabs, and one tab includes information of all registers in a module.
[0115] In this embodiment, by obtaining table information of multiple tabs, converting the table information into a json file, generating the rtl of each module register, and integrating the rtl of each module register, it is beneficial to generate the rtl and other related files integrating multiple module registers at one time, thereby improving the efficiency of generating multiple module register related files from multi-tab information.
[0116] It should be understood that the disclosed system can be implemented in other ways. For example, the system embodiments described above are merely schematic. For example, the division of the above modules is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, each functional module can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules.
[0117] The present invention provides an electronic device 2, such as Figure 8 As shown, a processor 21 and a memory 22, the memory 22 is used to store computer program codes, the computer program codes include computer instructions, when the processor 21 executes the computer instructions, the electronic device executes the above-mentioned register module generation method based on multi-page tab Excel.
[0118] The electronic device 2 includes a processor 21, a memory 22, an output device 23, and an input device 24. The processor 21, the memory 22, the output device 23, and the input device 24 are coupled via a connector, and the connector includes various interfaces, transmission lines, or buses, etc., which are not limited in the embodiments of the present invention. It should be understood that in various embodiments of the present invention, coupling refers to mutual connection in a specific manner, including direct connection or indirect connection through other devices, for example, through various interfaces, transmission lines, buses, etc.
[0119] The processor 21 may be one or more graphics processing units (GPUs). When the processor 21 is a GPU, the GPU may be a single-core GPU or a multi-core GPU. Optionally, the processor 21 may be a processor group consisting of multiple GPUs, and the multiple processors are coupled to each other via one or more buses. Optionally, the processor 21 may also be other types of processors, etc., which are not limited in the embodiments of the present invention.
[0120] The memory 22 can be used to store computer program instructions and various computer program codes including program codes for executing the scheme of the present invention. Optionally, the memory 22 includes but is not limited to random access memory (RAM), read-only memory (ROM), erasable programmable read only memory (EPROM), or portable read only memory (CD-ROM), and the memory 22 is used for related instructions and data.
[0121] The input device 24 is used to input data and / or signals, and the output device 23 is used to output data and / or signals. The output device 23 and the input device 24 can be independent devices or an integrated device.
[0122] The present invention provides a computer-readable storage medium, in which a computer program is stored. The computer program includes program instructions. When the program instructions are executed by a processor of an electronic device, the processor executes the above-mentioned register module generation method based on multi-page tab Excel.
[0123] The above are only specific embodiments of the present invention, which enable those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A register module generation method based on multi-tab Excel, characterized in that: include: Get excel table information; Generate a json file according to the excel table information; Generate the rtl of each module register according to the json file; Integrate the rtl of each module register; The Excel table information includes multiple tabs, and one tab includes information of all registers in a module; According to the json file, the rtl of each module register is generated, including: Generate a register manual for each module register according to the json file; Generate ralf of each module register according to the json file; Generate the code of each module register according to the json file and instantiate the common components of the register; Generate a macro definition file for each module register according to the json file; The step of integrating the RTL of each module register comprises: Instantiate each module register into the top-level module; Connect the configuration bus of each module register to the configuration bus of the top module; Store the rtl of each module register in the same directory; Generate a file list pointing to the rtl of each module register, and manage the rtl of each module register; The step of connecting the configuration bus of each module register to the configuration bus of the top module includes: Obtaining the input information and output information of the rtl of each module register; Get the configuration bus information of the top-level module; Address mapping is set according to the input information of the rtl of each module register, the output information of the rtl of each module register and the configuration bus information of the top-level module to generate a selection signal.
2. A register module generation method based on multi-tab Excel according to claim 1, characterized in that: After generating the ralf of each module register according to the json file, the method further includes: The format of RALF generated by each module register is modified, and the RALF of each module register is managed.
3. A register module generation method based on multi-tab Excel according to claim 2, characterized in that: The modifying the format of the RALF generated by each module register and managing the RALF of each module register includes: Get the ralf generation script; Modify the ralf generation script to generate system ralf; The system ralf refers to the ralf of each module register, and manages the ralf of each module register.
4. The register module generation method based on multi-tab Excel according to claim 1, characterized in that: Before generating the json file according to the excel table information, the method further includes: Perform field check on the Excel table information; Determine whether the Excel table information passes the field check; When the Excel table information passes the field check, generating the JSON file according to the Excel table information; When the Excel table information does not pass the field check, stop generating the register module.
5. A register module generation system based on multi-tab Excel, applying a register module generation method based on multi-tab Excel as claimed in any one of claims 1 to 4, characterized in that: include: Information acquisition module, used to obtain Excel table information; A field checking module is used to perform a field check on the Excel table information to determine whether the Excel table information passes the field check; A json file generation module is used to generate a json file according to the excel table information; The rtl file generation module is used to generate the rtl of each module register according to the json file; An rtl file integration module, used for integrating the rtl of each module register; The Excel spreadsheet information includes multiple tabs, and one tab includes information of all registers in a module.
6. An electronic device, characterized in that: The electronic device comprises a processor and a memory, wherein the memory is used to store computer program codes, and the computer program codes include computer instructions. When the processor executes the computer instructions, the electronic device executes a register module generation method based on multi-tab Excel as described in any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions. When the program instructions are executed by a processor of an electronic device, the processor executes a register module generation method based on multi-tab Excel as described in any one of claims 1 to 4.
Citation Information
Patent Citations
method and system for automatically generating a ruf file
CN109918343A
Conversion control method for file for describing register
CN113065315A