A method and device for visually generating design verification code based on XML

By adding and parsing XML attributes in the chip architecture design drawing to generate RTL and verification environment code, it solves the problem of non-standard expression in the chip architecture design drawing and achieves more efficient and high-quality code development with strong scalability.

CN117724686BActive Publication Date: 2024-10-08WUXI STARS MICRO SYSTEM TECHNOLOGIES CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311644079.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-01
Publication Date
2024-10-08
Estimated Expiration
2043-12-01

AI Technical Summary

Technical Problem

The expression formats of chip architecture design drawings in the existing technology are different, resulting in irregular information transmission, and there is a risk of loss or miscommunication during the information transmission process.

Method used

Using an XML-based visual generation method of design verification code, by adding and parsing attributes and definition information in the chip architecture design drawing file, the RTL design code and verification environment code are generated, the expression of the architecture diagram is standardized, and predefined code generation rules and XML parsing tools extract and process graphics attributes and generate code in a standard format.

Benefits of technology

It improves the efficiency and quality of code development, standardizes the expression of architecture diagrams, has strong scalability, and reduces the risk of loss and miscommunication in information transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117724686B_ABST
    Figure CN117724686B_ABST
Patent Text Reader

Abstract

The present invention provides a method and device for visually generating design verification code based on XML, the method comprising: adding the attributes and definition information of each graphic in an XML-based chip architecture design drawing file; parsing the chip architecture design drawing file to extract the attributes and definition information; and generating chip RTL design code and verification environment code based on the attributes and definition information and predefined code generation rules. The present invention standardizes the expression of architecture diagrams and improves the efficiency and quality of code development.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of code generation, and in particular relates to a method and device for visually generating design verification codes based on XML. Background Art

[0002] The chip front-end development process mainly includes document development, code development and code testing. The most important information carrier in the document is the chip architecture design diagram, which is also the most direct and effective form of conveying the architecture design intent. When conveying the design intent downward, the accuracy of the original information transmission has high requirements on the ability of text expression. Figure 1 It is a chip front-end development flow chart based on the existing technology. The architect Arch submits the functional specification FuncSpec and the architecture specification ArchSpec to the design engineer DE to form the design specification DesignSpec. The design engineer DE writes RTL according to the design specification DesignSpec and passes the design specification DesignSpec to the verification engineer DV to form the test point TestPoint and the test platform TestBench. However, the expression formats of chip architecture design drawings in the existing technology are different, resulting in non-standard information transmission and the risk of loss or miscommunication during information transmission. Summary of the invention

[0003] The purpose of the present invention is to provide a method and device for visually generating design verification code based on XML, aiming to solve the problem of generating design and verification code from chip architecture design drawings and speed up the process from design specifications to code implementation.

[0004] According to a first aspect of the present invention, there is provided a method for visually generating a design verification code based on XML, comprising:

[0005] Add the attributes and definition information of each graphic in the XML-based chip architecture design file;

[0006] Parsing the chip architecture design file to extract the attributes and definition information;

[0007] Based on the attributes and definition information and predefined code generation rules, chip RTL design code and verification environment code are generated.

[0008] Preferably, the attributes and definition information include:

[0009] The upper level module of the current module;

[0010] Port description file location;

[0011] Graphics attribute type;

[0012] A refined implementation diagram of the current graph;

[0013] Whether to generate a verification environment;

[0014] Verify the environment classification.

[0015] Preferably, the parsing of the chip architecture design file further includes:

[0016] Perform an exception check on the attribute value and output the exception information;

[0017] Extracting XML information, removing XML format information, and retaining the attribute definition;

[0018] Parse the port description file, generate port signal definition and verification environment component code;

[0019] Extract the hierarchical relationship and connection relationship between modules and present them in a tree form;

[0020] Print the function relationship in JSON format and output the configuration file in JSON format.

[0021] Preferably, the port description file uses an Excel file type.

[0022] Preferably, the file types of the RTL code and the verification environment code are .v and .sv respectively.

[0023] According to a second aspect of the present invention, there is provided an XML-based design verification code visual generation device, comprising:

[0024] An attribute definition unit, used to add attribute and definition information of each graphic in an XML-based chip architecture design file;

[0025] An attribute parsing unit, used to parse the chip architecture design drawing file and extract the attribute and definition information;

[0026] The code generation unit is used to generate chip RTL design code and verification environment code based on the attribute and definition information and predefined code generation rules.

[0027] Compared with the prior art, the technical solution of the present invention has the following advantages:

[0028] The XML-based design verification code visualization generation method and device of the present invention standardizes the expression mode of architecture diagrams, improves the code development efficiency and quality, and has strong scalability.

[0029] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or be understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures and processes indicated in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] 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. It is obvious that the drawings described below are certain embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0031] Figure 1 It is a chip front-end development flow chart based on existing technology.

[0032] Figure 2 It is an overall flow chart of the method for visually generating design verification code of XML according to the present invention.

[0033] Figure 3 It is a module architecture diagram of the XML design verification code visualization generation method according to the present invention.

[0034] Figure 4 It is a schematic diagram of attribute and definition information according to the present invention.

[0035] Figure 5 It is a schematic diagram of graphics and corresponding attributes defined according to the present invention.

[0036] Figure 6 Schematic diagram of a port description file according to the present invention.

[0037] Figure 7 is a schematic diagram of a code snippet generated according to the present invention.

[0038] Figure 8 It is a schematic diagram of the verification environment structure generated according to the present invention. DETAILED DESCRIPTION

[0039] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are 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.

[0040] Based on the above analysis, the present invention proposes an XML-based design verification code visualization generation method and device, which aims to add attribute information to the chip architecture design drawing through a plurality of pre-defined rules, use preset tools to identify attribute definitions, organize the module nesting relationship expressed in the chip architecture design drawing, and parse the port signals in the document defined in the interface attributes, so as to generate code or code fragments according to the code generation rules.

[0041] See also Figure 2 Flowchart and Figure 3 The XML-based design verification code visualization generation method provided by the present invention includes:

[0042] Step 101: Add the attributes and definition information of each graphic in the XML-based chip architecture design file.

[0043] like Figure 4 As shown, in the present invention, multiple graphics are defined, and different attributes are given to each graphic. Each graphic can be used as a module or a code block. The left figure shows that the top module includes two modules, SMA and SMB, and also includes their interface and module description information and the attributes of the top module. The right figure shows that the SMA module includes the SMA1 and SMB1 modules, and also includes their interface and module description information and the attributes of the SMA module.

[0044] Figure 5 It is a schematic diagram of the graphs and corresponding attributes defined according to the present invention. Specifically, the attributes defined for each graph are shown in Table 1:

[0045] Table 1

[0046]

[0047] For example, using Figure 5 The queue graph in can indicate the use of a queue, and this graph has the testbench_level attribute, and the selectable items for this attribute are UT / BT / IT / ST.

[0048] Step 102: Parse the chip architecture design drawing file to extract the attributes and definition information.

[0049] The chip architecture design diagram is in .xml format, and multiple layers are involved in the graphics. This article assumes that only layer 0 is actually useful information, including information about the relationship between graphics. The graphics in other layers are only used to describe additional information, which is used to more clearly express the data flow between systems, scene descriptions, and other added information. Specifically, the XML parsing tool is implemented through a programming language, mainly including: performing anomaly checks on attribute values ​​and outputting abnormal information. Extracting XML information, removing useless information such as graphic style or format in XML, and retaining the attribute definitions defined above. Parsing the port description file, generating port signal definitions and verification environment component codes, etc. The XML information is extracted, specifically including:

[0050] Parse the XML format file and extract the graphic attribute information represented in the XML; check the graphic attribute information and report the error information if there is any abnormal information, which is used to analyze and locate the cause of the error. The error information includes: illegal attribute value, invalid attribute value, unrecognizable XML file, parsing interface description document (type document is Excel); through layer recognition, remove invalid layers, identify the relationship between graphics in layer 0, and reorganize the hierarchical relationship of the entire module. Use the printing function to print the above-identified hierarchical relationship in JSON format for easy viewing. Generate code or code snippets and corresponding file list files based on the information obtained.

[0051] The XML parsing tool further implements the following functions:

[0052] The acquired information is stored in a file in JSON format for easy viewing or as input for other tools; code or code snippets, as well as corresponding file list files, are generated based on the acquired information. Any abnormalities that may exist during the parsing of input information or the generation of code are handled, and the error information is displayed on the screen or recorded in a log file for easy analysis.

[0053] The port description file uses the Excel file type to express all the information of the module port signal, such as Figure 6 As shown. The graph represents the modules in the final output code, and the relationship between the graphs is the relationship between the modules. The hierarchical relationship and connection relationship between modules are extracted and presented in a tree form. By printing the function, the function relationship is output and printed in JSON format, and the configuration file in JSON format is output as the configuration input of other parsing tools.

[0054] Step 103: Generate chip RTL design code and verification environment code based on the attribute and definition information and predefined code generation rules.

[0055] Using programming language, the chip RTL design code and verification environment code of all modules are generated based on the attribute definition, that is, a file list (.f file) with the correct compilation order is generated. The file types of RTL code and code snippet are .v and .vh. The file types of verification environment code are .sv and .svh respectively.

[0056] The present invention uses XML-based drawing tools to define the attributes of graphics, combined with the recording and expression of design port information, to develop parsing tools and code generation tools, which are used to convert XML information into a universal and easy-to-read JSON format, extract the information required by designers or verifiers to write codes, including the hierarchical relationship and connection relationship between modules in the system, and realize the conversion of system design information expressed by graphics into design codes or code snippets. Use JSON files to verify the structure description of Testbench, such as Figure 7 As shown in Figure 1. Testbench is a verification environment used for chip EDA verification.

[0057] The following is a detailed description of the functions of the interface parsing tool and the code generation tool with reference to specific examples.

[0058] The interface parsing tool performs a validity check on the format of the input document and the validity check on the table content of the input document. The parsing process is presented on the display screen, and the relevant information is stored in a JSON format file by generating an interface. The interface information is formatted and code is generated as required. The main requirements are for RTL interface definition and interface definition for the verification environment. Generate the interface definition code required by the RTL code and output it to other tools for calling. At the same time, generate the interface definition code required by the verification environment code and output it to other tools for calling. When the input of the tool is illegal, the tool outputs an error message to feedback to other tools.

[0059] The code generation tool performs a validity check on the input document format. The document format can only be a JSON document or a YAML format document. The input document content is also checked for validity, including but not limited to: the key value is empty; it contains illegal data types (defined according to the input document format); an RTL file is generated based on the input information, and the code content includes: the definition of all modules and port signal descriptions, instantiation of all sub-modules within the module, definition of connection relationships between modules, definition of connection signal lines, completion of signal connections, and partial logic function code. The logic function code is mainly specified in the defined graphics. If this graphic code is a code with complete logic functions, the code can be directly presented in the file. Finally, according to the following Figure 7 The input information shown generates the verification environment code, including Figure 8 The verification environment structure is shown in the figure. The verification environment code contains the following parts:

[0060] a. Universal Verification Component (UVC), which further comprises the following components:

[0061] i. Incentive description components (transaction and sequence);

[0062] ii. a stimulus driver component, used to drive the generated stimulus to the hardware interface;

[0063] iii. stimulus acquisition component (monitor), used to collect interface stimulus information from the hardware interface;

[0064] iv. The stimulus scheduling and delivery component (sequencer) is responsible for the scheduling from the stimulus description component to the stimulus driving component;

[0065] b. Module functional model component (RM);

[0066] c. Output result comparator component (SCB);

[0067] d. Verify the component manager (ENV or SUB_ENV), where when an ENV is included in another ENV, the included ENV acts as a subcomponent manager SUB_ENV of another ENV;

[0068] e. File listing of all component files.

[0069] The steps to use the XML parsing tool are as follows:

[0070] The parsing tool inputs the XML file and performs a validity check on the file format and attribute values. If the validity check passes, the truly useful layer information is stripped out. If the check fails, the tool exits and an error message is reported on the screen. After the check passes, the hierarchical relationship between the modules represented by the entire graph is obtained, and the obtained information is displayed on the screen and saved in a JSON file for subsequent functions as input. At the same time, the interface information of the specified interface description file is obtained. The file content format is as follows: Figure 6 As shown, the interface parsing tool can obtain the interface definition information, or perform corresponding processing for abnormal situations that occur during the parsing process. The abnormal situations include illegal input interface description document format, illegal internal input value of the interface document, and the input interface description document does not exist. Use the code generation function to generate RTL code snippets and verification code snippets as needed. If an exception is encountered during the execution of the above steps, the exception handling function is called to display the error message on the screen for user analysis.

[0071] It can be seen that the XML-based design verification code visualization generation method proposed in the present invention has the following advantages compared with the prior art: it standardizes the expression of architecture diagrams, improves code development efficiency and quality, and has strong scalability.

[0072] Accordingly, the present invention provides, in a second aspect, a device for visually generating a design verification code based on XML, comprising:

[0073] An attribute definition unit, used to add attribute and definition information of each graphic in an XML-based chip architecture design file;

[0074] An attribute parsing unit, used to parse the chip architecture design drawing file and extract the attribute and definition information;

[0075] The code generation unit is used to generate chip RTL design code and verification environment code based on the attribute and definition information and predefined code generation rules.

[0076] The above-mentioned device can be implemented through the XML-based design verification code visualization generation method provided by the embodiment of the first aspect above. The specific implementation method can be found in the description of the embodiment of the first aspect, which will not be repeated here.

[0077] It is understood that the data structures, names and parameters described in the above embodiments are only examples. Those skilled in the art can also make easily conceivable combinations and adjustments to the structural features of the above embodiments according to the use requirements, and the concept of the present invention should not be limited to the specific details of the above examples.

[0078] Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent substitutions for some of the technical features therein; and these modifications or substitutions do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for visually generating design verification code based on XML, characterized in that: include: Adding attributes and definition information of each graphic in the XML-based chip architecture design file; the graphics include multiplexer logic graphics, queue logic code graphics, linked list implementation logic graphics, FIFO implementation logic graphics, scheduler module graphics, function module graphics, cache module graphics and module multiple instantiation graphics; The attributes and definition information include: Parent represents the upper level module of the current module in the entire hierarchy, Port represents the description file location of the current port, Type represents the graph attribute type, link represents the detailed implementation graph describing the current graph, Create_testbench represents whether to generate a verification environment, and Testbench_level represents the verification environment level; Parsing the chip architecture design file to extract the attributes and definition information; Based on the attribute and definition information and the predefined code generation rules, the chip RTL design code and the verification environment code are generated; the verification environment code includes a general verification component, a module function model component, an output result comparator component, a verification component manager and a file list of all component files, wherein the general verification component further includes a stimulus description component, a stimulus drive component, a stimulus acquisition component and a stimulus scheduling and delivery component; wherein: A stimulus driving component, used to drive the generated stimulus to a hardware interface; The stimulus collection component is used to collect interface stimulus information from the hardware interface; The stimulus scheduling and delivery component is used to schedule the generation of stimulus description components to the stimulus driving components; The parsing of the chip architecture design file further includes: Perform an exception check on the attribute value and output the exception information; Extract XML information, remove XML format information, and retain attribute definitions; Parse the port description file, generate port signal definition and verification environment component code; Extract the hierarchical relationship and connection relationship between modules and present them in a tree form; Print the function relationship in JSON format and output a configuration file in JSON format; use the JSON file to verify the structure description of the Testbench; the Testbench is a verification environment for chip EDA verification; Generate code and corresponding file list based on the information obtained; handle abnormal situations in the process of parsing input information or generating code, and display error information on the screen or record it in a file.

2. The XML-based design verification code visualization generation method according to claim 1, characterized in that: The port description file uses an Excel file type.

3. The XML-based design verification code visualization generation method according to claim 1, characterized in that: The file types of the RTL design code and the verification environment code are .v and .sv respectively.

4. A device for visually generating design verification codes based on XML, characterized in that: include: An attribute definition unit, used to add attribute and definition information of each graphic in an XML-based chip architecture design file; An attribute parsing unit, used to parse the chip architecture design file and extract the attribute and definition information; the graphs include a multiplexer logic graph, a queue logic code graph, a linked list implementation logic graph, a FIFO implementation logic graph, a scheduler module graph, a function module graph, a cache module graph, and a module multiple instantiation graph; The attributes and definition information include: Parent represents the upper level module of the current module in the entire hierarchy, Port represents the description file location of the current port, Type represents the graph attribute type, link represents the detailed implementation graph describing the current graph, Create_testbench represents whether to generate a verification environment, and Testbench_level represents the verification environment level; A code generation unit is used to generate chip RTL design code and verification environment code based on the attribute and definition information and predefined code generation rules; the verification environment code includes a general verification component, a module function model component, an output result comparator component, a verification component manager and a file list of all component files, wherein the general verification component further includes a stimulus description component, a stimulus drive component, a stimulus acquisition component and a stimulus scheduling and delivery component; wherein: A stimulus driving component, used to drive the generated stimulus to a hardware interface; The stimulus collection component is used to collect interface stimulus information from the hardware interface; The stimulus scheduling and delivery component is used to schedule the generation of stimulus description components to the stimulus driving components; The attribute parsing unit is further used to: Perform an exception check on the attribute value and output the exception information; Extract XML information, remove XML format information, and retain attribute definitions; Parse the port description file, generate port signal definition and verification environment component code; Extract the hierarchical relationship and connection relationship between modules and present them in a tree form; Print the function relationship in JSON format and output a configuration file in JSON format; use the JSON file to verify the structure description of the Testbench; the Testbench is a verification environment for chip EDA verification; Generate code and corresponding file list based on the information obtained; handle abnormal situations in the process of parsing input information or generating code, and display error information on the screen or record it in a file.

5. The XML-based design verification code visualization generation device according to claim 4, characterized in that: The port description file uses an Excel file type.

6. The XML-based design verification code visualization generation device according to claim 5, characterized in that: The file types of the RTL design code and the verification environment code are .v and .sv respectively.