Subtracting method and device in or relating to signal processing technologies

Abstract: For subtracting two thermometer coded words each having a most significant byte (MSB) and a least significant byte (LSB), a check is made to see if a borrowing condition exists. A first borrowing condition exists if word B MSB is greater than word A MSB (12) and word A LSB is greater than word B LSB (14). In such a case a borrow (16) must take place on word B MSB. A second borrowing condition exists when word A MSB is greater than word B MSB (18) and word B LSB is greater than word A LSB (20). In this instance a borrow (22) must take place on word A MSB through a shift right function. After borrowing occurs, a subtraction process (24) takes place by exclusive-or'ing word A and B MSBs. The result is reconstructed (26) through a shift right process into proper thermometer code format. If a borrowing condition exists, an appropriate LSB is translated (28, 30) before an LSB subtraction process (32) takes the resulting word A and word B LSBs and exclusively-or's them together. The result is reconstructed (34) through a shift right rotate left process to place the LSB in proper thermometer code format. For addition, the first word is reversed (302) and added to the second word by an exclusive-or process. The result is inverted (306) and reconstructed (308) into proper thermometer code format. A carry (311) check is made and the reconstructed output is adjusted (310) whenever a carry condition exists. A further MSB adjustment (312) is made when the carry causes an overflow in the MSB result.

Description: TECHNICAL FIELD OF THE INVENTION This invention relates in general to signal processing technologies and more particularly to a method and device for adding and subtracting thermometer coded data. BACKGROUND OF THE INVENTION In certain applications, computation of maxima and minima is extensive. For such applications, it is desirable to represent a number in thermometer code since calculation of maxima or minima becomes a straightforward process. Thermometer coded data is used to indicate a specific value represented by the data. For example, the value of 5 in thermometer code is represented in binary form as 00011111 for an 8 bit data format. The more logic "1s" in the data in right justified order, the higher the value, and vice versa. One disadvantage of a straight thermometer code is the number of bits required to represent a number e.g. 64 bits to represent a value of 63. One solution around this problem is to represent each digit of a multidigit number in thermometer code. To represent a value of 63, a two digit octal number can be used, one for each digit of the value. If each octal number has 8 bits, then 16 bits of data rather than 64 bits will be needed to represent the value. Some computations will require arithmetic operations for maxima and minima processing. Conventional signal processing technology cannot simply and accurately perform arithmetic operations on thermometer coded words. Further, conventional technology cannot perform arithmetic operation or multi digit representation of thermometer coded data. It is thus desirable to have a circuit which can perform addition and subtraction of thermometer coded words to enhance signal processing of data representated in thermometer code. From the forgoing, it may be appreciated that a need has arisen for a method and device for processing thermometer coded data. A need has also arisen for a method and device which can perform arithmetic functions on thermometer coded data. A need has also arisen to perform arithmetic operations on multi digit representations of thermometer coded data. Further, a need has arisen for a method and device which can add and subtract two thermometer coded words. SUMMARY OF THE INVENTION In accordance with the present invention a method as defined in independent claim 12, and device as defined in independent claim 1 for subtracting thermometer coded data are provided which substantially eliminate or reduce disadvantages and problems associated with prior signal processing of thermometer coded data. Further embodiments of the invention are specified in the respective dependent claims. The present invention includes circuitry for determining whether a borrowing condition exists for a least significant byte of a thermometer coded word during an absolute value subtraction process. A borrowing condition exists if the most significant byte of word one is greater than the most significant byte of word two and the least significant byte of word two is greater than the least significant byte of word one, or vice versa. If no borrowing condition exists, the most significant bytes of the two words are subtracted form each other by an exclusive-or process and the result is reconstructed by shifting to the right the bit positions until the result is in proper thermometer code format. Similarly, the least significant bytes of the two words are subtracted from each other by an exclusive-or process to produce a result which is also shifted into proper thermometer code format. If a borrowing condition exists, the most significant byte of word one is shifted to the right once and the least significant byte of word two is translated in response to the borrowing condition before least significant byte subtraction occurs. The result of the subtraction is processed through a shift right, rotate left circuit to place the result, which becomes the resulting least significant byte of the absolute value subtraction function, into proper thermometer code format. For an addition process, the first thermometer coded word is reversed and then subtracted by an exclusive-or process from the second thermometer coded word. The result of the addition is inverted and reconstructed into proper thermometer code format. If a carry condition exists on the least significant byte, as determined by a carry circuit, the most significant byte of the resulting word is adjusted by the carry to produce the final most significant byte. If a carry condition exists on the most significant byte, a carry flag is set indicating that the most significant byte includes a carry condition. The present invention provides various technical advantages over thermometer code processing systems within the prior art. One technical advantage is in the ability to perform arithmetic functions on thermometer coded data. Another technical advantage is in providing addition and absolute value subtraction on thermometer coded data. Still another technical advantage is in the ability to perform separate arithmetic functions on the most significant bytes and the least significant bytes of desired thermometer coded words. Other technical advantages are readily apparent to one skilled in the art from the following figures, descriptions, and claims. BRIEF DESCRIPTION OF THE DRAWINGS For a more complete understanding of the present invention and the advantages thereof, reference is now made to the following description taken in conjunction with the accompanying drawings, wherein like reference numerals represent like parts in which: FIGURE 1 illustrates a block diagram of an absolute value subtraction circuit of the preferred embodiment; FIGURE 2 illustrates a simplified schematic diagram of a multiplexer implemented within the preferred absolute value subtraction circuit; FIGURE 3 illustrates a simplified schematic diagram of a most significant byte portion of the preferred absolute value subtraction circuit; FIGURE 4 illustrates a simplified schematic diagram of a reconstruction circuit for the most significant byte portion of the preferred absolute value subtraction circuit; FIGURE 5 illustrates a simplified schematic diagram of a binary parallel shifter for a reconstruction circuit of the preferred embodiment; FIGURE 6 illustrates a simplified schematic diagram of a least significant byte portion of the preferred absolute value subtraction circuit; FIGURE 7 illustrates a simplified schematic diagram of the least significant byte reconstruction circuit for the preferred absolute value subtraction circuit; FIGURE 8 illustrates a block diagram of an addition circuit of the preferred embodiment; FIGURE 9 illustrates a simplified schematic diagram of a portion of the preferred addition circuit; and FIGURE 10 illustrates a simplified schematic diagram of a carry circuit and a MSB adjust circuit for the preferred addition circuit. DETAILED DESCRIPTION OF THE INVENTION FIGURE 1 is a block diagram of an absolute value subtraction circuit 10 of the present invention. Absolute value subtraction circuit 10 includes a most significant byte (MSB) check block 12 and a least significant byte (LSB) check block 14 connecting to a word B borrow block 16. Absolute value subtraction circuit 10 also includes an MSB check block 18 and an LSB check block 20 connecting to a word A borrow block 22. A subtract block 24 connects to word B borrow block 16 and word A borrow block 22 and provides an output to an MSB reconstruct block 26 for generation of a resulting MSB at MSB out . Word B borrow block 16 provides a borrow signal B b to an LSB A translate block 28 and word A borrow block 22 provides a borrow signal B a to an LSB B translate block 30. An LSB subtract block 32 receives translated LSBs from LSB A translate block 28 and LSB B translate block 30, providing an output to an LSB reconstruct block 34 for generation of a resulting LSB at LSB out . In operation, check blocks 12 and 14 determine whether a first borrowing condition exists and check blocks 18 and 20 determine whether a second borrowing condition exists. For the first borrowing condition to exist, the MSB of word B must be greater than the MSB of word A and the LSB of word A must be greater than the LSB of word B. The second borrowing condition exists when the MSB of word A is greater than the MSB of word B and the LSB of word B is greater than the LSB of word A. If the first borrowing condition exists, word B borrow block 16 shifts each bit position of the MSB of word B once to the right, reducing the thermometer code value of the MSB of word B by 1. Word B borrow block 16 provides subtract block 24 with the new MSB of word B and indicates the occurrence of a borrow on signal B b . If the first borrowing condition does not exist, the MSB of word B passes through word B borrow block 16 to subtract block 24 without being shifted and borrow signal B b indicates that borrowing did not occur. Similarly, if the second borrowing condition exists, word A borrow block 22 shifts each bit position of the MSB of word A once to the right and provides the new MSB of word A to subtract circuit 24. Signal B a indicates the presence of the second borrowing condition. If the second borrowing condition does not exist, the MSB of word A passes through word A borrow block 22 to subtract block 24 without being shifted and signal B a indicates that the second borrowing condition does not occur. MSB subtract circuit 24 takes the modified or unmodified MSB for words A and B, depending on whether either borrowing condition occurs, and performs and exclusive-or function at each bit position of the two words. MSB reconstruct block 26 takes the result and performs a right shift of the bit positions in the result until the result is placed into proper thermometer code format. The output from MSB reconstruct block 26 is the most significant byte portion of the resulting word from the absolute value subtraction function. For the least significant byte, if borrow signal B b indicates that the first borrowing condition exists, LSB A translate block 28 takes the LSB of word A and subtracts the LSB of word A from the thermometer code base of the least significant byte to place the LSB of word A into proper form for LSB subtract block 32. If the first borrowing condition does not exist, the LSB of word A passes through LSB A translate block 28 to LSB subtract block 32 without any alteration. Similarly, if signal B a indicates the existence of the second borrowing condition, LSB B translate block 30 takes the LSB of word B and places the LSB of word B in proper form for LSB subtract block 32. If the second borrowing condition does not exist the LSB of word B passes through LSB B translate block 30 to LSB subtract block 32 without alteration. In principle, the word with the larger LSB is subtracted from the base for the least significant byte and added to the LSB of the other word to produce the resulting thermometer code LSB result as represented by the expression Base - B LSB + A LSB = Out LSB . In practice, LSB A translate block 28 and LSB translate block 30 perform this function by inverting their corresponding LSBs, shifting the inverted LSB once to the right, and providing the altered LSB to LSB subtract block 32 where it is exclusive-or'ed to the other LSB. LSB reconstruct block 32 takes the result of the exclusive-or function and performs a shift right rotate left process to produce the thermometer code LSB result. FIGURE 2 is a simplified schematic diagram of a multiplexer 40 used in absolute value subtraction circuit 10. Multiplexer 40 comprises an inverter 41 and n-channel transistors 42, 43, 44, and 45. Transistors 43 and 45 have inverting inputs. Transistors 43 and 44 have gates connected to a signal CTRL and transistors 42 and 45 have gates connected to inverter 41 to receive inverted signal CTRL. Transistors 42 and 43 have drains connected to an input signal INA at line X. Transistors 44 and 45 have drains connected to an input signal INB at line Y. The sources of each transistor connect to an output signal OUT. In operation a logic zero level on signal CTRL turns off transistors 44 and 45 and turns on transistors 42 and 43 allowing input signal INA on line X to appear on output signal OUT. Conversely, a logic one level on signal CTRL turns on transistors 44 and 45 and turns off transistors 42 and 43. allowing input signal INB or line Y to appear on output signal OUT. In this manner, multiplexer 40 selects which one of two input signals is to be transmitted of the multiplexer output signal. FIGURE 3 is a simplified schematic diagram of a portion of absolute value subtraction circuit 10. For purposes of illustration and discussion, each thermometer coded word comprises two 4 bit bytes, representing the most significant byte and least significant byte for each word. Each byte may consist of a greater or fewer number of bits as required for the desired application and each thermometer coded word may consist of a greater or fewer number of bytes. Check block 12 comprises n-channel transistors 50, 52, 54, and 56 with inverting inputs and having drains tied to supply voltage VCC through resistor 58 and gates tied to a separate bit position of the MSB of word A represented by signal UA4, UA3, UA2, and UA1, respectively. Check block 12 further comprises n-channel transistors 60, 62, 64, and 66 having sources tied to signal GND and gates tied to a separate bit position of the MSB of word B represented by signals UB4, UB3, UB2 and UB1, respectively. The sources of each p-channel transistor connect to the drains of each n-channel transistor to form a transistor pair for each corresponding bit position of the MSBs of words A and B. Similarly, check block 14 comprises n-channel transistors 68, 70, 72, and 74 with inverting inputs and having drains connected to supply voltage VCC through resistor 76 and gates connected to a separate bit position of the MSB of word B represented by signals LB4, LB3, LB2, and LB1, respectively. Check block 14 also comprises n-channel transistors 78, 80, 82, and 84 having sources connected to signal GND and gates connected to a separate bit position of the LSB of word A represented by signals LA4, LA3, LA2, and LA1, respectively. Check block 12 and 14 provide output signals to word B borrow block 16 at OR gate 86 that feeds the control lines of multiplexers 88, 90, 92, and 94. Multiplexers 88, 90, 92, and 94 receive a separate bit position of the MSB of word B represented by UB4, UB3, UB2, and UB1 respectively and provide outputs to MSB subtract block 24 at exclusive-or gate 96, 98, 100, and 102, respectively. MSB subtract block 24 provides outputs OU4, OU3, OU2 and OU1 from exclusive-or gate 96, 98, 100, and 102, respectively. Check block 18 is similarly constructed to check block 12 except that each bit position of the MSB of word B is tied to a gate of n-channel transistors 104, 106, 108, and 110 with inverting inputs, respectively, and each bit position of the MSB of word A is tied to a gate of n-channel transistors 112, 114, 116, and 118, respectively. Check block 20 is constructed similarly to check block 14 except that each bit position of the LSB of word A is tied to a gate of n-channel transistors 120, 122, 124, and 126 with inverting inputs respectively, and each bit position of the MSB of word B is tied to a gate of n-channel transistors 128, 130, 132, and 134, respectively. The outputs of check blocks 18 and 20 connect to word A borrow block 22 at OR gate 136 that feeds multiplexers 138, 140, 142, and 144. Multiplexers 138, 140, 142, and 144 receive a separate bit position of the MSB of word A represented by signals UA4, UA3, UA2, and UA1, respectively and generate output signals for MSB subtract block 24 at exclusive-or gates 96, 98, 100, and 102, respectively. In operation, check blocks 12 and 14 determine whether the first borrowing condition exists. For purposes of illustration, word A is 0111 0001 and word B is 0001 1111, to be placed in the absolute value expression of ½A - B½. For the first borrowing condition to exist, the outputs of both check blocks 12 and 14 that feed OR gate 86 of word B borrow block 16 must be at a logic zero level. To obtain a logic zero level, an n-channel transistor pair must both be turned on in producing a logic zero level at the output. For the example words given, no transistor pair within check block 12 conducts to generate a logic zero level and thus the output remains at the logic one level state. N-channel transistors 60, 62, and 64 remain off, since corresponding bit positions UB4, UB3, and UB2 of word B are at a logic zero level state. Though transistor 66 does turn on due to the high state of signal UB1, the high state at signal UA1 turns transistor 56 off to keep the transistor pair from conducting. Similarly, check block 14 generates a logic one level output because transistors 78, 80, and 82 remain off according to the bit positions of the least significant byte of word A represented by signals LA4, LA3, and LA2, respectively. Though transistor 84 turns on due to the high level state of signal LA1, transistor 74 remains off due to the high level state of LB1 of word B and thus no transistor pair is conducting and the output of check block 14 is at a logic one level state. With the outputs from check blocks 12 and 14 at the high level state, word B borrow block 16 passes the MSB of word B represented by signals UB4, UB3, UB2, and UB1 to MSB subtract block 24 without shifting the MSB of word B to the right. This is accomplished by signal B b from OR gate 86 being at the logic one level state and acting as the control line for multiplexers 88, 90, 92, and 94 to pass the MSB of word B over line Y of each multiplexer to MSB subtract block 24. Check blocks 18 and 22 determine whether the second borrowing condition exists. Check blocks 18 and 20 are pull down circuits similar to check blocks 12 and 14 except that the MSB of word B is tied to the n-channel transistors with inverting inputs of check block 18 and the LSB of word B is tied to the n-channel transistors of block 20, a situation reversed for check blocks 12 and 14. Check blocks 18 and 20 check to see if the MSB of word A is greater than the MSB of word B and the LSB of word B is greater than the LSB of word A, respectively. For the example words given, transistor pairs 110 and 118 are off due to the logic one level input from signal UB1. Transistor pair 108 and 116 are on, since signal UB2 is at a logic zero level and signal UA2 is at a logic one level. With transistor pair 108 and 116 conducting, the output signal is pulled down to ground, generating a logic zero level state on the output of check block 18. Similarly, check block 20 also generates a logic zero level state on its output through the conducting of transistor pair 124 and 132. A logic zero level on signal LA2 and a logic one level on signal LB2 cause transistors 124 and 132 to turn on, respectively, forcing output voltage from VCC to pull down to ground. The logic zero level outputs of check blocks 18 and 20 cause OR gate 136 of word A borrow block 22 to generate a logic zero level signal B a connected to the control lines of multiplexers 138, 140, 142, and 144. A logic zero level on signal B a forces multiplexers 138, 140, 142, and 144 to transfer inputs on their respective X lines to MSB subtract block 24. The MSB of word A represented by signals UA4, UA3, UA2, and UA1 are reduced by a value of one through a right shift by multiplexers 138, 140, 142, and 144. As will be subsequently shown, signal B a will be used to place the borrowed element within the least significant byte process circuitry. The MSB subtract function is performed in exclusive-or gates 96, 98, 100, and 102 within MSB subtract block 24. Each bit position of the MSB of word B from word B borrow block 16 is exclusively-or'ed with each corresponding bit position of the MSB of word A from word A borrow block 22 through OR gates 96, 98, 100, and 102 and the results are generated on output signals OU4, OU3, OU2, and OU1, respectively. These output signals are then sent to MSB reconstruct block 26. FIGURE 4 is a simplified schematic diagram of MSB reconstruct block 26. MSB reconstruct block 26 comprises multiplexers 150, 152, 154, and 156 that receive output signals from MSB subtract block 24 on signals OU4, OU3, OU2, and OU1, respectively. MSB reconstruct block 26 further comprises multiplexers 158, 160, 162, 164, 166, and 168 connected together as shown. In operation, MSB reconstruct block 26 performs a shift right function on output results OU4, OU3, OU2, and OU1 from exclusive-or gates 96, 98, 100, and 102 until a logic one level appears on the lower level bit position, indicating that the resulting MSB is in proper thermometer code format. Since proper thermometer code format occurs when the low order bit position is at a logic one level, successive values of signal OU1 connect to the control lines of each multiplexer for each shifting stage. Shifting occurs when signal OU1 and its successive values are at a logic zero level state and shifting ceases once a successive OU1 value reaches a logic one level. Though only one shifting stage is required for the example given, the remaining multiplexers insure that a proper thermometer code output on signals U04, U03, U02, and U01 occurs for each possible value of signals OU4, OU3, OU2, and OU1. MSB reconstruct block 26 generates the final MSB out signal over lines U04, U03, U02, and U01. For least significant bit processing,the borrow signals B b and B a are used to transform the LSB of words A and B into proper processing format. FIGURE 5 is a simplified schematic diagram of a binary parallel shifter 400 which may be used in place of the reconstruction circuit of FIGURE 4. Binary parallel shifter 400 comprises a first stage of multiplexers 402, 404, 406, and 408 connected to a second stage of multiplexers 410, 412, 414, and 416. Binary parallel shifter 400 places an input into proper thermometer code format by performing factor of 2 right shifting in response to logic levels on the factor of 2 bit positions of the input. The number of multiplexer stages is logarithmically proportional to the number of bit positions in the input. Thus, for the four bit input shown, 2 stages are required for complete shifting. For an 8 bit input, 3 stages of multiplexers are needed to shift the input into proper thermometer code format. The control lines for each multiplexer connect to factor of 2 bit positions of the input. In the first stage, the second bit position controls shifting of the input at multiplexers 402, 404, 406, and 408. If the second bit position is at a logic zero level, the first stage shifts the input two places to the right by introducing logic zeros into the high order bit positions, indicating that thermometer code values are in the high order bit positions of the input. In the second stage, the first bit position connects to the control lines of multiplexers 410, 412, 414, and 416. If the first bit position is at a logic zero level, the second stage shifts the first stage result one place to the right and generates an output in proper thermometer code format. For an 8 bit input, the fourth bit position controls the first stage, the second bit position controls the second stage, and the first bit position controls the third stage. FIGURE 6 is a simplified schematic diagram of the translation and subtraction functions performed on the LSBs of words A and B. LSB A translate block 28 comprises multiplexers 170, 172, 174, and 176 connected to LSB word A signals LA4, LA3, LA2, and LA1, respectively. Multiplexers 170, 172, 174, and 176 have control lines tied to signal B b and provide outputs to LSB subtract block 32. LSB B translate block 30 comprises multiplexers 178, 180, 182, and 184, receiving LSB word B signals LB4, LB3, LB2, and LB1, respectively. Multiplexers 178, 180, 182, and 184 have control lines tied to signal B a and provide outputs through LSB subtract block 32. LSB subtract block 32 comprises exclusive-or gates 186, 188, 190, and 192, generating output signals OL4, OL3, OL2, and OL1 for LSB reconstruct block 34. To subtract a larger LSB from a smaller LSB, the larger LSB is subtracted from the base of the LSB and then added to the smaller LSB to produce the resulting LSB output. To subtract the larger LSB from the base of the LSB and then add it to the smaller LSB in thermometer code, the larger LSB is inverted shifted to the right once by introducing a one in the high order bit position, exclusive-or'ed with the smaller LSB and the result reconstructed into proper thermometer code format. LSB A translate block 28 performs this function whenever the first borrowing condition exists as indicated by signal B b and LSB B translate block 30 performs this function whenever the second borrowing condition exists as indicated by signal B a . For the example given a logic one level on signal B b indicates that the first borrowing condition does not exist and thus no translation is required on the LSB of word A. Multiplexers 170, 172, 174, and 176 pass the LSB word A signals LA4, LA3, LA2 and LA1 on respective Y lines to LSB subtract block 32 without any translation. A logic zero level on signal B a indicates that the second borrowing condition exists, causing the LSB of word B to be translated with in the LSB B translate block 30 according to the process described above. A logic zero level on signal B a places the signals on the X lines of multiplexers 178, 180, 182, and 184 onto respective output lines. The LSB of word B is inverted through NOT gates 194, 196, and 198 and shifted to the right once by introducing a one from NOT gate 200. LSB A translate block 28 has similar NOT gates 201, 203, 205, and 207 for shifting and inverting when the first borrowing condition exists. LSB subtract block 32 receives the translated LSB of word B and the LSB of word A at exclusive-or gates 186, 188, 190, and 192 and generates output signals OL4, OL3, OL2, and OL1. Output signals OL4, OL3, OL2, and OL1 are sent to LSB reconstruct block 34 to be placed in proper thermometer code format. FIGURE 7 is a simplified schematic diagram of LSB reconstruct block 34. LSB reconstruct block 34 receives output signals OL4, OL3, OL2, and OL1 from LSB subtract block 32 at a first multiplexer stage comprising multiplexers 210, 212, 214, and 216 and NOT gate 218 and NAND gate 220. First multiplexer stage connects to a second multiplexer stage comprising multiplexers 222, 224, 226, and 228 and NOT gate 230 and NAND gate 232. The second multiplexer stage connects to a third multiplexer stage comprising multiplexers 234, 236, 238, and 240 and NOT gate 242 and NAND gate 244. The third multiplexer stage connects to a fourth multiplexer stage comprising multiplexers 246, 248, 250, and 252 and NOT gate 254 and NAND gate 256. The fourth multiplexer stage generates the LSB out signals L04, L03, L02, and L01. In operation LSB reconstruct block 34 performs a shift right rotate left function until the LSB is placed in proper thermometer code format. Each multiplexer stage performs a shift right rotate left function until proper thermometer code format is achieved as indicated by a logic one level on the low order bit and a logic zero level on the high order bit of the LSB. In the first multiplexer stage, NOT gate 218 and NAND gate 220 determine if the proper thermometer code condition exists. Since it does not for the illustrated example the LSB is shifted to the right and a low order bit is rotated around to the high order bit position. The input of line X for each of multiplexers 210, 212, 214, and 216 passes to the second multiplexer stage due to the logic zero level from NAND gate 220. At the second multiplexer stage, NOT gate 230 and NAND gate 232 determine if the proper thermometer code condition exists. Since it does not for the illustrated example the second multiplexer stage performs the shift right rotate left function by passing the input on line X for each of multiplexers 222, 224, 226, and 228 to the third stage due to the logic zero level from NAND gate 232. At the third stage NOT gate 242 and NAND gate 244 determine if the thermometer code condition exists. Since it still does not exist, the shift right rotate left function is performed by passing the input of line X for each of multiplexers 234, 236, 238, and 240 to the fourth multiplexer stage due to the logic zero level from NAND gate 244. At the fourth logic stage, NOT gate 254 and NAND gate 256 determine if the thermometer code condition exists. Since the thermometer code condition does now exist a logic one level from NAND gate 256 causes the input of line Y for each of multiplexers 246, 248, 250, and 252 to pass onto output signals L04, L03, L02, and L01 without further shifting or rotating. Signals L04, L03, L02, and L01 thus become the resulting LSB output. The four multiplexer stages insure that all possible configurations of signals OL4, OL3, OL2, and OL1 are placed in a proper thermometer code format. Even a configuration of 0000 (or 1111) on LSB subtract block 32 output lines OL4, OL3, OL2, and OL1, though never indicating a proper thermometer code condition in each multiplexer stage, will have an LSB output of 0000 (or 1111) at LSB output signals L04, L03, L02, and L01. FIGURE 8 is a block diagram of an addition circuit 300 for adding two thermometer coded words A and B together. Addition circuit 300 includes word B reverse block 302 connected to an addition block 304 each receiving word B and word A, respectively. Addition block 304 connects to and invert block 306 that provides signals to a reconstruct block 308. Reconstruct block 308 connects to an adjust block 310 that generates the resulting LSB at LSB out . A carry block 311 receives word A and reverse word B and generates carry signals carry M and carry L for adjust block 310 and invert block 306. An MSB adjust block 312 connects to adjust block 310 to place the MSB output from adjust block 310 into proper thermometer code format in response to signal carry L from carry block 311. To add two thermometer code words together the bit positions of the second word are reversed and then exclusive-or'ed with the first word. The reversed second word is compared to the first word to determine whether a carry condition occurs by monitoring for dual logic one levels at corresponding bit positions for each word and providing a carry signal in response to this match. The bit positions of the result are then inversed if a carry occurs and the result is reconstructed into proper thermometer code format. The reconstructed output is adjusted to compensate for the existence of a carry condition. The LSB output of adjust block 310 is the final LSB result of the addition process. The MSB result produced from adjust block 310 is increased by one through a shift left function within MSB adjust block 312 in response to a carry condition on the LSB to obtain the final MSB result of the addition process. MSB adjust block 312 also generates an MSB carry signal to flag a carry condition occuring in the MSB of the resulting thermometer coded word. FIGURE 9 is a simplified schematic diagram of the LSB portion of addition circuit 300. Addition block 304 comprises exclusive-or gates 320, 322, 324, and 326 having outputs tied to NOT gates 328, 330, 332, and 334, and multiplexers 329, 331, 333, and 335, respectively. The outputs of multiplexers 329, 331, 333, and 335 enter reconstruct block 308 which may be identical to the reconstruct block circuit found in FIGURE 7. Reconstruct block 308 provides outputs to adjust block 310 comprising multiplexers 336, 337, 338, and 339. For addition block 304, bit positions for word B are reversed such that signal B1 is exclusive-or'ed to signal A4, signal B2 is exclusive-or'ed to signal A3, signal B3 is exclusive-or'ed to signal A2, and signal B4 is exclusive-or'ed to signal A1. The result of the exclusive-or function is inverted if a carry exists or passes through to reconstruct block 308 from multiplexers 329, 331, 333, and 335 without an inversion if there is no carry. The final thermometer code least significant byte of the addition process is output by adjust block 310 over output lines 0 4 , 0 3 , 0 2 , and 0 1 . Though not shown, the MSB portion of addition circuit 300 generates output signals 0 8 , 0 7 , 0 6 , and 0 5 through signal carry M in the same manner as illustrated with the LSBs of words A and B. FIGURE 10 shows the remaining portion of addition circuit 300 comprising carry block 311 and MSB adjust block 312. Carry block 311 includes a pull down transistor circuit comprising n-channel transistors 340, 342, 344, and 346 coupled to LSB word A signals A4, A3, A2, and A1, respectively, and n-channel transistors 348, 350, 352, and 354 coupled to LSB word B signals B1, B2, B3, and B4, respectively. An output signal carry L is sent to MSB adjust block 312 comprising multiplexers 356, 358, 360, 362, 364, 366, 368, and 370, NOT gate 372, and NAND gate 373 connected as shown. MSB adjust block 312 receives MSB signals 0 8 , 0 7 , 0 6 , and 0 5 from adjust block 310. A similar transistor circuit comprising n-channel transistors 374, 376, 378, and 380 couple to MSB word A signals A8, A7, A6, and A5 respectively, and n-channel transistors 382, 384, 386, and 388 couple to LSB word B signals B5, B6, B7, and B8, respectively. An output signal carry M is sent to adjust block 310 and to OR gate 390 through inverter 392 to generate signal MSB carry . In operation, signal carry L will indicate the presence of a carry whenever the LSB of word A and the reversed LSB of word B have corresponding bit positions with a logic one level. For the example shown, signal A2 and signal B3 are at a logic one level that turn on transistors 344 and 352, respectively, causing the supply voltage VCC to pull down to ground, generating a logic zero level on signal carry L . Signal carry L is used to add one to the MSB of the resulting thermometer code word in the event a carry condition exists on the LSB. Multiplexers 356, 358, 360, and 362 cause the MSB on signals O 8 , O 7 , O 6 , and O 5 to shift to the left whenever carry L is at a logic zero level by introducing a logic one level into the low order bit position. Multiplexers 364, 366, 368, and 370 and NAND gate 373 ensure that the most significant byte is adjusted whenever carry L causes the MSB of the thermometer code word to enter into a carry condition. Whenever the high order bit 0 8 is at a logic one level and signal carry L is at a logic zero level, a carry occurs on the MSB and it is reset to logic zero level and signal MSB carry indicates the carry condition. The MSB pull down circuit operates as previously describe with reference to the LSB pull down circuit and generates a logic zero level on signal carry M . Signal MSB carry indicates whether a carry condition occurred on the MSB of the resulting thermometer code word either during MSB A and MSB B addition or through LSB carry. In summary addition and subtraction circuits perform arithmetic operations on two thermometer coded words. For subtraction, the two words are checked for the existence of borrowing conditions and MSBs and LSBs are adjusted accordingly. Subtraction is performed through exclusive-or functions and the results are reconstructed into proper thermometer code format. For addition, bit positions in the MSB and LSB for one word are reversed before performing exclusive-or functions with the second word. The result is inverted and reconstructed into thermometer code format. Carry conditions are checked and the result is adjusted to compensate for any carry. Thus, it is apparent that there has been provided in accordance with the present invention, a method and device for adding and subtracting thermometer coded data that satisfies the advantages set forth above. Although the preferred embodiment has been described in detail, it should be understood that various changes, substitutions, and alterations can be made herein. For example, though arithmetic functions have been performed on two byte thermometer coded words, the present invention can be extended to any number of multiple byte thermometer coded words, each having any number of bits. As another example, many of the logic functions within the described circuitry can be altered and signal levels reversed for other design techniques.

Claims: A device for subtracting two thermometer coded words which each of said coded words includes a plurality of bytes, each of said bytes being thermometer coded for representing a digit, comprising: circuitry (12, 14) for determining a presence of a first relationship between said words representative of a first borrowing condition; circuitry (18, 20) for determining a presence of a second relationship between said words representative of a second borrowing condition; circuitry (16) for decreasing a value of the most significant byte of the first word of said coded words in response to said presence of said first relationship; circuitry (22) for decreasing a value of the most significant byte of the second word of said coded words in response to said second relationship; circuitry (24) for subtracting the value of the most significant byte of the first word from the value of the most significant byte of the second word to obtain a first result; and circuitry (26) for reconstructing said first result into proper thermometer code format. The device of claim 1, further comprising: circuitry (28) for translating a first least significant byte corresponding to said first word in response to said second relationship; circuitry (30) for translating a second least significant byte corresponding to said second word in response to said first relationship; cicuitry (32) for subtracting one of said first least significant byte and said translated first least significant byte from one of said second least significant byte and said translated second least significant byte to obtain a second result; and circuitry (34) for reconstructing said second result into proper thermometer code format. The device of claim 1, wherein said first relationship determination circuitry (12, 14) comprises a first circuit (12) indicating that said first most significant byte is greater than said second most significant byte and a second circuit (14) indicating that a second least significant byte corresponding to said second word is greater than a first least significant byte corresponding to said first word. The device of claim 3, wherein said first circuit (12) comprises a plurality of n-channel transistors (60, 62, 64, 66) and n-channel transistors (50, 52, 54, 56) with inverting inputs, each n-channel transistor coupled to a separate bit position of said first most significant byte, each inverting input n-channel transistor coupled to a separate bit position of said second most significant byte, and wherein said second circuit (14) comprises a plurality of n-channel transistors (78, 80 ,82, 84) and n-channel transistors (68, 70, 72, 74) with inverting inputs, each n-channel transistor coupled to a separate bit position of said second least significant byte, each inverting input n-channel transistor coupled to a separate bit position of said first least significant byte. The device of claim 4, wherein said n-channel and said inverting input n-channel transistors form transistor pairs (50, 60; 52, 62; 54, 64; 56, 66; 68, 78; 70, 80; 72, 82; 71, 84) corresponding to identical bit positions of said first and second words, said first relationship occurring when at least one said transistor pair conducts. The device of claim 1, wherein said second relationship determination circuitry (18, 20) comprises a first circuit (18) indicating that said second most significant byte is greater than said first most significant byte and a second circuit (20) indicating that a first least significant byte corresponding to said first word is greater than a second least significant byte corresponding to said second word. The device of claim 1, wherein said most significant byte value subtracting circuitry (24) comprises a plurality of exclusive-or gates (96, 98, 100, 102) for performing an exclusive-or function on said first and second most significant bytes at each bit position. The device of claim 2, wherein said least significant byte subtracting circuitry (32) comprises exclusive-or gates (186, 188, 190, 192) for performing an exclusive-or function on said first and second least significant bytes at each corresponding bit position. The device of claim 1, wherein said first result reconstructing circuitry (26) comprises a plurality of multiplexers (150, 152, 154, 156, 158, 160, 162, 164, 166, 168) for right shifting said first result into code format. The device of claim 2 or claim 4, wherein said second result reconstructing circuitry (34) comprises a plurality of multiplexers (210, 212, 214, 216; 222, 224, 226, 228; 234, 236, 238, 240; 246, 248, 250, 252), inverters (218, 230, 242, 254), and NAND gates (220, 233, 244, 256) for shifting and rotating bit positions of said second result into code format. The device of claim 2 or 4, wherein said first and second translating circuitries (28, 30) each comprise respectively inverters (201, 203, 205, 207; 194, 196, 198, 200) and multiplexers (170, 172, 174, 176; 178, 180, 182, 184) for inverting and right shifting each bit position of said first and second least significant byte. A method of processing two thermometer coded words (A, B), each including a plurality of bytes, each of said bytes being thermometer coded for representing a digit, comprising: determining a presence of a first relationship representative of a first borrowing condition between a first said word (A) and a second said word (B); determining a presence of a second relationship representative of a second borrowing condition between said first and second words; decreasing a value of the most significant byte of the first word (A) in response to said first relationship; decreasing a value of the most significant byte of the second word (B) in response to said second relationship; subtracting the value of the most significant byte of the first word from the value of the most significant byte of the second word to obtain a first result; and reconstructing said first result into proper thermometer code format. The method of claim 12, further comprising the steps of: translating a first least significant byte corresponding to said first word in response to said second relationship; translating a second least significant byte corresponding to said second word in response to said first relationship; subtracting one of said first least significant byte and said translated first least significant byte from one of said second least significant byte and said translated second least significant byte to obtain a second result; and reconstructing said second result into proper thermometer code format. The method of claim 13, wherein said first relationship determining step includes generating a first borrow signal when said first most significant byte is greater than said second most significant byte and when a second least significant byte corresponding to said second word is greater than a first least significant byte corresponding to said first word. The method of claim 14, wherein said second relationship determining step includes generating a second borrow signal when said second most significant byte is greater than said first most significant byte and when a first least significant byte is greater than said first most significant byte and when a first least significant byte corresponding to said first word is greater than a second least significant byte corresponding to said second word. The method of claim 12, wherein, for an addition process, the first (A) of said two thermometer coded words is reversed and then subtracted by an exlusive-or process from the second (B) of said two thermometer coded words.

Inventors: MAHANT-SHETTI SHIVALING S, NG FUK HO P, MAHANT-SHETTI, SHIVALING S., NG, FUK HO P.
Applicants: TEXAS INSTRUMENTS INC, TEXAS INSTRUMENTS INCORPORATED
Application year: 1993
Main classification: G06F7
IPC codes: G06F7