Arbitrary bit width conversion method and device, computer equipment and storage medium

By establishing a first-in-first-out queue and a shift register group in data stream processing to perform bit-width conversion and data insertion and deletion operations, the problem of high resource occupation and delay in traditional methods is solved, and the efficiency of data stream processing is improved.

CN118760640AActive Publication Date: 2024-10-11HANGZHOU CORE POWER SEMICON CO LTD
View PDF 12 Cites 0 Cited by

Patent Information

Application Number
CN202410753709.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-12
Publication Date
2024-10-11
Estimated Expiration
2044-06-12

AI Technical Summary

Technical Problem

Traditional methods cannot simultaneously implement bit width conversion and data insertion and deletion operations during data stream processing, resulting in high logical/storage resource usage, complex clock cycles, and high latency.

Method used

By determining the input bit width, output bit width, number of consecutive data inputs, insertion length, and deletion length, a first-in-first-out queue and shift register group are established to perform data insertion and deletion operations, and perform bit width conversion based on the bit width relationship. Ensure the efficiency of data stream processing.

Benefits of technology

It realizes the simultaneous execution of bit width conversion and data insertion and deletion, which improves work efficiency, saves time and resources, and simplifies the control logic.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118760640A_ABST
    Figure CN118760640A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data processing, and discloses an arbitrary bit width conversion method and device, computer equipment and a storage medium, and the method comprises the steps: determining an input bit width, an output bit width, a data continuous input number, a data insertion length and a data deletion length of to-be-processed data; according to the input bit width, the output bit width and the continuous data input number, the depth of a first-in first-out queue and the length of a shift register set are determined, and the corresponding first-in first-out queue and the shift register set are established; data to be processed are input into the first-in-first-out queue, the data to be processed in the first-in-first-out queue are read through the shifting register set, data insertion or deletion operation is carried out on the data to be processed according to the size relation between the input bit width and the output bit width, and the bit width of the data to be processed is converted into output data with the output bit width. Bit width conversion and data insertion and deletion can be executed at the same time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing, and in particular to an arbitrary bit width conversion method, device, computer equipment and storage medium. Background Art

[0002] In digital integrated circuit design, especially in the process of data stream processing, data bit width conversion and deletion and insertion of some data in the data stream are often involved. A typical example is the preprocessing and postprocessing of Quasi-Cyclic Low Density Parity Check (QC-LDPC) coding. Preprocessing requires padding the input data length to the standard information bit length, and converting the input bit width to the block size of the QC-LDPC code, and then handing it over to the encoding core to complete the encoding. Post-processing can convert the block size back to the output bit width required by the external, and delete the bits filled in the information field to save storage or bandwidth. If the encoder is suitable for NAND Flash, the parity bit header can be filled according to the page size of the NAND Flash to adapt to the spare size of the NAND Flash.

[0003] Traditional methods can generally only complete bit width conversion and cannot insert or delete data, or use a ping-pong method to complete bit width conversion, occupying more logic / storage resources or performing input / output judgment in each clock cycle, resulting in complex control interactions and high latency. Summary of the invention

[0004] In a first aspect, the present application provides a method for arbitrary bit width conversion, comprising:

[0005] Determine the input bit width, output bit width, number of consecutive data inputs, data insertion length and data deletion length of the data to be processed;

[0006] Determine the depth of the first-in-first-out queue and the length of the shift register group according to the input bit width, the output bit width and the number of consecutive data inputs, and establish a corresponding first-in-first-out queue and shift register group;

[0007] When a data insertion operation is required, the data to be processed is input into the first-in first-out queue, the data to be processed in the first-in first-out queue is read by the shift register group, and the data to be processed is inserted according to the input bit width and the data insertion length;

[0008] When a data deletion operation is required, the data to be processed is input into the first-in-first-out queue, the data to be processed is read through the shift register group, and the deletion operation is performed on the data to be processed based on the size relationship between the input bit width and the output bit width and the data deletion length, and the bit width of the data to be processed is converted into output data with the output bit width.

[0009] Further, the inserting operation on the data to be processed according to the input bit width and the data insertion length includes:

[0010] Determine the insertion position of data insertion;

[0011] The number of times of continuous data insertion is determined according to the input bit width and the data insertion length, and when the insertion position reaches the head of the first-in-first-out queue, a corresponding number of data insertion operations are performed.

[0012] Furthermore, after determining the insertion position of the data, the method further includes:

[0013] Determine whether the current head of the input / output queue is the insertion position; if not, perform a data reading operation until the current head data is the insertion position.

[0014] Further, the deleting operation on the data to be processed according to the data deletion length includes:

[0015] Determine the deletion location of the data to be deleted;

[0016] If the deletion position is located at the head of the shift register group, data of the deletion length is deleted.

[0017] Furthermore, after determining the deletion location of the data to be deleted, the method further includes:

[0018] If the deletion position is not located at the head of the shift register group, a data write operation is performed until the head of the current data stream is the deletion position.

[0019] Further, the determining the depth of the first-in-first-out queue and the length of the shift register group according to the input bit width, the output bit width and the number of consecutive data inputs includes:

[0020] The depth of the first-in-first-out queue and the length of the shift register group are calculated according to the following expressions;

[0021]

[0022] Wherein, D is the depth of the first-in-first-out queue, L is the length of the shift register group, W1 is the input bit width, W2 is the output bit width, and N is the number of consecutive data inputs.

[0023] Furthermore, the step of converting the bit width of the data to be processed into output data of the output bit width includes:

[0024] According to the output bit width, the amount of data read in a single data read is controlled so that the amount of data read in a single data read is equal to the output bit width.

[0025] In a second aspect, the present application further provides an arbitrary bit width conversion device, comprising:

[0026] A data processing module, used to determine the input bit width, output bit width, number of continuous data inputs, data insertion length and data deletion length of the data to be processed;

[0027] An initialization module, used to determine the depth of the first-in-first-out queue and the length of the shift register group according to the input bit width, the output bit width and the number of continuous data inputs, and to establish a corresponding first-in-first-out queue and shift register group;

[0028] A data insertion module, used for inputting the data to be processed into the first-in first-out queue when a data insertion operation is required, reading the data to be processed in the first-in first-out queue through the shift register group, and performing an insertion operation on the data to be processed according to the input bit width and the data insertion length;

[0029] A data deletion module is used for inputting the data to be processed into the first-in-first-out queue when a data deletion operation is required, reading the data to be processed through the shift register group, and deleting the data to be processed according to the size relationship between the input bit width and the output bit width and the data deletion length, and converting the bit width of the data to be processed into output data with an output bit width.

[0030] In a third aspect, the present application further provides a computer device, comprising a processor and a memory, wherein the memory stores a computer program, and when the computer program is run on the processor, the arbitrary bit width conversion method is executed.

[0031] In a fourth aspect, the present application further provides a readable storage medium storing a computer program, which executes the arbitrary bit width conversion method when running on a processor.

[0032] The present invention relates to the technical field of data processing, and discloses an arbitrary bit width conversion method, which includes: determining the input bit width, output bit width, number of continuous data inputs, data insertion length and data deletion length of data to be processed; determining the depth of a first-in-first-out queue and the length of a shift register group according to the input bit width, output bit width and number of continuous data inputs, and establishing a corresponding first-in-first-out queue and shift register group; when a data insertion operation is required, the data to be processed is input into the first-in-first-out queue, and an insertion operation is performed on the data to be processed according to the input bit width and the data insertion length; when a data deletion operation is required, the data to be processed is read through the shift register group, and a deletion operation is performed on the data to be processed according to the size relationship between the input bit width and the output bit width and the data deletion length, and the bit width of the data to be processed is converted into output data of the output bit width. The bit width conversion and data insertion and deletion can be performed simultaneously, thereby improving work efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the technical solution of the present invention, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and should not be regarded as limiting the scope of protection of the present invention. In each of the drawings, similar components are numbered similarly.

[0034] Figure 1 A schematic diagram of a process flow of an arbitrary bit width conversion method according to an embodiment of the present application is shown;

[0035] Figure 2 A schematic diagram of the data flow direction of an embodiment of the present application is shown;

[0036] Figure 3 A schematic diagram of bit width conversion according to an embodiment of the present application is shown;

[0037] Figure 4 A schematic diagram of a state machine change in an embodiment of the present application is shown;

[0038] Figure 5 Another schematic diagram of state machine changes in an embodiment of the present application is shown;

[0039] Figure 6 A schematic diagram of the data insertion and data deletion process in an embodiment of the present application is shown;

[0040] Figure 7 A schematic diagram of the structure of an arbitrary bit width conversion device according to an embodiment of the present application is shown. DETAILED DESCRIPTION

[0041] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.

[0042] The components of the embodiments of the present invention generally described and shown in the drawings herein may be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0043] Hereinafter, the terms "including", "having" and their cognates, which may be used in various embodiments of the present invention, are intended only to indicate specific features, numbers, steps, operations, elements, components or combinations of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components or combinations of the foregoing items or adding the possibility of one or more features, numbers, steps, operations, elements, components or combinations of the foregoing items.

[0044] Furthermore, the terms “first”, “second”, “third”, etc. are merely used for distinguishing descriptions and are not to be understood as indicating or implying relative importance.

[0045] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present invention belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present invention.

[0046] The present application is applied to the bit width conversion of data involved in the data stream processing process and the deletion and insertion operations of part of the data in the data stream. The present application determines the input bit width, output bit width, number of continuous data inputs, data insertion length and data deletion length of the data to be processed; according to the input bit width, the output bit width and the number of continuous data inputs, the depth of the first-in-first-out queue and the length of the shift register group are determined, and the corresponding first-in-first-out queue and shift register group are established; the data to be processed is input into the first-in-first-out queue, the data to be processed in the first-in-first-out queue is read by the shift register group, and the data to be processed is inserted according to the input bit width and the data insertion length; according to the data deletion length, the data to be processed is deleted, and according to the size relationship between the input bit width and the output bit width, the bit width of the data to be processed is converted into output data of the output bit width. In this way, bit width conversion and data insertion and deletion operations are realized at the same time, thereby saving time and improving work efficiency.

[0047] Next, the technical solution of the present application is described with specific embodiments.

[0048] Example 1

[0049] like Figure 1 As shown, the arbitrary bit width conversion method of this embodiment includes:

[0050] Step S100, determining the input bit width, output bit width, number of continuous input data, data insertion length and data deletion length of the data to be processed.

[0051] The technical solution of this embodiment is applied to the processing of data streams, especially to bit width conversion and deletion and insertion of some data in the data stream. Among them, the input bit width and output bit width are determined according to the relationship between the front and back stages of the data stream processing. The processing bit width of the front-stage module corresponds to the input bit width, and the processing bit width of the back-stage module corresponds to the output bit width. When the input bit width is smaller than the output bit width, the bit width needs to be expanded, and when the input bit width is larger than the output bit width, the bit width needs to be reduced.

[0052] In order to meet some processing conditions during data processing, some data padding operations will be required. For example, in some scenarios where there are requirements for data formats, such as the length of information bits specified by the check matrix, data padding will be required. Therefore, the corresponding data insertion length will be obtained according to the data formats that need to be adapted. Similarly, data insertion usually inserts a string of meaningless characters, such as inserting a string of "0". After the data is processed, this string of "0" needs to be deleted, so there is a data deletion length.

[0053] Specifically, data stream processing usually includes preprocessing and post-processing. When the data to be processed is preprocessed, the data needs to convert the input bit width into the output bit width. At the same time, in order to make the data match the corresponding data format, it is necessary to insert data into the data to be processed so that the data format meets the processing requirements. After the data processing is completed, it enters the post-processing stage. At this time, in addition to the bit width conversion, the data inserted during preprocessing will also need to be deleted.

[0054] Specific as Figure 2 As shown in the figure, the data is input into the input first-in-first-out queue with a bit width of W1, and then input into the shift register group after being processed by the first-in-first-out queue. After being processed by the shift register group, it is input to the target position with a bit width of W2. For the two application scenarios of data pre-processing and post-processing, the flow direction and processing order of data flow are the same as Figure 2 The same as in.

[0055] Step S200, determining the depth of the first-in-first-out queue and the length of the shift register group according to the input bit width, the output bit width and the number of consecutive data inputs, and establishing a corresponding first-in-first-out queue and shift register group.

[0056] In this embodiment, whether the input bit width is greater than the output bit width or vice versa, when executing the above two steps, the data stream will be processed through a first-in-first-out queue and a shift register group to complete the reading and writing operations of the data stream, as well as the above bit width conversion and data insertion and deletion operations. Different bit widths have different requirements for the parameters of the above first-in-first-out queue and the shift register group, that is, when performing the above data processing, the first-in-first-out queue and the shift register group must not have data overflow. For this reason, it is necessary to calculate the required depth D of the first-in-first-out queue and the required length L of the shift register group according to the input bit width and the output bit width.

[0057] Specifically, the calculation expressions for depth and length are as follows:

[0058]

[0059] Wherein, D is the depth of the first-in-first-out queue, L is the length of the shift register group, W1 is the input bit width, W2 is the output bit width, and N is the number of consecutive data inputs.

[0060] It can be seen from the above formula that the calculated values ​​of D and L will be different for different input bit widths and output bit widths.

[0061] Taking the LDPC encoding process in the NAND Flash controller as an example, the encoded single data stream contains 32748 bits of user data, 96 bits of flash metadata (Fmeta) and 32 bits of cyclic redundancy check (CRC), and the data width is 32 bits. Preprocessing requires filling 32 bits of "0" in the header of the single data stream to adapt to the information bit length of 32928 bits specified by the check matrix, and converting the 32-bit bit width to 147 bits.

[0062] During the preprocessing process:

[0063] If no overflow occurs, the depth D of the FIFO queue is:

[0064]

[0065] The length L of the shift register group is:

[0066]

[0067] Similarly, in the post-processing process, the 32 bits of "0" in the header need to be removed, and 146 bits of "0" are filled in front of the check bit to adapt to the page size of the NAND Flash medium, and the 147-bit bit width is converted to 32 bits. Therefore, the input bit width and output bit width of the post-processing are exactly opposite to those of the pre-processing. If no overflow occurs, the depth D of the first-in first-out queue is:

[0068]

[0069] The length L of the shift register group is:

[0070] L = W1 + W2 = 147 + 32 = 179;

[0071] It should be noted here that W1 and W2 in post-processing are opposite to those in pre-processing.

[0072] As can be seen from the above formula, corresponding calculation operations are performed according to the different size relationships between W1 and W2, thereby determining the depth of the first-in-first-out queue and the length of the shift register group required to be generated during processing, ensuring that overflow will not occur during subsequent processing, and ensuring the safety and stability of the data processing process.

[0073] Step S300, when a data insertion operation is required, the data to be processed is input into the first-in-first-out queue, the data to be processed in the first-in-first-out queue is read by the shift register group, and the data to be processed is inserted according to the input bit width and the data insertion length;

[0074] When executing data stream processing services, the data to be processed will first enter the first-in-first-out queue and then be read by the shift register group. When the data passes through the first-in-first-out queue and reaches the shift register group, some data insertion processing operations will be performed. Depending on the actual processing content, there are pre-processing stages and post-processing stages. Regardless of the processing stage, the insertion position of the data insertion will be determined; according to the input bit width and the data insertion length, the number of consecutive data insertions is determined, and when the insertion position reaches the head of the first-in-first-out queue, the corresponding number of data insertion operations are performed.

[0075] When executing the preprocessing step, before data is inserted, the data will first exist in the first-in-first-out queue, where according to the nature of the first-in-first-out queue, the data will be output from the head of the queue to the subsequent shift register group in sequence, so at this time, it will first be judged whether the current head of the queue is the position where data needs to be inserted. If the current head of the queue is not the position where data needs to be inserted, a data read operation is performed to move the data at the head of the queue out of the queue one by one until the head of the current data stream is the data insertion position, and then the data insertion operation can be started. When data is inserted, the insertion data is generated at the head of the queue. It can be understood that the maximum amount of data inserted at one time is limited by the input bit width, so the maximum amount of inserted data is the same as the input bit width, so according to the size of the input bit width, the number of data insertions required can be determined. When the insertion is completed, the first-in-first-out queue continues to perform the read operation until all the data are moved out of the first-in-first-out queue and arrive at the shift register group, thereby completing the data insertion operation during the removal process.

[0076] In this embodiment, the above insertion process can be implemented by a state machine, as shown in the following example: Figure 4 As shown, the initial state is the initial state, which is triggered by a reset signal. When the FIFO is not empty, it enters the read state or the insert state. It can be understood that it will only enter the insert state when the head is the position where data needs to be inserted. At this time, if W1 is less than W2, continuous reading or insertion is required in these two states. Once the data is read or inserted, it will enter the waiting state. Otherwise, it only needs to read or insert once to enter the waiting state. After waiting for several clock cycles in the waiting state, it will determine whether the reading or inserting operation is completed. If it is completed, it will enter the end state. Otherwise, it will return to the reading state or the inserting state. After entering the end state, it will give a reading and inserting completion signal and return to the initial state to wait for the next data flow processing.

[0077] Specifically, still taking the example in step S200 as an illustration, at this time, in order to adapt to the information bit length specified by the parity check matrix, the preprocessing needs to fill 32 bits of "0" at the head of a single data stream. Then, in this step, it will first determine that 32 bits of "0" need to be filled and where this part of the data needs to be filled. Since in this example, 32 bits of "0" are filled at the head, these data will be inserted into the head of the queue at the beginning. After the insertion is completed, the corresponding data reading operation will be carried out. Among them, the input bit width is 32 bits, so the data filling operation can be completed through one insertion.

[0078] The principle of the post-processing operation is similar to that of the preprocessing. Continuing with the above example, when in the post-processing operation, it will be necessary to remove 32 bits of "0" at the head and fill 146 bits of "0" in front of the parity bits to adapt to the page size of the NAND Flash medium. Therefore, the data insertion size is 146 bits, and the position is in the middle of the data stream. And at this time, the input bit width is 147, so the insertion operation can be completed within one insertion. After the insertion is completed, the reading operation starts until the data reading is completed. In the above example, two insertions are performed, and the sizes of the inserted data are different, and the corresponding processing is also different.

[0079] Step S400, when a data deletion operation is required, the data to be processed is input into the first-in-first-out queue, the data to be processed is read through the shift register group, a deletion operation is performed on the data to be processed according to the data deletion length, and according to the size relationship between the input bit width and the output bit width, the bit width of the data to be processed is converted into output data with the output bit width. For the deletion operation, first, it is necessary to determine the deletion position of the data to be deleted; if the deletion position is at the head of the shift register group, then delete the data of the deletion length. If the deletion position is not at the head of the shift register group, then a data write operation is performed until the head of the current data stream is the deletion position.

[0080] First, the principle of bit width conversion is explained. As Figure 3 shown, denote the effective data length K in the shift register group. If W1 < W2, the shift logic is as Figure 3 shown. Assume that at time i - 2, K = W2 - 1, and the input data length at this time is W1. Then at time i - 1, K = W2 + W1 - 1. If no write operation occurs at time i and the condition K ≥ W2 is satisfied, then the shift-out operation of the shift register group is triggered, and the shift-out length is W2. At this time, K = W1 - 1. At time i + 1, the shift-in operation continues until at a certain moment no write operation occurs and K ≥ W2, then the shift-out operation is triggered, that is, multiple writes trigger one shift-out. If W1 > W2, the shift logic is the same as when W1 < W2, except that one write will trigger multiple shift-outs.

[0081] In this embodiment, the deletion operation can be implemented by a state machine, as shown in the following example: Figure 5 As shown, the initial state is triggered by the asynchronous reset signal. When the shift register group is detected to be ready for data, it is determined whether the data needs to be discarded from the head. If yes, it will jump to the delete state, if not, it will jump to the write state. The write state will write the data to be written into the shift register completely according to the input bit width. The delete state will skip the characters to be deleted according to the deletion length, write the remaining valid bits into the shift register group, and discard the rest. If there are multiple data that need to be deleted in a single data stream, the state of the state machine will repeatedly migrate between the delete state and the write state until the word data stream is processed, and then it will enter the end state. After the word data stream processing completion signal is given in the end state, it will jump to the initial state.

[0082] Specifically, the corresponding deletion operation is performed following the insertion operation in step 300. During preprocessing, only data needs to be written into the shift register group, that is, no data deletion operation is required. Therefore, in the preprocessing state, only a write operation is required.

[0083] If in the post-processing state, W1=147, W2=32. At this time, the bit width of a write is 147, so for each write, K is detected 5 times. If K≥32, a shift is triggered, and 32 bits of data are shifted out each time, thereby reducing the bit width. At the same time, in the post-processing state, it is also necessary to remove the 32 bits of "0" filled in the pre-processing process. First, determine whether the data to be deleted is located at the head of the data stream. If so, perform a deletion operation on the 32-bit data. After the deletion is completed, write the remaining valid 114 bits to the shift register group. If the head of the data stream is not the deletion position, write 146 bits of valid data directly until it reaches the queue position where the deletion operation is required, and then perform the operation corresponding to the above operation to delete the corresponding data and write the remaining valid data to the shift register group. In this way, while completing the bit width conversion, the data deletion operation is also performed.

[0084] Similarly, if W1=32, W2=147, the shift register group writes a bit width of 32 each time, and W2 / W1=4.5, then K is detected every 4 writes. If K≥147, a shift out is triggered, and each shift out is 147 bits of data, thereby achieving bit width expansion. Moreover, because the length of the deleted data is reached, it does not affect the execution of the data deletion operation. As long as the data of the corresponding length is deleted, the data deletion operation is completed.

[0085] Among them Figure 6As shown, a set of pre-processing and post-processing processes of step S300 and step S400 are included, including the changing process of data insertion, data deletion and bit width conversion. When the data to be processed flows in, it is pre-processed, data insertion and bit width conversion are performed to obtain the pre-processed data. When the data processing is completed and the post-processing is performed, the corresponding data insertion, data deletion and bit width conversion operations are performed to obtain the post-processed data. In the whole process, data insertion, data deletion and bit width conversion are completed synchronously with the transmission of data. It can be understood that the first-in-first-out queue and the shift register group are mainly used for the read and write operations of the data stream, and the present embodiment integrates the operations of data insertion, data deletion and bit width conversion in the process of reading and writing the data stream, so that these steps can be perfectly integrated, instead of first performing bit width conversion, then performing data insertion and deletion, or performing data insertion and deletion, and then performing bit width conversion. The two steps can be performed simultaneously, reducing resource occupation, thereby increasing work efficiency.

[0086] Example 2

[0087] like Figure 7 As shown, this embodiment also provides an arbitrary bit width conversion device, including:

[0088] The data processing module 10 is used to determine the input bit width, output bit width, number of continuous data inputs, data insertion length and data deletion length of the data to be processed;

[0089] An initialization module 20, for determining the depth of a first-in-first-out queue and the length of a shift register group according to the input bit width, the output bit width and the number of consecutive data inputs, and establishing a corresponding first-in-first-out queue and shift register group;

[0090] A data insertion module 30, used for inputting the data to be processed into the first-in first-out queue when a data insertion operation is required, reading the data to be processed in the first-in first-out queue through the shift register group, and performing an insertion operation on the data to be processed according to the input bit width and the data insertion length;

[0091] The data deletion module 40 is used to input the data to be processed into the first-in-first-out queue when a data deletion operation is required, read the data to be processed through the shift register group, and perform a deletion operation on the data to be processed based on the size relationship between the input bit width and the output bit width and the data deletion length, and complete the conversion of the bit width of the data to be processed into output data with an output bit width.

[0092] The present application also provides a computer device, including a processor and a memory, wherein the memory stores a computer program, and when the computer program is run on the processor, the arbitrary bit width conversion method is executed.

[0093] The present application also provides a readable storage medium storing a computer program, wherein the computer program executes the arbitrary bit width conversion method when running on a processor.

[0094] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in an alternative implementation, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the structure diagram and / or the flow chart, and the combination of boxes in the structure diagram and / or the flow chart, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0095] In addition, the functional modules or units in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.

[0096] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0097] The above description is only a specific implementation mode of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.

Claims

1. A method for arbitrary bit width conversion, characterized in that: include: Determine the input bit width, output bit width, number of consecutive data inputs, data insertion length and data deletion length of the data to be processed; Determine the depth of the first-in-first-out queue and the length of the shift register group according to the input bit width, the output bit width and the number of consecutive data inputs, and establish a corresponding first-in-first-out queue and shift register group; When a data insertion operation is required, the data to be processed is input into the first-in first-out queue, the data to be processed in the first-in first-out queue is read by the shift register group, and the data to be processed is inserted according to the input bit width and the data insertion length; When a data deletion operation is required, the data to be processed is input into the first-in-first-out queue, the data to be processed is read through the shift register group, the deletion operation is performed on the data to be processed according to the data deletion length, and the bit width of the data to be processed is converted into output data of the output bit width according to the size relationship between the input bit width and the output bit width.

2. The arbitrary bit width conversion method according to claim 1, characterized in that: The inserting operation on the data to be processed according to the input bit width and the data insertion length includes: Determine the insertion position of data insertion; The number of times of continuous data insertion is determined according to the input bit width and the data insertion length, and when the insertion position reaches the head of the first-in-first-out queue, a corresponding number of data insertion operations are performed.

3. The arbitrary bit width conversion method according to claim 2, characterized in that: After determining the insertion position of the data, the method further includes: Determine whether the current head of the input / output queue is the insertion position; if not, perform a data reading operation until the current head data is the insertion position.

4. The arbitrary bit width conversion method according to claim 1, characterized in that: The deleting operation on the data to be processed according to the data deletion length includes: Determine the deletion location of the data to be deleted; If the deletion position is located at the head of the shift register group, data of the deletion length is deleted.

5. The arbitrary bit width conversion method according to claim 4, characterized in that: After determining the deletion location of the data to be deleted, the method further includes: If the deletion position is not located at the head of the shift register group, a data write operation is performed until the head of the current data stream is the deletion position.

6. The arbitrary bit width conversion method according to claim 1, characterized in that: Determining the depth of the first-in-first-out queue and the length of the shift register group according to the input bit width, the output bit width and the number of consecutive data inputs includes: The depth of the first-in-first-out queue and the length of the shift register group are calculated according to the following expressions; Wherein, D is the depth of the first-in-first-out queue, L is the length of the shift register group, W1 is the input bit width, W2 is the output bit width, and N is the number of consecutive data inputs.

7. The arbitrary bit width conversion method according to claim 1, characterized in that: The step of converting the bit width of the data to be processed into output data of the output bit width comprises: If the input bit width is greater than the output bit width, after performing a data reading operation, the read data to be processed are outputted in sequence according to the output bit width; If the input bit width is smaller than the output bit width, multiple data reading operations are performed until the length of the read data to be processed is the same as the output bit width, and then the data to be processed is output.

8. An arbitrary bit width conversion device, characterized in that: include: A data processing module, used to determine the input bit width, output bit width, number of continuous data inputs, data insertion length and data deletion length of the data to be processed; An initialization module, used to determine the depth of the first-in-first-out queue and the length of the shift register group according to the input bit width, the output bit width and the number of continuous data inputs, and to establish a corresponding first-in-first-out queue and shift register group; A data insertion module, used for inputting the data to be processed into the first-in first-out queue when a data insertion operation is required, reading the data to be processed in the first-in first-out queue through the shift register group, and performing an insertion operation on the data to be processed according to the input bit width and the data insertion length; A data deletion module is used for inputting the data to be processed into the first-in-first-out queue when a data deletion operation is required, reading the data to be processed through the shift register group, and deleting the data to be processed according to the size relationship between the input bit width and the output bit width and the data deletion length, and converting the bit width of the data to be processed into output data with an output bit width.

9. A computer device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a computer program, and when the computer program is run on the processor, the method for converting any bit width according to any one of claims 1 to 7 is executed.

10. A readable storage medium, characterized in that: The computer program stores a computer program, which executes the arbitrary bit width conversion method according to any one of claims 1 to 7 when running on a processor.

Citation Information

Patent Citations

  • FIFO device and method thereof

    CN103677732A

  • Data transmission method and device

    CN106294234A

  • AXI protocol interface-based arbitrary bit width conversion method and device

    CN109815181A

  • Data splicing structure and method and on-chip implementation thereof

    CN110554852A

  • Data preprocessing method and device, electronic equipment and computer readable storage medium

    CN113131949A