Methods, devices, and media for random data packet writing based on multi-level buffers

By acquiring the data packet array, buffer levels, and jump sequence, data packets are automatically written into multi-level buffers, solving the problem of low data packet coverage in existing technologies and improving the randomness and completeness of data packets and jump situations.

CN120704614BActive Publication Date: 2025-10-31METAX INTEGRATED CIRCUITS (SHANGHAI) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511173417.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-21
Publication Date
2025-10-31
Estimated Expiration
2045-08-21

AI Technical Summary

Technical Problem

Existing technologies struggle to achieve adequate coverage of data packets and jump scenarios in multi-level buffers, exhibiting poor randomness and completeness, resulting in low data packet coverage.

Method used

By acquiring the array of data packets to be written, the buffer hierarchy sequence, and the jump sequence, business data packets are automatically written sequentially in multi-level buffers and jump data packets are generated. The hierarchical random mode and jump identifier are used to ensure the randomness and integrity of data packets in multi-level buffers.

Benefits of technology

It improves the coverage of data packets and jumps in the multi-level buffer, realizes automated random writing, and enhances the randomness and completeness of data packets and jumps.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120704614B_ABST
    Figure CN120704614B_ABST
Patent Text Reader

Abstract

This invention relates to the field of chip technology, and more particularly to a method, apparatus, and medium for randomly writing data packets based on a multi-level buffer. The method includes step S1: obtaining an array of data packets to be written {P1, P2, ..., P...} n ,…,P N Step S2: Obtain the buffer hierarchy sequence {Q1, Q2, ..., Q} corresponding to the array of data packets to be written. n ,…,Q N Step S3: Obtain the jump sequence {G1, G2, ..., G...} corresponding to the array of data packets to be written. n ,…,G N Step S4: Based on {Q1,Q2,…,Q} n ,…,Q N} and {G1,G2,…,G n ,…,G N The invention sequentially writes business data packets into a multi-level buffer and generates and writes jump data packets. This invention increases the randomness and completeness of data packet writing and jump operations, thereby improving the coverage of data packets and jump scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of chip technology, and in particular to a method, apparatus, and medium for randomly writing data packets based on a multi-level buffer. Background Technology

[0002] The bridge between GPU (Graphics Processing Unit) software and chip is through sending various data packets to the hardware to guide the chip's operation. The chip receives and stores these data packets in buffers, which can have multiple levels. Each level of buffer can be controlled by indirect packet jumps, executing in the current level before returning to the previous level. During chip verification, each buffer level needs to fully cover all data packets and jump scenarios. Current technology involves manually writing data packets, requiring careful consideration of jump relationships before each jump, making it difficult to achieve full coverage and resulting in poor randomness and completeness. Therefore, providing an automated method for randomly writing data packets to multi-level buffers, increasing the randomness and completeness of data packet writing and jumps, and thus improving the coverage of data packets and jump scenarios, is a pressing technical problem. Summary of the Invention

[0003] The purpose of this invention is to provide a method, device, and medium for randomly writing data packets based on a multi-level buffer, which increases the randomness and completeness of writing data packets and data packet jumps, thereby improving the coverage of data packets and jump situations.

[0004] According to a first aspect of the present invention, a method for randomly writing data packets based on a multi-level buffer is provided, comprising:

[0005] Step S1: Obtain the array of data packets to be written {P1, P2, ..., P} n ,…,P N}, P n This refers to the nth service data packet in the data packet array to be written, where n ranges from 1 to N, and N is the total number of service data packets in the data packet array to be written.

[0006] Step S2: Obtain the buffer hierarchy sequence {Q1, Q2, ..., Q} corresponding to the array of data packets to be written. n ,…,Q N}, Q n For P n The corresponding buffer level, 0≤Q n If T ≤ T, the total number of buffer levels is T+1;

[0007] Step S3: Obtain the jump sequence {G1, G2, ..., G} corresponding to the array of data packets to be written. n ,…,GN}, G n For P n The corresponding redirect information afterward, if P n No further jump is needed, then G n Set as a no-jump flag, if P n If a jump is required afterward, then G n Set to the corresponding jump flag (Q) n H n ), H n For G n The corresponding target jump level;

[0008] Step S4: Based on {Q1,Q2,…,Q... n ,…,Q N} and {G1,G2,…,G n ,…,G N Business data packets are written sequentially in a multi-level buffer, and jump data packets are generated and written.

[0009] 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.

[0010] 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.

[0011] Compared with existing technologies, this invention has significant advantages and beneficial effects. Through the above technical solution, the method, device, and medium for randomly writing data packets based on a multi-level buffer provided by this invention achieve considerable technological advancement and practicality, and have broad industrial application value. It has at least the following beneficial effects:

[0012] This invention first obtains an array of data packets to be written, then obtains the buffer hierarchy sequence and the jump sequence corresponding to the array of data packets to be written. Based on the hierarchy sequence and the jump sequence corresponding to the array of data packets to be written, business data packets are written sequentially in a multi-level buffer, and jump data packets are generated and written. This realizes automated random writing of data packets in a multi-level buffer, increases the randomness and completeness of writing data packets and data packet jumps in a multi-level buffer, and thus improves the coverage of data packets and jump situations. Attached Figure Description

[0013] 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.

[0014] Figure 1 A flowchart illustrating a method for randomly writing data packets based on a multi-level buffer, as provided in an embodiment of the present invention. Detailed Implementation

[0015] 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.

[0016] This invention provides a method for randomly writing data packets based on a multi-level buffer, such as... Figure 1 As shown, it includes:

[0017] Step S1: Obtain the array of data packets to be written {P1, P2, ..., P} n ,…,P N}, P n This is the nth service data packet in the data packet array to be written, where n ranges from 1 to N, and N is the total number of service data packets in the data packet array to be written.

[0018] Specifically, business data packets can be calculation data packets, drawing data packets, etc. During the data packet acquisition process, the corresponding buffer level is not specified for the data packet, but information such as the data packet type and length can be obtained.

[0019] Step S2: Obtain the buffer hierarchy sequence {Q1, Q2, ..., Q} corresponding to the array of data packets to be written. n ,…,Q N}, Q n For P n The corresponding buffer level, 0≤Q n If T ≤ T, the total number of buffer levels is T+1.

[0020] It should be noted that Q n Used to set P n The number of buffer levels to be written to.

[0021] Step S3: Obtain the jump sequence {G1, G2, ..., G} corresponding to the array of data packets to be written. n ,…,GN}, G n For P n The corresponding redirect information afterward, if P n No further jump is needed, then G n Set as a no-jump flag, if P n If a jump is required afterward, then G n Set to the corresponding jump flag (Q) n H n ), H n For G n The corresponding target jump level.

[0022] It should be noted that G n Used to set P n The operations to be performed after writing to the corresponding buffer level, if G n If P is set to the no-jump flag, then n No jump operation is required after writing to the corresponding buffer level, if G n Set to the corresponding jump flag (Q) n H n If so, then P needs to be set. n The corresponding H n Level to Q n Hierarchical jump data packets. Taking a total buffer level of 3 as an example, G... n Set to the corresponding jump flag (Q) n H n Specifically, (2,0) represents a jump from the 2nd level buffer to the 1st level buffer and then from the 1st level buffer to the 0th level buffer. n Set to the corresponding jump flag (Q) n H n Specifically, (2,1) represents a jump from the second-level buffer to the first-level buffer. n Set to the corresponding jump flag (Q) n H n Specifically, it can be (1,0), which means jumping from the first level buffer to the 0th level buffer.

[0023] Step S4: Based on {Q1,Q2,…,Q... n ,…,Q N} and {G1,G2,…,G n ,…,G N Business data packets are written sequentially in a multi-level buffer, and jump data packets are generated and written.

[0024] It should be noted that by setting {Q1,Q2,…,Q... n ,…,Q N} and {G1,G2,…,Gn ,…,G N This enables automated random data packet writing across multiple buffer levels.

[0025] As one embodiment, step S1 includes:

[0026] Step S11: Obtain the sequence of data packets to be processed.

[0027] Step S12: Traverse the data packets in the sequence of data packets to be processed, and detect each data packet, filter out invalid data packets, and add a preset number of data packets after the predicted data packets to generate a data packet array {P1, P2, ..., P} to be written. n ,…,P N}

[0028] It should be noted that by executing step S12, potential problems can be pre-processed before writing business data packets, thereby improving the accuracy of data processing for subsequent data packets.

[0029] It should be noted that the buffer level sequence corresponding to the array of data packets to be written can be obtained directly by random selection. However, some special cases may occur during the random selection process that are not covered, such as writing all business data packets to a certain buffer level, or only writing to a few specified buffer levels. In order to further improve the coverage, different random modes can be set. As an example, step S2 includes:

[0030] Step S21: Obtain the currently set hierarchical random mode, which includes unconstrained random mode, write all to the specified first-level buffer mode, and write all to the specified multi-level mode.

[0031] It should be noted that by setting the hierarchical random mode to include unconstrained random mode, write all to the specified first-level buffer mode, and write all to the specified multi-level mode, it is possible to ensure that some special cases that may not be covered are covered, while also meeting the requirements of unconstrained randomness, thereby improving the coverage of random data packet writing.

[0032] Step S22: If the currently set hierarchical random mode is an unconstrained random mode, then proceed to step S23. If the currently set hierarchical random mode is a full write-to-specified first-level mode, then proceed to step S24. If the currently set hierarchical random mode is a full write-to-specified multi-level mode, then proceed to step S25.

[0033] Step S23, for each P n Randomly select a number from 0 to N as the corresponding buffer level Q. n Proceed to step S26.

[0034] Step S24: Place each P n The corresponding buffer level Q n Set to the specified buffer level and proceed to step S26.

[0035] For example, if the total number of buffer levels is 3, the specified buffer level can be level 0, level 2, or level 2.

[0036] Step S25, for each P n Randomly select a number from the specified multiple buffer levels as the corresponding buffer level Q. n Proceed to step S26.

[0037] Taking a total of 3 buffer levels as an example, the specified multiple buffer levels can be level 0 and level 1, or level 0 and level 2. In this case, level 2 only contains jump packets and no service packets. Alternatively, it can be level 1 and level 2. In this case, level 0 only contains jump packets and no service packets.

[0038] Step S26, based on all Q n Generate {Q1,Q2,…,Q} n ,…,Q N}

[0039] As one embodiment, the jump sequence corresponding to the array of data packets to be written can be generated based on the relationship between the buffer levels of adjacent data packets to be written in the buffer level sequence corresponding to the array of data packets to be written. Step S3 includes:

[0040] Step S31: If n=1 and Q1=0, then set G1 as the no-jump flag; if n=1 and Q1≠0, then set G1 as the jump flag (Q1,0).

[0041] It should be noted that if n=1 and Q1=0, it means that the first service data packet is stored in the level 0 cache and does not require a jump, so G1 is set as the no-jump flag. If n=1 and Q1≠0, it means that it is stored in the level Q1 cache and a jump is required for execution, so G1 needs to be set as the jump flag (Q1,0).

[0042] Step S32, if n≠1 and Q n ≤Q n+1 Then G n Set as a no-jump flag if n≠1 and Q n Q n+1 Then G n Set as jump flag (Q) n Q n+1 If n=N, and Q nIf G ≠ 0, then G n Set as jump flag (Q) n ,0);

[0043] Step S33, based on all G n Generate {G1,G2,…,G n ,…,G N}

[0044] To further increase the randomness of data packet writing in multi-level caches, as an example, if the currently set hierarchical random mode is all-write-to-the-i-th level mode, step S3 includes:

[0045] Step C31: Set a random pattern for splitting all data packets in the i-th level buffer into single data packets and writing them into the j-th level buffer, where 0 ≤ j <i≤N。

[0046] Step C32: If n≠N, then G n Set as the jump flag (i,j). If n=N, then G will be... n Set to (i, N).

[0047] Step C33, based on all G n Generate {G1,G2,…,G n ,…,G N}

[0048] Taking a total number of buffer levels equal to 3 as an example, through steps C31-C33, the jump mode can be set to split all data packets of the second-level buffer into individual writes to the first-level buffer, or it can be set to split the data packets of the second-level buffer into individual writes to the 0th-level buffer, or it can be set to split the data packets of the first-level buffer into individual writes to the 0th-level buffer.

[0049] As one embodiment, step S4 includes:

[0050] Step S41: Initialize n=1, initially set the level 0 buffer R0 to empty, and set the level t buffer R to be stored. t If empty, the value of t ranges from 1 to T.

[0051] As one example, the level 0 buffer R0 is a circular buffer.

[0052] Step S42, P n Write to Q n In the level buffer, and P n Marked as unprocessed, if G n If the jump flag is not specified, proceed to step S47; otherwise, proceed to step S43.

[0053] Step S43: Obtain G n The corresponding jump identifier (Q n , H n ), and set e = Q n - 1.

[0054] Step S44: Generate a jump data packet P e , P e based on all unprocessed data packets in the current (e + 1)-th level buffer, including the starting address and the total length of all unprocessed data packets in the current e-th level buffer, write P e into the e-th level buffer, and mark all unprocessed data packets in the current (e + 1)-th level buffer as processed.

[0055] Step S45: If e = H n , then execute Step S46; if e > H n , then set e = e - 1 and return to Step S44.

[0056] Step S46: If H n = 0, then create a new empty buffer R to be stored in the t-th level t , and then execute Step S47; if H n ≠ 0, then directly execute Step S47;

[0057] Step S47: If n < N, then set n = n + 1 and return to Step S2; if n = N, then end the process.

[0058] It should be noted that through Steps S41 - S44, all jump packets can be generated based on {Q1, Q2,..., Q n ,..., Q N} and {G1, G2,..., G n ,..., G N}, and the service data packets and jump data packets are written into the corresponding buffer positions in sequence according to the storage positions corresponding to Q1, Q2,..., Q n ,..., Q N and the jump rules corresponding to G1, G2,..., G n ,..., G N .

[0059] As an embodiment, after Step S4, it further includes:

[0060] Step S5: Execute the data packets in the level 0 buffer R0 in sequence. If a jump packet is encountered, jump to the next level for execution based on the starting address and the total length of the data packet. If a jump packet is encountered in the next level, jump to the next level after that based on the starting address and the total length of the jump packet. When the total length of the data packet corresponding to the jump packet has been executed, return to the previous level to continue execution. Repeat the above loop until all data packets have been executed.

[0061] It should be noted that after step S4 is completed, the array of data packets to be written, the buffer level sequence corresponding to the array of data packets to be written, and the jump sequence corresponding to the array of data packets to be written can be cleared, and the execution can start again from step S1 until the coverage of random data packet writing meets the requirements.

[0062] 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.

[0063] 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.

[0064] This invention also provides a computer-readable storage medium storing computer-executable instructions for performing the methods described in this invention.

[0065] In this embodiment of the invention, the array of data packets to be written is first obtained, and then the buffer hierarchy sequence and the jump sequence corresponding to the array of data packets to be written are obtained. Based on the hierarchy sequence and the jump sequence corresponding to the array of data packets to be written, business data packets are written sequentially in the multi-level buffer, and jump data packets are generated and written. This realizes the automatic random writing of data packets in the multi-level buffer, increases the randomness and completeness of writing data packets and data packet jumps in the multi-level buffer, and thus improves the coverage of data packets and jump situations.

[0066] 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 randomly writing data packets based on a multi-level buffer, characterized in that, including: Step S1: Obtain the array of data packets to be written {P1, P2, ..., P} n ,…,P N }, P n This refers to the nth service data packet in the data packet array to be written, where n ranges from 1 to N, and N is the total number of service data packets in the data packet array to be written. Step S2: Obtain the buffer hierarchy sequence {Q1, Q2, ..., Q} corresponding to the array of data packets to be written. n ,…,Q N }, Q n For P n The corresponding buffer level, 0≤Q n If T ≤ T, the total number of buffer levels is T+1; Step S3: Obtain the jump sequence {G1, G2, ..., G} corresponding to the array of data packets to be written. n ,…,G N }, G n For P n The corresponding redirect information afterward, if P n No further jump is needed, then G n Set as a no-jump flag, if P n If a jump is required afterward, then G n Set to the corresponding jump flag (Q) n H n ), H n For G n The corresponding target jump level; Step S4: Based on {Q1,Q2,…,Q... n ,…,Q N } and {G1,G2,…,G n ,…,G N Business data packets are written sequentially in a multi-level buffer, and jump data packets are generated and written.

2. The method according to claim 1, wherein the step S1 includes: Step S11, obtaining a sequence of data packets to be processed; Step S12: Traverse the data packets in the sequence of data packets to be processed, and detect each data packet, filter out invalid data packets, and add a preset number of data packets after the predicted data packets to generate a data packet array {P1, P2, ..., P} to be written. n ,…,P N } 3. The method according to claim 1, wherein the step S2 includes: Step S21, obtaining the currently set hierarchical random mode, the hierarchical random mode including an unconstrained random mode, a mode of writing all to a specified first-level buffer, and a mode of writing all to a specified multi-level mode; Step S22, if the currently set hierarchical random mode is the unconstrained random mode, then execute step S23, if the currently set hierarchical random mode is the mode of writing all to the specified first-level mode, then execute step S24, if the currently set hierarchical random mode is the mode of writing all to the specified multi-level mode, then execute step S25; Step S23, for each P n Randomly select a number from 0 to N as the corresponding buffer level Q. n Proceed to step S26; Step S24: Place each P n The corresponding buffer level Q n Set to the specified buffer level and proceed to step S26; Step S25, for each P n Randomly select a number from the specified multiple buffer levels as the corresponding buffer level Q. n Proceed to step S26; Step S26, based on all Q n Generate {Q1,Q2,…,Q} n ,…,Q N } 4. The method according to claim 1, wherein the step S3 includes: Step S31, if n = 1 and Q1 = 0, then set G1 as a non-jump flag, if n = 1 and Q1 ≠ 0, then set G1 as a jump flag (Q1,0); Step S32, if n≠1 and Q n ≤Q n+1 Then G n Set as a no-jump flag if n≠1 and Q n Q n+1 Then G n Set as jump flag (Q) n Q n+1 If n=N, and Q n If G ≠ 0, then G n Set as jump flag (Q) n ,0); Step S33, based on all G n Generate {G1,G2,…,G n ,…,G N } 5. The method according to claim 3, wherein if the currently set hierarchical random mode is the mode of writing all to the i-th level mode, the step S3 includes: Step C31, setting a random mode of splitting the data packets in all the i-th level buffers into single data packets and writing them to the j-th level buffer, 0 ≤ j < i ≤ N; Step C32: If n≠N, then G n Set as the jump flag (i,j). If n=N, then G will be... n Set to (i, N); Step C33, based on all G n Generate {G1,G2,…,G n ,…,G N } 6. The method according to claim 4 or 5, wherein the step S4 includes: Step S41: Initialize n=1, initially set the level 0 buffer R0 to empty, and set the level t buffer R to be stored. t If empty, the value of t ranges from 1 to T; Step S42, P n Write to Q n In the level buffer, and P n Marked as unprocessed, if G n If the jump flag is not specified, proceed to step S47; otherwise, proceed to step S43. Step S43, Obtain G n The corresponding jump flag (Q) n H n ), set e=Q n -1; Step S44: Generate a jump data packet P based on all unprocessed data packets in the current (e+1)th level buffer. e ,P e Including the starting address and total length of all unprocessed packets in the current e-th level buffer, P e Write to the e-th level buffer, and mark all unprocessed data packets in the current e+1-th level buffer as processed; Step S45, if e=H n Then proceed to step S46, if e > H n If so, set e = e-1 and return to step S44; Step S46, if H n If the value is 0, then create a new empty buffer R to be stored in the t-th level. t Then proceed to step S47, if H n If the value is not equal to 0, then proceed directly to step S47. Step S47, if n < N, then set n = n + 1, return to step S2, if n = N, then end the process.

7. The method according to claim 6, wherein The 0th level buffer R0 is a circular buffer.

8. The method according to claim 6, wherein after the step S4, it further includes: Step S5, sequentially execute the data packets in the 0th level buffer R0, if a jump packet is executed, then jump to the next level for execution according to the start address and the total length of the data packet, if a jump packet is executed in the next level, then jump to the next lower level for execution according to the start address and the total length of the jump packet in the next level, when the total length of the data packet corresponding to the jump packet is executed, return to the upper level to continue execution until all the data packets are executed.

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

  • Attack detection method, processor, electronic equipment and storage medium

    CN116738414A

  • Harvard architecture multi-level instruction cache calculation method based on random instruction set

    CN118427030A