Method and equipment for randomly writing data packet based on multi-level buffer area and medium

By obtaining the packet array, buffer level and jump sequence, the data packets are automatically written in the multi-level buffer, which solves the problem of low packet coverage and achieves higher randomness and completeness.

CN120704614AActive Publication Date: 2025-09-26METAX INTEGRATED CIRCUITS (SHANGHAI) CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing technologies have difficulty in achieving sufficient coverage of data packets and jump situations in multi-level buffers, and have poor randomness and completeness, resulting in low data packet coverage.

Method used

By obtaining the array of data packets to be written, the buffer level sequence and the jump sequence, the business data packets are automatically written in sequence in the multi-level buffer and the jump data packets are generated to achieve random writing.

Benefits of technology

Improved coverage of multi-level buffer write packets and jump situations, enhancing randomness and completeness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120704614A_ABST
    Figure CN120704614A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of chips, in particular to a method, equipment and medium for randomly writing data packets based on a multi-level buffer area, and the method comprises the following steps: S1, obtaining a to-be-written data packet array {P1, P2,..., Pn,..., PN}; s2, acquiring a buffer hierarchy sequence {Q1, Q2,..., Qn,..., QN} corresponding to a data packet array to be written; s3, acquiring a jump sequence {G1, G2,..., Gn,..., GN} corresponding to the data packet array to be written; and S4, based on the {Q1, Q2,..., Qn,..., QN} and the {G1, G2,..., Gn,..., GN}, sequentially writing service data packets in the multi-level buffer area, and generating and writing jump data packets. According to the invention, the randomness and completeness of data packet writing and data packet skipping are increased, so that the coverage rate of the data packets and the skipping condition 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 randomly writing data packets based on a multi-level buffer. Background Art

[0002] The communication bridge between the GPU (Graphics Processing Unit) software and the chip is through sending various data packets to the hardware to guide the chip's operation. The place in the chip that receives and stores data packets is the buffer. There can be multiple levels of buffers. Each level of buffer can be controlled by indirect jump data packets, and after the current level buffer completes execution, it returns to the previous level buffer. During the chip verification process, each level of buffer needs to fully cover all data packets and jump situations. The existing technology manually writes data packets, requiring full consideration of jump relationships before each jump. This makes it difficult to achieve full coverage, and the randomness and completeness are poor. Therefore, how to provide an automated method for randomly writing data packets to multi-level buffers, increase the randomness and completeness of data packet writing and data packet jumps in the multi-level buffers, and thus improve the coverage of data packets and jump situations has become a technical problem that needs to be solved urgently. Summary of the Invention

[0003] The purpose of the present 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: Step S1, obtain the array of data packets to be written {P1, P2, ..., P n ,…,P N}, P n 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: Get the buffer level sequence {Q1, Q2, ..., Q n ,…,Q N}, Q n P n Corresponding buffer level, 0≤Q n ≤T, the total number of buffer levels is T+1; Step S3, obtain the jump sequence {G1, G2, ..., G n ,…,G N}, G n Pn Then the corresponding jump information, if P n No need to jump afterwards, then G n Set to no jump flag, if P n If you need to jump later, G n Set to the corresponding jump identifier (Q n ,H n ), H n G n The corresponding target jump level; Step S4: Based on {Q1, Q2, ..., Q n ,…,Q N} and {G1,G2,…,G n ,…,G N}Write business data packets in multi-level buffers in sequence, and generate and write jump data packets.

[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 for randomly writing data packets based on a multi-level buffer provided by the present invention can achieve considerable technological advancement and practicality, and has wide industrial application value, and has at least the following beneficial effects: The present invention first obtains an array of data packets to be written, then obtains a buffer level sequence corresponding to the array of data packets to be written and a jump sequence corresponding to the array of data packets to be written, and based on the level sequence and the jump sequence corresponding to the array of data packets to be written, writes business data packets in a multi-level buffer in sequence, and generates and writes jump data packets, thereby realizing the random writing of data packets in the automated multi-level buffer, increasing the randomness and completeness of data packet writing and data packet jumping in the multi-level buffer, and thus improving the coverage of data packets and jump situations. 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 1 A flow chart of a method for randomly writing data packets based on a multi-level buffer provided by 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 randomly writing data packets based on a multi-level buffer, such as Figure 1 As shown, including: Step S1, obtain the array of data packets to be written {P1, P2, ..., P n ,…,P N}, P n 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.

[0012] Specifically, the service data packet may be a calculation data packet, a drawing data packet, etc. In the process of obtaining the data packet, the corresponding buffer level is not specified for the data packet, but information such as the type of the data packet and the length of the data packet can be obtained.

[0013] Step S2: Get the buffer level sequence {Q1, Q2, ..., Q n ,…,Q N}, Q n P n Corresponding buffer level, 0≤Q n ≤T, the total number of buffer levels is T+1.

[0014] It should be noted that Q n To set P n The number of buffer levels to write to.

[0015] Step S3, obtain the jump sequence {G1, G2, ..., G n ,…,G N}, G n P n Then the corresponding jump information, if P n No need to jump afterwards, then G n Set to no jump flag, if P n If you need to jump later, G n Set to the corresponding jump identifier (Q n ,H n ), H n G n The corresponding target jump level.

[0016] It should be noted that G n To set P n The operations to be performed after writing to the corresponding buffer level, if G n Set to no jump flag, then P n After writing to the corresponding buffer level, no jump operation is required. If G n Set to the corresponding jump identifier (Q n ,H n ), you need to set P n The corresponding H n Level to Q n Layer jump data packets. Taking the total number of buffer levels equal to 3 as an example, G n Set to the corresponding jump identifier (Q n ,H n ) can be specifically (2,0), which means jumping from the second layer buffer to the first layer buffer and then continuing from the first layer buffer to the 0th layer buffer. n Set to the corresponding jump identifier (Q n ,H n ) can be specifically (2,1), which means jumping from the second-layer buffer to the first-layer buffer. G n Set to the corresponding jump identifier (Q n ,H n ) can be (1,0), which means jumping from the 1st layer buffer to the 0th layer buffer.

[0017] Step S4: Based on {Q1, Q2, ..., Q n ,…,Q N} and {G1,G2,…,G n ,…,G N}Write business data packets in multi-level buffers in sequence, and generate and write jump data packets.

[0018] It should be noted that by setting {Q1,Q2,…,Q n ,…,Q N} and {G1,G2,…,G n,…,G N}, implements automated multi-level buffer random write data packets.

[0019] As an embodiment, step S1 includes: Step S11: Obtain a sequence of data packets to be processed.

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

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

[0022] It should be noted that the buffer level sequence corresponding to the array of data packets to be written can be directly randomly obtained, but some special cases that are not covered may occur in the random process, such as writing all service data packets to a certain buffer level, or writing only to certain specified buffer levels. In order to further improve the coverage rate, different random modes can be set. As an embodiment, step S2 includes: Step S21 : obtaining a currently set hierarchical random mode, wherein the hierarchical random mode includes an unconstrained random mode, a mode of writing all into a designated primary buffer, and a mode of writing all into a designated multi-level buffer.

[0023] It should be noted that by setting the hierarchical random mode to include 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 buffer, it can not only ensure that some special situations that may not be covered are covered, but also meet the unconstrained random requirements, thereby improving the coverage rate of random writing of data packets.

[0024] Step S22: If the currently set hierarchical random mode is an unconstrained random mode, execute step S23; if the currently set hierarchical random mode is a write-all specified first-level mode, execute step S24; if the currently set hierarchical random mode is a write-all specified multi-level mode, execute step S25.

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

[0026] Step S24: n Corresponding buffer level Qn Set to the specified buffer level and execute step S26.

[0027] Taking the total number of buffer levels equal to 3 as an example, the specified buffer level can be level 0, level 2, or level 3.

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

[0029] Taking the total number of buffer levels as an example, 3, the specified multiple buffer levels can be level 0 and level 1, or level 0 and level 2. In this case, only redirect packets exist in level 2, and no service packets exist. Alternatively, the specified multiple buffer levels can be level 1 and level 2. In this case, only redirect packets exist in level 0, and no service packets exist.

[0030] Step S26: Based on all Q n Generate {Q1,Q2,…,Q n ,…,Q N}.

[0031] As an embodiment, the jump sequence corresponding to the array of data packets to be written may be generated based on the relationship between the buffer levels corresponding to adjacent data packets to be written in the buffer level sequence corresponding to the array of data packets to be written, and 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).

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

[0033] Step S32: If n≠1 and Q n ≤Q n+1 , then G n Set to no jump flag, if n≠1 and Q n >Q n+1 , then G n Set as jump indicator (Q n ,Q n+1 ), if n=N, and Q n ≠0, then G n Set as jump indicator (Q n ,0); Step S33: Based on all G n Generate {G1,G2,…,G n ,…,G N}.

[0034] In order to further increase the randomness of data packet writing in the multi-level cache, as an embodiment, if the currently set level random mode is the all-write-to-level i mode, step S3 includes: 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, 0≤j <i≤N。

[0035] Step C32: If n≠N, then G n Set as jump mark (i, j), if n=N, then G n Set to (i, N).

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

[0037] Still taking the example of the total number of buffer levels being 3, through steps C31-C33, the jump mode can be set to split all data packets in the level 2 buffer into a single write to the level 1 buffer, or it can be set to split the data packets in the level 2 buffer into a single write to the level 0 buffer, or it can be set to split the data packets in the level 1 buffer into a single write to the level 0 buffer.

[0038] As an embodiment, step S4 includes: Step S41, initially set n=1, initially set the 0th level buffer R0 to be empty, set the level to be stored in the tth level buffer R t Is empty, and the value of t ranges from 1 to T.

[0039] As an embodiment, the level 0 buffer R0 is a ring buffer.

[0040] Step S42: P n Write Q n The level buffer and P n Marked as unprocessed state, if G n If it is a non-jump flag, execute step S47; otherwise, execute step S43.

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

[0042] Step S44: Generate a jump packet P based on all unprocessed data packets in the current (e + 1)-th level buffer e ,P e including the start address and the total length of all unprocessed data packets in the current e-th level buffer, and 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.

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

[0044] 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; Step S47: If n < N, then set n = n + 1 and return to Step S2; if n = N, then end the process.

[0045] 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 packets are written into the corresponding buffer positions in order 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 .

[0046] As an embodiment, after Step S4, the following steps are further included: Step S5: Sequentially execute the data packets in the buffer R0 at the 0-th level. If a jump packet is encountered during execution, 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 encountered at the next level during execution, jump to the next lower level for execution according to the start address and the total length of the jump packet at the next level. When the total length of the data packet corresponding to the jump packet is executed, return to the previous level to continue execution. Repeat the above loop until all data packets are executed.

[0047] It should be noted that after step S4 is executed, 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 execution can be started again from step S1 until the coverage of random writing of data packets meets the requirements.

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

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

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

[0051] The embodiment of the present invention first obtains an array of data packets to be written, then obtains a buffer level sequence corresponding to the array of data packets to be written and a jump sequence corresponding to the array of data packets to be written, and writes business data packets in sequence in a multi-level buffer based on the level sequence and the jump sequence corresponding to the array of data packets to be written, and generates and writes jump data packets, thereby realizing the automated random writing of data packets in the multi-level buffer, increasing the randomness and completeness of data packet writing and data packet jumping in the multi-level buffer, and thus improving the coverage of data packets and jump situations.

[0052] 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 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 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: Get the buffer level sequence {Q1, Q2, ..., Q n ,…,Q N }, Q n P n Corresponding buffer level, 0≤Q n ≤T, the total number of buffer levels is T+1; Step S3, obtain the jump sequence {G1, G2, ..., G n ,…,G N }, G n P n Then the corresponding jump information, if P n No need to jump afterwards, then G n Set to no jump flag, if P n If you need to jump later, G n Set to the corresponding jump identifier (Q n ,H n ), H n G n The corresponding target jump level; Step S4: Based on {Q1, Q2, ..., Q n ,…,Q N } and {G1,G2,…,G n ,…,G N }Write business data packets in multi-level buffers in sequence, and generate and write jump data packets.

2. The method according to claim 1, wherein the step S1 includes: Step S11, obtaining a data packet sequence to be processed; Step S12, traverse the data packets in the sequence of data packets to be processed, detect each data packet, filter out invalid data packets, and add a preset number of data packets after the predicted data packet to generate a data packet array to be written {P1, P2, ..., P 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 , execute step S26; Step S24: n Corresponding buffer level Q n Set to the specified buffer level and execute 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 , execute 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 to no jump flag, if n≠1 and Q n >Q n+1 , then G n Set as jump indicator (Q n ,Q n+1 ), if n=N, and Q n ≠0, then G n Set as jump indicator (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 jump mark (i, j), if n=N, then G 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, initially set n=1, initially set the 0th level buffer R0 to be empty, set the level to be stored in the tth level buffer R t is empty, and the value of t ranges from 1 to T; Step S42: P n Write Q n The level buffer and P n Marked as unprocessed state, if G n If it is a non-jump flag, execute step S47; otherwise, execute step S43; Step S43: Get G n The corresponding jump identifier (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+1th level buffer. e ,P e Including the starting address and total length of all unprocessed data packets in the current e-th level buffer, e Write to the e-th level buffer and mark all unprocessed packets in the current e+1-th level buffer as processed; Step S45: If e=H n , then execute step S46, if e>H n , then set e=e-1 and return to step S44; Step S46: If H n =0, then create a new empty buffer R to be stored in the tth level t Then, execute step S47. If H n ≠0, directly execute 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 at 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 at the next level, when the total length of the data packet corresponding to the jump packet is executed, return to the previous 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 set 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

  • Storage control device, processing device, computer system, and storage control method

    CN112559389A

  • A medium access control protocol data unit in a message 3 buffer

    CN112655268A

  • Hierarchical random caching method in named data network

    CN113783779A

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

    CN116738414A

  • Cache request processing method and device, equipment and storage medium

    CN117573573A