Data decoding method and device

By dividing the target encoding into the first 6-bit and the last 4-bit data set for decoding, the resource occupation problem caused by table lookup in 8b/10b encoding and decoding is solved, and efficient resource saving and decoding speed improvement is achieved.

CN119210649APending Publication Date: 2024-12-27SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411295875.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-14
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

The existing 8b/10b encoding and decoding methods require table review, which leads to a large amount of logical resources and lacks effective solutions.

Method used

By dividing the target encoding into the first data set and the second data set, decoding and processing it separately, the need to store the encoding table is avoided, and the polarity judgment of the target decoding is achieved.

Benefits of technology

Reduces resource usage, saves logical resources, improves decoding efficiency, and reduces power consumption and chip area.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119210649A_ABST
    Figure CN119210649A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a data decoding method and device, and the method comprises the steps: obtaining a target code which comprises 10-bit data; the target code is divided into a first data set and a second data set, the first data set comprises the first 6 bits of data in the 10 bits of data, and the second data set comprises the last 4 bits of data in the 10 bits of data; decoding 6-bit data in the first data set into 5-bit data to obtain a third data set, and decoding 4-bit data in the second data set into 3-bit data to obtain a fourth data set; and processing the third data set and the fourth data set to obtain target decoding, and obtaining the polarity of the target decoding according to the polarity of the target decoding. Through the data decoding method and device, the problem that more resources are occupied due to the fact that table lookup is needed for data decoding in the prior art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computers, and more specifically, to a method and device for decoding data. Background Art

[0002] 8b / 10b coding is a channel coding technology that provides important support for the development of modern communication technology by improving the efficiency and reliability of data transmission. This coding method can achieve the balance of '0' and '1'. The continuous 0 and continuous 1 in the coding cannot exceed 5 bits, thereby ensuring DC balance, eliminating signal interference, and facilitating clock recovery at the receiving end. It is used in various high-speed buses such as USB3.0, PCIE, Fiber Channel, etc.

[0003] 8b / 10b encoding represents 8-bit data from high to low as HGFEDCBA, where the lower 5 bits of EDCBA are recorded as x according to their decimal value, and the upper 3 bits of HGF are recorded as y according to their decimal value. According to the function, the code is divided into data code and control code. The control code is used to indicate the start and end of data, symbol alignment, etc. The original 8-bit data code is recorded as Dxy, and the control code is recorded as Kxy.

[0004] The 8b / 10b encoding and decoding circuits are respectively applied to the high-speed interface physical layer sending channel and receiving channel. The commonly used 8b / 10b encoding and decoding scheme is the lookup table method. This method is characterized by simple implementation, but limited rate improvement and poor scalability. In practical applications, the entire encoding table needs to be stored, and a large amount of storage resources are occupied, resulting in more occupied logic resources.

[0005] There is currently no effective solution to the above problems. Summary of the invention

[0006] The embodiments of the present application provide a method and device for decoding data, so as to at least solve the problem in the related art that data decoding requires table lookup, resulting in a large amount of resource occupation.

[0007] According to an embodiment of the present application, a data decoding method is provided, comprising: obtaining a target code, wherein the target code comprises 10-bit data, each bit of data is a binary number 0 or 1, and when the number of 0s in the 10-bit data is greater than the number of 1s, the polarity of the target code is positive, when the number of 0s in the 10-bit data is less than the number of 1s, the polarity of the target code is negative, and when the number of 0s in the 10-bit data is equal to the number of 1s, the polarity of the target code is balanced;

[0008] Dividing the target code into a first data set and a second data set, wherein the first data set includes the first 6 bits of the 10 bits of data, and the second data set includes the last 4 bits of the 10 bits of data;

[0009] The 6-bit data in the first data set is decoded into 5-bit data to obtain a third data set, and the 4-bit data in the second data set is decoded into 3-bit data to obtain a fourth data set; the third data set and the fourth data set are processed to obtain a target decoding, and the polarity of the target decoding is obtained according to the polarity of the target encoding.

[0010] In an exemplary embodiment, decoding the 6-bit data in the first data set into 5-bit data to obtain the third data set includes: dividing the first data set into a first data subset and a second data subset, wherein the first data subset includes the first 4 bits of the 6-bit data of the first data set, and the second data subset includes the last 2 bits of the 6-bit data of the first data set; processing the data in the first data subset according to conditions satisfied by the first data subset and the values ​​of the data in the second data subset to obtain the first 4 bits of the third data set; processing the data in the second data subset according to the conditions satisfied by the first data subset and the values ​​of the data in the second data subset to obtain the 5th bit of the third data set.

[0011] In an exemplary embodiment, the data in the first data subset is processed according to the conditions satisfied by the first data subset and the values ​​of the data in the second data subset to obtain the first 4 bits of data in the third data set, including: when the first data subset is a non-special code, the ratio of the number of 0s to the number of 1s in the first data subset is 1, and the first data subset belongs to K.28, if the value of the first data in the second data subset is 0, the data obtained by inverting the data in the first data subset is determined as the first 4 bits of data in the third data set, and if the value of the first data in the second data subset is 1, the data in the first data subset is determined as the first 4 bits of data in the third data set, wherein K.28 is a coding type in a preset coding table; when the first data subset is a non-special code, the ratio of the number of 0s to the number of 1s in the first data subset is 1, and the first data subset does not belong to K.28, the data in the first data subset is determined as the first 4 bits of data in the third data set; in the first data subset In the case where the set is not a special code and the ratio of the number of 0s to the number of 1s in the first data subset is not 1, if the value of the first data in the second data subset is 0, the data in the first data subset is inverted to obtain the data as the first 4 bits of the data in the third data set; if the value of the first data in the second data subset is 1, the data in the first data subset is determined as the first 4 bits of the data in the third data set; in the case where the first data subset belongs to D.00 or D.16 or D.15 or D.31 or D.24 The first data subset is determined as a special code, wherein D.00, D.16, D.15, D.31, and D.24 belong to the preset coding table; when the first data subset belongs to D.00 or D.16, 0000 is determined as the first 4 bits of data in the third data set; when the first data subset belongs to D.15 or D.31, 1111 is determined as the first 4 bits of data in the third data set; when the first data subset belongs to D.24, 0001 is determined as the first 4 bits of data in the third data set.

[0012] In an exemplary embodiment, the data in the second data subset is processed according to the conditions satisfied by the first data subset and the values ​​of the data in the second data subset to obtain the fifth bit of data in the third data set, including: when one of the following conditions is met, the data obtained by inverting the first bit of data in the second data subset is determined as the fifth bit of data in the third data set: the first data subset belongs to D.00 or D.16, and the data in the first data subset is 1001; the first data subset belongs to D.15 or D.31, and the data in the first data subset is 0101; the first data subset belongs to D.7, the first The data in the data subset is 0001, and the data in the second data subset is 11; the first data subset belongs to D.24, the data in the first data subset is 0011, and the data in the second data subset is 00; the first data subset belongs to K.28, the last two digits of the first data subset are 00, and the data in the second data subset is 00; the ratio of the number of 1s to the number of 0s in the first data subset is 1:3, and the first bit of data in the second data subset is 0 or the first bit of data in the second data subset is 1; otherwise, the first bit of data in the second data subset is determined as the 5th bit of data in the third data set.

[0013] In an exemplary embodiment, when the target code is a control code, the 4-bit data in the second data set is decoded into 3-bit data to obtain a fourth data set, including: when the data in the second data set belongs to Kx7, the data in the fourth data set is determined to be 111, wherein Kx7 is a coding type in a preset coding table; when the data in the second data set belongs to Kx0, the data in the fourth data set is determined to be 000, wherein Kx0 is a coding type in a preset coding table; when the polarity of the first data set is positive, the data in the first data set belongs to K.28, and the data in the second data set does not belong to Kx3, the data in the fourth data set is determined to be the data obtained by inverting the first 3 bits of the data in the second data set, K.28 and Kx3 are coding types in the preset coding table; when the polarity of the second data set is positive and the second data set belongs to Kx3, the data in the fourth data set is determined to be the first 3 bits of the data in the second data set; otherwise, the data in the fourth data set is determined to be the first 3 bits of the data in the second data set.

[0014] In an exemplary embodiment, when the target code is a data code, the 4-bit data in the second data set is decoded into 3-bit data to obtain a fourth data set, including: when the data in the second data set belongs to Dx0, the data in the fourth data set is determined to be 000, wherein Dx0 is a coding type in a preset coding table; when the data in the second data set belongs to DxA7, the data in the fourth data set is determined to be 111; when the data in the second data set meets one of the following conditions, the data in the fourth data set is determined to be the data obtained by inverting the first 3 bits of data in the second data set: the data in the second data set belongs to DxP7, wherein DxP7 is a coding type in a preset coding table; the polarity of the second data set is positive, and the data in the second data set belongs to Dx3, wherein Dx3 is a coding type in a preset coding table; the polarity of the second data set is negative, and the data in the second data set belongs to Dx4, wherein Dx4 is a coding type in a preset coding table; otherwise, the data in the fourth data set is determined to be the first 3 bits of data in the second data set.

[0015] In an exemplary embodiment, the third data set and the fourth data set are processed to obtain a target decoding, including: merging the third data set and the fourth data set to obtain a merged data set; reversing the data in the merged data set to obtain the target decoding.

[0016] In an exemplary embodiment, obtaining the polarity of the target decoding according to the polarity of the target encoding includes: when the polarity of the target encoding is positive and the number of 0s in the first data set is not equal to the number of 1s, the polarity of the third data set is negative; when the polarity of the target encoding is negative and the number of 0s in the first data set is not equal to the number of 1s, the polarity of the third data set is positive; when the polarity of the target encoding is positive and the number of 0s in the first data set is equal to the number of 1s, the polarity of the third data set is positive; when the polarity of the target encoding is negative and the number of 0s in the first data set is equal to the number of 1s, the polarity of the third data set is positive; In the case where the polarity of the third data set is positive and the number of 0s in the second data set is not equal to the number of 1s, the polarity of the fourth data set is negative; in the case where the polarity of the third data set is negative and the number of 0s in the second data set is not equal to the number of 1s, the polarity of the fourth data set is positive; in the case where the polarity of the third data set is positive and the number of 0s in the second data set is equal to the number of 1s, the polarity of the fourth data set is positive; in the case where the polarity of the third data set is negative and the number of 0s in the second data set is not equal to the number of 1s, the polarity of the fourth data set is negative.

[0017] According to another embodiment of the present application, a data decoding device is provided, including: an acquisition module, used to acquire a target code, wherein the target code includes 10-bit data, each bit of data is a binary number 0 or 1, and the polarity of the target code is positive when the number of 0s in the 10-bit data is greater than the number of 1s, and the polarity of the target code is negative when the number of 0s in the 10-bit data is less than the number of 1s, and the polarity of the target code is balanced when the number of 0s in the 10-bit data is equal to the number of 1s; a division module, used to divide the target code into a first data set and a second data set, wherein the first data set includes the first 6 bits of the 10-bit data, and the second data set includes the last 4 bits of the 10-bit data; decoding the 6-bit data in the first data set into 5-bit data to obtain a third data set, and decoding the 4-bit data in the second data set into 3-bit data to obtain a fourth data set; a processing module, used to process the third data set and the fourth data set to obtain a target decoding, and obtain the polarity of the target decoding according to the polarity of the target code.

[0018] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0019] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0020] Through the present application, a data decoding method is adopted, by dividing the target code into a first data set and a second data set, the first data set includes the first 6 bits of the 10 bits of data, and the second data set includes the last 4 bits of the 10 bits of data; the 6 bits of data in the first data set are decoded into 5 bits of data to obtain a third data set, and the 4 bits of data in the second data set are decoded into 3 bits of data to obtain a fourth data set; the third data set and the fourth data set are processed to obtain a target decoding, and the polarity of the target decoding is obtained according to the polarity of the target code. The purpose of decoding the target code without storing a coding table can be achieved, and the problem of occupying more resources due to the need to look up a table for data decoding in the related art can be solved, and the effect of saving resources can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 It is a hardware structure block diagram of a server device of a data decoding method according to an embodiment of the present application;

[0022] Figure 2 is a flowchart of a method for decoding data according to an embodiment of the present application;

[0023] Figure 3 According to the process of the embodiment of the present application Figure 1 ;

[0024] Figure 4 According to the process of the embodiment of the present application Figure 1 ;

[0025] Figure 5 It is a structural block diagram of a data decoding device according to an embodiment of the present application. DETAILED DESCRIPTION

[0026] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0028] The method embodiments provided in the embodiments of the present application can be executed in a server device or a similar computing device. Taking running on a server device as an example, Figure 1 1 is a hardware structure block diagram of a server device of a data decoding method according to an embodiment of the present application. Figure 1As shown, the server device may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the server device may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above server device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0029] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the data decoding method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the server device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0030] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the server device. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0031] In this embodiment, a data decoding method is provided. Figure 2 is a flowchart of a method for decoding data according to an embodiment of the present application. Figure 2 As shown, the process includes the following steps:

[0032] Step S202, obtaining a target code, wherein the target code includes 10 bits of data, each bit of data is a binary number 0 or 1, and when the number of 0s in the 10 bits of data is greater than the number of 1s, the polarity of the target code is positive, when the number of 0s in the 10 bits of data is less than the number of 1s, the polarity of the target code is negative, and when the number of 0s in the 10 bits of data is equal to the number of 1s, the polarity of the target code is balanced;

[0033] The target code is 10 bits of data, each bit can be represented by abcdeifghj. Positive polarity can be represented by RD+, and negative polarity can be represented by RD-.

[0034] Step S204, dividing the target code into a first data set and a second data set, wherein the first data set includes the first 6 bits of the 10 bits of data, and the second data set includes the last 4 bits of the 10 bits of data;

[0035] The first data set is the first six digits abcdei of the above 10-digit data, and the second data set is the last four digits fghj of the above 10-digit data.

[0036] Step S206, decoding the 6-bit data in the first data set into 5-bit data to obtain a third data set, and decoding the 4-bit data in the second data set into 3-bit data to obtain a fourth data set;

[0037] Among them, the 5-bit data in the third data set can be represented by ABCDE, and the 3-bit data in the fourth data set can be represented by FGH.

[0038] Step S208: Process the third data set and the fourth data set to obtain a target decoding, and obtain the polarity of the target decoding according to the polarity of the target encoding.

[0039] The execution subject of the above steps may be a server, a terminal, etc., but is not limited thereto.

[0040] Through the above steps, a data decoding method is adopted to achieve the purpose of decoding the target code without storing a coding table. This can solve the problem of occupying more resources due to the need to look up a table for data decoding in related technologies, thereby achieving the effect of saving resources.

[0041] As an optional implementation manner, decoding the 6-bit data in the first data set into 5-bit data to obtain a third data set includes the following steps:

[0042] Dividing the first data set into a first data subset and a second data subset, wherein the first data subset includes first 4 bits of data among the 6 bits of data of the first data set, and the second data subset includes last 2 bits of data among the 6 bits of data of the first data set;

[0043] Process the data in the first data subset according to the conditions satisfied by the first data subset and the values ​​of the data in the second data subset to obtain the first 4 bits of data in the third data set;

[0044] The data in the second data subset is processed according to the conditions satisfied by the first data subset and the values ​​of the data in the second data subset to obtain the fifth bit of data in the third data set.

[0045] The first data subset is abcd in the above 10-bit data, the second data subset is ei in the above 10-bit data. The first 4 bits of data in the above third data set are ABCD, and the fifth bit of data in the above third data set is E.

[0046] As an optional implementation, processing the data in the first data subset according to the conditions satisfied by the first data subset and the values ​​of the data in the second data subset to obtain the first 4 bits of data in the third data set includes the following steps:

[0047] The default code table is the 8b / 10b code table. Table 1 below is part of the 8b / 10b code table:

[0048] Table 1

[0049]

[0050] The data code of the 8b / 10b encoding table is represented by Dxy, and the control code is represented by Kxy. K.28.0 and K.28.1 in Table 1 are both control codes. Taking K.28.1 as an example, x is 28 and y is 1. The 8b / 10b encoding table records the correspondence between 10b's abcdeifghj and 8b's HGFEDCBA.

[0051] There are special codes D.00, D.16, D.15, D.31, and D.24 in the 8b / 10b encoding table.

[0052] Therefore, when the first data subset belongs to D.00 or D.16 or D.15 or D.31 or D.24, the first data subset is determined as a special code, wherein D.00, D.16, D.15, D.31, and D.24 belong to the preset coding table; D.0.y, D.16.y, D.15.y, D.31.y, and D.24.y need to be processed separately as special cases. Specifically, when the first data subset belongs to D.00 or D.16, 0000 is determined as the first 4 bits of data in the third data set; when the first data subset belongs to D.15 or D.31, 1111 is determined as the first 4 bits of data in the third data set; when the first data subset belongs to D.24, 0001 is determined as the first 4 bits of data in the third data set.

[0053] As an optional implementation, the ratio of the number of 0s to the number of 1s in the first data subset (abcd) divides abcd into three groups: Q11, Q31, and Q13, wherein the ratio of 1s to 0s in group Q11 is 1:1, the ratio of 1s to 0s in group Q31 is 3:1, and the ratio of 1s to 0s in group Q13 is 1:3.

[0054] like Figure 3 In the flowchart shown, when the first data subset abcd is a non-special code, the ratio of the number of 0s to the number of 1s in the first data subset is 1 (Q11 group), and the first data subset belongs to K.28, if the value of the first data bit in the second data subset (e in the above 10-bit data) is 0, the data obtained by inverting the data in the first data subset is determined as the first 4-bit data in the third data set, and if the value of the first data bit in the second data subset is 1, the data in the first data subset is determined as the first 4-bit data in the third data set, wherein K.28 is the encoding type in the preset encoding table;

[0055] In the case where the first data subset is a non-special code, the ratio of the number of 0s to the number of 1s in the first data subset is 1 (Q11 group), and the first data subset does not belong to K.28, the data in the first data subset is determined as the first 4 bits of data in the third data set;

[0056] In the case where the first data subset is not a special code and the ratio of the number of 0s to the number of 1s in the first data subset is not 1 ((Q31 group or Q13 group)), if the value of the first bit of data in the second data subset is 0, the data obtained by inverting the data in the first data subset is determined as the first 4 bits of data in the third data set; if the value of the first bit of data in the second data subset is 1, the data in the first data subset is determined as the first 4 bits of data in the third data set.

[0057] As an optional implementation, the conversion from e to E can be divided into two categories: direct mapping and negation. The scenario of negation is summarized, and the other scenarios are direct mapping.

[0058] When one of the following conditions is met, data obtained by inverting the first bit of data in the second data subset is determined as the fifth bit of data in the third data set:

[0059] The first data subset belongs to D.00 or D.16, and the data (abcd) in the first data subset is 1001;

[0060] The first data subset belongs to D.15 or D.31, and the data (abcd) in the first data subset is 0101;

[0061] The first data subset belongs to D.7, the data (abcd) in the first data subset is 0001, and the data (ei) in the second data subset is 11;

[0062] The first data subset belongs to D.24, the data (abcd) in the first data subset is 0011, and the data (ei) in the second data subset is 00;

[0063] The first data subset belongs to K.28, the last two data (cd) in the first data subset are 00, and the data (ei) in the second data subset are 00;

[0064] The ratio of the number of 1s to the number of 0s in the first data subset is 1 to 3 (Q13 group), and the first bit of data in the second data subset is 0 or the first bit of data in the second data subset is 1;

[0065] Otherwise, the first bit of data in the second data subset is determined as the fifth bit of data in the third data set.

[0066] As an optional implementation, since the lower 4 bits (fghj) of the data code and the control code are different, some codes of the lower 4 bits of the data code do not distinguish between positive and negative polarities, and each group of codes of the control code has both positive and negative polarities. Therefore, the lower 4 bits are processed separately when converting.

[0067] Algorithm for converting the lower 4 bits of the control code to 3 bits: There are 12 control codes in total: K.28.1, K.28.2, K.28.3, K.28.4, K.28.5, K.28.6, K.28.7, K.23.7, K.29.7, and K30.7. Each control code corresponds to two polarity codes.

[0068] Specifically, Figure 4 The flowchart shown in the figure, decoding the 4-bit data in the second data set into 3-bit data to obtain a fourth data set, comprises the following steps:

[0069] For a control code (the target code is a control code), when the data (fghj) in the second data set belongs to Kx7, the data (FGH) in the fourth data set is determined to be 111, wherein Kx7 is a coding type in a preset coding table;

[0070] In the case where the data in the second data set belongs to Kx0, the data (FGH) in the fourth data set is determined to be 000, wherein Kx0 is a coding type in a preset coding table;

[0071] When the polarity of the first data set is positive (RD+), the data (abcdei) in the first data set belongs to K.28, and the data in the second data set does not belong to Kx3, the data in the fourth data set is determined to be the data obtained by inverting the first 3 bits of the data in the second data set, and K.28 and Kx3 are encoding types in the preset encoding table;

[0072] When the polarity of the second data set (fghj) is positive and the second data set (fghj) belongs to Kx3, the data in the fourth data set is determined to be the data obtained by inverting the first 3 bits of the data in the second data set;

[0073] Otherwise, the data in the fourth data set is determined as the first 3 bits of data in the second data set.

[0074] In the case where the data in the second data set belongs to Dx0, the data in the fourth data set is determined to be 000, where Dx0 is a coding type in a preset coding table;

[0075] In the case where the data (fghj) in the second data set belongs to DxA7, the data in the fourth data set is determined to be 111;

[0076] When the data in the second data set meets one of the following conditions, the data in the fourth data set is determined as the data obtained by inverting the first 3 bits of the data in the second data set:

[0077] The data in the second data set belongs to DxP7, where DxP7 is a coding type in a preset coding table;

[0078] The polarity of the second data set is positive, and the data in the second data set belongs to Dx3, where Dx3 is a coding type in a preset coding table;

[0079] The polarity of the second data set is negative, and the data in the second data set belongs to Dx4, where Dx4 is a coding type in a preset coding table;

[0080] Otherwise, the data in the fourth data set is determined as the first 3 bits of data in the second data set.

[0081] For a data code (the target code is a data code), the 4-bit data in the second data set is decoded into 3-bit data to obtain a fourth data set, including:

[0082] In the case where the data (fghj) in the second data set belongs to Dx0, the data in the fourth data set is determined to be 000, where Dx0 is a coding type in a preset coding table;

[0083] In the case where the data in the second data set belongs to DxA7, determining the data in the fourth data set to be 111;

[0084] When the data in the second data set meets one of the following conditions, the data in the fourth data set is determined as the data obtained by inverting the first 3 bits of the data in the second data set:

[0085] The data in the second data set belongs to DxP7, where DxP7 is a coding type in a preset coding table;

[0086] The polarity of the second data set is positive, and the data in the second data set belongs to Dx3, where Dx3 is a coding type in a preset coding table;

[0087] The polarity of the second data set is negative, and the data in the second data set belongs to Dx4, where Dx4 is a coding type in a preset coding table;

[0088] Otherwise, the data in the fourth data set is determined as the first 3 bits of data in the second data set.

[0089] As an optional implementation, the third data set and the fourth data set are processed to obtain a target decoding, including: merging the third data set and the fourth data set to obtain a merged data set; reversing the data in the merged data set to obtain the target decoding.

[0090] For example, D.2.1 (rd-) is coded as 101101 1001, abcdei = 101101, fghj = 1001, its abcd is P31 group, and e is equal to 0, so abcd needs to be inverted to get ABCD = 0100, e does not belong to the inversion scenario, so E = 0. fghj does not meet the inversion scenario, so FGH = 100, so D.2.1's ABCDEFGH = 01000 100, after reversing, it is 001 00010, which meets the definition of 8b / 10b coding table. K.28.6 (RD+) is coded as 110000 1001, abcdei = 110000, fghj = 1001, e is equal to 0, so after inversion, ABCD = 0011, and abcd is a special code. K.28's cdei is 0000, E is inverted from e, and E = 1. Fghj meets the inversion scenario: K.28 (RD+) and fghj is not Kx.3, so FGH = 011, so K.28.6 gets ABCDEFGH = 00111 011, and after reversing the order, it gets 110 11100.

[0091] The above-mentioned embodiments can be used to guide the use of combinational logic to implement circuit design. The decoding circuit designed using the algorithm reduces the demand for hardware resources such as the number of logic gates and memory resources, and improves the decoding speed. At the same time, the use of the algorithm can effectively reduce the chip area and save chip production costs. Compared with the frequent access to the lookup table during traditional lookup table decoding, the circuit implemented by the algorithm of this patent can reduce power consumption to a certain extent.

[0092] Obtaining the polarity of the target decoding according to the polarity of the target encoding includes:

[0093] In the case where the polarity of the target code is positive and the number of 0s in the first data set is not equal to the number of 1s, the polarity of the third data set is negative; in the case where the polarity of the target code is negative and the number of 0s in the first data set is not equal to the number of 1s, the polarity of the third data set is positive; in the case where the polarity of the target code is positive and the number of 0s in the first data set is equal to the number of 1s, the polarity of the third data set is positive; in the case where the polarity of the target code is negative and the number of 0s in the first data set is equal to the number of 1s, the polarity of the third data set is negative; in the case where the polarity of the third data set is positive and the number of 0s in the second data set is not equal to the number of 1s, the polarity of the third data set is negative; in the case where the polarity of the third data set is negative and the number of 0s in the second data set is not equal to the number of 1s, the polarity of the third data set is positive; in the case where the polarity of the third data set is positive and the number of 0s in the second data set is equal to the number of 1s, the polarity of the third data set is positive; in the case where the polarity of the third data set is negative and the number of 0s in the second data set is not equal to the number of 1s, the polarity of the third data set is positive; in the case where the polarity of the third data set is negative and the number of 0s in the second data set is equal to the number of 1s, the polarity of the third data set is positive.

[0094] For example, the polarity of the code should be judged during the decoding process. Ideally, the polarity of the upper 6 bits (abcdei) and the lower 4 bits (fghj) of the code should be transmitted alternately positive and negative. The upper 6 bits of the code (abcdei in the first data set) are divided into three groups according to the proportion of 0 and 1. Group 1 has more 0 than 1, group 2 has an equal number of 0 and 1, and group 3 has more 1 than 0.

[0095] For Group 1 and Group 3 (the number of 0s in the first data set is not equal to the number of 1s), when the input polarity of the 10-bit code is positive (the polarity of the target code is positive), the output polarity of the 6-bit to 5-bit conversion should be negative (the polarity of the third data set is negative), and when the input polarity of the 10-bit code is negative (the polarity of the target code is negative), the output polarity of the 6-bit to 5-bit conversion should be positive (the polarity of the third data set is positive). For Group 2 (the number of 0s in the first data set is equal to the number of 1s), the output polarity of the 6-bit to 5-bit conversion is consistent with the input polarity (the polarity of the target code is positive and the polarity of the third data set is positive, and the polarity of the target code is negative and the polarity of the third data set is negative). The output polarity of the lower 4 bits depends on the upper 6 bits. Similarly, the lower 4 bits are divided into 3 groups. Group 1 has more 0s than 1s, Group 2 has an equal number of 0s and 1s, and Group 3 has more 1s than 0s. For Group 1 and Group 3 (the number of 0s in the second data set is not equal to the number of 1s), when the 6-bit to 5-bit output polarity is positive (the polarity of the third data set is positive), the 4-bit to 3-bit output polarity should be negative (the polarity of the fourth data set is negative), and when the 6-bit to 5-bit output polarity is negative (the polarity of the third data set is negative), the 4-bit to 3-bit output polarity should be positive (the polarity of the fourth data set is positive). For Group 2 (the number of 0s in the second data set is equal to the number of 1s), the 4-bit to 3-bit output polarity is consistent with the 6-bit to 5-bit output polarity (the polarity of the third data set is positive and the polarity of the fourth data set is positive, the polarity of the third data set is negative and the polarity of the fourth data set is negative).

[0096] Since the polarity of the 10-bit code is transmitted alternately between positive and negative between 6-bit and 4-bit, both 6-bit and 4-bit need to be checked for polarity errors. For the 6-bit code, when the input polarity is positive, the upper 6 bits are detected to belong to group 1, indicating a polarity error. When the input polarity is negative, the upper 6 bits are detected to belong to group 3, indicating a polarity error. For the 4-bit code, when the input polarity is positive, the upper 4 bits are detected to belong to group 1, indicating a polarity error. When the input polarity is negative, the upper 4 bits are detected to belong to group 3, indicating a polarity error. Through this embodiment, polarity error checking can be performed to achieve the effect of improving the polarity accuracy of decoding.

[0097] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0098] In this embodiment, a data decoding device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0099] Figure 5 is a structural block diagram of a data decoding device according to an embodiment of the present application, such as Figure 5 As shown, the device includes: an acquisition module 52, used to acquire a target code, wherein the target code includes 10 bits of data, each bit of data is a binary number 0 or 1, and when the number of 0s in the 10 bits of data is greater than the number of 1s, the polarity of the target code is positive, when the number of 0s in the 10 bits of data is less than the number of 1s, the polarity of the target code is negative, and when the number of 0s in the 10 bits of data is equal to the number of 1s, the polarity of the target code is balanced; a division module 54, used to divide the target code into a first data set and a second data set, wherein the first data set includes the first 6 bits of the 10 bits of data, and the second data set includes the last 4 bits of the 10 bits of data; a decoding module 56, used to decode the 6 bits of data in the first data set into 5 bits of data to obtain a third data set, and decode the 4 bits of data in the second data set into 3 bits of data to obtain a fourth data set; a processing module 58, used to process the third data set and the fourth data set to obtain a target decoding, and obtain the polarity of the target decoding according to the polarity of the target code.

[0100] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0101] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0102] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0103] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0104] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0105] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.

[0106] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.

[0107] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method for decoding data, characterized in that: include: Acquire a target code, wherein the target code includes 10 bits of data, each bit of data is a binary number 0 or 1, and when the number of 0s in the 10 bits of data is greater than the number of 1s, the polarity of the target code is positive, when the number of 0s in the 10 bits of data is less than the number of 1s, the polarity of the target code is negative, and when the number of 0s in the 10 bits of data is equal to the number of 1s, the polarity of the target code is balanced; Dividing the target code into a first data set and a second data set, wherein the first data set includes the first 6 bits of the 10 bits of data, and the second data set includes the last 4 bits of the 10 bits of data; Decoding the 6-bit data in the first data set into 5-bit data to obtain a third data set, and decoding the 4-bit data in the second data set into 3-bit data to obtain a fourth data set; The third data set and the fourth data set are processed to obtain a target decoding, and the polarity of the target decoding is obtained according to the polarity of the target encoding.

2. The method according to claim 1, characterized in that The decoding of the 6-bit data in the first data set into 5-bit data to obtain a third data set includes: Dividing the first data set into a first data subset and a second data subset, wherein the first data subset includes first 4 bits of data among the 6 bits of data of the first data set, and the second data subset includes last 2 bits of data among the 6 bits of data of the first data set; Process the data in the first data subset according to the conditions satisfied by the first data subset and the values ​​of the data in the second data subset to obtain the first 4 bits of data in the third data set; The data in the second data subset is processed according to the conditions satisfied by the first data subset and the values ​​of the data in the second data subset to obtain the fifth bit of data in the third data set.

3. The method according to claim 2, characterized in that The data in the first data subset is processed according to the conditions satisfied by the first data subset and the values ​​of the data in the second data subset to obtain the first 4 bits of data in the third data set, including: In the case where the first data subset is a non-special code, the ratio of the number of 0s to the number of 1s in the first data subset is 1, and the first data subset belongs to K.28, if the value of the first data in the second data subset is 0, the data obtained by inverting the data in the first data subset is determined as the first 4 bits of data in the third data set, and if the value of the first data in the second data subset is 1, the data in the first data subset is determined as the first 4 bits of data in the third data set, wherein K.28 is a coding type in the preset coding table; If the first data subset is a non-special code, the ratio of the number of 0s to the number of 1s in the first data subset is 1, and the first data subset does not belong to K.28, the data in the first data subset is determined as the first 4 bits of data in the third data set; In the case where the first data subset is not a special code and the ratio of the number of 0s to the number of 1s in the first data subset is not 1, if the value of the first data in the second data subset is 0, the data obtained by inverting the data in the first data subset is determined as the first 4 bits of data in the third data set; if the value of the first data in the second data subset is 1, the data in the first data subset is determined as the first 4 bits of data in the third data set; In the case where the first data subset belongs to D.00 or D.16 or D.15 or D.31 or D.24, the first data subset is determined as a special code, wherein D.00, D.16, D.15, D.31, and D.24 belong to the preset coding table; When the first data subset belongs to D.00 or D.16, 0000 is determined as the first 4 bits of data in the third data set; when the first data subset belongs to D.15 or D.31, 1111 is determined as the first 4 bits of data in the third data set; when the first data subset belongs to D.24, 0001 is determined as the first 4 bits of data in the third data set.

4. The method according to claim 2, characterized in that: Processing the data in the second data subset according to the conditions satisfied by the first data subset and the values ​​of the data in the second data subset to obtain the fifth bit of data in the third data set includes: When one of the following conditions is met, data obtained by inverting the first bit of data in the second data subset is determined as the fifth bit of data in the third data set: The first data subset belongs to D.00 or D.16, and the data in the first data subset is 1001; The first data subset belongs to D.15 or D.31, and the data in the first data subset is 0101; The first data subset belongs to D.7, the data in the first data subset is 0001, and the data in the second data subset is 11; The first data subset belongs to D.24, the data in the first data subset is 0011, and the data in the second data subset is 00; The first data subset belongs to K.28, the last two digits of the first data subset are 00, and the data of the second data subset are 00; The ratio of the number of 1s to the number of 0s in the first data subset is 1:3, and the first bit of data in the second data subset is 0 or the first bit of data in the second data subset is 1; Otherwise, the first bit of data in the second data subset is determined as the fifth bit of data in the third data set.

5. The method according to claim 1, characterized in that In the case where the target code is a control code, decoding the 4-bit data in the second data set into 3-bit data to obtain a fourth data set, including: In the case where the data in the second data set belongs to Kx7, the data in the fourth data set is determined to be 111, wherein Kx7 is a coding type in a preset coding table; In the case where the data in the second data set belongs to Kx0, the data in the fourth data set is determined to be 000, where Kx0 is a coding type in a preset coding table; When the polarity of the first data set is positive, the data in the first data set belongs to K.28, and the data in the second data set does not belong to Kx3, the data in the fourth data set is determined to be the data obtained by inverting the first 3 bits of the data in the second data set, and K.28 and Kx3 are coding types in the preset coding table; When the polarity of the second data set is positive and the second data set belongs to Kx3, the data in the fourth data set is determined to be the first 3 bits of data in the second data set; Otherwise, the data in the fourth data set is determined as the first 3 bits of data in the second data set.

6. The method according to claim 1, characterized in that In the case where the target code is a data code, decoding the 4-bit data in the second data set into 3-bit data to obtain a fourth data set includes: In the case where the data in the second data set belongs to Dx0, the data in the fourth data set is determined to be 000, where Dx0 is a coding type in a preset coding table; In the case where the data in the second data set belongs to DxA7, determining the data in the fourth data set to be 111; When the data in the second data set meets one of the following conditions, the data in the fourth data set is determined as the data obtained by inverting the first 3 bits of the data in the second data set: The data in the second data set belongs to DxP7, where DxP7 is a coding type in a preset coding table; The polarity of the second data set is positive, and the data in the second data set belongs to Dx3, where Dx3 is a coding type in a preset coding table; The polarity of the second data set is negative, and the data in the second data set belongs to Dx4, where Dx4 is a coding type in a preset coding table; Otherwise, the data in the fourth data set is determined as the first 3 bits of data in the second data set.

7. The method according to claim 1, characterized in that Processing the third data set and the fourth data set to obtain a target decoding includes: Merging the third data set and the fourth data set to obtain a merged data set; The data in the combined data set are reversed to obtain the target decoding.

8. The method according to claim 1, characterized in that: Obtaining the polarity of the target decoding according to the polarity of the target encoding includes: When the polarity of the target code is positive and the number of 0s in the first data set is not equal to the number of 1s, the polarity of the third data set is negative; When the polarity of the target code is negative and the number of 0s in the first data set is not equal to the number of 1s, the polarity of the third data set is positive; When the polarity of the target code is positive and the number of 0s in the first data set is equal to the number of 1s, the polarity of the third data set is positive; When the polarity of the target code is negative and the number of 0s in the first data set is equal to the number of 1s, the polarity of the third data set is negative; In the case where the polarity of the third data set is positive and the number of 0s in the second data set is not equal to the number of 1s, the polarity of the fourth data set is negative; In the case where the polarity of the third data set is negative and the number of 0s in the second data set is not equal to the number of 1s, the polarity of the fourth data set is positive; In the case where the polarity of the third data set is positive and the number of 0s in the second data set is equal to the number of 1s, the polarity of the fourth data set is positive; In the case where the polarity of the third data set is negative and the number of 0s in the second data set is not equal to the number of 1s, the polarity of the fourth data set is negative.

9. A data decoding device, characterized in that: include: an acquisition module, configured to acquire a target code, wherein the target code includes 10 bits of data, each bit of data is a binary number 0 or 1, and when the number of 0s in the 10 bits of data is greater than the number of 1s, the polarity of the target code is positive, when the number of 0s in the 10 bits of data is less than the number of 1s, the polarity of the target code is negative, and when the number of 0s in the 10 bits of data is equal to the number of 1s, the polarity of the target code is balanced; a division module, configured to divide the target code into a first data set and a second data set, wherein the first data set includes the first 6 bits of the 10 bits of data, and the second data set includes the last 4 bits of the 10 bits of data; a decoding module, configured to decode the 6 bits of data in the first data set into 5 bits of data to obtain a third data set, and decode the 4 bits of data in the second data set into 3 bits of data to obtain a fourth data set; A processing module is used to process the third data set and the fourth data set to obtain a target decoding, and obtain a polarity of the target decoding according to a polarity of the target encoding.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 8 when executed by a processor.

11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method described in any one of claims 1 to 8 are implemented.

12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 8 are implemented.