Method, apparatus, and medium for generating functional coverage based on indefinite length packet
By setting packet sequence number and length variables in the chip code, variable-length data packets are stored in a fixed-length buffer, which solves the problem of information dispersion of variable-length data packets in the chip code and improves the collection efficiency of functional coverage.
Patent Information
- Application Number
- CN202511074755.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-01
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2045-08-01
AI Technical Summary
Existing technologies cannot quickly and accurately locate the header and information of variable-length data packets, resulting in low efficiency in collecting chip functional coverage.
By setting packet sequence number and length variables, the length of the data packet is obtained by reading the header of the data packet file and stored in the fixed-length buffer, thus achieving automatic generation coverage of variable-length data packets.
It achieves information integration of variable-length data packets and effective storage of control bits, improving the collection efficiency of chip function coverage.
Smart Images

Figure CN120562354B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of chip technology, and in particular to a method, apparatus, and medium for generating functional coverage based on variable-length data packets. Background Technology
[0002] During chip development, software distributes various data packets to the chip, involving different types and varying lengths. Before sending a data packet, the software prepares the packet data in memory and then notifies the chip's main control module to retrieve it. The main control module stores the retrieved packet content into the corresponding buffer. The firmware then retrieves the packet header, unpacks it, and distributes it to multiple hardware engines. These engines, under firmware instructions, continue reading fixed-length data from the buffer and execute it. However, because variable-length data packets may correspond to different buffer levels and involve different engines, the data is scattered across multiple locations in the chip code. Therefore, existing technologies cannot accurately and quickly locate the packet header and information within the variable-length packets, making coverage collection during verification difficult and reducing the efficiency of chip functional coverage collection. Thus, how to automatically generate functional coverage based on variable-length data packets and improve the efficiency of chip functional coverage collection has become an urgent technical problem to be solved. Summary of the Invention
[0003] The purpose of this invention is to provide a method, device, and medium for generating functional coverage based on variable-length data packets, which realizes the automated generation of functional coverage based on variable-length data packets and improves 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:
[0005] Step S1: Initially set package sequence number i=1, set the chip code starting point to the current starting position, and set the calculation variable C. i =0, length variable L i =0;
[0006] Step S2: Start reading the chip code from the current starting position. When the header of the i-th data packet is read, obtain the data packet length U from the header of the i-th data packet. i Update L i =U i ;
[0007] Step S3: Continue reading the chip code and updating C. i =C i +B i Bi The length of the i-th data packet already read;
[0008] Step S4: Store the read data of the i-th data packet into the i-th buffer unit D of the preset fixed-length buffer. i In the middle, when D i Full or C i =L i At that time, stop sending to D i The i-th data packet continues to be stored in the buffer, and the length of each buffer unit in the preset fixed-length buffer is E;
[0009] Step S5, when C i =L i At that time, determine whether the data packet in the chip code has been completely read. If so, proceed to step S6; otherwise, update the next position to be read to the current starting position, update i=i+1, and update C. i =0, L i =0, return to step S2;
[0010] Step S6: Generate functional coverage based on all data packets in the preset fixed-length buffer.
[0011] 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 executable by the at least one processor, the instructions being configured to perform the method described in the first aspect of the present invention.
[0012] According to a third aspect of the present invention, a computer-readable storage medium is provided, storing computer-executable instructions for performing the method described in the first aspect of the present invention.
[0013] Compared with existing technologies, this invention has significant advantages and beneficial effects. Through the above technical solution, the method, device, and medium for generating functional coverage based on variable-length data packets provided by this invention achieve considerable technological advancement and practicality, and have broad industrial application value. It has at least the following beneficial effects:
[0014] This invention can reintegrate information scattered in chip code, transfer variable-length data packets to a fixed-length buffer, retain 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. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 The flowchart illustrates a method for generating functional coverage based on variable-length data packets, as provided in an embodiment of the present invention. Detailed Implementation
[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0018] This invention provides a method for generating functional coverage based on variable-length data packets, such as... Figure 1 As shown, it includes:
[0019] Step S1: Initially set package sequence number i=1, set the chip code starting point to the current starting position, and set the calculation variable C. i =0, length variable L i =0.
[0020] It should be noted that the data packets are sent in sequence, and therefore arranged in sequence in the chip code. However, since the data packets are of variable length, it is difficult to directly locate the position of each data packet in the chip code.
[0021] Step S2: Start reading the chip code from the current starting position. When the header of the i-th data packet is read, obtain the data packet length U from the header of the i-th data packet. i Update L i =U i .
[0022] Step S3: Continue reading the chip code and updating C. i =C i +B i B i The length of the i-th data packet that has been read.
[0023] Step S4: Store the read data of the i-th data packet into the i-th buffer unit D of the preset fixed-length buffer. i In the middle, when D i Full or C i =L iAt that time, stop sending to D i The i-th data packet continues to be stored in the buffer, and the length of each buffer unit in the preset fixed-length buffer is E.
[0024] It should be noted that the above steps can read out each variable-length data packet and store the valid control bit information of each variable-length data packet in a fixed-length buffer.
[0025] Step S5, when C i =L i At that time, determine whether the data packet in the chip code has been completely read. If so, proceed to step S6; otherwise, update the next position to be read to the current starting position, update i=i+1, and update C. i =0, L i =0, return to step S2.
[0026] Step S6: Generate functional coverage based on all data packets in the preset fixed-length buffer.
[0027] It should be noted that through steps S1-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.
[0028] To ensure that the valid control bit information of each data packet in the chip code can be stored in a fixed-length buffer, a reasonable buffer unit length needs to be set. As one embodiment, the method further includes:
[0029] Step S10: Obtain the data packet type set {P1, P2, ..., P} corresponding to the chip code. n ,...,P N}, P n This represents 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.
[0030] Step S20: Obtain each P n The corresponding effective control bit length Q n .
[0031] For example, if a variable-length data packet has a total length of 400 dw (Double Word), but only the first 200 dw are valid control bits, then the length of the valid control bits for that data packet is 200 dw. Valid control bits refer to the data packet header and the control bits related to functional coverage.
[0032] Step S30, Q n The maximum value is determined to be the cache unit length E of the preset fixed-length cache area.
[0033] It should be noted that Q n The maximum value is determined to be the buffer unit length E of the preset fixed-length buffer area, which can ensure that the information of the effective control bits of each variable-length data packet can be stored in the buffer unit of the preset fixed-length buffer area.
[0034] As one embodiment, step S2 includes:
[0035] Step S21: Start reading chip code from the current starting position. When the header of the i-th data packet is read, the firmware parses the header of the i-th data packet to obtain the data packet length L. i And the sequence of read modules {R1} for reading the i-th data packet i R2 i ,...,R j i ,...,R f(i) i}, R j i To read the i-th read module of the i-th data packet, R j i For firmware or hardware engine, the value of i ranges from 1 to f(i), where f(i) is the total number of reading modules reading the i-th data packet.
[0036] It should be noted that the data packet header is read and parsed by the firmware. 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.
[0037] As one embodiment, step S3 includes:
[0038] Step S31: Continue reading the chip code and obtain each R j i The length W of the i-th data packet already read j i .
[0039] Among them, each R is monitored simultaneously. j i Record the length W of each i-th data packet that has been read. j i .
[0040] Step S32, Obtain .
[0041] Step S33, Update C i =C i +B i .
[0042] It should be noted that, through C iRecord the total length of the i-th data packet that has been read in real time.
[0043] As an embodiment, the step S4 includes:
[0044] Step S41: Store the data of the i-th data packet that has been read into the i-th cache unit D of a preset fixed-length buffer. i If L i ≥ E, when D i is full, stop storing the data of the i-th data packet into D i continuously. If L i < E, when C i = L i stop storing the data of the i-th data packet into D i continuously.
[0045] It should be noted that if L i > E, the data of the i-th data packet cannot be fully 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 into D i continuously, but continue to read the data of the i-th data packet until the data of the i-th data packet is completely read, and then enter the processing flow of the next data packet. If L i = E, the data of the i-th data packet can be fully stored in the i-th cache unit D i When D i is full, stop storing the data of the i-th data packet into D i continuously. If L i < E, 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 into D i continuously.
[0046] As an embodiment, if the total number I of data packets in the chip code can be obtained in advance, in the step S5, determining whether the data packets in the chip code have been completely read includes:
[0047] Step S51: If i = I, it is determined that the data packets in the chip code have been completely read, where I is the total number of data packets in the preset chip code. If i < I, it is determined that the data packets in the chip code have not been completely read.
[0048] As an embodiment, the step S5, determining whether the data packets in the chip code have been completely read, includes:
[0049] Step C51: Determine whether there is a data packet code in the unread chip code. If it exists, determine that the data packet in the chip code has not been completely read; otherwise, determine that the data packet in the chip code has been completely read.
[0050] As one embodiment, step S6 includes:
[0051] Step S61: Analyze each D i Data packet header information to obtain D i The corresponding data packet type information.
[0052] Step S62, Obtain D i The valid data bit field information of the data packet.
[0053] It should be noted that D i The data stored in the database may include invalid bit field information. During the coverage collection process, only D is acquired. i The valid data bit field information of the data packet is sufficient.
[0054] 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.
[0055] It should be noted that the data packet configuration file includes information such as the data packet header, the bit range of each bit field, and the data location at the corresponding function point.
[0056] Step S64, based on D i Obtain the corresponding data packet configuration file D i The functional coverage point information corresponding to the valid data bit field information of each data packet.
[0057] It should be noted that the valid data bit field information of each data packet in the configuration file may include both valid and invalid functional coverage point information. In step S64, invalid functional coverage point information can be directly filtered out, and only valid functional coverage point information can be retained.
[0058] Step S65, based on each D i The functional coverage information corresponding to the valid data bit field information of each data packet is used to generate functional coverage collection code to obtain the chip functional coverage.
[0059] It should be noted that the configuration file of the data packet can be set in the form of a table. Step S65 can be implemented directly through a preset script. That is, the configuration file of the data packet is parsed through the preset script, the functional coverage collection code is generated, and then the chip functional coverage corresponding to the variable-length data packet is obtained accurately and quickly based on the functional coverage collection code.
[0060] 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 these steps can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the steps can be rearranged. A process can be terminated when its operation is complete, but it may also have additional steps not included in the figures. A process can correspond to a method, function, procedure, subroutine, subroutine, etc.
[0061] This invention also provides an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being configured to perform the method described in this invention.
[0062] This invention also provides a computer-readable storage medium storing computer-executable instructions for performing the methods described in this invention.
[0063] The embodiments of the present invention can reorganize the information scattered in the chip code, transfer the variable-length data packets to the 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.
[0064] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes, and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope 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 package sequence number i=1, set the chip code starting point to the current starting position, and set the calculation variable C. i =0, length variable L i =0; Step S2: Start reading the chip code from the current starting position. When the header of the i-th data packet is read, obtain the data packet length U from the header of the i-th data packet. i Update L i =U i ; Step S3: Continue reading the chip code and updating C. i =C i +B i B i The length of the i-th data packet already read; Step S4: Store the read data of the i-th data packet into the i-th buffer unit D of the preset fixed-length buffer. i In the middle, when D i Full or C i =L i At that time, stop sending to D i The i-th data packet continues to be stored in the buffer, and the length of each buffer unit in the preset fixed-length buffer is E; Step S5, when C i =L i At that time, determine whether the data packet in the chip code has been completely read. If so, proceed to step S6; otherwise, update the next position to be read to the current starting position, update i=i+1, and update C. i =0, L i =0, return to step S2; Step S6: Generate a functional coverage rate based on all the data packet data in a preset fixed-length buffer.
2. The method according to claim 1, wherein: The method further includes: Step S10: Obtain the data packet type set {P1, P2, ..., P} corresponding to the chip code. n ,...,P N }, P n This represents 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: Obtain each P n The corresponding effective control bit length Q n ; Step S30, Q n The maximum value is determined to be 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: Start reading chip code from the current starting position. When the header of the i-th data packet is read, the firmware parses the header of the i-th data packet to obtain the data packet length L. i And the sequence of read modules {R1} for reading the i-th data packet i R2 i ,...,R j i ,...,R f(i) i }, R j i To read the j-th read module of the i-th data packet, R j i For firmware or hardware engine, the value of j ranges from 1 to f(i), where f(i) is the total number of reading modules reading the i-th data packet.
4. The method according to claim 3, wherein: The step S3 includes: Step S31: Continue reading the chip code and obtain each R j i The length W of the i-th data packet already read j i ; Step S32, Obtain ; 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 data of the i-th data packet that has been read into the i-th cache unit D of a preset fixed-length buffer i In it, if L i ≥ E, then when D i is full, stop storing the data of the i-th data packet into D i continuously. If L i < E, then when C i = L i stop storing the data of the i-th data packet into D i continuously.
6. The method according to claim 1, wherein: In the 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 total number of data packets in the preset chip code; if i < I, it is determined that the data 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 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.
8. The method according to claim 1, wherein: The step S6 includes: Step S61: Analyze each D i Data packet header information to obtain D i Corresponding data packet type information; Step S62, Obtain D i Valid data bit field information in 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 The corresponding data packet configuration file; Step S64, based on D i Obtain the corresponding data packet configuration file D i The functional 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 information corresponding to the valid data bit field information of each data packet is used to generate 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, Store 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
Generation method of analysis message class, verification method of network chip and electronic equipment
CN119254854A