8B/10B编码 详解 (z)

Original address: http://en.wikipedia.org/wiki/8B10B


In  telecommunications8b/10b is a  line code that maps  8-bit  symbols to  10-bit symbols to achieve  DC-balance and bounded disparity, and yet provide enough state changes to allow reasonable  clock recovery. This means that the difference between the count of 1s and 0s in a string of  at least 20 bits is no more than 2, and that there are not more than five 1s or 0s in a row. This helps to reduce the demand for the lower bandwidth limit of the channel necessary to transfer the signal.

The code was described in 1983 by Al Widmer and Peter Franaszek in the IBM Journal of Research and Development.[1] IBM was issued a patent[2] for the scheme the following year.IBM's patent notwithstanding, the method, implementation and goals are very similar to Group Code Recording (GCR), used by IBM in its 3400 Series 6250 cpi 9-track tape drives introduced with its System/370 in 1970, by Apple in the floppy disk controller of its Apple II series introduced in 1978, and by Commodore in the floppy disk controller of theCommodore 2040 introduced in 1979.

8b/10b encoding is normally done entirely in link layer hardware. Because this encoding is 8-bit clean and transparent, upper layers of the software stack need not be aware that the link layer is using this code.

Contents

  [hide]

[edit]How it works

As the scheme name suggests, 8 bits of data are transmitted as a 10-bit entity called a symbol, or character. The low 5 bit of data are encoded into a 6-bit group (the 5b/6b portion) and the top 3 bits are encoded into a 4-bit group (the 3b/4b portion). These code groups are concatenated together to form the 10-bit symbol that is transmitted on the wire. The data symbols are often referred to as D.x.y where x ranges over 0–31 and y over 0–7. Standards using the 8b/10b encoding also define up to 12 special symbols(or control characters) that can be sent in place of a data symbol. They are often used to indicate start-of-frame, end-of-frame, link idle, skip and similar link-level conditions. At least one of them (i.e. a "comma" symbol) needs to be used to define the alignment of the 10 bit symbols. They are referred to as K.x.y and have different encodings from any of the D.x.y symbols.

Because 8b/10b encoding uses 10-bit symbols to encode 8-bit words, some of the possible 1024 (10 bit, 210) codes can be excluded to grant a run-length limit of 5 consecutive equal bits and grant that the difference of the count of 0s and 1s is no more than 2. Some of the 256 possible 8-bit words can be encoded in two different ways. Using these alternative encodings, the scheme is able to affect long-term DC-balance in the serial data stream. This permits the data stream to be transmitted through a channel with a high-pass characteristic, for example Ethernet's transformer-coupled unshielded twisted pair or optical receivers using automatic gain control.

[edit]Encoding tables

Note that in the following tables, for each input byte, with A being the least significant bit, and H the most significant. The output gains two extra bits, i and j. The bits are sent low to high: a, b, c, d, e, i, f, g, h, and j; i.e., the 5b/6b code followed by the 3b/4b code. This ensures the uniqueness of the special bit sequence in the comma codes.

The residual effect on the stream to the number of zero and one bits transmitted is maintained as the running disparity (RD) and the effect of slew is balanced by the choice of encoding for following symbols.

Each 6- or 4-bit code word has either equal numbers of 0s and 1s (a disparity of 0), or comes in a pair of forms, one with two more 1s than 0s (four 1s and two 0s, or three 1s and one 0, respectively) and one with two less. When a 6- or 4-bit code is used that has a non-zero disparity (count of 1s minus count of 0s; i.e., -2 or +2), the choice of positive or negative disparity encodings must be the one that toggles the running disparity. I.e., the non zero disparity codes alternate.

[edit]Running disparity

8b/10b coding is DC-free, meaning that the long-term ratio of 1s and 0s transmitted is exactly 50%. To achieve this, the difference between the number of 1s transmitted and the number of 0s transmitted is always limited to ±2, and at the end of each symbol, it is either +1 or -1. This difference is known as the running disparity (RD).

This scheme only needs two states for running disparity of +1 and -1. It starts at -1.[3]

For each 5b/6b and 3b/4b code with an unequal number of 1s and 0s, there are two bit patterns that can be used to transmit it: one with two more 1 bit and one with all bit inverted and thus two more 0s. Depending on the current running disparity of the signal, the encoding engine selects which of the two possible 6- or 4-bit sequences to send for the given data. (Obviously, if the 6- or 4-bit code has equal numbers of 1s and 0s, there is no choice to make, as the disparity would be unchanged.)

Rules for running disparity
Previous RDDisparity of code wordDisparity chosenNext RD
-1-0-0-1
-1±2+2+1
+1-0-0+1
+1±2-2-1
[edit]5b/6b
5b/6b code
InputRD = -1RD = +1InputRD = -1RD = +1
EDCBAabcdeiEDCBAabcdei
D.0000000100111011000D.1610000011011100100
D.0100001011101100010D.1710001100011
D.0200010101101010010D.1810010010011
D.0300011110001D.1910011110010
D.0400100110101001010D.2010100001011
D.0500101101001D.2110101101010
D.0600110011001D.2210110011010
D.0700111111000000111D.23 ?10111111010000101
D.0801000111001000110D.2411000110011001100
D.0901001100101D.2511001100110
D.1001010010101D.2611010010110
D.1101011110100D.27 ?11011110110001001
D.1201100001101D.2811100001110
D.1301101101100D.29 ?11101101110010001
D.1401110011100D.30 ?11110011110100001
D.1501111010111101000D.3111111101011010100
K.2811100001111110000

? Same code is used for K.x.7

[edit]3b/4b
3b/4b code
InputRD = -1RD = +1InputRD = -1RD = +1
HGFfghjHGFfghj
D.x.000010110100K.x.000010110100
D.x.10011001K.x.1 ??00101101001
D.x.20100101K.x.2 ??01010100101
D.x.301111000011K.x.301111000011
D.x.410011010010K.x.410011010010
D.x.51011010K.x.5 ??10101011010
D.x.61100110K.x.6 ??11010010110
D.x.P7 ?11111100001
D.x.A7 ?11101111000K.x.7 ? 11101111000

? For D.x.7, either the Primary (D.x.P7), or the Alternate (D.x.A7) encoding must be selected in order to avoid a run of five consecutive 0s or 1s when combined with the preceding 5b/6b code. Sequences of five identical bits are used in comma codes for synchronization issues. D.x.A7 is only used for x=17, x=18, and x=20 when RD=?1 and for x=11, x=13, and x=14 when RD=+1. With x=23, x=27, x=29, and x=30, the same code forms the control codes K.x.7. Any other x.A7 code can't be used as it would result in chances for misaligned comma sequences.

?? The alternate encoding for the K.x.y codes with disparity 0 allow for K.28.1, K.28.5, and K.28.7 to be "comma" codes that contain a bit sequence that can't be found elsewhere in the data stream.

[edit]Control symbols

The control symbols within 8b/10b are 10b symbols that are valid sequences of bits (no more than six 1s or 0s) but do not have a corresponding 8b data byte. They are used for low-level control functions. For instance, in Fibre Channel, K28.5 is used at the beginning of four-byte sequences (called "Ordered Sets") that perform functions such as Loop Arbitration, Fill Words, Link Resets, etc.

Resulting from the 5b/6b and 3b/4b tables the following 12 control symbols are allowed to be sent:

Control symbols
InputRD = -1RD = +1
DECHGF EDCBAabcdei fghjabcdei fghj
K.28.028000 11100001111 0100110000 1011
K.28.1 ?60001 11100001111 1001110000 0110
K.28.2 92010 11100001111 0101110000 1010
K.28.3 124011 11100001111 0011110000 1100
K.28.4 156100 11100001111 0010110000 1101
K.28.5 ?188101 11100001111 1010110000 0101
K.28.6 220110 11100001111 0110110000 1001
K.28.7 ??252111 11100001111 1000110000 0111
K.23.7 247111 10111111010 1000000101 0111
K.27.7 251111 11011110110 1000001001 0111
K.29.7 253111 11101101110 1000010001 0111
K.30.7 254111 11110011110 1000100001 0111

? Within the control symbols, K.28.1, K.28.5, and K.28.7 are "comma symbols". Comma symbols are used for synchronization (finding the alignment of the 8b/10b codes within a bit-stream). If K.28.7 is not used, the unique comma sequences 0011111 or 1100000 cannot be found at any bit position within any combination of normal codes.

?? If K.28.7 is allowed in the actual coding, a more complex definition of the synchronization pattern than suggested by ? needs to be used, as a combination of K.28.7 with several other codes forms a false misaligned comma symbol overlapping the two codes. A sequence of multiple K.28.7 codes is not allowable in any case, as this would result in undetectable misaligned comma symbols.

K.28.7 is the only comma symbol that cannot be the result of a single bit error in the data stream.

[edit]Example encoding of D31.1
D31.1 for both running disparity cases
InputRD = ?1RD = +1
HGFEDCBAabcdei fghjabcdei fghj
00111111101011 1001010100 1001

[edit]Technologies that use 8b/10b

After the above mentioned IBM patent expired, the scheme became even more popular and is the default DC-free line code for new standards.

Among the areas in which 8b/10b encoding finds application are

[edit]Digital audio

The encoding has found a heavy use in digital audio applications which use this modulation scheme:

A differing but related scheme is used for audio CDs and CD-ROMs:

[edit]Exceptions

For 10 Gigabit Ethernet's 10GBASE-R Physical Medium Dependent (PMD) interfaces, 64b/66b encoding is used. This scheme is considerably different in design to 8b/10b encoding, but was created with similar considerations of DC balance, maximum run length, transition density and electromagnetic emission minimization.

Note that 8b/10b is the encoding scheme, not a specific code. While many applications do use the same code, there exist some incompatible implementations; for example,Transition Minimized Differential Signaling, which also expands 8 bits to 10 bits, but it uses a completely different method to do so.

[edit]Notes

  1. ^ Al X. Widmer, Peter A. Franaszek (1983). "A DC-Balanced, Partitioned-Block, 8B/10B Transmission Code"IBM Journal of Research and Development 27 (5): 440.
  2. ^ Byte oriented DC balanced (0,4) 8B/10B partitioned block transmission code. Dec 4, 1984 (published 1984).
  3. ^ Thatcher, Jonathan (1996-04-01). "Thoughts on Gigabit Ethernet Physical"IBM. Retrieved 2008-08-17.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值