WO2018082286A1 - Encoding and decoding method and apparatus for serial communication system based on serdes technology - Google Patents

Encoding and decoding method and apparatus for serial communication system based on serdes technology Download PDF

Info

Publication number
WO2018082286A1
WO2018082286A1 PCT/CN2017/085860 CN2017085860W WO2018082286A1 WO 2018082286 A1 WO2018082286 A1 WO 2018082286A1 CN 2017085860 W CN2017085860 W CN 2017085860W WO 2018082286 A1 WO2018082286 A1 WO 2018082286A1
Authority
WO
WIPO (PCT)
Prior art keywords
codeword
code
output
polarity
running
Prior art date
Application number
PCT/CN2017/085860
Other languages
French (fr)
Chinese (zh)
Inventor
徐小明
康婕
赵羽
项圣文
Original Assignee
深圳国人通信股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳国人通信股份有限公司 filed Critical 深圳国人通信股份有限公司
Publication of WO2018082286A1 publication Critical patent/WO2018082286A1/en

Links

Classifications

    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M7/00Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
    • H03M7/30Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
    • H03M7/46Conversion to or from run-length codes, i.e. by representing the number of consecutive digits, or groups of digits, of the same kind by a code word and a digit indicative of that kind

Definitions

  • the present invention relates to the field of communications technologies, and in particular, to a code decoding method and apparatus based on a SerDes technology serial communication system.
  • SerD es serializer/deserializer serial communication technology
  • channel capacity low system cost
  • fast transmission speed fast transmission speed
  • FIG. 1 The structure of the serial communication system based on SerDes is as shown in FIG. 1: On the transmitting end, the parallel data is encoded by the primary encoder 1; the parallel-serial converter 2 receives the encoded parallel data, according to the clock manager 4 The provided cuckoo clock signal converts the parallel data into serial data and transmits the serial data via the transmitter 3.
  • the receiver 7 receives the serial input data and sends it to the serial to parallel converter 6, which converts the serial input data into parallel data and sends it to the main decoder 5, the main The decoder 5 decodes it and outputs it; the clock manager 4 recovers the chirp signal from the data through the serial-to-parallel converter.
  • the serial communication system based on SerDes technology encodes the input parallel data at the transmitting end.
  • code word imbalance D represents the difference between the number of 1 in a code word and the number of 0.
  • Positive quantity indicates that the number of 1 in the code word is greater than 0, and the "N" in the positive N polarity indicates that the number of 1 in the data is more than the number of 0;
  • the data is encoded into lOBit (10-bit) data. Its good DC balance and short run length (maximum run length is only 5) make it easy for the receiver to recover data and clocks.
  • the 8B/10B code also has obvious disadvantages, that is, the coding efficiency is not high. If the transmission rate is a useful data stream of lGb/s, the actual line transmission rate after encoding is 1.25 Gb/s, which is nearly 25% redundant. Such large redundant credits will become unacceptable in higher-rate optical communication systems (transmission rates of up to 6Gb/s or even lOGb/s); in addition, as the performance of fiber-optic communication equipment increases, the optical communication system pairs the lines. The code requirements are much reduced. For example, the maximum coded run length is less than 20 and can be easily detected by the receiver.
  • the present invention provides a codec method and apparatus based on the SerDes technology serial communication system, which adopts a 9B/10B code and uses a lookup table method in an FPGA (Field-Programmable Gate Array, field). Implemented within a programmable gate array) to increase efficient transmission efficiency.
  • FPGA Field-Programmable Gate Array
  • a codec side in a serial communication system based on SerDes technology is provided Method, including coding steps:
  • the code lookup table outputs a first codeword and a second codeword including unbalance information according to the input address; wherein, the number of "1"s in the first codeword is greater than or equal to "0" The number of "unbalances is positive; the number of "0"s in the second codeword is greater than or equal to the number of ", and the degree of imbalance is negative;
  • the K code encoding step is further included:
  • K code encoding consisting of two 10 bits is output through the K code lookup table.
  • the selection indication signal is output according to the running polarity difference value of the current code stream: if the running polarity difference value of the current code stream is negative, the selection indication of the output The signal is high level; if the running polarity difference value of the current code stream is positive, the output selection indication signal is low level
  • the calculating the running polarity difference value of the current code stream specifically includes the following steps:
  • step of decoding is further included:
  • a codec device in a serial communication system based on SerDes technology comprising: a main encoder, a line polarity calculator connected to the main encoder, An encoding selector coupled to the primary encoder;
  • the primary encoder includes:
  • a splitting unit configured to divide 18-bit ordinary data into two original data of a high 9-bit and a low 9-bit
  • an initial address defining unit configured to use two of the original data as two The initial address N of the code lookup table
  • an input address calculation unit configured to convert the initial address into 2*N+0 and 2*N+1 as an input address of the code lookup table
  • an output unit configured to output, according to the input address, a first codeword and a second codeword including unbalance information; wherein, the number of "1"s in the first codeword is greater than or equal to "0 The number of "unbalances is positive; the number of "0"s in the second codeword is greater than or equal to the number of ", and the degree of imbalance is negative; [0047] the line polarity calculator is configured to output a selection indication signal according to the running polarity difference value of the current code stream; [0048] the code selector is configured to output in each of the lookup tables according to the selection indication signal Selecting one of the first codeword and the second codeword constitutes an output codeword.
  • the line polarity calculator is further configured to output a polarity selection signal
  • the K code encoder includes:
  • a defining unit configured to define six K codes, each of which is a group of K codes, and the code words in each group of K codes are complementary to each other;
  • a receiving unit configured to receive the input K code indication signal and the polarity selection signal
  • the K code encoding output unit is configured to output K code code composed of two 10 bits through the K code lookup table.
  • the line polarity calculator includes:
  • a difference sum value calculation unit configured to use an algebraic sum of the running polarity difference value and the unbalanced degree of the output codeword as a coded polarity difference sum value
  • a balance determining unit configured to determine whether the output codeword is perfectly balanced
  • a running polarity difference value calculating unit configured to: when the output codeword is perfectly balanced, the running polarity difference value of the current code stream remains unchanged;
  • the running polarity difference value calculating unit is further configured to: when the output codeword is unbalanced: if the encoded polarity difference sum value is less than 0, the running pole of the current code stream The difference value of the polarity difference is negative; if the sum of the polarity differences after the encoding is less than 0, the running polarity difference value of the current code stream is positive; if the sum of the polarity differences after the encoding is equal to 0, and If the running polarity difference value of the original code stream is positive, the running polarity difference value of the current code stream is negative; if the encoded polarity difference sum value is equal to 0, and the running polarity difference of the original code stream If the value is negative, the running polarity difference value of the current code stream is positive.
  • the main decoder is configured to process the decoded output data in the corresponding common data position in the decoding lookup table.
  • the data integrator is configured to integrate the lower 9 bits of the two decoded output data and output.
  • the present invention provides a codec method and apparatus based on a SerDes technology serial communication system, which maps 9-bit original words into 10-bit code words.
  • the encoded data stream has a good DC balance characteristic with a maximum run length of 7.
  • FIG. 1 is a block diagram showing the structure of a SerDes communication system in the prior art.
  • FIG. 2 is a schematic flow chart of an encoding step in a serial communication system based on SerDes technology according to an embodiment of the present invention
  • FIG. 3 is a diagram showing a polarity deviation state transition according to an embodiment of the present invention.
  • FIG. 4 is a schematic flow chart of a K code encoding step in a serial communication system based on SerDes technology according to an embodiment of the present invention
  • FIG. 5 is a schematic flow chart of a decoding step in a serial communication system based on SerDes technology according to an embodiment of the present invention
  • FIG. 6 is a schematic structural diagram of a serial communication coding system based on SerDes technology according to an embodiment of the present invention
  • FIG. 7 is a schematic structural diagram of a main encoder in a serial communication system based on SerDes technology according to an embodiment of the present invention.
  • FIG. 8 is a schematic structural diagram of a line polarity calculator in a serial communication system based on SerDes technology according to an embodiment of the present invention
  • 9 is a schematic structural diagram of a serial communication system based on SerDes technology according to another embodiment of the present invention.
  • 10 is a schematic structural diagram of a K code encoder in a serial communication system based on SerDes technology according to an embodiment of the present invention;
  • FIG. 11 is a schematic structural diagram of a serial communication system based on SerDes technology according to still another embodiment of the present invention.
  • FIG. 12 is a schematic diagram showing an output input relationship of an implementation process of K code encoding.
  • the present invention can map a 9-bit original word into a 10-bit code word by designing a code lookup table.
  • the code lookup table can be implemented as follows.
  • mapping of 9 bits to 10 bits may be performed, including the following steps:
  • Step 1 First, the first bit of the 232 balanced code words is removed, and the remaining 9 bits are the original words corresponding thereto. For example, if the balance code word is 0100100111, the first digit is 100100111, 100100111 is the original word corresponding to it, that is, it is 295 coded or 295 in decimal, and the first code word and the second code word of these original words are the same.
  • D ⁇ 4 codeword.
  • Step 3 The remaining 52 original words cannot be encoded in a certain mode by the above method because the imbalance is too large. In this case, only the remaining codewords can be found in the remaining allowed codewords. For example, if the original word 101000000, the closest one among the remaining codeword sets is 0101000001, then 0101000001 is the second codeword of 101000000.
  • Step 4 After the above steps are processed, each 9-bit original word finds a corresponding codeword mode, and the codeword mode may be the first codeword or the second codeword.
  • the other 280 original words require another mode of encoding. Therefore, you need to find the codeword in the other mode of the 280 original words.
  • the coding criterion is: For a original word that needs to be encoded, it is only necessary to find the nearest one from the remaining code words, and the polarity of the code word that has been found by steps 1 ⁇ 3 is opposite.
  • the original word 000000000 finds that the second code word is 0001000011 according to step 3, and its polarity is negative; then the first code word of the original word should select one of the remaining allowed code words that is closest to him and has a positive polarity. Codeword, here select 1001010111 as its first codeword.
  • Step 5 The mapping of 9 bits to 10 bits can be realized by the above steps, but the coding table is not only composed of 10-bit code word information, but also contains the imbalance D information of each code word.
  • the codeword unbalance D is 3-bit encoded as shown in Table 3 below:
  • Unbalance D 110 111 000 001 010 Value corresponding code Table 3 code word imbalance D value coding table
  • Equation 1 The coded information of the codeword unbalance degree D in the table is shifted to the left by 10 and the codeword information is added to obtain the final code, as shown in Equation 1:
  • F_Code is the final coded information in the code lookup table
  • D_Code represents the codeword.
  • the encoding information of the unbalance degree D, U_Code indicates the codeword information corresponding to the 9-bit original word. Multiplying D_Code by 2 to the 10th power means shifting 10 bits to the left. Therefore, the final encoded information is a 13-bit encoded data.
  • the 512 9-bit original words are mapped to the first code word and the second code word of RD- and RD+, respectively, so there are 1024 code words in the code table.
  • Each codeword is processed according to Equation 1 to generate a final code table and stored in the lookup table inside the FPGA.
  • the present invention provides a codec method in a serial communication system based on SerDes technology, which includes a data 9B/10B encoding step:
  • Sl the 18-bit ordinary data is divided into two raw data of high 9 bits and low 9 bits;
  • the 10-bit codeword is perfectly balanced, ie If the number of "1" in the codeword is the same as the number of "0", then the first codeword and the second codeword are the same; if the 10-bit codeword is not perfectly balanced, that is, the number of "1" in the codeword is If the number of "0" is different, the first codeword and the second codeword are two different codewords of opposite polarity;
  • the first codeword and the second codeword are obtained by adding the codeword information of 10 bits and the coding information of the unbalance degree D of 3 bits; wherein, the 10-bit codeword information is 9 bits.
  • the mapping of the original data to 10 bits; the imbalance degree 1) ⁇ (10-n), where n is the number of "1"s in the codeword;
  • S5. Output a selection indication signal according to a running polarity difference (RD) value of the current code stream;
  • the selection indication signal is output according to the running polarity difference value of the current code stream: if the running polarity difference value of the current code stream is negative, the output selection indication signal is a high level; If the running polarity difference value of the current code stream is positive, the output selection indication signal is low level;
  • the output selection indication signal is a high level, the first codeword is selected in the first codeword and the second codeword in the next output codeword; The selection indication signal is low, and the second codeword is selected in the first codeword and the second codeword in the next output codeword.
  • the running polarity difference (RD) value of the current code stream in step S5 is calculated according to the polarity difference sum (RDS) value indicating the encoded total unbalance degree information.
  • RDS polarity difference sum
  • the RD value of the initial engraving of the power-on is negative, and the RDS value is 0;
  • a K code encoding step is also included:
  • the K code can be used to perform functions such as byte alignment, frame delimitation, character padding, and clock recovery of the code stream.
  • the 9B/10B coding code defines three groups of six K codes, which are K001 and K101, ⁇ 002 and K102, and ⁇ 003 and K103, respectively. Two codewords in each group of weights complement each other, respectively. The first codeword and the second codeword of the weight are encoded and output;
  • S12. Receive an input K code indication signal and a polarity selection signal.
  • a decoding step is further included, where the decoding step and the encoding step are the same, and are also implemented based on a lookup table method, and the difference is that the translation is performed.
  • the code process is memoryless.
  • the so-called memoryless decoding refers to decoding a currently received 10-bit codeword to obtain a 9-bit data, which has nothing to do with the previous code stream, that is, only after receiving the same 10-bit codeword decoding. There will be a decoding result.
  • the decoding step may include:
  • Decoding is the inverse of encoding, and is specifically implemented based on a lookup table method.
  • two 10-bit code words are used in the code table mapping to represent a 9-bit original word, which are respectively the first code word and the second code word. If the 10-bit codeword is perfectly balanced, the first codeword and the second codeword are the same; if the 10-bit codeword is not perfectly balanced, the first codeword and the second codeword are different.
  • the decoding lookup table When the decoding lookup table is generated, if the first codeword and the second codeword are the same, only one location in the decoding lookup table stores the original word information. If the first codeword and the second codeword are different, there are two locations in the decoding lookup table to store the original word information. For example, the original word 000000000 (decimal is 0) is encoded to obtain two different code words, which are the first codeword 1001010111 (decimal is 599) and the second codeword 0001000011 (decimal is 67). Then, after decoding, the lookup table addresses are 599 and 67 ⁇ , and the decoded output will output 0, that is, the original word information is stored in both positions in the decoding table.
  • the original word 0011100001 (decimal is 225) is encoded to obtain two identical codewords, that is, the first codeword and the second codeword are 1011100001 (decimal is 737), then after decoding, the lookup table address has Only equal to 737 ⁇ , the decoding will output 225, that is, only one position in the decoding table stores 225 original word information.
  • the decoded output data corresponding to the K code position includes the lower 9 bits of the K code original word information and the upper 3 bits are the K code indication information;
  • K code indication information should also be included.
  • the invention is shared during the encoding process
  • the SJ3 group has six K codes, K001 and K101, ⁇ 002 and ⁇ 102, and ⁇ 003 and ⁇ 103, respectively. Two codewords in each set of codes are complementary to each other, respectively representing the first codeword and the second code of the ⁇ code. Word output.
  • K001 and K101 ⁇ are detected, the first bit of the weight indication information is set to 1; when ⁇ 002 and K102 ⁇ are detected, the second bit of the weight indication information is set to 1; when ⁇ 003 and K103 ⁇ , weight indication The third bit of the information is set to 1.
  • the 3-bit K code indication information is combined with the K code original word information, and the processing manner is as shown in Equation 2:
  • F_data K_Flag[9]*2 A 9 + K_Flag[10]*2 A 10+ K_Flag[l 1]*2 ⁇ 11+K_data (Equation 2) [0132] where F_data decodes the K code in the lookup table
  • K_Flag is a 3-digit weight indication information
  • K_data is a 9-digit weight original word information.
  • the 1st, 2nd, and 3rd bits of the 3-bit K code indication information are corresponding to the 9th, 10th, and 11th bits of the decoded data output, and the 9-bit K-code original word information is combined, and the final translation is performed.
  • the code output F_data is a 12-bit data.
  • the decoding output of the normal data in the decoding lookup table is actually 12 bits. It also includes 3-bit K code indication information, just as normal data, and the 3 bits corresponding to the K code indication information are all 0.
  • S23 Select one decoded output data according to the address of the lookup table in the generated decoding lookup table.
  • the 20-bit decoded data is divided into two addresses of the upper 10 bits and the lower 10 bits as the addresses of the two decoding lookup tables; since the decoding process is memoryless, the two decoding lookup tables are based on The input address selects the corresponding decoded output data.
  • the two-way lookup table decoded output data is integrated into one 18-bit data and used as a decoded output. Its input and output relationship is:
  • Xout is the decoded output signal
  • DoutA[8 : 0] is the lower 9 bits of the lower 10 bit codeword lookup table output decoding data
  • DoutB[8 : 0] is the upper 10 bit codeword lookup table
  • the lower 9 bits of the decoded data are output.
  • the SerDes system does not know which is the K code which is normal data, so the decoding process also needs to output a K code indication signal, that is, Kout[l : 0], when it is When two bits are 0 ⁇ , the system will consider the current decoded output to be the decoded output of normal data.
  • the K-code indication signal plays a key role in restoring the ⁇ clock for the SerDes system to maintain link synchronization.
  • the K code information ie, the 13th to 15th bits of the two lookup table output data
  • Kout is a K code indication signal
  • DoutA is a low 10-bit codeword lookup table outputting decoded data
  • DoutB is a high 10-bit codeword lookup table outputting decoded data.
  • serial communication system based on the SerDes technology in the embodiment of the present invention is described above, and the following is a serial communication system based on the SerDes (serializer/deserializer) technology in the embodiment of the present invention.
  • SerDes serializer/deserializer
  • the codec device is described.
  • the present invention further provides a codec device in a serial communication system based on SerDes technology, comprising a main encoder 10, a line polarity calculator 20 connected to the main encoder, and a main encoder A connected code selector 30.
  • main encoder 10 includes:
  • the input address calculation unit 13 is configured to convert the initial address into 2*N+0 and 2*N+1 as the code lookup table input address;
  • the output unit 14 is configured to output, according to the input address, the first codeword and the second codeword including the imbalance information according to the input address.
  • the mapping in the code lookup table is performed. 2Using two 10-bit codewords to represent a 9-bit original word, respectively a first codeword and a second codeword; wherein, the number of "1"s in the first codeword is greater than or equal to the number of "0" The number of "0" in the second codeword is greater than or equal to the number of ".
  • the 10-bit codeword is perfectly balanced, the first codeword and the second codeword are the same; if the 10-bit codeword is not perfectly balanced, then The first codeword and the second codeword are different and the polarities are opposite; the first codeword in the above code lookup table and the codeword information in which the second codeword is 10 bits are added to the coded information of the unbalanced degree D of 3 bits.
  • the line polarity calculator 20 described above is used to ensure DC balance of the output code stream, which provides a selection indication signal for the code selector.
  • the output of the selection indication signal is determined based on the running polarity difference RD value indicating the current code stream imbalance characteristic. Specifically, the value is output according to the running polarity difference value of the current code stream.
  • the selection indication signal ⁇ if the running polarity difference value of the current code stream is negative, the output selection indication signal is high level; if the running polarity difference value of the current code stream is positive, the output selection indication signal Is low.
  • the function of the code selector 30 is to select a coded output, which is composed of three inputs and one output, which are respectively a data input terminal 8, a data input terminal B, an input selection indication signal, and a data output terminal. Its output and input relationship is:
  • the line polarity calculator 20 includes:
  • the difference sum value calculation unit 21 is configured to use the algebraic sum of the running polarity difference value and the unbalanced degree of the output code word as the encoded polarity difference sum value;
  • the balance determining unit 22 is configured to determine whether the output codeword is perfectly balanced
  • the running polarity difference value calculating unit 23 is configured to: when the output codeword is perfectly balanced, the running polarity difference value of the current code stream remains unchanged;
  • the running polarity difference value calculating unit 23 is further configured to: when the output code word is unbalanced: if the encoded polarity difference sum value is less than 0, the current code stream running polarity difference value is negative; If the sum of the polarity differences after encoding is greater than 0, the running polarity difference value of the current code stream is positive; if the sum of the polarity differences after encoding is equal to 0, and the running polarity difference value of the original code stream is positive, then The running polarity difference value of the current code stream is negative; if the encoded polarity difference sum value is equal to 0, and the running polarity difference value of the original code stream is negative, the running polarity difference value of the current code stream is positive. It should be noted that the running polarity difference value at the initial power-on encapsulation is negative, and the sum of the polarity differences after encoding is 0.
  • the code selector 30 is configured to select one codeword among the first codeword and the second codeword outputted by each lookup table according to the selection indication signal to form a next output codeword.
  • the K code encoder 40 is further included in the embodiment, and is connected to the line polarity calculator 20 and the code selector 30.
  • the K code encoder 40 includes:
  • the defining unit 41 is configured to define six K codes, each of the two K codes is a group, and the code words in each group of K codes are complementary to each other; the K code can be used to complete the byte alignment of the code stream. , frame delimitation, character padding, and clock recovery, etc.
  • the 9B/10B codec defines 3 groups of 6 K codes, which are K001 and K101, ⁇ 002 and K102, and K003 and K103, two codewords in each set of weights are complementary to each other, respectively representing the first codeword and the second codeword coded output of the weight;
  • the receiving unit 42 is configured to receive the input weight indication signal and the polarity selection signal
  • the weight code output unit 43 is configured to output a weight code composed of two 10 bits through a weight lookup table
  • the implementation process of the weight code is also equivalent to a lookup table.
  • the output and input relationship is shown in Table 4.
  • the weight encoder 40 further includes a delay module connected to the weight encoder 40.
  • the function of the delay module is to ensure that the encoder code output and the weight output indication signal are aligned, that is, the encoder outputs the indication signal at the weight. Effectively, the encoded output of this ⁇ encoder is exactly the weight.
  • the weight input indication signal must obtain the weight output indication signal through the delay module, and the delay of the delay module must be equal to the delay of the input data after the encoder encoding process.
  • a main decoder 50 and a data integrator 60 connected to the main decoder are further included;
  • the main decoder 50 is configured to process the decoded output data in the corresponding common data position in the decoding lookup table; and process the decoded output data in the corresponding weight position in the decoding lookup table;
  • one decoding output data is respectively selected according to the address of the lookup table;
  • decoding is the inverse process of encoding, and is specifically implemented based on the lookup table method.
  • two 10-bit code words are used in the code table mapping to represent a 9-bit original word, which are the first code word and the second code word, respectively.
  • the decoding lookup table is generated, if the first codeword and the second codeword are the same, only one location in the decoding lookup table stores the original word information. If the first code word and the second code word are different, there are two locations in the decoding lookup table to store the original word information. For example, the original word 000 000000 (decimal 0) is encoded to obtain two different code words, which are the first code word 1001010111 (decimal is 599) and the second code word 0001000011 (decimal is 67).
  • the lookup table addresses are 599 and 67 ⁇ , and the decoded output will output 0.
  • the original word 0011100001 (decimal is 225) is encoded to obtain two identical codewords, that is, RD- and the second codeword are 1011100001 (decimal is 737), then after decoding, the lookup table address has and only equals 737 ⁇ , decoding only outputs 225.
  • the main decoder 50 can be used for decoding the weight; specifically, the special processing is performed on the original information of the weight in the generation of the decoding table, that is, the original word information of the 9-digit weight is added to the 3 Bit weight indication information.
  • the invention is encoded In the process, 3 groups of 6 K codes are shared, which are K001 and ⁇ 101, ⁇ 002 and ⁇ 102, and ⁇ 003 and K10 respectively.
  • the two code words in each set of weights are complementary to each other, and represent the first code word and the second code word code output of the weight respectively.
  • the third bit of the weight indication information is set to 1.
  • the data integrator 60 is configured to integrate the lower 9 bits of the two decoded output data and output the data; specifically, combine the decoded data of the two lookup tables into one 18-bit data, and use it as the whole main Decoded output of the decoder. Its input and output relationship is:
  • Xout is a decoded output signal
  • DoutA is a low 10-bit codeword lookup table to output decoded data
  • the K code indication information processor 70 is further configured to input the acquired data including the K code information (ie, the 9th to 11th bits of the two lookup table output data), and obtain the K through the related logical operation.
  • the code indicates the signal output. Its input and output relationship is:
  • Kout is a K code indication signal
  • DoutA is a low 10-bit codeword lookup table outputting decoded data
  • DoutB is a high 10-bit codeword lookup table outputting decoded data.
  • the 9B/10B encoding according to the present invention is mainly implemented in a FPGA by a lookup table method, which divides ordinary data into high 9 bits and low 9 bits respectively as addresses of a lookup table, and a lookup table puts addresses.
  • the corresponding positive polarity (Rd+) first codeword and negative polarity (Rd-) second codeword are output to the code selector, and the code selector selects the corresponding coded output through the indication signal provided by the line polarity calculator.
  • the K code encoder selects the corresponding K code output according to the K code indication and the indication provided by the line polarity calculator, and the final code output is selected by the code selector in the K code output and the normal data code output.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)
  • Dc Digital Transmission (AREA)

Abstract

Provided are an encoding and decoding method and apparatus for a serial communication system based on SerDes technology. The method comprises an encoding step: dividing 18-bit common data into two pieces of 9-bit original data; respectively using the two pieces of original data as the initial address N of two code look-up tables, and converting the initial addresses N into 2*N+0 and 2*N+1 as the input address of the code look-up table; outputting a first code word and a second code word comprising imbalance information according to the input addresses, the number of '1' in the first code word being larger than or equal to the number of '0', and the number of '0' in the second code word being larger than or equal to the number of '1'; outputting a selection indication signal according to the motion polarity difference value of a current code stream; and selecting a code word from the first code word and second code word output by each look-up table according to the selection indication signal to form a next output code word. The decoding process of the scheme is the inverse process of encoding, and the implementation method is similar to the encoding process. The present invention achieves the target of direct current balance of the output code stream, and at the same time, improves the transmission performance.

Description

说明书  Instruction manual
发明名称:基于 SerDes技术串 行 通信系统的编解码方法及装置 Title of Invention: Codec Method and Apparatus Based on SerDes Technology Serial Communication System
技术领域  Technical field
[0001] 本发明涉及通信技术领域, 尤其涉及一种基于 SerDes技术串行通信系统的编解 码方法及装置。  [0001] The present invention relates to the field of communications technologies, and in particular, to a code decoding method and apparatus based on a SerDes technology serial communication system.
背景技术  Background technique
[0002] 随着通信技术的不断发展, 通信系统对传输带宽要求不断增加, 由于高速 SerD es (串行器 /解串器) 的串行通信技术具有信道容量高、 系统成本低以及传输速 度快等特点, 这使得基于 SerDes的串行通信技术逐渐成为主流的高速数据通信技 术。  [0002] With the continuous development of communication technologies, communication systems have increasingly increased transmission bandwidth requirements, and high-speed SerD es (serializer/deserializer) serial communication technology has high channel capacity, low system cost, and fast transmission speed. And so on, this makes SerDes-based serial communication technology gradually become the mainstream high-speed data communication technology.
[0003] 基于 SerDes的串行通信系统结构如附图 1所示: 在发送端, 并行数据经过主编 码器 1进行编码; 并串转换器 2接收编码后的并行数据, 根据吋钟管理器 4提供的 吋钟信号将并行数据转换为串行数据, 并经由发送器 3发出该串行数据。 接收端 , 接收器 7接收串行输入数据, 并将其发送至串并转换器 6, 串并转换器 6将所述 串行输入数据变为并行数据, 并发送至主译码器 5, 主译码器 5将其译码后输出 ; 吋钟管理器 4通过串并转换器从数据中恢复吋钟信号。  [0003] The structure of the serial communication system based on SerDes is as shown in FIG. 1: On the transmitting end, the parallel data is encoded by the primary encoder 1; the parallel-serial converter 2 receives the encoded parallel data, according to the clock manager 4 The provided cuckoo clock signal converts the parallel data into serial data and transmits the serial data via the transmitter 3. At the receiving end, the receiver 7 receives the serial input data and sends it to the serial to parallel converter 6, which converts the serial input data into parallel data and sends it to the main decoder 5, the main The decoder 5 decodes it and outputs it; the clock manager 4 recovers the chirp signal from the data through the serial-to-parallel converter.
[0004] 基于 SerDes的串行通信系统中的关键技术之一是接收端的吋钟和数据恢复, 而 影响接收端吋钟和数据恢复性能的主要因素是串行数据流的电平变换和直流平 衡。 电平变换是指数据从 "0"到 "1"或者从 "1 "到 "0"的变换, 直流平衡是指串行数 据流中 "0"和 "1 "的个数基本相同。  [0004] One of the key technologies in the SerDes-based serial communication system is the chirp and data recovery at the receiving end, and the main factors affecting the receiving end clock and data recovery performance are the level conversion and DC balance of the serial data stream. . Level shifting refers to the conversion of data from "0" to "1" or from "1" to "0". DC balance means that the number of "0" and "1" in the serial data stream is basically the same.
[0005] 为了保证串行数据流具有很好的电平变换和直流平衡特性, 基于 SerDes技术的 串行通信系统在发送端对输入的并行数据进行编码处理。  [0005] In order to ensure that the serial data stream has good level shifting and DC balance characteristics, the serial communication system based on SerDes technology encodes the input parallel data at the transmitting end.
[0006] 在进行编码处理吋, 主要考量的因素包括:  [0006] After performing the encoding process, the main considerations include:
[0007] ( 1) 、 码字不平衡度 D (Disparity) , 表示一个码字中 1的数目与 0的数目的差 值。 用正极性 (Positive Disparity) 表示码字中 1的个数比 0的个数多, 正 N极性中 的" N", 表示数据中的 1的个数比 0的个数多 N; 用负极性 (Negative Disparity) 表 示码字中 1的个数比 0的个数少, 负 N极性中的" N", 表示数据中的 1的个数比 0的 个数少 N。 例如: 对于 0100, D=-2; 对于 0111 , D = +2。 [0007] (1), code word imbalance D (Disparity), represents the difference between the number of 1 in a code word and the number of 0. Positive quantity (Positive Disparity) indicates that the number of 1 in the code word is greater than 0, and the "N" in the positive N polarity indicates that the number of 1 in the data is more than the number of 0; Negative Disparity Table The number of 1s in the code word is less than the number of 0, and the "N" in the negative N polarity indicates that the number of 1s in the data is less than the number of 0's. For example: For 0100, D=-2; For 0111, D = +2.
[0008] (2) 运行极性差异值 RD (Running Disparity) 。 表示当前连续的所有码字中 1 和 0的个数之差, 即当前码流的不平衡特性。 用运行极性差异值和 RDS (Running Disparity Sum) 值表示输出码流的总不平衡度。 在编码吋要考虑输出码流的 RDS 的 "土"极性, 而不要考虑具体的数值。 "+"表示当前的码流中 "1"的数目多于 "0"的 数目; "-"表示当前的码流中 "0"的数目多于" 1 "的数目。 对于一个好的线路码, R DS应该是一个绝对值接近 0的有限值。  [0008] (2) Run the polarity difference value RD (Running Disparity). Indicates the difference between the number of 1s and 0s in all currently consecutive codewords, that is, the imbalance of the current code stream. The total imbalance of the output code stream is represented by the running polarity difference value and the RDS (Running Disparity Sum) value. In coding, consider the "earth" polarity of the RDS of the output stream, and do not consider the specific values. "+" indicates that the number of "1"s in the current stream is greater than the number of "0"; "-" indicates that the number of "0"s in the current stream is more than the number of "1"s. For a good line code, R DS should be a finite value with an absolute value close to zero.
[0009] (3) 编码游程长度 (Run Length) 表示连续的串行码流中, 连续的 1或者 0的个 数。  [0009] (3) Code Run Length Indicates the number of consecutive 1s or 0s in a continuous serial code stream.
[0010] 现有技术中, 最常见的线路编码技术是 8B/10B编码, 8B/10B编码将 8Bit (8位 [0010] In the prior art, the most common line coding technique is 8B/10B coding, and 8B/10B coding will be 8Bit (8 bits).
) 数据编码成 lOBit (10位) 数据, 其良好的直流平衡特性和游程短 (最大游程 长度仅为 5) 等优点使接收端进行数据和吋钟恢复变得非常容易。 然而 8B/10B编 码也存在明显的缺点, 即编码效率不高。 假如传输速率为 lGb/s的有用数据流, 其编码后实际线路传输速率为 1.25Gb/s, 这将近有 25%的冗余。 这么大的冗余幵 销在更高速率的光线通信系统 (传输速率达到 6Gb/s甚至 lOGb/s) 中将变得无法 承受; 另外随着光纤通信设备性能的提高, 使得光线通信系统对线路码的要求 降低了很多, 如最大编码游程只要小于 20就能很容易被接收机检测。 The data is encoded into lOBit (10-bit) data. Its good DC balance and short run length (maximum run length is only 5) make it easy for the receiver to recover data and clocks. However, the 8B/10B code also has obvious disadvantages, that is, the coding efficiency is not high. If the transmission rate is a useful data stream of lGb/s, the actual line transmission rate after encoding is 1.25 Gb/s, which is nearly 25% redundant. Such large redundant credits will become unacceptable in higher-rate optical communication systems (transmission rates of up to 6Gb/s or even lOGb/s); in addition, as the performance of fiber-optic communication equipment increases, the optical communication system pairs the lines. The code requirements are much reduced. For example, the maximum coded run length is less than 20 and can be easily detected by the receiver.
技术问题  technical problem
问题的解决方案  Problem solution
技术解决方案  Technical solution
[0011] 本发明的特征和优点在下文的描述中部分地陈述, 或者可从该描述显而易见, 或者可通过实践本发明而学习。  [0011] The features and advantages of the invention are set forth in part in the description which follows,
[0012] 为克服现有技术的问题, 本发明提供一种基于 SerDes技术串行通信系统的编解 码方法及装置, 采用 9B/10B编码, 通过査找表方法在 FPGA(Field-Programmable Gate Array, 现场可编程门阵列)内实现, 从而提高有效传输效率。  [0012] In order to overcome the problems of the prior art, the present invention provides a codec method and apparatus based on the SerDes technology serial communication system, which adopts a 9B/10B code and uses a lookup table method in an FPGA (Field-Programmable Gate Array, field). Implemented within a programmable gate array) to increase efficient transmission efficiency.
[0013] 本发明解决上述技术问题所采用的技术方案如下:  [0013] The technical solution adopted by the present invention to solve the above technical problems is as follows:
[0014] 根据本发明的一个方面, 提供一种基于 SerDes技术串行通信系统中的编解码方 法, 包括编码步骤: [0014] According to an aspect of the present invention, a codec side in a serial communication system based on SerDes technology is provided Method, including coding steps:
[0015] 将 18位的普通数据分为两个 9位的两个原始数据; [0015] dividing 18-bit ordinary data into two 9-bit original data;
[0016] 将两个所述原始数据分别作为两个编码査找表的初始地址 N; [0016] The two original data are respectively used as the initial address N of the two encoded lookup tables;
[0017] 将所述初始地址转化为 2*N+0和 2*N+1作为所述编码査找表的输入地址; [0017] converting the initial address into 2*N+0 and 2*N+1 as input addresses of the code lookup table;
[0018] 所述编码査找表根据所述输入地址输出包含不平衡度信息的第一码字与第二码 字; 其中, 所述第一码字中 "1 "的个数大于或等于 "0"的个数, 其不平衡度为正; 所述第二码字中" 0"的个数大于或等于" 的个数, 其不平衡度为负; [0018] the code lookup table outputs a first codeword and a second codeword including unbalance information according to the input address; wherein, the number of "1"s in the first codeword is greater than or equal to "0" The number of "unbalances is positive; the number of "0"s in the second codeword is greater than or equal to the number of ", and the degree of imbalance is negative;
[0019] 根据当前码流的运行极性差异值输出选择指示信号; [0019] outputting a selection indication signal according to a running polarity difference value of the current code stream;
[0020] 根据所述选择指示信号在每个所述査找表输出的第一码字与第二码字中选择一 个码字组成下一输出码字。  [0020] selecting one codeword among the first codeword and the second codeword outputted by each of the lookup tables according to the selection indication signal to form a next output codeword.
[0021] 可选地, 所述第一码字与第二码字为 10位的码字信息与 3位的不平衡度 D的编码 信息相加得到的; 其中, 所述 10位的码字信息为 9位的所述原始数据到 10位的映 射; 所述不平衡度 D=n- (10-n) , 其中 n为码字中 "1 "的个数。  [0021] Optionally, the first codeword and the second codeword are obtained by adding 10-bit codeword information and 3-bit unbalance degree D coding information; wherein the 10-bit codeword is The information is a mapping of the original data of 9 bits to 10 bits; the degree of imbalance D = n - (10-n), where n is the number of "1"s in the code word.
[0022] 可选地, 还包括 K码编码步骤:  [0022] Optionally, the K code encoding step is further included:
[0023] 定义 6个 K码, 每两个 K码为一组, 且每组 K码中的码字互为补码;  [0023] defining six K codes, each of which is a group of K codes, and the code words in each group of K codes are complementary to each other;
[0024] 接收输入的 K码指示信号和极性选择信号;  Receiving an input K code indication signal and a polarity selection signal;
[0025] 通过 K码査找表输出由两个 10比特组成的 K码编码。  [0025] K code encoding consisting of two 10 bits is output through the K code lookup table.
[0026] 可选地, 在根据所述当前码流的运行极性差异值输出所述选择指示信号吋: 若 所述当前码流的运行极性差异值为负, 则输出的所述选择指示信号为高电平; 若所述当前码流的运行极性差异值为正, 则输出的所述选择指示信号为低电平  Optionally, the selection indication signal is output according to the running polarity difference value of the current code stream: if the running polarity difference value of the current code stream is negative, the selection indication of the output The signal is high level; if the running polarity difference value of the current code stream is positive, the output selection indication signal is low level
[0027] 在根据所述选择指示信号在每个所述査找表输出的第一码字与第二码字中选择 一个码字组成输出码字吋: 若输出的所述选择指示信号为高电平, 则所述下一 输出码字中在所述第一码字与第二码字中选择所述第一码字; 若输出的所述选 择指示信号为低电平, 则所述下一输出码字中在所述第一码字与第二码字中选 择所述第二码字。 [0027] selecting one codeword in the first codeword and the second codeword outputted in each of the lookup tables according to the selection indication signal to form an output codeword 吋: if the output selection indication signal is high Ping, in the next output codeword, selecting the first codeword in the first codeword and the second codeword; if the output selection indication signal is low, the next The second codeword is selected in the first codeword and the second codeword in the output codeword.
[0028] 可选地, 所述当前码流的运行极性差异值的计算具体包括步骤:  [0028] Optionally, the calculating the running polarity difference value of the current code stream specifically includes the following steps:
[0029] 将所述运行极性差异值与所述输出码字的不平衡度的代数和作为编码后的极性 差异总和值; And [0029] the algebraic sum of the running polarity difference value and the unbalanced degree of the output codeword as the encoded polarity Total difference value;
[0030] 当所述输出码字完美平衡吋, 所述当前码流的运行极性差异值保持不变; [0031 ] 当所述输出码字的不平衡吋:  [0030] when the output codeword is perfectly balanced, the running polarity difference value of the current code stream remains unchanged; [0031] when the output codeword is unbalanced:
[0032] 若所述编码后的极性差异总和值小于 0,则所述当前码流的运行极性差异值为负 [0033] 若所述编码后的极性差异总和值大于 0,则所述当前码流的运行极性差异值为正  [0032] if the sum of the polarity differences after the encoding is less than 0, the running polarity difference value of the current code stream is negative [0033], if the sum of the polarity differences after the encoding is greater than 0, then The running polarity difference value of the current code stream is positive
[0034] 若所述编码后的极性差异总和值等于 0,且原码流的运行极性差异值为正, 则所 述当前码流的运行极性差异值为负; [0034] if the sum of the polarity differences after the encoding is equal to 0, and the running polarity difference value of the original code stream is positive, the running polarity difference value of the current code stream is negative;
[0035] 若所述编码后的极性差异总和值等于 0,且原码流的运行极性差异值为负, 则所 述当前码流的运行极性差异值为正。 [0035] If the sum of the polarity differences after encoding is equal to 0, and the running polarity difference value of the original code stream is negative, the running polarity difference value of the current code stream is positive.
[0036] 可选地, 还包括译码步骤: [0036] Optionally, the step of decoding is further included:
[0037] 对译码査找表中对应普通数据位置上的译码输出数据做处理;  [0037] processing the decoded output data at the corresponding common data position in the decoding lookup table;
[0038] 对所述译码査找表中对应 K码位置上的译码输出数据做处理;  [0038] processing the decoded output data at the corresponding K code position in the decoding lookup table;
[0039] 在上述生成的译码査找表中根据査找表的地址分别选择一个译码输出数据; [0039] in the above generated decoding lookup table, respectively, according to the address of the lookup table to select a decoded output data;
[0040] 将两个所述译码输出数据的低 9比特整合后输出。 [0040] The lower 9 bits of the two decoded output data are integrated and output.
[0041] 根据本发明的另一个方面, 提供一种基于 SerDes技术的串行通信系统中编解码 装置, 其特征在于, 包括主编码器、 与所述主编码器相连的线路极性计算器、 与所述主编码器相连的编码选择器;  [0041] According to another aspect of the present invention, a codec device in a serial communication system based on SerDes technology is provided, comprising: a main encoder, a line polarity calculator connected to the main encoder, An encoding selector coupled to the primary encoder;
[0042] 所述主编码器包括:  [0042] The primary encoder includes:
[0043] 拆分单元, 用于将 18位的普通数据分为高 9位以及低 9位的两个原始数据; [0044] 初始地址定义单元, 用于将两个所述原始数据分别作为两个编码査找表的初始 地址 N;  [0043] a splitting unit, configured to divide 18-bit ordinary data into two original data of a high 9-bit and a low 9-bit; [0044] an initial address defining unit, configured to use two of the original data as two The initial address N of the code lookup table;
[0045] 输入地址计算单元, 用于将所述初始地址转化为 2*N+0和 2*N+1作为所述编码 査找表的输入地址;  [0045] an input address calculation unit, configured to convert the initial address into 2*N+0 and 2*N+1 as an input address of the code lookup table;
[0046] 输出单元, 用于根据所述输入地址输出包含不平衡度信息的第一码字与第二码 字; 其中, 所述第一码字中 "1 "的个数大于或等于 "0"的个数, 其不平衡度为正; 所述第二码字中" 0"的个数大于或等于" 的个数, 其不平衡度为负; [0047] 所述线路极性计算器用于根据当前码流的运行极性差异值输出选择指示信号; [0048] 所述编码选择器用于根据所述选择指示信号在每个所述査找表输出的第一码字 与第二码字中选择一个码字组成输出码字。 [0046] an output unit, configured to output, according to the input address, a first codeword and a second codeword including unbalance information; wherein, the number of "1"s in the first codeword is greater than or equal to "0 The number of "unbalances is positive; the number of "0"s in the second codeword is greater than or equal to the number of ", and the degree of imbalance is negative; [0047] the line polarity calculator is configured to output a selection indication signal according to the running polarity difference value of the current code stream; [0048] the code selector is configured to output in each of the lookup tables according to the selection indication signal Selecting one of the first codeword and the second codeword constitutes an output codeword.
[0049] 可选地, 还包括 K码编码器, 与所述线路极性计算器相连: 所述线路极性计算 器还用于输出极性选择信号; [0049] Optionally, further comprising a K code encoder connected to the line polarity calculator: the line polarity calculator is further configured to output a polarity selection signal;
[0050] 所述 K码编码器包括: [0050] The K code encoder includes:
[0051] 定义单元, 用于定义 6个 K码, 每两个 K码为一组, 且每组 K码中的码字互为补 码;  [0051] a defining unit, configured to define six K codes, each of which is a group of K codes, and the code words in each group of K codes are complementary to each other;
[0052] 接收单元, 用于接收输入的 K码指示信号和极性选择信号;  [0052] a receiving unit, configured to receive the input K code indication signal and the polarity selection signal;
[0053] K码编码输出单元, 用于通过 K码査找表输出由两个 10比特组成的 K码编码。  [0053] The K code encoding output unit is configured to output K code code composed of two 10 bits through the K code lookup table.
[0054] 可选地, 所述线路极性计算器包括:  [0054] Optionally, the line polarity calculator includes:
[0055] 差异总和值计算单元, 用于将所述运行极性差异值与所述输出码字的不平衡度 的代数和作为编码后的极性差异总和值;  [0055] a difference sum value calculation unit, configured to use an algebraic sum of the running polarity difference value and the unbalanced degree of the output codeword as a coded polarity difference sum value;
[0056] 平衡判断单元, 用于判断所述输出码字是否完美平衡; [0056] a balance determining unit, configured to determine whether the output codeword is perfectly balanced;
[0057] 运行极性差异值计算单元, 用于当所述输出码字完美平衡吋, 所述当前码流的 运行极性差异值保持不变;  [0057] a running polarity difference value calculating unit, configured to: when the output codeword is perfectly balanced, the running polarity difference value of the current code stream remains unchanged;
[0058] 所述运行极性差异值计算单元还用于, 当所述输出码字的不平衡吋: 若所述编 码后的极性差异总和值小于 0,则所述当前码流的运行极性差异值为负; 若所述编 码后的极性差异总和值小于 0,则所述当前码流的运行极性差异值为正; 若所述编 码后的极性差异总和值等于 0,且原码流的运行极性差异值为正, 则所述当前码流 的运行极性差异值为负; 若所述编码后的极性差异总和值等于 0,且原码流的运行 极性差异值为负, 则所述当前码流的运行极性差异值为正。  [0058] The running polarity difference value calculating unit is further configured to: when the output codeword is unbalanced: if the encoded polarity difference sum value is less than 0, the running pole of the current code stream The difference value of the polarity difference is negative; if the sum of the polarity differences after the encoding is less than 0, the running polarity difference value of the current code stream is positive; if the sum of the polarity differences after the encoding is equal to 0, and If the running polarity difference value of the original code stream is positive, the running polarity difference value of the current code stream is negative; if the encoded polarity difference sum value is equal to 0, and the running polarity difference of the original code stream If the value is negative, the running polarity difference value of the current code stream is positive.
[0059] 可选地, 还包括主译码器以及与所述主译码器相连的数据整合器;  [0059] Optionally, further comprising a main decoder and a data integrator connected to the main decoder;
[0060] 所述主译码器用于对译码査找表中对应普通数据位置上的译码输出数据做处理  [0060] the main decoder is configured to process the decoded output data in the corresponding common data position in the decoding lookup table.
[0061] 对所述译码査找表中对应 K码位置上的译码输出数据做处理; [0061] processing the decoded output data at the corresponding K code position in the decoding lookup table;
[0062] 在上述生成的译码査找表中根据査找表的地址分别选择一个译码输出数据; [0062] selecting a decoded output data according to the address of the lookup table in the generated decoding lookup table;
[0063] 所述数据整合器用于将两个所述译码输出数据的低 9比特整合后输出。 发明的有益效果 [0063] The data integrator is configured to integrate the lower 9 bits of the two decoded output data and output. Advantageous effects of the invention
有益效果  Beneficial effect
[0064] 本发明提供了一种基于 SerDes技术串行通信系统的编解码方法及装置, 将 9位 的原字映射为 10位的码字。 编码后数据流具有很好的直流平衡特性, 最大游程 为 7, 这些优势使得数据在链路上的传输性能将大大提高, 且在接收端也很容易 实现吋钟恢复, 非常适用于高速串行数据的传输。 与现行常用的 8B/10B编码方 式相比, 在相同的传输速率下, 9B/10B编码方案的有效传输速率提高了 12.5%。  The present invention provides a codec method and apparatus based on a SerDes technology serial communication system, which maps 9-bit original words into 10-bit code words. The encoded data stream has a good DC balance characteristic with a maximum run length of 7. These advantages make the data transmission performance on the link greatly improved, and the chirp recovery is also easy at the receiving end, which is very suitable for high-speed serialization. The transmission of data. Compared to the currently used 8B/10B encoding method, the effective transmission rate of the 9B/10B encoding scheme is increased by 12.5% at the same transmission rate.
[0065] 通过阅读说明书, 本领域普通技术人员将更好地了解这些技术方案的特征和内 容。  [0065] Those skilled in the art will better understand the features and contents of these technical solutions by reading the specification.
对附图的简要说明  Brief description of the drawing
附图说明  DRAWINGS
[0066] 下面通过参考附图并结合实例具体地描述本发明, 本发明的优点和实现方式将 会更加明显, 其中附图所示内容仅用于对本发明的解释说明, 而不构成对本发 明的任何意义上的限制, 在附图中:  The present invention will be more apparent from the following description of the embodiments of the present invention. Any limit in the sense, in the drawing:
[0067] 图 1为现有技术中的 SerDes通信系统结构框图示意图。  1 is a block diagram showing the structure of a SerDes communication system in the prior art.
[0068] 图 2为本发明实施例的基于 SerDes技术串行通信系统中的编码步骤的流程示意 图;  2 is a schematic flow chart of an encoding step in a serial communication system based on SerDes technology according to an embodiment of the present invention;
[0069] 图 3为本发明实施例的极性偏差状态转移图;  3 is a diagram showing a polarity deviation state transition according to an embodiment of the present invention;
[0070] 图 4为本发明实施例的基于 SerDes技术串行通信系统中的 K码编码步骤的流程示 意图;  4 is a schematic flow chart of a K code encoding step in a serial communication system based on SerDes technology according to an embodiment of the present invention;
[0071] 图 5为本发明实施例的基于 SerDes技术串行通信系统中的译码步骤的流程示意 图;  5 is a schematic flow chart of a decoding step in a serial communication system based on SerDes technology according to an embodiment of the present invention;
[0072] 图 6为本发明实施例的基于 SerDes技术串行通信编码系统的结构示意图;  6 is a schematic structural diagram of a serial communication coding system based on SerDes technology according to an embodiment of the present invention;
[0073] 图 7为本发明实施例的基于 SerDes技术串行通信系统中主编码器的结构示意图 7 is a schematic structural diagram of a main encoder in a serial communication system based on SerDes technology according to an embodiment of the present invention;
[0074] 图 8为本发明实施例的基于 SerDes技术串行通信系统中的线路极性计算器的结 构示意图; 8 is a schematic structural diagram of a line polarity calculator in a serial communication system based on SerDes technology according to an embodiment of the present invention;
[0075] 图 9为本发明另一实施例的基于 SerDes技术串行通信系统的结构示意图; [0076] 图 10为本发明实施例的基于 SerDes技术串行通信系统中的 K码编码器的结构示 意图; 9 is a schematic structural diagram of a serial communication system based on SerDes technology according to another embodiment of the present invention; 10 is a schematic structural diagram of a K code encoder in a serial communication system based on SerDes technology according to an embodiment of the present invention;
[0077] 图 11为本发明又一实施例的基于 SerDes技术串行通信系统的结构示意图;  11 is a schematic structural diagram of a serial communication system based on SerDes technology according to still another embodiment of the present invention;
[0078] 图 12为 K码编码的实现过程的输出输入关系示意图。 12 is a schematic diagram showing an output input relationship of an implementation process of K code encoding.
本发明的实施方式 Embodiments of the invention
[0079] 本发明通过编码査找表的设计, 能将 9位的原字映射为 10位的码字。 该编码査 找表可以按以下方法实现。  [0079] The present invention can map a 9-bit original word into a 10-bit code word by designing a code lookup table. The code lookup table can be implemented as follows.
[0080] 首先, 考虑所有 10位码字样本, 10位的码字样本有 2Λ10=1024种组合。 这 1024 个码字向量按照比特 "1"的个数进行分组后得到下表 1所示的分布规律: [0080] First, considering all 10-bit codeword samples, a 10-bit codeword sample has 2 Λ 10=1024 combinations. The 1024 codeword vectors are grouped according to the number of bits "1" to obtain the distribution pattern shown in Table 1 below:
[] [表 1] [] [Table 1]
Figure imgf000009_0001
Figure imgf000009_0001
[0081] 表 1 10位码字的分类  Table 1 Classification of 10-bit codewords
[0082] 在所有可能的 1024个码字样本中, 放弃所有码字不平衡度 D绝对值大于 4的码字 样本, 这样就剩下 252个完美平衡码字 (D=0) 与 330对非完美平衡码字 (D=±2 、 ±4) 。 也就是说共有 582对码字, 大于 9位所需的 512对任意原字。  [0082] In all possible 1024 codeword samples, all codeword samples whose codeword imbalance D has an absolute value greater than 4 are discarded, so that 252 perfectly balanced codewords (D=0) and 330 pairs are left. Perfectly balanced codewords (D=±2, ±4). That is to say, there are 582 pairs of code words, more than 9 pairs of 512 pairs of arbitrary original words.
[0083] 为了使最大游程长度最小化, 在 582对码字中挑出 70对不需要的码字。 原则是 考虑每个码字的头部和尾部游程长度, 比如码字 0010111111的头部游程长度为 2 , 尾部游程长度为 6。 对上述 582对码字全都以这种方式分析, 可以得到表 2所示 的分布规律: [] [表 2] [0083] To minimize the maximum run length, 70 pairs of unneeded codewords are picked out in 582 pairs of codewords. The principle is to consider the head and tail run length of each codeword, for example, the codeword 0010111111 has a head run length of 2 and a tail run length of 6. The above 582 pairs of codewords are all analyzed in this way, and the distribution law shown in Table 2 can be obtained: [] [Table 2]
Figure imgf000010_0001
Figure imgf000010_0001
[0084] 表 2码字游程长度分布表  Table 2 codeword run length distribution table
[0085] 将头部和尾部游程长度大于 5的 32对码字 (其中码字 0000011111和 1111100000 在表中算了两次) 。 那么此吋还剩下 550对码字, 且由于头部和尾部游程长度为 [0085] 32 pairs of codewords with head and tail run lengths greater than 5 (where codewords 0000011111 and 1111100000 are counted twice in the table). Then there are 550 pairs of codewords left, and the length of the head and tail runs is
4, 所以连续码流的最大游程为 8。 4, so the maximum run of the continuous stream is 8.
[0086] 不能丢弃所有头部和尾部游程长度为 4的码字的原因是会损失太多码字, 从而 导致不够 9位编码所需 512对码字。 这里只选择丢弃尾部游程长度为 4的码字。 [0086] The reason that all headers with a head and tail run length of 4 cannot be discarded is that too many codewords are lost, resulting in less than 512 pairs of codewords required for 9-bit encoding. Here only the codewords with a tail run length of 4 are discarded.
[0087] 通过上述分析后最后得到的许用码字为 232个平衡码字, 其幵头和结尾处的游 程不大于 3 ; 200x2个 D=±2的码字, 80x2个 D=±4的码字, 其幵头和结尾处的游 程不大于 4, 且 232+200+80=512, 刚好可以满足 9位编码所需 512对码字样本。 [0087] The last available codeword obtained by the above analysis is 232 balanced codewords, the run of the head and the end is not more than 3; 200x2 codewords of D=±2, 80x2 D=±4 The codeword has a run of no more than 4 at the head and end, and 232+200+80=512, which just satisfies the 512 pairs of codeword samples required for 9-bit encoding.
[0088] 获取满足 9位编码所需 512对码字样本后, 可以进行 9位到 10位的映射吋, 具体 包括以下步骤: [0088] After obtaining 512 pairs of codeword samples required for 9-bit encoding, a mapping of 9 bits to 10 bits may be performed, including the following steps:
[0089] 步骤 1 : 首先将 232个平衡码字的第一位去掉, 剩下的 9位就是与其对应的原字 。 如平衡码字 0100100111, 去掉第一位就是 100100111, 100100111就是与它对 应的原字, 即用十进制表示就是 295编码后还是 295, 这些原字的第一码字和第 二码字相同。 [0090] 步骤 2: 对剩余的码字与原字进行分析, 同样可以将部分的不平衡码字与部分 的原字对应起来。 规则是先处理的是 D=±2的码字, 后处理 [0089] Step 1: First, the first bit of the 232 balanced code words is removed, and the remaining 9 bits are the original words corresponding thereto. For example, if the balance code word is 0100100111, the first digit is 100100111, 100100111 is the original word corresponding to it, that is, it is 295 coded or 295 in decimal, and the first code word and the second code word of these original words are the same. [0090] Step 2: The remaining codewords are analyzed with the original words, and some of the unbalanced codewords may be associated with the original words of the sections. The rule is to process the codeword with D=±2 first, post processing
D=±4的码字。 如 010011000原字既可以与 1010011000对应, 也可以与 0010011000 对应, 因为先处理 D=±2的码字, 所以它将与  D=±4 codeword. For example, the 010011000 original word can correspond to 1010011000 or 0010011000, because the code word of D=±2 is processed first, so it will be
1010011000对应。 这样处理后有 228个原字可以找到第一码字和第二码字中一种 模式的编码结果。  1010011000 corresponds. After this processing, there are 228 original words to find the coding result of one mode in the first code word and the second code word.
[0091] 步骤 3: 剩余的 52个原字由于不平衡度太大, 不能通过上面的方法得到某一模 式下的编码。 这样的话就只能在剩余的许用码字中先找一个与其最相近的码字 进行映射。 如原字 101000000, 在剩余的码字集合中与其最相近的是 0101000001 , 则 0101000001就是 101000000的第二码字。  [0091] Step 3: The remaining 52 original words cannot be encoded in a certain mode by the above method because the imbalance is too large. In this case, only the remaining codewords can be found in the remaining allowed codewords. For example, if the original word 101000000, the closest one among the remaining codeword sets is 0101000001, then 0101000001 is the second codeword of 101000000.
[0092] 步骤 4: 经过上面步骤处理后, 每个 9位原字都找到了一个与其对应的码字模式 , 这个码字模式可能第一码字也可能是第二码字。 除了步骤 1中平衡码字外, 其 他 280个原字还需要另外一种模式的编码结果。 因此还需找到这 280个原字的另 一个模式下的码字。 其编码准则为: 对于某一个需要编码的原字, 只要从剩余 的码字中找一个与其最接近, 并且和它通过步骤 1~3已找到码字的极性相反即可 。 比如原字 000000000根据步骤 3找到第二码字为 0001000011, 它的极性为负; 则原字的第一码字应该在剩余的许用码字中选一个与他最接近且极性为正的码 字, 这里选择 1001010111作为它的第一码字。  [0092] Step 4: After the above steps are processed, each 9-bit original word finds a corresponding codeword mode, and the codeword mode may be the first codeword or the second codeword. In addition to balancing the codewords in step 1, the other 280 original words require another mode of encoding. Therefore, you need to find the codeword in the other mode of the 280 original words. The coding criterion is: For a original word that needs to be encoded, it is only necessary to find the nearest one from the remaining code words, and the polarity of the code word that has been found by steps 1~3 is opposite. For example, the original word 000000000 finds that the second code word is 0001000011 according to step 3, and its polarity is negative; then the first code word of the original word should select one of the remaining allowed code words that is closest to him and has a positive polarity. Codeword, here select 1001010111 as its first codeword.
[0093] 步骤 5: 通过上述步骤就可以实现 9位到 10位的映射, 但是制作编码表吋不仅仅 包含 10位的码字信息, 还需包含每个码字的不平衡度 D信息。 具体操作方法是: 先计算每个码字中" 1"的个数 n, 则码字不平衡度 D=n-(10-n), 由于码字是经过筛 选后的, 所以这里 n只可能为 3,4,5,6,7。 所以码字不平衡度 D只能为 -4,-2,0,+2,+4 。 对码字不平衡度 D进行 3位编码, 如下表 3所示:  [0093] Step 5: The mapping of 9 bits to 10 bits can be realized by the above steps, but the coding table is not only composed of 10-bit code word information, but also contains the imbalance D information of each code word. The specific operation method is: first calculate the number n of "1" in each codeword, then the codeword unbalance degree D=n-(10-n), since the codeword is filtered, so n is only possible here. It is 3, 4, 5, 6, and 7. Therefore, the code word imbalance D can only be -4, -2, 0, +2, +4. The codeword unbalance D is 3-bit encoded as shown in Table 3 below:
[] [表 3] 码字不平衡 -4 -2 0 2 4  [] [Table 3] Codeword imbalance -4 -2 0 2 4
度 D值  Degree D value
不平衡度 D 110 111 000 001 010 值对应编码 [0094] 表 3码字不平衡度 D值编码表 Unbalance D 110 111 000 001 010 Value corresponding code Table 3 code word imbalance D value coding table
[0095] 将表中码字不平衡度 D的编码信息左移 10位于码字信息相加得到最终编码, 如 式 1所示: 公式中 F_Code为编码査找表中最终编码信息, D_Code表示码字不平 衡度 D的编码信息, U_Code表示 9位原字所对应的码字信息。 D_Code乘以 2的 10 次方表示左移 10位。 因此最终编码信息是一个 13位的编码数据。 512个 9位原字 分别映射为 RD-和 RD+的第一码字和第二码字, 因此码表中共有 1024个码字。 对 每个码字都按照公式 1进行处理生成最终码表后存到 FPGA内部的査找表 RAM中  [0095] The coded information of the codeword unbalance degree D in the table is shifted to the left by 10 and the codeword information is added to obtain the final code, as shown in Equation 1: In the formula, F_Code is the final coded information in the code lookup table, and D_Code represents the codeword. The encoding information of the unbalance degree D, U_Code indicates the codeword information corresponding to the 9-bit original word. Multiplying D_Code by 2 to the 10th power means shifting 10 bits to the left. Therefore, the final encoded information is a 13-bit encoded data. The 512 9-bit original words are mapped to the first code word and the second code word of RD- and RD+, respectively, so there are 1024 code words in the code table. Each codeword is processed according to Equation 1 to generate a final code table and stored in the lookup table inside the FPGA.
[0096] F_Code = D_Code*2A10 + U_Code (公式 1) [0096] F_Code = D_Code*2 A 10 + U_Code (Equation 1)
[0097] 基于上述编码査找表的实现方法, 提供本发明基于 SerDes技术的串行通信系统 编解码方法及装置。  [0097] Based on the implementation method of the above code lookup table, a serial communication system codec method and apparatus based on SerDes technology of the present invention is provided.
[0098] 如图 2所示, 本发明提供一种基于 SerDes技术串行通信系统中的编解码方法, 其中包括数据 9B/10B编码步骤:  As shown in FIG. 2, the present invention provides a codec method in a serial communication system based on SerDes technology, which includes a data 9B/10B encoding step:
[0099] Sl、 将 18位的普通数据分为高 9位和低 9位两个原始数据; [0099] Sl, the 18-bit ordinary data is divided into two raw data of high 9 bits and low 9 bits;
[0100] S2、 将两个所述原始数据分别作为两个编码査找表的初始地址 N (N=0~51 l) [0100] S2, the two original data are respectively used as the initial address of the two code lookup tables N (N=0~51 l)
[0101] S3、 将所述初始地址转化为 2*N+0和 2*N+1作为所述编码査找表的输入地址; [0102] S4、 所述编码査找表根据所述输入地址输出包含不平衡度信息的第一码字与第 二码字; [0101] S3, converting the initial address into 2*N+0 and 2*N+1 as an input address of the code lookup table; [0102] S4. The code lookup table is output according to the input address. a first codeword and a second codeword of the imbalance information;
[0103] 本发明中, 为保证输出码流的直流平衡, 在编码査找表映射吋用 2个 10位的码 字表示一个 9位原字, 分别为第一码字和第二码字; 其中, 第一码字中 "1"的个数 大于或等于 "0"的个数, 第二码字中 "0"的个数大于或等于 " 的个数。 若 10位码 字完美平衡, 即码字中 "1"的个数和 "0"的个数相同, 则第一码字和第二码字相同 ; 若 10位码字非完美平衡, 即码字中 "1 "的个数和 "0"的个数不同, 则第一码字和 第二码字是极性相反的两个不同码字;  [0103] In the present invention, in order to ensure the DC balance of the output code stream, two 10-bit code words are represented by the code lookup table mapping, and a 9-bit original word is respectively used as the first code word and the second code word; , the number of "1" in the first codeword is greater than or equal to the number of "0", and the number of "0" in the second codeword is greater than or equal to the number of ". If the 10-bit codeword is perfectly balanced, ie If the number of "1" in the codeword is the same as the number of "0", then the first codeword and the second codeword are the same; if the 10-bit codeword is not perfectly balanced, that is, the number of "1" in the codeword is If the number of "0" is different, the first codeword and the second codeword are two different codewords of opposite polarity;
[0104] 上述第一码字与第二码字为 10位的码字信息与 3位的不平衡度 D的编码信息相加 得到的; 其中, 所述 10位的码字信息为 9位的所述原始数据到 10位的映射; 所述 不平衡度1)=^ (10-n) , 其中 n为码字中" 1"的个数; [0105] S5、 根据当前码流的运行极性差异 (RD) 值输出选择指示信号; [0104] The first codeword and the second codeword are obtained by adding the codeword information of 10 bits and the coding information of the unbalance degree D of 3 bits; wherein, the 10-bit codeword information is 9 bits. The mapping of the original data to 10 bits; the imbalance degree 1)=^ (10-n), where n is the number of "1"s in the codeword; [0105] S5. Output a selection indication signal according to a running polarity difference (RD) value of the current code stream;
[0106] 具体地, 在根据当前码流的运行极性差异值输出所述选择指示信号吋: 若当前 码流的运行极性差异值为负, 则输出的选择指示信号为高电平; 若当前码流的 运行极性差异值为正, 则输出的选择指示信号为低电平;  [0106] Specifically, the selection indication signal is output according to the running polarity difference value of the current code stream: if the running polarity difference value of the current code stream is negative, the output selection indication signal is a high level; If the running polarity difference value of the current code stream is positive, the output selection indication signal is low level;
[0107] S6、 根据所述选择指示信号在每个所述査找表输出的第一码字与第二码字中选 择一个码字组成下一输出码字; [0107] S6, selecting one codeword among the first codeword and the second codeword outputted by each of the lookup tables according to the selection indication signal to form a next output codeword;
[0108] 具体地, 若输出的所述选择指示信号为高电平, 则下一输出码字中在所述第一 码字与第二码字中选择所述第一码字; 若输出的所述选择指示信号为低电平, 则下一输出码字中在所述第一码字与第二码字中选择所述第二码字。  [0108] Specifically, if the output selection indication signal is a high level, the first codeword is selected in the first codeword and the second codeword in the next output codeword; The selection indication signal is low, and the second codeword is selected in the first codeword and the second codeword in the next output codeword.
[0109] 在本发明的一个实施例中, 步骤 S5中的当前码流的运行极性差异 (RD) 值则 根据表示编码后总不平衡度信息的极性差异总和 (RDS) 值来计算, 其规则如图 3所示:  [0109] In an embodiment of the present invention, the running polarity difference (RD) value of the current code stream in step S5 is calculated according to the polarity difference sum (RDS) value indicating the encoded total unbalance degree information. The rules are shown in Figure 3:
[0110] 上电初始吋刻的 RD值为负, RDS值为 0;  [0110] The RD value of the initial engraving of the power-on is negative, and the RDS value is 0;
[0111] 将原 RD值与输出码字的不平衡度的代数和作为编码后的 RDS值;  [0111] an algebraic sum of the imbalance between the original RD value and the output codeword is taken as the encoded RDS value;
[0112] 当输出码字完美平衡吋, 当前码流的 RD值保持不变; [0112] When the output codeword is perfectly balanced, the RD value of the current code stream remains unchanged;
[0113] 当输出码字的不平衡吋: [0113] When the output codeword is unbalanced:
[0114] 若编码后的 RDS值小于 0,则当前码流的 RD值为负;  [0114] If the encoded RDS value is less than 0, the RD value of the current code stream is negative;
[0115] 若编码后的 RDS值大于 0,则当前码流的 RD值为正; [0115] If the encoded RDS value is greater than 0, the RD value of the current code stream is positive;
[0116] 若编码后的 RDS值等于 0,且原码流的 RD值为正, 则当前码流的 RD值为负; [0117] 若编码后的 RDS值等于 0,且原码流的 RD值为负, 则当前码流的 RD值为正。  [0116] If the encoded RDS value is equal to 0, and the RD value of the original code stream is positive, the RD value of the current code stream is negative; [0117] If the encoded RDS value is equal to 0, and the original code stream is RD If the value is negative, the RD value of the current stream is positive.
[0118] 如图 4所示, 除了编码步骤外, 还包括 K码编码步骤: [0118] As shown in FIG. 4, in addition to the encoding step, a K code encoding step is also included:
[0119] Sl l、 定义 6个 K码, 每两个 K码为一组, 且每组 K码中的码字互为补码; [0119] Sl l, defining six K codes, each of the two K codes is a group, and the code words in each group of K codes are complementary to each other;
[0120] K码可以用来完成码流的字节对齐、 帧定界、 字符填充以及吋钟恢复等功能。 [0120] The K code can be used to perform functions such as byte alignment, frame delimitation, character padding, and clock recovery of the code stream.
本实施例中 9B/10B编译码定义 3组共 6个 K码, 分别为 K001和 K101、 Κ002和 K102 、 以及 Κ003和 K103 , 每一组 Κ码中两个码字互为补码, 分别代表 Κ码的第一码字 和第二码字编码输出;  In this embodiment, the 9B/10B coding code defines three groups of six K codes, which are K001 and K101, Κ002 and K102, and Κ003 and K103, respectively. Two codewords in each group of weights complement each other, respectively. The first codeword and the second codeword of the weight are encoded and output;
[0121] S12、 接收输入的 K码指示信号和极性选择信号; [0121] S12. Receive an input K code indication signal and a polarity selection signal.
[0122] S13、 通过 K码査找表输出由两个 10比特组成的 K码编码; [0123] K码编码的实现过程也相当于一个査找表, 其输出输入关系如图 12所示。 [0122] S13. Output a K code encoded by two 10-bits through a K code lookup table. [0123] The implementation process of K code encoding is also equivalent to a lookup table, and its output input relationship is as shown in FIG.
[0124] 如图 5所示, 在本发明的另一实施例中, 还包括译码步骤, 译码步骤与编码步 骤的构思是相同的, 也是基于査找表方法实现的, 不同的是, 译码过程是无记 忆的。 所谓的无记忆译码就是指对当前接收的 10位码字译码得到一个 9位数据, 与以前的码流无任何关系, 即无论何吋接收到同样 10位的码字译码后都只会有 一种译码结果。 具体地, 译码步骤可以包括: [0124] As shown in FIG. 5, in another embodiment of the present invention, a decoding step is further included, where the decoding step and the encoding step are the same, and are also implemented based on a lookup table method, and the difference is that the translation is performed. The code process is memoryless. The so-called memoryless decoding refers to decoding a currently received 10-bit codeword to obtain a 9-bit data, which has nothing to do with the previous code stream, that is, only after receiving the same 10-bit codeword decoding. There will be a decoding result. Specifically, the decoding step may include:
[0125] S21、 对译码査找表中对应普通数据位置上的译码输出数据做处理;  [0125] S21. Perform processing on the decoded output data in the corresponding common data position in the decoding lookup table.
[0126] 译码是编码的逆过程, 具体也是基于査找表方法实现的。 由上文编码过程所知 , 为保证输出码流的直流平衡, 在码表映射吋用 2个 10位的码字表示一个 9位原 字, 分别为第一码字和第二码字。 若 10位码字完美平衡, 则第一码字和第二码 字相同; 若 10位码字非完美平衡, 则第一码字和第二码字不相同。 [0126] Decoding is the inverse of encoding, and is specifically implemented based on a lookup table method. As known from the above encoding process, in order to ensure the DC balance of the output code stream, two 10-bit code words are used in the code table mapping to represent a 9-bit original word, which are respectively the first code word and the second code word. If the 10-bit codeword is perfectly balanced, the first codeword and the second codeword are the same; if the 10-bit codeword is not perfectly balanced, the first codeword and the second codeword are different.
[0127] 在生成译码査找表的吋候, 若第一码字和第二码字相同, 则译码査找表中只有 一个位置存放着原字信息。 若第一码字和第二码字不同, 则译码査找表中有两 个位置存放着原字信息。 比如原字 000000000 (十进制为 0) 经编码后得到两个 不同码字, 分别为第一码字 1001010111 (十进制为 599) 、 第二码字 0001000011 (十进制为 67) 。 则在译码吋, 査找表地址为 599和 67吋, 译码输出都将输出 0 , 即译码表中两个位置都存放着 0这个原字信息。 而原字 0011100001 (十进制为 225) 经编码后得到两个相同的码字, 即第一码字和第二码字均为 1011100001 ( 十进制为 737) , 则在译码吋, 査找表地址有且只有等于 737吋, 译码才输出 225 , 即译码表中只有一个位置存放着 225这个原字信息。 [0127] When the decoding lookup table is generated, if the first codeword and the second codeword are the same, only one location in the decoding lookup table stores the original word information. If the first codeword and the second codeword are different, there are two locations in the decoding lookup table to store the original word information. For example, the original word 000000000 (decimal is 0) is encoded to obtain two different code words, which are the first codeword 1001010111 (decimal is 599) and the second codeword 0001000011 (decimal is 67). Then, after decoding, the lookup table addresses are 599 and 67吋, and the decoded output will output 0, that is, the original word information is stored in both positions in the decoding table. The original word 0011100001 (decimal is 225) is encoded to obtain two identical codewords, that is, the first codeword and the second codeword are 1011100001 (decimal is 737), then after decoding, the lookup table address has Only equal to 737 吋, the decoding will output 225, that is, only one position in the decoding table stores 225 original word information.
[0128] S22、 对所述译码査找表中对应 K码位置上的译码输出数据做处理; [0128] S22. Process the decoded output data at the corresponding K code position in the decoding lookup table.
[0129] 具体地, 对应 K码位置上的译码输出数据包括低 9位的 K码原字信息和高 3位为 K 码指示信息; [0129] Specifically, the decoded output data corresponding to the K code position includes the lower 9 bits of the K code original word information and the upper 3 bits are the K code indication information;
[0130] 在译码査找表生成过程中, 还应包含 K码指示信息。 本发明在编码过程中共用 [0130] In the decoding lookup table generation process, K code indication information should also be included. The invention is shared during the encoding process
SJ3组 6个 K码, 分别为 K001和 K101、 Κ002和 Κ102、 以及 Κ003和 Κ103, 每一组 Κ 码中两个码字互为补码, 分别代表 κ码的第一码字和第二码字输出。 在生成译码 査找表吋, 当检测到 K001和 K101吋, Κ码指示信息的第 1比特置 1 ; 当检测到 Κ002和 K102吋, Κ码指示信息第 2比特置 1 ; 当检测到 Κ003和 K103吋, Κ码指示 信息的第 3比特置 1。 然后将这 3比特 K码指示信息与 K码原字信息相结合, 其处理 方式如公式 2所示: The SJ3 group has six K codes, K001 and K101, Κ002 and Κ102, and Κ003 and Κ103, respectively. Two codewords in each set of codes are complementary to each other, respectively representing the first codeword and the second code of the κ code. Word output. After generating the decoding lookup table, when K001 and K101吋 are detected, the first bit of the weight indication information is set to 1; when Κ002 and K102吋 are detected, the second bit of the weight indication information is set to 1; when Κ003 and K103吋, weight indication The third bit of the information is set to 1. Then, the 3-bit K code indication information is combined with the K code original word information, and the processing manner is as shown in Equation 2:
[0131] F_data = K_Flag[9]*2A9 + K_Flag[10]*2A10+ K_Flag[l 1]*2Λ11+K_data (公式 2) [0132] 其中 F_data译码査找表中 K码的译码输出数据, K_Flag为 3位 Κ码指示信息, K_ data为 9位 Κ码原字信息。 为经过公式 2处理后就将 3位 K码指示信息的第 1、 2、 3 比特对应到译码数据输出的第 9、 10、 11比特, 在结合 9比特 K码原字信息, 最终 的译码输出 F_data为一个 12比特的数据。 F_data = K_Flag[9]*2 A 9 + K_Flag[10]*2 A 10+ K_Flag[l 1]*2 Λ 11+K_data (Equation 2) [0132] where F_data decodes the K code in the lookup table The decoded output data, K_Flag is a 3-digit weight indication information, and K_data is a 9-digit weight original word information. After processing by Equation 2, the 1st, 2nd, and 3rd bits of the 3-bit K code indication information are corresponding to the 9th, 10th, and 11th bits of the decoded data output, and the 9-bit K-code original word information is combined, and the final translation is performed. The code output F_data is a 12-bit data.
[0133] 值得一提的是, 译码査找表中的普通数据的译码输出其实也是 12比特。 其也包 括 3比特的 K码指示信息, 只是作为普通数据吋, 对应着 K码指示信息的 3比特均 为 0而已。 [0133] It is worth mentioning that the decoding output of the normal data in the decoding lookup table is actually 12 bits. It also includes 3-bit K code indication information, just as normal data, and the 3 bits corresponding to the K code indication information are all 0.
[0134] S23、 在上述生成的译码査找表中根据査找表的地址分别选择一个译码输出数 据;  [0134] S23. Select one decoded output data according to the address of the lookup table in the generated decoding lookup table.
[0135] 将 20位的译码数据分为高 10位与低 10位两个码字分别作为两个译码査找表的地 址; 由于译码过程是无记忆的, 两个译码査找表根据输入地址分别选择相应的 译码输出数据。  [0135] The 20-bit decoded data is divided into two addresses of the upper 10 bits and the lower 10 bits as the addresses of the two decoding lookup tables; since the decoding process is memoryless, the two decoding lookup tables are based on The input address selects the corresponding decoded output data.
[0136] S24、 将两个所述译码输出数据的低 9比特整合后输出。  [0136] S24. Integrate the lower 9 bits of the two decoded output data and output.
[0137] 也就是, 将两路査找表译码输出数据整合为一路 18位的数据, 并将其作为译码 输出。 其输入输出关系为:  [0137] That is, the two-way lookup table decoded output data is integrated into one 18-bit data and used as a decoded output. Its input and output relationship is:
[0138] Xout[17:0]={DoutB[8:0], DoutA[8:0] } [0138] Xout[17:0]={DoutB[8:0], DoutA[8:0] }
[0139] 其中 Xout为译码输出信号, DoutA[8:0]为低 10比特码字査找表输出译码数据的 低 9比特; DoutB[8:0]为高 10比特码字査找表输出译码数据的低 9比特。 在 S24中 所述的译码输出数据流中, SerDes系统并不知道哪个是 K码哪个是普通数据, 因 此译码过程还需输出 K码指示信号, 即 Kout[l:0], 当它为两比特 0吋, 系统会认 为当前译码输出为普通数据的译码输出, 当不为 0吋, 表明当前译码输出为 K码 的译码输出。 K码指示信号对于 SerDes系统对于恢复吋钟, 保持链路同步起着关 键作用。 具体地, 将在步骤 S22中获取的包含 K码信息 (即两个査找表输出数据 的第 13~15比特) 数据作为输入, 经过相关的逻辑运算得到 K码指示信号输出。 其输入输出关系为: [0140] 当 DoutB[10]=l吋, Kout[l]=l ; Where Xout is the decoded output signal, DoutA[8 : 0] is the lower 9 bits of the lower 10 bit codeword lookup table output decoding data; DoutB[8 : 0] is the upper 10 bit codeword lookup table The lower 9 bits of the decoded data are output. In the decoded output data stream described in S24, the SerDes system does not know which is the K code which is normal data, so the decoding process also needs to output a K code indication signal, that is, Kout[l : 0], when it is When two bits are 0吋, the system will consider the current decoded output to be the decoded output of normal data. When it is not 0吋, it indicates that the current decoded output is the decoded output of the K code. The K-code indication signal plays a key role in restoring the 吋 clock for the SerDes system to maintain link synchronization. Specifically, the K code information (ie, the 13th to 15th bits of the two lookup table output data) data acquired in step S22 is input, and the K code indication signal is output through the related logical operation. Its input and output relationship is: [0140] When DoutB[10]=l吋, Kout[l]=l;
[0141] 当 DoutA[9]=l吋, Kout[0]=0; DoutA[l l]=l吋, Kout[0]=l。  [0141] When DoutA[9]=l吋, Kout[0]=0; DoutA[l l]=l吋, Kout[0]=l.
[0142] 其中 Kout为 K码指示信号, DoutA为低 10比特码字査找表输出译码数据; DoutB 为高 10比特码字査找表输出译码数据。  [0142] wherein Kout is a K code indication signal, DoutA is a low 10-bit codeword lookup table outputting decoded data; DoutB is a high 10-bit codeword lookup table outputting decoded data.
[0143] 上面对本发明实施例中的基于 SerDes技术串行通信系统中的编解码方法进行了 描述, 下面对本发明实施例中的基于 SerDes (串行器 /解串器) 技术串行通信系 统中的编解码装置进行描述。 The encoding and decoding method in the serial communication system based on the SerDes technology in the embodiment of the present invention is described above, and the following is a serial communication system based on the SerDes (serializer/deserializer) technology in the embodiment of the present invention. The codec device is described.
[0144] 如图 6所示, 本发明还提供一种基于 SerDes技术串行通信系统中编解码装置, 包括主编码器 10、 与主编码器相连的线路极性计算器 20、 与主编码器相连的编 码选择器 30。 [0144] As shown in FIG. 6, the present invention further provides a codec device in a serial communication system based on SerDes technology, comprising a main encoder 10, a line polarity calculator 20 connected to the main encoder, and a main encoder A connected code selector 30.
[0145] 如图 7所示, 其中, 主编码器 10包括: [0145] As shown in FIG. 7, wherein the main encoder 10 includes:
[0146] 拆分单元 11, 用于将 18位的普通数据分为高 9位以及低 9位的两个原始数据; [0147] 初始地址定义单元 12, 用于将两个原始数据分别作为两个编码査找表的初始地 址 N (N=0~51 l) ;  [0146] The splitting unit 11 is configured to divide the normal data of 18 bits into two original data of the upper 9 bits and the lower 9 bits; [0147] an initial address defining unit 12, configured to use two original data as two The initial address of the code lookup table N (N=0~51 l);
[0148] 输入地址计算单元 13, 用于将初始地址转化为 2*N+0和 2*N+1作为编码査找表 输入地址;  [0148] The input address calculation unit 13 is configured to convert the initial address into 2*N+0 and 2*N+1 as the code lookup table input address;
[0149] 输出单元 14, 用于编码査找表根据输入地址输出包含不平衡度信息的第一码字 与第二码字; 本发明中, 为保证输出码流的直流平衡, 在编码査找表映射吋用 2 个 10位的码字表示一个 9位原字, 分别为第一码字和第二码字; 其中, 第一码字 中 "1 "的个数大于或等于 "0"的个数, 第二码字中 "0"的个数大于或等于 " 的个数 。 若 10位码字完美平衡, 则第一码字和第二码字相同; 若 10位码字非完美平衡 , 则第一码字和第二码字不同且极性相反; 上述编码査找表中的第一码字与第 二码字为 10位的码字信息与 3位的不平衡度 D的编码信息相加得到的; 其中, 10 位的码字信息为 9位的原始数据对应 10位的编码映射; 其中不平衡度 D=n- ( 10-n ) , 其中 n为码字中 "1"的个数。  [0149] The output unit 14 is configured to output, according to the input address, the first codeword and the second codeword including the imbalance information according to the input address. In the present invention, in order to ensure the DC balance of the output codestream, the mapping in the code lookup table is performed. 2Using two 10-bit codewords to represent a 9-bit original word, respectively a first codeword and a second codeword; wherein, the number of "1"s in the first codeword is greater than or equal to the number of "0" The number of "0" in the second codeword is greater than or equal to the number of ". If the 10-bit codeword is perfectly balanced, the first codeword and the second codeword are the same; if the 10-bit codeword is not perfectly balanced, then The first codeword and the second codeword are different and the polarities are opposite; the first codeword in the above code lookup table and the codeword information in which the second codeword is 10 bits are added to the coded information of the unbalanced degree D of 3 bits. The obtained 10-bit codeword information is 9-bit original data corresponding to a 10-bit coding mapping; wherein the imbalance degree D=n-( 10-n ), where n is the number of "1"s in the codeword .
[0150] 上述线路极性计算器 20用来保证输出码流的直流平衡, 它为编码选择器提供选 择指示信号。 编码过程中, 根据表示当前码流不平衡特性的运行极性差异 RD值 来决定选择指示信号的输出。 具体地, 在根据当前码流的运行极性差异值输出 所述选择指示信号吋: 若当前码流的运行极性差异值为负, 则输出的选择指示 信号为高电平; 若当前码流的运行极性差异值为正, 则输出的选择指示信号为 低电平。 [0150] The line polarity calculator 20 described above is used to ensure DC balance of the output code stream, which provides a selection indication signal for the code selector. In the encoding process, the output of the selection indication signal is determined based on the running polarity difference RD value indicating the current code stream imbalance characteristic. Specifically, the value is output according to the running polarity difference value of the current code stream. The selection indication signal 吋: if the running polarity difference value of the current code stream is negative, the output selection indication signal is high level; if the running polarity difference value of the current code stream is positive, the output selection indication signal Is low.
[0151] 编码选择器 30的功能是选择编码输出, 其由三个输入端一个输出端, 分别为数 据输入端八、 数据输入端 B、 输入选择指示信号以及数据输出端。 其输出与输入 关系为:  [0151] The function of the code selector 30 is to select a coded output, which is composed of three inputs and one output, which are respectively a data input terminal 8, a data input terminal B, an input selection indication signal, and a data output terminal. Its output and input relationship is:
[0152] 1) 当选择指示信号为 1吋, 编码输出=输入数据 A;  [0152] 1) when the selection indication signal is 1吋, the code output = input data A;
[0153] 2) 当选择指示信号为 0吋, 编码输出=输入数据^  [0153] 2) When the selection indication signal is 0吋, the code output = input data ^
[0154] 在本发明的另一实施例中, 请参照图 8, 线路极性计算器 20包括:  [0154] In another embodiment of the present invention, referring to FIG. 8, the line polarity calculator 20 includes:
[0155] 差异总和值计算单元 21, 用于将运行极性差异值与输出码字的不平衡度的代数 和作为编码后的极性差异总和值;  [0155] The difference sum value calculation unit 21 is configured to use the algebraic sum of the running polarity difference value and the unbalanced degree of the output code word as the encoded polarity difference sum value;
[0156] 平衡判断单元 22, 用于判断输出码字是否完美平衡; [0156] The balance determining unit 22 is configured to determine whether the output codeword is perfectly balanced;
[0157] 运行极性差异值计算单元 23, 用于当输出码字完美平衡吋, 当前码流的运行极 性差异值保持不变;  [0157] The running polarity difference value calculating unit 23 is configured to: when the output codeword is perfectly balanced, the running polarity difference value of the current code stream remains unchanged;
[0158] 运行极性差异值计算单元 23还用于, 当输出码字的不平衡吋: 若编码后的极性 差异总和值小于 0,则当前码流的运行极性差异值为负; 若编码后的极性差异总和 值大于 0,则当前码流的运行极性差异值为正; 若编码后的极性差异总和值等于 0, 且原码流的运行极性差异值为正, 则当前码流的运行极性差异值为负; 若编码 后的极性差异总和值等于 0,且原码流的运行极性差异值为负, 则当前码流的运行 极性差异值为正。 需要说明的是, 在上电初始吋刻的运行极性差异值为负, 编 码后的极性差异总和值为 0。  [0158] The running polarity difference value calculating unit 23 is further configured to: when the output code word is unbalanced: if the encoded polarity difference sum value is less than 0, the current code stream running polarity difference value is negative; If the sum of the polarity differences after encoding is greater than 0, the running polarity difference value of the current code stream is positive; if the sum of the polarity differences after encoding is equal to 0, and the running polarity difference value of the original code stream is positive, then The running polarity difference value of the current code stream is negative; if the encoded polarity difference sum value is equal to 0, and the running polarity difference value of the original code stream is negative, the running polarity difference value of the current code stream is positive. It should be noted that the running polarity difference value at the initial power-on encapsulation is negative, and the sum of the polarity differences after encoding is 0.
[0159] 编码选择器 30用于根据选择指示信号在每个査找表输出的第一码字与第二码字 中选择一个码字组成下一输出码字。 [0159] The code selector 30 is configured to select one codeword among the first codeword and the second codeword outputted by each lookup table according to the selection indication signal to form a next output codeword.
[0160] 如图 9、 图 10所示, 本实施例中还包括 K码编码器 40, 与线路极性计算器 20以及 编码选择器 30相连: K码编码器 40包括: As shown in FIG. 9 and FIG. 10, the K code encoder 40 is further included in the embodiment, and is connected to the line polarity calculator 20 and the code selector 30. The K code encoder 40 includes:
[0161] 定义单元 41, 用于定义 6个 K码, 每两个 K码为一组, 且每组 K码中的码字互为 补码; K码可以用来完成码流的字节对齐、 帧定界、 字符填充以及吋钟恢复等功 育^ 本实施例中 9B/10B编译码定义 3组共 6个 K码, 分别为 K001和 K101、 Κ002和 K102、 以及 K003和 K103, 每一组 Κ码中两个码字互为补码, 分别代表 Κ码的第 一码字和第二码字编码输出; [0161] The defining unit 41 is configured to define six K codes, each of the two K codes is a group, and the code words in each group of K codes are complementary to each other; the K code can be used to complete the byte alignment of the code stream. , frame delimitation, character padding, and clock recovery, etc. In this embodiment, the 9B/10B codec defines 3 groups of 6 K codes, which are K001 and K101, Κ002 and K102, and K003 and K103, two codewords in each set of weights are complementary to each other, respectively representing the first codeword and the second codeword coded output of the weight;
[0162] 接收单元 42, 用于接收输入的 Κ码指示信号和极性选择信号; [0162] The receiving unit 42 is configured to receive the input weight indication signal and the polarity selection signal;
[0163] Κ码编码输出单元 43, 用于通过 Κ码査找表输出由两个 10比特组成的 Κ码编码;[0163] The weight code output unit 43 is configured to output a weight code composed of two 10 bits through a weight lookup table;
Κ码编码的实现过程也相当于一个査找表, 其输出输入关系如表 4所示。 The implementation process of the weight code is also equivalent to a lookup table. The output and input relationship is shown in Table 4.
[0164] 虽然图中没显示, 但是还包括与 Κ码编码器 40相连的延迟模块, 延迟模块的功 能是保证编码器编码输出和 Κ码输出指示信号对齐, 即编码器在 Κ码输出指示信 号有效吋, 此吋编码器的编码输出正好是 Κ码。 为了保证这种对齐关系, Κ码输 入指示信号必须通过延迟模块得到 Κ码输出指示信号, 且延迟模块的吋延量必须 等于输入数据经过编码器编码处理产生的吋延量。 [0164] Although not shown in the figure, it further includes a delay module connected to the weight encoder 40. The function of the delay module is to ensure that the encoder code output and the weight output indication signal are aligned, that is, the encoder outputs the indication signal at the weight. Effectively, the encoded output of this 吋 encoder is exactly the weight. In order to ensure this alignment relationship, the weight input indication signal must obtain the weight output indication signal through the delay module, and the delay of the delay module must be equal to the delay of the input data after the encoder encoding process.
[0165] 如图 10所示, 在本实施例中还包括主译码器 50以及与主译码器相连的数据整合 器 60;  [0165] As shown in FIG. 10, in this embodiment, a main decoder 50 and a data integrator 60 connected to the main decoder are further included;
[0166] 主译码器 50用于对译码査找表中对应普通数据位置上的译码输出数据做处理; 对所述译码査找表中对应 Κ码位置上的译码输出数据做处理; 在上述生成的译码 査找表中根据査找表的地址分别选择一个译码输出数据; 译码是编码的逆过程 , 具体也是基于査找表方法实现的。 由上文所知, 为保证输出码流的直流平衡 , 在码表映射吋用 2个 10位的码字表示一个 9位原字, 分别为第一码字和第二码 字。 若 10位码字完美平衡, 则第一码字和第二码字相同; 若 10位码字非完美平 衡, 则第一码字和第二码字不相同。 因此在生成译码査找表的吋候, 若第一码 字和第二码字相同, 则译码査找表中只有一个位置存放着原字信息。 若第一码 字和第二码字不同, 则译码査找表中有两个位置存放着原字信息。 比如原字 000 000000 (十进制为 0) 经编码后得到两个不同码字, 分别为第一码字 1001010111 (十进制为 599) 、 第二码字 0001000011 (十进制为 67) 。 则在译码吋, 査找表 地址为 599和 67吋, 译码输出都将输出 0。 而原字 0011100001 (十进制为 225) 经 编码后得到两个相同的码字, 即 RD-和第二码字均为 1011100001 (十进制为 737 ) , 则在译码吋, 査找表地址有且只有等于 737吋, 译码才输出 225。  [0166] The main decoder 50 is configured to process the decoded output data in the corresponding common data position in the decoding lookup table; and process the decoded output data in the corresponding weight position in the decoding lookup table; In the above-mentioned generated decoding lookup table, one decoding output data is respectively selected according to the address of the lookup table; decoding is the inverse process of encoding, and is specifically implemented based on the lookup table method. As can be seen from the above, in order to ensure the DC balance of the output code stream, two 10-bit code words are used in the code table mapping to represent a 9-bit original word, which are the first code word and the second code word, respectively. If the 10-bit codeword is perfectly balanced, the first codeword and the second codeword are the same; if the 10-bit codeword is not perfectly balanced, the first codeword and the second codeword are not identical. Therefore, when the decoding lookup table is generated, if the first codeword and the second codeword are the same, only one location in the decoding lookup table stores the original word information. If the first code word and the second code word are different, there are two locations in the decoding lookup table to store the original word information. For example, the original word 000 000000 (decimal 0) is encoded to obtain two different code words, which are the first code word 1001010111 (decimal is 599) and the second code word 0001000011 (decimal is 67). Then, after decoding, the lookup table addresses are 599 and 67吋, and the decoded output will output 0. The original word 0011100001 (decimal is 225) is encoded to obtain two identical codewords, that is, RD- and the second codeword are 1011100001 (decimal is 737), then after decoding, the lookup table address has and only equals 737吋, decoding only outputs 225.
[0167] 主译码器 50可以用于 Κ码的译码; 具体地, 在生成译码表吋对 Κ码原字信息做 特殊处理, 即在 9位 Κ码的原字信息基础上加入 3位 Κ码指示信息。 本发明在编码 过程中共用到 3组 6个 K码, 分别为 K001和 Κ101、 Κ002和 Κ102、 以及 Κ003和 K10[0167] The main decoder 50 can be used for decoding the weight; specifically, the special processing is performed on the original information of the weight in the generation of the decoding table, that is, the original word information of the 9-digit weight is added to the 3 Bit weight indication information. The invention is encoded In the process, 3 groups of 6 K codes are shared, which are K001 and Κ101, Κ002 and Κ102, and Κ003 and K10 respectively.
3, 每一组 Κ码中两个码字互为补码, 分别代表 Κ码的第一码字和第二码字编码输 出。 在生成译码表吋, 当检测到 K001和 K101吋, Κ码指示信息的第 1比特置 1 ; 当检测到 Κ002和 K102吋, Κ码指示信息第 2比特置 1 ; 当检测到 Κ003和 K103吋3. The two code words in each set of weights are complementary to each other, and represent the first code word and the second code word code output of the weight respectively. After generating the decoding table, when K001 and K101吋 are detected, the first bit of the weight indication information is set to 1; when Κ002 and K102吋 are detected, the second bit of the weight indication information is set to 1; when Κ003 and K103 are detected Inches
, Κ码指示信息的第 3比特置 1。 The third bit of the weight indication information is set to 1.
[0168] 数据整合器 60用于将两个译码输出数据的低 9比特整合后输出; 具体地, 将两 路査找表译码输出数据整合为一路 18位的数据, 并将其作为整个主译码器的译 码输出。 其输入输出关系为: [0168] The data integrator 60 is configured to integrate the lower 9 bits of the two decoded output data and output the data; specifically, combine the decoded data of the two lookup tables into one 18-bit data, and use it as the whole main Decoded output of the decoder. Its input and output relationship is:
[0169] Xout[17:0]={DoutB[8:0], DoutA[8:0] } [0169] Xout[17:0]={DoutB[8:0], DoutA[8:0] }
[0170] 其中 Xout为译码输出信号, DoutA为低 10比特码字査找表输出译码数据; Dout [0170] wherein Xout is a decoded output signal, and DoutA is a low 10-bit codeword lookup table to output decoded data; Dout
B为高 10比特码字査找表输出译码数据。 B outputs decoded data for a high 10-bit codeword lookup table.
[0171] 此外, 还包括 K码指示信息处理器 70, 用于将获取的包含 K码信息 (即两个査 找表输出数据的第 9~11比特) 数据作为输入, 经过相关的逻辑运算得到 K码指示 信号输出。 其输入输出关系为: [0171] In addition, the K code indication information processor 70 is further configured to input the acquired data including the K code information (ie, the 9th to 11th bits of the two lookup table output data), and obtain the K through the related logical operation. The code indicates the signal output. Its input and output relationship is:
[0172] 当 DoutB[10]=l吋, Kout[l]=l ; [0172] When DoutB[10]=l吋, Kout[l]=l;
[0173] 当 DoutA[9]=l吋, Kout[0]=0; DoutA[l l]=l吋, Kout[0]=l。  [0173] When DoutA[9]=l吋, Kout[0]=0; DoutA[l l]=l吋, Kout[0]=l.
[0174] 其中 Kout为 K码指示信号, DoutA为低 10比特码字査找表输出译码数据; DoutB 为高 10比特码字査找表输出译码数据。  [0174] wherein Kout is a K code indication signal, DoutA is a low 10-bit codeword lookup table outputting decoded data; DoutB is a high 10-bit codeword lookup table outputting decoded data.
[0175] 本发明所述的 9B/10B编码主要是在 FPGA中通过査找表方法实现的, 其将普通 数据分为高 9位和低 9位数据分别作为査找表的地址, 査找表则把地址相对应的 正极性 (Rd+) 第一码字和负极性 (Rd-) 第二码字同吋输出到编码选择器中, 编码选择器通过线路极性计算器提供的指示信号选择相应的编码输出。 K码编码 器则根据 K码指示和线路极性计算器提供的指示共同选择相应的 K码输出, 最终 的编码输出则通过编码选择器在 K码输出和普通数据编码输出中做出选择。  [0175] The 9B/10B encoding according to the present invention is mainly implemented in a FPGA by a lookup table method, which divides ordinary data into high 9 bits and low 9 bits respectively as addresses of a lookup table, and a lookup table puts addresses. The corresponding positive polarity (Rd+) first codeword and negative polarity (Rd-) second codeword are output to the code selector, and the code selector selects the corresponding coded output through the indication signal provided by the line polarity calculator. . The K code encoder selects the corresponding K code output according to the K code indication and the indication provided by the line polarity calculator, and the final code output is selected by the code selector in the K code output and the normal data code output.
[0176] 以上参照附图说明了本发明的优选实施例, 本领域技术人员不脱离本发明的范 围和实质, 可以有多种变型方案实现本发明。 举例而言, 作为一个实施例的部 分示出或描述的特征可用于另一实施例以得到又一实施例。 以上仅为本发明较 佳可行的实施例而已, 并非因此局限本发明的权利范围, 凡运用本发明说明书 及附图内容所作的等效变化, 均包含于本发明的权利范围之内。 The preferred embodiments of the present invention have been described above with reference to the drawings, and the present invention can be implemented by various modifications without departing from the scope and spirit of the invention. For example, features illustrated or described as part of one embodiment can be used in another embodiment to yield a further embodiment. The above is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Equivalent variations made by the contents of the drawings are included in the scope of the invention.

Claims

权利要求书 Claim
[权利要求 1] 一种基于 SerDes技术串行通信系统中的编解码方法, 包括编码步骤: 将 18位的普通数据分为高 9位和低 9位两个原始数据;  [Claim 1] A codec method in a serial communication system based on SerDes technology, comprising an encoding step: dividing 18-bit ordinary data into two original data of 9 bits and 9 bits;
将两个所述原始数据分别作为两个编码査找表的初始地址 N;  Taking the two original data as the initial address N of the two encoded lookup tables respectively;
将所述初始地址转化为 2*N+0和 2*N+1作为所述编码査找表的输入地 址;  Converting the initial address into 2*N+0 and 2*N+1 as input addresses of the code lookup table;
所述编码査找表根据所述输入地址输出包含不平衡度信息的第一码字 与第二码字; 其中, 所述第一码字中 "1 "的个数大于或等于 "0"的个数 , 其不平衡度为正; 所述第二码字中 "0"的个数大于或等于 "1"的个数 The code lookup table outputs a first codeword and a second codeword including unbalance information according to the input address; wherein, the number of "1"s in the first codeword is greater than or equal to "0" Number, the degree of imbalance is positive; the number of "0" in the second codeword is greater than or equal to the number of "1"
, 其不平衡度为负; , its imbalance is negative;
根据当前码流的运行极性差异值输出选择指示信号;  Outputting a selection indication signal according to a running polarity difference value of the current code stream;
根据所述选择指示信号在每个所述査找表输出的第一码字与第二码字 中选择一个码字组成下一输出码字。  And selecting one codeword among the first codeword and the second codeword outputted by each of the lookup tables according to the selection indication signal to form a next output codeword.
[权利要求 2] 根据权利要求 1所述基于 SerDes技术串行通信系统中的编解码方法, 其特征在于, 所述第一码字与第二码字为 10位的码字信息与 3位的不 平衡度 D的编码信息相加得到的; 其中, 所述 10位的码字信息为 9位 的所述原始数据到 10位的映射; 所述不平衡度 D=n- (10-n) , 其中 n 为码字中 "1 "的个数。  [Claim 2] The codec method in the serial communication system based on the SerDes technology according to claim 1, wherein the first codeword and the second codeword are 10-bit codeword information and 3-bit The coding information of the unbalance degree D is added; wherein, the 10-bit codeword information is a mapping of the original data of 9 bits to 10 bits; the imbalance degree D=n-(10-n) , where n is the number of "1"s in the codeword.
[权利要求 3] 根据权利要求 1所述基于 SerDes技术串行通信系统中的编解码方法, 其特征在于, 还包括 K码编码步骤:  [Claim 3] The codec method in the serial communication system based on the SerDes technology according to claim 1, further comprising a K code encoding step:
定义 6个 K码, 每两个 K码为一组, 且每组 K码中的码字互为补码; 接收输入的 K码指示信号和极性选择信号;  Defining 6 K codes, each of the two K codes is a group, and the code words in each group of K codes are complementary to each other; receiving the input K code indication signal and the polarity selection signal;
通过 K码査找表输出由两个 10比特组成的 K码编码。  The K code code consisting of two 10 bits is output through the K code lookup table.
[权利要求 4] 根据权利要求 1所述基于 SerDes技术串行通信系统中的编解码方法, 其特征在于, [Claim 4] A codec method in a serial communication system based on SerDes technology according to claim 1, wherein
在根据所述当前码流的运行极性差异值输出所述选择指示信号吋: 若 所述当前码流的运行极性差异值为负, 则输出的所述选择指示信号为 高电平; 若所述当前码流的运行极性差异值为正, 则输出的所述选择 指示信号为低电平; Outputting the selection indication signal according to the running polarity difference value of the current code stream: if the running polarity difference value of the current code stream is negative, the output selection indication signal is a high level; The running polarity difference value of the current code stream is positive, and the selection of the output is The indication signal is low;
在根据所述选择指示信号在每个所述査找表输出的第一码字与第二码 字中选择一个码字组成输出码字吋: 若输出的所述选择指示信号为高 电平, 则所述下一输出码字中在所述第一码字与第二码字中选择所述 第一码字; 若输出的所述选择指示信号为低电平, 则所述下一输出码 字中在所述第一码字与第二码字中选择所述第二码字。  Selecting one codeword in the first codeword and the second codeword outputted in each of the lookup tables according to the selection indication signal to form an output codeword 吋: if the output selection indication signal is high level, Selecting the first codeword in the first codeword and the second codeword in the next output codeword; if the output selection indication signal is a low level, the next output codeword Selecting the second codeword in the first codeword and the second codeword.
[权利要求 5] 根据权利要求 1或 4所述基于 SerDes技术串行通信系统中的编解码方法[Claim 5] A codec method in a serial communication system based on SerDes technology according to claim 1 or 4.
, 其特征在于, 所述当前码流的运行极性差异值的计算具体包括步骤 将所述运行极性差异值与所述输出码字的不平衡度的代数和作为编码 后的极性差异总和值; The calculation of the running polarity difference value of the current code stream specifically includes the step of combining the algebraic sum of the running polarity difference value and the output code word imbalance as the sum of the encoded polarity differences Value
当所述输出码字完美平衡吋, 所述当前码流的运行极性差异值保持不 变.  When the output codeword is perfectly balanced, the running polarity difference value of the current code stream remains unchanged.
当所述输出码字的不平衡吋:  When the output codeword is unbalanced:
若所述编码后的极性差异总和值小于 0,则所述当前码流的运行极性差 异值为负;  If the sum of the polarity differences after the encoding is less than 0, the running polarity difference of the current code stream is negative;
若所述编码后的极性差异总和值大于 0,则所述当前码流的运行极性差 异值为正;  If the sum of the polarity differences after the encoding is greater than 0, the running polarity difference of the current code stream is positive;
若所述编码后的极性差异总和值等于 0,且原码流的运行极性差异值为 正, 则所述当前码流的运行极性差异值为负;  If the sum of the polarity differences after the encoding is equal to 0, and the running polarity difference value of the original code stream is positive, the running polarity difference value of the current code stream is negative;
若所述编码后的极性差异总和值等于 0,且原码流的运行极性差异值为 负, 则所述当前码流的运行极性差异值为正。  If the sum of the polarity differences after the encoding is equal to 0, and the running polarity difference value of the original code stream is negative, the running polarity difference value of the current code stream is positive.
[权利要求 6] 根据权利要求 1所述基于 SerDes技术串行通信系统中的编解码方法, 其特征在于, 还包括译码步骤:  [Claim 6] The codec method in the serial communication system based on the SerDes technology according to claim 1, further comprising a decoding step:
对译码査找表中对应普通数据位置上的译码输出数据做处理; 对所述译码査找表中对应 K码位置上的译码输出数据做处理; 在上述生成的所述译码査找表中根据査找表的地址分别选择一个译码 输出数据; 将两个所述译码输出数据的低 9比特整合后输出。 Processing the decoded output data at the corresponding normal data position in the decoding lookup table; processing the decoded output data at the corresponding K code position in the decoding lookup table; and performing the decoding lookup table generated above Selecting a decoded output data according to the address of the lookup table; The lower 9 bits of the two decoded output data are integrated and output.
[权利要求 7] —种基于 SerDes技术串行通信系统中的编解码装置, 其特征在于, 包 括主编码器、 与所述主编码器相连的线路极性计算器、 与所述主编码 器相连的编码选择器; [Claim 7] A codec device in a serial communication system based on a SerDes technology, comprising: a main encoder, a line polarity calculator connected to the main encoder, and the main encoder Code selector
所述主编码器包括:  The primary encoder includes:
拆分单元, 用于将 18位的普通数据分为高 9位以及低 9位的两个原始数 据;  Split unit, which is used to divide 18-bit ordinary data into two original data of 9 bits and 9 bits;
初始地址定义单元, 用于将两个所述原始数据分别作为两个编码査找 表的初始地址 N;  An initial address defining unit, configured to use two pieces of the original data as initial addresses N of two code lookup tables;
输入地址计算单元, 用于将所述初始地址转化为 2*N+0和 2*N+1作为 所述编码査找表的输入地址;  An input address calculation unit, configured to convert the initial address into 2*N+0 and 2*N+1 as an input address of the code lookup table;
输出单元, 用于根据所述输入地址输出包含不平衡度信息的第一码字 与第二码字; 其中, 所述第一码字中 "1 "的个数大于或等于 "0"的个数 , 其不平衡度为正; 所述第二码字中 "0"的个数大于或等于" 的个数 , 其不平衡度为负;  An output unit, configured to output, according to the input address, a first codeword and a second codeword including unbalance information; wherein, the number of "1"s in the first codeword is greater than or equal to "0" a number whose imbalance is positive; wherein the number of "0" in the second codeword is greater than or equal to the number of "unbalances";
所述线路极性计算器用于根据当前码流的运行极性差异值输出选择指 示信号;  The line polarity calculator is configured to output a selection indication signal according to a running polarity difference value of the current code stream;
所述编码选择器用于根据所述选择指示信号在每个所述査找表输出的 第一码字与第二码字中选择一个码字组成下一输出码字。  The code selector is configured to select one codeword among the first codeword and the second codeword outputted by each of the lookup tables according to the selection indication signal to form a next output codeword.
[权利要求 8] 根据权利要求 7所述基于 SerDes技术串行通信系统中的编解码装置, 其特征在于, 还包括 K码编码器, 与所述线路极性计算器相连: 所述 线路极性计算器还用于输出极性选择信号;  [Claim 8] The codec device in the serial communication system based on the SerDes technology according to claim 7, further comprising a K code encoder connected to the line polarity calculator: the line polarity The calculator is also used to output a polarity selection signal;
所述 K码编码器包括:  The K code encoder includes:
定义单元, 用于定义 6个 K码, 每两个 K码为一组, 且每组 K码中的码 字互为补码;  a defining unit for defining six K codes, each of which is a group of K codes, and the code words in each group of K codes are complementary to each other;
接收单元, 用于接收输入的 K码指示信号和极性选择信号;  a receiving unit, configured to receive an input K code indication signal and a polarity selection signal;
K码编码输出单元, 用于通过 K码査找表输出由两个 10比特组成的 K 码编码。 The K code encoding output unit is configured to output a K code code composed of two 10 bits through a K code lookup table.
[权利要求 9] 根据权利要求 7所述基于 SerDes技术串行通信系统中的编解码装置, 其特征在于, 所述线路极性计算器包括: [Claim 9] The codec device in the serial communication system based on the SerDes technology according to claim 7, wherein the line polarity calculator comprises:
差异总和值计算单元, 用于将所述运行极性差异值与所述输出码字的 不平衡度的代数和作为编码后的极性差异总和值; 平衡判断单元, 用于判断所述输出码字是否完美平衡;  a difference sum value calculation unit, configured to use an algebraic sum of the unbalanced degree of the running polarity difference value and the output codeword as a sum of polarity differences after encoding; a balance determining unit, configured to determine the output code Whether the word is perfectly balanced;
运行极性差异值计算单元, 用于当所述输出码字完美平衡吋, 所述当 前码流的运行极性差异值保持不变;  a running polarity difference value calculating unit, configured to: when the output codeword is perfectly balanced, the running polarity difference value of the current code stream remains unchanged;
所述运行极性差异值计算单元还用于, 当所述输出码字的不平衡吋: 若所述编码后的极性差异总和值小于 0,则所述当前码流的运行极性差 异值为负; 若所述编码后的极性差异总和值大于 0,则所述当前码流的 运行极性差异值为正; 若所述编码后的极性差异总和值等于 0,且原码 流的运行极性差异值为正, 则所述当前码流的运行极性差异值为负; 若所述编码后的极性差异总和值等于 0,且原码流的运行极性差异值为 负, 则所述当前码流的运行极性差异值为正。  The running polarity difference value calculating unit is further configured to: when the output codeword is unbalanced: if the encoded polarity difference sum value is less than 0, the current code stream running polarity difference value If the sum of the polarity differences after the encoding is greater than 0, the running polarity difference value of the current code stream is positive; if the encoded polarity difference sum value is equal to 0, and the original code stream The running polarity difference value is positive, then the current polarity difference value of the current code stream is negative; if the encoded polarity difference sum value is equal to 0, and the original code stream running polarity difference value is negative Then, the running polarity difference value of the current code stream is positive.
[权利要求 10] 根据权利要求 7所述基于 SerDes技术串行通信系统中的编解码装置, 其特征在于, 还包括主译码器以及与所述主译码器相连的数据整合器 所述主译码器用于对译码査找表中对应普通数据位置上的译码输出数 据做处理; 在上述生成的译码査找表中根据査找表的地址分别选择一 个译码输出数据; [Claim 10] The codec device in the serial communication system based on the SerDes technology according to claim 7, further comprising a main decoder and a data integrator connected to the main decoder The decoder is configured to process the decoded output data in the corresponding common data position in the decoding lookup table; and select a decoded output data according to the address of the lookup table in the generated decoding lookup table;
所述数据整合器用于将两个所述译码输出数据的低 9比特整合后输出  The data integrator is configured to integrate the lower 9 bits of the two decoded output data and output
PCT/CN2017/085860 2016-11-04 2017-05-25 Encoding and decoding method and apparatus for serial communication system based on serdes technology WO2018082286A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610961572.5A CN106411322A (en) 2016-11-04 2016-11-04 Encoding and decoding method and device of serial communication system based on SerDes technology
CN201610961572.5 2016-11-04

Publications (1)

Publication Number Publication Date
WO2018082286A1 true WO2018082286A1 (en) 2018-05-11

Family

ID=58014509

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/085860 WO2018082286A1 (en) 2016-11-04 2017-05-25 Encoding and decoding method and apparatus for serial communication system based on serdes technology

Country Status (2)

Country Link
CN (1) CN106411322A (en)
WO (1) WO2018082286A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111490984A (en) * 2020-04-03 2020-08-04 上海宽创国际文化科技股份有限公司 Network data coding and encryption algorithm thereof

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106411322A (en) * 2016-11-04 2017-02-15 深圳国人通信股份有限公司 Encoding and decoding method and device of serial communication system based on SerDes technology
WO2018161273A1 (en) 2017-03-08 2018-09-13 Credo Technology Group Ltd. Ethernet link extension method and device
US10069660B1 (en) * 2017-04-13 2018-09-04 Credo Technology Group Limited Low power SerDes architecture and protocol
CN107579779B (en) * 2017-09-13 2019-11-26 中国电子科技集团公司第四十一研究所 A kind of coding circuit design method for optical fiber transmission
CN109905199B (en) * 2017-12-08 2021-07-09 中国科学院上海高等研究院 Serial communication data polarity recovery method for asymmetric K code encoding and decoding
CN110098837B (en) 2019-04-08 2020-11-06 深圳市华星光电技术有限公司 Data encoding method, decoding method, related device and storage medium
CN111294299B (en) * 2020-02-10 2022-10-18 南京理工大学 Serdes link transmission method based on K codes
CN111966627B (en) * 2020-08-13 2023-06-30 北京中航通用科技有限公司 8B/9B encoding and decoding method for serial bus
US11356302B1 (en) 2020-11-30 2022-06-07 Credo Technology Group Limited Equalizer training during link speed negotiation
CN115037287B (en) 2021-03-05 2023-07-28 默升科技集团有限公司 Spread spectrum clock converter
US11424968B1 (en) 2021-06-10 2022-08-23 Credo Technology Group Limited Retimer training during link speed negotiation and link training
CN116667858B (en) * 2023-08-01 2023-10-27 上海芯炽科技集团有限公司 Method for detecting MIPI APHY high-speed differential signals

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101764617A (en) * 2009-12-22 2010-06-30 清华大学 Encoding method of 9B/10B code
CN101777966A (en) * 2010-01-05 2010-07-14 中国矿业大学 Method for extending real-time data channel of gigabit Ethernet
CN101847997A (en) * 2010-04-26 2010-09-29 瑞斯康达科技发展股份有限公司 9B/10B coder-decoder and realization method thereof
CN106411322A (en) * 2016-11-04 2017-02-15 深圳国人通信股份有限公司 Encoding and decoding method and device of serial communication system based on SerDes technology

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6853320B2 (en) * 2001-01-16 2005-02-08 Victor Company Of Japan, Ltd. Modulation system
US6747580B1 (en) * 2003-06-12 2004-06-08 Silicon Image, Inc. Method and apparatus for encoding or decoding data in accordance with an NB/(N+1)B block code, and method for determining such a block code
JP4852963B2 (en) * 2005-10-14 2012-01-11 株式会社日立製作所 Transmission equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101764617A (en) * 2009-12-22 2010-06-30 清华大学 Encoding method of 9B/10B code
CN101777966A (en) * 2010-01-05 2010-07-14 中国矿业大学 Method for extending real-time data channel of gigabit Ethernet
CN101847997A (en) * 2010-04-26 2010-09-29 瑞斯康达科技发展股份有限公司 9B/10B coder-decoder and realization method thereof
CN106411322A (en) * 2016-11-04 2017-02-15 深圳国人通信股份有限公司 Encoding and decoding method and device of serial communication system based on SerDes technology

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111490984A (en) * 2020-04-03 2020-08-04 上海宽创国际文化科技股份有限公司 Network data coding and encryption algorithm thereof
CN111490984B (en) * 2020-04-03 2022-03-29 上海宽创国际文化科技股份有限公司 Network data coding and encryption algorithm thereof

Also Published As

Publication number Publication date
CN106411322A (en) 2017-02-15

Similar Documents

Publication Publication Date Title
WO2018082286A1 (en) Encoding and decoding method and apparatus for serial communication system based on serdes technology
US11431351B2 (en) Selection of data compression technique based on input characteristics
US20090106631A1 (en) Parallel cyclic code generation device and parallel cyclic code error detection device
WO2015027755A1 (en) Physical layer coding/decoding method and apparatus thereof
JPH02172327A (en) Coding, decoding and transmission method and coding and decoding device
JPH08213969A (en) Equipment and method for correcting error basing on transmission code breach and parity
WO2011003329A1 (en) 64b/66b coding and decoding device and method for realizing 64b/66b coding and decoding
US20100324913A1 (en) Method and System for Block Adaptive Fractional-Bit Per Sample Encoding
WO2021027487A1 (en) Encoding method and related device
EP3930221A1 (en) Data transmission method, apparatus and system
US5424732A (en) Transmission compatibility using custom compression method and hardware
KR100281738B1 (en) Encoding and decoding method of nibble inversion and block inversion code, code and decoder
Hossein et al. Weakly mutually uncorrelated codes
WO2011029247A1 (en) Encoding/decoding method and apparatus
CN1639982A (en) Multiplexing an additional bit stream with a primary bit stream
CN113949388B (en) Coder-decoder and coding-decoding method for serializer/deserializer system
WO2020077625A1 (en) Data processing method and apparatus
CN110740011B (en) Coding and decoding method and coder-decoder
KR101286019B1 (en) Turbo encoder apparatus
WO2010133033A1 (en) Line coding method and apparatus
JPS6325739B2 (en)
JPH0936823A (en) Parallel data transmitter using mbnb code
JPH0340986B2 (en)
WO2023040466A1 (en) Encoding method, decoding method, and related apparatus
JP3515526B2 (en) Coding method of control information in a communication system

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17866866

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17866866

Country of ref document: EP

Kind code of ref document: A1