The 12B/14B line code is designed to provide a DC balanced encoding scheme for transmitting 12-bit data words over high speed serial links.
Like 8B/10B, the code table is split into two parts. The 7 least significant bits are encoded using a 7B/8B encoding table, and the 5 most significant bits are encoding using a 5B/6B table.
Also like 8B/10B, a running disparity is output with each code, and fed back to the input for use in selecting the next code.
The 7/8 encoding is considered first, along with a running disparity count. The code is looked up in the 7B/8B table. Then it is optionally inverted if doing so would bring would bring the running disparity closer to 0. Some codes naturally have 0 disparity (4 ones and 4 zeros), and these are never inverted.
Then the 5/6 encoding is considered. The code is looked up in the code table, and then optionally inverted according to the following rules
There are 9 Control Codes (K-Codes) which are considered separately from the 7/8-5/6 encoding algorithm. If the dataKIn input is high, then the 14-bit output is selected from the table below.
The normal output (Out 14b) is selected when the input disparity is -2. Otherwise the inverted output is selected. Control codes may get inverted even if their encoded disparity is 0.
K.120.3, K.120.11 and K.120.19 are special COMMA codes that can be used to perform word alignment on encoded serial streams. These codes contain an internal run of 7 consecutive 1's (or 0's when inverted). Such a run will never be seen for any other combination of codes in the output stream.
If dataKIn is high and the input code is not in the table, then the output is indeterminant.
Name | In 12b | Out 14b | Out Disp | Notes |
---|---|---|---|---|
K.120.0 | 000001111000 | 00011011111000 | 0 | |
K.120.1 | 000011111000 | 01000111111000 | 0 | |
K.120.2 |
| 01001011111000 | 0 | |
K.120.3 | 000111111000 | 10001111111000 | +2 | COMMA |
K.120.4 | 001001111000 | 01010011111000 | 0 | |
K.120.7 | 001111111000 | 11100011111000 | +2 | |
K.120.8 | 010001111000 | 01100011111000 | 0 | |
K.120.11 | 010111111000 | 00101111111000 | +2 | COMMA |
K.120.16 | 100001111000 | 00100111111000 | 0 | |
K.120.19 | 100111111000 | 01001111111000 | +2 | COMMA |
K.120.23 | 101111111000 | 10100011111000 | 0 | |
K.120.24 | 110001111000 | 00110011111000 | 0 | |
K.120.27 | 110111111000 | 10010011111000 | 0 | |
K.120.29 | 111011111000 | 10001011111000 | 0 | |
K.120.30 | 111101111000 | 10000111111000 | 0 | |
K.120.31 | 111111111000 | 00101011111000 | 0 |
The SLAC Streaming Protocol (SSP) 12b/14b implementation uses K.120.11 for IDLE (and alignment), K.120.0 for Start-of-Frame (SOF) and K.120.1 for End-of-Frame (EOF).
Name | In 7b | Out 8b | Out Disparity | Alt 8b | Alt Disparity |
D.0 | 0000000 | 01011000 | -2 | 10100111 | 2 |
D.1 | 0000001 | 00011001 | -2 | 11100110 | 2 |
D.2 | 0000010 | 00011010 | -2 | 11100101 | 2 |
D.3 | 0000011 | 00100011 | -2 | 11011100 | 2 |
D.4 | 0000100 | 01100100 | -2 | 10011011 | 2 |
D.5 | 0000101 | 10000101 | -2 | 01111010 | 2 |
D.6 | 0000110 | 10000110 | -2 | 01111001 | 2 |
D.7 | 0000111 | 10000111 | 0 | #N/A | 0 |
D.8 | 0001000 | 01101000 | -2 | 10010111 | 2 |
D.9 | 0001001 | 10001001 | -2 | 01110110 | 2 |
D.10 | 0001010 | 01001010 | -2 | 10110101 | 2 |
D.11 | 0001011 | 10001011 | 0 | #N/A | 0 |
D.12 | 0001100 | 01001100 | -2 | 10110011 | 2 |
D.13 | 0001101 | 10001101 | 0 | #N/A | 0 |
D.14 | 0001110 | 10001110 | 0 | #N/A | 0 |
D.15 | 0001111 | 11000111 | 2 | 00111000 | -2 |
D.16 | 0010000 | 00010011 | -2 | 11101100 | 2 |
D.17 | 0010001 | 10010001 | -2 | 01101110 | 2 |
D.18 | 0010010 | 10010010 | -2 | 01101101 | 2 |
D.19 | 0010011 | 10010011 | 0 | #N/A | 0 |
D.20 | 0010100 | 10010100 | -2 | 01101011 | 2 |
D.21 | 0010101 | 10010101 | 0 | #N/A | 0 |
D.22 | 0010110 | 10010110 | 0 | #N/A | 0 |
D.23 | 0010111 | 00010111 | 0 | #N/A | 0 |
D.24 | 0011000 | 10011000 | -2 | 01100111 | 2 |
D.25 | 0011001 | 10011001 | 0 | #N/A | 0 |
D.26 | 0011010 | 10011010 | 0 | #N/A | 0 |
D.27 | 0011011 | 00011011 | 0 | #N/A | 0 |
D.28 | 0011100 | 10011100 | 0 | #N/A | 0 |
D.29 | 0011101 | 00011101 | 0 | #N/A | 0 |
D.30 | 0011110 | 00011110 | 0 | #N/A | 0 |
D.31 | 0011111 | 00011100 | -2 | 11100011 | 2 |
D.32 | 0100000 | 00100101 | -2 | 11011010 | 2 |
D.33 | 0100001 | 10100001 | -2 | 01011110 | 2 |
D.34 | 0100010 | 00100110 | -2 | 11011001 | 2 |
D.35 | 0100011 | 10100011 | 0 | #N/A | 0 |
D.36 | 0100100 | 10100100 | -2 | 01011011 | 2 |
D.37 | 0100101 | 10100101 | 0 | #N/A | 0 |
D.38 | 0100110 | 10100110 | 0 | #N/A | 0 |
D.39 | 0100111 | 00100111 | 0 | #N/A | 0 |
D.40 | 0101000 | 00101001 | -2 | 11010110 | 2 |
D.41 | 0101001 | 10101001 | 0 | #N/A | 0 |
D.42 | 0101010 | 10101010 | 0 | #N/A | 0 |
D.43 | 0101011 | 00101011 | 0 | #N/A | 0 |
D.44 | 0101100 | 10101100 | 0 | #N/A | 0 |
D.45 | 0101101 | 00101101 | 0 | #N/A | 0 |
D.46 | 0101110 | 00101110 | 0 | #N/A | 0 |
D.47 | 0101111 | 00101010 | -2 | 11010101 | 2 |
D.48 | 0110000 | 00110010 | -2 | 11001101 | 2 |
D.49 | 0110001 | 10110001 | 0 | #N/A | 0 |
D.50 | 0110010 | 10110010 | 0 | #N/A | 0 |
D.51 | 0110011 | 00110011 | 0 | #N/A | 0 |
D.52 | 0110100 | 10110100 | 0 | #N/A | 0 |
D.53 | 0110101 | 00110101 | 0 | #N/A | 0 |
D.54 | 0110110 | 00110110 | 0 | #N/A | 0 |
D.55 | 0110111 | 00110111 | 2 | 11001000 | -2 |
K.55 | 0110111 | 10110111 | 4 | 01001000 | -4 |
D.56 | 0111000 | 10111000 | 0 | #N/A | 0 |
D.57 | 0111001 | 00111001 | 0 | #N/A | 0 |
K.57 | 0111001 | 10111001 | 2 | 01000110 | -2 |
D.58 | 0111010 | 00111010 | 0 | #N/A | 0 |
D.59 | 0111011 | 00111011 | 2 | 11000100 | -2 |
D.60 | 0111100 | 00111100 | 0 | #N/A | 0 |
D.61 | 0111101 | 10111101 | 4 | 01000010 | -4 |
D.62 | 0111110 | 00110100 | -2 | 11001011 | 2 |
D.63 | 0111111 | 10111011 | 4 | 01000100 | -4 |
D.64 | 1000000 | 01010100 | -2 | 10101011 | 2 |
D.65 | 1000001 | 11000001 | -2 | 00111110 | 2 |
D.66 | 1000010 | 11000010 | -2 | 00111101 | 2 |
D.67 | 1000011 | 11000011 | 0 | #N/A | 0 |
D.68 | 1000100 | 01000001 | -4 | 10111110 | 4 |
D.69 | 1000101 | 11000101 | 0 | #N/A | 0 |
D.70 | 1000110 | 11000110 | 0 | #N/A | 0 |
D.71 | 1000111 | 01000111 | 0 | #N/A | 0 |
D.72 | 1001000 | 01001001 | -2 | 10110110 | 2 |
D.73 | 1001001 | 11001001 | 0 | #N/A | 0 |
D.74 | 1001010 | 11001010 | 0 | #N/A | 0 |
D.75 | 1001011 | 01001011 | 0 | #N/A | 0 |
D.76 | 1001100 | 11001100 | 0 | #N/A | 0 |
D.77 | 1001101 | 01001101 | 0 | #N/A | 0 |
D.78 | 1001110 | 01001110 | 0 | #N/A | 0 |
D.79 | 1001111 | 01000101 | -2 | 10111010 | 2 |
D.80 | 1010000 | 01000011 | -2 | 10111100 | 2 |
D.81 | 1010001 | 11010001 | 0 | #N/A | 0 |
D.82 | 1010010 | 11010010 | 0 | #N/A | 0 |
D.83 | 1010011 | 01010011 | 0 | #N/A | 0 |
D.84 | 1010100 | 11010100 | 0 | #N/A | 0 |
D.85 | 1010101 | 01010101 | 0 | #N/A | 0 |
D.86 | 1010110 | 01010110 | 0 | #N/A | 0 |
D.87 | 1010111 | 01010111 | 2 | 10101000 | -2 |
D.88 | 1011000 | 11011000 | 0 | #N/A | 0 |
D.89 | 1011001 | 01011001 | 0 | #N/A | 0 |
D.90 | 1011010 | 01011010 | 0 | #N/A | 0 |
D.91 | 1011011 | 11010011 | 2 | 00101100 | -2 |
D.92 | 1011100 | 01011100 | 0 | #N/A | 0 |
D.93 | 1011101 | 01011101 | 2 | 10100010 | -2 |
D.94 | 1011110 | 11001110 | 2 | 00110001 | -2 |
D.95 | 1011111 | 11011110 | 4 | 00100001 | -4 |
D.96 | 1100000 | 01100010 | -2 | 10011101 | 2 |
D.97 | 1100001 | 11100001 | 0 | #N/A | 0 |
D.98 | 1100010 | 11100010 | 0 | #N/A | 0 |
D.99 | 1100011 | 01100011 | 0 | #N/A | 0 |
D.100 | 1100100 | 11100100 | 0 | #N/A | 0 |
D.101 | 1100101 | 01100101 | 0 | #N/A | 0 |
D.102 | 1100110 | 01100110 | 0 | #N/A | 0 |
D.103 | 1100111 | 11100111 | 4 | 00011000 | -4 |
D.104 | 1101000 | 11101000 | 0 | #N/A | 0 |
D.105 | 1101001 | 01101001 | 0 | #N/A | 0 |
D.106 | 1101010 | 01101010 | 0 | #N/A | 0 |
D.107 | 1101011 | 11101011 | 4 | 00010100 | -4 |
D.108 | 1101100 | 01101100 | 0 | #N/A | 0 |
D.109 | 1101101 | 11101001 | 2 | 00010110 | -2 |
D.110 | 1101110 | 11101010 | 2 | 00010101 | -2 |
D.111 | 1101111 | 11101101 | 4 | 00010010 | -4 |
D.112 | 1110000 | 00100100 | -4 | 11011011 | 4 |
D.113 | 1110001 | 01110001 | 0 | #N/A | 0 |
D.114 | 1110010 | 01110010 | 0 | #N/A | 0 |
D.115 | 1110011 | 01010001 | -2 | 10101110 | 2 |
D.116 | 1110100 | 01110100 | 0 | #N/A | 0 |
D.117 | 1110101 | 01110101 | 2 | 10001010 | -2 |
D.118 | 1110110 | 01010010 | -2 | 10101101 | 2 |
D.119 | 1110111 | 01110111 | 4 | 10001000 | -4 |
K.120 | 1111000 | 11111000 | 2 | 00000111 | -2 |
D.120 | 1111000 | 01111000 | 0 | #N/A | 0 |
D.121 | 1111001 | 01100001 | -2 | 10011110 | 2 |
D.122 | 1111010 | 01111011 | 4 | 10000100 | -4 |
D.123 | 1111011 | 01110011 | 2 | 10001100 | -2 |
D.124 | 1111100 | 01111100 | 2 | 10000011 | -2 |
D.125 | 1111101 | 01111101 | 4 | 10000010 | -4 |
D.126 | 1111110 | 01111110 | 4 | 10000001 | -4 |
D.127 | 1111111 | 11101110 | 4 | 00010001 | -4 |
Name | In 5b | Out 6b | Out Disparity | Alt 6b | Alt Disparity |
D.x.0 | 00000 | 000110 | -2 | 111001 | 2 |
D.x.1 | 00001 | 010001 | -2 | 101110 | 2 |
D.x.2 | 00010 | 010010 | -2 | 101101 | 2 |
D.x.3 | 00011 | 100011 | 0 | NA | NA |
D.x.4 | 00100 | 010100 | -2 | 101011 | 2 |
D.x.5 | 00101 | 100101 | 0 | NA | NA |
D.x.6 | 00110 | 100110 | 0 | NA | NA |
D.x.7 | 00111 | 000111 | 0 | NA | NA |
D.x.8 | 01000 | 011000 | -2 | 100111 | 2 |
D.x.9 | 01001 | 101001 | 0 | NA | NA |
D.x.10 | 01010 | 101010 | 0 | NA | NA |
D.x.11 | 01011 | 001011 | 0 | NA | NA |
D.x.12 | 01100 | 101100 | 0 | NA | NA |
D.x.13 | 01101 | 001101 | 0 | NA | NA |
D.x.14 | 01110 | 001110 | 0 | NA | NA |
D.x.15 | 01111 | 000101 | -2 | 111010 | 2 |
K.x.28 | 11100 | 111100 | 2 | 000011 | -2 |
D.x.16 | 10000 | 110110 | 2 | 001001 | -2 |
D.x.17 | 10001 | 110001 | 0 | NA | NA |
D.x.18 | 10010 | 110010 | 0 | NA | NA |
D.x.19 | 10011 | 010011 | 0 | NA | NA |
D.x.20 | 10100 | 110100 | 0 | NA | NA |
D.x.21 | 10101 | 010101 | 0 | NA | NA |
D.x.22 | 10110 | 010110 | 0 | NA | NA |
D.x.23 | 10111 | 010111 | 2 | 101000 | -2 |
D.x.24 | 11000 | 001100 | -2 | 110011 | 2 |
D.x.25 | 11001 | 011001 | 0 | NA | NA |
D.x.26 | 11010 | 011010 | 0 | NA | NA |
D.x.27 | 11011 | 011011 | 2 | 100100 | -2 |
D.x.28 | 11100 | 011100 | 0 | NA | NA |
D.x.29 | 11101 | 011101 | 2 | 100010 | -2 |
D.x.30 | 11110 | 011110 | 2 | 100001 | -2 |
D.x.31 | 11111 | 110101 | 2 | 001010 | -2 |