Method and apparatus for testing a binary counter

Abstract: A multi-stage M-bit binary counter is disclosed including S counter stages in which each counter stage includes an N-bit counter (M=SxN). During a test operation, the stages are decoupled for individual operation, a count value is loaded into the N-bit counter provided in each of the stages, and the N-­ bit counters of each stage are clocked 2 N times to check independently the function of the N-bit counters. The stages are then coupled together to function as a multi-­ stage M-bit counter and a single clock pulse is supplied to the M-bit counter to check the carry propagation between stages. If the N-bit counters are of a type which only generate an output when fully incremented or decremented and the actually count value cannot be read frcm the M-bit counter, then the stages are decoupled together for a second time and the N-bit counters are clocked an additional 2 N times.

Description: The present invention is related to the field of binary counters. In particular, the present invention is directed to a method and apparatus for quickly and fully testing a multi-stage binary counter. Many applications of digital logic design require the use of relatively high resolution M-bit binary counters. In some cases, the high resolution M-bit binary counter is implemented by coupling several smaller resolution N-bit counters together in several stages, in which N is equal to M divided by the number of stages. For example, a sixteen-bit resolution binary counter can be implemented by coupling four four-bit binary counters together. In such a configuration, the carry output signal (COUT) from each counter is coupled to the carry input (CIN) of counter in the next stage. It is generally desirable to fully test the operation of the binary counter at some stage regardless of the particular application in which the binary counter is employed. Testing of an M-bit binary countdown counter can be performed, for example, by loading the counter with all logical ones, fully decrementing the counter 2 M times, and then checking to see if the output of the counter is zero. The above-described testing method, however, requires an unacceptable amount of time for many digital logic applications, as the counter must always be decremented 2 M times to fully test its operation. In the case of the multi-stage counter, the testing time can be reduced by decoupling the stages and testing each stage simultaneously. For example in the sixteen-bit counter mentioned above, the four four-bit counters can be tested simultaneously by decoupling the stages with a switching mechanism, decrementing each stage 2⁴ times, and checking the output signal from each stage. The problem with this testing approach is that decoupling the stages requires that the carry outputs and carry inputs be disconnected between stages to permit independent operation of the counters, which would prevent the carry propagation between the four counters from being tested. Thus, overall counter operation cannot be fully tested. In Patent Abstract of Japan, Vol. 10, No. 177, 21 June 1986 (JP-A-61025079) there is disclosed a method of testing a binary counter of the type having a ripple-through carry. In this method the individual stages of the counter are decoupled to permit individual operation of the counter in each stage, a count value is loaded into the counter of each stage, and each stage is clocked 2 N times where N is the number of bits in the counter stage. The present specification discloses a method and apparatus for quickly and fully testing an M-bit multi-stage binary counter, including the carry propagation between counter stages, as is claimed in claim 1 and claim 4, respectively. Further enhancements are provided by the subclaims. In particular, a multi-stage M-bit binary counter is disclosed including S counter stages in which each counter stage includes an N-bit counter (M=SxN). During a test operation, the stages are decoupled for individual operation, a count value is loaded into the N-bit counter provided in each of the stages, and the N-bit counters of each stage are clocked 2 N times to independently check the function of the N-bit counters. The stages are then coupled together to function as a multi-stage M-bit counter and a single clock pulse is supplied to the M-bit counter to check the carry propagation between stages. If the N-bit counters are of a type which only generate an output when fully incremented or decremented and the actually count value cannot be read from the M-bit counter, then the stages are decoupled for a second time and the N-bit counters are clocked an additional 2 N times. For example, in the case of a sixteen-bit multi-stage counter, the initial cycling of 2 N clock pulses tests the basic counting function of each four-bit counter provided in the four stages by counting down from FFFF hex to 0000. Coupling the four counters together to function as an sixteen-bit counter and then clocking the sixteen-bit counter one time will check the carry propagation between the stages counter by changing the count value in each four-bit counter 0000 to FFFF, or all F's for the sixteen-bit counter, if the carry function is working properly. The count value cannot be directly determined, however, if the four-bit counters are of a type that generate an output signal only when fully incremented or decremented. Thus, the four-bit counters must be clocked an additional 2 N times to count down from FFFF to 0000 in order to generate an output signal that can be checked for an indication of proper operation. With the above as background, reference should now be made to the following detailed description of two embodiments of the invention in conjunction with the drawings, in which: Fig. 1 illustrates a multi-stage M-bit counter according to a first embodiment of the invention, wherein the M-bit counter includes a plurality of N-bit counters that generate an output signal only when fully decremented or incremented; and Fig. 2 illustrates a multi-stage M-bit counter according to a second embodiment of the invention, wherein the M-bit counter includes a plurality of N-bit counters from which a count value can be directly read. Referring now to Fig. 1, a multi-stage sixteen-bit binary countdown counter 8 is shown having four four-bit counters 10-16, wherein each counter represents one stage, and three multiplexer couplers 18-22. Each of the four-bit counters 10-16 are coupled to a clock source 24, a control bus 26 and a sixteen bit data bus 28. The control bus 26 and data bus 28 are coupled to control circuitry 29 which controls the initial loading of the counters 10-16 as will be discussed in greater detail below. The multiplexer couplers 18-22 are connected to a test signal source 30 that generates a control signal TEST and is controlled by the processing unit 29. Alternatively, the processing unit 29 may generate the TEST signal directly. Each of the multiplexer 18-22 contain an upper transistor 32 and a lower transistor 34. It will be readily understood by those having ordinary skill in the art that the counter 8 can be implemented as a discrete device or can be integrated with the control circuitry 29, clock source 24 and test signal source 30 in a single device. The control circuitry 29 can be implemented in hardware as a state machine or can be a central processing unit of a microprocessor. Other variations are of course possible and the invention is not limited to the specific configuration shown in Fig. 1. In the embodiment illustrated, the four-bit counters 10-16 will not decrement unless CIN is at a high "1" logic level. Each of the counters 10-16 generates an output signal OUT that switches to a logic "1" when the counter has decremented to zero. The carry outputs (COUT) and carry inputs (CIN) of the four-bit counters 10-16 are connected to the multiplexers 18-22 such that when the test signal source 30 generates a low logic level signal (TEST=0), the lower transistors 34 of the multiplexers 18-22 are turned on and the COUT of each counter 10-16 is connected to the CIN of the counter in the next stage, so that the four-bit counters 10-16 are coupled together to function normally as a sixteen-bit counter. When the signal source 26 generates a high logic level signal (TEST=1), the lower transistors 34 are turned off and the upper transistors 32 of the multiplexer 18-22 are turned on to couple CIN of each of the counters 10-16 to an activation potential, which in this case is a logic high level, in order to permit each of the counters 10-16 to be operated independently. The operation of the counter 8 during the test phase will now be discussed in greater detail. As mentioned above, each of the counters 10-16 are coupled to a data bus 28 and a control bus 26. The control bus 26 has two control lines; set/reset input (SR) which resets the counters 10-16, and load count (LDCNT) which causes an initial count value provided on the data bus 28 to be loaded into the counters 10-16. At the beginning of a test cycle, the control circuitry 29 issues the LDCNT signal to load the counters 10-16 with all ones (FFFF) via the data bus 28 and activates the test signal source 30 to drive TEST high (TEST=1). When TEST goes high, the multiplexer 18-22 pull the CIN lines of each of the counters 10-16 high. The clock source 24 then generates 2⁴ clock signals causing the counters 10-16 to be decremented to zero and the OUT line of the counters 10-16 to be driven high if the counters have functioned properly. The OUT lines of the counters 10-16 are combined by a gate 36 that generates a CNTOUT signal for the counter 8 which is supplied to the control circuitry 29. After 2⁴ clock pulses, the control circuitry 29 checks to see if CNTOUT is high indicating that the counters 10-16 have properly counted down to zero. If CNTOUT is not high, the counter 8 has failed the test and the control circuitry 29 aborts the test mode. If CNOUT is high, the processing unit 29 controls the test signal source 30 to drive TEST low to turn off the upper transistors 32 and turn on the lower transistors 34 of the multiplexer couplers 18-22. The counter 8 is now configured to function as a sixteen-bit counter. The clock source 24 then generates a single clock pulse which causes the sixteen-bit counter to decrement to FFFF hex if the carry propagation between the counters 10-16 is working properly. As the count value in the counters 10-16 cannot be read directly, the counters 10-16 must be fully decremented a second time in order to generate an output signal which will indicate proper carry propagation. Thus, the control circuitry 29 controls the test signal source to drive TEST high, causing the sixteen-bit counter 8 to once more function as four independent four-bit counters, and the clock source 29 generates 2⁴ clock pulses, causing the counters 10-16 to decrement to zero once more , thereby driving the OUT line of each counters 10-16 high which in turn drives CNTOUT high if the counters 10-16 have functioned properly. The control circuitry 29 then checks the status of the CNTOUT to determine if the test has been successfully completed. The complete operation of the counter 8 including the carry function of each of the counters 10-16, can therefore be tested with only 2⁴+2⁴+1 or 2⁵+1 clock cycles. This is a significant reduction over the 2¹⁶ clock cycles required to count down the sixteen-bit multi-stage counter 8 as a whole to test the carry function of the stages. It will be understood that the above description is of a preferred exemplary embodiment of the present invention, and the invention is not limited to the specific form shown. For example, the embodiment illustrated is a count-down counter, but the present invention is equally applicable to a count-up counter. In such a case, the stages of the count-up counter would initially be loaded with 0000 and the stages would be independently counted up to FFFF. The stages would then be coupled together to function as a full sixteen-bit counter, and would then be incremented from FFFF to 0000. The stages would then be separated to work independently and would then be counted up to FFFF. Also the illustrated embodiment employed counters having a single output to indicate when the count-down had been completed. If counters are employed in which the actual value of the counter can be read, the second full cycling of the counters can be avoided. For example, Fig. 2 illustrates a sixteen-bit countdown counter 8′ in which the counter output can be directly read by the control circuitry 29′ via the data bus 28′ when a read count RDCNT signal is issued by the control circuitry 29′. In the embodiment illustrated in Fig. 2, the count-down counters 10′-16′ would be loaded with FFFF and then independently decremented to 0000. The counters 10′-16′would then be coupled together via the multiplexers 18′-22′ to function as a full sixteen-bit counter and decremented once to FFFF. The value of the counters 10′-16′ would then be read out by the control circuitry 29′ to determine if the counter 8′ was functioning properly. In such a case, the total number of clock cycles needed would be 2 N +1. Additional, variations and modifications can be effected within the scope of the appended claims.

Claims: A method of testing an M-bit binary counter (8), the M-bit counter (8) including a plurality of N-bit counter stages each having a carry input and a carry output, the method comprising decoupling the stages of the M-bit counter (8) to permit individual operation of the N-bit counter (10, 12, 14, 16) in each stage, loading a count value into the N-bit counter of each stage, and clocking the N-bit counter (10, 12, 14, 16) of each stage 2 N times, characterised in that the counter stages are decoupled from one another by applying a test signal in a first logic state to respective multiplexers (18, 20, 22) coupling the carry output and carry input of successive stages to one another, and the said stages are then coupled back together by applying the test signal in a second logic state to the said multiplexers (18, 20, 22) before clocking the M-bit counter (8) one time and checking the output of the counter (8). A method according to claim 1 wherein, after the said clocking of the M-bit counter one time, the stages of the M-bit counter (8) are again decoupled to permit individual operation of the N-bit counters (10, 12, 14, 16), and thereafter clocking each of the N-bit counters (10, 12, 14, 16) 2 N times prior to the said checking of the output of the counter (8). A method according to claim 1 or claim 2 wherein each multiplexer (18, 20, 22) comprises a pair of transistors (32, 34), and wherein the test signal in its first logic state turns on a first of the transistors (34) connected between the respective carry outputs and the succeeding carry inputs and turns off the second transistor (32) connected between the respective carry inputs and an activation potential, and the test signal in its second logic state turns off the first transistor (34) and turns on the second transistor (32). An M-bit binary counter (8) comprising: (a) a plurality of counter stages, each of said stages including an N-bit counter (10, 12, 14, 16) having a carry input and a carry output; (b) first means (30, 18, 20, 22) for decoupling the said stages of the M-bit counter (8) to permit individual operation of the N-bit counter (10, 12, 14, 16) in each stage; (c) second means (29, 26) for loading a count value into the N-bit counter (10, 12, 14, 16) in each stage; and (d) third means (29, 24) for clocking the N-bit counter (10, 12, 14, 16) in each stage 2 N times after the respective counter has been loaded with its count value; characterised by: (e) said first means (30, 18, 20, 22) further coupling the stages of the M-bit counter (8) together after the respective N-bit counters (10, 12, 14, 16) have been clocked 2 N times; (f) said third means (29, 24) further clocking the M-bit counter (8) one time after the said stages of the counter have been coupled together; and (g) fourth means (36) for checking the output of the M-bit counter (8), and wherein the first means (30, 18, 20, 22) comprises a test signal source (30) and respective multiplexers (18, 20, 22) coupled between the respective carry outputs and carry inputs of the successive N-bit counters and responsive to a test signal from the test signal source (30) whereby, with the test signal in a first logic state, the respective carry outputs are coupled to the respective carry inputs for normal operation of the M-bit counter (8), and, with the test signal in a second logic state, the carry outputs are decoupled from the respective carry inputs to permit independent operation of the N-bit counters (10, 12, 14, 16). A counter according to claim 4 wherein the stages of the M-bit counter (8) are again decoupled by the first means after the third means has clocked the M-bit counter (8) one time in step (f), and the third means (29, 24) is then operative to again clock the N-bit counters (10, 12, 14, 16) in each stage 2 N times before the fourth means (36) checks the output of the counter. An M-bit counter according to claim 4 or claim 5 wherein each multiplexer (18, 20, 22) comprises a pair of transistors (32, 34), and wherein a first of the transistors (34) is connected between the respective carry outputs and the succeeding carry inputs, and the second transistor (32) is connected between the respective carry inputs and an activation potential.

Inventors: MEHTA MAYUR M, MEHTA, MAYUR M.
Applicants: ADVANCED MICRO DEVICES INC, ADVANCED MICRO DEVICES, INC.
Application year: 1990
Main classification: G06F11
IPC codes: H03K23, H03K21, G01R31