A device that compares two input frequencies, producing an output proportional to the difference in phase between them. If the two inputs differ in frequency, the output is a periodic signal at the difference frequency. There are two basic types of phase detector. Type I is designed to be driven by analogue or square-wave signals. This can be simply an exclusive-OR gate for the square-wave signals. Linear phase detectors use balanced mixer circuits. Type II is a detector sensitive to the relative timing of the rising or falling edges of the two digital inputs, producing output pulses to indicate leading or lagging phase difference, with the width of the pulses being equal to the time between the compared edges. The output pulses will disappear entirely when the two input signals are exactly in phase.