Disclosure of Invention
In view of the above, the main objective of the present invention is to provide a method and an apparatus for outputting a Turbo decoding result, which can realize outputting a Turbo decoding result with low cost and high efficiency.
In order to achieve the purpose, the technical scheme of the invention is realized as follows:
a method for outputting Turbo decoding results, the method comprising:
reading Turbo decoding results stored by taking a code block CB as a unit into a parallel shift register;
selecting the tap position of the parallel shift register according to the relevant information of the CB, and carrying out data splicing;
and controlling the output of the splicing result.
Reading the Turbo decoding result stored by taking CB as a unit into the parallel shift register is as follows:
reading a first Word of the CB, and inputting the first Word into a first-stage register of the parallel shift register; wherein the width w of the Word is 8, 16 or 32;
and reading the next Word of the CB, inputting the next Word into a first-stage register of the parallel shift register, and simultaneously shifting the data originally stored in the first-stage register into a second-stage register of the parallel shift register in parallel.
Wherein, according to the relevant information of the CB, the tap position of the parallel shift register is selected as follows:
when the CB is the first CB of the Turbo decoding result, tap positions of the parallel shift register are selected to be bit n-bit (w-1) of a second-stage register and bit 0-bit (n-1) of a first-stage register of the parallel shift register; wherein n is the number of dummy elements of the CB;
and when the CB is not the first CB of the Turbo decoding result, obtaining the bit number m of the effective data which is not output by the last CB according to the CB index of the CB and the size of the CB, and selecting tap positions of the parallel shift register as bit (w-m) -bit (w-1) of the second-stage register and bit 0-bit (w-m-1) of the first-stage register.
Wherein the data splicing is performed as follows: the spliced w bit data are data stored by bit n-bit (w-1) of the second-stage register and bit 0-bit (n-1) of the first-stage register from low bit to high bit; or,
the w bit data obtained by splicing are data stored in the second-stage register bit (w-m) -bit (w-1) and the first-stage register bit 0-bit (w-m-1) in sequence from the low bit to the high bit.
Further, the method further comprises:
judging whether the bit number of effective data in the spliced data is w or not;
and if the bit number of the effective data is not w, further judging whether the currently processed CB is the last CB of the Turbo decoding result.
Wherein, the output of the control splicing result is as follows:
if the bit number of the effective data in the spliced data is w, outputting the splicing result to an external cache;
if the bit number of the effective data in the spliced data is not w and the current processed CB is the last CB, supplementing 0 or 1 behind the effective data, and outputting to an external cache after completing w bits;
and if the bit number of the effective data in the spliced data is not w and the current processed CB is not the last CB, moving the spliced data, right-moving the effective data to the rightmost end, writing the effective data back to a first-stage register of the parallel shift register, and reading the first Word of the next CB.
An apparatus for outputting a Turbo decoding result, the apparatus comprising: the device comprises an input selection module, a parallel shift register, a data splicing control module and an output selection module; wherein,
the input selection module is used for reading the Turbo decoding result stored by taking CB as a unit into the parallel shift register;
the data splicing control module is used for selecting the tap position of the parallel shift register according to the relevant information of the CB and splicing data;
and the output selection module is used for controlling the output of the splicing result.
Further, the input selection module is specifically configured to read a first Word of the CB, and input the first Word into a first stage register of the parallel shift register; reading the next Word of the CB, inputting the next Word into the first-stage register, and simultaneously shifting the data originally stored in the first-stage register into a second-stage register of the parallel shift register in parallel; wherein the width w of the Word is 8, 16 or 32.
Further, the data splicing control module is specifically configured to select tap positions of the parallel shift register as bit n-bit (w-1) of a second stage register and bit 0-bit (n-1) of a first stage register of the parallel shift register when the CB is a first CB of the Turbo decoding result; wherein n is the number of dummy elements of the CB; and when the CB is not the first CB of the Turbo decoding result, obtaining the bit number m of the effective data which is not output by the last CB according to the CB index of the CB and the size of the CB, and selecting tap positions of the parallel shift register as bit (w-m) -bit (w-1) of the second-stage register and bit 0-bit (w-m-1) of the first-stage register.
Furthermore, w bit data obtained by splicing by the data splicing control module are data stored by bit n-bit (w-1) of the second-stage register and bit 0-bit (n-1) of the first-stage register from low bit to high bit; or sequentially storing data from bit (w-m) -bit (w-1) of the second-stage register and bit 0-bit (w-m-1) of the first-stage register.
Further, the data splicing control module is further configured to determine whether a bit number of valid data in the spliced data is w; and if the bit number of the effective data is not w, further judging whether the currently processed CB is the last CB of the Turbo decoding result.
Further, the output selection module is specifically configured to output the splicing result to an external cache if the number of bits of valid data in the data obtained by splicing is w; if the bit number of the effective data in the spliced data is not w and the current processed CB is the last CB, supplementing 0 or 1 behind the effective data, and outputting to an external cache after completing w bits; and if the bit number of the effective data in the spliced data is not w and the current processed CB is not the last CB, moving the spliced data, right-moving the effective data to the rightmost end, writing the effective data back to a first-stage register of the parallel shift register, and reading the first Word of the next CB.
The method and the device for outputting the Turbo decoding result realize the parallel processing of the Turbo decoding result through the parallel shift register and the data splicing control module, thus realizing the output of the Turbo decoding result with low cost and high efficiency, having the characteristics of low storage overhead, small processing time delay, simple processing and the like, further improving the system processing capacity and being beneficial to reducing the cost.
Detailed Description
The basic idea of the invention is as follows: reading Turbo decoding results stored by taking a code block CB as a unit into a parallel shift register; selecting the tap position of the parallel shift register according to the relevant information of the CB, and carrying out data splicing; controlling the output of the splicing result; the information related to the CB may be one or more of the number of dummy bits of the CB, a CB index, and a CB size.
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail below with reference to the accompanying drawings by way of examples.
Fig. 1 shows an implementation process of the Turbo decoding result output method of the present invention, and as shown in fig. 1, the method includes the following steps:
step 101, reading a Turbo decoding result stored by taking CB as a unit into a parallel shift register;
in this step, the parallel shift register may be 8bit, 16bit, 32bit parallel shift register; specifically, a first Word of a CB of the Turbo decoding result is read from an internal cache in which the Turbo decoding result is stored, the first Word is input into a first-stage register of the parallel shift register, then the next Word is read and input into a first-stage register of the parallel shift register, and data originally stored in the first-stage register is shifted into a second-stage register in parallel; wherein, the width w of the Word can be 8, 16 or 32, which is respectively marked as Word8, Word16 or Word 32;
102, selecting a tap position of a parallel shift register according to the related information of the CB, and carrying out data splicing;
specifically, in this step, the tap position may be selected according to one or more of parameters such as the dummy number of the CB, the CB index, and the CB size; when the CB is the first CB of the Turbo decoding result, tap positions of the parallel shift register are selected to be bit n-bit (w-1) of a second-stage register and bit 0-bit (n-1) of a first-stage register of the parallel shift register; wherein n is the number of dummy elements;
when the CB is not the first CB of the Turbo decoding result, obtaining the bit number m of effective data which is not output by the last CB according to the CB index and the size of the CB, and selecting tap positions of a parallel shift register as bit (w-m) -bit (w-1) of a second-stage register and bit 0-bit (w-m-1) of a first-stage register; wherein: the spliced w bit data are data stored by bit n-bit (w-1) of the second-stage register and bit 0-bit (n-1) of the first-stage register from low bit to high bit; or sequentially storing data from bit (w-m) -bit (w-1) of the second-stage register and from bit 0-bit (w-m-1) of the first-stage register.
Specifically, when w is 8, when the CB is the first CB of the Turbo decoding result, dummy bits may need to be filled to ensure that the length of each CB of the Turbo decoding result is the same; for example, when the number of the dummy bits of the first CB is 2, and when the first 8-bit data of the CB has been input to the second stage register of the parallel shift register, and the second 8-bit data of the CB has been input to the first stage register, the data stored in the first two bits of the second stage register is the dummy bits filled above, and is not valid data of the Turbo decoding result, and therefore, the tap position of the parallel shift register to be selected is the tap of the last six bits of the second stage register and the tap of the first two bits of the first stage register, and 8-bit data is obtained by splicing.
103, controlling the output of the splicing result;
here, the w bit data obtained by the splicing is output to an external cache and the like, and then the steps are repeated until the last group of data of one CB is obtained, and as the size of the CB is not necessarily integral multiple of w, the last group of data can also contain invalid data;
specifically, the method further comprises the following steps: judging whether the bit number of effective data in the spliced data is w or not; if the bit number of the effective data is not w, further judging whether the currently processed CB is the last CB of the Turbo decoding result;
correspondingly, if the bit number of the effective data in the spliced data is w, outputting the splicing result to an external cache;
if the bit number of the effective data in the spliced data is not w and the currently processed CB is the last CB, supplementing 0 or 1 behind the effective data, and outputting to an external cache after completing w bits;
if the bit number of the effective data in the spliced data is not w and the current processed CB is not the last CB, moving the spliced data, right-moving the effective data to the rightmost end, writing the effective data back to a first-stage register of a parallel shift register, and then reading the first Word of the next CB; specifically, after the write-back is performed to the first-stage register, at this time, the w bit data obtained by the splicing in step 102 are all invalid data, and the data are discarded, and then step 101 is repeated to read the first Word of the next CB.
Fig. 2 shows an internal buffer format and an expected external buffer format of a Turbo decoding result in a specific embodiment of the method for outputting a Turbo decoding result of the present invention, and for convenience of description, it is assumed that the maximum length of a CB in 3GPP is 64 bits, and the length of a currently processed TB is 154 bits, and it is assumed that a DSP/CPU system adopts a Word width w of 8, that is, Word8 is adopted. According to the CB separation algorithm, the total number of the CBs obtained by dividing is 3, the length of each CB is 52 bits, the filled dummy is 2 bits, under the conditions, after Turbo decoding is finished, the internal cache formats of the three CBs are shown as the left side of an arrow in figure 2, and the expected external cache format of the Turbo decoding result is shown as the right side of the arrow in figure 2; three rectangular boxes shown on the left side of the arrow in fig. 2 are hard decision results of a first CB, a second CB, and a third CB in sequence; in the hard decision result of the first CB, the first two bits of the first 8-bit data are filled dummy bits, and the last four bits of each CB are filled invalid data; the expected external cache format shown to the right of the arrow is the concatenation result after the invalid data is removed by the CB on the left.
FIG. 3 is a flowchart illustrating an implementation of a method for outputting the Turbo decoding result shown in FIG. 2 according to an embodiment, where in this embodiment, the width w of Word is 8; as shown in fig. 3, the embodiment comprises the following steps:
step 301, reading a first Word of a first CB, and storing the first Word into a first-stage register of a parallel shift register;
specifically, as shown in fig. 4, the first 8-bit data read from the first CB is stored in the first stage register of the parallel shift register, and at this time, the second stage register of the parallel shift register has not stored any data yet.
Step 302, reading the second Word of the CB, storing the second Word into the first-stage register of the parallel shift register, and shifting the data cached in the original first-stage register into the second-stage register at the moment;
specifically, as shown in fig. 5, the second 8-bit data of the first CB is read and input into the first stage register of the parallel shift register, and the data originally stored in the first stage register is shifted in parallel to the second stage register.
303, selecting tap positions of a first-stage register and a second-stage register according to related information of the CB, such as parameters of dummy number, CB index, CB size and the like, and performing data splicing;
specifically, referring to fig. 5, since the data in the positions bit0 and bit1 of the second level register are filled with dummy bits, the selected tap positions are bit2 to bit7 of the second level register and bit0 to bit1 of the first level register, so as to perform data splicing.
Step 304, outputting the spliced 8-bit data to an external cache and the like;
specifically, the spliced output data sequentially comprises bits 2 to 7 of the second-stage register and then bits 0 to 1 of the first-stage register from low bits to high bits.
Step 305, reading the next Word of the CB and storing the next Word into the first-level register of the parallel shift register, at this time, shifting the data cached in the original first-level register into the second-level register, and judging whether the number of bits of valid data in the Word obtained by splicing according to the tap position in the step is 8, if so, executing step 304, and if not, executing step 306;
specifically, the number of bits of valid data in the last Word of the first CB is 4, but less than 8 bits, referring to fig. 6, when the last Word is input into the first-stage register, the number of bits of valid data in the words obtained by splicing at this time is still 8, so step 304 is executed, 8-bit data obtained by splicing is output to an external cache, and then the step is repeatedly executed;
it should be noted that, at this time, the next Word of the Turbo decoding result is not read, but a random 8-bit data is stored in the first-stage register, and meanwhile, the data in the original first-stage register is shifted to the second-stage register in parallel, specifically referring to fig. 7, at this time, the 8-bit data obtained by splicing contains 2-bit valid data, so step 306 is executed.
Step 306, judging whether the currently processed CB is the last CB of the Turbo decoding result, if so, executing step 304, specifically, supplementing 0 or 1 to the back of less than 8-bit effective data, and outputting to an external cache after completing 8 bits; if not, go to step 307;
specifically, referring to fig. 7, the currently processed CB is not the last CB of the Turbo decoding result, so step 307 is performed.
307, moving the valid data in the spliced 8-bit data to the right end, writing the valid data back into a first-stage register, and shifting the data cached in the original first-stage register to a second-stage register;
specifically, referring to fig. 7, the valid data in the 8-bit data obtained by splicing in step 305 is shifted, right-shifted to the rightmost end, and written back to the first-stage register after being complemented to 8 bits by random data.
308, reading the first Word of the next CB, storing the first Word in a first-stage register, shifting 8-bit data containing effective data in the original first-stage register into a second-stage register, executing 303, re-determining the position of a tap, and splicing data;
specifically, referring to fig. 8, after the first Word of the second CB is stored in the first stage register, the positions of bits 6-bit 7 in the second stage register are 2 valid data that are not output by the first CB, and therefore, the determined tap positions are bits 6-7 of the second stage register and bits 0-5 of the first stage register, and then the above steps are repeated until the desired Turbo decoding result in the external buffer format is obtained as shown on the right side of the arrow in fig. 2.
Fig. 9 shows a schematic system structure of the Turbo decoding result output device of the present invention, and as shown in fig. 9, the output device may be built in a Turbo decoding processing unit of ASIC/FPGA, which reads the Turbo decoding result from an internal buffer, outputs the Turbo decoding result to an external storage after being processed by the output device, and then provides the Turbo decoding result to a CPU/DSP for use.
FIG. 10 shows a schematic structure of a Turbo decoding result output device of the present invention, and as shown in FIG. 10, the output device includes an input selection module, a parallel shift register, a data splicing control module, and an output selection module; the input selection module is used for reading a Turbo decoding result stored by taking CB as a unit into the parallel shift register; the data splicing control module is used for selecting the tap position of the parallel shift register according to the relevant information of the CB and splicing data; and the output selection module is used for controlling the output of the splicing result.
Further, the parallel shift register comprises a first stage register and a second stage register.
Further, the input selection module is specifically configured to read a first Word of the CB, and input the first Word into a first stage register of the parallel shift register; reading the next Word of the CB, inputting the next Word into the first-stage register, and simultaneously shifting the data originally stored in the first-stage register into a second-stage register of the parallel shift register in parallel; wherein the width w of Word is 8, 16 or 32, and is respectively marked as Word8, Word16 or Word 32.
Further, the data splicing control module is specifically configured to select tap positions of the parallel shift register as bit n-bit (w-1) of a second stage register and bit 0-bit (n-1) of a first stage register of the parallel shift register when the CB is a first CB of the Turbo decoding result; wherein n is the number of dummy elements of the CB; and when the CB is not the first CB of the Turbo decoding result, obtaining the bit number m of the effective data which is not output by the last CB according to the CB index of the CB and the size of the CB, and selecting tap positions of the parallel shift register as bit (w-m) -bit (w-1) of the second-stage register and bit 0-bit (w-m-1) of the first-stage register.
The w bit data spliced by the data splicing control module are data stored by the bits n-bit (w-1) of the second-stage register and the bits 0-bit (n-1) of the first-stage register from low bits to high bits in sequence; or sequentially storing data of bit (w-m) -bit (w-1) of the second-stage register and bit 0-bit (w-m-1) of the first-stage register.
Further, the data splicing control module is further configured to determine whether a bit number of valid data in the spliced data is w; and if the bit number of the effective data is not w, further judging whether the currently processed CB is the last CB of the Turbo decoding result.
Further, the output selection module is specifically configured to output the splicing result to an external cache if the number of bits of valid data in the data obtained by splicing is w; if the bit number of the effective data in the spliced data is not w and the current processed CB is the last CB, supplementing 0 or 1 behind the effective data, and outputting to an external cache after completing w bits; and if the bit number of the effective data in the spliced data is not w and the current processed CB is not the last CB, moving the spliced data, right-moving the effective data to the rightmost end, writing the effective data back to a first-stage register of the parallel shift register, and reading the first Word of the next CB.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention.