CMOS strobed comparator with programmable hysteresis
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates to differential comparators for producing digital outputs, and, specifically, to the implementation of process and temperature invariant hysteresis. 
     2. Discussion of the Related Art 
     In an automotive setting, to reduce the amount of wiring in the wiring harnesses, a differential bus arrangement similar to an ethernet is constructed to which several devices are connected. Since the devices share bandwidth on the bus, the differential bus must handle a high data rate. For a lengthy bus, the differential signal may be attenuated greatly in certain areas physically remote from the presently driving device. In order to receive digital information transmitted on the bus, a comparator is desired which can detect 50 mV p-p  input levels with a controlled level of hysteresis that is more than 8 mV but less than 15 mV. 
     As illustrated in FIG. 1, the common mode input voltage to the comparator is anywhere between the supply voltages, typically +5 V and ground. Valid output data must be available in 100 ns to meet the bandwidth requirement of the differential bus configuration. To accommodate the temperature range for an automotive application, the temperature range for this application is -40 to +155 degrees Celsius. Furthermore, the design must be robust over varying process comers produced during fabrication of the integrated circuit. 
     Several different design approaches were considered and found not adequate for all process corners or over the extremely wide temperature range of this application. 
     One approach is to use a comparator constructed with a standard differential pair and loaded by cross-coupled current mirrors with greater than unity gain and connected in such a way as to exhibit regenerative positive feedback, thus creating hysteresis. See, P. E. Allen and D. R. Holberg, CMOS Analog Circuit Design, New York: Holt Rinehart and Wilson, pp. 349-356, 1987. The level of hysteresis exhibited by this design is a function of the ratio of the positive feedback, the input stage transconductance, and the speed of the comparator coming out of saturation to change state with respect to changes in the input signal. The last two effects are strong functions of temperature and process variations. Due to the fact that the internal nodes saturate during operation, this comparator changes state too slowly for the present high speed application. Furthermore, the level of hysteresis is not adjustable, but rather is fixed by the circuit design and implementation. 
     The speed problem exhibited by the above-described design is somewhat improved by the design of Lionel M. De Weck, High Speed Comparator Having Controlled Hysteresis, U.S. Pat. No. 4,607,671, Jun. 2, 1987. But the hysteresis in this design is still set by the transconductance of the comparator input stage and, therefore, is still heavily dependent on process comers and temperature. 
     The comparator disclosed by David P. Laude, Precision CMOS Comparator With Hysteresis, U.S. Pat. No. 4,940,907, Jul. 10, 1990, attempts to fix the hysteresis problem by a replica bias method. However, the gain of the amplifier is relatively low because there is essentially only one gain stage. In order to acquire signals in 100 nanoseconds, this type of comparator requires a very high supply current. 
     Prior art comparators suffer either from process dependence or temperature dependence on the hysteresis level, or speed and power inadequacies. 
     SUMMARY OF THE INVENTION 
     The present invention provides a comparator that produces a digital output based upon a differential input signal and hysteresis. It is desirable to add hysteresis to the comparator, so that once it has settled on an output, in order to switch states so as-to detect the logically opposite output state, the differential input must change by an amount greater than 2 * V hysteresis . To inject positive feedback, a second differential pair is added. This feedback pair is nominally identical to the input pair. If the comparator has recently sensed a positive input of sufficient magnitude to drive the comparator output high, switches are turned on coupling a positive hysteresis voltage to the inputs of the feedback differential pair. By coupling a fixed current differential from the second differential pair to the input differential pair, the effective switching threshold of the comparator is changed. A non-overlapping clock generator is formed so that the switches will not turn on simultaneously so as to short the V hysteresis  reference voltage source. The V hysteresis  voltage source can be centered at any voltage that does not exceed the common mode range of the input pair. 
     According to a first alternative embodiment, the ratio of feedback is not unity, such that the hysteresis voltage is linearly related to the noise margin, but is not equal to the noise margin. This would have the effect that the V hysteresis  voltage would be multiplied by some factor in the inequalities which define the comparator&#39;s switching behavior. According to a second alternative embodiment, a more complicated switch matrix which can be used to provide a variety of different hysteresis voltage levels. By including a more complicated switch matrix having several taps, the level of hysteresis can be made programmable. In a third alternative embodiment, the comparator structure according to the present invention is easily translated so that the differential pairs are formed with p-channel transistors, and the current mirroring is done with n-channel transistors. According to a fourth alternative embodiment of the present invention, the programmable hysteresis can be applied to a sense amplifier. 
     The second alternative embodiment of the present invention is very useful in adaptive threshold systems. It is desirable that the noise margin be approximately 50% input range. Using the programmability of the hysteresis level according to the present invention, it is possible to optimally set the hysteresis voltage level using adaptive feedback techniques. 
     This invention virtually eliminates the effects of input stage transconductance on hysteresis. This eliminates the effects of processing and temperature on hysteresis and thresholds. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 illustrates a digital comparator and a model for the differential transmission medium and its driver. 
     FIG. 2 shows a CMOS circuit which is the preferred embodiment of the present invention. 
     FIG. 3 illustrates the noise immunity of the comparator according to the present invention. 
     FIG. 4 illustrates a switch matrix which is used to make the hysteresis level programmable according to a second alternative embodiment of the present invention. 
     FIG. 5 shows a CMOS circuit which is a third alternative embodiment of the present invention. 
     FIG. 6 shows a CMOS circuit which is a fourth alternative embodiment of the present invention. 
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     The present invention combines the differential difference amplifier structure described by E. Sackinger and W. Guggenbuhl, &#34;A Versatile Building Block: The CMOS Differential Difference Amplifier&#34;, IEEE J. Solid State Circuits, vol. SC-22 no. 2, pp. 287-294, April 1987, with the high speed strobed comparator technique described by Kevin E. Brehmer et al., High Input Impedance, High Gain CMOS Strobed Comparator, U.S. Pat. No. 4,717,838, Jan. 5, 1988. This invention virtually eliminates the effects of input stage transconductance on hysteresis. This eliminates the effects of processing and temperature on hysteresis and thresholds. The preferred embodiment of the present invention is illustrated in FIG. 2. 
     Consider first the nominal strobed comparator portion of the circuit (in which of transistors M3 and M4 carry no current). Neglecting, for the moment, the effect of transistors M3 and M4, transistors M1 and M2 form an input differential pair biased by current sourced from the drain of transistor M14. Transistors M1, M2 and M14, as configured in FIG. 2, form an input stage. The current sourced from the drain of transistor M14 is determined by the current mirror formed by transistors M13 and M14. A current mirror is a circuit in which the current flowing in one part of the circuit is replicated at least once in another part of the circuit. This is accomplished by forcing the second part of the circuit to operate under conditions which are as similar as possible to those in the first part of the circuit. Thus, the current from the current source I travels through the drain of transistor M13 and is reflected in transistor M14. The drain current from transistor M1 is reflected through the current mirror formed by transistors M5 and M6, such that the current through transistor M1 is essentially equal to the current through transistor M6. Likewise, the current from the drain of transistor M2 is reflected through the current mirror formed by transistors M7 and M8, such that the current through transistor M2 is essentially equal to the current through transistor M8. 
     The strobed comparator shown in FIG. 2 has a reset phase during which the drains of both transistors M9 and M10 are pulled low by switch transistors M11 and M12, respectively. This forces the outputs of inverters INV1 and INV2 high and leaves the crosscoupled set-reset latch 21 formed by NA1, NA2, INV3, INV4, 1NV5, and INV6 unchanged from its previous state. When the reset signal is brought low transistors M11 and M12 are turned off allowing the drains of transistors M9 and M10 to rise in response to the drain currents from transistors M6 and M8, respectively. Assuming that there is an imbalance in the input voltages, for instance V in+   is greater than V in- , then the drain current from transistor M8 will be greater than the drain current from transistor M6. This current imbalance causes the drain of transistor M10 to rise faster than the drain of transistor M9. Since the drain of transistor M10 is connected to the gate of transistor M9, the n-channel transistor M9 is turned on, thereby pulling the drain of transistor M9 low. Since the gate of transistor M10 is pulled low, the n-channel transistor M10 is turned off. Transistors M6, M8, M9, and M10, ratioed inverters INV1 and INV2, and set-reset latch 21, as configured in FIG. 2, form a detection stage. 
     Furthermore, inverters INV1 and INV2 are ratioed such that the switching thresholds for the inverters are lower than the normal switching threshold, which is half the supply voltage. This lowered switching threshold causes the Q out  and ˜Q out  outputs to be produced quickly. Since the drains of transistors M9 and M10 had been precharged low by the Reset signal, these drains have only to reach the reduced inverter thresholds of transistor M9 and M10 to cause the S-R latch 21 to acquire the proper comparator output value Q out . This ratioing is accomplished by making the n-channel pulldown transistors of inverters INV1 and INV2 wider than normal, such that the ratio of the pullup width to the pulldown width is less than the ratio of the n-type electron mobility to the p-type hole mobility. Eventually, when transistor M10 is turning off and transistor M9 is turning on, the drain of transistor M10 latches to the supply voltage V dd , while the drain of transistor M9 latches to ground. 
     If the comparator is in the process of a comparison which will ultimately produce a Q out  of one, by properly ratioing inverters INV1 and INV2, the drain of transistor M10 will rise to the lowered switching threshold of inverters INV2, causing the output of inverter INV2 to fall to a low logic level. When the output of inverter INV2 falls to a low logic level, the output of nand gate NA2 goes high, thereby setting the set-reset latch 21. Inverters INV3, INV4, 1NV5, and INV6 exist to provide the correct polarity of non-overlapping signals, to provide buffering to drive the capacitive loads of the switches S1, S2, S3, and S4, and to provide a sufficiently lengthy non-overlap period. Q out  and ˜Q out  are the comparator&#39;s complementary digital output. 
     It is desirable to add hysteresis to the comparator, so that once it has settled on an output Q out , in order to switch states so as to detect the logically opposite output state, the differential input must change by an mount greater than 2 * V hysteresis . When the last value of Q out  had been 0, the equation representing the detection of logic one is as follows. 
     
         V.sub.in+ -V.sub.in- &gt;+V.sub.hysteresis 
    
     However, after the above equation is satisfied, and an asserted Q out  output has been output by the setting of S-R output latch 21, the equation representing the detection of a logic zero changes to the following. 
     
         V.sub.in+ -V.sub.in- &lt;-V.sub.hysteresis 
    
     This hysteresis effect makes the comparator a device with memory, so that its present behavior is based upon the present inputs and state variables. 
     To inject positive feedback, a second differential pair, transistors M3 and M4, biased by current from the drain of transistor M15, is added. Transistors M3, M4, and M15, as configured in FIG. 2, form a feedback stage. Transistor M15 forms a current mirror with transistor M13, so that the current through transistor M15 is essentially identical to the current through transistor M13. This feedback pair transistors M3 and M4 is nominally identical to the input pair transistors M1 and M2 and the current sourced from the drain of transistor M15 is nominally identical to the current sourced by transistor M14. If the comparator has recently sensed a positive input of sufficient magnitude to drive Q out  high (and the inverted output ˜Q out  low), then switches S1 and S3 are turned on coupling a positive hysteresis voltage to the gates of transistors M4 and M3. This acts as positive feedback because transistor M4 will have a higher drain current than transistor M3--these current will sum in phase with the drain currents of transistors M2 and M1, respectively. The magnitude of the current differential between transistors M8 and M6 is increased by this positive feedback. 
     By coupling a fixed current differential from the second differential pair transistors M3 and M4 to the input differential pair transistors M1 and M2, the effective switching threshold of the comparator is changed as illustrated in FIG. 3. At time t=0 in FIG. 3, the comparator had previously output a one as Q out . At time t=t1, the Reset signal is deasserted. Since V in+  -V in-   is less than -V hysteresis , the comparator outputs an asserted Q out  output at time t=t1+tc (not shown), where tc is propagation delay time of the comparator. Although ringing and noise occur after t1, and although that ringing is sufficient as illustrated in FIG. 3 to cross the initial switching threshold of -V hysteresis  at times t=t2 and t3, the outputting of a one at time t=t1+tc causes the switching threshold to change to +V hysteresis  at that time t=t1+tc, so that the noise shown in FIG. 3 does no harm. The noise does not cause the comparator output Q out  to glitch or incorrectly change states. 
     If the past Q out  had been a one, when a negative going differential input V in+  -V in-   is injected to the input pair transistors M2 and M1, it will have to be more negative than -V hysteresis  in order for the comparator to change states. (In order for the sum of the drain currents from transistors M1 and M3 to be greater than the sum of the drain currents of transistors M2 and M4, V in+  -V in-   must be more negative than -V hysteresis .) When this happens and the output of the comparator changes states, switches S1 and S3 will be turned off and switches S2 and S4 will be turned on providing positive feedback once again. 
     NA1, NA2, INV3, INV4, INV5, and INV6 form a non-overlapping clock generator so that switches S1 and S2 (as well as switches S3 and S4) will not turn on simultaneously so as to short the V hysteresis  reference voltage source. These switches S1, S2, S3 and S4 are normally made with single n-channel transistors; however, they could be constructed of transmission gates just as easily, since both Q out  and ˜Q out  are available to turn on the p-channel devices of the transmission gates without adding additional inverters. The V hysteresis  voltage source can be centered at any voltage that does not exceed the common mode range of the input pair transistors M3 and M4. 
     There are several alternative embodiments to the present invention. For example, according to a first alternative embodiment, instead of designing the drain current through transistors M13, M14, and M15 to be equal, the current through transistor M15 could be less or greater than that in transistor M13. This could be accomplished by using a different transistor width for transistor M15 than for transistors M13 and M14. Alternatively if transistors M13, M14, and M15 are all the same size, a separate current mirror could drive transistor M15. This would have the effect that the V hysteresis  voltage would be multiplied by some factor representative of the current ratio between transistors M15 and M14 in the inequalities shown above which define the comparator&#39;s switching behavior. By the same token, the currents through transistors M6 and M8 can be made unequal, yet proportional, to the currents through transistors M5 and M7, respectively, by using a non-unity transistor width ratio between transistors M5 and M6 and between transistors M7 and M8. 
     According to a second alternative embodiment, FIG. 4 illustrates a more complicated switch matrix which can be used to provide a variety of different hysteresis voltage levels. On an integrated circuit, the resistor 41 could be implemented as a polysilicon resistor with several taps. Each tap 42 represents a fixed voltage some fraction of the supply voltage. Therefore, each tap 42 has a common resistive voltage divider relationship between the supply voltage and ground. A set of n-channel transistors 43 or pass gates form a multiplexor which connects the gate of transistor M4 to one voltage, and a separate set of n-channel transistors 44 or pass gates form another multiplexor which connects the gate of transistor M3 to another voltage. By including a more complicated switch matrix having several taps 42 as in FIG. 4, the level of hysteresis can be made programmable. For a switch matrix with N taps, where each tap can be connected to the gate of either transistors M3 or M4, there are N(N-1)/2 different non-zero complementary hysteresis voltages which can be selected. 
     In a third alternative embodiment, the comparator structure according to the present invention is easily translated so that the differential pairs are formed with p-channel transistors, and the current mirroring is done with n-channel transistors as shown in FIG. 5. The structure of the comparator in FIG. 5 is nearly identical to that of FIG. 2, except that the supply voltage V dd  and ground are reversed in relation, all transistor types are inverted in type, so that N-type is converted into P-type, and P-type is converted into N-type. Secondly, the nand gates NA1 and NA2 are transformed into nor gates NO1 and NO2 in the latch 51 so that both outputs Q out  and ˜Q out  are never low simultaneously, thereby shorting out the hysteresis supply voltage. If the switch matrix including S1, S2, S3, and S4 is also translated so that p-channel pass transistors are used to implement switches S1, S2, S3, and S4, then non-overlapping clocks of this type (never low simultaneously) are desired to prevent S3 and S4 from simultaneously conducting, and to prevent S1 and S2 from simultaneously conducting. 
     According to a fourth alternative embodiment of the present invention, the programmable hysteresis can be applied to a sense amplifier as shown in FIG. 6. Although simpler in terms of the total transistor count, the sense amplifier structure produces large current spikes which cause noise in the system. This noise is a result of the fact that no current is conducting until both differential pairs 61, 62, 63, and 64 are turned on by transistors 65 and 66, at which time a relatively large current begins to flow. 
     The second alternative embodiment of the present invention is very useful in adaptive threshold systems. For example, if the receiving comparator is at the end of a 1.5 kilometer cable, the differential signal amplitude is on the order of 100 mV. In contrast, if the receiver is at the end of a 100 foot cable, the differential signal amplitude will be on the order of 2 volts. If the differential signal amplitude is on the order of 2 volts, the differential signal will have tails and noise components which are on the order of hundreds of millivolts. Thus, it is not desirable to have the hysteresis voltage set at 100 mV when the differential signal level is 2 volts, since very little noise immunity is gained by using hysteresis in this manner, because the noise margin V hysteresis  of 100 mV is only 5% of the input voltage V in+  -V in-   range. This noise margin is very narrow. It is desirable that the noise margin be approximately 50% input range. Using the programmability of the hysteresis level according to the present invention, it is possible to optimally set the hysteresis voltage level using adaptive feedback techniques such as described below. 
     Upon initially turning the comparator on, the hysteresis voltage is set to a level indicative of the best guess of the differential signal amplitude. A second comparator takes the differential signal as input, and has an offset voltage that is twice the hysteresis voltage of the first comparator. Periodically, over large blocks of data, a state machine will review the outputs of the two comparators. Optimally, for those clock cycles during which the first comparator detected a one, the second comparator will have detected that its offset voltage was exceeded during 50% of those clock cycles. If the second comparator&#39;s offset threshold was exceeded less than 50% of the time, the state machine adjusts the hysteresis level of the first comparator downward and adjusts the offset level of the second comparator downward twice as far. Similarly, if the second comparator&#39;s offset threshold was exceeded during more than 50% of the clock cycles during which the first comparator&#39;s offset threshold was exceeded, the state machine adjusts the hysteresis level of the first comparator upward and adjusts the offset level of the second comparator upward twice as far. Using this feedback strategy, the system will converge so that the hysteresis voltage is set at half the average peak differential signal amplitude. This is an effective way to control bias distortion, and thus to provide a lower bit error rate. 
     This invention virtually eliminates the effects of input stage transconductance on hysteresis. This eliminates the effects of processing and temperature on hysteresis and thresholds. The 10 Mz comparator (100 ns) can be realized dissipating only 1 mW of power. 
     The apparatuses of the present invention have been described in terms of its presently preferred embodiment and its four alternative embodiments. Those skilled in the art will recognize that the present invention may be practiced with modification and alteration within the spirit and scope of the appended claims. Therefore, the specifications and drawings are to be regarded in an illustrative rather than a restrictive sense.