METHOD AND APPARATUS FOR IMPLEMENTING A TYPE 8B6T ENCODER AND DECODER

Abstract: An apparatus and method for transmitting an 8-bit binary format data word as a 6-trit ternary code word includes an encoder (13), a decoder (178), and a code assignment that produce, for each 8-bit data word value, a unique 6-trit ternary code word that is particularly optimized for transmission over twisted-pair cable (35, 38, 40, 43). The logic circuitry (100, 220) of the invention is optimized to accomplish the translation using a small number of combinatorial logic gates. The present invention thus has advantages in size, speed, and performance over other possible means for encoding an 8-bit data word to a 6-trit code word.

Description: METHOD AND APPARATUS FOR IMPLEMENTING A TYPE 8B6T ENCODER AND DECODER BACKGROUND OF THE INVENTION The invention relates generally to electric signal and data processing and more particularly to a new and improved means for encoding a binary data word as a ternary code word and for decoding the ternary code word to recapture the binary data word for data transmission in a high speed network. The invention includes circuits for encoding and decoding the ternary code word and for maintaining DC balance in a series of transmitted ternary code words. Binary (two-level) to ternary (three-level) data conversion has long been recognized as being beneficial for placement of data on an electromagnetic channel. Such a channel may be a storage medium such as a disk dive or magnetic tape or may be a transmission medium, such as an electric transmission line (twisted-pair) . The three voltage levels (positive, negative, and zero, sometimes represented as the digits +,-, and 0) of ternary signals can provide a number of advantages over binary signals in data transmission and storage. One advantage is that ternary coding inherently carries more data per bit than binary data. For example, six binary bits can represent only 2 6 or 64 different values, whereas six ternary bits (or trits) can represent 3 6 or 729 different values. This increased data carrying capacity can be effectively used to increase the speed of data transmission and the density of data storage. The three levels of ternary data can also provide a way for eliminating the problem of an accumulated DC signal that can arise in binary data signals. A DC signal may arise in the transmission of a binary signal because the voltage on the signal line varies between a positive voltage level (such as +5) and 0 volts. During transmission of such a signal, the signal line will take on a overall positive charge, and this can increase sensitivity to signal distortion by noise or cross-talk interference. Ternary signals can eliminate this problem so long as the transmitted + and - voltage signals are in balance with each other. In order to effectively maintain DC balance, prior art ternary encoders include sometimes complex adder circuitry to keep a running total of the charge of transmitted ternary digits and have included an inverter circuit to invert selected transmitted ternary words when the accumulated DC voltage level diverges from zero. Some of these prior art encoders include additional information in the transmitted data to indicate when a word has been inverted. Ternary signals can also be designed to incorporate a guaranteed number of voltage transitions on the media during a specified period of time. These guaranteed voltage transitions can be used to maintain data self-clocking and error checking. Some prior art ternary encoder circuits include a "repeat code" or other means to ensure periodic voltage transitions by preventing transmission of long strings of identical digits. A number of binary-to-ternary encoders and decoders have been developed incorporating the above discussed principles, but thus far these circuits have been limited in the size of the binary word that is converted to a ternary code. Various methods and apparatus have been disclosed for translation of 2 binary bits to 1 ternary trit (2B1T) , 3 binary bits to 2 ternary trits (3B2T) , and 6 binary bits to 4 ternary trit (6B4T) . Each of these translation methods claims specific advantages based on the translation used and each is designed for a particular application. For example, U.S. Pat. No. 4,910,750, to Fisher, discloses a 3B2T code with a method for ensuring that no 2T code word is ever repeated during serial transmission. A claimed advantage of this invention is the facilitation of self-clocking by ensuring that a voltage transition occurs at least once during any two transmitted ternary words. The encoder uses a look-up table to accomplish the binary to ternary translation and a comparer with a memory to compare each to-be-transmitted word with the previously transmitted word and to substitute a "repeat" code whenever two words in sequence are identical. The use of the look-up table makes this invention impractical when applied to high speed network applications because the access time for look up table memories is too slow. U.S. Pat. No. 4,779,073, to Iketani, discloses a 3B2T encoder with a look-up table similar to Fisher but including, in a second embodiment, an accumulator circuit and an inverter. The accumulator circuit determines the running "algebraic weight" of the transmitted ternary signals. The algebraic weight is defined as the sum of the ternary digits in the code word, where the two trit ternary code word "+0" would have an algebraic weight of plus one (+1) and the ternary code word "—" would have an algebraic weight of minus two (-2) . The inverter is used to change the polarity of selected ternary words when the accumulated algebraic weight of transmitted words deviates from zero. The Iketani system uses a comparer to ensure that no 2T code word is ever repeated during serial transmission by replacing an even numbered pair of ternary symbols whenever two ternary code words in series are identical. DC balance is maintained through use of an inverter which inserts a "synchronous pattern" into the ternary data stream to let the decoder know when a code word has been inverted. One problem with the addition of the "synchronous pattern" into the ternary signal is that it reduces the overall speed of transmitted data and adds a data-dependent delay and circuit complexity to the Iketani system. U.S. Pat. No. 4,387,366 to Chow discloses a 4B3T code converter with a PROM look-up table that stores inversion ternary code words along with non-inverted code words to maintain DC balance. A counter circuit adds up the algebraic weight of transmitted code words and selects the inverted ternary codes from the PROM to maintain DC balance when the balance deviates from zero. A claimed advantage of this invention is the facilitation of self-clocking by ensuring that a voltage transition occurs at least once during any two transmitted ternary words. As in Iketani, the look-up table and DC balance means are particularly unsuited for use in a high-speed network due to the slow access time of available memories that can serve as look-up tables. Another encoder that uses a look-up table for binary to ternary translation is U.S. Pat. No. 4,092,595, to Weir, which discloses a 3B3T encoder. U.S. Pat. No. 3,611,141, to Waters, discloses a 4B3T data transmission terminal that includes a disparity (or algebraic weight) checker and an inverter to maintain a zero DC balance. The binary to ternary translation uses combinatorial logic to translate from binary to ternary and provides a means to ensure that the maximum accumulated algebraic weight is four and that the longest possible string of identical ternary digits in a transmitted data stream is six. According to the system, no attempt is made in the translation to find a translation that uses a small number of logic gates. For this reason and because of the complexity of the disparity checking and inversion circuitry, the Waters system would be ineffective when applied to larger binary to ternary code conversions. U.S. Pat. No. 4,244,052, to Hemsworth, provides a means for detecting misalignment of received words for a 6B4T translation system built according to the Waters system. Other systems that reference the Waters method for binary to ternary translation are U.S. Pat. No. 4,087,642 to Jessop (4B3T) , and U.S. Pat. No. 3,902,117 to Sheppard (4B3T) . U.S. Pat. No. 4,631,428 to Grimes discloses a system for communicating data between binary chips using a 3B2T code converter that employs combinatorial logic. This system is not concerned with DC balance or other transmission issues and does not include means for addressing those problems. The system first translates the 3B code word to a 6B ternary control word which is used to control the 2T ternary drivers. One specific application for binary to ternary translation that is not effectively addressed by the prior art systems is in high speed data transmission between computers in a network. On September 28, 1993, the Fast Ethernet Alliance, a non-sanctioned technical group of the IEEE, proposed a new standard (the 4T+ Media Specification) for data transmission over four twisted pairs using a modification of the ethernet network protocol and using an 8B6T binary to ternary translation. The proposal was made to the IEEE 802.3 High-Speed Study Group. The 4T+ Media Specification proposes to achieve transmission speeds of 100 megabits per second using available ethernet transmission technology. This represents a 10 fold increase in speed over standard ethernet transmissions. As discussed above, prior art binary to ternary encoders are not well suited to perform the binary to ternary code conversion needed in this system. What is needed is an 8B6T encoder and decoder and 8B to 6T code assignment that can utilize fast combinatorial logic, that efficiently preserves DC balance, that ensures frequent voltage transitions in a transmitted serial data stream and that is suited for high-speed processing and transmission in a computer network. SUMMARY OF THE INVENTION According to the present invention, an apparatus and method for transmitting an 8-bit binary format data word as a 6-trit ternary code word includes an encoder that produces, for each 8-bit data word value, an unique 6-trit ternary code word that is particularly optimized for transmission over twisted-pair cable. The 8-bit data word is first translated by binary logic circuitry into a 12-bit binary coded ternary (BCT) code word, which is easily translated into the 6-trit code word. The logic circuitry of the invention is optimized to accomplish the translation using a small number of combinatorial logic gates (less than 2000) . The present invention thus has advantages in size, speed and performance over other possible means for encoding an 8 bit data word to a 6 trit code word. The present invention maps 256 binary-based 8 bit groups into 256 of a possible 729 six trit ternary groups by using combinatorial logic that selects only code words that meet specific criteria that make the code words well suited for transmission. A technique and apparatus is included for ensuring that the accumulated DC balance of the data stream remains at zero. The available six trit code words are characterized in the present invention by two parameters. An algebraic weight (W) of each code word represents the sum of the digits in the six trit code word, with possible values ranging from -6 to +6. A parameter Z of each code word indicates the maximum number of leading or trailing zeros that are present in the code word. The present invention selects values for these parameters that result in very efficient translation from binary to ternary and result in the most effective data transmission. According to the invention, these parameters are selected and allowable 6T code words are determined as follows. Of the 729 possible 6T code words, it will be found that 18 have four or more leading or trailing zeros. If these words are eliminated, of the remaining 711 possible 6T code words, it will be found that 134 have an algebraic weight of 0 and 122 have an algebraic weight (W) of +1, making a total of 256 possible 6T code words with an algebraic weight of either 0 or +1 and having fewer than 4 leading or trailing zeros. Selecting only code words with an algebraic weight of either 0 or +1 immediately reduces the problem of DC balance in the transmitted ternary signal and, as will be seen below, allows for an easy apparatus for ensuring that the D.C. balance is exactly zero. Selecting only code words that have fewer than four leading or trailing zeros eliminates the need for circuitry to prevent the transmission of duplicate ternary words as is present in a number of the prior art references discussed above. This circuitry is not needed because each allowed 6T code word guarantees at least 2 voltage transitions for each six trits of code word transmitted, even if the same code word is repeated indefinitely. The guaranteed voltage transitions provided by the invention allow the transmitted code words to be reliably self clocking. The elimination of the need for compare and substitution circuitry to prevent duplicate code words from being transmitted is one advantage of this invention over prior art binary to ternary converters. In order to process the 6T code words in conventional binary logic circuits, the 6T code words are first represented within the encoder and decoder by a 12 bit, binary coded ternary (BCT) code word, where each trit of the 6T code word is encoded as two bits. This assignment and the assignment of 8B data words to 6T code words according to the invention is done so that the translation from an 8B data word to a 12B binary-coded-ternary (BCT) code word can be accomplished using a simple combinatorial logic scheme. An encoder/transmitter built according to the invention includes a register to receive an 8-bit data word, a combinatorial logic block for translating from the 8-bit data word to a 12-bit BCT code word with an inversion control circuit for inverting every second 12-bit BCT code word that represents a 6-trit ternary word with an algebraic weight of +1 in order to preserve DC balance, a data splitter, a plurality of parallel-in/serial-out shift registers for shifting out the 12-bit code word 2-bits at a time, and a plurality of pulse shapers that produce ternary pulses in response to the 2-bit outputs of the shift registers. In one specific embodiment of the invention, the pulse shapers produce a Nyquist pulse for pulse transmission. A decoder/receiver built according to the invention includes a plurality of pulse detectors that each produce a 2- bit output in response to ternary pulses detected on a transmission line, a plurality of shift registers for assembling the 2-bit outputs into received 12-bit BCT code words, a combinatorial logic circuit for translating from the 12-bit BCT code word to an 8-bit data word with an invertor circuit for inverting every 12-bit BCT code word that has an algebraic weight of -1, and a register for receiving the 8- bit data words. The invention will be understood more completely upon reference to the following detailed description in connection with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS Fig. 1 is a block diagram of a data encoding and transmission system that could effectively employ an 8B6T encoder according to the invention; Fig. 2 is a block diagram of an 8B6T encoder according to an embodiment of the invention; Figs. 3a, 3b, and 3c together are a table showing the correspondence between 8-bit data words, 12-bit binary coded ternary code words, and 6-trit ternary code words according to a specific embodiment of the invention; Figs. 4a and 4b show the logic relationships between each digit of an input 8-bit data word and each digit of an output 12-bit binary coded ternary code word according to an embodiment of the invention; Fig. 5 is a block diagram of a data decoding and receiving system that could effectively employ a 8B6T decoder according to an embodiment of the invention; Fig. 6 is a block diagram of a 8B6T decoder according to an embodiment of the invention; and Fig. 7 shows the logic relationships between each digit of an input 12-bit binary coded ternary code word and each digit of an output 8-bit data word according to an embodiment of the invention. DETAILED DESCRIPTION OF SPECIFIC EMBODIMENTS Fig. 1 shows one type of data transmission system in which the encoder of the present invention may be effectively employed. This transmission system was discussed in the Fast Ethernet Alliance's 4T+ Media Specification proposal discussed above. The system is designed to transmit data over a total of four twisted-pair transmission lines. It contains a Media Access Controller (MAC) 10, which is connected to the system bus (not shown) of a computer or other data processing unit. MAC 10 receives data from the system bus. In the Fast Ethernet Alliance proposal, the MAC is specified to output that data as 4-bit nibbles at a clock rate of 25 Mhz, giving an effective bit rate of 100 Mbps. The 4-bit nibbles from MAC 10 are received by an 8- bit register 11. Register 11 receives two nibbles and then makes the resulting 8-bit data word available to 8B6T encoder 13. The encoder encodes the 8-bit c -.a word and outputs a 12- bit binary coded ternary (BCT) code word, which represents a 6-trit ternary code word, to data splitter 15. Operation of data splitter 15 is controlled by state machine 14 which is connected to the MAC'S clock and which provides a simple sequential 3-bit select signal to data splitter 15 and encoder 13. The data splitter time de-multiplexes the 12-bit code words among three shift registers 16, 17, and 18 in a round robin fashion in response to the 3-bit select signal from state machine 14. These shift registers shift out 2-bits (representing one trit) of the code words every clock cycle to transmission pulse shapers 20, 23, and 25. The pulse shapers generate pulses in response to their inputs and these pulses are transmitted through filters 28, 30, and 33 onto twisted pairs 35, 38, and 40. The pulse shapers produce a ternary pulse for each two-bit input according to the code shown in Table 1. Collision detect and carrier detect in this system are accomplished over a forth twisted pair 43. While the system is transmitting, twisted pair 43 is monitored through filter 45 by carrier sense detector circuit 48. If a carrier is detected by circuit 48 while the transmitter is transmitting, circuit 48 sends a signal to MAC 10 alerting it to a collision and MAC 10 halts data transmission and processes the error. Fig. 2 shows encoder 13 in more detail. Once the eight bits of data are available from register 11, the data word is presented to combinatorial logic block 100. Logic block 100 converts the 8-bit data word into a 12-bit binary- coded-ternary (BCT) code word having the algebraic weight and zero properties discussed above. All utilized code words have a ternary algebraic weight of either 0 or +1 and all have fewer than 4 leading or trailing zeros. For any 8-bit data input shown in Figs. 3a, 3b, and 3c, combinatorial logic block 100 produces the 12-bit BCT output as shown in those figures. Each 12-bit binary code word is representative of a 6-trit ternary code word also as shown in Figs. 3a, 3b, and 3c. In one embodiment of the invention, combinatorial logic block 100 implements the logic equations shown in Figs. 4a and 4b. Combinatorial logic block 100 also generates the binary signal Wl in response to the ternary algebraic weight of the BCT code word. Signal Wl is high when the 12-bit BCT code word represents a ternary code word with an algebraic weight of one and low when the 12-bit BCT code word represents a ternary code word with an algebraic weight of zero. As discussed above, the algebraic weight of a ternary code word is determined by adding together all the digits in the code word. For example, the ternary code word "0—i—-0", which according to the invention is mapped from binary data word "00000001", has an algebraic weight of zero. Block 100 may be constructed of discrete logic elements, may be a programmable logic array, or may be a custom integrated logic circuit. The logic equations as presented in Figs. 4a and 4b and the code assignment shown in Figs. 3a, 3b, and 3c have been selected to minimize the number of logic gates needed to construct block 100. According to the invention, combinatorial logic block 100 may be built with less than 2,000 logic gates. The invention maintains a zero DC balance on each twisted pair for the transmitted ternary signal by inverting every second ternary code word on each twisted pair that has an algebraic weight of +1. This inversion produces an inverted ternary code word with an algebraic weight of -1. For example, the ternary code word "--f00+0" with an algebraic weight of +1, when inverted produces the code word "+-00-0" with an algebraic weight of -1. With inversion of every other ternary code word with an algebraic weight of +1, if the algebraic weights of a series of nine ternary code words decoded by logic block 100 for one twisted pair were +1,0,0, 0,+l,+1,0,+1, 0, an encoder according to the invention would invert the second and fourth code words with an algebraic weight of +1 to produce nine ternary code words with algebraic weights +1,0,0,0,-1,+1,0,-1,0 thus achieving an overall zero DC balance. It will be noted that with the 2-bit to 1-trit code assignment of Table 1, inversion of the 6-trit code word may be accomplish by simply inverting each bit in the 12-bit BCT code word. Selective inversion on each of the three twisted pairs is accomplished as follows. The signal Wl generated by combinatorial logic block 100 is input to each of three selectable toggle register 120, 122, and 124 that essentially each act as 1-bit memories. The toggle registers operate such that their Q outputs will change from 0 to 1 or 1 to 0 (i.e. will "toggle") on an active clock edge whenever both their T inputs and their enable (EN) inputs are active. The enable inputs of the toggle registers are connected to one of the three outputs (Sl-3) of state machine 14 such that during any given word cycle just one of the toggle registers is enabled. The three toggle registers are each connected to one of the three input AND gates 130, 132, or 134. The AND gates combine the signal Wl, the toggle register output, and the select line for each of the twisted pairs to generate a signal that is active during every other data word cycle where a data word with weight +1 for a given twisted pair is input into block 100. OR gate 138 combines the outputs of the three AND gates to form the signal INV_CNTL which controls whether the code word output to the data splitter will be inverted. Once output by block 100, the 12-bit BCT code word is input to 12- bit XOR gate 140. XOR gate 140 performs an XOR function on each bit of the 12-bit code word with the one-bit signal INV_CNTL. As described above, the signal INV_CNTL is generated for each of the three twisted-pair lines based on the select signals generated by state machine 14. When signal INV_CNTL is high, XOR gate 140 operates so that its 12-bit output is the bit-by-bit inverse of its 12-bit input. When signal INV_CNTL is low, the 12-bit output of XOR gate 140 is the same as its input. After performing the selective inversion, XOR gate 140 outputs the 12-bit BCT code word to data splitter 15. While a specific configuration for the 1-bit memory function of the toggle registers is shown, it would be obvious to one skilled in the art that there are many other logic circuit configurations that could perform the same function. Figs. 3a, 3b, and 3c show the particular assignment of the 256 possible 8-bit binary data words to 256 6-trit ternary code words according to the invention. The code assignment according to the invention can best be understood as follows. As discussed above, the 729 available six trit code words are characterized in the present invention by two parameters. An algebraic weight (W) of each code word represents the sum of the digits in the six trit code word, with possible values ranging from -6 to +6. A parameter Z of each code word indicates the maximum number of leading or trailing zeros that are present in the code word. According to the present invention, ternary code words are selected so that the parameter W=0 or +1 and Z=3. Once the 256 allowable ternary code words have been selected, they must be assigned in a unique one to one relationship to the 256 possible 8-bit binary data words. This assignment is shown in Figs 3a, 3b, and 3c. The code assignment shown in Figs. 3a-c was constructed so that a translation between an 8-bit data word and a 12-bit BCT code can be accomplished by a combinatorial logic block such as 100 using the least number of logic gates. Figs. 4a and 4b show a symbolic representation of the logic relationships that determine the outputs of combinatorial logic block 100 based on the inputs. In one embodiment, combinatorial logic block 100 is constructed from logic gate elements so that its outputs follow its inputs as described by the equations shown in Figs. 4a and 4b. In the figures, the 8 binary bits that are input to encoder 13 are represented by the symbols B7-B0 with B7 being the most significant bit, and the 12 BCT bits that are output by block 100 are represented by the symbols T11-T0, with Til being the most significant bit. The symbols ml-7, pl-3, sl-10, tl-3, ul-2, vl-2, and "special" in Figs. 4a-b, all represent intermediate logic values that are used to generate T11-T0. Fig. 5 shows one type data receiver system in which the decoder of the present invention may be effectively employed. This receiver system was also discussed in the Fast Ethernet Alliance's 4T+ Media Specification proposal discussed above. The receiver receives serial ternary encoded data over a total of three twisted-pair transmission lines. Serial, DC balanced ternary data is received over the three twisted pair lines 43, 38, and 40. The signals are filtered by filters 150, 153, and 155 and are then input into pulse detectors 158, 160, 163. The pulse detectors detect whether there is a positive pulse, a negative pulse, or no pulse on their connected data transmission channel during a clock cycle and output a 2-bit binary code word for each of these pulses as shown in Table 1. The 2-bit output from the pulse detectors is collected by serial-in/parallel-out shift registers 165, 168, and 170. The shift registers reconstruct the 12-bit transmitted BCT code-words. A signal from one of the pulse detectors, 163, is provided to clock recovery circuit 173, which generates a 25 Mhz clock synchronized to the clock cycle of the recovered data. State machine 175 generates three sequential enable signals EN1, EN2, and EN3, based on the recovered clock which during each clock cycle enables just one of the three shift registers 165, 168, and 170 to output its data to 8B6T decoder 178. Once the 12-bit data has been decoded, it is placed in register 180 and is available for transmission to MAC 10. Fig. 6 is a block diagram of 8B6T decoder 178. The 12 BCT code words are first received by weight-check circuit 203 that determines the ternary algebraic weight of the BCT code word and for each code word with a weight of -1, circuit 203 asserts a signal W2 to XOR gate 205. When W2 is high, the 12-bit BCT output of XOR gate 205 is the bit-by-bit inverse of its 12-bit BCT input. The output of XOR gate 205 is then presented to logic block 208 which makes a determination as to which of the two possible 2-bit codes to use for trits that have a zero value. As can be seen from Table 1, when translating from 12BCT to 6T, both the 2-bit doublets 01 and 10 translate to a 0 trit. When the reverse translation is made, a determination must be made as to how 0 trit digits will be translated to a 2-bit binary doublet. According to the invention, this determination is made by examining each 6- bit half of the 12 BCT code word and determining what is the ternary algebraic weight of that half. Logic block 208 then converts the zero code doublets in the 6-bit half according to the assignment shown in Table 2. TABLE 2 Ternary Binary 00 01 If the half has negative algebraic weight 10 If the half has positive algebraic weight 11 Logic block 208 contains two identical logic circuits that have as their input one half of the 12-bit BCT code word. Each half of block 208 examines its input to determine if the combined algebraic weight of the three ternary digits represented by that code word is positive, negative, or zero. If the algebraic weight is positive, block 208 assigns the code "01" for any 0 trits on its input. If the algebraic weight is negative, block 208 assigns the code "10" for any 0 trits on its input. For the purposes of making this assignment, block 208 treats the zero algebraic weight halves -1 1 0, 0 -1 1, and 1 0 -1 as having negative algebraic weight and treats the halves 1 -1 0, 0 1 -1, -1 0 1, and 0 0 0 as having positive algebraic weight. While in this specific embodiment the decode functions of logic blocks 208 and 220 are shown as being carried out by two distinct circuit elements, it would be obvious to one of ordinary skill in the art that these logic blocks could be combined into a single logic circuit. The 12-bit BCT code word is then output by circuit 208 to 12BCT to 8B combinatorial logic block 220. Block 220 converts each 12-bit input to an 8-bit output in accordance with the table shown in Figs 3a-c and the 8-bit data words are output to register 180 where it is available to MAC 10. Fig. 7 shows a symbolic representation of the logic relationships that determine the outputs of combinatorial logic block 220 based on the inputs. In one embodiment, combinatorial logic block 220 is constructed from logic gate elements so that its outputs follow its inputs as described by the equations shown in Fig. 7. In Fig. 7, the 12 BCT bits that are input to block 220 are represented by the symbols T11-T0 with Til being the most significant bit, and the 8 binary bits that are output by circuit 220 are represented by the symbols B7-B0 with B7 being the most significant bit. The symbols al, ar, bl, br, cl, cr, dl, dr, el, er, fl, fr, lpO, rpO, InO, rnO, lpl, lnl, lp2, rp2, ln2, rn2, lOhat, xio, x8, x4, x2, and "special", all represent intermediate logic values that are used in the equations to generate B7-B0. While the above is a complete description of specific embodiments of the invention, various modifications, alternative constructions, and equivalents may be used. The code assignments shown in Figs. 3a-c could be modified, for example, without changing the essential nature of the invention, or the logical relationships shown in Figs 4a-b and Fig. 7 could be written in slightly different form but with equivalent results. Signals that are active low could be substituted for signals that are active high. Processing functions of particular circuit elements could be divided out into separate elements or circuit elements shown in specific embodiments as individual functional blocks could be combined, The specific method for assigning 2-bit codes as shown in Table 1 could be modified without changing the essential nature of the invention by, for example, using a 3-bit binary nibble to represent each trit in the ternary code word. Therefore, the above description should not be taken as limiting the scope of the invention as defined by the claims.

Claims: WHAT IS CLAIMED IS: 1. An encoder/transmitter for 8B-6T code conversion, comprising: means for receiving an 8-bit binary data word; combinatorial logic means capable of converting each possible 8-bit binary data word to an unique 12-bit binary- coded-ternary (BCT) code word, operatively connected to; a circuit for selecting an inverted code word for every other code word that has an algebraic weight of +1 in a series of code words, operatively connected to; means for separating said 12-bit code word into subparts operatively connected to; a signal generator for producing a serial ternary data stream in response to said subparts. 2. The encoder according to claim 1, wherein said unique 12-bit binary-coded-ternary (BCT) code word is representative of a 6-trit ternary code word and wherein each 6-trit ternary code word has an algebraic weight of either 0 or +1 and has no more than three leading or trailing zeros. 3. The encoder according to claim 1, wherein said combinatorial logic means is additionally capable of detecting when the algebraic weight of a 12-bit BCT code word is +1 and generating a signal when the algebraic weight of a 12-bit BCT code word is +1. 4. A decoder/receiver for 6T-8B code conversion, comprising: a ternary detector which produces a 2-bit binary signal in response to each digit in a serial ternary pulse data stream received on a channel operatively connected to; means for assembling a 12-bit binary-coded-ternary (BCT) code word for each six ternary trits received operatively connected to; an algebraic weight detecting circuit for detecting when the algebraic weight of a 12-bit BCT code word is -1 operatively connected to; a circuit for selecting an inverted code word for every code word that has an algebraic weight of -1, operatively connected to; a combinatorial logic means for converting each 12- bit binary-coded-ternary (BCT) code word to an 8-bit binary data word. 5. Apparatus for encoding eight bit binary data words into six trit ternary code words comprising: receiver means for receiving the binary data word; combinatorial logic encoder means coupled to the receiver means, for producing encoded data capable of being converted into ternary code words; said ternary code words having no more than a first preselected number of leading or trailing zeros; said ternary code words having an algebraic weight of zero or plus one. 6. Apparatus for decoding six trit ternary code words into eight bit binary data comprising: receiver means for receiving the 6 trit code words; ternary to binary conversion circuit for converting each trit of said 6 trit code words into a binary representation for assembling into a binary coded ternary word; said ternary code words having no more than a first preselected number of leading or trailing zeros; said ternary code words having an algebraic weight factor of zero or plus one; and combinatorial logic decoder means for converting the ternary code words into binary data words. 7. A method for encoding an eight bit binary data word into a six trit ternary code word, said method comprising the steps of: receiving the binary data word; and converting said binary data word to a binary coded ternary code word data word using combinatorial logic; said binary coded ternary code word being capable of being converted into ternary code words; said ternary code words having no more than a first preselected number of leading or trailing zeros; said ternary code words having an algebraic weight factor of zero or plus one. 8. A method for decoding a six trit ternar/ code word into an eight bit binary data word, said method comprising the steps of: receiving the ternary code word; producing a binary coded ternary code word capable of being converted into a binary data word; said binary coded ternary code word representing a ternary code word having no more than a first preselected number of leading or trailing zeros; said binary coded ternary code word representing a ternary code word having an algebraic weight factor of zero or plus one; and converting said binary coded ternary code word to a binary data word using combinatorial logic. 9. A system for transmitting binary data between a transmitter and a receiver comprising: means for receiving a sequence of 8-bit binary data words from a transmitter; combinatorial logic means for converting said 8-bit data words into binary coded ternary code words with an algebraic weight of 0 or 1; means for DC balancing a sequence of said code words by inverting every second code word that has an algebraic weight of 1 thereby producing an inverted code word with an algebraic weight of -1; means for converting subparts of said code word into a ternary pulse; a medium for transmitting said ternary pulses to said receiver; means at said receiver for detecting said ternary pulses and generating a binary representation for each detected pulse; means for assembling said binary representation codes into a received binary coded ternary code word; means for inverting each said received code word that has an algebraic weight of -1; and combinatorial logic means for converting each said received code word to a received 8-bit binary data word and making said received data word available to said receiver. 10. The apparatus according to claim 6 wherein said representation is two binary bits and wherein said binary coded ternary word is a 12-bit word. 11. The system according to claim 9 wherein said subparts are two binary bits and wherein said ternary code word is a 12-bit word. 12. The encoder according to claims 1, 2, and 3, the decoder according to claim 4, the apparatus according to claims 5 and 6, and the system according to claim 9, wherein said combinatorial logic is operative to convert between 8-bit binary data words and 6-trit ternary code words according to the following table: Binary Ternary 1 13. The apparatus according to claim 12 wherein 2 translation between each ternary trit and its binary 3 representation is according to the following table: 1 14. The encoder according to claims 1, 2, and 3, 2 the apparatus according to claims 5, and the system according 3 to claim 9, wherein said combinatorial logic for converting 4 each possible 8-bit binary data word having binary digits B7- 5 B0 to a unique 12-bit binary-coded-ternary (BCT) code word 6 having binary digits T11-T0 is constructed such that its 12 7 bit output is a function of its 8 bit input according to the 8 following logical relationships: 9 ml = B7 * B5 * !B4; 10 m2 = !B7 * !B6 * B5 * B4; 11 m3 = !B7 * !B6 * !B5 * !B4; 12 m4 = !B7 * B6 * !B5 * B4 * !B3; 13 m5 = B7 * !B6 * !B5 * B4; 14 m6 = B7 * B6 * !B5 * !B4; 15 m7 = B7 * B6 * !B5 *B4; 16 pi = B2 * (Bl + B0) ; 17 p2 = !B2 * (Bl + B0) ; 18 p3 = !B1 * !B0; SUBSTfTUTESHEET(RULE26) si = !B7 * !B6 * !B5 * !B4 * !B3; s2 = !B7 * !B6 * 1B5 * !B4 * B3; S3 = B7 * !B6 * !B5 * !B3; s4 = B7 * B6 * !B5 * !B3; s5 = !B7 * !B6 * B5 * B4 * !B3; S6 = 1B7 * !B6 * B5 * B4 * B3 ; s7 = !B7 * B6 * B5 * !B4 * B3; s8 = B7 * !B6 * B5 * B3; s9 = B7 * B6 * B5 * 1B3; sl0= B7 * B6 * B5 * B3 ; tl = (Bl * BO) + (B2 * !B1 * !B0); t2 = !B1 * BO; t3 = (!B2 * !B1 * !B0) + (Bl * !B0); ul = Bl + BO; U2 = B2 + (1B1 * !B0) ; vl = Bl + !B0; v2 = BO + (B2 * !B1) ; special = (!B7 * !B6 * !B5 * B4 * B3) + (!B7 * !B6 * B5 * 1B4 * !B3) + (!B7 * B6 * !B5 * B3) (1B7 * B6 * B5 * B4) ; T10 = ( ( (ul * !B4) + (!ul * B4)) * Ispecial) + (1B7 * !B6 * !B5 * B4 * B3 * ((!B2 * BO) + (B2 * !B0))) + (!B7 * 1B6 * B5 * !B4 * !B3 * ((!B2 * BO) + (B2 * !B0))) + (!B7 * B6 * !B5 * !B4 * B3 * ((!B1 * BO) + (Bl * !B0))) + (!B7 * B6 * !B5 * B4 * B3 * ((!B2 * Bl) + (B2 * !B1 * •BO))) + (!B7 * B6 B5 * B4 * B3 * ( (!B2 !B1) + (Bl * !B0) (B2 * Bl))); T8 = (((u2 * !B4) + (!u2 * B4)) * "special) + (!B7 * !B6 * !B5 * B4 * B3 * ((!B2 * !B0) + (B2 * BO))) + (!B7 * 1B6 * B5 * !B4 * !B3 * ((1B2 * !B0) + (B2 * BO))) + (!B7 * B6 * !B5 * !B4 * B3 * ((!B2 * BO) + (B2 * !B1))) + (!B7 * B6 * !B5 * B4 * B3 * ((!B1 * BO) + (B2 * Bl) ) ) + (!B7 * B6 * B5 * B4 * B3 * ! (B2 * Bl) ) ; T6 = (((!B4 * (!B10 + !B8)) + (B4 * !B10 * !B8)) * Ispecial) + (!B7 * !B6 * !B5 * B4 * B3 * ((!B2 * !B0) + (B2 * BO))) + (!B7 * !B6 * B5 * !B4 * !B3 * ((!B2 * !B0) + (B2 * BO))) + (!B7 * B6 * !B5 * !B4 * B3 * (Bl + (!B2 * !B0))) + (!B7 * B6 * !B5 * B4 * B3 * ( (B2 * BO) + (B2 * Bl) + (!B2 * !B1 * !B0))) + (!B7 * B6 * B5 * B4 * B3 * ! (B2 * Bl) ) ; T4 = (((vl * !B3) + (!vl * B3)) * 'special) + (!B7 * !B6 * !B5 * B4 * B3 * B2) + (!B7 * !B6 * B5 * !B4 * !B3 * ( (B2 * !B1) + (B2 * BO) + (!B1 * BO))) + (!B7 * B6 * !B5 * B4 * B3 * ((1B2 * !B1) + (Bl * !B0))) + (1B7 * B6 * B5 * B4 * !B3 * (!B1 + (!B2 * BO))) + (!B7 * B6 * B5 * B4 * B3 * ( (B2 * BO) + (!B2 * Bl) ) ) ; T2 = (((v2 * !B3) + (!v2 * B3)) * Ispecial) + (!B7 * !B6 * 1B5 * B4 * B3 * !B2) + (!B7 * !B6 71 * B5 * !B4 * !B3 * ! ( (B2 * !B1) + (B2 * BO) + 72 (!B1 * BO))) + (!B7 * B6 * !B5 * B4 * B3 * 73 1 (B2 * Bl * !B0)) + (!B7 * B6 * B5 * B4 * !B3 74 * ((!B2 * !B0) + (B2 * Bl * BO) + (!B1 * 75 IBO))) + (!B7 * B6 * B5 * B4 * B3 * ( (B2 * 76 IBO) + (1B2 * IB1 * BO) ) ) 77 TO = (((!B3 * (IB2 + 1B4)) + (B3 * 1B4 * IB2) ) * 78 "special) + (IB7 * IB6 * 1B5 * B4 * B3 * 1B2) 79 + (IB7 * IB6 * B5 * IB4 * IB3 * I ( (B2 * IB1) + 80 (B2 * BO) + (IB1 * BO))) + (IB7 * B6 * 1B5 * 81 B4 * B3 * I (B2 * Bl * IBO)) + (IB7 * B6 * B5 * 82 B4 * 1B3 * ( (B2 * Bl) + (IB2 * 1B1 * BO) + 83 (Bl * IBO))) + (IB7 * B6 * B5 * B4 * B3 * ( (B2 84 * IBO) + (IB1 * IBO) ) ) ; 85 Til = (B5 * I (ml * p3) * 1 (m2 * pi) * I ( IB7 * 1B6 86 * B5 * 1B4 * IB3 * ( (B2 * BO) + (IB2 * IBO))) 87 * I(1B7 * B6 * B5 * B4 * B3 * (B2 * IB1))) + 88 (m3 * pi) + (m4 * p3) + (m5 * p3) + (m6 * pi) 89 + (m7 * Ipl) + (IB7 * IB6 * IB5 * B4 * B3 * 90 ((IB2 * BO) + (B2 * IBO))) + (1B7 * B6 * IB5 * 91 IB4 * B3 * (IB1 + (IB2 * IBO))) + ( 1B7 * B6 * 92 IB5 * B4 * B3 * ( (B2 * Bl) + (B2 * IBO))); 93 T9 = (B5 * I (ml * p2) * I (m2 * p3) * 1 (IB7 * IB6 94 * B5 * 1B4 * IB3 * ((IB2 * Bl * BO) + (B2 * 95 1B1 *1B0))) * " (1B7 * B6 * B5 * B4 * B3 * B2)) 96 + (m3 * p3) + (m4 * p2) + (m5 * p2) + (m6 * 97 p3) + (m7 * Ip3) + (IB7 * IB6 * IB5 * B4 * B3 98 * !((!B2 * IB1 * BO) + (B2 * Bl * IBO))) + 99 (IB7 * B6 * IB5 * !B4 * B3 * ((IB1 * IBO) + 100 (Bl * BO) + (1B2 * BO))) + (IB7 * B6 * IB5 * 101 B4 * B3 * B2 * Bl) ; 102 T7 = (B5 * I (ml * pi) * I (m2 * p2) * !("B7 * 1B6 103 * B5 * 1B4 * 1B3 * ((1B2 * Bl * IBO) + (B2 * 104 IB1 * BO))) * 1 ("B7 * B6 * B5 * B4 * B3 * B2)) 105 + (m3 * p2) + (m4 * pi) + (m5 * pi) + (m6 * 106 p2) + (m7 * Ip2) + (1B7 * 1B6 * 1B5 * B4 * B3 107 * I((1B2 * "Bl * iBO)-t§t§G-L + (B2 * Bl * BO))) 108 + (IB7 * B6 * 1B5 * 1B4 * B3 * (Bl + (1B2 * 109 IBO))) + (1B7 * B6 * IB5 * B4 * B3 * B2 * Bl) ; 110 T5 = (!B5 * 1 (Si * Itl) * 1 (s2 * tl) * 1 (S3 * t2) 111 * I (s4 * t2) * I(IB7 * IB6 * IB5 * B4 * B3 * 112 IB2) * I (IB7 * B6 * IB5 * B4 * B3 * B2 * Bl * 113 BO)) + (S5 * tl) + (s6 * Itl) + (s7 * t2) + 114 (S8 * t2) + (s9 * tl) + (slO * itl) + (!B7 * 115 IB6 * B5 * 1B4 * "B3 * ((1B1 * BO) + (B2 * IB1) 116 + (B2 * BO))) + (IB7 * B6 * B5 * B4 * IB3 * 117 (IB1 + (1B2 * BO))) + (IB7 * B6 * B5 * B4 * B3 118 * B2 * BO) ; 119 T3 = (1B5 * 1 (si * It2) * I (s2 * t2) * 1 (s3 * t3) 120 * I (s4 * t3) * i(!B7 * IB6 * IB5 * B4 * B3 * 121 B2) * ! (!B7 * B6 * 1B5 * B4 * B3 * B2 * Bl) ) 122 + (S5 * t2) + (s6 * it2) + (S7 * t3) + (S8 * 123 t3) + (S9 * t2) + (S10 * lt2) + (IB7 * IB6 * 124 B5 * 1B4 * 1B3 * ((1B2 * Bl) + (B2 * 1B1))) + 125 (IB7 * B6 * B5 * B4 * 1B3 * (Bl + (1B2 * IBO))) 126 + (IB7 * B6 * B5 * B4 * B3 * B2); 127 Tl = (1B5 * I (si * It3) * I (s2 * t3) * I (S3 * tl) 128 * I (ε4 * tl) * 1(1B7 * 1B6 * IB5 * B4 * B3 * 129 1B2) * 1(1B7 * B6 * 1B5 * B4 * B3 * B2 * Bl) ) 130 + (s5 * t3) + (s6 * It3) + (s7 * tl) + (s8 * 131 tl) + (s9 * t3) + (S10 * lt3) + (IB7 * 1B6 * 132 B5 * IB4 * 1B3 * ((IB2 * Bl) + (B2 * IB1) ) ) + 133 (IB7 * B6 * B5 * B4 * IB3 * ((IB1 * BO) + (Bl 134 * IBO) j ! (IB2 * Bl))) + (IB7 * B6 * B5 * B4 * 135 B3 * B2) . 1 15. The decoder according to claim 4, the apparatus 2 according to claim 6, and the system according to claim 9, 3 wherein said combinatorial logic circuit for converting each 4 input 12-bit binary-coded-ternary data word having binary 5 digits T11-T0 to an output 8-bit binary data word having 6 binary digits B7-B0 is constructed such that its 8-bit output 7 is a function of its 12-bit input according to the following 8 logical relationships: 9 al = Til * T9 * T7; 10 ar = T5 * T3 * Tl; 11 bl = 1 11 * IT9 * IT7; 12 br = 1T5 * IT3 * IT1; 13 Cl = (T10 * IT8 * IT6) + (IT10 * T8 * 1T6) + (IT10 14 * IT8 * T6) ; 15 cr = (T4 * IT2 * ITO) + (IT4 * T2 * 1T0) + (1T4 * 16 IT2 * TO) ; 17 dl = (IT10 * T8 * T6) + (T10 * 1T8 * T6) + (T10 * 18 T8 * IT6) ; 19 dr = (1T4 * T2 * TO) + (T4 * IT2 * TO) + (T4 * T2 20 * ITO); 21 el = (ITU * T9 * T8 * T7) + (Til * IT9 * T7 * T6) 22 + (Til * T10 * T9 * IT7); 23 er = (1T5 * T3 * T2 * Tl) + (T5 * IT3 * Tl * TO) + 24 (T5 * T4 * T3 * IT1) ; 25 fl = ( Til * 1T9 * IT8 * 1T7) + (IT11 * T9 * IT7 * 26 1T6) + (ITU * 1T10 * IT9 * T7) ; 27 fr •= ( T5 * 1T3 * 1T2 * 1T1) + (1T5 * T3 * 1T1 * 28 !T0) + (1T5 * IT4 * IT3 * Tl) ; 29 lpO = (Til * T10 * IT9 * 1T8 * T7 * IT6) + (Til * 30 IT10 * T9 * T8 * IT7 * 1T6) + (ITU * 1T10 * T9* 31 IT8 * T7 * T6) ; 32 rpO = (T5 * T4 * 1T3 * 1T2 * Tl * ITO) + (T5 * 1T4 33 * T3 * T2 * IT1 * ITO) + (IT5 * 1T4 * T3 * IT2 * 34 Tl * TO) ; InO = (IT11 * IT10 * T9 * T8 * IT7 * T6) + (IT11 * T10 * 1T9 * 1T8 * T7 * T6) + (Til * T10 * IT9 * T8 * 1T7 * IT6) ; rnO = (IT5 * IT4 * T3 * T2 * IT1 * TO) + (1T5 * T4 * 1T3 * IT2 * Tl * TO) + (T5 * T4 * IT3 * T2 * IT1 * ITO) ; lpl = (al * cl) + el; rpl - (ar * cr) + er; lnl = (bl * dl) + fl; ml = (br * dr) + fr; lp2 = al * dl; B7 =((lpl + rpl) * I(10hat + rOhat) ) * ispecial; B6 =(((lpO + InO + lOhat) * rpl) + (lnl * rp2) + (ln2 * rp3) + ( (rpO + rnO + rOhat) * lpl) + (ml * lp2) + (rn2 * lp3)) * Ispecial + special * I (((rp0 + rnO) * ilOhat) + (lpl * ml) + ((InO + IpO) * rpl)) ; B5 =((lpO * Irpl) + lpl + lp2 + lp3) * 1 special + special * ( ( (T9+ T7) * rpl) + (lpl * ml) + lOhat + (lp2 * rn2) + (lnl * irp2) + lp3) ; B4 = (cl * ispecial) + special * !( ((InO + IpO) * rpl) + (lpl *rnl) + rOhat) ; B3 =(cr * ispecial) + special * !( ((InO + IpO) * rpl) + (lpl *rnl) + lOhat) ; B2 = (((xlO * x8) + (IxlO * x2)) * ispecial) + special * (rpO + (lOhat * mO)+ ((IpO + InO) * rpl * T5) + (IpO * rOhat) + (InO * rOhat) + (lp2 * 1(IT5 * T4)) + (rp2 * I(IT11 * T10) ) + (lnl * rpl)+ (lpl * ml * ((T6 * T5) + (!T6 * !T5)))); Bl = (((XlO * x4) + (ixlO * 1x4)) * ispecial) + special * ((lpl * mO)+ (rpO * 1 (T9 * T7))+ (rpl * ((1T6 * IT4) + (1T7 * IT6 * T5) + (1T11 * T9 * !T5)))+ (ml * ((T6 * T5) + (1T6 * IT5) + (Til * 1T10)))+ (rOhat * (T6 * I (Til * T9)))+ (ln2 * IT8 * 1T6)+ (rn2 * 1T2 * ITO)+ (lOhat * ( (T3 * Tl) + (1T5 * ITl)) )) ; BO = ( ( (XlO * x2 ) + ( 1 x10 * 1 x4 ) ) * i special) + special * ( (rnO * Til * 1 T5) + (rpO * ( I TU) ) + 84 (T5 * T4 * 1T3 * IT2 * 1T1 * ITO * 1 (Til * 85 IT10))+ (rpl * ((ITO * 1T7) + (T7 * !T5 * 1T9))) 86 + (rOhat * ((Til * T10 * T8) + (IT11 * IT10 * 87 T7))) + (ln2 * (IT4 + T8))+ (rp2 * T6) + (lp2 * 88 1T4) + (lOhat * (IT2 * T4))+ (rn2 * (T2 + 89 1T10))) . 1 16. The method according to claims 7 2 and 8 wherein converting between 8 bit binary data 3 words and 6-trit ternary code words produces 4 results in accordance with the following table: Binary Ternary 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 102 01100000 0 + + 0 - 0 103 01100001 + 0 + - 0 0 104 01100010 + 0 + 0 - 0 105 01100011 + 0 + 0 0 - 106 01100100 0 + + 0 0 - 107 01100101 + + 0 - 0 0 108 01100110 + + 0 0 - 0 109 01100111 + + 0 0 0 - 110 01101000 0 + + - + - 111 01101001 + 0 + + - - 112 01101010 + 0 + - + - 113 01101011 + 0 + - - + 114 01101100 0 + + - - + 115 01101101 + + 0 + - - 116 01101110 + + 0 - + - 117 01101111 + + 0 - - + 118 01110000 0 0 0 + + - 119 01110001 0 0 0 + - + 120 01110010 0 0 0 - + + 121 01110011 0 0 0 + 0 0 122 01110100 0 0 0 + 0 - 123 01110101 0 0 0 + - 0 124 01110110 0 0 0 - 0 + 125 01110111 0 0 0 - + 0 126 01111000 + + + - - 0 127 01111001 + + + - 0 - 128 01111010 + + + 0 - - 129 01111011 0 + + 0 - - 130 01111100 - 0 0 - + + 131 01111101 - 0 0 + 0 0 132 01111110 + - - - + + 133 01111111 + - - + 0 0 134 10000000 - 0 0 + - + 135 10000001 0 - 0 - + + 136 10000010 0 - 0 + - + 137 10000011 0 - 0 + + - 138 10000100 - 0 0 + + - 139 10000101 0 0 - - + + 140 10000110 0 0 - + - + 141 10000111 0 0 - + + - 142 10001000 - 0 0 0 + 0 143 10001001 0 - 0 + 0 0 144 10001010 0 - 0 0 + 0 145 10001011 0 - 0 0 0 + 146 10001100 - 0 0 0 0 + 147 10001101 0 0 - + 0 0 148 10001110 0 0 - 0 + 0 149 10001111 0 0 - 0 0 + 150 10010000 + - - + - + 151 10010001 - + - - + + 152 10010010 - + - + - + 153 10010011 - + - + + - 154 10010100 + - - + + - 155 10010101 - - + - + + 156 10010110 - - + + - + 157 10010111 - - + + + - 158 10011000 + - - 0 + 0 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261

Inventors: JOHNSON HOWARD W, PATEL SANDEEP, RIVERS J R, JOHNSON, HOWARD, W., PATEL, SANDEEP, RIVERS, J., R.
Applicants: 3COM CORP, 3COM CORPORATION
Application year: 1995
Main classification: H03M5
IPC codes: H03M5, H04L25