Method and device for generating function coverage rate based on variable-length data packet and medium

By setting the packet sequence number and length variables in the chip code, the uncertainty-length data packets are stored in the fixed-length cache area, which solves the problem of information dispersed in the chip code and improves the collection efficiency of functional coverage.

CN120562354AActive Publication Date: 2025-08-29METAX INTEGRATED CIRCUITS (SHANGHAI) CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202511074755.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-01
Publication Date
2025-08-29
Estimated Expiration
2045-08-01

AI Technical Summary

Technical Problem

The prior art is difficult to quickly and accurately locate the packet headers and information of uncertain data packets, resulting in low chip function coverage collection efficiency.

Method used

By setting the packet sequence number and length variables, reading the packet file header to obtain the length, and storing it in the fixed-length cache area, realizing the coverage of the automatic generation function of uncertain-length packets.

Benefits of technology

The automatic generation function coverage of uncertain data packets is realized, and the efficiency of collecting chip function coverage is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120562354A_ABST
    Figure CN120562354A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of chips, in particular to a method, equipment and medium for generating a function coverage rate based on variable-length data packets, and the method comprises the following steps: S1, initially setting i = 1, Ci = 0 and Li = 0; s2, when the file header of the ith data packet is read, obtaining the length Ui of the data packet, and updating Li = Ui; s3, reading is continued, and Ci = Ci + Bi is updated; s4, storing the read data into the Di, and when the Di is full or the Ci is equal to Li, stopping continuously storing the data into the Di; s5, when Ci is equal to Li, judging whether the data packet in the chip code is completely read, if so, executing S6, otherwise, updating the next to-be-read position to the current initial position, updating i to be equal to i + 1, updating Ci to be equal to 0 and Li to be equal to 0, and returning to S2; and S6, generating a function coverage rate based on the data of all the data packets in the preset fixed-length cache region. According to the invention, the collection efficiency of the chip function coverage rate is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of chip technology, and in particular to a method, device and medium for generating functional coverage based on variable-length data packets. Background Art

[0002] During chip development, software distributes multiple data packets to the chip. These packets come in various types and have varying lengths. Before sending a packet, the software prepares the packet data in memory and then notifies the chip's main control module to retrieve it. The chip's main control module stores the retrieved packet content in a corresponding buffer. The firmware then retrieves the packet header, unpacks it, and distributes it to multiple hardware engines. Under the firmware's instructions, the engines read fixed-length data from the buffer and execute it. However, because variable-length packets may correspond to different buffer levels and may be read by different engines, the data in these packets is scattered across multiple locations in the chip code. Therefore, existing techniques cannot accurately and quickly locate the headers and information within these packets, complicating coverage collection during verification and reducing the efficiency of chip functional coverage collection. Therefore, how to automatically generate functional coverage based on variable-length packets and improve chip functional coverage collection efficiency has become a pressing technical challenge. Summary of the Invention

[0003] The purpose of the present invention is to provide a method, device and medium for generating functional coverage based on variable-length data packets, thereby realizing automatic generation of functional coverage based on variable-length data packets and improving the collection efficiency of chip functional coverage.

[0004] According to a first aspect of the present invention, a method for generating functional coverage based on variable-length data packets is provided, comprising: Step S1, initially set the package number i=1, set the chip code starting point to the current starting position, set the calculation variable C i =0, length variable L i =0; Step S2: Read the chip code from the current starting position. When the i-th data packet header is read, obtain the data packet length U from the i-th data packet header. i , update L i =U i ; Step S3, continue to read the chip code and update C i =C i +B i , B i is the length of the i-th data packet that has been read; Step S4: store the read data packet i into the i-th buffer unit D of the preset fixed-length buffer area. i In, when D i Full or C i =L i When i Continue to store the data of the i-th data packet in the preset fixed-length buffer area, and the length of each buffer unit is E; Step S5: When C i =L i When the chip code is read, it is determined whether the data packet is read. If so, step S6 is executed. Otherwise, the next position to be read is updated to the current starting position, i=i+1 is updated, and C is updated. i =0,L i =0, return to step S2; Step S6: Generate functional coverage based on all data packet data in the preset fixed-length buffer area.

[0005] According to a second aspect of the present invention, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executed by the at least one processor, the instructions being configured to execute the method described in the first aspect of the present invention.

[0006] According to a third aspect of the present invention, a computer-readable storage medium is provided, storing computer-executable instructions, wherein the computer instructions are used to execute the method according to the first aspect of the present invention.

[0007] The present invention has significant advantages and beneficial effects compared to the prior art. By utilizing the above technical solution, the method, device, and medium provided by the present invention for generating functional coverage based on variable-length data packets can achieve considerable technological advancement and practicality, and has wide industrial application value, with at least the following beneficial effects: The present invention can reintegrate information scattered in the chip code, transfer variable-length data packets to a fixed-length buffer, retain the valid control bit information in the data packets, realize the automatic generation of functional coverage based on variable-length data packets, and improve the collection efficiency of chip functional coverage. BRIEF DESCRIPTION OF THE DRAWINGS

[0008] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0009] Figure 1A flow chart of a method for generating functional coverage based on variable-length data packets provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0010] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. 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 those skilled in the art without making any creative efforts shall fall within the scope of protection of the present invention.

[0011] The embodiment of the present invention provides a method for generating functional coverage based on variable-length data packets, such as Figure 1 As shown, including: Step S1, initially set the package number i=1, set the chip code starting point to the current starting position, set the calculation variable C i =0, length variable L i =0.

[0012] It should be noted that data packets are sent in sequence, so they are also arranged in sequence in the chip code. However, since data packets are of variable length, it is difficult to directly locate the position of each data packet in the chip code.

[0013] Step S2: Read the chip code from the current starting position. When the i-th data packet header is read, obtain the data packet length U from the i-th data packet header. i , update L i =U i .

[0014] Step S3, continue to read the chip code and update C i =C i +B i , B i is the length of the i-th data packet that has been read.

[0015] Step S4: store the read data packet i into the i-th buffer unit D of the preset fixed-length buffer area. i In, when D i Full or C i =L i When i The i-th data packet data is continued to be stored in the buffer, and the length of each buffer unit in the preset fixed-length buffer is E.

[0016] It should be noted that, through the above steps, each variable-length data packet can be read out, and the valid control bit information of each variable-length data packet can be stored in a fixed-length buffer area.

[0017] Step S5: When Ci =L i When the chip code is read, it is determined whether the data packet is read. If so, step S6 is executed. Otherwise, the next position to be read is updated to the current starting position, i=i+1 is updated, and C is updated. i =0,L i =0, return to step S2.

[0018] Step S6: Generate functional coverage based on all data packet data in the preset fixed-length buffer area.

[0019] It should be noted that, through steps S1 to S5, the variable-length data packets in the chip code can be converted into a fixed-length format, which facilitates the collection of functional coverage.

[0020] In order to ensure that valid control bit information of each data packet in the chip code can be stored in a fixed-length buffer, it is necessary to set a reasonable buffer unit length of the fixed-length buffer. As an embodiment, the method further includes: Step S10: Get the data packet type set {P1, P2, ..., P n ,...,P N}, P n The nth data packet type, where n ranges from 1 to N, and N is the total number of data packet types corresponding to the chip code.

[0021] Step S20: Get each P n The corresponding effective control bit length Q n .

[0022] For example, if the total length of a variable-length data packet is 400 double words (dw), but only the first 200 dw are valid control bits, then the valid control bit length for the data packet is 200 dw. Valid control bits refer to the data packet header and control bits related to functional coverage.

[0023] Step S30: Q n The maximum value in is determined as the cache unit length E of the preset fixed-length cache area.

[0024] It should be noted that Q n The maximum value in is determined as the cache unit length E of the preset fixed-length cache area, which can ensure that the information of the valid control bits of each variable-length data packet can be stored in the cache unit of the preset fixed-length cache area.

[0025] As an embodiment, step S2 includes: Step S21: Read the chip code from the current starting position. When the i-th data packet header is read, the firmware parses the i-th data packet header to obtain the data packet length L. i And the read module sequence {R1 i ,R2 i ,...,R j i ,...,R f(i) i}, R j i For the i-th reading module that reads the i-th data packet, R j i is a firmware or a hardware engine, the value of i ranges from 1 to f(i), and f(i) is the total number of read modules that read the i-th data packet.

[0026] It should be noted that the data packet headers are read and parsed by the firmware, and other bit fields outside the data packet header may be read by the firmware or by one or more hardware engines. The reading module sequence corresponding to each data packet is obtained through step S21.

[0027] As an embodiment, step S3 includes: Step S31, continue to read the chip code, obtain each R j i The length W of the i-th data packet read j i .

[0028] Among them, each R is monitored at the same time j i , record the length W of each,i,data packet that has been read j i .

[0029] Step S32: Acquire .

[0030] Step S33, update C i =C i +B i .

[0031] It should be noted that through C i The total length of the i-th data packet read is recorded in real time.

[0032] As an embodiment, step S4 includes: Step S41: store the read data packet i into the i-th buffer unit D of the preset fixed-length buffer area. i In. If L i ≥E, then when D i When full, stop sending to Di Continue to store the data of the i-th data packet in it. If L i <E, then when C i =L i Stop storing the data of the i-th data packet in D i Continue.

[0033] It should be noted that if L i >E, then all the data of the i-th data packet cannot be stored in the i-th cache unit D i However, the valid control bits of the data of the i-th data packet can all be stored in the i-th cache unit D i When D i is full, stop storing the data of the i-th data packet in D i Continue, but continue to read the data of the i-th data packet until the data of the i-th data packet is read completely, and then enter the processing flow of the next data packet. If L i =E, then all the data of the i-th data packet can be stored in the i-th cache unit D i When D i is full, stop storing the data of the i-th data packet in D i Continue. If L i <E, then the i-th data packet cannot fill the i-th cache unit D i When C i =L i Stop storing the data of the i-th data packet in D i Continue.

[0034] As an embodiment, if the total number I of data packets in the chip code can be obtained in advance, then in step S5, determining whether the data packets in the chip code have been read completely includes: Step S51: If i = I, it is determined that the data packets in the chip code have been read completely, where I is the preset total number of data packets in the chip code. If i < I, it is determined that the data packets in the chip code have not been read completely.

[0035] As an embodiment, step S5, determining whether the data packets in the chip code have been read completely, includes: Step C51: Determine whether there is a data packet code in the unread chip code. If so, it is determined that the data packets in the chip code have not been read completely. Otherwise, it is determined that the data packets in the chip code have been read completely.

[0036] As an embodiment, step S6 includes: Step S61: Analyze the data packet header information in each D i to obtain the data packet type information corresponding to D i

[0037] Step S62: Obtain D​i The valid data field information of the data packet.

[0038] It should be noted that D i The data stored in may include invalid data bit field information. During the coverage collection process, only D i The valid data bit field information of the data packet is sufficient.

[0039] Step S63: Based on D i The corresponding data packet type information is obtained from the preset data packet configuration file library. i The corresponding data packet configuration file.

[0040] It should be noted that the configuration file of the data packet includes information such as the packet header, the bit range of each digital field, and the corresponding function point where the data is located.

[0041] Step S64: Based on D i Get the corresponding data packet configuration file D i The function coverage point information corresponding to the valid data bit field information of each data packet.

[0042] It should be noted that the valid data field information of each data packet in the configuration file may include valid and invalid function coverage point information. In step S64, the invalid function coverage point information can be directly filtered out, and only the valid function coverage point information is retained.

[0043] Step S65: Based on each D i The functional coverage point information corresponding to the valid data bit field information of each data packet generates the functional coverage collection code to obtain the chip functional coverage.

[0044] It should be noted that the configuration file of the data packet can be specifically set in the form of a table, and step S65 can be directly implemented through a preset script, that is, the configuration file of the data packet is parsed through the preset script, converted to generate functional coverage collection code, and then based on the functional coverage collection code, the chip functional coverage corresponding to the variable-length data packet is obtained accurately and quickly.

[0045] It should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe the steps as sequential processes, many of the steps can be performed in parallel, concurrently, or simultaneously. In addition, the order of the steps can be rearranged. A process can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings. A process can correspond to a method, function, procedure, subroutine, subprogram, etc.

[0046] An embodiment of the present invention also provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executed by the at least one processor, and the instructions are configured to execute the method described in the embodiment of the present invention.

[0047] An embodiment of the present invention further provides a computer-readable storage medium storing computer-executable instructions, wherein the computer instructions are used to execute the method described in the embodiment of the present invention.

[0048] The embodiment of the present invention can reintegrate the information scattered in the chip code, transfer the variable-length data packet to the fixed-length buffer, retain the valid control bit information in the data packet, realize the automatic generation of functional coverage based on the variable-length data packet, and improve the collection efficiency of the chip functional coverage.

[0049] The above description is merely a preferred embodiment of the present invention and does not constitute any form of limitation to the present invention. Although the present invention has been disclosed as a preferred embodiment, it is not intended to limit the present invention. Any technician familiar with the present profession can make slight changes or modifications to equivalent embodiments using the technical contents disclosed above without departing from the scope of the technical solution of the present invention. However, any simple modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention are still within the scope of the technical solution of the present invention.

Claims

1. A method for generating functional coverage based on variable-length data packets, characterized in that: including: Step S1, initially set the package number i=1, set the chip code starting point to the current starting position, set the calculation variable C i =0, length variable L i =0; Step S2: Read the chip code from the current starting position. When the i-th data packet header is read, obtain the data packet length U from the i-th data packet header. i , update L i =U i ; Step S3, continue to read the chip code and update C i =C i +B i , B i is the length of the i-th data packet that has been read; Step S4: store the read data packet i into the i-th buffer unit D of the preset fixed-length buffer area. i In, when D i Full or C i =L i When D i Continue to store the data of the i-th data packet in the preset fixed-length buffer area, and the length of each buffer unit is E; Step S5: When C i =L i When the chip code is read, it is determined whether the data packet is read. If so, step S6 is executed. Otherwise, the next position to be read is updated to the current starting position, i=i+1 is updated, and C is updated. i =0,L i =0, return to step S2; Step S6, generating a functional coverage rate based on all packet data in a preset fixed-length buffer.

2. The method according to claim 1, wherein: The method further includes: Step S10: Get the data packet type set {P1, P2, ..., P n ,...,P N }, P n The nth data packet type, where n ranges from 1 to N, and N is the total number of data packet types corresponding to the chip code; Step S20: Get each P n The corresponding effective control bit length Q n ; Step S30: Q n The maximum value in is determined as the cache unit length E of the preset fixed-length cache area.

3. The method according to claim 1, wherein: The step S2 includes: Step S21: Read the chip code from the current starting position. When the i-th data packet header is read, the firmware parses the i-th data packet header to obtain the data packet length L. i And the read module sequence {R1 i ,R2 i ,...,R j i ,...,R f(i) i }, R j i For the i-th reading module that reads the i-th data packet, R j i is a firmware or a hardware engine, the value of i ranges from 1 to f(i), and f(i) is the total number of read modules that read the i-th data packet.

4. The method according to claim 3, wherein: The step S3 includes: Step S31, continue to read the chip code, obtain each R j i The length W of the i-th data packet read j i ; Step S32: Acquire ; Step S33, update C i =C i +B i .

5. The method according to claim 1, wherein: The step S4 includes: Step S41: store the read data packet i into the i-th buffer unit D of the preset fixed-length buffer area. i middle, If L i ≥ E, then when D i is full, stop storing the data of the i-th data packet into D i . If L i < E, then when C i = L i , stop storing the data of the i-th data packet into D i .

6. The method according to claim 1, wherein: In the step S5, determining whether the packets in the chip code have been read completely includes: Step S51, if i = I, it is determined that the packets in the chip code have been read completely, where I is the total number of packets in the preset chip code; if i < I, it is determined that the packets in the chip code have not been read completely.

7. The method according to claim 1, wherein: In the step S5, determining whether the packets in the chip code have been read completely includes: Step C51, determining whether there is a packet code in the unread chip code. If there is, it is determined that the packets in the chip code have not been read completely; otherwise, it is determined that the packets in the chip code have been read completely.

8. The method according to claim 1, wherein: The step S6 includes: Step S61, analyze each D i Get the packet header information in D i Corresponding data packet type information; Step S62: Get D i Valid data bit field information of the data packet; Step S63: Based on D i The corresponding data packet type information is obtained from the preset data packet configuration file library. i Corresponding data packet configuration file; Step S64: Based on D i Get the corresponding data packet configuration file D i Function coverage point information corresponding to the valid data bit field information of each data packet; Step S65: Based on each D i The functional coverage point information corresponding to the valid data bit field information of each data packet generates the functional coverage collection code to obtain the chip functional coverage.

9. An electronic device, characterized in that: including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executed by the at least one processor, and the instructions are configured to execute the method according to any one of the foregoing claims 1-8.

10. A computer-readable storage medium, characterized in that stores computer-executable instructions for executing the method according to any one of the foregoing claims 1-8.

Citation Information

Patent Citations

  • Adjustment method and device for chip coverage rate analysis process, equipment and medium

    CN117875228A

  • Source code data caching method, electronic equipment and medium

    CN118052173A

  • Generation method of analysis message class, verification method of network chip and electronic equipment

    CN119254854A

  • Software and hardware interactive system based on variable-length data packets

    CN119741184A

  • Large-scale chip code coverage rate acquisition method, electronic equipment and medium

    CN119782128A