Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
8b/10b encoding
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== IBM implementation == As the scheme name suggests, eight [[bit]]s of data are transmitted as a 10-bit entity called a ''symbol'', or ''character''. The low five bits of data are encoded into a 6-bit group (the 5b/6b portion) and the top three 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, 2<sup>10</sup>) symbols can be excluded to grant a run-length limit of 5 consecutive equal bits and to ensure the difference between the count of zeros and ones to be no more than two. Some of the 256 possible 8-bit words can be encoded in two different ways. Using these alternative encodings, the scheme is able to achieve 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. ===Encoding tables and byte encoding=== Note that in the following tables, for each input byte (represented as {{Code|HGF EDCBA}}), ''A'' denotes the [[least significant bit]] (LSB), and ''H'' the most significant (MSB). The output gains two extra bits, '''i''' and '''j'''. The bits are sent from LSB to MSB: a, b, c, d, e, '''i''', β―f, g, h, and '''j''';<!--Do NOT re-order; i,f,g,h,j is correct--> i.e., the 5b/6b code followed by the 3b/4b code. This ensures the uniqueness of the special bit sequence in the comma symbols. 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. The 5b/6b code is a [[paired disparity code]], and so is the 3b/4b code. Each 6- or 4-bit code word has either equal numbers of zeros and ones (a disparity of zero), or comes in a pair of forms, one with two more zeros than ones (four zeros and two ones, or three zeros and one one, respectively) and one with two less. When a 6- or 4-bit code is used that has a non-zero disparity (count of ones minus count of zeros; i.e., β2 or +2), the choice of positive or negative disparity encodings must be the one that toggles the running disparity. In other words, the non zero disparity codes alternate. ====Running disparity==== 8b/10b coding is DC-free, meaning that the long-term ratio of ones and zeros transmitted is exactly 50%. To achieve this, the difference between the number of ones transmitted and the number of zeros 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 needs only two states for the running disparity of +1 and β1. It starts at β1.<ref>{{cite web |title=Thoughts on Gigabit Ethernet Physical |date=1996-04-01 |url=https://grouper.ieee.org/groups/802/3/z/public/presentations/mar1996/JTtgep.txt|author=Thatcher, Jonathan|work=IBM|access-date=2008-08-17}}</ref> For each 5b/6b and 3b/4b code with an unequal number of ones and zeros, there are two bit patterns that can be used to transmit it: one with two more "1" bits, and one with all bits inverted and thus two more zeros. Depending on the current running disparity of the signal, the encoding engine selects which of the two possible six- or four-bit sequences to send for the given data. Obviously, if the six-bit or four-bit code has equal numbers of ones and zeros, there is no choice to make, as the disparity would be unchanged, with the exceptions of sub-blocks D.07 (00111) and D.x.3 (011). In either case the disparity is still unchanged, but if RD is positive when D.07 is encountered 000111 is used, and if it is negative 111000 is used. Likewise, if RD is positive when D.x.3 is encountered 0011 is used, and if it is negative 1100 is used. This is accurately reflected in the charts below, but is worth making additional mention of as these are the only two sub-blocks with equal numbers of 1s and 0s that each have two possible encodings. {| class="wikitable" style="text-align:center" |+ Rules for running disparity |- ! previous<br>RD !! Disparity of<br>code word !! Disparity<br>chosen !! next<br>RD |- | β1 || 0 || 0 || β1 |- | β1 || Β±2 || +2 || +1 |- | +1 || 0 || 0 || +1 |- | +1 || Β±2 || β2 || β1 |} ==== 5b/6b code (abcdei) ==== {| class="wikitable" style="text-align:center; border-width:0;" !colspan="2" | Input !! <small>RD = β1</small> !! <small>RD = +1</small> |rowspan="19" style="border-width:0; background:#FFFFFF;" | !colspan="2" | Input !! <small>RD = β1</small> !! <small>RD = +1</small> !style="border-width:0; background:#FFFFFF;" | |- ! Code !! {{Abbr|EDCBA|Bits of a 5 bits with MSB on the left and LSB on the right}}!! colspan="2" | a b c d e i !! Code !! EDCBA !!colspan="2"| a b c d e i || style="border-width:0; background:#FFFFFF;" | |- | D.00 || 00000 || 100111 || 011000 ||align="left"| D.16 || 10000|| 011011 || 100100 || style="border-width:0; background:#FFFFFF;" | |- | D.01 || 00001 || 011101 || 100010 ||align="left"| D.17 || 10001 ||colspan=2| 100011 || style="border-width:0; background:#FFFFFF;" | |- | D.02 || 00010 || 101101 || 010010 ||align="left"| D.18 || 10010 ||colspan=2| 010011 || style="border-width:0; background:#FFFFFF;" | |- | D.03 || 00011 ||colspan=2| 110001 ||align="left"| D.19 || 10011 ||colspan=2| 110010 || style="border-width:0; background:#FFFFFF;" | |- | D.04 || 00100 || 110101 || 001010 ||align="left"| D.20 || 10100 ||colspan=2| 001011 || style="border-width:0; background:#FFFFFF;" | |- | D.05 || 00101 ||colspan=2| 101001 ||align="left"| D.21 || 10101 ||colspan=2| 101010 || style="border-width:0; background:#FFFFFF;" | |- | D.06 || 00110 ||colspan=2| 011001 ||align="left"| D.22 || 10110 ||colspan=2| 011010 || style="border-width:0; background:#FFFFFF;" | |- | D.07 || 00111 || 111000 || 000111 ||align="left" style="background:#F4F4FC;" | D.23 β || 10111 || 111010 || 000101 || style="border-width:0; background:#FFFFFF;" align="left" | ''also used for the K.23.7 symbol'' |- | D.08 || 01000 || 111001 || 000110 ||align="left"| D.24 || 11000 || 110011 || 001100 || style="border-width:0; background:#FFFFFF;" | |- | D.09 || 01001 ||colspan=2| 100101 ||align="left"| D.25 || 11001 ||colspan=2| 100110 || style="border-width:0; background:#FFFFFF;" | |- | D.10 || 01010 ||colspan=2| 010101 ||align="left"| D.26 || 11010 ||colspan=2| 010110 || style="border-width:0; background:#FFFFFF;" | |- | D.11 || 01011 ||colspan=2| 110100 ||align="left" style="background:#F4F4FC;"| D.27 β || 11011 || 110110 || 001001 || style="border-width:0; background:#FFFFFF;" align="left"| ''also used for the K.27.7 symbol'' |- | D.12 || 01100 ||colspan=2| 001101 ||align="left"| D.28 || 11100 ||colspan=2| 001110 || style="border-width:0; background:#FFFFFF;" align="left"| |- | D.13 || 01101 ||colspan=2| 101100 ||align="left" style="background:#F4F4FC;"| D.29 β || 11101 || 101110 || 010001 || style="border-width:0; background:#FFFFFF;" align="left"| ''also used for the K.29.7 symbol'' |- | D.14 || 01110 ||colspan=2| 011100 ||align="left" style="background:#F4F4FC;"| D.30 β || 11110 || 011110 || 100001 || style="border-width:0; background:#FFFFFF;" align="left"| ''also used for the K.30.7 symbol'' |- | D.15 || 01111 || 010111 || 101000 ||align="left"| D.31 || 11111 || 101011 || 010100 || rowspan="1" style="border-width:0; background:#FFFFFF;" | |- | align="left" style="border-width:0; background:#FFFFFF;" colspan="2" | ''not used'' || style="border-width:0; background:#FFFFFF;" | '''1111'''00 || style="border-width:0; background:#FFFFFF;" | '''0000'''11 |align="left" style="background:#E8EAFF;" | K.28 β‘ || 11100 || 00'''1111''' || 11'''0000''' || style="border-width:0; background:#FFFFFF;" align="left" | exclusively used for K.28.x symbols |} β also used for the 5b/6b code of K.x.7 β‘ exclusively used for the 5b/6b code of K.28.y ==== 3b/4b code (fghj) ==== {| class="wikitable" style="text-align:center; border-width:0;" !colspan="2"| Input !! <small>RD = β1</small> !! <small>RD = +1</small> |rowspan="11" style="text-align:center; background:#FFFFFF; border-width:0;"| !colspan="2"| Input !! <small>RD = β1</small> !! <small>RD = +1</small> |- ! Code !! HGF !! colspan="2" | f g h j !! Code !! HGF !! colspan="2" | f g h j |- |align="left"| D.x.0 || 000 || 1011 || 0100 || align="left" style="background:#EEEEFF;" | K.x.0 || 000 || 1011 || 0100 |- |align="left"| D.x.1 || 001 ||colspan=2| 1001 ||align="left" style="background:#EEEEFF;" | K.x.1 β‘ || 001 || '''0'''110 || '''1'''001 |- |align="left"| D.x.2 || 010 ||colspan=2| 0101 ||align="left" style="background:#EEEEFF;" | K.x.2 || 010 || 1010 || 0101 |- |align="left"| D.x.3 || 011 || 1100 || 0011 || align="left" style="background:#EEEEFF;" | K.x.3 || 011 || 1100 || 0011 |- |align="left"| D.x.4 || 100 || 1101 || 0010 || align="left" style="background:#EEEEFF;" | K.x.4 || 100 || 1101 || 0010 |- |align="left"| D.x.5 || 101 ||colspan=2| 1010 ||align="left" style="background:#EEEEFF;" | K.x.5 β‘ || 101 || '''0'''101 || '''1'''010 |- |align="left"| D.x.6 || 110 ||colspan=2| 0110 ||align="left" style="background:#EEEEFF;" | K.x.6 || 110 || 1001 || 0110 |- |align="left"| D.x.P7 β || rowspan="2" | 111 || 1110 || 0001 || align="left" style="background:#EEEEFF;" | K.x.7 β‘ || 111 || '''0'''111 || '''1'''000 |- |align="left"| D.x.A7 β || 0111 || 1000 || colspan="4" style="background:#FFFFFF; border-width:0;" | |} β 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.<br>Sequences of exactly five identical bits are used in comma symbols for synchronization issues.<br> D.x.A7 is used only * when RD = β1: for ''x'' = 17, 18 and 20 and * when RD = +1: for ''x'' = 11, 13 and 14. With ''x'' = 23, ''x'' = 27, ''x'' = 29, and ''x'' = 30, the 3b/4b code portion used for control symbols K.x.7 is the same as that for D.x.A7.<br>Any other D.x.A7 code can't be used as it would result in chances for misaligned comma sequences. β‘ Only K.28.1, K.28.5, and K.28.7 generate comma symbols, that contain a bit sequence of five 0s or 1s.<br>The symbol has the format 11'''0000 0'''1xx or 00'''1111 1'''0xx. ====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: {| class="wikitable" style="text-align:center" |+ Control symbols |- ! colspan="4" | Input !! <small>RD = β1</small> !! <small>RD = +1</small> |- ! Symbol !! DEC !! HEX !! HGF EDCBA !! abcdei fghj !! abcdei fghj |- |align="left" style="background:#EEEEFF;" | K.28.0 || 28 || 1C || 000 11100 || 001111 0100 || 110000 1011 |- |align="left" style="background:#EEEEFF;" | K.28.1 β || 60 || 3C || 001 11100 || 00'''1111 1'''001 || 11'''0000 0'''110 |- |align="left" style="background:#EEEEFF;" | K.28.2 || 92 || 5C || 010 11100 || 001111 0101 || 110000 1010 |- |align="left" style="background:#EEEEFF;" | K.28.3 || 124 || 7C || 011 11100 || 001111 0011 || 110000 1100 |- |align="left" style="background:#EEEEFF;" | K.28.4 || 156 || 9C || 100 11100 || 001111 0010 || 110000 1101 |- |align="left" style="background:#EEEEFF;" | K.28.5 β || 188 || BC || 101 11100 || 00'''1111 1'''010 || 11'''0000 0'''101 |- |align="left" style="background:#EEEEFF;" | K.28.6 || 220 || DC || 110 11100 || 001111 0110 || 110000 1001 |- |align="left" style="background:#EEEEFF;" | K.28.7 β‘ || 252 || FC || 111 11100 || 00'''1111 1'''000 || 11'''0000 0'''111 |- |align="left" style="background:#EEEEFF;" | K.23.7 || 247 || F7 || 111 10111 || 111010 1000 || 000101 0111 |- |align="left" style="background:#EEEEFF;" | K.27.7 || 251 || FB || 111 11011 || 110110 1000 || 001001 0111 |- |align="left" style="background:#EEEEFF;" | K.29.7 || 253 || FD || 111 11101 || 101110 1000 || 010001 0111 |- |align="left" style="background:#EEEEFF;" | K.30.7 || 254 || FE || 111 11110 || 011110 1000 || 100001 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 00'''11111'''0 or 11'''00000'''1 cannot inadvertently appear 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. ====Example encoding of D31.1==== {| class="wikitable" style="text-align:center;" |+ D31.1 for both running disparity cases |- ! colspan="4" | Input !! <small>RD = β1</small> !! <small>RD = +1</small> |- ! Code !! DEC !! HEX !! HGF EDCBA !! abcdei fghj !! abcdei fghj |- | D31.1 || 63 || 3F || 001 11111 || 101011 1001 || 010100 1001 |}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)